diff --git a/.hgignore b/.hgignore index a8a244596d44cdb3d3be789af06cd4dda54ce7e7..f3fca9bcb29629f082b8281445a4822a1c422425 100755 --- a/.hgignore +++ b/.hgignore @@ -75,4 +75,6 @@ glob:indra/newview/filters.xml glob:indra/newview/avatar_icons_cache.txt glob:indra/newview/avatar_lad.log glob:*.diff -#*.rej +indra/newview/pilot.txt +indra/newview/pilot.xml +*.rej diff --git a/.hgtags b/.hgtags index 08f079a3a1e929a292c4dd519c429b6ba9478945..c36ce93d0e16c756c78f8a5f20b24b6cd5732cc5 100755 --- a/.hgtags +++ b/.hgtags @@ -479,3 +479,4 @@ b842534cb4d76c9ef87676a62b1d2d19e79c015f 3.7.2-release d076568ff7883b41c149e6afb421f39c29dbfe2b 3.7.4-release fc066b82343fca51f9c1b8eda0abc6bee9bb4503 3.7.5-release d029faf69f20a23007f32420a1ac6a3b89a6d441 3.7.6-release +83959480cb986522d07b151a0c778ab7f920d41b 3.7.7-release diff --git a/BuildParams b/BuildParams index 51434a49126162bb39d5b2346422dee3fc3490f9..1c9534ad7c7ce7f758a97874d19f7d2fb287af8f 100755 --- a/BuildParams +++ b/BuildParams @@ -201,8 +201,6 @@ runway.viewer_grid = agni runway.build_debug_release_separately = true runway.build_CYGWIN_Debug = false runway.build_viewer_update_version_manager = false - - # eof diff --git a/autobuild.xml b/autobuild.xml index 468a7c6182b09315f9fdd4ee9cd20daf0338225f..1d827cb6c44be82e45d81e4f0ee8ec1f8d7d5414 100755 --- a/autobuild.xml +++ b/autobuild.xml @@ -764,7 +764,7 @@ <key>hash</key> <string>aff5566e04003de0383941981198e04e</string> <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-breakpad/rev/273073/arch/Darwin/installer/google_breakpad-0.0.0-rev1099-darwin-20130329.tar.bz2</string> + <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-breakpad/rev/273073/arch/Darwin/installer/google_breakpad-0.0.0-rev1099-darwin-20130329.tar.bz2</string> </map> <key>name</key> <string>darwin</string> @@ -776,7 +776,7 @@ <key>hash</key> <string>52257e5eb166a0b69c9c0c38f6e1920e</string> <key>url</key> - <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-breakpad/rev/273079/arch/Linux/installer/google_breakpad-0.0.0-rev1099-linux-20130329.tar.bz2</string> + <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-google-breakpad/rev/273079/arch/Linux/installer/google_breakpad-0.0.0-rev1099-linux-20130329.tar.bz2</string> </map> <key>name</key> <string>linux</string> @@ -1290,9 +1290,9 @@ <key>archive</key> <map> <key>hash</key> - <string>5bc44db15eb3cca021382e40e04a9a38</string> + <string>b6d29de20de5c8f31925697b30e8f727</string> <key>url</key> - <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/271972/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130315.tar.bz2</string> + <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/283723/arch/Linux/installer/llappearanceutility_source-0.1-linux-20131109.tar.bz2</string> </map> <key>name</key> <string>linux</string> diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 87484f4ae3628c2957555b9da678944af0284592..1d78638143f53de932e8990a1645cc419853f97d 100755 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -61,6 +61,7 @@ if (WINDOWS) add_definitions( /DLL_WINDOWS=1 + /DNOMINMAX /DDOM_DYNAMIC /DUNICODE /D_UNICODE diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake old mode 100644 new mode 100755 index 9bb3077797db94c929b803c68a4f977a51c354d1..068aeea2129349073ba0f1e00b446630566fc6e7 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -211,7 +211,7 @@ FUNCTION(LL_ADD_INTEGRATION_TEST if (WINDOWS) SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES - LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS" + LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE" LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO" LINK_FLAGS_RELEASE "" ) diff --git a/indra/integration_tests/llui_libtest/llui_libtest.cpp b/indra/integration_tests/llui_libtest/llui_libtest.cpp index 38aa1bbeb2a7a4e6f9f2ff497eae96b25c8b4b3c..a0418f09d50b21867074cb178057b4a7afb1f2d4 100755 --- a/indra/integration_tests/llui_libtest/llui_libtest.cpp +++ b/indra/integration_tests/llui_libtest/llui_libtest.cpp @@ -182,7 +182,7 @@ void export_test_floaters() // don't re-export other test floaters continue; } - llinfos << "Converting " << filename << llendl; + LL_INFOS() << "Converting " << filename << LL_ENDL; // Build a floater and output new attributes LLXMLNodePtr output_node = new LLXMLNode(); LLFloater* floater = new LLFloater(LLSD()); @@ -194,7 +194,7 @@ void export_test_floaters() out_filename.resize(extension_pos); out_filename += "_new.xml"; - llinfos << "Output: " << out_filename << llendl; + LL_INFOS() << "Output: " << out_filename << LL_ENDL; LLFILE* floater_file = LLFile::fopen(out_filename.c_str(), "w"); LLXMLNode::writeHeaderToFile(floater_file); output_node->writeToFile(floater_file); diff --git a/indra/linux_crash_logger/linux_crash_logger.cpp b/indra/linux_crash_logger/linux_crash_logger.cpp index d4e7ad7be33d23c8c687d8d31ed970fbc5621e26..36f62451d7e37d9d1a89d3c274185dac129a3f50 100755 --- a/indra/linux_crash_logger/linux_crash_logger.cpp +++ b/indra/linux_crash_logger/linux_crash_logger.cpp @@ -30,7 +30,7 @@ int main(int argc, char **argv) { - llinfos << "Starting crash reporter." << llendl; + LL_INFOS() << "Starting crash reporter." << LL_ENDL; LLCrashLoggerLinux app; app.parseCommandOptions(argc, argv); @@ -47,12 +47,12 @@ int main(int argc, char **argv) if (! app.init()) { - llwarns << "Unable to initialize application." << llendl; + LL_WARNS() << "Unable to initialize application." << LL_ENDL; return 1; } app.mainLoop(); app.cleanup(); - llinfos << "Crash reporter finished normally." << llendl; + LL_INFOS() << "Crash reporter finished normally." << LL_ENDL; return 0; } diff --git a/indra/linux_crash_logger/llcrashloggerlinux.cpp b/indra/linux_crash_logger/llcrashloggerlinux.cpp index 871d6377cb262203bb0f37d97577a163af076a92..e2d2e7ff26949fdfbfdc9c81db9520badbf255f2 100755 --- a/indra/linux_crash_logger/llcrashloggerlinux.cpp +++ b/indra/linux_crash_logger/llcrashloggerlinux.cpp @@ -71,7 +71,7 @@ static BOOL do_ask_dialog(void) #if LL_GTK gtk_disable_setlocale(); if (!gtk_init_check(NULL, NULL)) { - llinfos << "Could not initialize GTK for 'ask to send crash report' dialog; not sending report." << llendl; + LL_INFOS() << "Could not initialize GTK for 'ask to send crash report' dialog; not sending report." << LL_ENDL; return FALSE; } diff --git a/indra/linux_updater/linux_updater.cpp b/indra/linux_updater/linux_updater.cpp index 86fa596aef6d98d0eb982aed22a796e64376c88f..5c94deba0215e737749a40f88a979f11dcdf2f7e 100644 --- a/indra/linux_updater/linux_updater.cpp +++ b/indra/linux_updater/linux_updater.cpp @@ -28,6 +28,8 @@ #include <unistd.h> #include <signal.h> #include <errno.h> +#include <set> +#include <iostream> #include "linden_common.h" #include "llerrorcontrol.h" @@ -315,9 +317,9 @@ gpointer worker_thread_cb(gpointer data) ("secondlife-update-XXXXXX", &tmp_local_filename, &error); if (error != NULL) { - llerrs << "Unable to create temporary file: " + LL_ERRS() << "Unable to create temporary file: " << error->message - << llendl; + << LL_ENDL; g_error_free(error); throw 0; @@ -332,9 +334,9 @@ gpointer worker_thread_cb(gpointer data) package_file = fdopen(fd, "wb"); if (package_file == NULL) { - llerrs << "Failed to create temporary file: " + LL_ERRS() << "Failed to create temporary file: " << app_state->file.c_str() - << llendl; + << LL_ENDL; gdk_threads_enter(); display_error(app_state->window, @@ -345,12 +347,12 @@ gpointer worker_thread_cb(gpointer data) } // initialize curl and start downloading the package - llinfos << "Downloading package: " << app_state->url << llendl; + LL_INFOS() << "Downloading package: " << app_state->url << LL_ENDL; curl = curl_easy_init(); if (curl == NULL) { - llerrs << "Failed to initialize libcurl" << llendl; + LL_ERRS() << "Failed to initialize libcurl" << LL_ENDL; gdk_threads_enter(); display_error(app_state->window, @@ -375,9 +377,9 @@ gpointer worker_thread_cb(gpointer data) if (result) { - llerrs << "Failed to download update: " + LL_ERRS() << "Failed to download update: " << app_state->url - << llendl; + << LL_ENDL; gdk_threads_enter(); display_error(app_state->window, @@ -403,9 +405,9 @@ gpointer worker_thread_cb(gpointer data) // thread and show file chooser? if (!install_package(app_state->file.c_str(), app_state->dest_dir)) { - llwarns << "Failed to install package to destination: " + LL_WARNS() << "Failed to install package to destination: " << app_state->dest_dir - << llendl; + << LL_ENDL; gdk_threads_enter(); display_error(app_state->window, @@ -419,9 +421,9 @@ gpointer worker_thread_cb(gpointer data) // try to spawn the new viewer if (!spawn_viewer(app_state)) { - llwarns << "Viewer was not installed properly in : " + LL_WARNS() << "Viewer was not installed properly in : " << app_state->dest_dir - << llendl; + << LL_ENDL; gdk_threads_enter(); display_error(app_state->window, @@ -481,10 +483,10 @@ int rename_with_sudo_fallback(const std::string& filename, const std::string& newname) { int rtncode = ::rename(filename.c_str(), newname.c_str()); - lldebugs << "rename result is: " << rtncode << " / " << errno << llendl; + LL_DEBUGS() << "rename result is: " << rtncode << " / " << errno << LL_ENDL; if (rtncode && (EACCES == errno || EPERM == errno || EXDEV == errno)) { - llinfos << "Permission problem in rename, or moving between different mount points. Retrying as a mv under a sudo." << llendl; + LL_INFOS() << "Permission problem in rename, or moving between different mount points. Retrying as a mv under a sudo." << LL_ENDL; // failed due to permissions, try again as a gksudo or kdesu mv wrapper hack char *sudo_cmd = NULL; sudo_cmd = g_find_program_in_path("gksudo"); @@ -515,15 +517,15 @@ rename_with_sudo_fallback(const std::string& filename, const std::string& newnam if (!less_anal_gspawnsync(argv, &stderr_output, &child_exit_status, &spawn_error)) { - llwarns << "Failed to spawn child process: " + LL_WARNS() << "Failed to spawn child process: " << spawn_error->message - << llendl; + << LL_ENDL; } else if (child_exit_status) { - llwarns << "mv command failed: " + LL_WARNS() << "mv command failed: " << (stderr_output ? stderr_output : "(no reason given)") - << llendl; + << LL_ENDL; } else { @@ -549,19 +551,19 @@ gboolean install_package(std::string package_file, std::string destination) tar_cmd = g_find_program_in_path("tar"); if (!tar_cmd) { - llerrs << "`tar' was not found in $PATH" << llendl; + LL_ERRS() << "`tar' was not found in $PATH" << LL_ENDL; return FALSE; } - llinfos << "Found tar command: " << tar_cmd << llendl; + LL_INFOS() << "Found tar command: " << tar_cmd << LL_ENDL; // Unpack the tarball in a temporary place first, then move it to // its final destination std::string tmp_dest_dir = gDirUtilp->getTempFilename(); if (LLFile::mkdir(tmp_dest_dir, 0744)) { - llerrs << "Failed to create directory: " + LL_ERRS() << "Failed to create directory: " << destination - << llendl; + << LL_ENDL; return FALSE; } @@ -577,7 +579,7 @@ gboolean install_package(std::string package_file, std::string destination) NULL, }; - llinfos << "Untarring package: " << package_file << llendl; + LL_INFOS() << "Untarring package: " << package_file << LL_ENDL; // store current SIGCHLD handler if there is one, replace with default // handler to make glib happy @@ -594,17 +596,17 @@ gboolean install_package(std::string package_file, std::string destination) if (!less_anal_gspawnsync(argv, &stderr_output, &child_exit_status, &untar_error)) { - llwarns << "Failed to spawn child process: " + LL_WARNS() << "Failed to spawn child process: " << untar_error->message - << llendl; + << LL_ENDL; return FALSE; } if (child_exit_status) { - llwarns << "Untar command failed: " + LL_WARNS() << "Untar command failed: " << (stderr_output ? stderr_output : "(no reason given)") - << llendl; + << LL_ENDL; return FALSE; } @@ -628,9 +630,9 @@ gboolean install_package(std::string package_file, std::string destination) if (rename_with_sudo_fallback(destination, backup_dir)) { - llwarns << "Failed to move directory: '" + LL_WARNS() << "Failed to move directory: '" << destination << "' -> '" << backup_dir - << llendl; + << LL_ENDL; return FALSE; } } @@ -639,9 +641,9 @@ gboolean install_package(std::string package_file, std::string destination) // need to move it to its destination. if (rename_with_sudo_fallback(tmp_dest_dir, destination)) { - llwarns << "Failed to move installation to the destination: " + LL_WARNS() << "Failed to move installation to the destination: " << destination - << llendl; + << LL_ENDL; return FALSE; } @@ -736,8 +738,8 @@ BOOL spawn_viewer(UpdaterAppState *app_state) if (!success) { - llwarns << "Failed to launch viewer: " << error->message - << llendl; + LL_WARNS() << "Failed to launch viewer: " << error->message + << LL_ENDL; } if (error) g_error_free(error); @@ -838,7 +840,7 @@ int main(int argc, char **argv) // create UI updater_app_ui_init(app_state); - //llinfos << "SAMPLE TRANSLATION IS: " << LLTrans::getString("LoginInProgress") << llendl; + //LL_INFOS() << "SAMPLE TRANSLATION IS: " << LLTrans::getString("LoginInProgress") << LL_ENDL; // create download thread g_thread_create(GThreadFunc(worker_thread_cb), app_state, FALSE, NULL); diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index 0f5d729e77e1bd0662f9b435056acdac1ef07c3b..41fcb6ce4baab9a8e30c55df493372354e7553e0 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -35,15 +35,15 @@ #include "llavatarappearance.h" #include "llavatarappearancedefines.h" #include "llavatarjointmesh.h" -#include "imageids.h" +#include "llstl.h" #include "lldir.h" -#include "lldeleteutils.h" #include "llpolymorph.h" #include "llpolymesh.h" #include "llpolyskeletaldistortion.h" #include "llstl.h" #include "lltexglobalcolor.h" #include "llwearabledata.h" +#include "boost/bind.hpp" #if LL_MSVC @@ -142,9 +142,9 @@ LLAvatarAppearance::LLAvatarXmlInfo::~LLAvatarXmlInfo() std::for_each(mAttachmentInfoList.begin(), mAttachmentInfoList.end(), DeletePointer()); mAttachmentInfoList.clear(); - deleteAndClear(mTexSkinColorInfo); - deleteAndClear(mTexHairColorInfo); - deleteAndClear(mTexEyeColorInfo); + delete_and_clear(mTexSkinColorInfo); + delete_and_clear(mTexHairColorInfo); + delete_and_clear(mTexEyeColorInfo); std::for_each(mLayerInfoList.begin(), mLayerInfoList.end(), DeletePointer()); mLayerInfoList.clear(); @@ -235,7 +235,7 @@ void LLAvatarAppearance::initInstance() mesh->setMeshID(mesh_index); mesh->setPickName(mesh_dict->mPickName); mesh->setIsTransparent(FALSE); - switch((int)mesh_index) + switch((S32)mesh_index) { case MESH_ID_HAIR: mesh->setIsTransparent(TRUE); @@ -271,7 +271,7 @@ void LLAvatarAppearance::initInstance() ++iter) { LLAvatarJointMesh* mesh = (*iter); - mBakedTextureDatas[(int)baked_texture_index].mJointMeshes.push_back(mesh); + mBakedTextureDatas[(S32)baked_texture_index].mJointMeshes.push_back(mesh); } } @@ -282,13 +282,13 @@ void LLAvatarAppearance::initInstance() // virtual LLAvatarAppearance::~LLAvatarAppearance() { - deleteAndClear(mTexSkinColor); - deleteAndClear(mTexHairColor); - deleteAndClear(mTexEyeColor); + delete_and_clear(mTexSkinColor); + delete_and_clear(mTexHairColor); + delete_and_clear(mTexEyeColor); for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - deleteAndClear(mBakedTextureDatas[i].mTexLayerSet); + delete_and_clear(mBakedTextureDatas[i].mTexLayerSet); mBakedTextureDatas[i].mJointMeshes.clear(); for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin(); @@ -303,7 +303,7 @@ LLAvatarAppearance::~LLAvatarAppearance() mJointMap.clear(); clearSkeleton(); - deleteAndClearArray(mCollisionVolumes); + delete_and_clear_array(mCollisionVolumes); std::for_each(mPolyMeshes.begin(), mPolyMeshes.end(), DeletePairedPointer()); mPolyMeshes.clear(); @@ -329,14 +329,14 @@ void LLAvatarAppearance::initClass() BOOL success = sXMLTree.parseFile( xmlFile, FALSE ); if (!success) { - llerrs << "Problem reading avatar configuration file:" << xmlFile << llendl; + LL_ERRS() << "Problem reading avatar configuration file:" << xmlFile << LL_ENDL; } // now sanity check xml file LLXmlTreeNode* root = sXMLTree.getRoot(); if (!root) { - llerrs << "No root node found in avatar configuration file: " << xmlFile << llendl; + LL_ERRS() << "No root node found in avatar configuration file: " << xmlFile << LL_ENDL; return; } @@ -345,14 +345,14 @@ void LLAvatarAppearance::initClass() //------------------------------------------------------------------------- if( !root->hasName( "linden_avatar" ) ) { - llerrs << "Invalid avatar file header: " << xmlFile << llendl; + LL_ERRS() << "Invalid avatar file header: " << xmlFile << LL_ENDL; } std::string version; static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) { - llerrs << "Invalid avatar file version: " << version << " in file: " << xmlFile << llendl; + LL_ERRS() << "Invalid avatar file version: " << version << " in file: " << xmlFile << LL_ENDL; } S32 wearable_def_version = 1; @@ -365,7 +365,7 @@ void LLAvatarAppearance::initClass() LLXmlTreeNode* skeleton_node = root->getChildByName( "skeleton" ); if (!skeleton_node) { - llerrs << "No skeleton in avatar configuration file: " << xmlFile << llendl; + LL_ERRS() << "No skeleton in avatar configuration file: " << xmlFile << LL_ENDL; return; } @@ -373,14 +373,14 @@ void LLAvatarAppearance::initClass() static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); if (!skeleton_node->getFastAttributeString(file_name_string, skeleton_file_name)) { - llerrs << "No file name in skeleton node in avatar config file: " << xmlFile << llendl; + LL_ERRS() << "No file name in skeleton node in avatar config file: " << xmlFile << LL_ENDL; } std::string skeleton_path; skeleton_path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,skeleton_file_name); if (!parseSkeletonFile(skeleton_path)) { - llerrs << "Error parsing skeleton file: " << skeleton_path << llendl; + LL_ERRS() << "Error parsing skeleton file: " << skeleton_path << LL_ENDL; } // Process XML data @@ -393,43 +393,43 @@ void LLAvatarAppearance::initClass() sAvatarSkeletonInfo = new LLAvatarSkeletonInfo; if (!sAvatarSkeletonInfo->parseXml(sSkeletonXMLTree.getRoot())) { - llerrs << "Error parsing skeleton XML file: " << skeleton_path << llendl; + LL_ERRS() << "Error parsing skeleton XML file: " << skeleton_path << LL_ENDL; } // parse avatar_lad.xml if (sAvatarXmlInfo) { //this can happen if a login attempt failed - deleteAndClear(sAvatarXmlInfo); + delete_and_clear(sAvatarXmlInfo); } sAvatarXmlInfo = new LLAvatarXmlInfo; if (!sAvatarXmlInfo->parseXmlSkeletonNode(root)) { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; + LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL; } if (!sAvatarXmlInfo->parseXmlMeshNodes(root)) { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; + LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL; } if (!sAvatarXmlInfo->parseXmlColorNodes(root)) { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; + LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL; } if (!sAvatarXmlInfo->parseXmlLayerNodes(root)) { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; + LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL; } if (!sAvatarXmlInfo->parseXmlDriverNodes(root)) { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; + LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL; } if (!sAvatarXmlInfo->parseXmlMorphNodes(root)) { - llerrs << "Error parsing skeleton node in avatar XML file: " << skeleton_path << llendl; + LL_ERRS() << "Error parsing skeleton node in avatar XML file: " << skeleton_path << LL_ENDL; } } void LLAvatarAppearance::cleanupClass() { - deleteAndClear(sAvatarXmlInfo); + delete_and_clear(sAvatarXmlInfo); // *TODO: What about sAvatarSkeletonInfo ??? sSkeletonXMLTree.cleanup(); sXMLTree.cleanup(); @@ -536,7 +536,7 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename) if (!parsesuccess) { - llerrs << "Can't parse skeleton file: " << filename << llendl; + LL_ERRS() << "Can't parse skeleton file: " << filename << LL_ENDL; return FALSE; } @@ -544,13 +544,13 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename) LLXmlTreeNode* root = sSkeletonXMLTree.getRoot(); if (!root) { - llerrs << "No root node found in avatar skeleton file: " << filename << llendl; + LL_ERRS() << "No root node found in avatar skeleton file: " << filename << LL_ENDL; return FALSE; } if( !root->hasName( "linden_skeleton" ) ) { - llerrs << "Invalid avatar skeleton file header: " << filename << llendl; + LL_ERRS() << "Invalid avatar skeleton file header: " << filename << LL_ENDL; return FALSE; } @@ -558,7 +558,7 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename) static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) { - llerrs << "Invalid avatar skeleton file version: " << version << " in file: " << filename << llendl; + LL_ERRS() << "Invalid avatar skeleton file version: " << version << " in file: " << filename << LL_ENDL; return FALSE; } @@ -577,7 +577,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent joint = getCharacterJoint(joint_num); if (!joint) { - llwarns << "Too many bones" << llendl; + LL_WARNS() << "Too many bones" << LL_ENDL; return FALSE; } joint->setName( info->mName ); @@ -586,7 +586,7 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent { if (volume_num >= (S32)mNumCollisionVolumes) { - llwarns << "Too many bones" << llendl; + LL_WARNS() << "Too many bones" << LL_ENDL; return FALSE; } joint = (&mCollisionVolumes[volume_num]); @@ -656,7 +656,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) //------------------------------------------------------------------------- if (!allocateCharacterJoints(info->mNumBones)) { - llerrs << "Can't allocate " << info->mNumBones << " joints" << llendl; + LL_ERRS() << "Can't allocate " << info->mNumBones << " joints" << LL_ENDL; return FALSE; } @@ -667,7 +667,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) { if (!allocateCollisionVolumes(info->mNumCollisionVolumes)) { - llerrs << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << llendl; + LL_ERRS() << "Can't allocate " << info->mNumCollisionVolumes << " collision volumes" << LL_ENDL; return FALSE; } } @@ -680,7 +680,7 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) LLAvatarBoneInfo *info = *iter; if (!setupBone(info, NULL, current_volume_num, current_joint_num)) { - llerrs << "Error parsing bone in skeleton file" << llendl; + LL_ERRS() << "Error parsing bone in skeleton file" << LL_ENDL; return FALSE; } } @@ -740,17 +740,17 @@ void LLAvatarAppearance::buildCharacter() stop_glerror(); // gPrintMessagesThisFrame = TRUE; - lldebugs << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << llendl; + LL_DEBUGS() << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << LL_ENDL; if (!status) { if (isSelf()) { - llerrs << "Unable to load user's avatar" << llendl; + LL_ERRS() << "Unable to load user's avatar" << LL_ENDL; } else { - llwarns << "Unable to load other's avatar" << llendl; + LL_WARNS() << "Unable to load other's avatar" << LL_ENDL; } return; } @@ -799,7 +799,7 @@ void LLAvatarAppearance::buildCharacter() mEyeLeftp && mEyeRightp)) { - llerrs << "Failed to create avatar." << llendl; + LL_ERRS() << "Failed to create avatar." << LL_ENDL; return; } @@ -815,26 +815,26 @@ void LLAvatarAppearance::buildCharacter() BOOL LLAvatarAppearance::loadAvatar() { -// LLFastTimer t(FTM_LOAD_AVATAR); +// LL_RECORD_BLOCK_TIME(FTM_LOAD_AVATAR); // avatar_skeleton.xml if( !buildSkeleton(sAvatarSkeletonInfo) ) { - llwarns << "avatar file: buildSkeleton() failed" << llendl; + LL_WARNS() << "avatar file: buildSkeleton() failed" << LL_ENDL; return FALSE; } // avatar_lad.xml : <skeleton> if( !loadSkeletonNode() ) { - llwarns << "avatar file: loadNodeSkeleton() failed" << llendl; + LL_WARNS() << "avatar file: loadNodeSkeleton() failed" << LL_ENDL; return FALSE; } // avatar_lad.xml : <mesh> if( !loadMeshNodes() ) { - llwarns << "avatar file: loadNodeMesh() failed" << llendl; + LL_WARNS() << "avatar file: loadNodeMesh() failed" << LL_ENDL; return FALSE; } @@ -844,13 +844,13 @@ BOOL LLAvatarAppearance::loadAvatar() mTexSkinColor = new LLTexGlobalColor( this ); if( !mTexSkinColor->setInfo( sAvatarXmlInfo->mTexSkinColorInfo ) ) { - llwarns << "avatar file: mTexSkinColor->setInfo() failed" << llendl; + LL_WARNS() << "avatar file: mTexSkinColor->setInfo() failed" << LL_ENDL; return FALSE; } } else { - llwarns << "<global_color> name=\"skin_color\" not found" << llendl; + LL_WARNS() << "<global_color> name=\"skin_color\" not found" << LL_ENDL; return FALSE; } if( sAvatarXmlInfo->mTexHairColorInfo ) @@ -858,13 +858,13 @@ BOOL LLAvatarAppearance::loadAvatar() mTexHairColor = new LLTexGlobalColor( this ); if( !mTexHairColor->setInfo( sAvatarXmlInfo->mTexHairColorInfo ) ) { - llwarns << "avatar file: mTexHairColor->setInfo() failed" << llendl; + LL_WARNS() << "avatar file: mTexHairColor->setInfo() failed" << LL_ENDL; return FALSE; } } else { - llwarns << "<global_color> name=\"hair_color\" not found" << llendl; + LL_WARNS() << "<global_color> name=\"hair_color\" not found" << LL_ENDL; return FALSE; } if( sAvatarXmlInfo->mTexEyeColorInfo ) @@ -872,26 +872,26 @@ BOOL LLAvatarAppearance::loadAvatar() mTexEyeColor = new LLTexGlobalColor( this ); if( !mTexEyeColor->setInfo( sAvatarXmlInfo->mTexEyeColorInfo ) ) { - llwarns << "avatar file: mTexEyeColor->setInfo() failed" << llendl; + LL_WARNS() << "avatar file: mTexEyeColor->setInfo() failed" << LL_ENDL; return FALSE; } } else { - llwarns << "<global_color> name=\"eye_color\" not found" << llendl; + LL_WARNS() << "<global_color> name=\"eye_color\" not found" << LL_ENDL; return FALSE; } // avatar_lad.xml : <layer_set> if (sAvatarXmlInfo->mLayerInfoList.empty()) { - llwarns << "avatar file: missing <layer_set> node" << llendl; + LL_WARNS() << "avatar file: missing <layer_set> node" << LL_ENDL; return FALSE; } if (sAvatarXmlInfo->mMorphMaskInfoList.empty()) { - llwarns << "avatar file: missing <morph_masks> node" << llendl; + LL_WARNS() << "avatar file: missing <morph_masks> node" << LL_ENDL; return FALSE; } @@ -933,14 +933,14 @@ BOOL LLAvatarAppearance::loadAvatar() LLVisualParam*(LLAvatarAppearance::*avatar_function)(S32)const = &LLAvatarAppearance::getVisualParam; if( !driver_param->linkDrivenParams(boost::bind(avatar_function,(LLAvatarAppearance*)this,_1 ), false)) { - llwarns << "could not link driven params for avatar " << getID().asString() << " param id: " << driver_param->getID() << llendl; + LL_WARNS() << "could not link driven params for avatar " << getID().asString() << " param id: " << driver_param->getID() << LL_ENDL; continue; } } else { delete driver_param; - llwarns << "avatar file: driver_param->parseData() failed" << llendl; + LL_WARNS() << "avatar file: driver_param->parseData() failed" << LL_ENDL; return FALSE; } } @@ -1060,17 +1060,17 @@ BOOL LLAvatarAppearance::loadMeshNodes() } else { - llwarns << "Avatar file: <mesh> has invalid lod setting " << lod << llendl; + LL_WARNS() << "Avatar file: <mesh> has invalid lod setting " << lod << LL_ENDL; return FALSE; } } else { - llwarns << "Ignoring unrecognized mesh type: " << type << llendl; + LL_WARNS() << "Ignoring unrecognized mesh type: " << type << LL_ENDL; return FALSE; } - // llinfos << "Parsing mesh data for " << type << "..." << llendl; + // LL_INFOS() << "Parsing mesh data for " << type << "..." << LL_ENDL; // If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings. // Do not touch!!! @@ -1100,7 +1100,7 @@ BOOL LLAvatarAppearance::loadMeshNodes() if( !poly_mesh ) { - llwarns << "Failed to load mesh of type " << type << llendl; + LL_WARNS() << "Failed to load mesh of type " << type << LL_ENDL; return FALSE; } @@ -1160,7 +1160,7 @@ BOOL LLAvatarAppearance::loadLayersets() { stop_glerror(); delete layer_set; - llwarns << "avatar file: layer_set->setInfo() failed" << llendl; + LL_WARNS() << "avatar file: layer_set->setInfo() failed" << LL_ENDL; return FALSE; } @@ -1183,7 +1183,7 @@ BOOL LLAvatarAppearance::loadLayersets() // if no baked texture was found, warn and cleanup if (baked_index == BAKED_NUM_INDICES) { - llwarns << "<layer_set> has invalid body_region attribute" << llendl; + LL_WARNS() << "<layer_set> has invalid body_region attribute" << LL_ENDL; delete layer_set; return FALSE; } @@ -1201,7 +1201,7 @@ BOOL LLAvatarAppearance::loadLayersets() } else { - llwarns << "Could not find layer named " << morph->mLayer << " to set morph flag" << llendl; + LL_WARNS() << "Could not find layer named " << morph->mLayer << " to set morph flag" << LL_ENDL; success = FALSE; } } @@ -1297,7 +1297,7 @@ BOOL LLAvatarAppearance::isValid() const // This should only be called on ourself. if (!isSelf()) { - llerrs << "Called LLAvatarAppearance::isValid() on when isSelf() == false" << llendl; + LL_ERRS() << "Called LLAvatarAppearance::isValid() on when isSelf() == false" << LL_ENDL; } return TRUE; } @@ -1462,7 +1462,7 @@ LLTexLayerSet* LLAvatarAppearance::getAvatarLayerSet(EBakedTextureIndex baked_in //----------------------------------------------------------------------------- BOOL LLAvatarAppearance::allocateCollisionVolumes( U32 num ) { - deleteAndClearArray(mCollisionVolumes); + delete_and_clear_array(mCollisionVolumes); mNumCollisionVolumes = 0; mCollisionVolumes = new LLAvatarJointCollisionVolume[num]; @@ -1486,7 +1486,7 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (!node->getFastAttributeString(name_string, mName)) { - llwarns << "Bone without name" << llendl; + LL_WARNS() << "Bone without name" << LL_ENDL; return FALSE; } } @@ -1501,28 +1501,28 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node) } else { - llwarns << "Invalid node " << node->getName() << llendl; + LL_WARNS() << "Invalid node " << node->getName() << LL_ENDL; return FALSE; } static LLStdStringHandle pos_string = LLXmlTree::addAttributeString("pos"); if (!node->getFastAttributeVector3(pos_string, mPos)) { - llwarns << "Bone without position" << llendl; + LL_WARNS() << "Bone without position" << LL_ENDL; return FALSE; } static LLStdStringHandle rot_string = LLXmlTree::addAttributeString("rot"); if (!node->getFastAttributeVector3(rot_string, mRot)) { - llwarns << "Bone without rotation" << llendl; + LL_WARNS() << "Bone without rotation" << LL_ENDL; return FALSE; } static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); if (!node->getFastAttributeVector3(scale_string, mScale)) { - llwarns << "Bone without scale" << llendl; + LL_WARNS() << "Bone without scale" << LL_ENDL; return FALSE; } @@ -1531,7 +1531,7 @@ BOOL LLAvatarBoneInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle pivot_string = LLXmlTree::addAttributeString("pivot"); if (!node->getFastAttributeVector3(pivot_string, mPivot)) { - llwarns << "Bone without pivot" << llendl; + LL_WARNS() << "Bone without pivot" << LL_ENDL; return FALSE; } } @@ -1559,7 +1559,7 @@ BOOL LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle num_bones_string = LLXmlTree::addAttributeString("num_bones"); if (!node->getFastAttributeS32(num_bones_string, mNumBones)) { - llwarns << "Couldn't find number of bones." << llendl; + LL_WARNS() << "Couldn't find number of bones." << LL_ENDL; return FALSE; } @@ -1573,7 +1573,7 @@ BOOL LLAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) if (!info->parseXml(child)) { delete info; - llwarns << "Error parsing bone in skeleton file" << llendl; + LL_WARNS() << "Error parsing bone in skeleton file" << LL_ENDL; return FALSE; } mBoneInfoList.push_back(info); @@ -1590,7 +1590,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro LLXmlTreeNode* node = root->getChildByName( "skeleton" ); if( !node ) { - llwarns << "avatar file: missing <skeleton>" << llendl; + LL_WARNS() << "avatar file: missing <skeleton>" << LL_ENDL; return FALSE; } @@ -1605,11 +1605,11 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro { if (child->getChildByName("param_morph")) { - llwarns << "Can't specify morph param in skeleton definition." << llendl; + LL_WARNS() << "Can't specify morph param in skeleton definition." << LL_ENDL; } else { - llwarns << "Unknown param type." << llendl; + LL_WARNS() << "Unknown param type." << LL_ENDL; } continue; } @@ -1634,7 +1634,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (!child->getFastAttributeString(name_string, info->mName)) { - llwarns << "No name supplied for attachment point." << llendl; + LL_WARNS() << "No name supplied for attachment point." << LL_ENDL; delete info; continue; } @@ -1642,7 +1642,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro static LLStdStringHandle joint_string = LLXmlTree::addAttributeString("joint"); if (!child->getFastAttributeString(joint_string, info->mJointName)) { - llwarns << "No bone declared in attachment point " << info->mName << llendl; + LL_WARNS() << "No bone declared in attachment point " << info->mName << LL_ENDL; delete info; continue; } @@ -1668,7 +1668,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* ro static LLStdStringHandle id_string = LLXmlTree::addAttributeString("id"); if (!child->getFastAttributeS32(id_string, info->mAttachmentID)) { - llwarns << "No id supplied for attachment point " << info->mName << llendl; + LL_WARNS() << "No id supplied for attachment point " << info->mName << LL_ENDL; delete info; continue; } @@ -1703,7 +1703,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) static LLStdStringHandle type_string = LLXmlTree::addAttributeString("type"); if( !node->getFastAttributeString( type_string, info->mType ) ) { - llwarns << "Avatar file: <mesh> is missing type attribute. Ignoring element. " << llendl; + LL_WARNS() << "Avatar file: <mesh> is missing type attribute. Ignoring element. " << LL_ENDL; delete info; return FALSE; // Ignore this element } @@ -1711,7 +1711,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) static LLStdStringHandle lod_string = LLXmlTree::addAttributeString("lod"); if (!node->getFastAttributeS32( lod_string, info->mLOD )) { - llwarns << "Avatar file: <mesh> is missing lod attribute. Ignoring element. " << llendl; + LL_WARNS() << "Avatar file: <mesh> is missing lod attribute. Ignoring element. " << LL_ENDL; delete info; return FALSE; // Ignore this element } @@ -1719,7 +1719,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) static LLStdStringHandle file_name_string = LLXmlTree::addAttributeString("file_name"); if( !node->getFastAttributeString( file_name_string, info->mMeshFileName ) ) { - llwarns << "Avatar file: <mesh> is missing file_name attribute. Ignoring: " << info->mType << llendl; + LL_WARNS() << "Avatar file: <mesh> is missing file_name attribute. Ignoring: " << info->mType << LL_ENDL; delete info; return FALSE; // Ignore this element } @@ -1750,11 +1750,11 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) { if (child->getChildByName("param_skeleton")) { - llwarns << "Can't specify skeleton param in a mesh definition." << llendl; + LL_WARNS() << "Can't specify skeleton param in a mesh definition." << LL_ENDL; } else { - llwarns << "Unknown param type." << llendl; + LL_WARNS() << "Unknown param type." << LL_ENDL; } continue; } @@ -1795,14 +1795,14 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root { if (mTexSkinColorInfo) { - llwarns << "avatar file: multiple instances of skin_color" << llendl; + LL_WARNS() << "avatar file: multiple instances of skin_color" << LL_ENDL; return FALSE; } mTexSkinColorInfo = new LLTexGlobalColorInfo; if( !mTexSkinColorInfo->parseXml( color_node ) ) { - deleteAndClear(mTexSkinColorInfo); - llwarns << "avatar file: mTexSkinColor->parseXml() failed" << llendl; + delete_and_clear(mTexSkinColorInfo); + LL_WARNS() << "avatar file: mTexSkinColor->parseXml() failed" << LL_ENDL; return FALSE; } } @@ -1810,14 +1810,14 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root { if (mTexHairColorInfo) { - llwarns << "avatar file: multiple instances of hair_color" << llendl; + LL_WARNS() << "avatar file: multiple instances of hair_color" << LL_ENDL; return FALSE; } mTexHairColorInfo = new LLTexGlobalColorInfo; if( !mTexHairColorInfo->parseXml( color_node ) ) { - deleteAndClear(mTexHairColorInfo); - llwarns << "avatar file: mTexHairColor->parseXml() failed" << llendl; + delete_and_clear(mTexHairColorInfo); + LL_WARNS() << "avatar file: mTexHairColor->parseXml() failed" << LL_ENDL; return FALSE; } } @@ -1825,13 +1825,13 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root { if (mTexEyeColorInfo) { - llwarns << "avatar file: multiple instances of eye_color" << llendl; + LL_WARNS() << "avatar file: multiple instances of eye_color" << LL_ENDL; return FALSE; } mTexEyeColorInfo = new LLTexGlobalColorInfo; if( !mTexEyeColorInfo->parseXml( color_node ) ) { - llwarns << "avatar file: mTexEyeColor->parseXml() failed" << llendl; + LL_WARNS() << "avatar file: mTexEyeColor->parseXml() failed" << LL_ENDL; return FALSE; } } @@ -1857,7 +1857,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root else { delete layer_info; - llwarns << "avatar file: layer_set->parseXml() failed" << llendl; + LL_WARNS() << "avatar file: layer_set->parseXml() failed" << LL_ENDL; return FALSE; } } @@ -1886,7 +1886,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* roo else { delete driver_info; - llwarns << "avatar file: driver_param->parseXml() failed" << llendl; + LL_WARNS() << "avatar file: driver_param->parseXml() failed" << LL_ENDL; return FALSE; } } @@ -1915,7 +1915,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root static LLStdStringHandle name_string = LLXmlTree::addAttributeString("morph_name"); if (!grand_child->getFastAttributeString(name_string, info->mName)) { - llwarns << "No name supplied for morph mask." << llendl; + LL_WARNS() << "No name supplied for morph mask." << LL_ENDL; delete info; continue; } @@ -1923,7 +1923,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root static LLStdStringHandle region_string = LLXmlTree::addAttributeString("body_region"); if (!grand_child->getFastAttributeString(region_string, info->mRegion)) { - llwarns << "No region supplied for morph mask." << llendl; + LL_WARNS() << "No region supplied for morph mask." << LL_ENDL; delete info; continue; } @@ -1931,7 +1931,7 @@ BOOL LLAvatarAppearance::LLAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root static LLStdStringHandle layer_string = LLXmlTree::addAttributeString("layer"); if (!grand_child->getFastAttributeString(layer_string, info->mLayer)) { - llwarns << "No layer supplied for morph mask." << llendl; + LL_WARNS() << "No layer supplied for morph mask." << LL_ENDL; delete info; continue; } diff --git a/indra/llappearance/llavatarjoint.cpp b/indra/llappearance/llavatarjoint.cpp index 6ab341af64ee270f0475f3ad43912e5959041dbe..2ee3c65a01ddef2a2cde2a688fe40ffa5afb4261 100644 --- a/indra/llappearance/llavatarjoint.cpp +++ b/indra/llappearance/llavatarjoint.cpp @@ -238,7 +238,7 @@ LLAvatarJointCollisionVolume::LLAvatarJointCollisionVolume() /*virtual*/ U32 LLAvatarJointCollisionVolume::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) { - llerrs << "Cannot call render() on LLAvatarJointCollisionVolume" << llendl; + LL_ERRS() << "Cannot call render() on LLAvatarJointCollisionVolume" << LL_ENDL; return 0; } diff --git a/indra/llappearance/llavatarjointmesh.cpp b/indra/llappearance/llavatarjointmesh.cpp index 4a5cff1dc36a8805f7c1e309daeccc517acc1e28..520ad775db7cbc46c59a1c95b5bf01167f69325f 100644 --- a/indra/llappearance/llavatarjointmesh.cpp +++ b/indra/llappearance/llavatarjointmesh.cpp @@ -28,7 +28,6 @@ // Header Files //----------------------------------------------------------------------------- #include "linden_common.h" -#include "imageids.h" #include "llfasttimer.h" #include "llrender.h" @@ -89,7 +88,7 @@ BOOL LLSkinJoint::setupSkinJoint( LLAvatarJoint *joint) mJoint = joint; if ( !mJoint ) { - llinfos << "Can't find joint" << llendl; + LL_INFOS() << "Can't find joint" << LL_ENDL; } // compute the inverse root skin matrix @@ -117,7 +116,6 @@ BOOL LLSkinJoint::setupSkinJoint( LLAvatarJoint *joint) //----------------------------------------------------------------------------- BOOL LLAvatarJointMesh::sPipelineRender = FALSE; -EAvatarRenderPass LLAvatarJointMesh::sRenderPass = AVATAR_RENDER_PASS_SINGLE; U32 LLAvatarJointMesh::sClothingMaskImageName = 0; LLColor4 LLAvatarJointMesh::sClothingInnerColor; @@ -306,7 +304,7 @@ void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh ) U32 jn; for (jn = 0; jn < numJointNames; jn++) { - //llinfos << "Setting up joint " << jointNames[jn] << llendl; + //LL_INFOS() << "Setting up joint " << jointNames[jn] << LL_ENDL; LLAvatarJoint* joint = (LLAvatarJoint*)(getRoot()->findJoint(jointNames[jn]) ); mSkinJoints[jn].setupSkinJoint( joint ); } @@ -318,7 +316,7 @@ void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh ) setupJoint((LLAvatarJoint*)getRoot()); } -// llinfos << "joint render entries: " << mMesh->mJointRenderData.count() << llendl; + LL_DEBUGS() << "joint render entries: " << mMesh->mJointRenderData.size() << LL_ENDL; } //----------------------------------------------------------------------------- @@ -326,10 +324,11 @@ void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh ) //----------------------------------------------------------------------------- void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint) { -// llinfos << "Mesh: " << getName() << llendl; + LL_DEBUGS() << "Mesh: " << getName() << LL_ENDL; -// S32 joint_count = 0; + S32 joint_count = 0; U32 sj; + for (sj=0; sj<mNumSkinJoints; sj++) { LLSkinJoint &js = mSkinJoints[sj]; @@ -342,23 +341,20 @@ void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint) // we've found a skinjoint for this joint.. // is the last joint in the array our parent? - if(mMesh->mJointRenderData.count() && mMesh->mJointRenderData[mMesh->mJointRenderData.count() - 1]->mWorldMatrix == ¤t_joint->getParent()->getWorldMatrix()) + if(mMesh->mJointRenderData.size() && mMesh->mJointRenderData[mMesh->mJointRenderData.size() - 1]->mWorldMatrix == ¤t_joint->getParent()->getWorldMatrix()) { // ...then just add ourselves LLAvatarJoint* jointp = js.mJoint; - mMesh->mJointRenderData.put(new LLJointRenderData(&jointp->getWorldMatrix(), &js)); -// llinfos << "joint " << joint_count << js.mJoint->getName() << llendl; -// joint_count++; + mMesh->mJointRenderData.push_back(new LLJointRenderData(&jointp->getWorldMatrix(), &js)); + LL_DEBUGS() << "joint " << joint_count++ << js.mJoint->getName() << LL_ENDL; } // otherwise add our parent and ourselves else { - mMesh->mJointRenderData.put(new LLJointRenderData(¤t_joint->getParent()->getWorldMatrix(), NULL)); -// llinfos << "joint " << joint_count << current_joint->getParent()->getName() << llendl; -// joint_count++; - mMesh->mJointRenderData.put(new LLJointRenderData(¤t_joint->getWorldMatrix(), &js)); -// llinfos << "joint " << joint_count << current_joint->getName() << llendl; -// joint_count++; + mMesh->mJointRenderData.push_back(new LLJointRenderData(¤t_joint->getParent()->getWorldMatrix(), NULL)); + LL_DEBUGS() << "joint " << joint_count++ << current_joint->getParent()->getName() << LL_ENDL; + mMesh->mJointRenderData.push_back(new LLJointRenderData(¤t_joint->getWorldMatrix(), &js)); + LL_DEBUGS() << "joint " << joint_count++ << current_joint->getName() << LL_ENDL; } } diff --git a/indra/llappearance/llavatarjointmesh.h b/indra/llappearance/llavatarjointmesh.h index 6486932cdfcd38ea5e7441da037cfabaa50c3603..5980b29b467bc0e9b30ee4f39873bfb7ce589242 100644 --- a/indra/llappearance/llavatarjointmesh.h +++ b/indra/llappearance/llavatarjointmesh.h @@ -82,7 +82,6 @@ class LLAvatarJointMesh : public virtual LLAvatarJoint static BOOL sPipelineRender; //RN: this is here for testing purposes static U32 sClothingMaskImageName; - static EAvatarRenderPass sRenderPass; static LLColor4 sClothingInnerColor; public: diff --git a/indra/llappearance/lldriverparam.cpp b/indra/llappearance/lldriverparam.cpp index 1f7e8b86524a667bd8a46f5a2ac080acaab53ff1..c66a4283740058ee555d0fe0f8e2708aa64a909e 100644 --- a/indra/llappearance/lldriverparam.cpp +++ b/indra/llappearance/lldriverparam.cpp @@ -89,7 +89,7 @@ BOOL LLDriverParamInfo::parseXml(LLXmlTreeNode* node) } else { - llerrs << "<driven> Unable to resolve driven parameter: " << driven_id << llendl; + LL_ERRS() << "<driven> Unable to resolve driven parameter: " << driven_id << LL_ENDL; return FALSE; } } @@ -139,9 +139,9 @@ void LLDriverParamInfo::toStream(std::ostream &out) } else { - llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " + LL_WARNS() << "could not get parameter " << driven.mDrivenID << " from avatar " << mDriverParam->getAvatarAppearance() - << " for driver parameter " << getID() << llendl; + << " for driver parameter " << getID() << LL_ENDL; } out << std::endl; } diff --git a/indra/llappearance/lldriverparam.h b/indra/llappearance/lldriverparam.h index 040c9cf5be1dce89df81b2b31b49b27f3be3fb92..2420db76e7fdc59cc153ccffff0574f4e37c2082 100644 --- a/indra/llappearance/lldriverparam.h +++ b/indra/llappearance/lldriverparam.h @@ -29,6 +29,7 @@ #include "llviewervisualparam.h" #include "llwearabletype.h" +#include <deque> class LLAvatarAppearance; class LLDriverParam; diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index 7e36a06797456fbb12be34d171524a5d126e1aab..f49cf215129a2397d4d4eb3b362e32c5e75be032 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -64,7 +64,7 @@ LLLocalTextureObject::LLLocalTextureObject(const LLLocalTextureObject& lto) : LLTexLayer* original_layer = lto.getTexLayer(index); if (!original_layer) { - llerrs << "could not clone Local Texture Object: unable to extract texlayer!" << llendl; + LL_ERRS() << "could not clone Local Texture Object: unable to extract texlayer!" << LL_ENDL; continue; } diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp index a01457246e19de1ff115e9e16bfa08d4f6ed6d27..0a7a8d27bbfa701e701286aa6ce62a6ebeba5ab7 100644 --- a/indra/llappearance/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -161,8 +161,8 @@ void LLPolyMeshSharedData::freeMeshData() // mVertFaceMap.deleteAllData(); } -// compate_int is used by the qsort function to sort the index array -int compare_int(const void *a, const void *b); +// compare_int is used by the qsort function to sort the index array +S32 compare_int(const void *a, const void *b); //----------------------------------------------------------------------------- // genIndices() @@ -277,13 +277,13 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) //------------------------------------------------------------------------- if(fileName.empty()) { - llerrs << "Filename is Empty!" << llendl; + LL_ERRS() << "Filename is Empty!" << LL_ENDL; return FALSE; } LLFILE* fp = LLFile::fopen(fileName, "rb"); /*Flawfinder: ignore*/ if (!fp) { - llerrs << "can't open: " << fileName << llendl; + LL_ERRS() << "can't open: " << fileName << LL_ENDL; return FALSE; } @@ -293,7 +293,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) char header[128]; /*Flawfinder: ignore*/ if (fread(header, sizeof(char), 128, fp) != 128) { - llwarns << "Short read" << llendl; + LL_WARNS() << "Short read" << LL_ENDL; } //------------------------------------------------------------------------- @@ -302,7 +302,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) BOOL status = FALSE; if ( strncmp(header, HEADER_BINARY, strlen(HEADER_BINARY)) == 0 ) /*Flawfinder: ignore*/ { - lldebugs << "Loading " << fileName << llendl; + LL_DEBUGS() << "Loading " << fileName << LL_ENDL; //---------------------------------------------------------------- // File Header (seek past it) @@ -316,7 +316,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) size_t numRead = fread(&hasWeights, sizeof(U8), 1, fp); if (numRead != 1) { - llerrs << "can't read HasWeights flag from " << fileName << llendl; + LL_ERRS() << "can't read HasWeights flag from " << fileName << LL_ENDL; return FALSE; } if (!isLOD()) @@ -331,7 +331,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) numRead = fread(&hasDetailTexCoords, sizeof(U8), 1, fp); if (numRead != 1) { - llerrs << "can't read HasDetailTexCoords flag from " << fileName << llendl; + LL_ERRS() << "can't read HasDetailTexCoords flag from " << fileName << LL_ENDL; return FALSE; } @@ -343,7 +343,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(position.mV, sizeof(float), 3); if (numRead != 3) { - llerrs << "can't read Position from " << fileName << llendl; + LL_ERRS() << "can't read Position from " << fileName << LL_ENDL; return FALSE; } setPosition( position ); @@ -356,7 +356,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(rotationAngles.mV, sizeof(float), 3); if (numRead != 3) { - llerrs << "can't read RotationAngles from " << fileName << llendl; + LL_ERRS() << "can't read RotationAngles from " << fileName << LL_ENDL; return FALSE; } @@ -365,7 +365,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) if (numRead != 1) { - llerrs << "can't read RotationOrder from " << fileName << llendl; + LL_ERRS() << "can't read RotationOrder from " << fileName << LL_ENDL; return FALSE; } @@ -384,7 +384,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(scale.mV, sizeof(float), 3); if (numRead != 3) { - llerrs << "can't read Scale from " << fileName << llendl; + LL_ERRS() << "can't read Scale from " << fileName << LL_ENDL; return FALSE; } setScale( scale ); @@ -405,7 +405,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(&numVertices, sizeof(U16), 1); if (numRead != 1) { - llerrs << "can't read NumVertices from " << fileName << llendl; + LL_ERRS() << "can't read NumVertices from " << fileName << LL_ENDL; return FALSE; } @@ -420,7 +420,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(&mBaseCoords[i], sizeof(float), 3); if (numRead != 3) { - llerrs << "can't read Coordinates from " << fileName << llendl; + LL_ERRS() << "can't read Coordinates from " << fileName << LL_ENDL; return FALSE; } } @@ -434,7 +434,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(&mBaseNormals[i], sizeof(float), 3); if (numRead != 3) { - llerrs << " can't read Normals from " << fileName << llendl; + LL_ERRS() << " can't read Normals from " << fileName << LL_ENDL; return FALSE; } } @@ -448,7 +448,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(&mBaseBinormals[i], sizeof(float), 3); if (numRead != 3) { - llerrs << " can't read Binormals from " << fileName << llendl; + LL_ERRS() << " can't read Binormals from " << fileName << LL_ENDL; return FALSE; } } @@ -460,7 +460,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(mTexCoords, sizeof(float), 2*numVertices); if (numRead != numVertices) { - llerrs << "can't read TexCoords from " << fileName << llendl; + LL_ERRS() << "can't read TexCoords from " << fileName << LL_ENDL; return FALSE; } @@ -473,7 +473,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(mDetailTexCoords, sizeof(float), 2*numVertices); if (numRead != numVertices) { - llerrs << "can't read DetailTexCoords from " << fileName << llendl; + LL_ERRS() << "can't read DetailTexCoords from " << fileName << LL_ENDL; return FALSE; } } @@ -487,7 +487,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(mWeights, sizeof(float), numVertices); if (numRead != numVertices) { - llerrs << "can't read Weights from " << fileName << llendl; + LL_ERRS() << "can't read Weights from " << fileName << LL_ENDL; return FALSE; } } @@ -501,7 +501,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(&numFaces, sizeof(U16), 1); if (numRead != 1) { - llerrs << "can't read NumFaces from " << fileName << llendl; + LL_ERRS() << "can't read NumFaces from " << fileName << LL_ENDL; return FALSE; } allocateFaceData( numFaces ); @@ -519,7 +519,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(face, sizeof(U16), 3); if (numRead != 3) { - llerrs << "can't read Face[" << i << "] from " << fileName << llendl; + LL_ERRS() << "can't read Face[" << i << "] from " << fileName << LL_ENDL; return FALSE; } if (mReferenceData) @@ -547,10 +547,10 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) // S32 j; // for(j = 0; j < 3; j++) // { -// LLDynamicArray<S32> *face_list = mVertFaceMap.getIfThere(face[j]); +// std::vector<S32> *face_list = mVertFaceMap.getIfThere(face[j]); // if (!face_list) // { -// face_list = new LLDynamicArray<S32>; +// face_list = new std::vector<S32>; // mVertFaceMap.addData(face[j], face_list); // } // face_list->put(i); @@ -559,10 +559,10 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) numTris++; } - lldebugs << "verts: " << numVertices + LL_DEBUGS() << "verts: " << numVertices << ", faces: " << numFaces << ", tris: " << numTris - << llendl; + << LL_ENDL; //---------------------------------------------------------------- // NumSkinJoints @@ -576,7 +576,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) llendianswizzle(&numSkinJoints, sizeof(U16), 1); if (numRead != 1) { - llerrs << "can't read NumSkinJoints from " << fileName << llendl; + LL_ERRS() << "can't read NumSkinJoints from " << fileName << LL_ENDL; return FALSE; } allocateJointNames( numSkinJoints ); @@ -592,7 +592,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) jointName[sizeof(jointName)-1] = '\0'; // ensure nul-termination if (numRead != 1) { - llerrs << "can't read Skin[" << i << "].Name from " << fileName << llendl; + LL_ERRS() << "can't read Skin[" << i << "].Name from " << fileName << LL_ENDL; return FALSE; } @@ -687,12 +687,12 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) S32 remapDst; if (fread(&remapSrc, sizeof(S32), 1, fp) != 1) { - llerrs << "can't read source vertex in vertex remap data" << llendl; + LL_ERRS() << "can't read source vertex in vertex remap data" << LL_ENDL; break; } if (fread(&remapDst, sizeof(S32), 1, fp) != 1) { - llerrs << "can't read destination vertex in vertex remap data" << llendl; + LL_ERRS() << "can't read destination vertex in vertex remap data" << LL_ENDL; break; } llendianswizzle(&remapSrc, sizeof(S32), 1); @@ -707,7 +707,7 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName ) } else { - llerrs << "invalid mesh file header: " << fileName << llendl; + LL_ERRS() << "invalid mesh file header: " << fileName << LL_ENDL; status = FALSE; } @@ -808,15 +808,8 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_ //----------------------------------------------------------------------------- LLPolyMesh::~LLPolyMesh() { - S32 i; - for (i = 0; i < mJointRenderData.count(); i++) - { - delete mJointRenderData[i]; - mJointRenderData[i] = NULL; - } - - ll_aligned_free_16(mVertexData); - + delete_and_clear(mJointRenderData); + ll_aligned_free_16(mVertexData); } @@ -831,7 +824,7 @@ LLPolyMesh *LLPolyMesh::getMesh(const std::string &name, LLPolyMesh* reference_m LLPolyMeshSharedData* meshSharedData = get_if_there(sGlobalSharedMeshList, name, (LLPolyMeshSharedData*)NULL); if (meshSharedData) { -// llinfos << "Polymesh " << name << " found in global mesh table." << llendl; +// LL_INFOS() << "Polymesh " << name << " found in global mesh table." << LL_ENDL; LLPolyMesh *poly_mesh = new LLPolyMesh(meshSharedData, reference_mesh); return poly_mesh; } @@ -855,7 +848,7 @@ LLPolyMesh *LLPolyMesh::getMesh(const std::string &name, LLPolyMesh* reference_m LLPolyMesh *poly_mesh = new LLPolyMesh(mesh_data, reference_mesh); -// llinfos << "Polymesh " << name << " added to global mesh table." << llendl; +// LL_INFOS() << "Polymesh " << name << " added to global mesh table." << LL_ENDL; sGlobalSharedMeshList[name] = poly_mesh->mSharedData; return poly_mesh; @@ -889,10 +882,10 @@ void LLPolyMesh::dumpDiagInfo() std::string buf; - llinfos << "-----------------------------------------------------" << llendl; - llinfos << " Global PolyMesh Table (DEBUG only)" << llendl; - llinfos << " Verts Faces Mem(KB) Name" << llendl; - llinfos << "-----------------------------------------------------" << llendl; + LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; + LL_INFOS() << " Global PolyMesh Table (DEBUG only)" << LL_ENDL; + LL_INFOS() << " Verts Faces Mem(KB) Name" << LL_ENDL; + LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; // print each loaded mesh, and it's memory usage for(LLPolyMeshSharedDataTable::iterator iter = sGlobalSharedMeshList.begin(); @@ -906,17 +899,17 @@ void LLPolyMesh::dumpDiagInfo() U32 num_kb = mesh->getNumKB(); buf = llformat("%8d %8d %8d %s", num_verts, num_faces, num_kb, mesh_name.c_str()); - llinfos << buf << llendl; + LL_INFOS() << buf << LL_ENDL; total_verts += num_verts; total_faces += num_faces; total_kb += num_kb; } - llinfos << "-----------------------------------------------------" << llendl; + LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; buf = llformat("%8d %8d %8d TOTAL", total_verts, total_faces, total_kb ); - llinfos << buf << llendl; - llinfos << "-----------------------------------------------------" << llendl; + LL_INFOS() << buf << LL_ENDL; + LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; } //----------------------------------------------------------------------------- diff --git a/indra/llappearance/llpolymesh.h b/indra/llappearance/llpolymesh.h index ef1dfb1adb25feb94f105bde280589ae588a0511..83659d9514c30ac9c895ad98e8e708253b8194d8 100644 --- a/indra/llappearance/llpolymesh.h +++ b/indra/llappearance/llpolymesh.h @@ -36,7 +36,6 @@ #include "llquaternion.h" #include "llpolymorph.h" #include "lljoint.h" -//#include "lldarray.h" class LLSkinJoint; class LLAvatarAppearance; @@ -322,7 +321,7 @@ class LLPolyMesh void setAvatar(LLAvatarAppearance* avatarp) { mAvatarp = avatarp; } LLAvatarAppearance* getAvatar() { return mAvatarp; } - LLDynamicArray<LLJointRenderData*> mJointRenderData; + std::vector<LLJointRenderData*> mJointRenderData; U32 mFaceVertexOffset; U32 mFaceVertexCount; diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index 93c2f15a535e378ffbdc74562d3867b5697123db..ce8a0b0b764692884e8e49e7dde9254ae4831fb7 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -35,6 +35,7 @@ #include "llxmltree.h" #include "llendianswizzle.h" #include "llpolymesh.h" +#include "llfasttimer.h" //#include "../tools/imdebug/imdebug.h" @@ -112,7 +113,7 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) llendianswizzle(&numVertices, sizeof(S32), 1); if (numRead != 1) { - llwarns << "Can't read number of morph target vertices" << llendl; + LL_WARNS() << "Can't read number of morph target vertices" << LL_ENDL; return FALSE; } @@ -149,13 +150,13 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) llendianswizzle(&mVertexIndices[v], sizeof(U32), 1); if (numRead != 1) { - llwarns << "Can't read morph target vertex number" << llendl; + LL_WARNS() << "Can't read morph target vertex number" << LL_ENDL; return FALSE; } if (mVertexIndices[v] > 10000) { - llerrs << "Bad morph index: " << mVertexIndices[v] << llendl; + LL_ERRS() << "Bad morph index: " << mVertexIndices[v] << LL_ENDL; } @@ -163,7 +164,7 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) llendianswizzle(&mCoords[v], sizeof(F32), 3); if (numRead != 3) { - llwarns << "Can't read morph target vertex coordinates" << llendl; + LL_WARNS() << "Can't read morph target vertex coordinates" << LL_ENDL; return FALSE; } @@ -183,7 +184,7 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) llendianswizzle(&mNormals[v], sizeof(F32), 3); if (numRead != 3) { - llwarns << "Can't read morph target normal" << llendl; + LL_WARNS() << "Can't read morph target normal" << LL_ENDL; return FALSE; } @@ -191,7 +192,7 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) llendianswizzle(&mBinormals[v], sizeof(F32), 3); if (numRead != 3) { - llwarns << "Can't read morph target binormal" << llendl; + LL_WARNS() << "Can't read morph target binormal" << LL_ENDL; return FALSE; } @@ -200,7 +201,7 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh) llendianswizzle(&mTexCoords[v].mV, sizeof(F32), 2); if (numRead != 2) { - llwarns << "Can't read morph target uv" << llendl; + LL_WARNS() << "Can't read morph target uv" << LL_ENDL; return FALSE; } @@ -268,7 +269,7 @@ BOOL LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if( !node->getFastAttributeString( name_string, mMorphName ) ) { - llwarns << "Avatar file: <param> is missing name attribute" << llendl; + LL_WARNS() << "Avatar file: <param> is missing name attribute" << LL_ENDL; return FALSE; // Continue, ignoring this tag } @@ -279,8 +280,8 @@ BOOL LLPolyMorphTargetInfo::parseXml(LLXmlTreeNode* node) if (NULL == paramNode) { - llwarns << "Failed to getChildByName(\"param_morph\")" - << llendl; + LL_WARNS() << "Failed to getChildByName(\"param_morph\")" + << LL_ENDL; return FALSE; } @@ -376,7 +377,7 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) } if (!mMorphData) { - llwarns << "No morph target named " << morph_param_name << " found in mesh." << llendl; + LL_WARNS() << "No morph target named " << morph_param_name << " found in mesh." << LL_ENDL; return FALSE; // Continue, ignoring this tag } return TRUE; @@ -524,7 +525,7 @@ F32 LLPolyMorphTarget::getMaxDistortion() //----------------------------------------------------------------------------- // apply() //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_APPLY_MORPH_TARGET("Apply Morph"); +static LLTrace::BlockTimerStatHandle FTM_APPLY_MORPH_TARGET("Apply Morph"); void LLPolyMorphTarget::apply( ESex avatar_sex ) { @@ -533,7 +534,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) return; } - LLFastTimer t(FTM_APPLY_MORPH_TARGET); + LL_RECORD_BLOCK_TIME(FTM_APPLY_MORPH_TARGET); mLastSex = avatar_sex; @@ -619,9 +620,9 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) tangent.setCross3(scaled_binormals[vert_index_mesh], norm); LLVector4a& normalized_binormal = binormals[vert_index_mesh]; - normalized_binormal.setCross3(norm, tangent); + normalized_binormal.setCross3(norm, tangent); normalized_binormal.normalize3fast(); - + tex_coords[vert_index_mesh] += mMorphData->mTexCoords[vert_index_morph] * delta_weight * maskWeight; } diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp index 4ba16691c28b48ec0318be80537cf76f898cc965..a72b446ace9fa148e23e5f09d8c325f02557a25c 100644 --- a/indra/llappearance/llpolyskeletaldistortion.cpp +++ b/indra/llappearance/llpolyskeletaldistortion.cpp @@ -28,19 +28,12 @@ // Header Files //----------------------------------------------------------------------------- #include "llpreprocessor.h" -#include "llerrorlegacy.h" -//#include "llcommon.h" -//#include "llmemory.h" +#include "llerror.h" #include "llavatarappearance.h" #include "llavatarjoint.h" #include "llpolymorph.h" -//#include "llviewercontrol.h" -//#include "llxmltree.h" -//#include "llvoavatar.h" #include "llwearable.h" -//#include "lldir.h" -//#include "llvolume.h" -//#include "llendianswizzle.h" +#include "llfasttimer.h" #include "llpolyskeletaldistortion.h" @@ -62,8 +55,8 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) if (NULL == skeletalParam) { - llwarns << "Failed to getChildByName(\"param_skeleton\")" - << llendl; + LL_WARNS() << "Failed to getChildByName(\"param_skeleton\")" + << LL_ENDL; return FALSE; } @@ -79,14 +72,14 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (!bone->getFastAttributeString(name_string, name)) { - llwarns << "No bone name specified for skeletal param." << llendl; + LL_WARNS() << "No bone name specified for skeletal param." << LL_ENDL; continue; } static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale"); if (!bone->getFastAttributeVector3(scale_string, scale)) { - llwarns << "No scale specified for bone " << name << "." << llendl; + LL_WARNS() << "No scale specified for bone " << name << "." << LL_ENDL; continue; } @@ -100,7 +93,7 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node) } else { - llwarns << "Unrecognized element " << bone->getName() << " in skeletal distortion" << llendl; + LL_WARNS() << "Unrecognized element " << bone->getName() << " in skeletal distortion" << LL_ENDL; continue; } } @@ -139,13 +132,13 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName); if (!joint) { - llwarns << "Joint " << bone_info->mBoneName << " not found." << llendl; + LL_WARNS() << "Joint " << bone_info->mBoneName << " not found." << LL_ENDL; continue; } if (mJointScales.find(joint) != mJointScales.end()) { - llwarns << "Scale deformation already supplied for joint " << joint->getName() << "." << llendl; + LL_WARNS() << "Scale deformation already supplied for joint " << joint->getName() << "." << LL_ENDL; } // store it @@ -168,7 +161,7 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) { if (mJointOffsets.find(joint) != mJointOffsets.end()) { - llwarns << "Offset deformation already supplied for joint " << joint->getName() << "." << llendl; + LL_WARNS() << "Offset deformation already supplied for joint " << joint->getName() << "." << LL_ENDL; } mJointOffsets[joint] = bone_info->mPositionDeformation; } @@ -186,11 +179,11 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) //----------------------------------------------------------------------------- // apply() //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion"); +static LLTrace::BlockTimerStatHandle FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion"); void LLPolySkeletalDistortion::apply( ESex avatar_sex ) { - LLFastTimer t(FTM_POLYSKELETAL_DISTORTION_APPLY); + LL_RECORD_BLOCK_TIME(FTM_POLYSKELETAL_DISTORTION_APPLY); F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight(); diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h index 774bc7dfa2a8071ad89ae8c680e4326a17f0c033..24c9e9ae48aa5b06e4b50bf218a9094f29a1c773 100644 --- a/indra/llappearance/llpolyskeletaldistortion.h +++ b/indra/llappearance/llpolyskeletaldistortion.h @@ -39,7 +39,6 @@ //#include "llpolymorph.h" #include "lljoint.h" #include "llviewervisualparam.h" -//#include "lldarray.h" //class LLSkinJoint; class LLAvatarAppearance; diff --git a/indra/llappearance/lltexglobalcolor.cpp b/indra/llappearance/lltexglobalcolor.cpp index 16b0260d1ae3364fde16c34880efbc802befeb27..186c53765979bc8453a1c4b81bab8586c00b602e 100644 --- a/indra/llappearance/lltexglobalcolor.cpp +++ b/indra/llappearance/lltexglobalcolor.cpp @@ -129,7 +129,7 @@ BOOL LLTexGlobalColorInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if (!node->getFastAttributeString(name_string, mName)) { - llwarns << "<global_color> element is missing name attribute." << llendl; + LL_WARNS() << "<global_color> element is missing name attribute." << LL_ENDL; return FALSE; } // <param> sub-element diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 63d01999f0610c3cc843bc47917d91852e7bb79b..f6abaa5eb32f50299e198e6e03fdb40a44ffec8a 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -30,7 +30,6 @@ #include "llavatarappearance.h" #include "llcrc.h" -#include "imageids.h" #include "llimagej2c.h" #include "llimagetga.h" #include "lldir.h" @@ -38,11 +37,13 @@ #include "llvfs.h" #include "lltexlayerparams.h" #include "lltexturemanagerbridge.h" +#include "lllocaltextureobject.h" #include "../llui/llui.h" #include "llwearable.h" #include "llwearabledata.h" #include "llvertexbuffer.h" #include "llviewervisualparam.h" +#include "llfasttimer.h" //#include "../tools/imdebug/imdebug.h" @@ -210,7 +211,7 @@ BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node) static LLStdStringHandle body_region_string = LLXmlTree::addAttributeString("body_region"); if( !node->getFastAttributeString( body_region_string, mBodyRegion ) ) { - llwarns << "<layer_set> is missing body_region attribute" << llendl; + LL_WARNS() << "<layer_set> is missing body_region attribute" << LL_ENDL; return FALSE; } @@ -521,10 +522,10 @@ const LLTexLayerSetBuffer* LLTexLayerSet::getComposite() const return mComposite; } -static LLFastTimer::DeclareTimer FTM_GATHER_MORPH_MASK_ALPHA("gatherMorphMaskAlpha"); +static LLTrace::BlockTimerStatHandle FTM_GATHER_MORPH_MASK_ALPHA("gatherMorphMaskAlpha"); void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S32 width, S32 height) { - LLFastTimer t(FTM_GATHER_MORPH_MASK_ALPHA); + LL_RECORD_BLOCK_TIME(FTM_GATHER_MORPH_MASK_ALPHA); memset(data, 255, width * height); for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) @@ -537,10 +538,10 @@ void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S renderAlphaMaskTextures(origin_x, origin_y, width, height, true); } -static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_MASK_TEXTURES("renderAlphaMaskTextures"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MASK_TEXTURES("renderAlphaMaskTextures"); void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear) { - LLFastTimer t(FTM_RENDER_ALPHA_MASK_TEXTURES); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK_TEXTURES); const LLTexLayerSetInfo *info = getInfo(); bool use_shaders = LLGLSLShader::sNoFixedFunction; @@ -740,13 +741,13 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) } if (mLocalTexture == TEX_NUM_INDICES) { - llwarns << "<texture> element has invalid local_texture attribute: " << mName << " " << local_texture_name << llendl; + LL_WARNS() << "<texture> element has invalid local_texture attribute: " << mName << " " << local_texture_name << LL_ENDL; return FALSE; } } else { - llwarns << "<texture> element is missing a required attribute. " << mName << llendl; + LL_WARNS() << "<texture> element is missing a required attribute. " << mName << LL_ENDL; return FALSE; } } @@ -809,7 +810,7 @@ BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance) LLTexLayerParamColor* param_color = new LLTexLayerParamColor(appearance); if (!param_color->setInfo(color_info, TRUE)) { - llwarns << "NULL TexLayer Color Param could not be added to visual param list. Deleting." << llendl; + LL_WARNS() << "NULL TexLayer Color Param could not be added to visual param list. Deleting." << LL_ENDL; delete param_color; success = FALSE; } @@ -823,7 +824,7 @@ BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance) LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(appearance); if (!param_alpha->setInfo(alpha_info, TRUE)) { - llwarns << "NULL TexLayer Alpha Param could not be added to visual param list. Deleting." << llendl; + LL_WARNS() << "NULL TexLayer Alpha Param could not be added to visual param list. Deleting." << LL_ENDL; delete param_alpha; success = FALSE; } @@ -856,7 +857,7 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab // Not a critical warning, but could be useful for debugging later issues. -Nyx if (mInfo != NULL) { - llwarns << "mInfo != NULL" << llendl; + LL_WARNS() << "mInfo != NULL" << LL_ENDL; } mInfo = info; //mID = info->mID; // No ID @@ -1212,7 +1213,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height) } else { - llinfos << "lto not defined or image not defined: " << getInfo()->getLocalTexture() << " lto: " << mLocalTextureObject << llendl; + LL_INFOS() << "lto not defined or image not defined: " << getInfo()->getLocalTexture() << " lto: " << mLocalTextureObject << LL_ENDL; } // if( mTexLayerSet->getAvatarAppearance()->getLocalTextureGL((ETextureIndex)getInfo()->mLocalTexture, &image_gl ) ) { @@ -1300,7 +1301,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height) if( !success ) { - llinfos << "LLTexLayer::render() partial: " << getInfo()->mName << llendl; + LL_INFOS() << "LLTexLayer::render() partial: " << getInfo()->mName << LL_ENDL; } return success; } @@ -1432,15 +1433,15 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) addAlphaMask(data, originX, originY, width, height); } -static LLFastTimer::DeclareTimer FTM_RENDER_MORPH_MASKS("renderMorphMasks"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_MORPH_MASKS("renderMorphMasks"); void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, bool force_render) { if (!force_render && !hasMorph()) { - lldebugs << "skipping renderMorphMasks for " << getUUID() << llendl; + LL_DEBUGS() << "skipping renderMorphMasks for " << getUUID() << LL_ENDL; return; } - LLFastTimer t(FTM_RENDER_MORPH_MASKS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_MORPH_MASKS); BOOL success = TRUE; llassert( !mParamAlphaList.empty() ); @@ -1478,7 +1479,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC success &= param->render( x, y, width, height ); if (!success && !force_render) { - lldebugs << "Failed to render param " << param->getID() << " ; skipping morph mask." << llendl; + LL_DEBUGS() << "Failed to render param " << param->getID() << " ; skipping morph mask." << LL_ENDL; return; } } @@ -1520,8 +1521,8 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC } else { - llwarns << "Skipping rendering of " << getInfo()->mStaticImageFileName - << "; expected 1 or 4 components." << llendl; + LL_WARNS() << "Skipping rendering of " << getInfo()->mStaticImageFileName + << "; expected 1 or 4 components." << LL_ENDL; } } } @@ -1583,10 +1584,10 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC } } -static LLFastTimer::DeclareTimer FTM_ADD_ALPHA_MASK("addAlphaMask"); +static LLTrace::BlockTimerStatHandle FTM_ADD_ALPHA_MASK("addAlphaMask"); void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height) { - LLFastTimer t(FTM_ADD_ALPHA_MASK); + LL_RECORD_BLOCK_TIME(FTM_ADD_ALPHA_MASK); S32 size = width * height; const U8* alphaData = getAlphaData(); if (!alphaData && hasAlphaParams()) @@ -1900,18 +1901,18 @@ LLTexLayerStaticImageList::~LLTexLayerStaticImageList() void LLTexLayerStaticImageList::dumpByteCount() const { - llinfos << "Avatar Static Textures " << + LL_INFOS() << "Avatar Static Textures " << "KB GL:" << (mGLBytes / 1024) << - "KB TGA:" << (mTGABytes / 1024) << "KB" << llendl; + "KB TGA:" << (mTGABytes / 1024) << "KB" << LL_ENDL; } void LLTexLayerStaticImageList::deleteCachedImages() { if( mGLBytes || mTGABytes ) { - llinfos << "Clearing Static Textures " << + LL_INFOS() << "Clearing Static Textures " << "KB GL:" << (mGLBytes / 1024) << - "KB TGA:" << (mTGABytes / 1024) << "KB" << llendl; + "KB TGA:" << (mTGABytes / 1024) << "KB" << LL_ENDL; //mStaticImageLists uses LLPointers, clear() will cause deletion @@ -1929,10 +1930,10 @@ void LLTexLayerStaticImageList::deleteCachedImages() // Returns an LLImageTGA that contains the encoded data from a tga file named file_name. // Caches the result to speed identical subsequent requests. -static LLFastTimer::DeclareTimer FTM_LOAD_STATIC_TGA("getImageTGA"); +static LLTrace::BlockTimerStatHandle FTM_LOAD_STATIC_TGA("getImageTGA"); LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name) { - LLFastTimer t(FTM_LOAD_STATIC_TGA); + LL_RECORD_BLOCK_TIME(FTM_LOAD_STATIC_TGA); const char *namekey = mImageNames.addString(file_name); image_tga_map_t::const_iterator iter = mStaticImageListTGA.find(namekey); if( iter != mStaticImageListTGA.end() ) @@ -1959,10 +1960,10 @@ LLImageTGA* LLTexLayerStaticImageList::getImageTGA(const std::string& file_name) // Returns a GL Image (without a backing ImageRaw) that contains the decoded data from a tga file named file_name. // Caches the result to speed identical subsequent requests. -static LLFastTimer::DeclareTimer FTM_LOAD_STATIC_TEXTURE("getTexture"); +static LLTrace::BlockTimerStatHandle FTM_LOAD_STATIC_TEXTURE("getTexture"); LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, BOOL is_mask) { - LLFastTimer t(FTM_LOAD_STATIC_TEXTURE); + LL_RECORD_BLOCK_TIME(FTM_LOAD_STATIC_TEXTURE); LLPointer<LLGLTexture> tex; const char *namekey = mImageNames.addString(file_name); @@ -2009,10 +2010,10 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, // Reads a .tga file, decodes it, and puts the decoded data in image_raw. // Returns TRUE if successful. -static LLFastTimer::DeclareTimer FTM_LOAD_IMAGE_RAW("loadImageRaw"); +static LLTrace::BlockTimerStatHandle FTM_LOAD_IMAGE_RAW("loadImageRaw"); BOOL LLTexLayerStaticImageList::loadImageRaw(const std::string& file_name, LLImageRaw* image_raw) { - LLFastTimer t(FTM_LOAD_IMAGE_RAW); + LL_RECORD_BLOCK_TIME(FTM_LOAD_IMAGE_RAW); BOOL success = FALSE; std::string path; path = gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,file_name); diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp index 6aae9a8cc11ce032266c3bbcfec8027f810d1b03..f1f7d07fa9c98cf82f458edb0d16e3c048f0a2c3 100644 --- a/indra/llappearance/lltexlayerparams.cpp +++ b/indra/llappearance/lltexlayerparams.cpp @@ -35,6 +35,7 @@ #include "lltexturemanagerbridge.h" #include "../llui/llui.h" #include "llwearable.h" +#include "llfasttimer.h" //----------------------------------------------------------------------------- // LLTexLayerParam @@ -49,7 +50,7 @@ LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) : } else { - llerrs << "LLTexLayerParam constructor passed with NULL reference for layer!" << llendl; + LL_ERRS() << "LLTexLayerParam constructor passed with NULL reference for layer!" << LL_ENDL; } } @@ -86,7 +87,7 @@ void LLTexLayerParamAlpha::dumpCacheByteCount() { S32 gl_bytes = 0; getCacheByteCount( &gl_bytes); - llinfos << "Processed Alpha Texture Cache GL:" << (gl_bytes/1024) << "KB" << llendl; + LL_INFOS() << "Processed Alpha Texture Cache GL:" << (gl_bytes/1024) << "KB" << LL_ENDL; } // static @@ -238,10 +239,10 @@ BOOL LLTexLayerParamAlpha::getSkip() const } -static LLFastTimer::DeclareTimer FTM_TEX_LAYER_PARAM_ALPHA("alpha render"); +static LLTrace::BlockTimerStatHandle FTM_TEX_LAYER_PARAM_ALPHA("alpha render"); BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) { - LLFastTimer t(FTM_TEX_LAYER_PARAM_ALPHA); + LL_RECORD_BLOCK_TIME(FTM_TEX_LAYER_PARAM_ALPHA); BOOL success = TRUE; if (!mTexLayer) @@ -278,7 +279,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) if (mStaticImageTGA.isNull()) { - llwarns << "Unable to load static file: " << info->mStaticImageFileName << llendl; + LL_WARNS() << "Unable to load static file: " << info->mStaticImageFileName << LL_ENDL; mStaticImageInvalid = TRUE; // don't try again. return FALSE; } @@ -309,7 +310,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) mStaticImageRaw = new LLImageRaw; mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight); mNeedsCreateTexture = TRUE; - lldebugs << "Built Cached Alpha: " << info->mStaticImageFileName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << "Domain: " << info->mDomain << " Weight: " << effective_weight << llendl; + LL_DEBUGS() << "Built Cached Alpha: " << info->mStaticImageFileName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << "Domain: " << info->mDomain << " Weight: " << effective_weight << LL_ENDL; } if (mCachedProcessedTexture) @@ -380,7 +381,7 @@ BOOL LLTexLayerParamAlphaInfo::parseXml(LLXmlTreeNode* node) } // else // { -// llwarns << "<param_alpha> element is missing tga_file attribute." << llendl; +// LL_WARNS() << "<param_alpha> element is missing tga_file attribute." << LL_ENDL; // } static LLStdStringHandle multiply_blend_string = LLXmlTree::addAttributeString("multiply_blend"); @@ -481,7 +482,7 @@ void LLTexLayerParamColor::setWeight(F32 weight, BOOL upload_bake) } } -// llinfos << "param " << mName << " = " << new_weight << llendl; +// LL_INFOS() << "param " << mName << " = " << new_weight << LL_ENDL; } } @@ -556,13 +557,13 @@ BOOL LLTexLayerParamColorInfo::parseXml(LLXmlTreeNode *node) } if (!mNumColors) { - llwarns << "<param_color> is missing <value> sub-elements" << llendl; + LL_WARNS() << "<param_color> is missing <value> sub-elements" << LL_ENDL; return FALSE; } if ((mOperation == LLTexLayerParamColor::OP_BLEND) && (mNumColors != 1)) { - llwarns << "<param_color> with operation\"blend\" must have exactly one <value>" << llendl; + LL_WARNS() << "<param_color> with operation\"blend\" must have exactly one <value>" << LL_ENDL; return FALSE; } diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index d86a460511fba4cb052b8d40029dae735488e08b..389505fa3449e035057ed662d5ab45021d8d76bc 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -33,6 +33,7 @@ #include "llvisualparam.h" #include "llavatarappearancedefines.h" #include "llwearable.h" +#include "boost/bind.hpp" using namespace LLAvatarAppearanceDefines; @@ -149,7 +150,7 @@ void LLWearable::createVisualParams(LLAvatarAppearance *avatarp) { if( !param->linkDrivenParams(boost::bind(param_function,avatarp,_1 ), true)) { - llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl; + LL_WARNS() << "could not link driven params for wearable " << getName() << " id: " << param->getID() << LL_ENDL; continue; } } @@ -173,7 +174,7 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp) } else { - llerrs << "could not find layerset for LTO in wearable!" << llendl; + LL_ERRS() << "could not find layerset for LTO in wearable!" << LL_ENDL; } } @@ -207,7 +208,7 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // read header and version if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { - llwarns << "Failed to read wearable asset input stream." << llendl; + LL_WARNS() << "Failed to read wearable asset input stream." << LL_ENDL; return LLWearable::FAILURE; } if ( 1 != sscanf( /* Flawfinder: ignore */ @@ -225,15 +226,15 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // these wearables get re-saved with version definition 22. if( mDefinitionVersion > LLWearable::sCurrentDefinitionVersion && mDefinitionVersion != 24 ) { - llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl; + LL_WARNS() << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << LL_ENDL; return LLWearable::FAILURE; } // name may be empty if (!input_stream.good()) { - llwarns << "Bad Wearable asset: early end of input stream " - << "while reading name" << llendl; + LL_WARNS() << "Bad Wearable asset: early end of input stream " + << "while reading name" << LL_ENDL; return LLWearable::FAILURE; } input_stream.getline(buffer, PARSE_BUFFER_SIZE); @@ -242,8 +243,8 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // description may be empty if (!input_stream.good()) { - llwarns << "Bad Wearable asset: early end of input stream " - << "while reading description" << llendl; + LL_WARNS() << "Bad Wearable asset: early end of input stream " + << "while reading description" << LL_ENDL; return LLWearable::FAILURE; } input_stream.getline(buffer, PARSE_BUFFER_SIZE); @@ -252,15 +253,15 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // permissions may have extra empty lines before the correct line if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { - llwarns << "Bad Wearable asset: early end of input stream " - << "while reading permissions" << llendl; + LL_WARNS() << "Bad Wearable asset: early end of input stream " + << "while reading permissions" << LL_ENDL; return LLWearable::FAILURE; } S32 perm_version = -1; if ( 1 != sscanf( buffer, " permissions %d\n", &perm_version ) || perm_version != 0 ) { - llwarns << "Bad Wearable asset: missing valid permissions" << llendl; + LL_WARNS() << "Bad Wearable asset: missing valid permissions" << LL_ENDL; return LLWearable::FAILURE; } if( !mPermissions.importLegacyStream( input_stream ) ) @@ -271,15 +272,15 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // sale info if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { - llwarns << "Bad Wearable asset: early end of input stream " - << "while reading sale info" << llendl; + LL_WARNS() << "Bad Wearable asset: early end of input stream " + << "while reading sale info" << LL_ENDL; return LLWearable::FAILURE; } S32 sale_info_version = -1; if ( 1 != sscanf( buffer, " sale_info %d\n", &sale_info_version ) || sale_info_version != 0 ) { - llwarns << "Bad Wearable asset: missing valid sale_info" << llendl; + LL_WARNS() << "Bad Wearable asset: missing valid sale_info" << LL_ENDL; return LLWearable::FAILURE; } // Sale info used to contain next owner perm. It is now in the @@ -305,14 +306,14 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // wearable type if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { - llwarns << "Bad Wearable asset: early end of input stream " - << "while reading type" << llendl; + LL_WARNS() << "Bad Wearable asset: early end of input stream " + << "while reading type" << LL_ENDL; return LLWearable::FAILURE; } S32 type = -1; if ( 1 != sscanf( buffer, "type %d\n", &type ) ) { - llwarns << "Bad Wearable asset: bad type" << llendl; + LL_WARNS() << "Bad Wearable asset: bad type" << LL_ENDL; return LLWearable::FAILURE; } if( 0 <= type && type < LLWearableType::WT_COUNT ) @@ -322,36 +323,36 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, else { mType = LLWearableType::WT_COUNT; - llwarns << "Bad Wearable asset: bad type #" << type << llendl; + LL_WARNS() << "Bad Wearable asset: bad type #" << type << LL_ENDL; return LLWearable::FAILURE; } // parameters header if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { - llwarns << "Bad Wearable asset: early end of input stream " - << "while reading parameters header" << llendl; + LL_WARNS() << "Bad Wearable asset: early end of input stream " + << "while reading parameters header" << LL_ENDL; return LLWearable::FAILURE; } S32 num_parameters = -1; if ( 1 != sscanf( buffer, "parameters %d\n", &num_parameters ) ) { - llwarns << "Bad Wearable asset: missing parameters block" << llendl; + LL_WARNS() << "Bad Wearable asset: missing parameters block" << LL_ENDL; return LLWearable::FAILURE; } if ( num_parameters > MAX_WEARABLE_ASSET_PARAMETERS ) { - llwarns << "Bad Wearable asset: too many parameters, " - << num_parameters << llendl; + LL_WARNS() << "Bad Wearable asset: too many parameters, " + << num_parameters << LL_ENDL; return LLWearable::FAILURE; } if( num_parameters != mVisualParamIndexMap.size() ) { - llwarns << "Wearable parameter mismatch. Reading in " + LL_WARNS() << "Wearable parameter mismatch. Reading in " << num_parameters << " from file, but created " << mVisualParamIndexMap.size() << " from avatar parameters. type: " - << getType() << llendl; + << getType() << LL_ENDL; } // parameters @@ -360,15 +361,15 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, { if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { - llwarns << "Bad Wearable asset: early end of input stream " - << "while reading parameter #" << i << llendl; + LL_WARNS() << "Bad Wearable asset: early end of input stream " + << "while reading parameter #" << i << LL_ENDL; return LLWearable::FAILURE; } S32 param_id = 0; F32 param_weight = 0.f; if ( 2 != sscanf( buffer, "%d %f\n", ¶m_id, ¶m_weight ) ) { - llwarns << "Bad Wearable asset: bad parameter, #" << i << llendl; + LL_WARNS() << "Bad Wearable asset: bad parameter, #" << i << LL_ENDL; return LLWearable::FAILURE; } mSavedVisualParamMap[param_id] = param_weight; @@ -377,20 +378,20 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // textures header if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { - llwarns << "Bad Wearable asset: early end of input stream " - << "while reading textures header" << i << llendl; + LL_WARNS() << "Bad Wearable asset: early end of input stream " + << "while reading textures header" << i << LL_ENDL; return LLWearable::FAILURE; } S32 num_textures = -1; if ( 1 != sscanf( buffer, "textures %d\n", &num_textures) ) { - llwarns << "Bad Wearable asset: missing textures block" << llendl; + LL_WARNS() << "Bad Wearable asset: missing textures block" << LL_ENDL; return LLWearable::FAILURE; } if ( num_textures > MAX_WEARABLE_ASSET_TEXTURES ) { - llwarns << "Bad Wearable asset: too many textures, " - << num_textures << llendl; + LL_WARNS() << "Bad Wearable asset: too many textures, " + << num_textures << LL_ENDL; return LLWearable::FAILURE; } @@ -399,8 +400,8 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, { if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { - llwarns << "Bad Wearable asset: early end of input stream " - << "while reading textures #" << i << llendl; + LL_WARNS() << "Bad Wearable asset: early end of input stream " + << "while reading textures #" << i << LL_ENDL; return LLWearable::FAILURE; } S32 te = 0; @@ -409,14 +410,14 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, "%d %36s\n", &te, uuid_buffer) ) { - llwarns << "Bad Wearable asset: bad texture, #" << i << llendl; + LL_WARNS() << "Bad Wearable asset: bad texture, #" << i << LL_ENDL; return LLWearable::FAILURE; } if( !LLUUID::validate( uuid_buffer ) ) { - llwarns << "Bad Wearable asset: bad texture uuid: " - << uuid_buffer << llendl; + LL_WARNS() << "Bad Wearable asset: bad texture uuid: " + << uuid_buffer << LL_ENDL; return LLWearable::FAILURE; } LLUUID id = LLUUID(uuid_buffer); @@ -655,7 +656,7 @@ void LLWearable::setVisualParamWeight(S32 param_index, F32 value, BOOL upload_ba } else { - llerrs << "LLWearable::setVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl; + LL_ERRS() << "LLWearable::setVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << LL_ENDL; } } @@ -668,7 +669,7 @@ F32 LLWearable::getVisualParamWeight(S32 param_index) const } else { - llwarns << "LLWerable::getVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl; + LL_WARNS() << "LLWerable::getVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << LL_ENDL; } return (F32)-1.0; } diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h index 6f5a1e14e8ab82ae5e3dec1c1e8b6e24448477a7..132c153bcdb5c1515648391d9476b4b17b26043c 100644 --- a/indra/llappearance/llwearable.h +++ b/indra/llappearance/llwearable.h @@ -28,16 +28,15 @@ #define LL_LLWEARABLE_H #include "llavatarappearancedefines.h" -#include "llextendedstatus.h" #include "llpermissions.h" #include "llsaleinfo.h" #include "llwearabletype.h" -#include "lllocaltextureobject.h" class LLMD5; class LLVisualParam; class LLTexGlobalColorInfo; class LLTexGlobalColor; +class LLLocalTextureObject; class LLAvatarAppearance; // Abstract class. diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp index 68fdcca78214dc7030de849e35e9280838cbd1c2..089370dbc45995896459d6f904bf80c02a36c93a 100644 --- a/indra/llappearance/llwearabledata.cpp +++ b/indra/llappearance/llwearabledata.cpp @@ -75,13 +75,13 @@ void LLWearableData::setWearable(const LLWearableType::EType type, U32 index, LL wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type); if (wearable_iter == mWearableDatas.end()) { - llwarns << "invalid type, type " << type << " index " << index << llendl; + LL_WARNS() << "invalid type, type " << type << " index " << index << LL_ENDL; return; } wearableentry_vec_t& wearable_vec = wearable_iter->second; if (index>=wearable_vec.size()) { - llwarns << "invalid index, type " << type << " index " << index << llendl; + LL_WARNS() << "invalid index, type " << type << " index " << index << LL_ENDL; } else { @@ -99,7 +99,7 @@ U32 LLWearableData::pushWearable(const LLWearableType::EType type, if (wearable == NULL) { // no null wearables please! - llwarns << "Null wearable sent for type " << type << llendl; + LL_WARNS() << "Null wearable sent for type " << type << LL_ENDL; return MAX_CLOTHING_PER_TYPE; } if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) @@ -221,7 +221,7 @@ U32 LLWearableData::getWearableIndex(const LLWearable *wearable) const wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type); if (wearable_iter == mWearableDatas.end()) { - llwarns << "tried to get wearable index with an invalid type!" << llendl; + LL_WARNS() << "tried to get wearable index with an invalid type!" << LL_ENDL; return MAX_CLOTHING_PER_TYPE; } const wearableentry_vec_t& wearable_vec = wearable_iter->second; diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index ef63b2cc044d73d1e92d542f0821c392c499abd1..20a7afc748edca6b14535ae4a48559d1a93b31e0 100755 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -40,6 +40,8 @@ #include "vorbis/codec.h" #include "vorbis/vorbisfile.h" +#include <iterator> +#include <deque> extern LLAudioEngine *gAudiop; @@ -113,7 +115,7 @@ size_t vfs_read(void *ptr, size_t size, size_t nmemb, void *datasource) } } -int vfs_seek(void *datasource, ogg_int64_t offset, int whence) +S32 vfs_seek(void *datasource, ogg_int64_t offset, S32 whence) { LLVFile *file = (LLVFile *)datasource; @@ -149,7 +151,7 @@ int vfs_seek(void *datasource, ogg_int64_t offset, int whence) } } -int vfs_close (void *datasource) +S32 vfs_close (void *datasource) { LLVFile *file = (LLVFile *)datasource; delete file; @@ -208,7 +210,7 @@ BOOL LLVorbisDecodeState::initDecode() return FALSE; } - int r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, vfs_callbacks); + S32 r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, vfs_callbacks); if(r < 0) { LL_WARNS("AudioEngine") << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << mUUID << LL_ENDL; @@ -541,7 +543,7 @@ class LLAudioDecodeMgr::Impl void processQueue(const F32 num_secs = 0.005); protected: - LLLinkedQueue<LLUUID> mDecodeQueue; + std::deque<LLUUID> mDecodeQueue; LLPointer<LLVorbisDecodeState> mCurrentDecodep; }; @@ -621,7 +623,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) if (!done) { - if (!mDecodeQueue.getLength()) + if (mDecodeQueue.empty()) { // Nothing else on the queue. done = TRUE; @@ -629,14 +631,15 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) else { LLUUID uuid; - mDecodeQueue.pop(uuid); + uuid = mDecodeQueue.front(); + mDecodeQueue.pop_front(); if (!gAudiop || gAudiop->hasDecodedFile(uuid)) { // This file has already been decoded, don't decode it again. continue; } - lldebugs << "Decoding " << uuid << " from audio queue!" << LL_ENDL; + LL_DEBUGS() << "Decoding " << uuid << " from audio queue!" << LL_ENDL; std::string uuid_str; std::string d_path; @@ -687,7 +690,7 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) { // Just put it on the decode queue. LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has local asset file already" << LL_ENDL; - mImpl->mDecodeQueue.push(uuid); + mImpl->mDecodeQueue.push_back(uuid); return TRUE; } diff --git a/indra/llaudio/llaudiodecodemgr.h b/indra/llaudio/llaudiodecodemgr.h index e42fe8a40d3855670004bbe666b817ceb3b4f910..7a9b807d04db0ccc7247e443b319f928e3165e09 100755 --- a/indra/llaudio/llaudiodecodemgr.h +++ b/indra/llaudio/llaudiodecodemgr.h @@ -28,7 +28,6 @@ #include "stdtypes.h" -#include "lllinkedqueue.h" #include "lluuid.h" #include "llassettype.h" diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index ecdfcaf73a2191711b6a867b6fbc33b08f75ec17..f49028aad51955fbc5a606cda3ebcf9f2985e43e 100755 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -187,7 +187,7 @@ void LLAudioEngine::stopInternetStream() } // virtual -void LLAudioEngine::pauseInternetStream(int pause) +void LLAudioEngine::pauseInternetStream(S32 pause) { if (mStreamingAudioImpl) mStreamingAudioImpl->pause(pause); @@ -308,7 +308,7 @@ void LLAudioEngine::idle(F32 max_decode_time) LLAudioChannel *channelp = getFreeChannel(max_priority); if (channelp) { - LL_DEBUGS("AudioEngine") << "Replacing source in channel due to priority!" << LL_ENDL; + //LL_INFOS() << "Replacing source in channel due to priority!" << LL_ENDL; max_sourcep->setChannel(channelp); channelp->setSource(max_sourcep); if (max_sourcep->isSyncSlave()) @@ -479,7 +479,7 @@ void LLAudioEngine::idle(F32 max_decode_time) { if (!mBuffers[i]->mInUse && mBuffers[i]->mLastUseTimer.getElapsedTimeF32() > 30.f) { - LL_DEBUGS("AudioEngine") << "Flushing unused buffer!" << LL_ENDL; + //LL_INFOS() << "Flushing unused buffer!" << LL_ENDL; mBuffers[i]->mAudioDatap->mBufferp = NULL; delete mBuffers[i]; mBuffers[i] = NULL; @@ -591,8 +591,8 @@ LLAudioBuffer * LLAudioEngine::getFreeBuffer() if (buffer_id >= 0) { - lldebugs << "Taking over unused buffer " << buffer_id << LL_ENDL; - LL_DEBUGS("AudioEngine") << "Flushing unused buffer!" << LL_ENDL; + LL_DEBUGS() << "Taking over unused buffer " << buffer_id << LL_ENDL; + //LL_INFOS() << "Flushing unused buffer!" << LL_ENDL; mBuffers[buffer_id]->mAudioDatap->mBufferp = NULL; delete mBuffers[buffer_id]; mBuffers[buffer_id] = createBuffer(); @@ -686,7 +686,7 @@ bool LLAudioEngine::preloadSound(const LLUUID &uuid) // At some point we need to have the audio/asset system check the static VFS // before it goes off and fetches stuff from the server. - LL_DEBUGS("AudioEngine") << "Used internal preload for non-local sound "<< uuid << LL_ENDL; + //LL_WARNS() << "Used internal preload for non-local sound" << LL_ENDL; return false; } @@ -817,7 +817,7 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i const S32 type, const LLVector3d &pos_global) { // Create a new source (since this can't be associated with an existing source. - LL_DEBUGS("AudioEngine") << "Localized: " << audio_uuid << LL_ENDL; + //LL_INFOS() << "Localized: " << audio_uuid << LL_ENDL; if (mMuted) { @@ -984,14 +984,15 @@ void LLAudioEngine::cleanupAudioSource(LLAudioSource *asp) iter = mAllSources.find(asp->getID()); if (iter == mAllSources.end()) { - LL_WARNS("AudioEngine") << "Cleaning up unknown audio source!" << LL_ENDL; + LL_WARNS() << "Cleaning up unknown audio source!" << LL_ENDL; + return; } else { LL_DEBUGS("AudioEngine") << "Cleaning up audio sources for "<< asp->getID() <<LL_ENDL; - delete asp; - mAllSources.erase(iter); - } + delete asp; + mAllSources.erase(iter); +} } @@ -1026,10 +1027,10 @@ bool LLAudioEngine::hasLocalFile(const LLUUID &uuid) void LLAudioEngine::startNextTransfer() { - //LL_DEBUGS("AudioEngine") << "LLAudioEngine::startNextTransfer()" << LL_ENDL; + //LL_INFOS() << "LLAudioEngine::startNextTransfer()" << LL_ENDL; if (mCurrentTransfer.notNull() || getMuted()) { - //LL_DEBUGS("AudioEngine") << "Transfer in progress, aborting" << LL_ENDL; + //LL_INFOS() << "Transfer in progress, aborting" << LL_ENDL; return; } @@ -1210,7 +1211,7 @@ void LLAudioEngine::startNextTransfer() if (asset_id.notNull()) { - LL_INFOS("AudioEngine") << "Getting audio asset data for: " << asset_id << LL_ENDL; + LL_INFOS() << "Getting asset data for: " << asset_id << LL_ENDL; mCurrentTransfer = asset_id; mCurrentTransferTimer.reset(); gAssetStorage->getAssetData(asset_id, LLAssetType::AT_SOUND, @@ -1218,7 +1219,7 @@ void LLAudioEngine::startNextTransfer() } else { - //LL_DEBUGS("AudioEngine") << "No pending transfers?" << LL_ENDL; + //LL_INFOS() << "No pending transfers?" << LL_ENDL; } } @@ -1234,7 +1235,7 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E if (result_code) { - LL_INFOS("AudioEngine") << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL; + LL_INFOS() << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL; // Need to mark data as bad to avoid constant rerequests. LLAudioData *adp = gAudiop->getAudioData(uuid); if (adp) @@ -1251,11 +1252,11 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E if (!adp) { // Should never happen - LL_WARNS("AudioEngine") << "Got asset callback without audio data for " << uuid << LL_ENDL; + LL_WARNS() << "Got asset callback without audio data for " << uuid << LL_ENDL; } else { - LL_DEBUGS("AudioEngine") << "Got asset callback with good audio data for " << uuid << ", making decode request" << LL_ENDL; + // LL_INFOS() << "Got asset callback with good audio data for " << uuid << ", making decode request" << LL_ENDL; adp->setHasValidData(true); adp->setHasLocalData(true); gAudioDecodeMgrp->addDecodeRequest(uuid); @@ -1334,7 +1335,7 @@ void LLAudioSource::update() } else if (adp->hasCompletedDecode()) // Only mark corrupted after decode is done { - LL_WARNS("AudioEngine") << "Marking LLAudioSource corrupted for " << adp->getID() << LL_ENDL; + LL_WARNS() << "Marking LLAudioSource corrupted for " << adp->getID() << LL_ENDL; mCorrupted = true ; } } @@ -1375,6 +1376,7 @@ bool LLAudioSource::setupChannel() if (!adp->getBuffer()) { // We're not ready to play back the sound yet, so don't try and allocate a channel for it. + //LL_WARNS() << "Aborting, no buffer" << LL_ENDL; return false; } @@ -1397,7 +1399,7 @@ bool LLAudioSource::setupChannel() // Ugh, we don't have any free channels. // Now we have to reprioritize. // For now, just don't play the sound. - //llwarns << "Aborting, no free channels" << LL_ENDL; + //LL_WARNS() << "Aborting, no free channels" << LL_ENDL; return false; } @@ -1502,7 +1504,7 @@ bool LLAudioSource::isDone() const { // We don't have a channel assigned, and it's been // over 15 seconds since we tried to play it. Don't bother. - LL_DEBUGS("AudioEngine") << "No channel assigned, source is done" << LL_ENDL; + //LL_INFOS() << "No channel assigned, source is done" << LL_ENDL; return true; } else @@ -1675,7 +1677,7 @@ LLAudioChannel::LLAudioChannel() : LLAudioChannel::~LLAudioChannel() { // Need to disconnect any sources which are using this channel. - LL_DEBUGS("AudioEngine") << "Cleaning up audio channel" << LL_ENDL; + //LL_INFOS() << "Cleaning up audio channel" << LL_ENDL; if (mCurrentSourcep) { mCurrentSourcep->setChannel(NULL); @@ -1686,10 +1688,12 @@ LLAudioChannel::~LLAudioChannel() void LLAudioChannel::setSource(LLAudioSource *sourcep) { + //LL_INFOS() << this << ": setSource(" << sourcep << ")" << LL_ENDL; + if (!sourcep) { // Clearing the source for this channel, don't need to do anything. - LL_DEBUGS("AudioEngine") << "Clearing source" << ( mCurrentSourcep ? mCurrentSourcep->getID() : LLUUID::null ) << LL_ENDL; + //LL_INFOS() << "Clearing source for channel" << LL_ENDL; cleanup(); mCurrentSourcep = NULL; mWaiting = false; @@ -1698,17 +1702,17 @@ void LLAudioChannel::setSource(LLAudioSource *sourcep) { LL_DEBUGS("AudioEngine") << "( id: " << sourcep->getID() << ")" << LL_ENDL; - if (sourcep == mCurrentSourcep) - { - // Don't reallocate the channel, this will make FMOD goofy. - //LL_DEBUGS("AudioEngine") << "Calling setSource with same source!" << LL_ENDL; - } - - mCurrentSourcep = sourcep; - - updateBuffer(); - update3DPosition(); + if (sourcep == mCurrentSourcep) + { + // Don't reallocate the channel, this will make FMOD goofy. + //LL_INFOS() << "Calling setSource with same source!" << LL_ENDL; } + + mCurrentSourcep = sourcep; + + updateBuffer(); + update3DPosition(); +} } @@ -1812,7 +1816,7 @@ bool LLAudioData::load() if (mBufferp) { // We already have this sound in a buffer, don't do anything. - LL_INFOS("AudioEngine") << "Already have a buffer for this sound, don't bother loading!" << LL_ENDL; + LL_INFOS() << "Already have a buffer for this sound, don't bother loading!" << LL_ENDL; return true; } @@ -1826,7 +1830,7 @@ bool LLAudioData::load() if (!mBufferp) { // No free buffers, abort. - LL_INFOS("AudioEngine") << "Not able to allocate a new audio buffer, aborting." << LL_ENDL; + LL_INFOS() << "Not able to allocate a new audio buffer, aborting." << LL_ENDL; return true; } diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index da1629a1db57a7c1fda86305a06e6ced52e90898..f1e1b4e308c79a440115011ed64a53c2dfe0343e 100755 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -88,7 +88,7 @@ class LLAudioEngine enum LLAudioPlayState { - // isInternetStreamPlaying() returns an *int*, with + // isInternetStreamPlaying() returns an *S32*, with // 0 = stopped, 1 = playing, 2 = paused. AUDIO_STOPPED = 0, AUDIO_PLAYING = 1, @@ -160,7 +160,7 @@ class LLAudioEngine // Internet stream methods - these will call down into the *mStreamingAudioImpl if it exists void startInternetStream(const std::string& url); void stopInternetStream(); - void pauseInternetStream(int pause); + void pauseInternetStream(S32 pause); void updateInternetStream(); // expected to be called often LLAudioPlayState isInternetStreamPlaying(); // use a value from 0.0 to 1.0, inclusive diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp index 36e8044a25f7c6289f3a0738cee39320bff44760..7e65a05e48ab561f7c65b9cdd406571c5f2bba42 100644 --- a/indra/llaudio/llaudioengine_fmodex.cpp +++ b/indra/llaudio/llaudioengine_fmodex.cpp @@ -69,7 +69,7 @@ inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) { if(result == FMOD_OK) return false; - lldebugs << string << " Error: " << FMOD_ErrorString(result) << llendl; + LL_DEBUGS() << string << " Error: " << FMOD_ErrorString(result) << LL_ENDL; return true; } @@ -77,11 +77,11 @@ void* F_STDCALL decode_alloc(unsigned int size, FMOD_MEMORY_TYPE type, const cha { if(type & FMOD_MEMORY_STREAM_DECODE) { - llinfos << "Decode buffer size: " << size << llendl; + LL_INFOS() << "Decode buffer size: " << size << LL_ENDL; } else if(type & FMOD_MEMORY_STREAM_FILE) { - llinfos << "Strean buffer size: " << size << llendl; + LL_INFOS() << "Strean buffer size: " << size << LL_ENDL; } return new char[size]; } @@ -307,7 +307,7 @@ void LLAudioEngine_FMODEX::allocateListener(void) mListenerp = (LLListener *) new LLListener_FMODEX(mSystem); if (!mListenerp) { - llwarns << "Listener creation failed" << llendl; + LL_WARNS() << "Listener creation failed" << LL_ENDL; } } @@ -316,16 +316,16 @@ void LLAudioEngine_FMODEX::shutdown() { stopInternetStream(); - llinfos << "About to LLAudioEngine::shutdown()" << llendl; + LL_INFOS() << "About to LLAudioEngine::shutdown()" << LL_ENDL; LLAudioEngine::shutdown(); - llinfos << "LLAudioEngine_FMODEX::shutdown() closing FMOD Ex" << llendl; + LL_INFOS() << "LLAudioEngine_FMODEX::shutdown() closing FMOD Ex" << LL_ENDL; if ( mSystem ) // speculative fix for MAINT-2657 { mSystem->close(); mSystem->release(); } - llinfos << "LLAudioEngine_FMODEX::shutdown() done closing FMOD Ex" << llendl; + LL_INFOS() << "LLAudioEngine_FMODEX::shutdown() done closing FMOD Ex" << LL_ENDL; delete mListenerp; mListenerp = NULL; @@ -474,7 +474,7 @@ bool LLAudioChannelFMODEX::updateBuffer() { // This is bad, there should ALWAYS be a sound associated with a legit // buffer. - llerrs << "No FMOD sound!" << llendl; + LL_ERRS() << "No FMOD sound!" << LL_ENDL; return false; } @@ -487,7 +487,7 @@ bool LLAudioChannelFMODEX::updateBuffer() Check_FMOD_Error(result, "FMOD::System::playSound"); } - //llinfos << "Setting up channel " << std::hex << mChannelID << std::dec << llendl; + //LL_INFOS() << "Setting up channel " << std::hex << mChannelID << std::dec << LL_ENDL; } // If we have a source for the channel, we need to update its gain. @@ -504,8 +504,8 @@ bool LLAudioChannelFMODEX::updateBuffer() { S32 index; mChannelp->getIndex(&index); - llwarns << "Channel " << index << "Source ID: " << mCurrentSourcep->getID() - << " at " << mCurrentSourcep->getPositionGlobal() << llendl; + LL_WARNS() << "Channel " << index << "Source ID: " << mCurrentSourcep->getID() + << " at " << mCurrentSourcep->getPositionGlobal() << LL_ENDL; }*/ } @@ -575,11 +575,11 @@ void LLAudioChannelFMODEX::cleanup() { if (!mChannelp) { - //llinfos << "Aborting cleanup with no channel handle." << llendl; + //LL_INFOS() << "Aborting cleanup with no channel handle." << LL_ENDL; return; } - //llinfos << "Cleaning up channel: " << mChannelID << llendl; + //LL_INFOS() << "Cleaning up channel: " << mChannelID << LL_ENDL; Check_FMOD_Error(mChannelp->stop(),"FMOD::Channel::stop"); mCurrentBufferp = NULL; @@ -591,7 +591,7 @@ void LLAudioChannelFMODEX::play() { if (!mChannelp) { - llwarns << "Playing without a channel handle, aborting" << llendl; + LL_WARNS() << "Playing without a channel handle, aborting" << LL_ENDL; return; } @@ -699,7 +699,7 @@ bool LLAudioBufferFMODEX::loadWAV(const std::string& filename) if (result != FMOD_OK) { // We failed to load the file for some reason. - llwarns << "Could not load data '" << filename << "': " << FMOD_ErrorString(result) << llendl; + LL_WARNS() << "Could not load data '" << filename << "': " << FMOD_ErrorString(result) << LL_ENDL; // // If we EVER want to load wav files provided by end users, we need diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp index 34a057dcc0f64a4048cc8ca676d080ce57965799..e6ac586618e3cb2855e76a3b308c2a6ab181a8c4 100755 --- a/indra/llaudio/llaudioengine_openal.cpp +++ b/indra/llaudio/llaudioengine_openal.cpp @@ -59,33 +59,33 @@ bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata) if(!alutInit(NULL, NULL)) { - llwarns << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << alutGetErrorString (alutGetError ()) << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << alutGetErrorString (alutGetError ()) << LL_ENDL; return false; } - llinfos << "LLAudioEngine_OpenAL::init() OpenAL successfully initialized" << llendl; + LL_INFOS() << "LLAudioEngine_OpenAL::init() OpenAL successfully initialized" << LL_ENDL; - llinfos << "OpenAL version: " - << ll_safe_string(alGetString(AL_VERSION)) << llendl; - llinfos << "OpenAL vendor: " - << ll_safe_string(alGetString(AL_VENDOR)) << llendl; - llinfos << "OpenAL renderer: " - << ll_safe_string(alGetString(AL_RENDERER)) << llendl; + LL_INFOS() << "OpenAL version: " + << ll_safe_string(alGetString(AL_VERSION)) << LL_ENDL; + LL_INFOS() << "OpenAL vendor: " + << ll_safe_string(alGetString(AL_VENDOR)) << LL_ENDL; + LL_INFOS() << "OpenAL renderer: " + << ll_safe_string(alGetString(AL_RENDERER)) << LL_ENDL; ALint major = alutGetMajorVersion (); ALint minor = alutGetMinorVersion (); - llinfos << "ALUT version: " << major << "." << minor << llendl; + LL_INFOS() << "ALUT version: " << major << "." << minor << LL_ENDL; ALCdevice *device = alcGetContextsDevice(alcGetCurrentContext()); alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major); alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &minor); - llinfos << "ALC version: " << major << "." << minor << llendl; + LL_INFOS() << "ALC version: " << major << "." << minor << LL_ENDL; - llinfos << "ALC default device: " + LL_INFOS() << "ALC default device: " << ll_safe_string(alcGetString(device, ALC_DEFAULT_DEVICE_SPECIFIER)) - << llendl; + << LL_ENDL; return true; } @@ -125,24 +125,24 @@ void LLAudioEngine_OpenAL::allocateListener() mListenerp = (LLListener *) new LLListener_OpenAL(); if(!mListenerp) { - llwarns << "LLAudioEngine_OpenAL::allocateListener() Listener creation failed" << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::allocateListener() Listener creation failed" << LL_ENDL; } } // virtual void LLAudioEngine_OpenAL::shutdown() { - llinfos << "About to LLAudioEngine::shutdown()" << llendl; + LL_INFOS() << "About to LLAudioEngine::shutdown()" << LL_ENDL; LLAudioEngine::shutdown(); - llinfos << "About to alutExit()" << llendl; + LL_INFOS() << "About to alutExit()" << LL_ENDL; if(!alutExit()) { - llwarns << "Nuts." << llendl; - llwarns << "LLAudioEngine_OpenAL::shutdown() ALUT shutdown failed: " << alutGetErrorString (alutGetError ()) << llendl; + LL_WARNS() << "Nuts." << LL_ENDL; + LL_WARNS() << "LLAudioEngine_OpenAL::shutdown() ALUT shutdown failed: " << alutGetErrorString (alutGetError ()) << LL_ENDL; } - llinfos << "LLAudioEngine_OpenAL::shutdown() OpenAL successfully shut down" << llendl; + LL_INFOS() << "LLAudioEngine_OpenAL::shutdown() OpenAL successfully shut down" << LL_ENDL; delete mListenerp; mListenerp = NULL; @@ -160,7 +160,7 @@ LLAudioChannel *LLAudioEngine_OpenAL::createChannel() void LLAudioEngine_OpenAL::setInternalGain(F32 gain) { - //llinfos << "LLAudioEngine_OpenAL::setInternalGain() Gain: " << gain << llendl; + //LL_INFOS() << "LLAudioEngine_OpenAL::setInternalGain() Gain: " << gain << LL_ENDL; alListenerf(AL_GAIN, gain); } @@ -188,7 +188,7 @@ void LLAudioChannelOpenAL::play() { if (mALSource == AL_NONE) { - llwarns << "Playing without a mALSource, aborting" << llendl; + LL_WARNS() << "Playing without a mALSource, aborting" << LL_ENDL; return; } @@ -213,8 +213,8 @@ void LLAudioChannelOpenAL::playSynced(LLAudioChannel *channelp) alGetSourcef(masterchannelp->mALSource, AL_SEC_OFFSET, &master_offset); - llinfos << "Syncing with master at " << master_offset - << "sec" << llendl; + LL_INFOS() << "Syncing with master at " << master_offset + << "sec" << LL_ENDL; // *TODO: detect when this fails, maybe use AL_SAMPLE_ alSourcef(mALSource, AL_SEC_OFFSET, master_offset); } @@ -334,18 +334,18 @@ bool LLAudioBufferOpenAL::loadWAV(const std::string& filename) ALenum error = alutGetError(); if (gDirUtilp->fileExists(filename)) { - llwarns << + LL_WARNS() << "LLAudioBufferOpenAL::loadWAV() Error loading " << filename - << " " << alutGetErrorString(error) << llendl; + << " " << alutGetErrorString(error) << LL_ENDL; } else { // It's common for the file to not actually exist. - lldebugs << + LL_DEBUGS() << "LLAudioBufferOpenAL::loadWAV() Error loading " << filename - << " " << alutGetErrorString(error) << llendl; + << " " << alutGetErrorString(error) << LL_ENDL; } return false; } @@ -369,7 +369,7 @@ U32 LLAudioBufferOpenAL::getLength() bool LLAudioEngine_OpenAL::initWind() { ALenum error; - llinfos << "LLAudioEngine_OpenAL::initWind() start" << llendl; + LL_INFOS() << "LLAudioEngine_OpenAL::initWind() start" << LL_ENDL; mNumEmptyWindALBuffers = MAX_NUM_WIND_BUFFERS; @@ -379,7 +379,7 @@ bool LLAudioEngine_OpenAL::initWind() if((error=alGetError()) != AL_NO_ERROR) { - llwarns << "LLAudioEngine_OpenAL::initWind() Error creating wind sources: "<<error<<llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::initWind() Error creating wind sources: "<<error<<LL_ENDL; } mWindGen = new LLWindGen<WIND_SAMPLE_T>; @@ -392,18 +392,18 @@ bool LLAudioEngine_OpenAL::initWind() if(mWindBuf==NULL) { - llerrs << "LLAudioEngine_OpenAL::initWind() Error creating wind memory buffer" << llendl; + LL_ERRS() << "LLAudioEngine_OpenAL::initWind() Error creating wind memory buffer" << LL_ENDL; return false; } - llinfos << "LLAudioEngine_OpenAL::initWind() done" << llendl; + LL_INFOS() << "LLAudioEngine_OpenAL::initWind() done" << LL_ENDL; return true; } void LLAudioEngine_OpenAL::cleanupWind() { - llinfos << "LLAudioEngine_OpenAL::cleanupWind()" << llendl; + LL_INFOS() << "LLAudioEngine_OpenAL::cleanupWind()" << LL_ENDL; if (mWindSource != AL_NONE) { @@ -479,7 +479,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) mNumEmptyWindALBuffers = llmin(mNumEmptyWindALBuffers + processed * 3 - unprocessed, MAX_NUM_WIND_BUFFERS-unprocessed); mNumEmptyWindALBuffers = llmax(mNumEmptyWindALBuffers, 0); - //llinfos << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << llendl; + //LL_INFOS() << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << LL_ENDL; while(processed--) // unqueue old buffers { @@ -490,7 +490,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) error = alGetError(); if(error != AL_NO_ERROR) { - llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (unqueuing) buffers" << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::updateWind() error swapping (unqueuing) buffers" << LL_ENDL; } else { @@ -506,7 +506,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) alGenBuffers(1,&buffer); if((error=alGetError()) != AL_NO_ERROR) { - llwarns << "LLAudioEngine_OpenAL::updateWind() Error creating wind buffer: " << error << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::updateWind() Error creating wind buffer: " << error << LL_ENDL; break; } @@ -519,14 +519,14 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) error = alGetError(); if(error != AL_NO_ERROR) { - llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers" << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers" << LL_ENDL; } alSourceQueueBuffers(mWindSource, 1, &buffer); error = alGetError(); if(error != AL_NO_ERROR) { - llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers" << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers" << LL_ENDL; } --mNumEmptyWindALBuffers; @@ -538,7 +538,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) { alSourcePlay(mWindSource); - lldebugs << "Wind had stopped - probably ran out of buffers - restarting: " << (unprocessed+mNumEmptyWindALBuffers) << " now queued." << llendl; + LL_DEBUGS() << "Wind had stopped - probably ran out of buffers - restarting: " << (unprocessed+mNumEmptyWindALBuffers) << " now queued." << LL_ENDL; } } diff --git a/indra/llaudio/lllistener_openal.cpp b/indra/llaudio/lllistener_openal.cpp index b3d4b02f09486d1d76606b21ed603ae7cc4596e7..9dd4c8685460ccf29603f406405e0a94b8e39b2d 100755 --- a/indra/llaudio/lllistener_openal.cpp +++ b/indra/llaudio/lllistener_openal.cpp @@ -41,13 +41,13 @@ LLListener_OpenAL::~LLListener_OpenAL() void LLListener_OpenAL::translate(LLVector3 offset) { - //llinfos << "LLListener_OpenAL::translate() : " << offset << llendl; + //LL_INFOS() << "LLListener_OpenAL::translate() : " << offset << LL_ENDL; LLListener::translate(offset); } void LLListener_OpenAL::setPosition(LLVector3 pos) { - //llinfos << "LLListener_OpenAL::setPosition() : " << pos << llendl; + //LL_INFOS() << "LLListener_OpenAL::setPosition() : " << pos << LL_ENDL; LLListener::setPosition(pos); } @@ -58,7 +58,7 @@ void LLListener_OpenAL::setVelocity(LLVector3 vel) void LLListener_OpenAL::orient(LLVector3 up, LLVector3 at) { - //llinfos << "LLListener_OpenAL::orient() up: " << up << " at: " << at << llendl; + //LL_INFOS() << "LLListener_OpenAL::orient() up: " << up << " at: " << at << LL_ENDL; LLListener::orient(up, at); } @@ -84,7 +84,7 @@ void LLListener_OpenAL::commitDeferredChanges() void LLListener_OpenAL::setDopplerFactor(F32 factor) { - //llinfos << "LLListener_OpenAL::setDopplerFactor() : " << factor << llendl; + //LL_INFOS() << "LLListener_OpenAL::setDopplerFactor() : " << factor << LL_ENDL; alDopplerFactor(factor); } @@ -92,7 +92,7 @@ F32 LLListener_OpenAL::getDopplerFactor() { ALfloat factor; factor = alGetFloat(AL_DOPPLER_FACTOR); - //llinfos << "LLListener_OpenAL::getDopplerFactor() : " << factor << llendl; + //LL_INFOS() << "LLListener_OpenAL::getDopplerFactor() : " << factor << LL_ENDL; return factor; } diff --git a/indra/llaudio/llstreamingaudio_fmodex.cpp b/indra/llaudio/llstreamingaudio_fmodex.cpp index 42f30aa1c44ef487795efbad38b58f03254fbd5e..9c9e85c00cb6d93a924390a6b7b51633a52cf028 100644 --- a/indra/llaudio/llstreamingaudio_fmodex.cpp +++ b/indra/llaudio/llstreamingaudio_fmodex.cpp @@ -91,7 +91,7 @@ void LLStreamingAudio_FMODEX::start(const std::string& url) { //if (!mInited) //{ - // llwarns << "startInternetStream before audio initialized" << llendl; + // LL_WARNS() << "startInternetStream before audio initialized" << LL_ENDL; // return; //} @@ -100,13 +100,13 @@ void LLStreamingAudio_FMODEX::start(const std::string& url) if (!url.empty()) { - llinfos << "Starting internet stream: " << url << llendl; + LL_INFOS() << "Starting internet stream: " << url << LL_ENDL; mCurrentInternetStreamp = new LLAudioStreamManagerFMODEX(mSystem,url); mURL = url; } else { - llinfos << "Set internet stream to null" << llendl; + LL_INFOS() << "Set internet stream to null" << LL_ENDL; mURL.clear(); } } @@ -121,7 +121,7 @@ void LLStreamingAudio_FMODEX::update() LLAudioStreamManagerFMODEX *streamp = *iter; if (streamp->stopStream()) { - llinfos << "Closed dead stream" << llendl; + LL_INFOS() << "Closed dead stream" << LL_ENDL; delete streamp; mDeadStreams.erase(iter++); } @@ -181,7 +181,7 @@ void LLStreamingAudio_FMODEX::update() { if (!strcmp(tag.name, "Sample Rate Change")) { - llinfos << "Stream forced changing sample rate to " << *((float *)tag.data) << llendl; + LL_INFOS() << "Stream forced changing sample rate to " << *((float *)tag.data) << LL_ENDL; mFMODInternetStreamChannelp->setFrequency(*((float *)tag.data)); } continue; @@ -195,9 +195,9 @@ void LLStreamingAudio_FMODEX::update() mFMODInternetStreamChannelp->getPaused(&paused); if(!paused) { - llinfos << "Stream starvation detected! Pausing stream until buffer nearly full." << llendl; - llinfos << " (diskbusy="<<diskbusy<<")" << llendl; - llinfos << " (progress="<<progress<<")" << llendl; + LL_INFOS() << "Stream starvation detected! Pausing stream until buffer nearly full." << LL_ENDL; + LL_INFOS() << " (diskbusy="<<diskbusy<<")" << LL_ENDL; + LL_INFOS() << " (progress="<<progress<<")" << LL_ENDL; mFMODInternetStreamChannelp->setPaused(true); } } @@ -220,14 +220,14 @@ void LLStreamingAudio_FMODEX::stop() if (mCurrentInternetStreamp) { - llinfos << "Stopping internet stream: " << mCurrentInternetStreamp->getURL() << llendl; + LL_INFOS() << "Stopping internet stream: " << mCurrentInternetStreamp->getURL() << LL_ENDL; if (mCurrentInternetStreamp->stopStream()) { delete mCurrentInternetStreamp; } else { - llwarns << "Pushing stream to dead list: " << mCurrentInternetStreamp->getURL() << llendl; + LL_WARNS() << "Pushing stream to dead list: " << mCurrentInternetStreamp->getURL() << LL_ENDL; mDeadStreams.push_back(mCurrentInternetStreamp); } mCurrentInternetStreamp = NULL; @@ -314,9 +314,9 @@ LLAudioStreamManagerFMODEX::LLAudioStreamManagerFMODEX(FMOD::System *system, con if (result!= FMOD_OK) { - llwarns << "Couldn't open fmod stream, error " + LL_WARNS() << "Couldn't open fmod stream, error " << FMOD_ErrorString(result) - << llendl; + << LL_ENDL; mReady = false; return; } @@ -329,7 +329,7 @@ FMOD::Channel *LLAudioStreamManagerFMODEX::startStream() // We need a live and opened stream before we try and play it. if (!mInternetStream || getOpenState() != FMOD_OPENSTATE_READY) { - llwarns << "No internet stream to start playing!" << llendl; + LL_WARNS() << "No internet stream to start playing!" << LL_ENDL; return NULL; } diff --git a/indra/llaudio/llstreamingaudio_fmodex.h b/indra/llaudio/llstreamingaudio_fmodex.h index 1dee18ae7dab520cea4295bdd254dc14a4da21d2..2787840ba1a8581bba725f3574c0620fa9c7ea3e 100644 --- a/indra/llaudio/llstreamingaudio_fmodex.h +++ b/indra/llaudio/llstreamingaudio_fmodex.h @@ -49,9 +49,9 @@ class LLStreamingAudio_FMODEX : public LLStreamingAudioInterface /*virtual*/ void start(const std::string& url); /*virtual*/ void stop(); - /*virtual*/ void pause(int pause); + /*virtual*/ void pause(S32 pause); /*virtual*/ void update(); - /*virtual*/ int isPlaying(); + /*virtual*/ S32 isPlaying(); /*virtual*/ void setGain(F32 vol); /*virtual*/ F32 getGain(); /*virtual*/ std::string getURL(); diff --git a/indra/llaudio/llvorbisencode.cpp b/indra/llaudio/llvorbisencode.cpp index dfd5da12b3fa4f700c8f1acd4c95e1d8f2b673a2..2e1ed9b5057af2e237df0ee7acd1f43a45fee6d9 100755 --- a/indra/llaudio/llvorbisencode.cpp +++ b/indra/llaudio/llvorbisencode.cpp @@ -127,7 +127,7 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro return(LLVORBISENC_CHUNK_SIZE_ERR); } -// llinfos << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << llendl; +// LL_INFOS() << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << LL_ENDL; if (!(strncmp((char *)&(wav_header[0]),"fmt ",4))) { @@ -224,7 +224,7 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname std::string error_msg; if ((format_error = check_for_invalid_wav_formats(in_fname, error_msg))) { - llwarns << error_msg << ": " << in_fname << llendl; + LL_WARNS() << error_msg << ": " << in_fname << LL_ENDL; return(format_error); } @@ -237,8 +237,8 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname infile.open(in_fname,LL_APR_RB); if (!infile.getFileHandle()) { - llwarns << "Couldn't open temporary ogg file for writing: " << in_fname - << llendl; + LL_WARNS() << "Couldn't open temporary ogg file for writing: " << in_fname + << LL_ENDL; return(LLVORBISENC_SOURCE_OPEN_ERR); } @@ -246,8 +246,8 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname outfile.open(out_fname,LL_APR_WPB); if (!outfile.getFileHandle()) { - llwarns << "Couldn't open upload sound file for reading: " << in_fname - << llendl; + LL_WARNS() << "Couldn't open upload sound file for reading: " << in_fname + << LL_ENDL; return(LLVORBISENC_DEST_OPEN_ERR); } @@ -265,7 +265,7 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname + ((U32) wav_header[5] << 8) + wav_header[4]; -// llinfos << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << llendl; +// LL_INFOS() << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << LL_ENDL; if (!(strncmp((char *)&(wav_header[0]),"fmt ",4))) { @@ -308,8 +308,8 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname // vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE_AVG,NULL) || // vorbis_encode_setup_init(&vi)) { - llwarns << "unable to initialize vorbis codec at quality " << quality << llendl; - // llwarns << "unable to initialize vorbis codec at bitrate " << bitrate << llendl; + LL_WARNS() << "unable to initialize vorbis codec at quality " << quality << LL_ENDL; + // LL_WARNS() << "unable to initialize vorbis codec at bitrate " << bitrate << LL_ENDL; return(LLVORBISENC_DEST_OPEN_ERR); } @@ -498,7 +498,7 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname libvorbis. They're never freed or manipulated directly */ // fprintf(stderr,"Vorbis encoding: Done.\n"); - llinfos << "Vorbis encoding: Done." << llendl; + LL_INFOS() << "Vorbis encoding: Done." << LL_ENDL; #endif return(LLVORBISENC_NOERR); diff --git a/indra/llcharacter/llanimationstates.h b/indra/llcharacter/llanimationstates.h index 84185c3f92c8b27a17ac411afb18a874b3050b2f..79cbcabdc1da0e72ad4c4fd6544cf2ebc2f288bd 100755 --- a/indra/llcharacter/llanimationstates.h +++ b/indra/llcharacter/llanimationstates.h @@ -29,7 +29,7 @@ #include <map> -#include "string_table.h" +#include "llstringtable.h" #include "lluuid.h" //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/llbvhloader.cpp b/indra/llcharacter/llbvhloader.cpp index 8c02a2536703b2b0452abd3599624478bce65a8b..0d558aeaa2be3717b5f34188d5e1ac2af755c297 100755 --- a/indra/llcharacter/llbvhloader.cpp +++ b/indra/llcharacter/llbvhloader.cpp @@ -130,14 +130,14 @@ LLQuaternion::Order bvhStringToOrder( char *str ) if (mStatus == LLBVHLoader::ST_NO_XLT_FILE) { - llwarns << "NOTE: No translation table found." << llendl; + LL_WARNS() << "NOTE: No translation table found." << LL_ENDL; return; } else { if (mStatus != LLBVHLoader::ST_OK) { - llwarns << "ERROR: [line: " << getLineNumber() << "] " << mStatus << llendl; + LL_WARNS() << "ERROR: [line: " << getLineNumber() << "] " << mStatus << LL_ENDL; return; } } @@ -147,7 +147,7 @@ LLQuaternion::Order bvhStringToOrder( char *str ) mStatus = loadBVHFile(buffer, error_text, error_line); if (mStatus != LLBVHLoader::ST_OK) { - llwarns << "ERROR: [line: " << getLineNumber() << "] " << mStatus << llendl; + LL_WARNS() << "ERROR: [line: " << getLineNumber() << "] " << mStatus << LL_ENDL; return; } @@ -163,10 +163,10 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error errorLine = 0; mStatus = loadTranslationTable("anim.ini"); loadStatus = mStatus; - llinfos<<"Load Status 00 : "<< loadStatus << llendl; + LL_INFOS()<<"Load Status 00 : "<< loadStatus << LL_ENDL; if (mStatus == E_ST_NO_XLT_FILE) { - //llwarns << "NOTE: No translation table found." << llendl; + //LL_WARNS() << "NOTE: No translation table found." << LL_ENDL; loadStatus = mStatus; return; } @@ -174,7 +174,7 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error { if (mStatus != E_ST_OK) { - //llwarns << "ERROR: [line: " << getLineNumber() << "] " << mStatus << llendl; + //LL_WARNS() << "ERROR: [line: " << getLineNumber() << "] " << mStatus << LL_ENDL; errorLine = getLineNumber(); loadStatus = mStatus; return; @@ -187,7 +187,7 @@ LLBVHLoader::LLBVHLoader(const char* buffer, ELoadStatus &loadStatus, S32 &error if (mStatus != E_ST_OK) { - //llwarns << "ERROR: [line: " << getLineNumber() << "] " << mStatus << llendl; + //LL_WARNS() << "ERROR: [line: " << getLineNumber() << "] " << mStatus << LL_ENDL; loadStatus = mStatus; errorLine = getLineNumber(); return; @@ -226,7 +226,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName) if (!fp) return E_ST_NO_XLT_FILE; - llinfos << "NOTE: Loading translation table: " << fileName << llendl; + LL_INFOS() << "NOTE: Loading translation table: " << fileName << LL_ENDL; //-------------------------------------------------------------------- // register file to be closed on function exit @@ -290,7 +290,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName) return E_ST_NO_XLT_EMOTE; mEmoteName.assign( emote_str ); -// llinfos << "NOTE: Emote: " << mEmoteName.c_str() << llendl; +// LL_INFOS() << "NOTE: Emote: " << mEmoteName.c_str() << LL_ENDL; continue; } @@ -305,7 +305,7 @@ ELoadStatus LLBVHLoader::loadTranslationTable(const char *fileName) return E_ST_NO_XLT_PRIORITY; mPriority = priority; -// llinfos << "NOTE: Priority: " << mPriority << llendl; +// LL_INFOS() << "NOTE: Priority: " << mPriority << LL_ENDL; continue; } @@ -698,7 +698,7 @@ ELoadStatus LLBVHLoader::loadBVHFile(const char *buffer, char* error_text, S32 & if ( !strstr(line.c_str(), "HIERARCHY") ) { -// llinfos << line << llendl; +// LL_INFOS() << line << LL_ENDL; return E_ST_NO_HIER; } @@ -1045,7 +1045,7 @@ void LLBVHLoader::applyTranslations() //---------------------------------------------------------------- if ( trans.mIgnore ) { - //llinfos << "NOTE: Ignoring " << joint->mName.c_str() << llendl; + //LL_INFOS() << "NOTE: Ignoring " << joint->mName.c_str() << LL_ENDL; joint->mIgnore = TRUE; continue; } @@ -1055,7 +1055,7 @@ void LLBVHLoader::applyTranslations() //---------------------------------------------------------------- if ( ! trans.mOutName.empty() ) { - //llinfos << "NOTE: Changing " << joint->mName.c_str() << " to " << trans.mOutName.c_str() << llendl; + //LL_INFOS() << "NOTE: Changing " << joint->mName.c_str() << " to " << trans.mOutName.c_str() << LL_ENDL; joint->mOutName = trans.mOutName; } @@ -1072,25 +1072,25 @@ void LLBVHLoader::applyTranslations() //---------------------------------------------------------------- if ( trans.mRelativePositionKey ) { -// llinfos << "NOTE: Removing 1st position offset from all keys for " << joint->mOutName.c_str() << llendl; +// LL_INFOS() << "NOTE: Removing 1st position offset from all keys for " << joint->mOutName.c_str() << LL_ENDL; joint->mRelativePositionKey = TRUE; } if ( trans.mRelativeRotationKey ) { -// llinfos << "NOTE: Removing 1st rotation from all keys for " << joint->mOutName.c_str() << llendl; +// LL_INFOS() << "NOTE: Removing 1st rotation from all keys for " << joint->mOutName.c_str() << LL_ENDL; joint->mRelativeRotationKey = TRUE; } if ( trans.mRelativePosition.magVec() > 0.0f ) { joint->mRelativePosition = trans.mRelativePosition; -// llinfos << "NOTE: Removing " << +// LL_INFOS() << "NOTE: Removing " << // joint->mRelativePosition.mV[0] << " " << // joint->mRelativePosition.mV[1] << " " << // joint->mRelativePosition.mV[2] << // " from all position keys in " << -// joint->mOutName.c_str() << llendl; +// joint->mOutName.c_str() << LL_ENDL; } //---------------------------------------------------------------- @@ -1104,9 +1104,9 @@ void LLBVHLoader::applyTranslations() //---------------------------------------------------------------- if ( ! trans.mMergeParentName.empty() ) { -// llinfos << "NOTE: Merging " << joint->mOutName.c_str() << +// LL_INFOS() << "NOTE: Merging " << joint->mOutName.c_str() << // " with parent " << -// trans.mMergeParentName.c_str() << llendl; +// trans.mMergeParentName.c_str() << LL_ENDL; joint->mMergeParentName = trans.mMergeParentName; } @@ -1115,8 +1115,8 @@ void LLBVHLoader::applyTranslations() //---------------------------------------------------------------- if ( ! trans.mMergeChildName.empty() ) { -// llinfos << "NOTE: Merging " << joint->mName.c_str() << -// " with child " << trans.mMergeChildName.c_str() << llendl; +// LL_INFOS() << "NOTE: Merging " << joint->mName.c_str() << +// " with child " << trans.mMergeChildName.c_str() << LL_ENDL; joint->mMergeChildName = trans.mMergeChildName; } @@ -1311,7 +1311,7 @@ void LLBVHLoader::optimize() // don't output joints with no motion if (!(pos_changed || rot_changed)) { - //llinfos << "Ignoring joint " << joint->mName << llendl; + //LL_INFOS() << "Ignoring joint " << joint->mName << LL_ENDL; joint->mIgnore = TRUE; } } diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 85cf1cd3f5eac08db7e89efd7d25d90fe313a227..82ddfa01ecf92222a7f8d9377f62355dc207d4f5 100755 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -32,6 +32,7 @@ #include "llcharacter.h" #include "llstring.h" +#include "llfasttimer.h" #define SKEL_HEADER "Linden Skeleton 1.0" @@ -105,7 +106,7 @@ LLJoint *LLCharacter::getJoint( const std::string &name ) if (!joint) { - llwarns << "Failed to find joint." << llendl; + LL_WARNS() << "Failed to find joint." << LL_ENDL; } return joint; } @@ -180,27 +181,27 @@ BOOL LLCharacter::isMotionActive(const LLUUID& id) //----------------------------------------------------------------------------- void LLCharacter::requestStopMotion( LLMotion* motion) { -// llinfos << "DEBUG: Char::onDeactivateMotion( " << motionName << " )" << llendl; +// LL_INFOS() << "DEBUG: Char::onDeactivateMotion( " << motionName << " )" << LL_ENDL; } //----------------------------------------------------------------------------- // updateMotions() //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation"); -static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim"); -static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS("Update Motions"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_ANIMATION("Update Animation"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_MOTIONS("Update Motions"); void LLCharacter::updateMotions(e_update_t update_type) { if (update_type == HIDDEN_UPDATE) { - LLFastTimer t(FTM_UPDATE_HIDDEN_ANIMATION); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_HIDDEN_ANIMATION); mMotionController.updateMotionsMinimal(); } else { - LLFastTimer t(FTM_UPDATE_ANIMATION); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_ANIMATION); // unpause if the number of outstanding pause requests has dropped to the initial one if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1) { @@ -208,7 +209,7 @@ void LLCharacter::updateMotions(e_update_t update_type) } bool force_update = (update_type == FORCE_UPDATE); { - LLFastTimer t(FTM_UPDATE_MOTIONS); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_MOTIONS); mMotionController.updateMotions(force_update); } } @@ -241,14 +242,14 @@ void LLCharacter::dumpCharacter( LLJoint* joint ) // handle top level entry into recursion if (joint == NULL) { - llinfos << "DEBUG: Dumping Character @" << this << llendl; + LL_INFOS() << "DEBUG: Dumping Character @" << this << LL_ENDL; dumpCharacter( getRootJoint() ); - llinfos << "DEBUG: Done." << llendl; + LL_INFOS() << "DEBUG: Done." << LL_ENDL; return; } // print joint info - llinfos << "DEBUG: " << joint->getName() << " (" << (joint->getParent()?joint->getParent()->getName():std::string("ROOT")) << ")" << llendl; + LL_INFOS() << "DEBUG: " << joint->getName() << " (" << (joint->getParent()?joint->getParent()->getName():std::string("ROOT")) << ")" << LL_ENDL; // recurse for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin(); @@ -312,7 +313,7 @@ BOOL LLCharacter::setVisualParamWeight(const char* param_name, F32 weight, BOOL name_iter->second->setWeight(weight, upload_bake); return TRUE; } - llwarns << "LLCharacter::setVisualParamWeight() Invalid visual parameter: " << param_name << llendl; + LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter: " << param_name << LL_ENDL; return FALSE; } @@ -327,7 +328,7 @@ BOOL LLCharacter::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake) index_iter->second->setWeight(weight, upload_bake); return TRUE; } - llwarns << "LLCharacter::setVisualParamWeight() Invalid visual parameter index: " << index << llendl; + LL_WARNS() << "LLCharacter::setVisualParamWeight() Invalid visual parameter index: " << index << LL_ENDL; return FALSE; } @@ -344,7 +345,7 @@ F32 LLCharacter::getVisualParamWeight(LLVisualParam *which_param) } else { - llwarns << "LLCharacter::getVisualParamWeight() Invalid visual parameter*, index= " << index << llendl; + LL_WARNS() << "LLCharacter::getVisualParamWeight() Invalid visual parameter*, index= " << index << LL_ENDL; return 0.f; } } @@ -362,7 +363,7 @@ F32 LLCharacter::getVisualParamWeight(const char* param_name) { return name_iter->second->getWeight(); } - llwarns << "LLCharacter::getVisualParamWeight() Invalid visual parameter: " << param_name << llendl; + LL_WARNS() << "LLCharacter::getVisualParamWeight() Invalid visual parameter: " << param_name << LL_ENDL; return 0.f; } @@ -378,7 +379,7 @@ F32 LLCharacter::getVisualParamWeight(S32 index) } else { - llwarns << "LLCharacter::getVisualParamWeight() Invalid visual parameter index: " << index << llendl; + LL_WARNS() << "LLCharacter::getVisualParamWeight() Invalid visual parameter index: " << index << LL_ENDL; return 0.f; } } @@ -412,7 +413,7 @@ LLVisualParam* LLCharacter::getVisualParam(const char *param_name) { return name_iter->second; } - llwarns << "LLCharacter::getVisualParam() Invalid visual parameter: " << param_name << llendl; + LL_WARNS() << "LLCharacter::getVisualParam() Invalid visual parameter: " << param_name << LL_ENDL; return NULL; } @@ -437,8 +438,8 @@ void LLCharacter::addSharedVisualParam(LLVisualParam *param) } else { - llwarns << "Shared visual parameter " << param->getName() << " does not already exist with ID " << - param->getID() << llendl; + LL_WARNS() << "Shared visual parameter " << param->getName() << " does not already exist with ID " << + param->getID() << LL_ENDL; } } @@ -453,8 +454,8 @@ void LLCharacter::addVisualParam(LLVisualParam *param) idxres = mVisualParamIndexMap.insert(visual_param_index_map_t::value_type(index, param)); if (!idxres.second) { - llwarns << "Visual parameter " << param->getName() << " already exists with same ID as " << - param->getName() << llendl; + LL_WARNS() << "Visual parameter " << param->getName() << " already exists with same ID as " << + param->getName() << LL_ENDL; visual_param_index_map_t::iterator index_iter = idxres.first; index_iter->second = param; } @@ -474,7 +475,7 @@ void LLCharacter::addVisualParam(LLVisualParam *param) name_iter->second = param; } } - //llinfos << "Adding Visual Param '" << param->getName() << "' ( " << index << " )" << llendl; + //LL_INFOS() << "Adding Visual Param '" << param->getName() << "' ( " << index << " )" << LL_ENDL; } //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index 5740dbce77274089b2a4a0d60ea9c6b8c57c50bd..b10a8a5f34a99bf4a35631aa1bbb6eba8327d9e1 100755 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -35,9 +35,9 @@ #include "lljoint.h" #include "llmotioncontroller.h" #include "llvisualparam.h" -#include "string_table.h" +#include "llstringtable.h" #include "llpointer.h" -#include "llthread.h" +#include "llrefcount.h" class LLPolyMesh; diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp index 4e8c3268c5de0124294c103e61999ca9dfd78385..36341065ae16e48bd1f709638e2af894a248947a 100755 --- a/indra/llcharacter/lleditingmotion.cpp +++ b/indra/llcharacter/lleditingmotion.cpp @@ -89,7 +89,7 @@ LLMotion::LLMotionInitStatus LLEditingMotion::onInitialize(LLCharacter *characte !mCharacter->getJoint("mElbowLeft") || !mCharacter->getJoint("mWristLeft")) { - llwarns << "Invalid skeleton for editing motion!" << llendl; + LL_WARNS() << "Invalid skeleton for editing motion!" << LL_ENDL; return STATUS_FAILURE; } @@ -102,7 +102,7 @@ LLMotion::LLMotionInitStatus LLEditingMotion::onInitialize(LLCharacter *characte if ( ! mParentState->getJoint() ) { - llinfos << getName() << ": Can't get parent joint." << llendl; + LL_INFOS() << getName() << ": Can't get parent joint." << LL_ENDL; return STATUS_FAILURE; } @@ -215,14 +215,14 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask) if (!target.isFinite()) { // Don't error out here, set a fail-safe target vector - llwarns << "Non finite target in editing motion with target distance of " << target_dist << - " and focus point " << focus_pt << llendl; + LL_WARNS() << "Non finite target in editing motion with target distance of " << target_dist << + " and focus point " << focus_pt << LL_ENDL; target.setVec(1.f, 1.f, 1.f); } mTarget.setPosition( target + mParentJoint.getPosition()); -// llinfos << "Point At: " << mTarget.getPosition() << llendl; +// LL_INFOS() << "Point At: " << mTarget.getPosition() << LL_ENDL; // update the ikSolver if (!mTarget.getPosition().isExactlyZero()) @@ -232,7 +232,7 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask) mIKSolver.solve(); // use blending... - F32 slerp_amt = LLCriticalDamp::getInterpolant(TARGET_LAG_HALF_LIFE); + F32 slerp_amt = LLSmoothInterpolation::getInterpolant(TARGET_LAG_HALF_LIFE); shoulderRot = slerp(slerp_amt, mShoulderJoint.getRotation(), shoulderRot); elbowRot = slerp(slerp_amt, mElbowJoint.getRotation(), elbowRot); diff --git a/indra/llcharacter/llgesture.cpp b/indra/llcharacter/llgesture.cpp index c23694639e1e98ab6778b2e9ac481e8bbe81e1bd..1549c41e624e87b9f7a6b2a07d9501fbed7750d9 100755 --- a/indra/llcharacter/llgesture.cpp +++ b/indra/llcharacter/llgesture.cpp @@ -93,14 +93,14 @@ const LLGesture &LLGesture::operator =(const LLGesture &rhs) BOOL LLGesture::trigger(KEY key, MASK mask) { - llwarns << "Parent class trigger called: you probably didn't mean this." << llendl; + LL_WARNS() << "Parent class trigger called: you probably didn't mean this." << LL_ENDL; return FALSE; } BOOL LLGesture::trigger(const std::string& trigger_string) { - llwarns << "Parent class trigger called: you probably didn't mean this." << llendl; + LL_WARNS() << "Parent class trigger called: you probably didn't mean this." << LL_ENDL; return FALSE; } @@ -130,7 +130,7 @@ U8 *LLGesture::deserialize(U8 *buffer, S32 max_size) if (tmp + sizeof(mKey) + sizeof(mMask) + 16 > buffer + max_size) { - llwarns << "Attempt to read past end of buffer, bad data!!!!" << llendl; + LL_WARNS() << "Attempt to read past end of buffer, bad data!!!!" << LL_ENDL; return buffer; } @@ -155,7 +155,7 @@ U8 *LLGesture::deserialize(U8 *buffer, S32 max_size) if (tmp > buffer + max_size) { - llwarns << "Read past end of buffer, bad data!!!!" << llendl; + LL_WARNS() << "Read past end of buffer, bad data!!!!" << LL_ENDL; return tmp; } @@ -173,27 +173,7 @@ S32 LLGesture::getMaxSerialSize() LLGestureList::LLGestureList() : mList(0) -{ - // add some gestures for debugging -// LLGesture *gesture = NULL; -/* - gesture = new LLGesture(KEY_F2, MASK_NONE, ":-)", - SND_CHIRP, "dance2", ":-)" ); - mList.put(gesture); - - gesture = new LLGesture(KEY_F3, MASK_NONE, "/dance", - SND_OBJECT_CREATE, "dance3", "(dances)" ); - mList.put(gesture); - - gesture = new LLGesture(KEY_F4, MASK_NONE, "/boogie", - LLUUID::null, "dance4", LLStringUtil::null ); - mList.put(gesture); - - gesture = new LLGesture(KEY_F5, MASK_SHIFT, "/tongue", - LLUUID::null, "Express_Tongue_Out", LLStringUtil::null ); - mList.put(gesture); - */ -} +{} LLGestureList::~LLGestureList() { @@ -203,12 +183,7 @@ LLGestureList::~LLGestureList() void LLGestureList::deleteAll() { - S32 count = mList.count(); - for (S32 i = 0; i < count; i++) - { - delete mList.get(i); - } - mList.reset(); + delete_and_clear(mList); } // Iterates through space delimited tokens in string, triggering any gestures found. @@ -235,9 +210,9 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin std::string cur_token_lower = *token_iter; LLStringUtil::toLower(cur_token_lower); - for (S32 i = 0; i < mList.count(); i++) + for (U32 i = 0; i < mList.size(); i++) { - gesture = mList.get(i); + gesture = mList.at(i); if (gesture->trigger(cur_token_lower)) { if( !gesture->getOutputString().empty() ) @@ -286,9 +261,9 @@ BOOL LLGestureList::triggerAndReviseString(const std::string &string, std::strin BOOL LLGestureList::trigger(KEY key, MASK mask) { - for (S32 i = 0; i < mList.count(); i++) + for (U32 i = 0; i < mList.size(); i++) { - LLGesture* gesture = mList.get(i); + LLGesture* gesture = mList.at(i); if( gesture ) { if (gesture->trigger(key, mask)) @@ -298,7 +273,7 @@ BOOL LLGestureList::trigger(KEY key, MASK mask) } else { - llwarns << "NULL gesture in gesture list (" << i << ")" << llendl; + LL_WARNS() << "NULL gesture in gesture list (" << i << ")" << LL_ENDL; } } return FALSE; @@ -308,7 +283,7 @@ BOOL LLGestureList::trigger(KEY key, MASK mask) U8 *LLGestureList::serialize(U8 *buffer) const { // a single S32 serves as the header that tells us how many to read - S32 count = mList.count(); + U32 count = mList.size(); htonmemcpy(buffer, &count, MVT_S32, 4); buffer += sizeof(count); @@ -331,7 +306,7 @@ U8 *LLGestureList::deserialize(U8 *buffer, S32 max_size) if (tmp + sizeof(count) > buffer + max_size) { - llwarns << "Invalid max_size" << llendl; + LL_WARNS() << "Invalid max_size" << LL_ENDL; return buffer; } @@ -339,20 +314,20 @@ U8 *LLGestureList::deserialize(U8 *buffer, S32 max_size) if (count > MAX_GESTURES) { - llwarns << "Unreasonably large gesture list count in deserialize: " << count << llendl; + LL_WARNS() << "Unreasonably large gesture list count in deserialize: " << count << LL_ENDL; return tmp; } tmp += sizeof(count); - mList.reserve_block(count); + mList.resize(count); for (S32 i = 0; i < count; i++) { mList[i] = create_gesture(&tmp, max_size - (S32)(tmp - buffer)); if (tmp - buffer > max_size) { - llwarns << "Deserialization read past end of buffer, bad data!!!!" << llendl; + LL_WARNS() << "Deserialization read past end of buffer, bad data!!!!" << LL_ENDL; return tmp; } } diff --git a/indra/llcharacter/llgesture.h b/indra/llcharacter/llgesture.h index 66b618c473e061ca3ca5b344d4c7631cb2d9c7a1..cfb489f72766a051cd5512bb5d9dfe659c68b299 100755 --- a/indra/llcharacter/llgesture.h +++ b/indra/llcharacter/llgesture.h @@ -31,7 +31,6 @@ #include "llanimationstates.h" #include "lluuid.h" #include "llstring.h" -#include "lldarray.h" class LLGesture { @@ -67,12 +66,12 @@ class LLGesture static S32 getMaxSerialSize(); protected: - KEY mKey; // usually a function key - MASK mMask; // usually MASK_NONE, or MASK_SHIFT + KEY mKey; // usually a function key + MASK mMask; // usually MASK_NONE, or MASK_SHIFT std::string mTrigger; // string, no whitespace allowed std::string mTriggerLower; // lowercase version of mTrigger - LLUUID mSoundItemID; // ItemID of sound to play, LLUUID::null if none - std::string mAnimation; // canonical name of animation or face animation + LLUUID mSoundItemID; // ItemID of sound to play, LLUUID::null if none + std::string mAnimation; // canonical name of animation or face animation std::string mOutputString; // string to say static const S32 MAX_SERIAL_SIZE; @@ -91,9 +90,9 @@ class LLGestureList BOOL triggerAndReviseString(const std::string &string, std::string* revised_string); // Used for construction from UI - S32 count() const { return mList.count(); } - virtual LLGesture* get(S32 i) const { return mList.get(i); } - virtual void put(LLGesture* gesture) { mList.put( gesture ); } + S32 count() const { return mList.size(); } + virtual LLGesture* get(S32 i) const { return mList.at(i); } + virtual void put(LLGesture* gesture) { mList.push_back( gesture ); } void deleteAll(); // non-endian-neutral serialization @@ -106,7 +105,7 @@ class LLGestureList virtual LLGesture *create_gesture(U8 **buffer, S32 max_size); protected: - LLDynamicArray<LLGesture*> mList; + std::vector<LLGesture*> mList; static const S32 SERIAL_HEADER_SIZE; }; diff --git a/indra/llcharacter/llhandmotion.cpp b/indra/llcharacter/llhandmotion.cpp index 696dba0d95d0779c0e5faba1cea38bbd285f4c01..b3bf5a9a919d9b1ed2e835702ce5e485c5da5112 100755 --- a/indra/llcharacter/llhandmotion.cpp +++ b/indra/llcharacter/llhandmotion.cpp @@ -192,7 +192,7 @@ BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask) } else { - llwarns << "Requested hand pose out of range. Ignoring requested pose." << llendl; + LL_WARNS() << "Requested hand pose out of range. Ignoring requested pose." << LL_ENDL; } } @@ -200,7 +200,7 @@ BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask) mCharacter->removeAnimationData("Hand Pose Priority"); // if (requestedHandPose) -// llinfos << "Hand Pose " << *requestedHandPose << llendl; +// LL_INFOS() << "Hand Pose " << *requestedHandPose << LL_ENDL; // if we are still blending... if (mCurrentPose != mNewPose) diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp index 2b1aa194a9a52b19ddb9680e852201b54bb54ca4..d045bca22e3defe46e05333d85e103c3a0226587 100755 --- a/indra/llcharacter/llheadrotmotion.cpp +++ b/indra/llcharacter/llheadrotmotion.cpp @@ -104,49 +104,49 @@ LLMotion::LLMotionInitStatus LLHeadRotMotion::onInitialize(LLCharacter *characte mPelvisJoint = character->getJoint("mPelvis"); if ( ! mPelvisJoint ) { - llinfos << getName() << ": Can't get pelvis joint." << llendl; + LL_INFOS() << getName() << ": Can't get pelvis joint." << LL_ENDL; return STATUS_FAILURE; } mRootJoint = character->getJoint("mRoot"); if ( ! mRootJoint ) { - llinfos << getName() << ": Can't get root joint." << llendl; + LL_INFOS() << getName() << ": Can't get root joint." << LL_ENDL; return STATUS_FAILURE; } mTorsoJoint = character->getJoint("mTorso"); if ( ! mTorsoJoint ) { - llinfos << getName() << ": Can't get torso joint." << llendl; + LL_INFOS() << getName() << ": Can't get torso joint." << LL_ENDL; return STATUS_FAILURE; } mHeadJoint = character->getJoint("mHead"); if ( ! mHeadJoint ) { - llinfos << getName() << ": Can't get head joint." << llendl; + LL_INFOS() << getName() << ": Can't get head joint." << LL_ENDL; return STATUS_FAILURE; } mTorsoState->setJoint( character->getJoint("mTorso") ); if ( ! mTorsoState->getJoint() ) { - llinfos << getName() << ": Can't get torso joint." << llendl; + LL_INFOS() << getName() << ": Can't get torso joint." << LL_ENDL; return STATUS_FAILURE; } mNeckState->setJoint( character->getJoint("mNeck") ); if ( ! mNeckState->getJoint() ) { - llinfos << getName() << ": Can't get neck joint." << llendl; + LL_INFOS() << getName() << ": Can't get neck joint." << LL_ENDL; return STATUS_FAILURE; } mHeadState->setJoint( character->getJoint("mHead") ); if ( ! mHeadState->getJoint() ) { - llinfos << getName() << ": Can't get head joint." << llendl; + LL_INFOS() << getName() << ": Can't get head joint." << LL_ENDL; return STATUS_FAILURE; } @@ -182,8 +182,8 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) LLQuaternion currentRootRotWorld = mRootJoint->getWorldRotation(); LLQuaternion currentInvRootRotWorld = ~currentRootRotWorld; - F32 head_slerp_amt = LLCriticalDamp::getInterpolant(HEAD_LOOKAT_LAG_HALF_LIFE); - F32 torso_slerp_amt = LLCriticalDamp::getInterpolant(TORSO_LOOKAT_LAG_HALF_LIFE); + F32 head_slerp_amt = LLSmoothInterpolation::getInterpolant(HEAD_LOOKAT_LAG_HALF_LIFE); + F32 torso_slerp_amt = LLSmoothInterpolation::getInterpolant(TORSO_LOOKAT_LAG_HALF_LIFE); LLVector3* targetPos = (LLVector3*)mCharacter->getAnimationData("LookAtPoint"); @@ -191,7 +191,7 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask) { LLVector3 headLookAt = *targetPos; -// llinfos << "Look At: " << headLookAt + mHeadJoint->getWorldPosition() << llendl; +// LL_INFOS() << "Look At: " << headLookAt + mHeadJoint->getWorldPosition() << LL_ENDL; F32 lookatDistance = headLookAt.normVec(); @@ -310,21 +310,21 @@ LLMotion::LLMotionInitStatus LLEyeMotion::onInitialize(LLCharacter *character) mHeadJoint = character->getJoint("mHead"); if ( ! mHeadJoint ) { - llinfos << getName() << ": Can't get head joint." << llendl; + LL_INFOS() << getName() << ": Can't get head joint." << LL_ENDL; return STATUS_FAILURE; } mLeftEyeState->setJoint( character->getJoint("mEyeLeft") ); if ( ! mLeftEyeState->getJoint() ) { - llinfos << getName() << ": Can't get left eyeball joint." << llendl; + LL_INFOS() << getName() << ": Can't get left eyeball joint." << LL_ENDL; return STATUS_FAILURE; } mRightEyeState->setJoint( character->getJoint("mEyeRight") ); if ( ! mRightEyeState->getJoint() ) { - llinfos << getName() << ": Can't get Right eyeball joint." << llendl; + LL_INFOS() << getName() << ": Can't get Right eyeball joint." << LL_ENDL; return STATUS_FAILURE; } diff --git a/indra/llcharacter/lljoint.cpp b/indra/llcharacter/lljoint.cpp index 09a7c11a22d972a007c22407aac3a2802463a3eb..1492cc172cf97e959917d6d87d221bbae23b413c 100755 --- a/indra/llcharacter/lljoint.cpp +++ b/indra/llcharacter/lljoint.cpp @@ -438,7 +438,7 @@ const LLMatrix4 &LLJoint::getWorldMatrix() //-------------------------------------------------------------------- void LLJoint::setWorldMatrix( const LLMatrix4& mat ) { -llinfos << "WARNING: LLJoint::setWorldMatrix() not correctly implemented yet" << llendl; +LL_INFOS() << "WARNING: LLJoint::setWorldMatrix() not correctly implemented yet" << LL_ENDL; // extract global translation LLVector3 trans( mat.mMatrix[VW][VX], mat.mMatrix[VW][VY], @@ -560,7 +560,7 @@ void LLJoint::clampRotation(LLQuaternion old_rot, LLQuaternion new_rot) // LLVector3 old_axis = main_axis * old_rot; // LLVector3 new_axis = main_axis * new_rot; -// for (S32 i = 0; i < mConstraintSilhouette.count() - 1; i++) +// for (S32 i = 0; i < mConstraintSilhouette.size() - 1; i++) // { // LLVector3 vert1 = mConstraintSilhouette[i]; // LLVector3 vert2 = mConstraintSilhouette[i + 1]; diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index 2b1e2005c62022910497ea8bbd8dbbd6ce7f8c31..6efa13aeb55592e6986332355514c259a7e2fed5 100755 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -31,14 +31,13 @@ // Header Files //----------------------------------------------------------------------------- #include <string> +#include <list> -#include "linked_lists.h" #include "v3math.h" #include "v4math.h" #include "m4math.h" #include "llquaternion.h" #include "xform.h" -#include "lldarray.h" const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; const U32 LL_CHARACTER_MAX_JOINTS = 32; // must be divisible by 4! diff --git a/indra/llcharacter/lljointsolverrp3.cpp b/indra/llcharacter/lljointsolverrp3.cpp index 133190079115fde5b438a4e79beeeecc036148b4..69a7e3dc6e7593c314ab30a2e94960a0ef6f17cc 100755 --- a/indra/llcharacter/lljointsolverrp3.cpp +++ b/indra/llcharacter/lljointsolverrp3.cpp @@ -135,8 +135,6 @@ void LLJointSolverRP3::setTwist( F32 twist ) //----------------------------------------------------------------------------- void LLJointSolverRP3::solve() { -// llinfos << llendl; -// llinfos << "LLJointSolverRP3::solve()" << llendl; //------------------------------------------------------------------------- // setup joints in their base rotations @@ -152,15 +150,15 @@ void LLJointSolverRP3::solve() LLVector3 cPos = mJointC->getWorldPosition(); LLVector3 gPos = mJointGoal->getWorldPosition(); -// llinfos << "bPosLocal = " << mJointB->getPosition() << llendl; -// llinfos << "cPosLocal = " << mJointC->getPosition() << llendl; -// llinfos << "bRotLocal = " << mJointB->getRotation() << llendl; -// llinfos << "cRotLocal = " << mJointC->getRotation() << llendl; - -// llinfos << "aPos : " << aPos << llendl; -// llinfos << "bPos : " << bPos << llendl; -// llinfos << "cPos : " << cPos << llendl; -// llinfos << "gPos : " << gPos << llendl; + LL_DEBUGS("JointSolver") << "LLJointSolverRP3::solve()" << LL_NEWLINE + << "bPosLocal = " << mJointB->getPosition() << LL_NEWLINE + << "cPosLocal = " << mJointC->getPosition() << LL_NEWLINE + << "bRotLocal = " << mJointB->getRotation() << LL_NEWLINE + << "cRotLocal = " << mJointC->getRotation() << LL_NEWLINE + << "aPos : " << aPos << LL_NEWLINE + << "bPos : " << bPos << LL_NEWLINE + << "cPos : " << cPos << LL_NEWLINE + << "gPos : " << gPos << LL_ENDL; //------------------------------------------------------------------------- // get the poleVector in world space @@ -184,11 +182,6 @@ void LLJointSolverRP3::solve() LLVector3 acVec = cPos - aPos; LLVector3 agVec = gPos - aPos; -// llinfos << "abVec : " << abVec << llendl; -// llinfos << "bcVec : " << bcVec << llendl; -// llinfos << "acVec : " << acVec << llendl; -// llinfos << "agVec : " << agVec << llendl; - //------------------------------------------------------------------------- // compute needed lengths of those vectors //------------------------------------------------------------------------- @@ -196,16 +189,19 @@ void LLJointSolverRP3::solve() F32 bcLen = bcVec.magVec(); F32 agLen = agVec.magVec(); -// llinfos << "abLen : " << abLen << llendl; -// llinfos << "bcLen : " << bcLen << llendl; -// llinfos << "agLen : " << agLen << llendl; - //------------------------------------------------------------------------- // compute component vector of (A->B) orthogonal to (A->C) //------------------------------------------------------------------------- LLVector3 abacCompOrthoVec = abVec - acVec * ((abVec * acVec)/(acVec * acVec)); -// llinfos << "abacCompOrthoVec : " << abacCompOrthoVec << llendl; + LL_DEBUGS("JointSolver") << "abVec : " << abVec << LL_NEWLINE + << "bcVec : " << bcVec << LL_NEWLINE + << "acVec : " << acVec << LL_NEWLINE + << "agVec : " << agVec << LL_NEWLINE + << "abLen : " << abLen << LL_NEWLINE + << "bcLen : " << bcLen << LL_NEWLINE + << "agLen : " << agLen << LL_NEWLINE + << "abacCompOrthoVec : " << abacCompOrthoVec << LL_ENDL; //------------------------------------------------------------------------- // compute the normal of the original ABC plane (and store for later) @@ -273,13 +269,17 @@ void LLJointSolverRP3::solve() LLQuaternion bRot(theta - abbcAng, abbcOrthoVec); -// llinfos << "abbcAng : " << abbcAng << llendl; -// llinfos << "abbcOrthoVec : " << abbcOrthoVec << llendl; -// llinfos << "agLenSq : " << agLenSq << llendl; -// llinfos << "cosTheta : " << cosTheta << llendl; -// llinfos << "theta : " << theta << llendl; -// llinfos << "bRot : " << bRot << llendl; -// llinfos << "theta abbcAng theta-abbcAng: " << theta*180.0/F_PI << " " << abbcAng*180.0f/F_PI << " " << (theta - abbcAng)*180.0f/F_PI << llendl; + LL_DEBUGS("JointSolver") << "abbcAng : " << abbcAng << LL_NEWLINE + << "abbcOrthoVec : " << abbcOrthoVec << LL_NEWLINE + << "agLenSq : " << agLenSq << LL_NEWLINE + << "cosTheta : " << cosTheta << LL_NEWLINE + << "theta : " << theta << LL_NEWLINE + << "bRot : " << bRot << LL_NEWLINE + << "theta abbcAng theta-abbcAng: " + << theta*180.0/F_PI << " " + << abbcAng*180.0f/F_PI << " " + << (theta - abbcAng)*180.0f/F_PI + << LL_ENDL; //------------------------------------------------------------------------- // compute rotation that rotates new A->C to A->G @@ -293,9 +293,9 @@ void LLJointSolverRP3::solve() LLQuaternion cgRot; cgRot.shortestArc( acVec, agVec ); -// llinfos << "bcVec : " << bcVec << llendl; -// llinfos << "acVec : " << acVec << llendl; -// llinfos << "cgRot : " << cgRot << llendl; + LL_DEBUGS("JointSolver") << "bcVec : " << bcVec << LL_NEWLINE + << "acVec : " << acVec << LL_NEWLINE + << "cgRot : " << cgRot << LL_ENDL; // update A->B and B->C with rotation from C to G abVec = abVec * cgRot; @@ -353,18 +353,16 @@ void LLJointSolverRP3::solve() pRot.shortestArc( abcNorm, apgNorm ); } -// llinfos << "abcNorm = " << abcNorm << llendl; -// llinfos << "apgNorm = " << apgNorm << llendl; -// llinfos << "pRot = " << pRot << llendl; - //------------------------------------------------------------------------- // compute twist rotation //------------------------------------------------------------------------- LLQuaternion twistRot( mTwist, agVec ); -// llinfos << "twist : " << mTwist*180.0/F_PI << llendl; -// llinfos << "agNormVec: " << agNormVec << llendl; -// llinfos << "twistRot : " << twistRot << llendl; + LL_DEBUGS("JointSolver") << "abcNorm = " << abcNorm << LL_NEWLINE + << "apgNorm = " << apgNorm << LL_NEWLINE + << "pRot = " << pRot << LL_NEWLINE + << "twist : " << mTwist*180.0/F_PI << LL_NEWLINE + << "twistRot : " << twistRot << LL_ENDL; //------------------------------------------------------------------------- // compute rotation of A diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 2241a595139ef95f2d11b9bd5b4cff77634f13dd..22aa4f1d2fe25c32e8c242cd7e4cfc4bedb35644 100755 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -94,30 +94,30 @@ U32 LLKeyframeMotion::JointMotionList::dumpDiagInfo() { LLKeyframeMotion::JointMotion* joint_motion_p = mJointMotionArray[i]; - llinfos << "\tJoint " << joint_motion_p->mJointName << llendl; + LL_INFOS() << "\tJoint " << joint_motion_p->mJointName << LL_ENDL; if (joint_motion_p->mUsage & LLJointState::SCALE) { - llinfos << "\t" << joint_motion_p->mScaleCurve.mNumKeys << " scale keys at " - << joint_motion_p->mScaleCurve.mNumKeys * sizeof(ScaleKey) << " bytes" << llendl; + LL_INFOS() << "\t" << joint_motion_p->mScaleCurve.mNumKeys << " scale keys at " + << joint_motion_p->mScaleCurve.mNumKeys * sizeof(ScaleKey) << " bytes" << LL_ENDL; total_size += joint_motion_p->mScaleCurve.mNumKeys * sizeof(ScaleKey); } if (joint_motion_p->mUsage & LLJointState::ROT) { - llinfos << "\t" << joint_motion_p->mRotationCurve.mNumKeys << " rotation keys at " - << joint_motion_p->mRotationCurve.mNumKeys * sizeof(RotationKey) << " bytes" << llendl; + LL_INFOS() << "\t" << joint_motion_p->mRotationCurve.mNumKeys << " rotation keys at " + << joint_motion_p->mRotationCurve.mNumKeys * sizeof(RotationKey) << " bytes" << LL_ENDL; total_size += joint_motion_p->mRotationCurve.mNumKeys * sizeof(RotationKey); } if (joint_motion_p->mUsage & LLJointState::POS) { - llinfos << "\t" << joint_motion_p->mPositionCurve.mNumKeys << " position keys at " - << joint_motion_p->mPositionCurve.mNumKeys * sizeof(PositionKey) << " bytes" << llendl; + LL_INFOS() << "\t" << joint_motion_p->mPositionCurve.mNumKeys << " position keys at " + << joint_motion_p->mPositionCurve.mNumKeys * sizeof(PositionKey) << " bytes" << LL_ENDL; total_size += joint_motion_p->mPositionCurve.mNumKeys * sizeof(PositionKey); } } - llinfos << "Size: " << total_size << " bytes" << llendl; + LL_INFOS() << "Size: " << total_size << " bytes" << LL_ENDL; return total_size; } @@ -560,7 +560,7 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact if (!sVFS) { - llerrs << "Must call LLKeyframeMotion::setVFS() first before loading a keyframe file!" << llendl; + LL_ERRS() << "Must call LLKeyframeMotion::setVFS() first before loading a keyframe file!" << LL_ENDL; } BOOL success = FALSE; @@ -586,18 +586,18 @@ LLMotion::LLMotionInitStatus LLKeyframeMotion::onInitialize(LLCharacter *charact if (!success) { - llwarns << "Can't open animation file " << mID << llendl; + LL_WARNS() << "Can't open animation file " << mID << LL_ENDL; mAssetStatus = ASSET_FETCH_FAILED; return STATUS_FAILURE; } - lldebugs << "Loading keyframe data for: " << getName() << ":" << getID() << " (" << anim_file_size << " bytes)" << llendl; + LL_DEBUGS() << "Loading keyframe data for: " << getName() << ":" << getID() << " (" << anim_file_size << " bytes)" << LL_ENDL; LLDataPackerBinaryBuffer dp(anim_data, anim_file_size); if (!deserialize(dp)) { - llwarns << "Failed to decode asset for animation " << getName() << ":" << getID() << llendl; + LL_WARNS() << "Failed to decode asset for animation " << getName() << ":" << getID() << LL_ENDL; mAssetStatus = ASSET_FETCH_FAILED; return STATUS_FAILURE; } @@ -984,7 +984,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 { case CONSTRAINT_TARGET_TYPE_GROUND: target_pos = mCharacter->getPosAgentFromGlobal(constraint->mGroundPos); -// llinfos << "Target Pos " << constraint->mGroundPos << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << llendl; +// LL_INFOS() << "Target Pos " << constraint->mGroundPos << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL; break; case CONSTRAINT_TARGET_TYPE_BODY: target_pos = mCharacter->getVolumePos(shared_data->mTargetConstraintVolume, shared_data->mTargetConstraintOffset); @@ -1035,11 +1035,11 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 if (constraint->mSharedData->mChainLength != 0 && dist_vec_squared(root_pos, target_pos) * 0.95f > constraint->mTotalLength * constraint->mTotalLength) { - constraint->mWeight = lerp(constraint->mWeight, 0.f, LLCriticalDamp::getInterpolant(0.1f)); + constraint->mWeight = LLSmoothInterpolation::lerp(constraint->mWeight, 0.f, 0.1f); } else { - constraint->mWeight = lerp(constraint->mWeight, 1.f, LLCriticalDamp::getInterpolant(0.3f)); + constraint->mWeight = LLSmoothInterpolation::lerp(constraint->mWeight, 1.f, 0.3f); } F32 weight = constraint->mWeight * ((shared_data->mEaseOutStopTime == 0.f) ? 1.f : @@ -1086,9 +1086,9 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 // convert intermediate joint positions to world coordinates positions[joint_num] = ( constraint->mPositions[joint_num] * mPelvisp->getWorldRotation()) + mPelvisp->getWorldPosition(); F32 time_constant = 1.f / clamp_rescale(constraint->mFixupDistanceRMS, 0.f, 0.5f, 0.2f, 8.f); -// llinfos << "Interpolant " << LLCriticalDamp::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << llendl; +// LL_INFOS() << "Interpolant " << LLSmoothInterpolation::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL; positions[joint_num] = lerp(positions[joint_num], kinematic_position, - LLCriticalDamp::getInterpolant(time_constant, FALSE)); + LLSmoothInterpolation::getInterpolant(time_constant, FALSE)); } S32 iteration_count; @@ -1117,8 +1117,8 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 if ((iteration_count >= MIN_ITERATION_COUNT) && (num_joints_finished == shared_data->mChainLength - 1)) { -// llinfos << iteration_count << " iterations on " << -// mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << llendl; +// LL_INFOS() << iteration_count << " iterations on " << +// mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL; break; } } @@ -1234,13 +1234,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (!dp.unpackU16(version, "version")) { - llwarns << "can't read version number" << llendl; + LL_WARNS() << "can't read version number" << LL_ENDL; return FALSE; } if (!dp.unpackU16(sub_version, "sub_version")) { - llwarns << "can't read sub version number" << llendl; + LL_WARNS() << "can't read sub version number" << LL_ENDL; return FALSE; } @@ -1251,28 +1251,28 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) else if (version != KEYFRAME_MOTION_VERSION || sub_version != KEYFRAME_MOTION_SUBVERSION) { #if LL_RELEASE - llwarns << "Bad animation version " << version << "." << sub_version << llendl; + LL_WARNS() << "Bad animation version " << version << "." << sub_version << LL_ENDL; return FALSE; #else - llerrs << "Bad animation version " << version << "." << sub_version << llendl; + LL_ERRS() << "Bad animation version " << version << "." << sub_version << LL_ENDL; #endif } if (!dp.unpackS32(temp_priority, "base_priority")) { - llwarns << "can't read animation base_priority" << llendl; + LL_WARNS() << "can't read animation base_priority" << LL_ENDL; return FALSE; } mJointMotionList->mBasePriority = (LLJoint::JointPriority) temp_priority; if (mJointMotionList->mBasePriority >= LLJoint::ADDITIVE_PRIORITY) { - mJointMotionList->mBasePriority = (LLJoint::JointPriority)((int)LLJoint::ADDITIVE_PRIORITY-1); + mJointMotionList->mBasePriority = (LLJoint::JointPriority)((S32)LLJoint::ADDITIVE_PRIORITY-1); mJointMotionList->mMaxPriority = mJointMotionList->mBasePriority; } else if (mJointMotionList->mBasePriority < LLJoint::USE_MOTION_PRIORITY) { - llwarns << "bad animation base_priority " << mJointMotionList->mBasePriority << llendl; + LL_WARNS() << "bad animation base_priority " << mJointMotionList->mBasePriority << LL_ENDL; return FALSE; } @@ -1281,14 +1281,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) //------------------------------------------------------------------------- if (!dp.unpackF32(mJointMotionList->mDuration, "duration")) { - llwarns << "can't read duration" << llendl; + LL_WARNS() << "can't read duration" << LL_ENDL; return FALSE; } if (mJointMotionList->mDuration > MAX_ANIM_DURATION || !llfinite(mJointMotionList->mDuration)) { - llwarns << "invalid animation duration" << llendl; + LL_WARNS() << "invalid animation duration" << LL_ENDL; return FALSE; } @@ -1297,13 +1297,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) //------------------------------------------------------------------------- if (!dp.unpackString(mJointMotionList->mEmoteName, "emote_name")) { - llwarns << "can't read optional_emote_animation" << llendl; + LL_WARNS() << "can't read optional_emote_animation" << LL_ENDL; return FALSE; } if(mJointMotionList->mEmoteName==mID.asString()) { - llwarns << "Malformed animation mEmoteName==mID" << llendl; + LL_WARNS() << "Malformed animation mEmoteName==mID" << LL_ENDL; return FALSE; } @@ -1313,20 +1313,20 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (!dp.unpackF32(mJointMotionList->mLoopInPoint, "loop_in_point") || !llfinite(mJointMotionList->mLoopInPoint)) { - llwarns << "can't read loop point" << llendl; + LL_WARNS() << "can't read loop point" << LL_ENDL; return FALSE; } if (!dp.unpackF32(mJointMotionList->mLoopOutPoint, "loop_out_point") || !llfinite(mJointMotionList->mLoopOutPoint)) { - llwarns << "can't read loop point" << llendl; + LL_WARNS() << "can't read loop point" << LL_ENDL; return FALSE; } if (!dp.unpackS32(mJointMotionList->mLoop, "loop")) { - llwarns << "can't read loop" << llendl; + LL_WARNS() << "can't read loop" << LL_ENDL; return FALSE; } @@ -1336,14 +1336,14 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (!dp.unpackF32(mJointMotionList->mEaseInDuration, "ease_in_duration") || !llfinite(mJointMotionList->mEaseInDuration)) { - llwarns << "can't read easeIn" << llendl; + LL_WARNS() << "can't read easeIn" << LL_ENDL; return FALSE; } if (!dp.unpackF32(mJointMotionList->mEaseOutDuration, "ease_out_duration") || !llfinite(mJointMotionList->mEaseOutDuration)) { - llwarns << "can't read easeOut" << llendl; + LL_WARNS() << "can't read easeOut" << LL_ENDL; return FALSE; } @@ -1353,13 +1353,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) U32 word; if (!dp.unpackU32(word, "hand_pose")) { - llwarns << "can't read hand pose" << llendl; + LL_WARNS() << "can't read hand pose" << LL_ENDL; return FALSE; } if(word > LLHandMotion::NUM_HAND_POSES) { - llwarns << "invalid LLHandMotion::eHandPose index: " << word << llendl; + LL_WARNS() << "invalid LLHandMotion::eHandPose index: " << word << LL_ENDL; return FALSE; } @@ -1371,18 +1371,18 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) U32 num_motions = 0; if (!dp.unpackU32(num_motions, "num_joints")) { - llwarns << "can't read number of joints" << llendl; + LL_WARNS() << "can't read number of joints" << LL_ENDL; return FALSE; } if (num_motions == 0) { - llwarns << "no joints in animation" << llendl; + LL_WARNS() << "no joints in animation" << LL_ENDL; return FALSE; } else if (num_motions > LL_CHARACTER_MAX_JOINTS) { - llwarns << "too many joints in animation" << llendl; + LL_WARNS() << "too many joints in animation" << LL_ENDL; return FALSE; } @@ -1403,13 +1403,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) std::string joint_name; if (!dp.unpackString(joint_name, "joint_name")) { - llwarns << "can't read joint name" << llendl; + LL_WARNS() << "can't read joint name" << LL_ENDL; return FALSE; } if (joint_name == "mScreen" || joint_name == "mRoot") { - llwarns << "attempted to animate special " << joint_name << " joint" << llendl; + LL_WARNS() << "attempted to animate special " << joint_name << " joint" << LL_ENDL; return FALSE; } @@ -1419,11 +1419,11 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) LLJoint *joint = mCharacter->getJoint( joint_name ); if (joint) { -// llinfos << " joint: " << joint_name << llendl; +// LL_INFOS() << " joint: " << joint_name << LL_ENDL; } else { - llwarns << "joint not found: " << joint_name << llendl; + LL_WARNS() << "joint not found: " << joint_name << LL_ENDL; //return FALSE; } @@ -1440,13 +1440,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) S32 joint_priority; if (!dp.unpackS32(joint_priority, "joint_priority")) { - llwarns << "can't read joint priority." << llendl; + LL_WARNS() << "can't read joint priority." << LL_ENDL; return FALSE; } if (joint_priority < LLJoint::USE_MOTION_PRIORITY) { - llwarns << "joint priority unknown - too low." << llendl; + LL_WARNS() << "joint priority unknown - too low." << LL_ENDL; return FALSE; } @@ -1464,7 +1464,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) //--------------------------------------------------------------------- if (!dp.unpackS32(joint_motion->mRotationCurve.mNumKeys, "num_rot_keys") || joint_motion->mRotationCurve.mNumKeys < 0) { - llwarns << "can't read number of rotation keys" << llendl; + LL_WARNS() << "can't read number of rotation keys" << LL_ENDL; return FALSE; } @@ -1489,7 +1489,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (!dp.unpackF32(time, "time") || !llfinite(time)) { - llwarns << "can't read rotation key (" << k << ")" << llendl; + LL_WARNS() << "can't read rotation key (" << k << ")" << LL_ENDL; return FALSE; } @@ -1498,7 +1498,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) { if (!dp.unpackU16(time_short, "time")) { - llwarns << "can't read rotation key (" << k << ")" << llendl; + LL_WARNS() << "can't read rotation key (" << k << ")" << LL_ENDL; return FALSE; } @@ -1506,7 +1506,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (time < 0 || time > mJointMotionList->mDuration) { - llwarns << "invalid frame time" << llendl; + LL_WARNS() << "invalid frame time" << LL_ENDL; return FALSE; } } @@ -1540,13 +1540,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if( !(rot_key.mRotation.isFinite()) ) { - llwarns << "non-finite angle in rotation key" << llendl; + LL_WARNS() << "non-finite angle in rotation key" << LL_ENDL; success = FALSE; } if (!success) { - llwarns << "can't read rotation key (" << k << ")" << llendl; + LL_WARNS() << "can't read rotation key (" << k << ")" << LL_ENDL; return FALSE; } @@ -1558,7 +1558,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) //--------------------------------------------------------------------- if (!dp.unpackS32(joint_motion->mPositionCurve.mNumKeys, "num_pos_keys") || joint_motion->mPositionCurve.mNumKeys < 0) { - llwarns << "can't read number of position keys" << llendl; + LL_WARNS() << "can't read number of position keys" << LL_ENDL; return FALSE; } @@ -1583,7 +1583,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (!dp.unpackF32(pos_key.mTime, "time") || !llfinite(pos_key.mTime)) { - llwarns << "can't read position key (" << k << ")" << llendl; + LL_WARNS() << "can't read position key (" << k << ")" << LL_ENDL; return FALSE; } } @@ -1591,7 +1591,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) { if (!dp.unpackU16(time_short, "time")) { - llwarns << "can't read position key (" << k << ")" << llendl; + LL_WARNS() << "can't read position key (" << k << ")" << LL_ENDL; return FALSE; } @@ -1619,13 +1619,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if( !(pos_key.mPosition.isFinite()) ) { - llwarns << "non-finite position in key" << llendl; + LL_WARNS() << "non-finite position in key" << LL_ENDL; success = FALSE; } if (!success) { - llwarns << "can't read position key (" << k << ")" << llendl; + LL_WARNS() << "can't read position key (" << k << ")" << LL_ENDL; return FALSE; } @@ -1646,13 +1646,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) S32 num_constraints = 0; if (!dp.unpackS32(num_constraints, "num_constraints")) { - llwarns << "can't read number of constraints" << llendl; + LL_WARNS() << "can't read number of constraints" << LL_ENDL; return FALSE; } if (num_constraints > MAX_CONSTRAINTS || num_constraints < 0) { - llwarns << "Bad number of constraints... ignoring: " << num_constraints << llendl; + LL_WARNS() << "Bad number of constraints... ignoring: " << num_constraints << LL_ENDL; } else { @@ -1668,7 +1668,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (!dp.unpackU8(byte, "chain_length")) { - llwarns << "can't read constraint chain length" << llendl; + LL_WARNS() << "can't read constraint chain length" << LL_ENDL; delete constraintp; return FALSE; } @@ -1676,21 +1676,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if((U32)constraintp->mChainLength > mJointMotionList->getNumJointMotions()) { - llwarns << "invalid constraint chain length" << llendl; + LL_WARNS() << "invalid constraint chain length" << LL_ENDL; delete constraintp; return FALSE; } if (!dp.unpackU8(byte, "constraint_type")) { - llwarns << "can't read constraint type" << llendl; + LL_WARNS() << "can't read constraint type" << LL_ENDL; delete constraintp; return FALSE; } if( byte >= NUM_CONSTRAINT_TYPES ) { - llwarns << "invalid constraint type" << llendl; + LL_WARNS() << "invalid constraint type" << LL_ENDL; delete constraintp; return FALSE; } @@ -1700,7 +1700,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) U8 bin_data[BIN_DATA_LENGTH+1]; if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume")) { - llwarns << "can't read source volume name" << llendl; + LL_WARNS() << "can't read source volume name" << LL_ENDL; delete constraintp; return FALSE; } @@ -1711,21 +1711,21 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset")) { - llwarns << "can't read constraint source offset" << llendl; + LL_WARNS() << "can't read constraint source offset" << LL_ENDL; delete constraintp; return FALSE; } if( !(constraintp->mSourceConstraintOffset.isFinite()) ) { - llwarns << "non-finite constraint source offset" << llendl; + LL_WARNS() << "non-finite constraint source offset" << LL_ENDL; delete constraintp; return FALSE; } if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "target_volume")) { - llwarns << "can't read target volume name" << llendl; + LL_WARNS() << "can't read target volume name" << LL_ENDL; delete constraintp; return FALSE; } @@ -1745,28 +1745,28 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (!dp.unpackVector3(constraintp->mTargetConstraintOffset, "target_offset")) { - llwarns << "can't read constraint target offset" << llendl; + LL_WARNS() << "can't read constraint target offset" << LL_ENDL; delete constraintp; return FALSE; } if( !(constraintp->mTargetConstraintOffset.isFinite()) ) { - llwarns << "non-finite constraint target offset" << llendl; + LL_WARNS() << "non-finite constraint target offset" << LL_ENDL; delete constraintp; return FALSE; } if (!dp.unpackVector3(constraintp->mTargetConstraintDir, "target_dir")) { - llwarns << "can't read constraint target direction" << llendl; + LL_WARNS() << "can't read constraint target direction" << LL_ENDL; delete constraintp; return FALSE; } if( !(constraintp->mTargetConstraintDir.isFinite()) ) { - llwarns << "non-finite constraint target direction" << llendl; + LL_WARNS() << "non-finite constraint target direction" << LL_ENDL; delete constraintp; return FALSE; } @@ -1779,28 +1779,28 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if (!dp.unpackF32(constraintp->mEaseInStartTime, "ease_in_start") || !llfinite(constraintp->mEaseInStartTime)) { - llwarns << "can't read constraint ease in start time" << llendl; + LL_WARNS() << "can't read constraint ease in start time" << LL_ENDL; delete constraintp; return FALSE; } if (!dp.unpackF32(constraintp->mEaseInStopTime, "ease_in_stop") || !llfinite(constraintp->mEaseInStopTime)) { - llwarns << "can't read constraint ease in stop time" << llendl; + LL_WARNS() << "can't read constraint ease in stop time" << LL_ENDL; delete constraintp; return FALSE; } if (!dp.unpackF32(constraintp->mEaseOutStartTime, "ease_out_start") || !llfinite(constraintp->mEaseOutStartTime)) { - llwarns << "can't read constraint ease out start time" << llendl; + LL_WARNS() << "can't read constraint ease out start time" << LL_ENDL; delete constraintp; return FALSE; } if (!dp.unpackF32(constraintp->mEaseOutStopTime, "ease_out_stop") || !llfinite(constraintp->mEaseOutStopTime)) { - llwarns << "can't read constraint ease out stop time" << llendl; + LL_WARNS() << "can't read constraint ease out stop time" << LL_ENDL; delete constraintp; return FALSE; } @@ -1820,8 +1820,8 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) LLJoint* parent = joint->getParent(); if (!parent) { - llwarns << "Joint with no parent: " << joint->getName() - << " Emote: " << mJointMotionList->mEmoteName << llendl; + LL_WARNS() << "Joint with no parent: " << joint->getName() + << " Emote: " << mJointMotionList->mEmoteName << LL_ENDL; return FALSE; } joint = parent; @@ -1832,7 +1832,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) if ( !constraint_joint ) { - llwarns << "Invalid joint " << j << llendl; + LL_WARNS() << "Invalid joint " << j << LL_ENDL; return FALSE; } @@ -1844,7 +1844,7 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp) } if (constraintp->mJointStateIndices[i] < 0 ) { - llwarns << "No joint index for constraint " << i << llendl; + LL_WARNS() << "No joint index for constraint " << i << LL_ENDL; delete constraintp; return FALSE; } @@ -2165,7 +2165,7 @@ void LLKeyframeMotion::onLoadComplete(LLVFS *vfs, U8* buffer = new U8[size]; file.read((U8*)buffer, size); /*Flawfinder: ignore*/ - lldebugs << "Loading keyframe data for: " << motionp->getName() << ":" << motionp->getID() << " (" << size << " bytes)" << llendl; + LL_DEBUGS() << "Loading keyframe data for: " << motionp->getName() << ":" << motionp->getID() << " (" << size << " bytes)" << LL_ENDL; LLDataPackerBinaryBuffer dp(buffer, size); if (motionp->deserialize(dp)) @@ -2174,7 +2174,7 @@ void LLKeyframeMotion::onLoadComplete(LLVFS *vfs, } else { - llwarns << "Failed to decode asset for animation " << motionp->getName() << ":" << motionp->getID() << llendl; + LL_WARNS() << "Failed to decode asset for animation " << motionp->getName() << ":" << motionp->getID() << LL_ENDL; motionp->mAssetStatus = ASSET_FETCH_FAILED; } @@ -2182,13 +2182,13 @@ void LLKeyframeMotion::onLoadComplete(LLVFS *vfs, } else { - llwarns << "Failed to load asset for animation " << motionp->getName() << ":" << motionp->getID() << llendl; + LL_WARNS() << "Failed to load asset for animation " << motionp->getName() << ":" << motionp->getID() << LL_ENDL; motionp->mAssetStatus = ASSET_FETCH_FAILED; } } else { - llwarns << "No existing motion for asset data. UUID: " << asset_uuid << llendl; + LL_WARNS() << "No existing motion for asset data. UUID: " << asset_uuid << LL_ENDL; } } @@ -2202,9 +2202,9 @@ void LLKeyframeDataCache::dumpDiagInfo() char buf[1024]; /* Flawfinder: ignore */ - llinfos << "-----------------------------------------------------" << llendl; - llinfos << " Global Motion Table (DEBUG only)" << llendl; - llinfos << "-----------------------------------------------------" << llendl; + LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; + LL_INFOS() << " Global Motion Table (DEBUG only)" << LL_ENDL; + LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; // print each loaded mesh, and it's memory usage for (keyframe_data_map_t::iterator map_it = sKeyframeDataMap.begin(); @@ -2214,18 +2214,18 @@ void LLKeyframeDataCache::dumpDiagInfo() LLKeyframeMotion::JointMotionList *motion_list_p = map_it->second; - llinfos << "Motion: " << map_it->first << llendl; + LL_INFOS() << "Motion: " << map_it->first << LL_ENDL; joint_motion_kb = motion_list_p->dumpDiagInfo(); total_size += joint_motion_kb; } - llinfos << "-----------------------------------------------------" << llendl; - llinfos << "Motions\tTotal Size" << llendl; + LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; + LL_INFOS() << "Motions\tTotal Size" << LL_ENDL; snprintf(buf, sizeof(buf), "%d\t\t%d bytes", (S32)sKeyframeDataMap.size(), total_size ); /* Flawfinder: ignore */ - llinfos << buf << llendl; - llinfos << "-----------------------------------------------------" << llendl; + LL_INFOS() << buf << LL_ENDL; + LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; } @@ -2292,8 +2292,7 @@ LLKeyframeMotion::JointConstraint::JointConstraint(JointConstraintSharedData* sh mTargetVolume = NULL; mFixupDistanceRMS = 0.f; - int i; - for (i=0; i<MAX_CHAIN_LENGTH; ++i) + for (S32 i=0; i<MAX_CHAIN_LENGTH; ++i) { mJointLengths[i] = 0.f; mJointLengthFractions[i] = 0.f; diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp index 82fe8971f5a4183d6e7c2dfc917d74e9c91ffaf0..6ed18bc4455972d76acc18cb69236491158b6c4f 100755 --- a/indra/llcharacter/llkeyframemotionparam.cpp +++ b/indra/llcharacter/llkeyframemotionparam.cpp @@ -168,7 +168,7 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { const ParameterizedMotion& paramMotion = *iter2; -// llinfos << "Weight for pose " << paramMotion.mMotion->getName() << " is " << paramMotion.mMotion->getPose()->getWeight() << llendl; +// LL_INFOS() << "Weight for pose " << paramMotion.mMotion->getName() << " is " << paramMotion.mMotion->getPose()->getWeight() << LL_ENDL; paramMotion.mMotion->getPose()->setWeight(0.f); } } @@ -181,7 +181,7 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) F32* paramValue = (F32 *)mCharacter->getAnimationData(paramName); if (NULL == paramValue) // unexpected, but... { - llwarns << "paramValue == NULL" << llendl; + LL_WARNS() << "paramValue == NULL" << LL_ENDL; continue; } @@ -256,8 +256,8 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) firstPose->setWeight(first_weight * weightFactor); secondPose->setWeight(second_weight * weightFactor); -// llinfos << "Parameter " << *paramName << ": " << *paramValue << llendl; -// llinfos << "Weights " << firstPose->getWeight() << " " << secondPose->getWeight() << llendl; +// LL_INFOS() << "Parameter " << *paramName << ": " << *paramValue << LL_ENDL; +// LL_INFOS() << "Weights " << firstPose->getWeight() << " " << secondPose->getWeight() << LL_ENDL; } } else if (firstMotion && !secondMotion) @@ -269,7 +269,7 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) // blend poses mPoseBlender.blendAndApply(); - llinfos << "Param Motion weight " << mPoseBlender.getBlendedPose()->getWeight() << llendl; + LL_INFOS() << "Param Motion weight " << mPoseBlender.getBlendedPose()->getWeight() << LL_ENDL; return TRUE; } @@ -356,7 +356,7 @@ BOOL LLKeyframeMotionParam::loadMotions() apr_file_t* fp = infile.getFileHandle() ; if (!fp || fileSize == 0) { - llinfos << "ERROR: can't open: " << path << llendl; + LL_INFOS() << "ERROR: can't open: " << path << LL_ENDL; return FALSE; } @@ -395,11 +395,11 @@ BOOL LLKeyframeMotionParam::loadMotions() if ( error ) { - llinfos << "ERROR: error while reading from " << path << llendl; + LL_INFOS() << "ERROR: error while reading from " << path << LL_ENDL; return FALSE; } - llinfos << "Loading parametric keyframe data for: " << getName() << llendl; + LL_INFOS() << "Loading parametric keyframe data for: " << getName() << LL_ENDL; //------------------------------------------------------------------------- // parse the text and build keyframe data structures @@ -422,7 +422,7 @@ BOOL LLKeyframeMotionParam::loadMotions() if (num == 0 || num == EOF) break; if ((num != 3)) { - llinfos << "WARNING: can't read parametric motion" << llendl; + LL_INFOS() << "WARNING: can't read parametric motion" << LL_ENDL; return FALSE; } diff --git a/indra/llcharacter/llkeyframemotionparam.h b/indra/llcharacter/llkeyframemotionparam.h index 24e81417539d920f560be2255a7693ed42e180e7..0fac3724d14dac9392c0d7571595c40da532bc30 100755 --- a/indra/llcharacter/llkeyframemotionparam.h +++ b/indra/llcharacter/llkeyframemotionparam.h @@ -37,7 +37,6 @@ #include "lljointstate.h" #include "v3math.h" #include "llquaternion.h" -#include "linked_lists.h" #include "llkeyframemotion.h" //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/llkeyframestandmotion.cpp b/indra/llcharacter/llkeyframestandmotion.cpp index 3f91532c8e078f163f67c16d49aa98545a115ae0..fdeddf55e16538326b600342b7fa0b4e55d55b07 100755 --- a/indra/llcharacter/llkeyframestandmotion.cpp +++ b/indra/llcharacter/llkeyframestandmotion.cpp @@ -119,7 +119,7 @@ LLMotion::LLMotionInitStatus LLKeyframeStandMotion::onInitialize(LLCharacter *ch !mKneeRightState || !mAnkleRightState ) { - llinfos << getName() << ": Can't find necessary joint states" << llendl; + LL_INFOS() << getName() << ": Can't find necessary joint states" << LL_ENDL; return STATUS_FAILURE; } @@ -329,9 +329,9 @@ BOOL LLKeyframeStandMotion::onUpdate(F32 time, U8* joint_mask) mKneeRightState->setRotation( mKneeRightJoint.getRotation() ); mAnkleRightState->setRotation( mAnkleRightJoint.getRotation() ); - //llinfos << "Stand drift amount " << (mCharacter->getCharacterPosition() - mLastGoodPosition).magVec() << llendl; + //LL_INFOS() << "Stand drift amount " << (mCharacter->getCharacterPosition() - mLastGoodPosition).magVec() << LL_ENDL; -// llinfos << "DEBUG: " << speed << " : " << mTrackAnkles << llendl; +// LL_INFOS() << "DEBUG: " << speed << " : " << mTrackAnkles << LL_ENDL; return TRUE; } diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp index 69f064b615528c5db5d9345accbb9e91efcdfcd4..7c1fcacf8ab7d935a49e9766f48a5ff155bd1532 100755 --- a/indra/llcharacter/llkeyframewalkmotion.cpp +++ b/indra/llcharacter/llkeyframewalkmotion.cpp @@ -163,7 +163,7 @@ LLMotion::LLMotionInitStatus LLWalkAdjustMotion::onInitialize(LLCharacter *chara mPelvisState->setJoint( mPelvisJoint ); if ( !mPelvisJoint ) { - llwarns << getName() << ": Can't get pelvis joint." << llendl; + LL_WARNS() << getName() << ": Can't get pelvis joint." << LL_ENDL; return STATUS_FAILURE; } @@ -258,7 +258,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) // but this will cause the animation playback rate calculation below to // kick in too slowly and sometimes start playing the animation in reverse. - //mPelvisOffset -= PELVIS_COMPENSATION_WIEGHT * (foot_slip_vector * world_to_avatar_rot);//lerp(LLVector3::zero, -1.f * (foot_slip_vector * world_to_avatar_rot), LLCriticalDamp::getInterpolant(0.1f)); + //mPelvisOffset -= PELVIS_COMPENSATION_WIEGHT * (foot_slip_vector * world_to_avatar_rot);//lerp(LLVector3::zero, -1.f * (foot_slip_vector * world_to_avatar_rot), LLSmoothInterpolation::getInterpolant(0.1f)); ////F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL * (llclamp(speed, 0.f, DRIFT_COMP_MAX_SPEED) / DRIFT_COMP_MAX_SPEED); //F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL; @@ -287,7 +287,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) F32 desired_speed_multiplier = llclamp(speed / foot_speed, min_speed_multiplier, ANIM_SPEED_MAX); // blend towards new speed adjustment value - F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLCriticalDamp::getInterpolant(SPEED_ADJUST_TIME_CONSTANT)); + F32 new_speed_adjust = LLSmoothInterpolation::lerp(mAdjustedSpeed, desired_speed_multiplier, SPEED_ADJUST_TIME_CONSTANT); // limit that rate at which the speed adjustment changes F32 speedDelta = llclamp(new_speed_adjust - mAdjustedSpeed, -SPEED_ADJUST_MAX_SEC * delta_time, SPEED_ADJUST_MAX_SEC * delta_time); @@ -305,8 +305,8 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask) { // standing/turning // damp out speed adjustment to 0 - mAnimSpeed = lerp(mAnimSpeed, 1.f, LLCriticalDamp::getInterpolant(0.2f)); - //mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLCriticalDamp::getInterpolant(0.2f)); + mAnimSpeed = LLSmoothInterpolation::lerp(mAnimSpeed, 1.f, 0.2f); + //mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.2f)); } // broadcast walk speed change @@ -350,7 +350,7 @@ LLMotion::LLMotionInitStatus LLFlyAdjustMotion::onInitialize(LLCharacter *charac mPelvisState->setJoint( pelvisJoint ); if ( !pelvisJoint ) { - llwarns << getName() << ": Can't get pelvis joint." << llendl; + LL_WARNS() << getName() << ": Can't get pelvis joint." << LL_ENDL; return STATUS_FAILURE; } @@ -383,7 +383,7 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask) F32 target_roll = llclamp(ang_vel.mV[VZ], -4.f, 4.f) * roll_factor; // roll is critically damped interpolation between current roll and angular velocity-derived target roll - mRoll = lerp(mRoll, target_roll, LLCriticalDamp::getInterpolant(0.1f)); + mRoll = LLSmoothInterpolation::lerp(mRoll, target_roll, U32Milliseconds(100)); LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f)); mPelvisState->setRotation(roll); diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp index a07f9f4d2e2f4339b83a7f8c5025f31f6c91d2a9..4803f855de98853a96a0f5364ae98b6f4d47868d 100755 --- a/indra/llcharacter/llmotion.cpp +++ b/indra/llcharacter/llmotion.cpp @@ -54,7 +54,7 @@ LLMotion::LLMotion( const LLUUID &id ) : mDeactivateCallback(NULL), mDeactivateCallbackUserData(NULL) { - for (int i=0; i<3; ++i) + for (S32 i=0; i<3; ++i) memset(&mJointSignature[i][0], 0, sizeof(U8) * LL_CHARACTER_MAX_JOINTS); } @@ -73,7 +73,7 @@ void LLMotion::fadeOut() { if (mFadeWeight > 0.01f) { - mFadeWeight = lerp(mFadeWeight, 0.f, LLCriticalDamp::getInterpolant(0.15f)); + mFadeWeight = lerp(mFadeWeight, 0.f, LLSmoothInterpolation::getInterpolant(0.15f)); } else { @@ -88,7 +88,7 @@ void LLMotion::fadeIn() { if (mFadeWeight < 0.99f) { - mFadeWeight = lerp(mFadeWeight, 1.f, LLCriticalDamp::getInterpolant(0.15f)); + mFadeWeight = lerp(mFadeWeight, 1.f, LLSmoothInterpolation::getInterpolant(0.15f)); } else { diff --git a/indra/llcharacter/llmotion.h b/indra/llcharacter/llmotion.h index 6e532aac2fc32775f371929e3e130bb3fd7d651b..5e37f094b8967ec53699ccfae4c797954a039ebf 100755 --- a/indra/llcharacter/llmotion.h +++ b/indra/llcharacter/llmotion.h @@ -204,10 +204,10 @@ class LLTestMotion : public LLMotion LLMotionBlendType getBlendType() { return NORMAL_BLEND; } F32 getMinPixelArea() { return 0.f; } - LLMotionInitStatus onInitialize(LLCharacter*) { llinfos << "LLTestMotion::onInitialize()" << llendl; return STATUS_SUCCESS; } - BOOL onActivate() { llinfos << "LLTestMotion::onActivate()" << llendl; return TRUE; } - BOOL onUpdate(F32 time, U8* joint_mask) { llinfos << "LLTestMotion::onUpdate(" << time << ")" << llendl; return TRUE; } - void onDeactivate() { llinfos << "LLTestMotion::onDeactivate()" << llendl; } + LLMotionInitStatus onInitialize(LLCharacter*) { LL_INFOS() << "LLTestMotion::onInitialize()" << LL_ENDL; return STATUS_SUCCESS; } + BOOL onActivate() { LL_INFOS() << "LLTestMotion::onActivate()" << LL_ENDL; return TRUE; } + BOOL onUpdate(F32 time, U8* joint_mask) { LL_INFOS() << "LLTestMotion::onUpdate(" << time << ")" << LL_ENDL; return TRUE; } + void onDeactivate() { LL_INFOS() << "LLTestMotion::onDeactivate()" << LL_ENDL; } }; diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index e9fb91ad7323d4cd6dba1d5eb7ff611fc3b055d0..50ccfd75fbc9bad63285ea44f34cb3c28b8a4d41 100755 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -30,6 +30,7 @@ #include "linden_common.h" #include "llmotioncontroller.h" +#include "llfasttimer.h" #include "llkeyframemotion.h" #include "llmath.h" #include "lltimer.h" @@ -76,7 +77,7 @@ LLMotionRegistry::~LLMotionRegistry() //----------------------------------------------------------------------------- BOOL LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) { - // llinfos << "Registering motion: " << name << llendl; + // LL_INFOS() << "Registering motion: " << name << LL_ENDL; if (!is_in_map(mMotionTable, id)) { mMotionTable[id] = constructor; @@ -231,7 +232,7 @@ void LLMotionController::purgeExcessMotions() if (mLoadedMotions.size() > 2*MAX_MOTION_INSTANCES) { - LL_WARNS_ONCE("Animation") << "> " << 2*MAX_MOTION_INSTANCES << " Loaded Motions" << llendl; + LL_WARNS_ONCE("Animation") << "> " << 2*MAX_MOTION_INSTANCES << " Loaded Motions" << LL_ENDL; } } @@ -359,7 +360,7 @@ LLMotion* LLMotionController::createMotion( const LLUUID &id ) switch(stat) { case LLMotion::STATUS_FAILURE: - llinfos << "Motion " << id << " init failed." << llendl; + LL_INFOS() << "Motion " << id << " init failed." << LL_ENDL; sRegistry.markBad(id); delete motion; return NULL; @@ -371,7 +372,7 @@ LLMotion* LLMotionController::createMotion( const LLUUID &id ) mLoadedMotions.insert(motion); break; default: - llerrs << "Invalid initialization status" << llendl; + LL_ERRS() << "Invalid initialization status" << LL_ENDL; break; } @@ -417,7 +418,7 @@ BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset) return TRUE; } -// llinfos << "Starting motion " << name << llendl; +// LL_INFOS() << "Starting motion " << name << LL_ENDL; return activateMotionInstance(motion, mAnimTime - start_offset); } @@ -540,7 +541,7 @@ void LLMotionController::updateIdleActiveMotions() //----------------------------------------------------------------------------- // updateMotionsByType() //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_MOTION_ON_UPDATE("Motion onUpdate"); +static LLTrace::BlockTimerStatHandle FTM_MOTION_ON_UPDATE("Motion onUpdate"); void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type) { @@ -700,7 +701,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty // perform motion update { - LLFastTimer t(FTM_MOTION_ON_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_MOTION_ON_UPDATE); update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); } } @@ -780,7 +781,7 @@ void LLMotionController::updateLoadingMotions() } else if (status == LLMotion::STATUS_FAILURE) { - llinfos << "Motion " << motionp->getID() << " init failed." << llendl; + LL_INFOS() << "Motion " << motionp->getID() << " init failed." << LL_ENDL; sRegistry.markBad(motionp->getID()); mLoadingMotions.erase(curiter); motion_set_t::iterator found_it = mDeprecatedMotions.find(motionp); @@ -882,7 +883,7 @@ void LLMotionController::updateMotions(bool force_update) } mHasRunOnce = TRUE; -// llinfos << "Motion controller time " << motionTimer.getElapsedTimeF32() << llendl; +// LL_INFOS() << "Motion controller time " << motionTimer.getElapsedTimeF32() << LL_ENDL; } //----------------------------------------------------------------------------- @@ -1038,7 +1039,7 @@ LLMotion* LLMotionController::findMotion(const LLUUID& id) const //----------------------------------------------------------------------------- void LLMotionController::dumpMotions() { - llinfos << "=====================================" << llendl; + LL_INFOS() << "=====================================" << LL_ENDL; for (motion_map_t::iterator iter = mAllMotions.begin(); iter != mAllMotions.end(); iter++) { @@ -1053,7 +1054,7 @@ void LLMotionController::dumpMotions() state_string += std::string("A"); if (mDeprecatedMotions.find(motion) != mDeprecatedMotions.end()) state_string += std::string("D"); - llinfos << gAnimLibrary.animationName(id) << " " << state_string << llendl; + LL_INFOS() << gAnimLibrary.animationName(id) << " " << state_string << LL_ENDL; } } @@ -1112,7 +1113,7 @@ void LLMotionController::pauseAllMotions() { if (!mPaused) { - //llinfos << "Pausing animations..." << llendl; + //LL_INFOS() << "Pausing animations..." << LL_ENDL; mPaused = TRUE; } @@ -1125,7 +1126,7 @@ void LLMotionController::unpauseAllMotions() { if (mPaused) { - //llinfos << "Unpausing animations..." << llendl; + //LL_INFOS() << "Unpausing animations..." << LL_ENDL; mPaused = FALSE; } } diff --git a/indra/llcharacter/llmotioncontroller.h b/indra/llcharacter/llmotioncontroller.h index 52eaf557b16c12898051fa05d557a9a5f17e9ba3..2bd5271c4f73a0775985fa7f8eab83b8c3f7dfd7 100755 --- a/indra/llcharacter/llmotioncontroller.h +++ b/indra/llcharacter/llmotioncontroller.h @@ -34,7 +34,6 @@ #include <map> #include <deque> -#include "lluuidhashmap.h" #include "llmotion.h" #include "llpose.h" #include "llframetimer.h" diff --git a/indra/llcharacter/llmultigesture.cpp b/indra/llcharacter/llmultigesture.cpp index 411bb094fd12d06606e1b05c04f1591683409f42..2045739c7f1144e76cfa5b5a703e02a18947f2ec 100755 --- a/indra/llcharacter/llmultigesture.cpp +++ b/indra/llcharacter/llmultigesture.cpp @@ -147,9 +147,9 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) dp.unpackS32(version, "version"); if (version != GESTURE_VERSION) { - llwarns << "Bad LLMultiGesture version " << version + LL_WARNS() << "Bad LLMultiGesture version " << version << " should be " << GESTURE_VERSION - << llendl; + << LL_ENDL; return FALSE; } @@ -165,7 +165,7 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) dp.unpackS32(count, "step_count"); if (count < 0) { - llwarns << "Bad LLMultiGesture step count " << count << llendl; + LL_WARNS() << "Bad LLMultiGesture step count " << count << LL_ENDL; return FALSE; } @@ -212,7 +212,7 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) } default: { - llwarns << "Bad LLMultiGesture step type " << type << llendl; + LL_WARNS() << "Bad LLMultiGesture step type " << type << LL_ENDL; return FALSE; } } @@ -222,10 +222,10 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp) void LLMultiGesture::dump() { - llinfos << "key " << S32(mKey) << " mask " << U32(mMask) + LL_INFOS() << "key " << S32(mKey) << " mask " << U32(mMask) << " trigger " << mTrigger << " replace " << mReplaceText - << llendl; + << LL_ENDL; U32 i; for (i = 0; i < mSteps.size(); ++i) { @@ -313,10 +313,10 @@ std::vector<std::string> LLGestureStepAnimation::getLabel() const void LLGestureStepAnimation::dump() { - llinfos << "step animation " << mAnimName + LL_INFOS() << "step animation " << mAnimName << " id " << mAnimAssetID << " flags " << mFlags - << llendl; + << LL_ENDL; } //--------------------------------------------------------------------------- @@ -375,10 +375,10 @@ std::vector<std::string> LLGestureStepSound::getLabel() const void LLGestureStepSound::dump() { - llinfos << "step sound " << mSoundName + LL_INFOS() << "step sound " << mSoundName << " id " << mSoundAssetID << " flags " << mFlags - << llendl; + << LL_ENDL; } @@ -431,9 +431,9 @@ std::vector<std::string> LLGestureStepChat::getLabel() const void LLGestureStepChat::dump() { - llinfos << "step chat " << mChatText + LL_INFOS() << "step chat " << mChatText << " flags " << mFlags - << llendl; + << LL_ENDL; } @@ -504,7 +504,7 @@ std::vector<std::string> LLGestureStepWait::getLabel() const void LLGestureStepWait::dump() { - llinfos << "step wait " << mWaitSeconds + LL_INFOS() << "step wait " << mWaitSeconds << " flags " << mFlags - << llendl; + << LL_ENDL; } diff --git a/indra/llcharacter/llpose.h b/indra/llcharacter/llpose.h index b486852605db04d815a1e9dec54f03b03ad33253..c004a0f3b74388b3ceb7999eca33b2dff6a59fb9 100755 --- a/indra/llcharacter/llpose.h +++ b/indra/llcharacter/llpose.h @@ -33,7 +33,6 @@ #include "lljointstate.h" #include "lljoint.h" -#include "llmap.h" #include "llpointer.h" #include <map> diff --git a/indra/llcharacter/llstatemachine.cpp b/indra/llcharacter/llstatemachine.cpp index e0454131a52e393d6c006a5897815336a0fa20df..b917db31172fd5bb8397390834b1db73d2f8bef3 100755 --- a/indra/llcharacter/llstatemachine.cpp +++ b/indra/llcharacter/llstatemachine.cpp @@ -88,7 +88,7 @@ BOOL LLStateDiagram::addTransition(LLFSMState& start_state, LLFSMState& end_stat Transitions::iterator transition_it = state_transitions->find(&transition); if (transition_it != state_transitions->end()) { - llerrs << "LLStateTable::addDirectedTransition() : transition already exists" << llendl; + LL_ERRS() << "LLStateTable::addDirectedTransition() : transition already exists" << LL_ENDL; return FALSE; // transition already exists } @@ -210,7 +210,7 @@ BOOL LLStateDiagram::saveDotFile(const std::string& filename) if (!dot_file) { - llwarns << "LLStateDiagram::saveDotFile() : Couldn't open " << filename << " to save state diagram." << llendl; + LL_WARNS() << "LLStateDiagram::saveDotFile() : Couldn't open " << filename << " to save state diagram." << LL_ENDL; return FALSE; } apr_file_printf(dot_file, "digraph StateMachine {\n\tsize=\"100,100\";\n\tfontsize=40;\n\tlabel=\"Finite State Machine\";\n\torientation=landscape\n\tratio=.77\n"); @@ -364,7 +364,7 @@ void LLStateMachine::processTransition(LLFSMTransition& transition, void* user_d if (NULL == mCurrentState) { - llwarns << "mCurrentState == NULL; aborting processTransition()" << llendl; + LL_WARNS() << "mCurrentState == NULL; aborting processTransition()" << LL_ENDL; return; } @@ -372,7 +372,7 @@ void LLStateMachine::processTransition(LLFSMTransition& transition, void* user_d if (NULL == new_state) { - llwarns << "new_state == NULL; aborting processTransition()" << llendl; + LL_WARNS() << "new_state == NULL; aborting processTransition()" << LL_ENDL; return; } @@ -385,9 +385,9 @@ void LLStateMachine::processTransition(LLFSMTransition& transition, void* user_d mCurrentState = new_state; mCurrentState->onEntry(user_data); #if FSM_PRINT_STATE_TRANSITIONS - llinfos << "Entering state " << mCurrentState->getName() << + LL_INFOS() << "Entering state " << mCurrentState->getName() << " on transition " << transition.getName() << " from state " << - mLastState->getName() << llendl; + mLastState->getName() << LL_ENDL; #endif } } diff --git a/indra/llcharacter/lltargetingmotion.cpp b/indra/llcharacter/lltargetingmotion.cpp index fa5f06328e68b01e15cf9298d206defbb9e8b359..007834b17820f72ca8149692d8e8142429ba9417 100755 --- a/indra/llcharacter/lltargetingmotion.cpp +++ b/indra/llcharacter/lltargetingmotion.cpp @@ -80,7 +80,7 @@ LLMotion::LLMotionInitStatus LLTargetingMotion::onInitialize(LLCharacter *charac !mTorsoJoint || !mRightHandJoint) { - llwarns << "Invalid skeleton for targeting motion!" << llendl; + LL_WARNS() << "Invalid skeleton for targeting motion!" << LL_ENDL; return STATUS_FAILURE; } @@ -106,7 +106,7 @@ BOOL LLTargetingMotion::onActivate() //----------------------------------------------------------------------------- BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) { - F32 slerp_amt = LLCriticalDamp::getInterpolant(TORSO_TARGET_HALF_LIFE); + F32 slerp_amt = LLSmoothInterpolation::getInterpolant(TORSO_TARGET_HALF_LIFE); LLVector3 target; LLVector3* lookAtPoint = (LLVector3*)mCharacter->getAnimationData("LookAtPoint"); diff --git a/indra/llcharacter/llvisualparam.cpp b/indra/llcharacter/llvisualparam.cpp index f7cb0f76b717f9a83b42d91d96b64219b527a9ff..0df7fb2bc3c73b9784e452bc2b037bc601064363 100755 --- a/indra/llcharacter/llvisualparam.cpp +++ b/indra/llcharacter/llvisualparam.cpp @@ -79,7 +79,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) mDefaultWeight = llclamp( default_weight, mMinWeight, mMaxWeight ); if( default_weight != mDefaultWeight ) { - llwarns << "value_default attribute is out of range in node " << mName << " " << default_weight << llendl; + LL_WARNS() << "value_default attribute is out of range in node " << mName << " " << default_weight << LL_ENDL; } } @@ -101,7 +101,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) } else { - llwarns << "Avatar file: <param> has invalid sex attribute: " << sex << llendl; + LL_WARNS() << "Avatar file: <param> has invalid sex attribute: " << sex << LL_ENDL; return FALSE; } @@ -109,7 +109,7 @@ BOOL LLVisualParamInfo::parseXml(LLXmlTreeNode *node) static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); if( !node->getFastAttributeString( name_string, mName ) ) { - llwarns << "Avatar file: <param> is missing name attribute" << llendl; + LL_WARNS() << "Avatar file: <param> is missing name attribute" << LL_ENDL; return FALSE; } @@ -346,7 +346,7 @@ void LLVisualParam::setParamLocation(EParamLocation loc) } else { - lldebugs << "param location is already " << mParamLocation << ", not slamming to " << loc << llendl; + LL_DEBUGS() << "param location is already " << mParamLocation << ", not slamming to " << loc << LL_ENDL; } } diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h index 60ea7a369a8aecfc6c0a1c96a9d8b32c33b7eec7..a4d9f93e56f78b5fb3f8f6f970e6a62fa6ca64a7 100755 --- a/indra/llcharacter/llvisualparam.h +++ b/indra/llcharacter/llvisualparam.h @@ -47,6 +47,7 @@ enum EVisualParamGroup VISUAL_PARAM_GROUP_TWEAKABLE, VISUAL_PARAM_GROUP_ANIMATABLE, VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT, + VISUAL_PARAM_GROUP_TRANSMIT_NOT_TWEAKABLE, // deprecated params that used to be tweakable. NUM_VISUAL_PARAM_GROUPS }; diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 8767616a70fe87bc6c1f575b47ad9264d4a00421..5856e06b67510e9686a0eeaefa07ece22a094cf4 100755 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -26,22 +26,20 @@ include_directories( # ${LLCOMMON_LIBRARIES}) set(llcommon_SOURCE_FILES - imageids.cpp indra_constants.cpp llallocator.cpp llallocator_heap_profile.cpp llapp.cpp llapr.cpp llassettype.cpp - llavatarname.cpp llbase32.cpp llbase64.cpp + llbitpack.cpp llcommon.cpp llcommonutils.cpp llcoros.cpp llcrc.cpp llcriticaldamp.cpp - llcursortypes.cpp lldate.cpp lldeadmantimer.cpp lldependencies.cpp @@ -59,7 +57,6 @@ set(llcommon_SOURCE_FILES llfile.cpp llfindlocale.cpp llfixedbuffer.cpp - llfoldertype.cpp llformat.cpp llframetimer.cpp llheartbeat.cpp @@ -69,15 +66,15 @@ set(llcommon_SOURCE_FILES llleaplistener.cpp llliveappconfig.cpp lllivefile.cpp - lllog.cpp llmd5.cpp llmemory.cpp llmemorystream.cpp llmetrics.cpp llmetricperformancetester.cpp llmortician.cpp - lloptioninterface.cpp + llmutex.cpp llptrto.cpp + llpredicate.cpp llprocess.cpp llprocessor.cpp llprocinfo.cpp @@ -90,9 +87,7 @@ set(llcommon_SOURCE_FILES llsdserialize.cpp llsdserialize_xml.cpp llsdutil.cpp - llsecondlifeurls.cpp llsingleton.cpp - llstat.cpp llstacktrace.cpp llstreamqueue.cpp llstreamtools.cpp @@ -100,14 +95,16 @@ set(llcommon_SOURCE_FILES llstringtable.cpp llsys.cpp llthread.cpp + llthreadlocalstorage.cpp llthreadsafequeue.cpp lltimer.cpp + lltrace.cpp + lltraceaccumulators.cpp + lltracerecording.cpp + lltracethreadrecorder.cpp lluri.cpp lluuid.cpp llworkerthread.cpp - metaclass.cpp - metaproperty.cpp - reflective.cpp timing.cpp u64.cpp ) @@ -115,53 +112,35 @@ set(llcommon_SOURCE_FILES set(llcommon_HEADER_FILES CMakeLists.txt - bitpack.h ctype_workaround.h - doublelinkedlist.h fix_macros.h - imageids.h indra_constants.h linden_common.h - linked_lists.h - llaccountingcost.h llalignedarray.h llallocator.h llallocator_heap_profile.h - llagentconstants.h - llavatarname.h llapp.h llapr.h llassettype.h - llassoclist.h - llavatarconstants.h llbase32.h llbase64.h + llbitpack.h llboost.h - llchat.h - llclickaction.h llcommon.h llcommonutils.h llcoros.h llcrc.h llcriticaldamp.h - llcursortypes.h - lldarray.h - lldarrayptr.h lldate.h lldeadmantimer.h lldefs.h lldependencies.h - lldeleteutils.h lldepthstack.h lldictionary.h - lldlinked.h lldoubledispatch.h - lldqueueptr.h llendianswizzle.h - llenum.h llerror.h llerrorcontrol.h - llerrorlegacy.h llerrorthread.h llevent.h lleventapi.h @@ -170,33 +149,25 @@ set(llcommon_HEADER_FILES lleventfilter.h llevents.h lleventemitter.h - llextendedstatus.h llfasttimer.h llfile.h llfindlocale.h llfixedbuffer.h - llfoldertype.h llformat.h llframetimer.h llhandle.h llhash.h llheartbeat.h llhttpstatuscodes.h - llindexedqueue.h + llindexedvector.h llinitparam.h llinstancetracker.h llkeythrottle.h - lllazy.h llleap.h llleaplistener.h lllistenerwrapper.h - lllinkedqueue.h llliveappconfig.h lllivefile.h - lllocalidhashmap.h - lllog.h - lllslconstants.h - llmap.h llmd5.h llmemory.h llmemorystream.h @@ -204,15 +175,13 @@ set(llcommon_HEADER_FILES llmetricperformancetester.h llmortician.h llnametable.h - lloptioninterface.h llpointer.h + llpredicate.h llpreprocessor.h llpriqueuemap.h llprocess.h llprocessor.h llprocinfo.h - llptrskiplist.h - llptrskipmap.h llptrto.h llqueuedthread.h llrand.h @@ -226,16 +195,9 @@ set(llcommon_HEADER_FILES llsdserialize.h llsdserialize_xml.h llsdutil.h - llsecondlifeurls.h llsimplehash.h llsingleton.h - llskiplist.h - llskipmap.h - llsortedvector.h - llstack.h llstacktrace.h - llstat.h - llstatenums.h llstl.h llstreamqueue.h llstreamtools.h @@ -245,29 +207,24 @@ set(llcommon_HEADER_FILES llstaticstringtable.h llsys.h llthread.h + llthreadlocalstorage.h llthreadsafequeue.h lltimer.h + lltrace.h + lltraceaccumulators.h + lltracerecording.h + lltracethreadrecorder.h lltreeiterators.h - lltypeinfolookup.h + llunits.h + llunittype.h lluri.h lluuid.h - lluuidhashmap.h - llversionserver.h + llwin32headers.h + llwin32headerslean.h llworkerthread.h - ll_template_cast.h - metaclass.h - metaclasst.h - metaproperty.h - metapropertyt.h - reflective.h - reflectivet.h - roles_constants.h - stdenums.h stdtypes.h - string_table.h stringize.h timer.h - timing.h u64.h ) @@ -333,16 +290,16 @@ if (LL_TESTS) LL_ADD_INTEGRATION_TEST(llerror "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llframetimer "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llinstancetracker "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(lllazy "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llprocessor "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llprocinfo "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llrand "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llsdserialize "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llsingleton "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llstring "" "${test_libs}") + LL_ADD_INTEGRATION_TEST(lltrace "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lltreeiterators "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lluri "" "${test_libs}") - LL_ADD_INTEGRATION_TEST(reflection "" "${test_libs}") + LL_ADD_INTEGRATION_TEST(llunits "" "${test_libs}") LL_ADD_INTEGRATION_TEST(stringize "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lleventdispatcher "" "${test_libs}") LL_ADD_INTEGRATION_TEST(lleventcoro "" "${test_libs};${BOOST_CONTEXT_LIBRARY}") diff --git a/indra/llcommon/doublelinkedlist.h b/indra/llcommon/doublelinkedlist.h deleted file mode 100755 index 0aeaa69df3435a27ea6d99f855f74bb7c56a47c7..0000000000000000000000000000000000000000 --- a/indra/llcommon/doublelinkedlist.h +++ /dev/null @@ -1,1397 +0,0 @@ -/** - * @file doublelinkedlist.h - * @brief Provides a standard doubly linked list for fun and profit. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_DOUBLELINKEDLIST_H -#define LL_DOUBLELINKEDLIST_H - -#include "llerror.h" -#include "llrand.h" - -// node that actually contains the data -template <class DATA_TYPE> class LLDoubleLinkedNode -{ -public: - DATA_TYPE *mDatap; - LLDoubleLinkedNode *mNextp; - LLDoubleLinkedNode *mPrevp; - - -public: - // assign the mDatap pointer - LLDoubleLinkedNode(DATA_TYPE *data); - - // destructor does not, by default, destroy associated data - // however, the mDatap must be NULL to ensure that we aren't causing memory leaks - ~LLDoubleLinkedNode(); - - // delete associated data and NULL out pointer - void deleteData(); - - // remove associated data and NULL out pointer - void removeData(); -}; - - -const U32 LLDOUBLE_LINKED_LIST_STATE_STACK_DEPTH = 4; - -template <class DATA_TYPE> class LLDoubleLinkedList -{ -private: - LLDoubleLinkedNode<DATA_TYPE> mHead; // head node - LLDoubleLinkedNode<DATA_TYPE> mTail; // tail node - LLDoubleLinkedNode<DATA_TYPE> *mQueuep; // The node in the batter's box - LLDoubleLinkedNode<DATA_TYPE> *mCurrentp; // The node we're talking about - - // The state stack allows nested exploration of the LLDoubleLinkedList - // but should be used with great care - LLDoubleLinkedNode<DATA_TYPE> *mQueuepStack[LLDOUBLE_LINKED_LIST_STATE_STACK_DEPTH]; - LLDoubleLinkedNode<DATA_TYPE> *mCurrentpStack[LLDOUBLE_LINKED_LIST_STATE_STACK_DEPTH]; - U32 mStateStackDepth; - U32 mCount; - - // mInsertBefore is a pointer to a user-set function that returns - // TRUE if "first" should be located before "second" - // NOTE: mInsertBefore() should never return TRUE when ("first" == "second") - // or never-ending loops can occur - BOOL (*mInsertBefore)(DATA_TYPE *first, DATA_TYPE *second); - -public: - LLDoubleLinkedList(); - - // destructor destroys list and nodes, but not data in nodes - ~LLDoubleLinkedList(); - - // put data into a node and stick it at the front of the list - // set mCurrentp to mQueuep - void addData(DATA_TYPE *data); - - // put data into a node and stick it at the end of the list - // set mCurrentp to mQueuep - void addDataAtEnd(DATA_TYPE *data); - - S32 getLength() const; - // search the list starting at mHead.mNextp and remove the link with mDatap == data - // set mCurrentp to mQueuep - // return TRUE if found, FALSE if not found - BOOL removeData(const DATA_TYPE *data); - - // search the list starting at mHead.mNextp and delete the link with mDatap == data - // set mCurrentp to mQueuep - // return TRUE if found, FALSE if not found - BOOL deleteData(DATA_TYPE *data); - - // remove all nodes from the list and delete the associated data - void deleteAllData(); - - // remove all nodes from the list but do not delete data - void removeAllNodes(); - - BOOL isEmpty(); - - // check to see if data is in list - // set mCurrentp and mQueuep to the target of search if found, otherwise set mCurrentp to mQueuep - // return TRUE if found, FALSE if not found - BOOL checkData(const DATA_TYPE *data); - - // NOTE: This next two funtions are only included here - // for those too familiar with the LLLinkedList template class. - // They are depreciated. resetList() is unecessary while - // getCurrentData() is identical to getNextData() and has - // a misleading name. - // - // The recommended way to loop through a list is as follows: - // - // datap = list.getFirstData(); - // while (datap) - // { - // /* do stuff */ - // datap = list.getNextData(); - // } - - // place mQueuep on mHead node - void resetList(); - - // return the data currently pointed to, - // set mCurrentp to that node and bump mQueuep down the list - // NOTE: this function is identical to getNextData() - DATA_TYPE *getCurrentData(); - - - // reset the list and return the data currently pointed to, - // set mCurrentp to that node and bump mQueuep down the list - DATA_TYPE *getFirstData(); - - - // reset the list and return the data at position n, set mCurentp - // to that node and bump mQueuep down the list - // Note: n=0 will behave like getFirstData() - DATA_TYPE *getNthData(U32 n); - - // reset the list and return the last data in it, - // set mCurrentp to that node and bump mQueuep up the list - DATA_TYPE *getLastData(); - - // return data in mQueuep, - // set mCurrentp mQueuep and bump mQueuep down the list - DATA_TYPE *getNextData(); - - // return the data in mQueuep, - // set mCurrentp to mQueuep and bump mQueuep up the list - DATA_TYPE *getPreviousData(); - - // remove the Node at mCurrentp - // set mCurrentp to mQueuep - void removeCurrentData(); - - // delete the Node at mCurrentp - // set mCurrentp to mQueuep - void deleteCurrentData(); - - // remove the Node at mCurrentp and insert it into newlist - // set mCurrentp to mQueuep - void moveCurrentData(LLDoubleLinkedList<DATA_TYPE> *newlist); - - // insert the node in front of mCurrentp - // set mCurrentp to mQueuep - void insertNode(LLDoubleLinkedNode<DATA_TYPE> *node); - - // insert the data in front of mCurrentp - // set mCurrentp to mQueuep - void insertData(DATA_TYPE *data); - - // if mCurrentp has a previous node then : - // * swaps mCurrentp with its previous - // * set mCurrentp to mQueuep - // (convenient for forward bubble-sort) - // otherwise does nothing - void swapCurrentWithPrevious(); - - // if mCurrentp has a next node then : - // * swaps mCurrentp with its next - // * set mCurrentp to mQueuep - // (convenient for backwards bubble-sort) - // otherwise does nothing - void swapCurrentWithNext(); - - // move mCurrentp to the front of the list - // set mCurrentp to mQueuep - void moveCurrentToFront(); - - // move mCurrentp to the end of the list - // set mCurrentp to mQueuep - void moveCurrentToEnd(); - - // set mInsertBefore - void setInsertBefore(BOOL (*insert_before)(DATA_TYPE *first, DATA_TYPE *second)); - - // add data in front of first node for which mInsertBefore(datap, node->mDatap) returns TRUE - // set mCurrentp to mQueuep - BOOL addDataSorted(DATA_TYPE *datap); - - // sort the list using bubble-sort - // Yes, this is a different name than the same function in LLLinkedList. - // When it comes time for a name consolidation hopefully this one will win. - BOOL bubbleSort(); - - // does a single bubble sort pass on the list - BOOL lazyBubbleSort(); - - // returns TRUE if state successfully pushed (state stack not full) - BOOL pushState(); - - // returns TRUE if state successfully popped (state stack not empty) - BOOL popState(); - - // empties the state stack - void clearStateStack(); - - // randomly move the the links in the list for debug or (Discordian) purposes - // sets mCurrentp and mQueuep to top of list - void scramble(); - -private: - // add node to beginning of list - // set mCurrentp to mQueuep - void addNode(LLDoubleLinkedNode<DATA_TYPE> *node); - - // add node to end of list - // set mCurrentp to mQueuep - void addNodeAtEnd(LLDoubleLinkedNode<DATA_TYPE> *node); -}; - -//#endif - -//////////////////////////////////////////////////////////////////////////////////////////// - -// doublelinkedlist.cpp -// LLDoubleLinkedList template class implementation file. -// Provides a standard doubly linked list for fun and profit. -// -// Copyright 2001, Linden Research, Inc. - -//#include "llerror.h" -//#include "doublelinkedlist.h" - -////////////////////////////////////////////////////////////////////////////////////////// -// LLDoubleLinkedNode -////////////////////////////////////////////////////////////////////////////////////////// - - -// assign the mDatap pointer -template <class DATA_TYPE> -LLDoubleLinkedNode<DATA_TYPE>::LLDoubleLinkedNode(DATA_TYPE *data) : - mDatap(data), mNextp(NULL), mPrevp(NULL) -{ -} - - -// destructor does not, by default, destroy associated data -// however, the mDatap must be NULL to ensure that we aren't causing memory leaks -template <class DATA_TYPE> -LLDoubleLinkedNode<DATA_TYPE>::~LLDoubleLinkedNode() -{ - if (mDatap) - { - llerror("Attempting to call LLDoubleLinkedNode destructor with a non-null mDatap!", 1); - } -} - - -// delete associated data and NULL out pointer -template <class DATA_TYPE> -void LLDoubleLinkedNode<DATA_TYPE>::deleteData() -{ - delete mDatap; - mDatap = NULL; -} - - -template <class DATA_TYPE> -void LLDoubleLinkedNode<DATA_TYPE>::removeData() -{ - mDatap = NULL; -} - - -////////////////////////////////////////////////////////////////////////////////////// -// LLDoubleLinkedList -////////////////////////////////////////////////////////////////////////////////////// - -// <------- up ------- -// -// mCurrentp -// mQueuep | -// | | -// | | -// .------. .------. .------. .------. -// | |---->| |---->| |----->| |-----> NULL -// NULL <-----| |<----| |<----| |<-----| | -// _'------' '------' '------' '------:_ -// .------. /| | | |\ .------. -// NULL <-----|mHead |/ | mQueuep \|mTail |-----> NULL -// | | mCurrentp | | -// '------' '------' -// -------- down ---------> - -template <class DATA_TYPE> -LLDoubleLinkedList<DATA_TYPE>::LLDoubleLinkedList() -: mHead(NULL), mTail(NULL), mQueuep(NULL) -{ - mCurrentp = mHead.mNextp; - mQueuep = mHead.mNextp; - mStateStackDepth = 0; - mCount = 0; - mInsertBefore = NULL; -} - - -// destructor destroys list and nodes, but not data in nodes -template <class DATA_TYPE> -LLDoubleLinkedList<DATA_TYPE>::~LLDoubleLinkedList() -{ - removeAllNodes(); -} - - -// put data into a node and stick it at the front of the list -// doesn't change mCurrentp nor mQueuep -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::addData(DATA_TYPE *data) -{ - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLDoubleLinkedList::addData()", 0); - } - - // make the new node - LLDoubleLinkedNode<DATA_TYPE> *temp = new LLDoubleLinkedNode<DATA_TYPE> (data); - - // add the node to the front of the list - temp->mPrevp = NULL; - temp->mNextp = mHead.mNextp; - mHead.mNextp = temp; - - // if there's something in the list, fix its back pointer - if (temp->mNextp) - { - temp->mNextp->mPrevp = temp; - } - // otherwise, fix the tail of the list - else - { - mTail.mPrevp = temp; - } - - mCount++; -} - - -// put data into a node and stick it at the end of the list -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::addDataAtEnd(DATA_TYPE *data) -{ - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLDoubleLinkedList::addData()", 0); - } - - // make the new node - LLDoubleLinkedNode<DATA_TYPE> *nodep = new LLDoubleLinkedNode<DATA_TYPE>(data); - - addNodeAtEnd(nodep); - mCount++; -} - - -// search the list starting at mHead.mNextp and remove the link with mDatap == data -// set mCurrentp to mQueuep, or NULL if mQueuep points to node with mDatap == data -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLDoubleLinkedList<DATA_TYPE>::removeData(const DATA_TYPE *data) -{ - BOOL b_found = FALSE; - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLDoubleLinkedList::removeData()", 0); - } - - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - if (mCurrentp->mDatap == data) - { - b_found = TRUE; - - // if there is a next one, fix it - if (mCurrentp->mNextp) - { - mCurrentp->mNextp->mPrevp = mCurrentp->mPrevp; - } - else // we are at end of list - { - mTail.mPrevp = mCurrentp->mPrevp; - } - - // if there is a previous one, fix it - if (mCurrentp->mPrevp) - { - mCurrentp->mPrevp->mNextp = mCurrentp->mNextp; - } - else // we are at beginning of list - { - mHead.mNextp = mCurrentp->mNextp; - } - - // remove the node - mCurrentp->removeData(); - delete mCurrentp; - mCount--; - break; - } - mCurrentp = mCurrentp->mNextp; - } - - // reset the list back to where it was - if (mCurrentp == mQueuep) - { - mCurrentp = mQueuep = NULL; - } - else - { - mCurrentp = mQueuep; - } - - return b_found; -} - - -// search the list starting at mHead.mNextp and delete the link with mDatap == data -// set mCurrentp to mQueuep, or NULL if mQueuep points to node with mDatap == data -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLDoubleLinkedList<DATA_TYPE>::deleteData(DATA_TYPE *data) -{ - BOOL b_found = FALSE; - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLDoubleLinkedList::deleteData()", 0); - } - - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - if (mCurrentp->mDatap == data) - { - b_found = TRUE; - - // if there is a next one, fix it - if (mCurrentp->mNextp) - { - mCurrentp->mNextp->mPrevp = mCurrentp->mPrevp; - } - else // we are at end of list - { - mTail.mPrevp = mCurrentp->mPrevp; - } - - // if there is a previous one, fix it - if (mCurrentp->mPrevp) - { - mCurrentp->mPrevp->mNextp = mCurrentp->mNextp; - } - else // we are at beginning of list - { - mHead.mNextp = mCurrentp->mNextp; - } - - // remove the node - mCurrentp->deleteData(); - delete mCurrentp; - mCount--; - break; - } - mCurrentp = mCurrentp->mNextp; - } - - // reset the list back to where it was - if (mCurrentp == mQueuep) - { - mCurrentp = mQueuep = NULL; - } - else - { - mCurrentp = mQueuep; - } - - return b_found; -} - - -// remove all nodes from the list and delete the associated data -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::deleteAllData() -{ - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - mQueuep = mCurrentp->mNextp; - mCurrentp->deleteData(); - delete mCurrentp; - mCurrentp = mQueuep; - } - - // reset mHead and mQueuep - mHead.mNextp = NULL; - mTail.mPrevp = NULL; - mCurrentp = mHead.mNextp; - mQueuep = mHead.mNextp; - mStateStackDepth = 0; - mCount = 0; -} - - -// remove all nodes from the list but do not delete associated data -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::removeAllNodes() -{ - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - mQueuep = mCurrentp->mNextp; - mCurrentp->removeData(); - delete mCurrentp; - mCurrentp = mQueuep; - } - - // reset mHead and mCurrentp - mHead.mNextp = NULL; - mTail.mPrevp = NULL; - mCurrentp = mHead.mNextp; - mQueuep = mHead.mNextp; - mStateStackDepth = 0; - mCount = 0; -} - -template <class DATA_TYPE> -S32 LLDoubleLinkedList<DATA_TYPE>::getLength() const -{ -// U32 length = 0; -// for (LLDoubleLinkedNode<DATA_TYPE>* temp = mHead.mNextp; temp != NULL; temp = temp->mNextp) -// { -// length++; -// } - return mCount; -} - -// check to see if data is in list -// set mCurrentp and mQueuep to the target of search if found, otherwise set mCurrentp to mQueuep -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLDoubleLinkedList<DATA_TYPE>::checkData(const DATA_TYPE *data) -{ - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - if (mCurrentp->mDatap == data) - { - mQueuep = mCurrentp; - return TRUE; - } - mCurrentp = mCurrentp->mNextp; - } - - mCurrentp = mQueuep; - return FALSE; -} - -// NOTE: This next two funtions are only included here -// for those too familiar with the LLLinkedList template class. -// They are depreciated. resetList() is unecessary while -// getCurrentData() is identical to getNextData() and has -// a misleading name. -// -// The recommended way to loop through a list is as follows: -// -// datap = list.getFirstData(); -// while (datap) -// { -// /* do stuff */ -// datap = list.getNextData(); -// } - - // place mCurrentp and mQueuep on first node - template <class DATA_TYPE> - void LLDoubleLinkedList<DATA_TYPE>::resetList() - { - mCurrentp = mHead.mNextp; - mQueuep = mHead.mNextp; - mStateStackDepth = 0; - } - - - // return the data currently pointed to, - // set mCurrentp to that node and bump mQueuep down the list - template <class DATA_TYPE> - DATA_TYPE* LLDoubleLinkedList<DATA_TYPE>::getCurrentData() - { - if (mQueuep) - { - mCurrentp = mQueuep; - mQueuep = mQueuep->mNextp; - return mCurrentp->mDatap; - } - else - { - return NULL; - } - } - - -// reset the list and return the data currently pointed to, -// set mCurrentp to that node and bump mQueuep down the list -template <class DATA_TYPE> -DATA_TYPE* LLDoubleLinkedList<DATA_TYPE>::getFirstData() -{ - mQueuep = mHead.mNextp; - mCurrentp = mQueuep; - if (mQueuep) - { - mQueuep = mQueuep->mNextp; - return mCurrentp->mDatap; - } - else - { - return NULL; - } -} - - -// reset the list and return the data at position n, set mCurentp -// to that node and bump mQueuep down the list -// Note: n=0 will behave like getFirstData() -template <class DATA_TYPE> -DATA_TYPE* LLDoubleLinkedList<DATA_TYPE>::getNthData(U32 n) -{ - mCurrentp = mHead.mNextp; - - if (mCurrentp) - { - for (U32 i=0; i<n; i++) - { - mCurrentp = mCurrentp->mNextp; - if (!mCurrentp) - { - break; - } - } - } - - if (mCurrentp) - { - // bump mQueuep down the list - mQueuep = mCurrentp->mNextp; - return mCurrentp->mDatap; - } - else - { - mQueuep = NULL; - return NULL; - } -} - - -// reset the list and return the last data in it, -// set mCurrentp to that node and bump mQueuep up the list -template <class DATA_TYPE> -DATA_TYPE* LLDoubleLinkedList<DATA_TYPE>::getLastData() -{ - mQueuep = mTail.mPrevp; - mCurrentp = mQueuep; - if (mQueuep) - { - mQueuep = mQueuep->mPrevp; - return mCurrentp->mDatap; - } - else - { - return NULL; - } -} - - -// return the data in mQueuep, -// set mCurrentp to mQueuep and bump mQueuep down the list -template <class DATA_TYPE> -DATA_TYPE* LLDoubleLinkedList<DATA_TYPE>::getNextData() -{ - if (mQueuep) - { - mCurrentp = mQueuep; - mQueuep = mQueuep->mNextp; - return mCurrentp->mDatap; - } - else - { - return NULL; - } -} - - -// return the data in mQueuep, -// set mCurrentp to mQueuep and bump mQueuep up the list -template <class DATA_TYPE> -DATA_TYPE* LLDoubleLinkedList<DATA_TYPE>::getPreviousData() -{ - if (mQueuep) - { - mCurrentp = mQueuep; - mQueuep = mQueuep->mPrevp; - return mCurrentp->mDatap; - } - else - { - return NULL; - } -} - - -// remove the Node at mCurrentp -// set mCurrentp to mQueuep, or NULL if (mCurrentp == mQueuep) -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::removeCurrentData() -{ - if (mCurrentp) - { - // if there is a next one, fix it - if (mCurrentp->mNextp) - { - mCurrentp->mNextp->mPrevp = mCurrentp->mPrevp; - } - else // otherwise we are at end of list - { - mTail.mPrevp = mCurrentp->mPrevp; - } - - // if there is a previous one, fix it - if (mCurrentp->mPrevp) - { - mCurrentp->mPrevp->mNextp = mCurrentp->mNextp; - } - else // otherwise we are at beginning of list - { - mHead.mNextp = mCurrentp->mNextp; - } - - // remove the node - mCurrentp->removeData(); - delete mCurrentp; - mCount--; - - // check for redundant pointing - if (mCurrentp == mQueuep) - { - mCurrentp = mQueuep = NULL; - } - else - { - mCurrentp = mQueuep; - } - } -} - - -// delete the Node at mCurrentp -// set mCurrentp to mQueuep, or NULL if (mCurrentp == mQueuep) -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::deleteCurrentData() -{ - if (mCurrentp) - { - // remove the node - // if there is a next one, fix it - if (mCurrentp->mNextp) - { - mCurrentp->mNextp->mPrevp = mCurrentp->mPrevp; - } - else // otherwise we are at end of list - { - mTail.mPrevp = mCurrentp->mPrevp; - } - - // if there is a previous one, fix it - if (mCurrentp->mPrevp) - { - mCurrentp->mPrevp->mNextp = mCurrentp->mNextp; - } - else // otherwise we are at beginning of list - { - mHead.mNextp = mCurrentp->mNextp; - } - - // remove the LLDoubleLinkedNode - mCurrentp->deleteData(); - delete mCurrentp; - mCount--; - - // check for redundant pointing - if (mCurrentp == mQueuep) - { - mCurrentp = mQueuep = NULL; - } - else - { - mCurrentp = mQueuep; - } - } -} - - -// remove the Node at mCurrentp and insert it into newlist -// set mCurrentp to mQueuep, or NULL if (mCurrentp == mQueuep) -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::moveCurrentData(LLDoubleLinkedList<DATA_TYPE> *newlist) -{ - if (mCurrentp) - { - // remove the node - // if there is a next one, fix it - if (mCurrentp->mNextp) - { - mCurrentp->mNextp->mPrevp = mCurrentp->mPrevp; - } - else // otherwise we are at end of list - { - mTail.mPrevp = mCurrentp->mPrevp; - } - - // if there is a previous one, fix it - if (mCurrentp->mPrevp) - { - mCurrentp->mPrevp->mNextp = mCurrentp->mNextp; - } - else // otherwise we are at beginning of list - { - mHead.mNextp = mCurrentp->mNextp; - } - - // move the node to the new list - newlist->addNode(mCurrentp); - - // check for redundant pointing - if (mCurrentp == mQueuep) - { - mCurrentp = mQueuep = NULL; - } - else - { - mCurrentp = mQueuep; - } - } -} - - -// Inserts the node previous to mCurrentp -// set mCurrentp to mQueuep -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::insertNode(LLDoubleLinkedNode<DATA_TYPE> *nodep) -{ - // don't allow pointer to NULL to be passed - if (!nodep) - { - llerror("NULL pointer passed to LLDoubleLinkedList::insertNode()", 0); - } - if (!nodep->mDatap) - { - llerror("NULL data pointer passed to LLDoubleLinkedList::insertNode()", 0); - } - - if (mCurrentp) - { - if (mCurrentp->mPrevp) - { - nodep->mPrevp = mCurrentp->mPrevp; - nodep->mNextp = mCurrentp; - mCurrentp->mPrevp->mNextp = nodep; - mCurrentp->mPrevp = nodep; - } - else // at beginning of list - { - nodep->mPrevp = NULL; - nodep->mNextp = mCurrentp; - mHead.mNextp = nodep; - mCurrentp->mPrevp = nodep; - } - mCurrentp = mQueuep; - } - else // add to front of list - { - addNode(nodep); - } -} - - -// insert the data in front of mCurrentp -// set mCurrentp to mQueuep -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::insertData(DATA_TYPE *data) -{ - if (!data) - { - llerror("NULL data pointer passed to LLDoubleLinkedList::insertNode()", 0); - } - LLDoubleLinkedNode<DATA_TYPE> *node = new LLDoubleLinkedNode<DATA_TYPE>(data); - insertNode(node); - mCount++; -} - - -// if mCurrentp has a previous node then : -// * swaps mCurrentp with its previous -// * set mCurrentp to mQueuep -// otherwise does nothing -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::swapCurrentWithPrevious() -{ - if (mCurrentp) - { - if (mCurrentp->mPrevp) - { - // Pull mCurrentp out of list - mCurrentp->mPrevp->mNextp = mCurrentp->mNextp; - if (mCurrentp->mNextp) - { - mCurrentp->mNextp->mPrevp = mCurrentp->mPrevp; - } - else // mCurrentp was at end of list - { - mTail.mPrevp = mCurrentp->mPrevp; - } - - // Fix mCurrentp's pointers - mCurrentp->mNextp = mCurrentp->mPrevp; - mCurrentp->mPrevp = mCurrentp->mNextp->mPrevp; - mCurrentp->mNextp->mPrevp = mCurrentp; - - if (mCurrentp->mPrevp) - { - // Fix the backward pointer of mCurrentp's new previous - mCurrentp->mPrevp->mNextp = mCurrentp; - } - else // mCurrentp is now at beginning of list - { - mHead.mNextp = mCurrentp; - } - - // Set the list back to the way it was - mCurrentp = mQueuep; - } - } -} - - -// if mCurrentp has a next node then : -// * swaps mCurrentp with its next -// * set mCurrentp to mQueuep -// otherwise does nothing -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::swapCurrentWithNext() -{ - if (mCurrentp) - { - if (mCurrentp->mNextp) - { - // Pull mCurrentp out of list - mCurrentp->mNextp->mPrevp = mCurrentp->mPrevp; - if (mCurrentp->mPrevp) - { - mCurrentp->mPrevp->mNextp = mCurrentp->mNextp; - } - else // mCurrentp was at beginning of list - { - mHead.mNextp = mCurrentp->mNextp; - } - - // Fix mCurrentp's pointers - mCurrentp->mPrevp = mCurrentp->mNextp; - mCurrentp->mNextp = mCurrentp->mPrevp->mNextp; - mCurrentp->mPrevp->mNextp = mCurrentp; - - if (mCurrentp->mNextp) - { - // Fix the back pointer of mCurrentp's new next - mCurrentp->mNextp->mPrevp = mCurrentp; - } - else // mCurrentp is now at end of list - { - mTail.mPrevp = mCurrentp; - } - - // Set the list back to the way it was - mCurrentp = mQueuep; - } - } -} - -// move mCurrentp to the front of the list -// set mCurrentp to mQueuep -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::moveCurrentToFront() -{ - if (mCurrentp) - { - // if there is a previous one, fix it - if (mCurrentp->mPrevp) - { - mCurrentp->mPrevp->mNextp = mCurrentp->mNextp; - } - else // otherwise we are at beginning of list - { - // check for redundant pointing - if (mCurrentp == mQueuep) - { - mCurrentp = mQueuep = NULL; - } - else - { - mCurrentp = mQueuep; - } - return; - } - - // if there is a next one, fix it - if (mCurrentp->mNextp) - { - mCurrentp->mNextp->mPrevp = mCurrentp->mPrevp; - } - else // otherwise we are at end of list - { - mTail.mPrevp = mCurrentp->mPrevp; - } - - // add mCurrentp to beginning of list - mCurrentp->mNextp = mHead.mNextp; - mHead.mNextp->mPrevp = mCurrentp; // mHead.mNextp MUST be valid, - // or the list had only one node - // and we would have returned already - mCurrentp->mPrevp = NULL; - mHead.mNextp = mCurrentp; - - // check for redundant pointing - if (mCurrentp == mQueuep) - { - mCurrentp = mQueuep = NULL; - } - else - { - mCurrentp = mQueuep; - } - } - -} - -// move mCurrentp to the end of the list -// set mCurrentp to mQueuep -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::moveCurrentToEnd() -{ - if (mCurrentp) - { - // if there is a next one, fix it - if (mCurrentp->mNextp) - { - mCurrentp->mNextp->mPrevp = mCurrentp->mPrevp; - } - else // otherwise we are at end of list and we're done - { - // check for redundant pointing - if (mCurrentp == mQueuep) - { - mCurrentp = mQueuep = NULL; - } - else - { - mCurrentp = mQueuep; - } - return; - } - - // if there is a previous one, fix it - if (mCurrentp->mPrevp) - { - mCurrentp->mPrevp->mNextp = mCurrentp->mNextp; - } - else // otherwise we are at beginning of list - { - mHead.mNextp = mCurrentp->mNextp; - } - - // add mCurrentp to end of list - mCurrentp->mPrevp = mTail.mPrevp; - mTail.mPrevp->mNextp = mCurrentp; // mTail.mPrevp MUST be valid, - // or the list had only one node - // and we would have returned already - mCurrentp->mNextp = NULL; - mTail.mPrevp = mCurrentp; - - // check for redundant pointing - if (mCurrentp == mQueuep) - { - mCurrentp = mQueuep = NULL; - } - else - { - mCurrentp = mQueuep; - } - } -} - - -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::setInsertBefore(BOOL (*insert_before)(DATA_TYPE *first, DATA_TYPE *second) ) -{ - mInsertBefore = insert_before; -} - - -// add data in front of the first node for which mInsertBefore(datap, node->mDatap) returns TRUE -// set mCurrentp to mQueuep -template <class DATA_TYPE> -BOOL LLDoubleLinkedList<DATA_TYPE>::addDataSorted(DATA_TYPE *datap) -{ - // don't allow NULL to be passed to addData() - if (!datap) - { - llerror("NULL pointer passed to LLDoubleLinkedList::addDataSorted()", 0); - } - - // has mInsertBefore not been set? - if (!mInsertBefore) - { - addData(datap); - return FALSE; - } - - // is the list empty? - if (!mHead.mNextp) - { - addData(datap); - return TRUE; - } - - // Note: this step has been added so that the behavior of LLDoubleLinkedList - // is as rigorous as the LLLinkedList class about adding duplicate nodes. - // Duplicate nodes can cause a problem when sorting if mInsertBefore(foo, foo) - // returns TRUE. However, if mInsertBefore(foo, foo) returns FALSE, then there - // shouldn't be any reason to exclude duplicate nodes (as we do here). - if (checkData(datap)) - { - return FALSE; - } - - mCurrentp = mHead.mNextp; - while (mCurrentp) - { - // check to see if datap is already in the list - if (datap == mCurrentp->mDatap) - { - return FALSE; - } - else if (mInsertBefore(datap, mCurrentp->mDatap)) - { - insertData(datap); - return TRUE; - } - mCurrentp = mCurrentp->mNextp; - } - - addDataAtEnd(datap); - return TRUE; -} - - -// bubble-sort until sorted and return TRUE if anything was sorted -// leaves mQueuep pointing at last node that was swapped with its mNextp -// -// NOTE: if you find this function looping for really long times, then you -// probably need to check your implementation of mInsertBefore(a,b) and make -// sure it does not return TRUE when (a == b)! -template <class DATA_TYPE> -BOOL LLDoubleLinkedList<DATA_TYPE>::bubbleSort() -{ - BOOL b_swapped = FALSE; - U32 count = 0; - while (lazyBubbleSort()) - { - b_swapped = TRUE; - if (count++ > 0x7FFFFFFF) - { - llwarning("LLDoubleLinkedList::bubbleSort() : too many passes...", 1); - llwarning(" make sure the mInsertBefore(a, b) does not return TRUE for a == b", 1); - break; - } - } - return b_swapped; -} - - -// do a single bubble-sort pass and return TRUE if anything was sorted -// leaves mQueuep pointing at last node that was swapped with its mNextp -template <class DATA_TYPE> -BOOL LLDoubleLinkedList<DATA_TYPE>::lazyBubbleSort() -{ - // has mInsertBefore been set? - if (!mInsertBefore) - { - return FALSE; - } - - // is list empty? - mCurrentp = mHead.mNextp; - if (!mCurrentp) - { - return FALSE; - } - - BOOL b_swapped = FALSE; - - // the sort will exit after 0x7FFFFFFF nodes or the end of the list, whichever is first - S32 length = 0x7FFFFFFF; - S32 count = 0; - - while (mCurrentp && mCurrentp->mNextp && count<length) - { - if (mInsertBefore(mCurrentp->mNextp->mDatap, mCurrentp->mDatap)) - { - b_swapped = TRUE; - mQueuep = mCurrentp; - swapCurrentWithNext(); // sets mCurrentp to mQueuep - } - count++; - mCurrentp = mCurrentp->mNextp; - } - - return b_swapped; -} - - -template <class DATA_TYPE> -BOOL LLDoubleLinkedList<DATA_TYPE>::pushState() -{ - if (mStateStackDepth < LLDOUBLE_LINKED_LIST_STATE_STACK_DEPTH) - { - *(mQueuepStack + mStateStackDepth) = mQueuep; - *(mCurrentpStack + mStateStackDepth) = mCurrentp; - mStateStackDepth++; - return TRUE; - } - return FALSE; -} - - -template <class DATA_TYPE> -BOOL LLDoubleLinkedList<DATA_TYPE>::popState() -{ - if (mStateStackDepth > 0) - { - mStateStackDepth--; - mQueuep = *(mQueuepStack + mStateStackDepth); - mCurrentp = *(mCurrentpStack + mStateStackDepth); - return TRUE; - } - return FALSE; -} - - -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::clearStateStack() -{ - mStateStackDepth = 0; -} - -////////////////////////////////////////////////////////////////////////////////////////// -// private members -////////////////////////////////////////////////////////////////////////////////////////// - -// add node to beginning of list -// set mCurrentp to mQueuep -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::addNode(LLDoubleLinkedNode<DATA_TYPE> *nodep) -{ - // add the node to the front of the list - nodep->mPrevp = NULL; - nodep->mNextp = mHead.mNextp; - mHead.mNextp = nodep; - - // if there's something in the list, fix its back pointer - if (nodep->mNextp) - { - nodep->mNextp->mPrevp = nodep; - } - else // otherwise fix the tail node - { - mTail.mPrevp = nodep; - } - - mCurrentp = mQueuep; -} - - -// add node to end of list -// set mCurrentp to mQueuep -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::addNodeAtEnd(LLDoubleLinkedNode<DATA_TYPE> *node) -{ - // add the node to the end of the list - node->mNextp = NULL; - node->mPrevp = mTail.mPrevp; - mTail.mPrevp = node; - - // if there's something in the list, fix its back pointer - if (node->mPrevp) - { - node->mPrevp->mNextp = node; - } - else // otherwise fix the head node - { - mHead.mNextp = node; - } - - mCurrentp = mQueuep; -} - - -// randomly move nodes in the list for DEBUG (or Discordian) purposes -// sets mCurrentp and mQueuep to top of list -template <class DATA_TYPE> -void LLDoubleLinkedList<DATA_TYPE>::scramble() -{ - S32 random_number; - DATA_TYPE *datap = getFirstData(); - while(datap) - { - random_number = ll_rand(5); - - if (0 == random_number) - { - removeCurrentData(); - addData(datap); - } - else if (1 == random_number) - { - removeCurrentData(); - addDataAtEnd(datap); - } - else if (2 == random_number) - { - swapCurrentWithPrevious(); - } - else if (3 == random_number) - { - swapCurrentWithNext(); - } - datap = getNextData(); - } - mQueuep = mHead.mNextp; - mCurrentp = mQueuep; -} - -template <class DATA_TYPE> -BOOL LLDoubleLinkedList<DATA_TYPE>::isEmpty() -{ - return (mCount == 0); -} - - -#endif diff --git a/indra/llcommon/imageids.cpp b/indra/llcommon/imageids.cpp deleted file mode 100755 index 7d647e5c364f4dae5a76bc817c50e2f1c48d699c..0000000000000000000000000000000000000000 --- a/indra/llcommon/imageids.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @file imageids.cpp - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "imageids.h" - -#include "lluuid.h" - -// -// USE OF THIS FILE IS DEPRECATED -// -// Please use viewerart.ini and the standard -// art import path. // indicates if file is only - // on dataserver, or also - // pre-cached on viewer - -// Grass Images -const LLUUID IMG_SMOKE ("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d"); // VIEWER - -const LLUUID IMG_DEFAULT ("d2114404-dd59-4a4d-8e6c-49359e91bbf0"); // VIEWER - -const LLUUID IMG_SUN ("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver -const LLUUID IMG_MOON ("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver -const LLUUID IMG_CLOUD_POOF ("fc4b9f0b-d008-45c6-96a4-01dd947ac621"); // dataserver -const LLUUID IMG_SHOT ("35f217a3-f618-49cf-bbca-c86d486551a9"); // dataserver -const LLUUID IMG_SPARK ("d2e75ac1-d0fb-4532-820e-a20034ac814d"); // dataserver -const LLUUID IMG_FIRE ("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver -const LLUUID IMG_FACE_SELECT ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector -const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver -const LLUUID IMG_INVISIBLE ("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver - -const LLUUID IMG_EXPLOSION ("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver -const LLUUID IMG_EXPLOSION_2 ("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver -const LLUUID IMG_EXPLOSION_3 ("fedea30a-1be8-47a6-bc06-337a04a39c4b"); // On dataserver -const LLUUID IMG_EXPLOSION_4 ("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); // On dataserver -const LLUUID IMG_SMOKE_POOF ("1e63e323-5fe0-452e-92f8-b98bd0f764e3"); // On dataserver - -const LLUUID IMG_BIG_EXPLOSION_1 ("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); // On dataserver -const LLUUID IMG_BIG_EXPLOSION_2 ("9c8eca51-53d5-42a7-bb58-cef070395db8"); // On dataserver - -const LLUUID IMG_BLOOM1 ("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); // VIEWER -const LLUUID TERRAIN_DIRT_DETAIL ("0bc58228-74a0-7e83-89bc-5c23464bcec5"); // VIEWER -const LLUUID TERRAIN_GRASS_DETAIL ("63338ede-0037-c4fd-855b-015d77112fc8"); // VIEWER -const LLUUID TERRAIN_MOUNTAIN_DETAIL ("303cd381-8560-7579-23f1-f0a880799740"); // VIEWER -const LLUUID TERRAIN_ROCK_DETAIL ("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // VIEWER - -const LLUUID DEFAULT_WATER_NORMAL ("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER - -const LLUUID IMG_CHECKERBOARD_RGBA ("2585a0f3-4163-6dd1-0f34-ad48cb909e25"); // dataserver - diff --git a/indra/llcommon/imageids.h b/indra/llcommon/imageids.h deleted file mode 100755 index 18c8ecb0743765b06857558504cdd1bb16722376..0000000000000000000000000000000000000000 --- a/indra/llcommon/imageids.h +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @file imageids.h - * @brief Temporary holder for image IDs - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_IMAGEIDS_H -#define LL_IMAGEIDS_H - -// -// USE OF THIS FILE IS DEPRECATED -// -// Please use viewerart.ini and the standard -// art import path. - -class LLUUID; - -LL_COMMON_API extern const LLUUID IMG_SMOKE; - -LL_COMMON_API extern const LLUUID IMG_DEFAULT; - -LL_COMMON_API extern const LLUUID IMG_SUN; -LL_COMMON_API extern const LLUUID IMG_MOON; -LL_COMMON_API extern const LLUUID IMG_CLOUD_POOF; -LL_COMMON_API extern const LLUUID IMG_SHOT; -LL_COMMON_API extern const LLUUID IMG_SPARK; -LL_COMMON_API extern const LLUUID IMG_FIRE; -LL_COMMON_API extern const LLUUID IMG_FACE_SELECT; -LL_COMMON_API extern const LLUUID IMG_DEFAULT_AVATAR; -LL_COMMON_API extern const LLUUID IMG_INVISIBLE; - -LL_COMMON_API extern const LLUUID IMG_EXPLOSION; -LL_COMMON_API extern const LLUUID IMG_EXPLOSION_2; -LL_COMMON_API extern const LLUUID IMG_EXPLOSION_3; -LL_COMMON_API extern const LLUUID IMG_EXPLOSION_4; -LL_COMMON_API extern const LLUUID IMG_SMOKE_POOF; - -LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_1; -LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_2; - -LL_COMMON_API extern const LLUUID IMG_BLOOM1; -LL_COMMON_API extern const LLUUID TERRAIN_DIRT_DETAIL; -LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL; -LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL; -LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL; - -LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL; - -LL_COMMON_API extern const LLUUID IMG_CHECKERBOARD_RGBA; -#endif diff --git a/indra/llcommon/indra_constants.cpp b/indra/llcommon/indra_constants.cpp index d32ae6c04184bf42f365e36a32ee9f960ecd0ea2..f3989ee1d06ffd4e19733e0c087745f80a0cc154 100755 --- a/indra/llcommon/indra_constants.cpp +++ b/indra/llcommon/indra_constants.cpp @@ -35,6 +35,35 @@ const LLUUID LL_UUID_ALL_AGENTS("44e87126-e794-4ded-05b3-7c42da3d5cdb"); // Governor Linden's agent id. const LLUUID ALEXANDRIA_LINDEN_ID("ba2a564a-f0f1-4b82-9c61-b7520bfcd09f"); const LLUUID GOVERNOR_LINDEN_ID("3d6181b0-6a4b-97ef-18d8-722652995cf1"); -const LLUUID REALESTATE_LINDEN_ID("3d6181b0-6a4b-97ef-18d8-722652995cf1"); // Maintenance's group id. const LLUUID MAINTENANCE_GROUP_ID("dc7b21cd-3c89-fcaa-31c8-25f9ffd224cd"); +// Grass Images +const LLUUID IMG_SMOKE ("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d"); // VIEWER + +const LLUUID IMG_DEFAULT ("d2114404-dd59-4a4d-8e6c-49359e91bbf0"); // VIEWER + +const LLUUID IMG_SUN ("cce0f112-878f-4586-a2e2-a8f104bba271"); // dataserver +const LLUUID IMG_MOON ("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver +const LLUUID IMG_SHOT ("35f217a3-f618-49cf-bbca-c86d486551a9"); // dataserver +const LLUUID IMG_SPARK ("d2e75ac1-d0fb-4532-820e-a20034ac814d"); // dataserver +const LLUUID IMG_FIRE ("aca40aa8-44cf-44ca-a0fa-93e1a2986f82"); // dataserver +const LLUUID IMG_FACE_SELECT ("a85ac674-cb75-4af6-9499-df7c5aaf7a28"); // face selector +const LLUUID IMG_DEFAULT_AVATAR ("c228d1cf-4b5d-4ba8-84f4-899a0796aa97"); // dataserver +const LLUUID IMG_INVISIBLE ("3a367d1c-bef1-6d43-7595-e88c1e3aadb3"); // dataserver + +const LLUUID IMG_EXPLOSION ("68edcf47-ccd7-45b8-9f90-1649d7f12806"); // On dataserver +const LLUUID IMG_EXPLOSION_2 ("21ce046c-83fe-430a-b629-c7660ac78d7c"); // On dataserver +const LLUUID IMG_EXPLOSION_3 ("fedea30a-1be8-47a6-bc06-337a04a39c4b"); // On dataserver +const LLUUID IMG_EXPLOSION_4 ("abf0d56b-82e5-47a2-a8ad-74741bb2c29e"); // On dataserver +const LLUUID IMG_SMOKE_POOF ("1e63e323-5fe0-452e-92f8-b98bd0f764e3"); // On dataserver + +const LLUUID IMG_BIG_EXPLOSION_1 ("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); // On dataserver +const LLUUID IMG_BIG_EXPLOSION_2 ("9c8eca51-53d5-42a7-bb58-cef070395db8"); // On dataserver + +const LLUUID IMG_BLOOM1 ("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); // VIEWER +const LLUUID TERRAIN_DIRT_DETAIL ("0bc58228-74a0-7e83-89bc-5c23464bcec5"); // VIEWER +const LLUUID TERRAIN_GRASS_DETAIL ("63338ede-0037-c4fd-855b-015d77112fc8"); // VIEWER +const LLUUID TERRAIN_MOUNTAIN_DETAIL ("303cd381-8560-7579-23f1-f0a880799740"); // VIEWER +const LLUUID TERRAIN_ROCK_DETAIL ("53a2f406-4895-1d13-d541-d2e3b86bc19c"); // VIEWER + +const LLUUID DEFAULT_WATER_NORMAL ("822ded49-9a6c-f61c-cb89-6df54f42cdf4"); // VIEWER diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 0da83720bd57d8f3bd15c75a066aab291a70e223..02f063f5e843cf2105440983e85e05d6f7e2ec98 100755 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -31,122 +31,28 @@ class LLUUID; -// At 45 Hz collisions seem stable and objects seem -// to settle down at a reasonable rate. -// JC 3/18/2003 - -// const F32 PHYSICS_TIMESTEP = 1.f / 45.f; -// This must be a #define due to anal retentive restrictions on const expressions -// CG 2008-06-05 -#define PHYSICS_TIMESTEP (1.f / 45.f) - -const F32 COLLISION_TOLERANCE = 0.1f; -const F32 HALF_COLLISION_TOLERANCE = 0.05f; - -// Time constants -const U32 HOURS_PER_LINDEN_DAY = 4; -const U32 DAYS_PER_LINDEN_YEAR = 11; - -const U32 SEC_PER_LINDEN_DAY = HOURS_PER_LINDEN_DAY * 60 * 60; -const U32 SEC_PER_LINDEN_YEAR = DAYS_PER_LINDEN_YEAR * SEC_PER_LINDEN_DAY; - static const F32 REGION_WIDTH_METERS = 256.f; static const S32 REGION_WIDTH_UNITS = 256; static const U32 REGION_WIDTH_U32 = 256; const F32 REGION_HEIGHT_METERS = 4096.f; -// Bits for simulator performance query flags -enum LAND_STAT_FLAGS -{ - STAT_FILTER_BY_PARCEL = 0x00000001, - STAT_FILTER_BY_OWNER = 0x00000002, - STAT_FILTER_BY_OBJECT = 0x00000004, - STAT_FILTER_BY_PARCEL_NAME = 0x00000008, - STAT_REQUEST_LAST_ENTRY = 0x80000000, -}; - -enum LAND_STAT_REPORT_TYPE -{ - STAT_REPORT_TOP_SCRIPTS = 0, - STAT_REPORT_TOP_COLLIDERS -}; - -const U32 STAT_FILTER_MASK = 0x1FFFFFFF; - -// Region absolute limits -static const S32 REGION_AGENT_COUNT_MIN = 1; -static const S32 REGION_AGENT_COUNT_MAX = 200; // Must fit in U8 for the moment (RegionInfo msg) -static const S32 REGION_PRIM_COUNT_MIN = 0; -static const S32 REGION_PRIM_COUNT_MAX = 40000; -static const F32 REGION_PRIM_BONUS_MIN = 1.0; -static const F32 REGION_PRIM_BONUS_MAX = 10.0; - -// Default maximum number of tasks/prims per region. -const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; - -const F32 MIN_AGENT_DEPTH = 0.30f; const F32 DEFAULT_AGENT_DEPTH = 0.45f; -const F32 MAX_AGENT_DEPTH = 0.60f; - -const F32 MIN_AGENT_WIDTH = 0.40f; const F32 DEFAULT_AGENT_WIDTH = 0.60f; -const F32 MAX_AGENT_WIDTH = 0.80f; - -const F32 MIN_AGENT_HEIGHT = 1.1f; const F32 DEFAULT_AGENT_HEIGHT = 1.9f; -const F32 MAX_AGENT_HEIGHT = 2.45f; - -// For linked sets -const S32 MAX_CHILDREN_PER_TASK = 255; -const S32 MAX_CHILDREN_PER_PHYSICAL_TASK = 32; - -const S32 MAX_JOINTS_PER_OBJECT = 1; // limiting to 1 until Havok 2.x - -const char* const DEFAULT_DMZ_SPACE_SERVER = "192.168.0.140"; -const char* const DEFAULT_DMZ_USER_SERVER = "192.168.0.140"; -const char* const DEFAULT_DMZ_DATA_SERVER = "192.168.0.140"; -const char* const DEFAULT_DMZ_ASSET_SERVER = "http://asset.dmz.lindenlab.com:80"; - -const char* const DEFAULT_AGNI_SPACE_SERVER = "63.211.139.100"; -const char* const DEFAULT_AGNI_USER_SERVER = "63.211.139.100"; -const char* const DEFAULT_AGNI_DATA_SERVER = "63.211.139.100"; -const char* const DEFAULT_AGNI_ASSET_SERVER = "http://asset.agni.lindenlab.com:80"; - -// Information about what ports are for what services is in the wiki Name Space Ports page -// https://wiki.lindenlab.com/wiki/Name_Space_Ports -const char* const DEFAULT_LOCAL_ASSET_SERVER = "http://localhost:12041/asset/tmp"; -const char* const LOCAL_ASSET_URL_FORMAT = "http://%s:12041/asset"; - -const U32 DEFAULT_LAUNCHER_PORT = 12029; -//const U32 DEFAULT_BIGBOARD_PORT = 12030; // Deprecated -//const U32 DEFAULT_QUERYSIM_PORT = 12031; // Deprecated -const U32 DEFAULT_DATA_SERVER_PORT = 12032; -const U32 DEFAULT_SPACE_SERVER_PORT = 12033; -const U32 DEFAULT_VIEWER_PORT = 12034; -const U32 DEFAULT_SIMULATOR_PORT = 12035; -const U32 DEFAULT_USER_SERVER_PORT = 12036; -const U32 DEFAULT_RPC_SERVER_PORT = 12037; -const U32 DEFAULT_LOG_DATA_SERVER_PORT = 12039; -const U32 DEFAULT_BACKBONE_PORT = 12040; -const U32 DEFAULT_LOCAL_ASSET_PORT = 12041; -//const U32 DEFAULT_BACKBONE_CAP_PORT = 12042; // Deprecated -const U32 DEFAULT_CAP_PROXY_PORT = 12043; -const U32 DEFAULT_INV_DATA_SERVER_PORT = 12044; -const U32 DEFAULT_CGI_SERVICES_PORT = 12045; - -// Mapserver uses ports 12124 - 12139 to allow multiple mapservers to run -// on a single host for map tile generation. JC -const U32 DEFAULT_MAPSERVER_PORT = 12124; - -// For automatic port discovery when running multiple viewers on one host -const U32 PORT_DISCOVERY_RANGE_MIN = 13000; -const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50; - -const char LAND_LAYER_CODE = 'L'; -const char WATER_LAYER_CODE = 'W'; -const char WIND_LAYER_CODE = '7'; -const char CLOUD_LAYER_CODE = '8'; + +enum ETerrainBrushType +{ + // the valid brush numbers cannot be reordered, because they + // are used in the binary LSL format as arguments to llModifyLand() + E_LANDBRUSH_LEVEL = 0, + E_LANDBRUSH_RAISE = 1, + E_LANDBRUSH_LOWER = 2, + E_LANDBRUSH_SMOOTH = 3, + E_LANDBRUSH_NOISE = 4, + E_LANDBRUSH_REVERT = 5, + E_LANDBRUSH_INVALID = 6 +}; // keys // Bit masks for various keyboard modifier keys. @@ -265,89 +171,43 @@ LL_COMMON_API extern const LLUUID LL_UUID_ALL_AGENTS; LL_COMMON_API extern const LLUUID ALEXANDRIA_LINDEN_ID; LL_COMMON_API extern const LLUUID GOVERNOR_LINDEN_ID; -LL_COMMON_API extern const LLUUID REALESTATE_LINDEN_ID; // Maintenance's group id. LL_COMMON_API extern const LLUUID MAINTENANCE_GROUP_ID; -// Flags for kick message -const U32 KICK_FLAGS_DEFAULT = 0x0; -const U32 KICK_FLAGS_FREEZE = 1 << 0; -const U32 KICK_FLAGS_UNFREEZE = 1 << 1; - -const U8 UPD_NONE = 0x00; -const U8 UPD_POSITION = 0x01; -const U8 UPD_ROTATION = 0x02; -const U8 UPD_SCALE = 0x04; -const U8 UPD_LINKED_SETS = 0x08; -const U8 UPD_UNIFORM = 0x10; // used with UPD_SCALE - -// Agent Update Flags (U8) -const U8 AU_FLAGS_NONE = 0x00; -const U8 AU_FLAGS_HIDETITLE = 0x01; -const U8 AU_FLAGS_CLIENT_AUTOPILOT = 0x02; - -// start location constants -const U32 START_LOCATION_ID_LAST = 0; -const U32 START_LOCATION_ID_HOME = 1; -const U32 START_LOCATION_ID_DIRECT = 2; // for direct teleport -const U32 START_LOCATION_ID_PARCEL = 3; // for teleports to a parcel -const U32 START_LOCATION_ID_TELEHUB = 4; // for teleports to a spawnpoint -const U32 START_LOCATION_ID_URL = 5; -const U32 START_LOCATION_ID_COUNT = 6; - -// group constants -const U32 GROUP_MIN_SIZE = 2; - -// gMaxAgentGroups is now sent by login.cgi, which -// looks it up from globals.xml. -// -// For now we need an old default value however, -// so the viewer can be deployed ahead of login.cgi. -// -const S32 DEFAULT_MAX_AGENT_GROUPS = 25; +// image ids +LL_COMMON_API extern const LLUUID IMG_SMOKE; -// radius within which a chat message is fully audible -const F32 CHAT_WHISPER_RADIUS = 10.f; -const F32 CHAT_NORMAL_RADIUS = 20.f; -const F32 CHAT_SHOUT_RADIUS = 100.f; -const F32 CHAT_MAX_RADIUS = CHAT_SHOUT_RADIUS; -const F32 CHAT_MAX_RADIUS_BY_TWO = CHAT_MAX_RADIUS / 2.f; +LL_COMMON_API extern const LLUUID IMG_DEFAULT; -// squared editions of the above for distance checks -const F32 CHAT_WHISPER_RADIUS_SQUARED = CHAT_WHISPER_RADIUS * CHAT_WHISPER_RADIUS; -const F32 CHAT_NORMAL_RADIUS_SQUARED = CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS; -const F32 CHAT_SHOUT_RADIUS_SQUARED = CHAT_SHOUT_RADIUS * CHAT_SHOUT_RADIUS; -const F32 CHAT_MAX_RADIUS_SQUARED = CHAT_SHOUT_RADIUS_SQUARED; -const F32 CHAT_MAX_RADIUS_BY_TWO_SQUARED = CHAT_MAX_RADIUS_BY_TWO * CHAT_MAX_RADIUS_BY_TWO; +LL_COMMON_API extern const LLUUID IMG_SUN; +LL_COMMON_API extern const LLUUID IMG_MOON; +LL_COMMON_API extern const LLUUID IMG_SHOT; +LL_COMMON_API extern const LLUUID IMG_SPARK; +LL_COMMON_API extern const LLUUID IMG_FIRE; +LL_COMMON_API extern const LLUUID IMG_FACE_SELECT; +LL_COMMON_API extern const LLUUID IMG_DEFAULT_AVATAR; +LL_COMMON_API extern const LLUUID IMG_INVISIBLE; +LL_COMMON_API extern const LLUUID IMG_EXPLOSION; +LL_COMMON_API extern const LLUUID IMG_EXPLOSION_2; +LL_COMMON_API extern const LLUUID IMG_EXPLOSION_3; +LL_COMMON_API extern const LLUUID IMG_EXPLOSION_4; +LL_COMMON_API extern const LLUUID IMG_SMOKE_POOF; -// this times above gives barely audible radius -const F32 CHAT_BARELY_AUDIBLE_FACTOR = 2.0f; +LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_1; +LL_COMMON_API extern const LLUUID IMG_BIG_EXPLOSION_2; -// distance in front of speaking agent the sphere is centered -const F32 CHAT_WHISPER_OFFSET = 5.f; -const F32 CHAT_NORMAL_OFFSET = 10.f; -const F32 CHAT_SHOUT_OFFSET = 50.f; +LL_COMMON_API extern const LLUUID IMG_BLOOM1; +LL_COMMON_API extern const LLUUID TERRAIN_DIRT_DETAIL; +LL_COMMON_API extern const LLUUID TERRAIN_GRASS_DETAIL; +LL_COMMON_API extern const LLUUID TERRAIN_MOUNTAIN_DETAIL; +LL_COMMON_API extern const LLUUID TERRAIN_ROCK_DETAIL; -// first clean starts at 3 AM -const S32 SANDBOX_FIRST_CLEAN_HOUR = 3; -// clean every <n> hours -const S32 SANDBOX_CLEAN_FREQ = 12; +LL_COMMON_API extern const LLUUID DEFAULT_WATER_NORMAL; -const F32 WIND_SCALE_HACK = 2.0f; // hack to make wind speeds more realistic -enum ETerrainBrushType -{ - // the valid brush numbers cannot be reordered, because they - // are used in the binary LSL format as arguments to llModifyLand() - E_LANDBRUSH_LEVEL = 0, - E_LANDBRUSH_RAISE = 1, - E_LANDBRUSH_LOWER = 2, - E_LANDBRUSH_SMOOTH = 3, - E_LANDBRUSH_NOISE = 4, - E_LANDBRUSH_REVERT = 5, - E_LANDBRUSH_INVALID = 6 -}; +// radius within which a chat message is fully audible +const F32 CHAT_NORMAL_RADIUS = 20.f; // media commands const U32 PARCEL_MEDIA_COMMAND_STOP = 0; @@ -365,51 +225,101 @@ const U32 PARCEL_MEDIA_COMMAND_SIZE = 11; const U32 PARCEL_MEDIA_COMMAND_DESC = 12; const U32 PARCEL_MEDIA_COMMAND_LOOP_SET = 13; -// map item types -const U32 MAP_ITEM_TELEHUB = 0x01; -const U32 MAP_ITEM_PG_EVENT = 0x02; -const U32 MAP_ITEM_MATURE_EVENT = 0x03; -//const U32 MAP_ITEM_POPULAR = 0x04; // No longer supported, 2009-03-02 KLW -//const U32 MAP_ITEM_AGENT_COUNT = 0x05; -const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06; -const U32 MAP_ITEM_LAND_FOR_SALE = 0x07; -const U32 MAP_ITEM_CLASSIFIED = 0x08; -const U32 MAP_ITEM_ADULT_EVENT = 0x09; -const U32 MAP_ITEM_LAND_FOR_SALE_ADULT = 0x0a; - -// Region map layer numbers -const S32 MAP_SIM_OBJECTS = 0; -const S32 MAP_SIM_TERRAIN = 1; -const S32 MAP_SIM_LAND_FOR_SALE = 2; // Transparent alpha overlay of land for sale -const S32 MAP_SIM_IMAGE_TYPES = 3; // Number of map layers -const S32 MAP_SIM_INFO_MASK = 0x00FFFFFF; // Agent access may be stuffed into upper byte -const S32 MAP_SIM_LAYER_MASK = 0x0000FFFF; // Layer info is in lower 16 bits -const S32 MAP_SIM_RETURN_NULL_SIMS = 0x00010000; -const S32 MAP_SIM_PRELUDE = 0x00020000; - -// Crash reporter behavior -const S32 CRASH_BEHAVIOR_ASK = 0; -const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1; -const S32 CRASH_BEHAVIOR_NEVER_SEND = 2; - -// Export/Import return values -const S32 EXPORT_SUCCESS = 0; -const S32 EXPORT_ERROR_PERMISSIONS = -1; -const S32 EXPORT_ERROR_UNKNOWN = -2; - -// This is how long the sim will try to teleport you before giving up. -const F32 TELEPORT_EXPIRY = 15.0f; -// Additional time (in seconds) to wait per attachment -const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f; - -// The maximum size of an object extra parameters binary (packed) block -#define MAX_OBJECT_PARAMS_SIZE 1024 - const S32 CHAT_CHANNEL_DEBUG = S32_MAX; -// PLEASE don't add constants here. Every dev will have to do -// a complete rebuild. Try to find another shared header file, -// like llregionflags.h, lllslconstants.h, llagentconstants.h, -// or create a new one. JC +// agent constants +const U32 CONTROL_AT_POS_INDEX = 0; +const U32 CONTROL_AT_NEG_INDEX = 1; +const U32 CONTROL_LEFT_POS_INDEX = 2; +const U32 CONTROL_LEFT_NEG_INDEX = 3; +const U32 CONTROL_UP_POS_INDEX = 4; +const U32 CONTROL_UP_NEG_INDEX = 5; +const U32 CONTROL_PITCH_POS_INDEX = 6; +const U32 CONTROL_PITCH_NEG_INDEX = 7; +const U32 CONTROL_YAW_POS_INDEX = 8; +const U32 CONTROL_YAW_NEG_INDEX = 9; +const U32 CONTROL_FAST_AT_INDEX = 10; +const U32 CONTROL_FAST_LEFT_INDEX = 11; +const U32 CONTROL_FAST_UP_INDEX = 12; +const U32 CONTROL_FLY_INDEX = 13; +const U32 CONTROL_STOP_INDEX = 14; +const U32 CONTROL_FINISH_ANIM_INDEX = 15; +const U32 CONTROL_STAND_UP_INDEX = 16; +const U32 CONTROL_SIT_ON_GROUND_INDEX = 17; +const U32 CONTROL_MOUSELOOK_INDEX = 18; +const U32 CONTROL_NUDGE_AT_POS_INDEX = 19; +const U32 CONTROL_NUDGE_AT_NEG_INDEX = 20; +const U32 CONTROL_NUDGE_LEFT_POS_INDEX = 21; +const U32 CONTROL_NUDGE_LEFT_NEG_INDEX = 22; +const U32 CONTROL_NUDGE_UP_POS_INDEX = 23; +const U32 CONTROL_NUDGE_UP_NEG_INDEX = 24; +const U32 CONTROL_TURN_LEFT_INDEX = 25; +const U32 CONTROL_TURN_RIGHT_INDEX = 26; +const U32 CONTROL_AWAY_INDEX = 27; +const U32 CONTROL_LBUTTON_DOWN_INDEX = 28; +const U32 CONTROL_LBUTTON_UP_INDEX = 29; +const U32 CONTROL_ML_LBUTTON_DOWN_INDEX = 30; +const U32 CONTROL_ML_LBUTTON_UP_INDEX = 31; +const U32 TOTAL_CONTROLS = 32; + +const U32 AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX; // 0x00000001 +const U32 AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX; // 0x00000002 +const U32 AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX; // 0x00000004 +const U32 AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX; // 0x00000008 +const U32 AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX; // 0x00000010 +const U32 AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX; // 0x00000020 +const U32 AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX; // 0x00000040 +const U32 AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX; // 0x00000080 +const U32 AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX; // 0x00000100 +const U32 AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX; // 0x00000200 + +const U32 AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX; // 0x00000400 +const U32 AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX; // 0x00000800 +const U32 AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX; // 0x00001000 + +const U32 AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX; // 0x00002000 +const U32 AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX; // 0x00004000 +const U32 AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX; // 0x00008000 +const U32 AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX; // 0x00010000 +const U32 AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX; // 0x00020000 +const U32 AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX; // 0x00040000 + +const U32 AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX; // 0x00080000 +const U32 AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX; // 0x00100000 +const U32 AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX; // 0x00200000 +const U32 AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX; // 0x00400000 +const U32 AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX; // 0x00800000 +const U32 AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX; // 0x01000000 +const U32 AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX; // 0x02000000 +const U32 AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX; // 0x04000000 + +const U32 AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX; // 0x08000000 + +const U32 AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX; // 0x10000000 +const U32 AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX; // 0x20000000 +const U32 AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX; // 0x40000000 +const U32 AGENT_CONTROL_ML_LBUTTON_UP = ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX; // 0x80000000 + +// move these up so that we can hide them in "State" for object updates +// (for now) +const U32 AGENT_ATTACH_OFFSET = 4; +const U32 AGENT_ATTACH_MASK = 0xf << AGENT_ATTACH_OFFSET; + +// RN: this method swaps the upper and lower nibbles to maintain backward +// compatibility with old objects that only used the upper nibble +#define ATTACHMENT_ID_FROM_STATE(state) ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4))) + +// DO NOT CHANGE THE SEQUENCE OF THIS LIST!! +const U8 CLICK_ACTION_NONE = 0; +const U8 CLICK_ACTION_TOUCH = 0; +const U8 CLICK_ACTION_SIT = 1; +const U8 CLICK_ACTION_BUY = 2; +const U8 CLICK_ACTION_PAY = 3; +const U8 CLICK_ACTION_OPEN = 4; +const U8 CLICK_ACTION_PLAY = 5; +const U8 CLICK_ACTION_OPEN_MEDIA = 6; +const U8 CLICK_ACTION_ZOOM = 7; +// DO NOT CHANGE THE SEQUENCE OF THIS LIST!! + #endif diff --git a/indra/llcommon/linked_lists.h b/indra/llcommon/linked_lists.h deleted file mode 100755 index 6b25295b7b51c6840f7b4c307ebbcad4231a5acc..0000000000000000000000000000000000000000 --- a/indra/llcommon/linked_lists.h +++ /dev/null @@ -1,937 +0,0 @@ -/** - * @file linked_lists.h - * @brief LLLinkedList class header amd implementation file. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LINKED_LISTS_H -#define LL_LINKED_LISTS_H - -/** - * Provides a standard doubly linked list for fun and profit - * Utilizes a neat trick off of Flipcode where the back pointer is a - * pointer to a pointer, allowing easier transfer of nodes between lists, &c - * And a template class, of course - */ - -#include "llerror.h" - - -template <class DATA_TYPE> class LLLinkedList -{ -public: - friend class LLLinkNode; - // External interface - - // basic constructor - LLLinkedList() : mHead(NULL), mCurrentp(NULL), mInsertBefore(NULL) - { - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - mCount = 0; - } - - // basic constructor - LLLinkedList(BOOL (*insert_before)(DATA_TYPE *data_new, DATA_TYPE *data_tested)) : mHead(NULL), mCurrentp(NULL), mInsertBefore(insert_before) - { - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - mCount = 0; - } - - // destructor destroys list and nodes, but not data in nodes - ~LLLinkedList() - { - removeAllNodes(); - } - - // set mInsertBefore - void setInsertBefore(BOOL (*insert_before)(DATA_TYPE *data_new, DATA_TYPE *data_tested)) - { - mInsertBefore = insert_before; - } - - // - // WARNING!!!!!!! - // addData and addDataSorted are NOT O(1) operations, but O(n) because they check - // for existence of the data in the linked list first. Why, I don't know - djs - // If you don't care about dupes, use addDataNoCheck - // - - // put data into a node and stick it at the front of the list - inline BOOL addData(DATA_TYPE *data); - - // put data into a node and sort into list by mInsertBefore() - // calls normal add if mInsertBefore isn't set - inline BOOL addDataSorted(DATA_TYPE *data); - - inline BOOL addDataNoCheck(DATA_TYPE *data); - - // bubbleSortList - // does an improved bubble sort of the list . . . works best with almost sorted data - // does nothing if mInsertBefore isn't set - // Nota Bene: Swaps are accomplished by swapping data pointers - inline void bubbleSortList(); - - // put data into a node and stick it at the end of the list - inline BOOL addDataAtEnd(DATA_TYPE *data); - - // returns number of items in the list - inline S32 getLength() const; - - inline BOOL isEmpty(); - - // search the list starting at mHead.mNextp and remove the link with mDatap == data - // leave mCurrentp and mCurrentOperatingp on the next entry - // return TRUE if found, FALSE if not found - inline BOOL removeData(DATA_TYPE *data); - - // search the list starting at mHead.mNextp and delete the link with mDatap == data - // leave mCurrentp and mCurrentOperatingp on the next entry - // return TRUE if found, FALSE if not found - inline BOOL deleteData(DATA_TYPE *data); - - // remove all nodes from the list and delete the associated data - inline void deleteAllData(); - - // remove all nodes from the list but do not delete data - inline void removeAllNodes(); - - // check to see if data is in list - // if TRUE then mCurrentp and mCurrentOperatingp point to data - inline BOOL checkData(DATA_TYPE *data); - - // place mCurrentp on first node - inline void resetList(); - - // return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - inline DATA_TYPE *getCurrentData(); - - // same as getCurrentData() but a more intuitive name for the operation - inline DATA_TYPE *getNextData(); - - // reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - inline DATA_TYPE *getFirstData(); - - // reset the list and return the data at position n, set mCurentOperatingp to that node and bump mCurrentp - // Note: n is zero-based - inline DATA_TYPE *getNthData( U32 n); - - // reset the list and return the last data in it, set mCurentOperatingp to that node and bump mCurrentp - inline DATA_TYPE *getLastData(); - - // remove the Node at mCurentOperatingp - // leave mCurrentp and mCurentOperatingp on the next entry - inline void removeCurrentData(); - - // remove the Node at mCurentOperatingp and add it to newlist - // leave mCurrentp and mCurentOperatingp on the next entry - void moveCurrentData(LLLinkedList *newlist, BOOL b_sort); - - BOOL moveData(DATA_TYPE *data, LLLinkedList *newlist, BOOL b_sort); - - // delete the Node at mCurentOperatingp - // leave mCurrentp anf mCurentOperatingp on the next entry - void deleteCurrentData(); - -private: - // node that actually contains the data - class LLLinkNode - { - public: - // assign the mDatap pointer - LLLinkNode(DATA_TYPE *data) : mDatap(data), mNextp(NULL), mPrevpp(NULL) - { - } - - // destructor does not, by default, destroy associated data - // however, the mDatap must be NULL to ensure that we aren't causing memory leaks - ~LLLinkNode() - { - if (mDatap) - { - llerror("Attempting to call LLLinkNode destructor with a non-null mDatap!", 1); - } - } - - // delete associated data and NULL out pointer - void deleteData() - { - delete mDatap; - mDatap = NULL; - } - - // NULL out pointer - void removeData() - { - mDatap = NULL; - } - - DATA_TYPE *mDatap; - LLLinkNode *mNextp; - LLLinkNode **mPrevpp; - }; - - // add a node at the front of the list - void addData(LLLinkNode *node) - { - // don't allow NULL to be passed to addData - if (!node) - { - llerror("NULL pointer passed to LLLinkedList::addData", 0); - } - - // add the node to the front of the list - node->mPrevpp = &mHead.mNextp; - node->mNextp = mHead.mNextp; - - // if there's something in the list, fix its back pointer - if (node->mNextp) - { - node->mNextp->mPrevpp = &node->mNextp; - } - - mHead.mNextp = node; - } - - LLLinkNode mHead; // fake head node. . . makes pointer operations faster and easier - LLLinkNode *mCurrentp; // mCurrentp is the Node that getCurrentData returns - LLLinkNode *mCurrentOperatingp; // this is the node that the various mumbleCurrentData functions act on - BOOL (*mInsertBefore)(DATA_TYPE *data_new, DATA_TYPE *data_tested); // user function set to allow sorted lists - U32 mCount; -}; - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::addData(DATA_TYPE *data) -{ - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::addData", 0); - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - if ( checkData(data)) - { - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return FALSE; - } - - // make the new node - LLLinkNode *temp = new LLLinkNode(data); - - // add the node to the front of the list - temp->mPrevpp = &mHead.mNextp; - temp->mNextp = mHead.mNextp; - - // if there's something in the list, fix its back pointer - if (temp->mNextp) - { - temp->mNextp->mPrevpp = &temp->mNextp; - } - - mHead.mNextp = temp; - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - mCount++; - return TRUE; -} - - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::addDataNoCheck(DATA_TYPE *data) -{ - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::addData", 0); - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - // make the new node - LLLinkNode *temp = new LLLinkNode(data); - - // add the node to the front of the list - temp->mPrevpp = &mHead.mNextp; - temp->mNextp = mHead.mNextp; - - // if there's something in the list, fix its back pointer - if (temp->mNextp) - { - temp->mNextp->mPrevpp = &temp->mNextp; - } - - mHead.mNextp = temp; - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - mCount++; - return TRUE; -} - - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::addDataSorted(DATA_TYPE *data) -{ - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::addDataSorted", 0); - } - - if (checkData(data)) - { - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return FALSE; - } - - // mInsertBefore not set? - if (!mInsertBefore) - { - addData(data); - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return FALSE; - } - - // empty list? - if (!mHead.mNextp) - { - addData(data); - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return TRUE; - } - - // make the new node - LLLinkNode *temp = new LLLinkNode(data); - - // walk the list until mInsertBefore returns true - mCurrentp = mHead.mNextp; - while (mCurrentp->mNextp) - { - if (mInsertBefore(data, mCurrentp->mDatap)) - { - // insert before the current one - temp->mPrevpp = mCurrentp->mPrevpp; - temp->mNextp = mCurrentp; - *(temp->mPrevpp) = temp; - mCurrentp->mPrevpp = &temp->mNextp; - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - mCount++; - return TRUE; - } - else - { - mCurrentp = mCurrentp->mNextp; - } - } - - // on the last element, add before? - if (mInsertBefore(data, mCurrentp->mDatap)) - { - // insert before the current one - temp->mPrevpp = mCurrentp->mPrevpp; - temp->mNextp = mCurrentp; - *(temp->mPrevpp) = temp; - mCurrentp->mPrevpp = &temp->mNextp; - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - } - else // insert after - { - temp->mPrevpp = &mCurrentp->mNextp; - temp->mNextp = NULL; - mCurrentp->mNextp = temp; - - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - } - mCount++; - return TRUE; -} - -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::bubbleSortList() -{ - // mInsertBefore not set - if (!mInsertBefore) - { - return; - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - BOOL b_swapped = FALSE; - DATA_TYPE *temp; - - // Nota Bene: This will break if more than 0x7FFFFFFF members in list! - S32 length = 0x7FFFFFFF; - S32 count = 0; - do - { - b_swapped = FALSE; - mCurrentp = mHead.mNextp; - count = 0; - while ( (count + 1 < length) - &&(mCurrentp)) - { - if (mCurrentp->mNextp) - { - if (!mInsertBefore(mCurrentp->mDatap, mCurrentp->mNextp->mDatap)) - { - // swap data pointers! - temp = mCurrentp->mDatap; - mCurrentp->mDatap = mCurrentp->mNextp->mDatap; - mCurrentp->mNextp->mDatap = temp; - b_swapped = TRUE; - } - } - else - { - break; - } - count++; - mCurrentp = mCurrentp->mNextp; - } - length = count; - } while (b_swapped); - - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; -} - - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::addDataAtEnd(DATA_TYPE *data) -{ - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::addData", 0); - } - - if (checkData(data)) - { - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return FALSE; - } - - // make the new node - LLLinkNode *temp = new LLLinkNode(data); - - // add the node to the end of the list - - // if empty, add to the front and be done with it - if (!mHead.mNextp) - { - temp->mPrevpp = &mHead.mNextp; - temp->mNextp = NULL; - mHead.mNextp = temp; - } - else - { - // otherwise, walk to the end of the list - mCurrentp = mHead.mNextp; - while (mCurrentp->mNextp) - { - mCurrentp = mCurrentp->mNextp; - } - temp->mPrevpp = &mCurrentp->mNextp; - temp->mNextp = NULL; - mCurrentp->mNextp = temp; - } - - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - mCount++; - return TRUE; -} - - -// returns number of items in the list -template <class DATA_TYPE> -S32 LLLinkedList<DATA_TYPE>::getLength() const -{ -// S32 length = 0; -// for (LLLinkNode* temp = mHead.mNextp; temp != NULL; temp = temp->mNextp) -// { -// length++; -// } - return mCount; -} - - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::isEmpty() -{ - return (mCount == 0); -} - - -// search the list starting at mHead.mNextp and remove the link with mDatap == data -// leave mCurrentp and mCurrentOperatingp on the next entry -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::removeData(DATA_TYPE *data) -{ - BOOL b_found = FALSE; - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::removeData", 0); - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - - while (mCurrentOperatingp) - { - if (mCurrentOperatingp->mDatap == data) - { - b_found = TRUE; - - // remove the node - - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // remove the LLLinkNode - - // if we were on the one we want to delete, bump the cached copies - if (mCurrentOperatingp == tcurrop) - { - tcurrop = tcurr = mCurrentOperatingp->mNextp; - } - else if (mCurrentOperatingp == tcurr) - { - tcurrop = tcurr = mCurrentOperatingp->mNextp; - } - - mCurrentp = mCurrentOperatingp->mNextp; - - mCurrentOperatingp->removeData(); - delete mCurrentOperatingp; - mCurrentOperatingp = mCurrentp; - mCount--; - break; - } - mCurrentOperatingp = mCurrentOperatingp->mNextp; - } - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return b_found; -} - -// search the list starting at mHead.mNextp and delete the link with mDatap == data -// leave mCurrentp and mCurrentOperatingp on the next entry -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::deleteData(DATA_TYPE *data) -{ - BOOL b_found = FALSE; - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::removeData", 0); - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - - while (mCurrentOperatingp) - { - if (mCurrentOperatingp->mDatap == data) - { - b_found = TRUE; - - // remove the node - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // delete the LLLinkNode - // if we were on the one we want to delete, bump the cached copies - if (mCurrentOperatingp == tcurrop) - { - tcurrop = tcurr = mCurrentOperatingp->mNextp; - } - - // and delete the associated data - llassert(mCurrentOperatingp); - mCurrentp = mCurrentOperatingp->mNextp; - mCurrentOperatingp->deleteData(); - delete mCurrentOperatingp; - mCurrentOperatingp = mCurrentp; - mCount--; - break; - } - mCurrentOperatingp = mCurrentOperatingp->mNextp; - } - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return b_found; -} - - // remove all nodes from the list and delete the associated data -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::deleteAllData() -{ - LLLinkNode *temp; - // reset mCurrentp - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - temp = mCurrentp->mNextp; - mCurrentp->deleteData(); - delete mCurrentp; - mCurrentp = temp; - } - - // reset mHead and mCurrentp - mHead.mNextp = NULL; - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - mCount = 0; -} - -// remove all nodes from the list but do not delete data -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::removeAllNodes() -{ - LLLinkNode *temp; - // reset mCurrentp - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - temp = mCurrentp->mNextp; - mCurrentp->removeData(); - delete mCurrentp; - mCurrentp = temp; - } - - // reset mHead and mCurrentp - mHead.mNextp = NULL; - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - mCount = 0; -} - -// check to see if data is in list -// if TRUE then mCurrentp and mCurrentOperatingp point to data -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::checkData(DATA_TYPE *data) -{ - // reset mCurrentp - mCurrentp = mHead.mNextp; - - while (mCurrentp) - { - if (mCurrentp->mDatap == data) - { - mCurrentOperatingp = mCurrentp; - return TRUE; - } - mCurrentp = mCurrentp->mNextp; - } - mCurrentOperatingp = mCurrentp; - return FALSE; -} - -// place mCurrentp on first node -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::resetList() -{ - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; -} - -// return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class DATA_TYPE> -DATA_TYPE *LLLinkedList<DATA_TYPE>::getCurrentData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mNextp; - return mCurrentOperatingp->mDatap; - } - else - { - return NULL; - } -} - -// same as getCurrentData() but a more intuitive name for the operation -template <class DATA_TYPE> -DATA_TYPE *LLLinkedList<DATA_TYPE>::getNextData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mNextp; - return mCurrentOperatingp->mDatap; - } - else - { - return NULL; - } -} - -// reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class DATA_TYPE> -DATA_TYPE *LLLinkedList<DATA_TYPE>::getFirstData() -{ - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mNextp; - return mCurrentOperatingp->mDatap; - } - else - { - return NULL; - } -} - -// Note: n is zero-based -template <class DATA_TYPE> -DATA_TYPE *LLLinkedList<DATA_TYPE>::getNthData( U32 n ) -{ - mCurrentOperatingp = mHead.mNextp; - - // if empty, return NULL - if (!mCurrentOperatingp) - { - return NULL; - } - - for( U32 i = 0; i < n; i++ ) - { - mCurrentOperatingp = mCurrentOperatingp->mNextp; - if( !mCurrentOperatingp ) - { - return NULL; - } - } - - mCurrentp = mCurrentOperatingp->mNextp; - return mCurrentOperatingp->mDatap; -} - - -// reset the list and return the last data in it, set mCurentOperatingp to that node and bump mCurrentp -template <class DATA_TYPE> -DATA_TYPE *LLLinkedList<DATA_TYPE>::getLastData() -{ - mCurrentOperatingp = mHead.mNextp; - - // if empty, return NULL - if (!mCurrentOperatingp) - return NULL; - - // walk until we're pointing at the last entry - while (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp = mCurrentOperatingp->mNextp; - } - mCurrentp = mCurrentOperatingp->mNextp; - return mCurrentOperatingp->mDatap; -} - -// remove the Node at mCurentOperatingp -// leave mCurrentp and mCurentOperatingp on the next entry -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::removeCurrentData() -{ - if (mCurrentOperatingp) - { - // remove the node - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // remove the LLLinkNode - mCurrentp = mCurrentOperatingp->mNextp; - - mCurrentOperatingp->removeData(); - delete mCurrentOperatingp; - mCount--; - mCurrentOperatingp = mCurrentp; - } -} - -// remove the Node at mCurentOperatingp and add it to newlist -// leave mCurrentp and mCurentOperatingp on the next entry -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::moveCurrentData(LLLinkedList *newlist, BOOL b_sort) -{ - if (mCurrentOperatingp) - { - // remove the node - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // remove the LLLinkNode - mCurrentp = mCurrentOperatingp->mNextp; - // move the node to the new list - newlist->addData(mCurrentOperatingp); - if (b_sort) - bubbleSortList(); - mCurrentOperatingp = mCurrentp; - } -} - -template <class DATA_TYPE> -BOOL LLLinkedList<DATA_TYPE>::moveData(DATA_TYPE *data, LLLinkedList *newlist, BOOL b_sort) -{ - BOOL b_found = FALSE; - // don't allow NULL to be passed to addData - if (!data) - { - llerror("NULL pointer passed to LLLinkedList::removeData", 0); - } - - LLLinkNode *tcurr = mCurrentp; - LLLinkNode *tcurrop = mCurrentOperatingp; - - mCurrentp = mHead.mNextp; - mCurrentOperatingp = mHead.mNextp; - - while (mCurrentOperatingp) - { - if (mCurrentOperatingp->mDatap == data) - { - b_found = TRUE; - - // remove the node - - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // if we were on the one we want to delete, bump the cached copies - if ( (mCurrentOperatingp == tcurrop) - ||(mCurrentOperatingp == tcurr)) - { - tcurrop = tcurr = mCurrentOperatingp->mNextp; - } - - // remove the LLLinkNode - mCurrentp = mCurrentOperatingp->mNextp; - // move the node to the new list - newlist->addData(mCurrentOperatingp); - if (b_sort) - newlist->bubbleSortList(); - mCurrentOperatingp = mCurrentp; - break; - } - mCurrentOperatingp = mCurrentOperatingp->mNextp; - } - // restore - mCurrentp = tcurr; - mCurrentOperatingp = tcurrop; - return b_found; -} - -// delete the Node at mCurentOperatingp -// leave mCurrentp anf mCurentOperatingp on the next entry -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -void LLLinkedList<DATA_TYPE>::deleteCurrentData() -{ - if (mCurrentOperatingp) - { - // remove the node - // if there is a next one, fix it - if (mCurrentOperatingp->mNextp) - { - mCurrentOperatingp->mNextp->mPrevpp = mCurrentOperatingp->mPrevpp; - } - *(mCurrentOperatingp->mPrevpp) = mCurrentOperatingp->mNextp; - - // remove the LLLinkNode - mCurrentp = mCurrentOperatingp->mNextp; - - mCurrentOperatingp->deleteData(); - if (mCurrentOperatingp->mDatap) - llerror("This is impossible!", 0); - delete mCurrentOperatingp; - mCurrentOperatingp = mCurrentp; - mCount--; - } -} - -#endif diff --git a/indra/llcommon/ll_template_cast.h b/indra/llcommon/ll_template_cast.h deleted file mode 100755 index c8f9a2f7eb382752844364a98841a7924aae852a..0000000000000000000000000000000000000000 --- a/indra/llcommon/ll_template_cast.h +++ /dev/null @@ -1,177 +0,0 @@ -/** - * @file ll_template_cast.h - * @author Nat Goodspeed - * @date 2009-11-21 - * @brief Define ll_template_cast function - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#if ! defined(LL_LL_TEMPLATE_CAST_H) -#define LL_LL_TEMPLATE_CAST_H - -/** - * Implementation for ll_template_cast() (q.v.). - * - * Default implementation: trying to cast two completely unrelated types - * returns 0. Typically you'd specify T and U as pointer types, but in fact T - * can be any type that can be initialized with 0. - */ -template <typename T, typename U> -struct ll_template_cast_impl -{ - T operator()(U) - { - return 0; - } -}; - -/** - * ll_template_cast<T>(some_value) is for use in a template function when - * some_value might be of arbitrary type, but you want to recognize type T - * specially. - * - * It's designed for use with pointer types. Example: - * @code - * struct SpecialClass - * { - * void someMethod(const std::string&) const; - * }; - * - * template <class REALCLASS> - * void somefunc(const REALCLASS& instance) - * { - * const SpecialClass* ptr = ll_template_cast<const SpecialClass*>(&instance); - * if (ptr) - * { - * ptr->someMethod("Call method only available on SpecialClass"); - * } - * } - * @endcode - * - * Why is this better than dynamic_cast<>? Because unless OtherClass is - * polymorphic, the following won't even compile (gcc 4.0.1): - * @code - * OtherClass other; - * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&other); - * @endcode - * to say nothing of this: - * @code - * void function(int); - * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&function); - * @endcode - * ll_template_cast handles these kinds of cases by returning 0. - */ -template <typename T, typename U> -T ll_template_cast(U value) -{ - return ll_template_cast_impl<T, U>()(value); -} - -/** - * Implementation for ll_template_cast() (q.v.). - * - * Implementation for identical types: return same value. - */ -template <typename T> -struct ll_template_cast_impl<T, T> -{ - T operator()(T value) - { - return value; - } -}; - -/** - * LL_TEMPLATE_CONVERTIBLE(dest, source) asserts that, for a value @c s of - * type @c source, <tt>ll_template_cast<dest>(s)</tt> will return @c s -- - * presuming that @c source can be converted to @c dest by the normal rules of - * C++. - * - * By default, <tt>ll_template_cast<dest>(s)</tt> will return 0 unless @c s's - * type is literally identical to @c dest. (This is because of the - * straightforward application of template specialization rules.) That can - * lead to surprising results, e.g.: - * - * @code - * Foo myFoo; - * const Foo* fooptr = ll_template_cast<const Foo*>(&myFoo); - * @endcode - * - * Here @c fooptr will be 0 because <tt>&myFoo</tt> is of type <tt>Foo*</tt> - * -- @em not <tt>const Foo*</tt>. (Declaring <tt>const Foo myFoo;</tt> would - * force the compiler to do the right thing.) - * - * More disappointingly: - * @code - * struct Base {}; - * struct Subclass: public Base {}; - * Subclass object; - * Base* ptr = ll_template_cast<Base*>(&object); - * @endcode - * - * Here @c ptr will be 0 because <tt>&object</tt> is of type - * <tt>Subclass*</tt> rather than <tt>Base*</tt>. We @em want this cast to - * succeed, but without our help ll_template_cast can't recognize it. - * - * The following would suffice: - * @code - * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*); - * ... - * Base* ptr = ll_template_cast<Base*>(&object); - * @endcode - * - * However, as noted earlier, this is easily fooled: - * @code - * const Base* ptr = ll_template_cast<const Base*>(&object); - * @endcode - * would still produce 0 because we haven't yet seen: - * @code - * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*); - * @endcode - * - * @TODO - * This macro should use Boost type_traits facilities for stripping and - * re-adding @c const and @c volatile qualifiers so that invoking - * LL_TEMPLATE_CONVERTIBLE(dest, source) will automatically generate all - * permitted permutations. It's really not fair to the coder to require - * separate: - * @code - * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*); - * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*); - * LL_TEMPLATE_CONVERTIBLE(const Base*, const Subclass*); - * @endcode - * - * (Naturally we omit <tt>LL_TEMPLATE_CONVERTIBLE(Base*, const Subclass*)</tt> - * because that's not permitted by normal C++ assignment anyway.) - */ -#define LL_TEMPLATE_CONVERTIBLE(DEST, SOURCE) \ -template <> \ -struct ll_template_cast_impl<DEST, SOURCE> \ -{ \ - DEST operator()(SOURCE wrapper) \ - { \ - return wrapper; \ - } \ -} - -#endif /* ! defined(LL_LL_TEMPLATE_CAST_H) */ diff --git a/indra/llcommon/llaccountingcost.h b/indra/llcommon/llaccountingcost.h deleted file mode 100755 index 0ef3b50c6dfa513bfd1b8357e4325f8e1959bad5..0000000000000000000000000000000000000000 --- a/indra/llcommon/llaccountingcost.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @file llaccountingcost.h - * @ - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_ACCOUNTINGQUOTA_H -#define LL_ACCOUNTINGQUOTA_H - -struct ParcelQuota -{ - ParcelQuota( F32 ownerRenderCost, F32 ownerPhysicsCost, F32 ownerNetworkCost, F32 ownerSimulationCost, - F32 groupRenderCost, F32 groupPhysicsCost, F32 groupNetworkCost, F32 groupSimulationCost, - F32 otherRenderCost, F32 otherPhysicsCost, F32 otherNetworkCost, F32 otherSimulationCost, - F32 tempRenderCost, F32 tempPhysicsCost, F32 tempNetworkCost, F32 tempSimulationCost, - F32 selectedRenderCost, F32 selectedPhysicsCost, F32 selectedNetworkCost, F32 selectedSimulationCost, - F32 parcelCapacity ) - : mOwnerRenderCost( ownerRenderCost ), mOwnerPhysicsCost( ownerPhysicsCost ) - , mOwnerNetworkCost( ownerNetworkCost ), mOwnerSimulationCost( ownerSimulationCost ) - , mGroupRenderCost( groupRenderCost ), mGroupPhysicsCost( groupPhysicsCost ) - , mGroupNetworkCost( groupNetworkCost ), mGroupSimulationCost( groupSimulationCost ) - , mOtherRenderCost( otherRenderCost ), mOtherPhysicsCost( otherPhysicsCost ) - , mOtherNetworkCost( otherNetworkCost ), mOtherSimulationCost( otherSimulationCost ) - , mTempRenderCost( tempRenderCost ), mTempPhysicsCost( tempPhysicsCost ) - , mTempNetworkCost( tempNetworkCost ), mTempSimulationCost( tempSimulationCost ) - , mSelectedRenderCost( tempRenderCost ), mSelectedPhysicsCost( tempPhysicsCost ) - , mSelectedNetworkCost( tempNetworkCost ), mSelectedSimulationCost( selectedSimulationCost ) - , mParcelCapacity( parcelCapacity ) - { - } - - ParcelQuota(){} - F32 mOwnerRenderCost, mOwnerPhysicsCost, mOwnerNetworkCost, mOwnerSimulationCost; - F32 mGroupRenderCost, mGroupPhysicsCost, mGroupNetworkCost, mGroupSimulationCost; - F32 mOtherRenderCost, mOtherPhysicsCost, mOtherNetworkCost, mOtherSimulationCost; - F32 mTempRenderCost, mTempPhysicsCost, mTempNetworkCost, mTempSimulationCost; - F32 mSelectedRenderCost, mSelectedPhysicsCost, mSelectedNetworkCost, mSelectedSimulationCost; - F32 mParcelCapacity; -}; - -//SelectionQuota atm does not require a id -struct SelectionCost -{ - SelectionCost( /*LLTransactionID transactionId, */ F32 physicsCost, F32 networkCost, F32 simulationCost ) - //: mTransactionId( transactionId) - : mPhysicsCost( physicsCost ) - , mNetworkCost( networkCost ) - , mSimulationCost( simulationCost ) - { - } - SelectionCost() - : mPhysicsCost( 0.0f ) - , mNetworkCost( 0.0f ) - , mSimulationCost( 0.0f ) - {} - - F32 mPhysicsCost, mNetworkCost, mSimulationCost; - //LLTransactionID mTransactionId; -}; - -typedef enum { Roots = 0 , Prims } eSelectionType; - -#endif - - - diff --git a/indra/llcommon/llagentconstants.h b/indra/llcommon/llagentconstants.h deleted file mode 100755 index cd237da4eb909ae733a7275b3158ad87fd550d14..0000000000000000000000000000000000000000 --- a/indra/llcommon/llagentconstants.h +++ /dev/null @@ -1,159 +0,0 @@ -/** - * @file llagentconstants.h - * @author James Cook, Andrew Meadows, Richard Nelson - * @brief Shared constants through the system for agents. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLAGENTCONSTANTS_H -#define LL_LLAGENTCONSTANTS_H - -const U32 CONTROL_AT_POS_INDEX = 0; -const U32 CONTROL_AT_NEG_INDEX = 1; -const U32 CONTROL_LEFT_POS_INDEX = 2; -const U32 CONTROL_LEFT_NEG_INDEX = 3; -const U32 CONTROL_UP_POS_INDEX = 4; -const U32 CONTROL_UP_NEG_INDEX = 5; -const U32 CONTROL_PITCH_POS_INDEX = 6; -const U32 CONTROL_PITCH_NEG_INDEX = 7; -const U32 CONTROL_YAW_POS_INDEX = 8; -const U32 CONTROL_YAW_NEG_INDEX = 9; -const U32 CONTROL_FAST_AT_INDEX = 10; -const U32 CONTROL_FAST_LEFT_INDEX = 11; -const U32 CONTROL_FAST_UP_INDEX = 12; -const U32 CONTROL_FLY_INDEX = 13; -const U32 CONTROL_STOP_INDEX = 14; -const U32 CONTROL_FINISH_ANIM_INDEX = 15; -const U32 CONTROL_STAND_UP_INDEX = 16; -const U32 CONTROL_SIT_ON_GROUND_INDEX = 17; -const U32 CONTROL_MOUSELOOK_INDEX = 18; -const U32 CONTROL_NUDGE_AT_POS_INDEX = 19; -const U32 CONTROL_NUDGE_AT_NEG_INDEX = 20; -const U32 CONTROL_NUDGE_LEFT_POS_INDEX = 21; -const U32 CONTROL_NUDGE_LEFT_NEG_INDEX = 22; -const U32 CONTROL_NUDGE_UP_POS_INDEX = 23; -const U32 CONTROL_NUDGE_UP_NEG_INDEX = 24; -const U32 CONTROL_TURN_LEFT_INDEX = 25; -const U32 CONTROL_TURN_RIGHT_INDEX = 26; -const U32 CONTROL_AWAY_INDEX = 27; -const U32 CONTROL_LBUTTON_DOWN_INDEX = 28; -const U32 CONTROL_LBUTTON_UP_INDEX = 29; -const U32 CONTROL_ML_LBUTTON_DOWN_INDEX = 30; -const U32 CONTROL_ML_LBUTTON_UP_INDEX = 31; -const U32 TOTAL_CONTROLS = 32; - -const U32 AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX; // 0x00000001 -const U32 AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX; // 0x00000002 -const U32 AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX; // 0x00000004 -const U32 AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX; // 0x00000008 -const U32 AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX; // 0x00000010 -const U32 AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX; // 0x00000020 -const U32 AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX; // 0x00000040 -const U32 AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX; // 0x00000080 -const U32 AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX; // 0x00000100 -const U32 AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX; // 0x00000200 - -const U32 AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX; // 0x00000400 -const U32 AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX; // 0x00000800 -const U32 AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX; // 0x00001000 - -const U32 AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX; // 0x00002000 -const U32 AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX; // 0x00004000 -const U32 AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX; // 0x00008000 -const U32 AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX; // 0x00010000 -const U32 AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX; // 0x00020000 -const U32 AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX; // 0x00040000 - -const U32 AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX; // 0x00080000 -const U32 AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX; // 0x00100000 -const U32 AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX; // 0x00200000 -const U32 AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX; // 0x00400000 -const U32 AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX; // 0x00800000 -const U32 AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX; // 0x01000000 -const U32 AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX; // 0x02000000 -const U32 AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX; // 0x04000000 - -const U32 AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX; // 0x08000000 - -const U32 AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX; // 0x10000000 -const U32 AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX; // 0x20000000 -const U32 AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX; // 0x40000000 -const U32 AGENT_CONTROL_ML_LBUTTON_UP = ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX; // 0x80000000 - -const U32 AGENT_CONTROL_AT = AGENT_CONTROL_AT_POS - | AGENT_CONTROL_AT_NEG - | AGENT_CONTROL_NUDGE_AT_POS - | AGENT_CONTROL_NUDGE_AT_NEG; - -const U32 AGENT_CONTROL_LEFT = AGENT_CONTROL_LEFT_POS - | AGENT_CONTROL_LEFT_NEG - | AGENT_CONTROL_NUDGE_LEFT_POS - | AGENT_CONTROL_NUDGE_LEFT_NEG; - -const U32 AGENT_CONTROL_UP = AGENT_CONTROL_UP_POS - | AGENT_CONTROL_UP_NEG - | AGENT_CONTROL_NUDGE_UP_POS - | AGENT_CONTROL_NUDGE_UP_NEG; - -const U32 AGENT_CONTROL_HORIZONTAL = AGENT_CONTROL_AT - | AGENT_CONTROL_LEFT; - -const U32 AGENT_CONTROL_NOT_USED_BY_LSL = AGENT_CONTROL_FLY - | AGENT_CONTROL_STOP - | AGENT_CONTROL_FINISH_ANIM - | AGENT_CONTROL_STAND_UP - | AGENT_CONTROL_SIT_ON_GROUND - | AGENT_CONTROL_MOUSELOOK - | AGENT_CONTROL_AWAY; - -const U32 AGENT_CONTROL_MOVEMENT = AGENT_CONTROL_AT - | AGENT_CONTROL_LEFT - | AGENT_CONTROL_UP; - -const U32 AGENT_CONTROL_ROTATION = AGENT_CONTROL_PITCH_POS - | AGENT_CONTROL_PITCH_NEG - | AGENT_CONTROL_YAW_POS - | AGENT_CONTROL_YAW_NEG; - -const U32 AGENT_CONTROL_NUDGE = AGENT_CONTROL_NUDGE_AT_POS - | AGENT_CONTROL_NUDGE_AT_NEG - | AGENT_CONTROL_NUDGE_LEFT_POS - | AGENT_CONTROL_NUDGE_LEFT_NEG; - - -// move these up so that we can hide them in "State" for object updates -// (for now) -const U32 AGENT_ATTACH_OFFSET = 4; -const U32 AGENT_ATTACH_MASK = 0xf << AGENT_ATTACH_OFFSET; -const U32 AGENT_ATTACH_CLEAR = 0x00; - -// RN: this method swaps the upper and lower nibbles to maintain backward -// compatibility with old objects that only used the upper nibble -#define ATTACHMENT_ID_FROM_STATE(state) ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4))) - -// test state for use in testing grabbing the camera -const U32 AGENT_CAMERA_OBJECT = 0x1 << 3; - -const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters? - -#endif diff --git a/indra/llcommon/llalignedarray.h b/indra/llcommon/llalignedarray.h index ed8fd3120593d829bb62391d38bc2c940fde7ca5..b68e9e0f82d6eae65ea84c99e53776433119d6ae 100644 --- a/indra/llcommon/llalignedarray.h +++ b/indra/llcommon/llalignedarray.h @@ -60,7 +60,7 @@ LLAlignedArray<T, alignment>::LLAlignedArray() template <class T, U32 alignment> LLAlignedArray<T, alignment>::~LLAlignedArray() { - ll_aligned_free(mArray); + ll_aligned_free<alignment>(mArray); mArray = NULL; mElementCount = 0; mCapacity = 0; @@ -74,7 +74,7 @@ void LLAlignedArray<T, alignment>::push_back(const T& elem) { mCapacity++; mCapacity *= 2; - T* new_buf = (T*) ll_aligned_malloc(mCapacity*sizeof(T), alignment); + T* new_buf = (T*) ll_aligned_malloc<alignment>(mCapacity*sizeof(T)); if (mArray) { ll_memcpy_nonaliased_aligned_16((char*)new_buf, (char*)mArray, sizeof(T)*mElementCount); @@ -86,7 +86,7 @@ void LLAlignedArray<T, alignment>::push_back(const T& elem) mArray[mElementCount++] = elem; //delete old array here to prevent error on a.push_back(a[0]) - ll_aligned_free(old_buf); + ll_aligned_free<alignment>(old_buf); } template <class T, U32 alignment> @@ -95,11 +95,11 @@ void LLAlignedArray<T, alignment>::resize(U32 size) if (mCapacity < size) { mCapacity = size+mCapacity*2; - T* new_buf = mCapacity > 0 ? (T*) ll_aligned_malloc(mCapacity*sizeof(T), alignment) : NULL; + T* new_buf = mCapacity > 0 ? (T*) ll_aligned_malloc<alignment>(mCapacity*sizeof(T)) : NULL; if (mArray) { ll_memcpy_nonaliased_aligned_16((char*) new_buf, (char*) mArray, sizeof(T)*mElementCount); - ll_aligned_free(mArray); + ll_aligned_free<alignment>(mArray); } /*for (U32 i = mElementCount; i < mCapacity; ++i) diff --git a/indra/llcommon/llallocator_heap_profile.cpp b/indra/llcommon/llallocator_heap_profile.cpp index b574ef668b67d2f2ad4e6bcd7f0bddda11cab2c3..b2eafde1aaf4b0e24928175229ae802e8d4f4aab 100755 --- a/indra/llcommon/llallocator_heap_profile.cpp +++ b/indra/llcommon/llallocator_heap_profile.cpp @@ -59,7 +59,7 @@ void LLAllocatorHeapProfile::parse(std::string const & prof_text) { // *TODO - determine if there should be some better error state than // mLines being empty. -brad - llwarns << "invalid heap profile data passed into parser." << llendl; + LL_WARNS() << "invalid heap profile data passed into parser." << LL_ENDL; return; } diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 63a38f2884e1ceac084c224fe746c8307676cc13..5a40845e7d739209255b73b529448b73d2986ccd 100755 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -209,8 +209,8 @@ bool LLApp::parseCommandOptions(int argc, char** argv) { if(argv[ii][0] != '-') { - llinfos << "Did not find option identifier while parsing token: " - << argv[ii] << llendl; + LL_INFOS() << "Did not find option identifier while parsing token: " + << argv[ii] << LL_ENDL; return false; } int offset = 1; @@ -348,7 +348,7 @@ void LLApp::setupErrorHandling(bool second_instance) } else { - llwarns << "adding breakpad exception handler" << llendl; + LL_WARNS() << "adding breakpad exception handler" << LL_ENDL; std::wstring wpipe_name; wpipe_name = mCrashReportPipeStr + wstringize(getPid()); @@ -463,7 +463,7 @@ void LLApp::startErrorThread() // if(!mThreadErrorp) { - llinfos << "Starting error thread" << llendl; + LL_INFOS() << "Starting error thread" << LL_ENDL; mThreadErrorp = new LLErrorThread(); mThreadErrorp->setUserData((void *) this); mThreadErrorp->start(); @@ -483,7 +483,7 @@ void LLApp::runErrorHandler() LLApp::sErrorHandler(); } - //llinfos << "App status now STOPPED" << llendl; + //LL_INFOS() << "App status now STOPPED" << LL_ENDL; LLApp::setStopped(); } @@ -544,7 +544,7 @@ void LLApp::setQuitting() if (!isExiting()) { // If we're already exiting, we don't want to reset our state back to quitting. - llinfos << "Setting app state to QUITTING" << llendl; + LL_INFOS() << "Setting app state to QUITTING" << LL_ENDL; setStatus(APP_STATUS_QUITTING); } } @@ -629,7 +629,7 @@ LONG WINAPI default_windows_exception_handler(struct _EXCEPTION_POINTERS *except if (LLApp::isError()) { - llwarns << "Got another fatal signal while in the error handler, die now!" << llendl; + LL_WARNS() << "Got another fatal signal while in the error handler, die now!" << LL_ENDL; retval = EXCEPTION_EXECUTE_HANDLER; return retval; } @@ -675,7 +675,7 @@ BOOL ConsoleCtrlHandler(DWORD fdwCtrlType) // We're already trying to die, just ignore this signal if (LLApp::sLogInSignal) { - llinfos << "Signal handler - Already trying to quit, ignoring signal!" << llendl; + LL_INFOS() << "Signal handler - Already trying to quit, ignoring signal!" << LL_ENDL; } return TRUE; } @@ -776,7 +776,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) if (LLApp::sLogInSignal) { - llinfos << "Signal handler - Got signal " << signum << " - " << apr_signal_description_get(signum) << llendl; + LL_INFOS() << "Signal handler - Got signal " << signum << " - " << apr_signal_description_get(signum) << LL_ENDL; } @@ -785,7 +785,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) case SIGCHLD: if (LLApp::sLogInSignal) { - llinfos << "Signal handler - Got SIGCHLD from " << info->si_pid << llendl; + LL_INFOS() << "Signal handler - Got SIGCHLD from " << info->si_pid << LL_ENDL; } return; @@ -793,7 +793,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) // Abort just results in termination of the app, no funky error handling. if (LLApp::sLogInSignal) { - llwarns << "Signal handler - Got SIGABRT, terminating" << llendl; + LL_WARNS() << "Signal handler - Got SIGABRT, terminating" << LL_ENDL; } clear_signals(); raise(signum); @@ -803,7 +803,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) case SIGTERM: if (LLApp::sLogInSignal) { - llwarns << "Signal handler - Got SIGINT, HUP, or TERM, exiting gracefully" << llendl; + LL_WARNS() << "Signal handler - Got SIGINT, HUP, or TERM, exiting gracefully" << LL_ENDL; } // Graceful exit // Just set our state to quitting, not error @@ -812,7 +812,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) // We're already trying to die, just ignore this signal if (LLApp::sLogInSignal) { - llinfos << "Signal handler - Already trying to quit, ignoring signal!" << llendl; + LL_INFOS() << "Signal handler - Already trying to quit, ignoring signal!" << LL_ENDL; } return; } @@ -834,7 +834,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) // Smackdown treated just like any other app termination, for now if (LLApp::sLogInSignal) { - llwarns << "Signal handler - Handling smackdown signal!" << llendl; + LL_WARNS() << "Signal handler - Handling smackdown signal!" << LL_ENDL; } else { @@ -848,7 +848,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) if (LLApp::sLogInSignal) { - llwarns << "Signal handler - Handling fatal signal!" << llendl; + LL_WARNS() << "Signal handler - Handling fatal signal!" << LL_ENDL; } if (LLApp::isError()) { @@ -858,7 +858,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) if (LLApp::sLogInSignal) { - llwarns << "Signal handler - Got another fatal signal while in the error handler, die now!" << llendl; + LL_WARNS() << "Signal handler - Got another fatal signal while in the error handler, die now!" << LL_ENDL; } raise(signum); return; @@ -866,13 +866,13 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) if (LLApp::sLogInSignal) { - llwarns << "Signal handler - Flagging error status and waiting for shutdown" << llendl; + LL_WARNS() << "Signal handler - Flagging error status and waiting for shutdown" << LL_ENDL; } if (LLApp::isCrashloggerDisabled()) // Don't gracefully handle any signal, crash and core for a gdb post mortem { clear_signals(); - llwarns << "Fatal signal received, not handling the crash here, passing back to operating system" << llendl; + LL_WARNS() << "Fatal signal received, not handling the crash here, passing back to operating system" << LL_ENDL; raise(signum); return; } @@ -887,7 +887,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) if (LLApp::sLogInSignal) { - llwarns << "Signal handler - App is stopped, reraising signal" << llendl; + LL_WARNS() << "Signal handler - App is stopped, reraising signal" << LL_ENDL; } clear_signals(); raise(signum); @@ -895,7 +895,7 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) } else { if (LLApp::sLogInSignal) { - llinfos << "Signal handler - Unhandled signal " << signum << ", ignoring!" << llendl; + LL_INFOS() << "Signal handler - Unhandled signal " << signum << ", ignoring!" << LL_ENDL; } } } @@ -929,7 +929,7 @@ bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_ strncpy(path, minidump_desc.path(), remaining); - llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + LL_INFOS() << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << LL_ENDL; LLApp::runErrorHandler(); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -975,7 +975,7 @@ bool unix_post_minidump_callback(const char *dump_dir, strncpy(path, ".dmp", remaining); } - llinfos << "generated minidump: " << path << llendl; + LL_INFOS() << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << LL_ENDL; LLApp::runErrorHandler(); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -1019,16 +1019,16 @@ bool windows_post_minidump_callback(const wchar_t* dump_path, strncpy(path, ".dmp", remaining); } - llinfos << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << llendl; + LL_INFOS() << "generated minidump: " << LLApp::instance()->getMiniDumpFilename() << LL_ENDL; // *NOTE:Mani - this code is stolen from LLApp, where its never actually used. //OSMessageBox("Attach Debugger Now", "Error", OSMB_OK); // *TODO: Translate the signals/exceptions into cross-platform stuff // Windows implementation - llinfos << "Entering Windows Exception Handler..." << llendl; + LL_INFOS() << "Entering Windows Exception Handler..." << LL_ENDL; if (LLApp::isError()) { - llwarns << "Got another fatal signal while in the error handler, die now!" << llendl; + LL_WARNS() << "Got another fatal signal while in the error handler, die now!" << LL_ENDL; } // Flag status to error, so thread_error starts its work diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index 3f7bf2ca476d4c9a2a33cfc7949035ec7b544da4..d9933b3d369d21590bedc35c07c1a258b54f1e02 100755 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -30,7 +30,6 @@ #include <map> #include "llrun.h" #include "llsd.h" -#include "lloptioninterface.h" // Forward declarations template <typename Type> class LLAtomic32; typedef LLAtomic32<U32> LLAtomicU32; @@ -55,7 +54,7 @@ namespace google_breakpad { class ExceptionHandler; // See exception_handler.h } -class LL_COMMON_API LLApp : public LLOptionInterface +class LL_COMMON_API LLApp { friend class LLErrorThread; public: @@ -104,7 +103,7 @@ class LL_COMMON_API LLApp : public LLOptionInterface * @param name The name of the option. * @return Returns the option data. */ - virtual LLSD getOption(const std::string& name) const; + LLSD getOption(const std::string& name) const; /** * @brief Parse command line options and insert them into diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index b7815b0e3586829015c9119fc2c19fe94063ee29..a548c96002413ebfaa943a93049a547b2061a4c0 100755 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -29,6 +29,7 @@ #include "linden_common.h" #include "llapr.h" #include "apr_dso.h" +#include "llthreadlocalstorage.h" apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool. @@ -37,12 +38,15 @@ apr_thread_mutex_t *gCallStacksLogMutexp = NULL; const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool +bool gAPRInitialized = false; + void ll_init_apr() { + // Initialize APR and create the global pool + apr_initialize(); + if (!gAPRPoolp) { - // Initialize APR and create the global pool - apr_initialize(); apr_pool_create(&gAPRPoolp, NULL); // Initialize the logging mutex @@ -54,11 +58,21 @@ void ll_init_apr() { LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool(FALSE) ; } + + LLThreadLocalPointerBase::initAllThreadLocalStorage(); + gAPRInitialized = true; } +bool ll_apr_is_initialized() +{ + return gAPRInitialized; +} + void ll_cleanup_apr() { + gAPRInitialized = false; + LL_INFOS("APR") << "Cleaning up APR" << LL_ENDL; if (gLogMutexp) @@ -77,6 +91,9 @@ void ll_cleanup_apr() apr_thread_mutex_destroy(gCallStacksLogMutexp); gCallStacksLogMutexp = NULL; } + + LLThreadLocalPointerBase::destroyAllThreadLocalStorage(); + if (gAPRPoolp) { apr_pool_destroy(gAPRPoolp); @@ -429,7 +446,7 @@ S32 LLAPRFile::read(void *buf, S32 nbytes) { if(!mFile) { - llwarns << "apr mFile is removed by somebody else. Can not read." << llendl ; + LL_WARNS() << "apr mFile is removed by somebody else. Can not read." << LL_ENDL ; return 0; } @@ -451,7 +468,7 @@ S32 LLAPRFile::write(const void *buf, S32 nbytes) { if(!mFile) { - llwarns << "apr mFile is removed by somebody else. Can not write." << llendl ; + LL_WARNS() << "apr mFile is removed by somebody else. Can not write." << LL_ENDL ; return 0; } diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 1fe7d9847289e987d1be1641dfed097f43c96c3b..b1b0fc4718fa92e16d19d65b020f6e3fc63a994f 100755 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -32,28 +32,34 @@ #if LL_LINUX || LL_SOLARIS #include <sys/param.h> // Need PATH_MAX in APR headers... #endif -#if LL_WINDOWS - // Limit Windows API to small and manageable set. - // If you get undefined symbols, find the appropriate - // Windows header file and include that in your .cpp file. - #define WIN32_LEAN_AND_MEAN - #include <winsock2.h> - #include <windows.h> -#endif #include <boost/noncopyable.hpp> - +#include "llwin32headerslean.h" #include "apr_thread_proc.h" #include "apr_thread_mutex.h" #include "apr_getopt.h" #include "apr_signal.h" #include "apr_atomic.h" + #include "llstring.h" extern LL_COMMON_API apr_thread_mutex_t* gLogMutexp; extern apr_thread_mutex_t* gCallStacksLogMutexp; struct apr_dso_handle_t; +/** + * @brief Function which appropriately logs error or remains quiet on + * APR_SUCCESS. + * @return Returns <code>true</code> if status is an error condition. + */ +bool LL_COMMON_API ll_apr_warn_status(apr_status_t status); +/// There's a whole other APR error-message function if you pass a DSO handle. +bool LL_COMMON_API ll_apr_warn_status(apr_status_t status, apr_dso_handle_t* handle); + +void LL_COMMON_API ll_apr_assert_status(apr_status_t status); +void LL_COMMON_API ll_apr_assert_status(apr_status_t status, apr_dso_handle_t* handle); + +extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool /** * @brief initialize the common apr constructs -- apr itself, the @@ -66,6 +72,9 @@ void LL_COMMON_API ll_init_apr(); */ void LL_COMMON_API ll_cleanup_apr(); +bool LL_COMMON_API ll_apr_is_initialized(); + + // //LL apr_pool //manage apr_pool_t, destroy allocated apr_pool in the destruction function. @@ -263,18 +272,5 @@ class LL_COMMON_API LLAPRFile : boost::noncopyable //******************************************************************************************************************************* }; -/** - * @brief Function which appropriately logs error or remains quiet on - * APR_SUCCESS. - * @return Returns <code>true</code> if status is an error condition. - */ -bool LL_COMMON_API ll_apr_warn_status(apr_status_t status); -/// There's a whole other APR error-message function if you pass a DSO handle. -bool LL_COMMON_API ll_apr_warn_status(apr_status_t status, apr_dso_handle_t* handle); - -void LL_COMMON_API ll_apr_assert_status(apr_status_t status); -void LL_COMMON_API ll_apr_assert_status(apr_status_t status, apr_dso_handle_t* handle); - -extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool #endif // LL_LLAPR_H diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h index 69b01731e5dc2ed76d764a441764b0ec38448a11..5a95a58d93db4f43054e507e2020c8ae2e7569e4 100755 --- a/indra/llcommon/llassettype.h +++ b/indra/llcommon/llassettype.h @@ -29,8 +29,6 @@ #include <string> -#include "stdenums.h" // for EDragAndDropType - class LL_COMMON_API LLAssetType { public: diff --git a/indra/llcommon/llassoclist.h b/indra/llcommon/llassoclist.h deleted file mode 100755 index 29505041552cfb1ba7889d9135a3893b359a0370..0000000000000000000000000000000000000000 --- a/indra/llcommon/llassoclist.h +++ /dev/null @@ -1,296 +0,0 @@ -/** - * @file llassoclist.h - * @brief LLAssocList class header file - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLASSOCLIST_H -#define LL_LLASSOCLIST_H - -//------------------------------------------------------------------------ -// LLAssocList is an associative list container class. -// -// The implementation is a single linked list. -// Both index and value objects are stored by value (not reference). -// If pointer values are specified for index and/or value, this -// container does NOT assume ownership of the referenced objects, -// and does NOT delete() them on removal or destruction of the container. -// -// Note that operations are generally not optimized, and may of them -// are O(n) complexity. -//------------------------------------------------------------------------ - -#include <iostream> - -template<class INDEX_TYPE, class VALUE_TYPE> -class LLAssocList -{ -private: - // internal list node type - class Node - { - public: - Node(const INDEX_TYPE &index, const VALUE_TYPE &value, Node *next) - { - mIndex = index; - mValue = value; - mNext = next; - } - ~Node() { } - INDEX_TYPE mIndex; - VALUE_TYPE mValue; - Node *mNext; - }; - - // head of the linked list - Node *mHead; - -public: - // Constructor - LLAssocList() - { - mHead = NULL; - } - - // Destructor - ~LLAssocList() - { - removeAll(); - } - - // Returns TRUE if list is empty. - BOOL isEmpty() - { - return (mHead == NULL); - } - - // Returns the number of items in the list. - U32 length() - { - U32 count = 0; - for ( Node *node = mHead; - node; - node = node->mNext ) - { - count++; - } - return count; - } - - // Removes item with the specified index. - BOOL remove( const INDEX_TYPE &index ) - { - if (!mHead) - return FALSE; - - if (mHead->mIndex == index) - { - Node *node = mHead; - mHead = mHead->mNext; - delete node; - return TRUE; - } - - for ( Node *prev = mHead; - prev->mNext; - prev = prev->mNext ) - { - if (prev->mNext->mIndex == index) - { - Node *node = prev->mNext; - prev->mNext = prev->mNext->mNext; - delete node; - return TRUE; - } - } - return FALSE; - } - - // Removes all items from the list. - void removeAll() - { - while ( mHead ) - { - Node *node = mHead; - mHead = mHead->mNext; - delete node; - } - } - - // Adds a new item to the head of the list, - // removing any existing item with same index. - void addToHead( const INDEX_TYPE &index, const VALUE_TYPE &value ) - { - remove(index); - Node *node = new Node(index, value, mHead); - mHead = node; - } - - // Adds a new item to the end of the list, - // removing any existing item with the same index. - void addToTail( const INDEX_TYPE &index, const VALUE_TYPE &value ) - { - remove(index); - Node *node = new Node(index, value, NULL); - if (!mHead) - { - mHead = node; - return; - } - for ( Node *prev=mHead; - prev; - prev=prev->mNext ) - { - if (!prev->mNext) - { - prev->mNext=node; - return; - } - } - } - - // Sets the value of a specified index. - // If index does not exist, a new value will be added only if - // 'addIfNotFound' is set to TRUE. - // Returns TRUE if successful. - BOOL setValue( const INDEX_TYPE &index, const VALUE_TYPE &value, BOOL addIfNotFound=FALSE ) - { - VALUE_TYPE *valueP = getValue(index); - if (valueP) - { - *valueP = value; - return TRUE; - } - if (!addIfNotFound) - return FALSE; - addToTail(index, value); - return TRUE; - } - - // Sets the ith value in the list. - // A new value will NOT be addded, if the ith value does not exist. - // Returns TRUE if successful. - BOOL setValueAt( U32 i, const VALUE_TYPE &value ) - { - VALUE_TYPE *valueP = getValueAt(i); - if (valueP) - { - *valueP = value; - return TRUE; - } - return FALSE; - } - - // Returns a pointer to the value for the specified index, - // or NULL if no item found. - VALUE_TYPE *getValue( const INDEX_TYPE &index ) - { - for ( Node *node = mHead; - node; - node = node->mNext ) - { - if (node->mIndex == index) - return &node->mValue; - } - return NULL; - } - - // Returns a pointer to the ith value in the list, or - // NULL if i is not valid. - VALUE_TYPE *getValueAt( U32 i ) - { - U32 count = 0; - for ( Node *node = mHead; - node; - node = node->mNext ) - { - if (count == i) - return &node->mValue; - count++; - } - return NULL; - } - - // Returns a pointer to the index for the specified index, - // or NULL if no item found. - INDEX_TYPE *getIndex( const INDEX_TYPE &index ) - { - for ( Node *node = mHead; - node; - node = node->mNext ) - { - if (node->mIndex == index) - return &node->mIndex; - } - return NULL; - } - - // Returns a pointer to the ith index in the list, or - // NULL if i is not valid. - INDEX_TYPE *getIndexAt( U32 i ) - { - U32 count = 0; - for ( Node *node = mHead; - node; - node = node->mNext ) - { - if (count == i) - return &node->mIndex; - count++; - } - return NULL; - } - - // Returns a pointer to the value for the specified index, - // or NULL if no item found. - VALUE_TYPE *operator[](const INDEX_TYPE &index) - { - return getValue(index); - } - - // Returns a pointer to the ith value in the list, or - // NULL if i is not valid. - VALUE_TYPE *operator[](U32 i) - { - return getValueAt(i); - } - - // Prints the list contents to the specified stream. - friend std::ostream &operator<<( std::ostream &os, LLAssocList &map ) - { - os << "{"; - for ( Node *node = map.mHead; - node; - node = node->mNext ) - { - os << "<" << node->mIndex << ", " << node->mValue << ">"; - if (node->mNext) - os << ", "; - } - os << "}"; - - return os; - } -}; - -#endif // LL_LLASSOCLIST_H diff --git a/indra/llcommon/llavatarconstants.h b/indra/llcommon/llavatarconstants.h deleted file mode 100755 index f47f447b454b9ca13df7cbf5575f8a98e86c4aa0..0000000000000000000000000000000000000000 --- a/indra/llcommon/llavatarconstants.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file llavatarconstants.h - * @brief some useful short term constants for Indra - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_AVATAR_CONSTANTS_H -#define LL_AVATAR_CONSTANTS_H - -// If this string is passed to dataserver in AvatarPropertiesUpdate -// then no change is made to user.profile_web -const char* const BLACKLIST_PROFILE_WEB_STR = "featureWebProfilesDisabled"; - -// If profile web pages are feature blacklisted then this URL is -// shown in the profile instead of the user's set URL -const char* const BLACKLIST_PROFILE_WEB_URL = "http://secondlife.com/app/webdisabled"; - -// Maximum number of avatar picks -const S32 MAX_AVATAR_PICKS = 10; - -// For Flags in AvatarPropertiesReply -const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not -const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature" -const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info -const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info -const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known. -const U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified - -char const* const VISIBILITY_DEFAULT = "default"; -char const* const VISIBILITY_HIDDEN = "hidden"; -char const* const VISIBILITY_VISIBLE = "visible"; -char const* const VISIBILITY_INVISIBLE = "invisible"; - -#endif - diff --git a/indra/llcommon/llbase32.cpp b/indra/llcommon/llbase32.cpp index 053ac0d32fc2130cbd20f70cbaa1412c1941019a..349567c90b904cce0276305c25ca1cb7e291513a 100755 --- a/indra/llcommon/llbase32.cpp +++ b/indra/llcommon/llbase32.cpp @@ -231,8 +231,8 @@ std::string LLBase32::encode(const U8* input, size_t input_size) size_t encoded = base32_encode(&output[0], output_size, input, input_size); - llinfos << "encoded " << encoded << " into buffer of size " - << output_size << llendl; + LL_INFOS() << "encoded " << encoded << " into buffer of size " + << output_size << LL_ENDL; } return output; } diff --git a/indra/llcommon/bitpack.cpp b/indra/llcommon/llbitpack.cpp similarity index 98% rename from indra/llcommon/bitpack.cpp rename to indra/llcommon/llbitpack.cpp index cdcaba076577edf2cfdbd62a1a2883b5d243b8c1..622a099945c6100ba959f3e6e28b9f1469338c47 100755 --- a/indra/llcommon/bitpack.cpp +++ b/indra/llcommon/llbitpack.cpp @@ -27,4 +27,4 @@ #include "linden_common.h" // implementation is all in the header, this include dep ensures the unit test is rerun if the implementation changes. -#include "bitpack.h" +#include "llbitpack.h" diff --git a/indra/llcommon/bitpack.h b/indra/llcommon/llbitpack.h similarity index 91% rename from indra/llcommon/bitpack.h rename to indra/llcommon/llbitpack.h index 037300dd144a5ffccbd1119a4912f442d8afb124..f99a354cd44d4a2c8fa910e4732731beb5621812 100755 --- a/indra/llcommon/bitpack.h +++ b/indra/llcommon/llbitpack.h @@ -1,5 +1,5 @@ /** - * @file bitpack.h + * @file llbitpack.h * @brief Convert data to packed bit stream * * $LicenseInfo:firstyear=2000&license=viewerlgpl$ @@ -79,7 +79,7 @@ class LLBitPack *(mBuffer + mBufferSize++) = mLoad; if (mBufferSize > mMaxSize) { - llerror("mBufferSize exceeding mMaxSize!", 0); + LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL; } mLoadSize = 0; mLoad = 0x00; @@ -122,7 +122,7 @@ class LLBitPack *(mBuffer + mBufferSize++) = mLoad; if (mBufferSize > mMaxSize) { - llerror("mBufferSize exceeding mMaxSize!", 0); + LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL; } mLoadSize = 0; mLoad = 0x00; @@ -165,8 +165,8 @@ class LLBitPack #ifdef _DEBUG if (mBufferSize > mMaxSize) { - llerrs << "mBufferSize exceeding mMaxSize" << llendl; - llerrs << mBufferSize << " > " << mMaxSize << llendl; + LL_ERRS() << "mBufferSize exceeding mMaxSize" << LL_ENDL; + LL_ERRS() << mBufferSize << " > " << mMaxSize << LL_ENDL; } #endif mLoad = *(mBuffer + mBufferSize++); @@ -190,7 +190,7 @@ class LLBitPack *(mBuffer + mBufferSize++) = mLoad; if (mBufferSize > mMaxSize) { - llerror("mBufferSize exceeding mMaxSize!", 0); + LL_ERRS() << "mBufferSize exceeding mMaxSize!" << LL_ENDL; } mLoadSize = 0; } diff --git a/indra/llcommon/llclickaction.h b/indra/llcommon/llclickaction.h old mode 100755 new mode 100644 index 1f87d8eec3a87d8e52eb7cd9a02ca06e3daed2cf..2f83113af9334a044c5107fc8c73407e935f7a86 --- a/indra/llcommon/llclickaction.h +++ b/indra/llcommon/llclickaction.h @@ -27,15 +27,4 @@ #ifndef LL_LLCLICKACTION_H #define LL_LLCLICKACTION_H -// DO NOT CHANGE THE SEQUENCE OF THIS LIST!! -const U8 CLICK_ACTION_NONE = 0; -const U8 CLICK_ACTION_TOUCH = 0; -const U8 CLICK_ACTION_SIT = 1; -const U8 CLICK_ACTION_BUY = 2; -const U8 CLICK_ACTION_PAY = 3; -const U8 CLICK_ACTION_OPEN = 4; -const U8 CLICK_ACTION_PLAY = 5; -const U8 CLICK_ACTION_OPEN_MEDIA = 6; -const U8 CLICK_ACTION_ZOOM = 7; -// DO NOT CHANGE THE SEQUENCE OF THIS LIST!! #endif diff --git a/indra/llcommon/llcommon.cpp b/indra/llcommon/llcommon.cpp index b938b0e65a73e456d79fce7ae1d43428e2bf8095..19642b0982f4680f7ea459580fb28566e86d54f5 100755 --- a/indra/llcommon/llcommon.cpp +++ b/indra/llcommon/llcommon.cpp @@ -29,10 +29,14 @@ #include "llmemory.h" #include "llthread.h" +#include "lltrace.h" +#include "lltracethreadrecorder.h" //static BOOL LLCommon::sAprInitialized = FALSE; +static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL; + //static void LLCommon::initClass() { @@ -45,15 +49,19 @@ void LLCommon::initClass() LLTimer::initClass(); LLThreadSafeRefCount::initThreadSafeRefCount(); assert_main_thread(); // Make sure we record the main thread -// LLWorkerThread::initClass(); -// LLFrameCallbackManager::initClass(); + if (!sMasterThreadRecorder) + { + sMasterThreadRecorder = new LLTrace::ThreadRecorder(); + LLTrace::set_master_thread_recorder(sMasterThreadRecorder); + } } //static void LLCommon::cleanupClass() { -// LLFrameCallbackManager::cleanupClass(); -// LLWorkerThread::cleanupClass(); + delete sMasterThreadRecorder; + sMasterThreadRecorder = NULL; + LLTrace::set_master_thread_recorder(NULL); LLThreadSafeRefCount::cleanupThreadSafeRefCount(); LLTimer::cleanupClass(); if (sAprInitialized) diff --git a/indra/llcommon/llcommonutils.h b/indra/llcommon/llcommonutils.h index 755dc41fb4c1dfe98c68b7a500a7009918450eb3..20ada27830835d4bb6f78dede5144c2d936dd873 100755 --- a/indra/llcommon/llcommonutils.h +++ b/indra/llcommon/llcommonutils.h @@ -27,6 +27,8 @@ #ifndef LL_LLCOMMONUTILS_H #define LL_LLCOMMONUTILS_H +#include "lluuid.h" + namespace LLCommonUtils { /** diff --git a/indra/llcommon/llcrc.cpp b/indra/llcommon/llcrc.cpp index e80da0bb0dc2188c716af01f4b5ace0f6ef810f5..626bb1e564265e58398f72d57f6e2e6bedb84b07 100755 --- a/indra/llcommon/llcrc.cpp +++ b/indra/llcommon/llcrc.cpp @@ -162,7 +162,7 @@ void LLCRC::update(const std::string& filename) { if (filename.empty()) { - llerrs << "No filename specified" << llendl; + LL_ERRS() << "No filename specified" << LL_ENDL; return; } @@ -185,7 +185,7 @@ void LLCRC::update(const std::string& filename) if (nread < (size_t) size) { - llwarns << "Short read on " << filename << llendl; + LL_WARNS() << "Short read on " << filename << LL_ENDL; } update(data, nread); diff --git a/indra/llcommon/llcrc.h b/indra/llcommon/llcrc.h index 2d291d92a12e82d483a038bd306589fad9bac2dc..3f41b28ffa12ec4154dce7a120a25c40b905b43c 100755 --- a/indra/llcommon/llcrc.h +++ b/indra/llcommon/llcrc.h @@ -41,7 +41,7 @@ // crc.update(fgetc(fp)); // } // fclose(fp); -// llinfos << "File crc: " << crc.getCRC() << llendl; +// LL_INFOS() << "File crc: " << crc.getCRC() << LL_ENDL; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LL_COMMON_API LLCRC diff --git a/indra/llcommon/llcriticaldamp.cpp b/indra/llcommon/llcriticaldamp.cpp index 49aac9ce7529d054196554e532839811af9fc601..54be855f6706421e9ca7eed6e4713e2472e947da 100755 --- a/indra/llcommon/llcriticaldamp.cpp +++ b/indra/llcommon/llcriticaldamp.cpp @@ -27,18 +27,38 @@ #include "linden_common.h" #include "llcriticaldamp.h" +#include <algorithm> //----------------------------------------------------------------------------- // static members //----------------------------------------------------------------------------- -LLFrameTimer LLCriticalDamp::sInternalTimer; -std::map<F32, F32> LLCriticalDamp::sInterpolants; -F32 LLCriticalDamp::sTimeDelta; +LLFrameTimer LLSmoothInterpolation::sInternalTimer; +std::vector<LLSmoothInterpolation::Interpolant> LLSmoothInterpolation::sInterpolants; +F32 LLSmoothInterpolation::sTimeDelta; + +// helper functors +struct LLSmoothInterpolation::CompareTimeConstants +{ + bool operator()(const F32& a, const LLSmoothInterpolation::Interpolant& b) const + { + return a < b.mTimeScale; + } + + bool operator()(const LLSmoothInterpolation::Interpolant& a, const F32& b) const + { + return a.mTimeScale < b; // bottom of a is higher than bottom of b + } + + bool operator()(const LLSmoothInterpolation::Interpolant& a, const LLSmoothInterpolation::Interpolant& b) const + { + return a.mTimeScale < b.mTimeScale; // bottom of a is higher than bottom of b + } +}; //----------------------------------------------------------------------------- -// LLCriticalDamp() +// LLSmoothInterpolation() //----------------------------------------------------------------------------- -LLCriticalDamp::LLCriticalDamp() +LLSmoothInterpolation::LLSmoothInterpolation() { sTimeDelta = 0.f; } @@ -47,44 +67,55 @@ LLCriticalDamp::LLCriticalDamp() //----------------------------------------------------------------------------- // updateInterpolants() //----------------------------------------------------------------------------- -void LLCriticalDamp::updateInterpolants() +void LLSmoothInterpolation::updateInterpolants() { sTimeDelta = sInternalTimer.getElapsedTimeAndResetF32(); - F32 time_constant; - - for (std::map<F32, F32>::iterator iter = sInterpolants.begin(); - iter != sInterpolants.end(); iter++) + for (S32 i = 0; i < sInterpolants.size(); i++) { - time_constant = iter->first; - F32 new_interpolant = 1.f - pow(2.f, -sTimeDelta / time_constant); - new_interpolant = llclamp(new_interpolant, 0.f, 1.f); - sInterpolants[time_constant] = new_interpolant; + Interpolant& interp = sInterpolants[i]; + interp.mInterpolant = calcInterpolant(interp.mTimeScale); } } //----------------------------------------------------------------------------- // getInterpolant() //----------------------------------------------------------------------------- -F32 LLCriticalDamp::getInterpolant(const F32 time_constant, BOOL use_cache) +F32 LLSmoothInterpolation::getInterpolant(F32SecondsImplicit time_constant, bool use_cache) { if (time_constant == 0.f) { return 1.f; } - if (use_cache && sInterpolants.count(time_constant)) + if (use_cache) { - return sInterpolants[time_constant]; + interpolant_vec_t::iterator find_it = std::lower_bound(sInterpolants.begin(), sInterpolants.end(), time_constant.value(), CompareTimeConstants()); + if (find_it != sInterpolants.end() && find_it->mTimeScale == time_constant) + { + return find_it->mInterpolant; + } + else + { + Interpolant interp; + interp.mTimeScale = time_constant.value(); + interp.mInterpolant = calcInterpolant(time_constant.value()); + sInterpolants.insert(find_it, interp); + return interp.mInterpolant; + } } - - F32 interpolant = 1.f - pow(2.f, -sTimeDelta / time_constant); - interpolant = llclamp(interpolant, 0.f, 1.f); - if (use_cache) + else { - sInterpolants[time_constant] = interpolant; + return calcInterpolant(time_constant.value()); + } +} - return interpolant; +//----------------------------------------------------------------------------- +// calcInterpolant() +//----------------------------------------------------------------------------- +F32 LLSmoothInterpolation::calcInterpolant(F32 time_constant) +{ + return llclamp(1.f - powf(2.f, -sTimeDelta / time_constant), 0.f, 1.f); } diff --git a/indra/llcommon/llcriticaldamp.h b/indra/llcommon/llcriticaldamp.h index 52f052ae250c0d5a2f7dfe52713913e750fb76ef..1fb6a1af29fb1a2e4fd2b2a0da619c3efc341c61 100755 --- a/indra/llcommon/llcriticaldamp.h +++ b/indra/llcommon/llcriticaldamp.h @@ -28,26 +28,46 @@ #ifndef LL_LLCRITICALDAMP_H #define LL_LLCRITICALDAMP_H -#include <map> +#include <vector> #include "llframetimer.h" +#include "llunits.h" -class LL_COMMON_API LLCriticalDamp +class LL_COMMON_API LLSmoothInterpolation { public: - LLCriticalDamp(); + LLSmoothInterpolation(); // MANIPULATORS static void updateInterpolants(); // ACCESSORS - static F32 getInterpolant(const F32 time_constant, BOOL use_cache = TRUE); + static F32 getInterpolant(F32SecondsImplicit time_constant, bool use_cache = true); -protected: + template<typename T> + static T lerp(T a, T b, F32SecondsImplicit time_constant, bool use_cache = true) + { + F32 interpolant = getInterpolant(time_constant, use_cache); + return ((a * (1.f - interpolant)) + + (b * interpolant)); + } + +protected: + static F32 calcInterpolant(F32 time_constant); + + struct CompareTimeConstants; static LLFrameTimer sInternalTimer; // frame timer for calculating deltas - static std::map<F32, F32> sInterpolants; + struct Interpolant + { + F32 mTimeScale; + F32 mInterpolant; + }; + typedef std::vector<Interpolant> interpolant_vec_t; + static interpolant_vec_t sInterpolants; static F32 sTimeDelta; }; +typedef LLSmoothInterpolation LLCriticalDamp; + #endif // LL_LLCRITICALDAMP_H diff --git a/indra/llcommon/lldarray.h b/indra/llcommon/lldarray.h deleted file mode 100755 index 131b819c99148f29c136c77012450ffe6a02de10..0000000000000000000000000000000000000000 --- a/indra/llcommon/lldarray.h +++ /dev/null @@ -1,223 +0,0 @@ -/** - * @file lldarray.h - * @brief Wrapped std::vector for backward compatibility. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLDARRAY_H -#define LL_LLDARRAY_H - -#include "llerror.h" - -#include <vector> -#include <map> - -// class LLDynamicArray<>; // = std::vector + reserves <BlockSize> elements -// class LLDynamicArrayIndexed<>; // = std::vector + std::map if indices, only supports operator[] and begin(),end() - -//-------------------------------------------------------- -// LLDynamicArray declaration -//-------------------------------------------------------- -// NOTE: BlockSize is used to reserve a minimal initial amount -template <typename Type, int BlockSize = 32> -class LLDynamicArray : public std::vector<Type> -{ -public: - enum - { - OKAY = 0, - FAIL = -1 - }; - - LLDynamicArray(S32 size=0) : std::vector<Type>(size) { if (size < BlockSize) std::vector<Type>::reserve(BlockSize); } - - void reset() { std::vector<Type>::clear(); } - - // ACCESSORS - const Type& get(S32 index) const { return std::vector<Type>::operator[](index); } - Type& get(S32 index) { return std::vector<Type>::operator[](index); } - S32 find(const Type &obj) const; - - S32 count() const { return std::vector<Type>::size(); } - S32 getLength() const { return std::vector<Type>::size(); } - S32 getMax() const { return std::vector<Type>::capacity(); } - - // MANIPULATE - S32 put(const Type &obj); // add to end of array, returns index -// Type* reserve(S32 num); // reserve a block of indices in advance - Type* reserve_block(U32 num); // reserve a block of indices in advance - - S32 remove(S32 index); // remove by index, no bounds checking - S32 removeObj(const Type &obj); // remove by object - S32 removeLast(); - - void operator+=(const LLDynamicArray<Type,BlockSize> &other); -}; - -//-------------------------------------------------------- -// LLDynamicArray implementation -//-------------------------------------------------------- - -template <typename Type,int BlockSize> -inline S32 LLDynamicArray<Type,BlockSize>::find(const Type &obj) const -{ - typename std::vector<Type>::const_iterator iter = std::find(this->begin(), this->end(), obj); - if (iter != this->end()) - { - return iter - this->begin(); - } - return FAIL; -} - - -template <typename Type,int BlockSize> -inline S32 LLDynamicArray<Type,BlockSize>::remove(S32 i) -{ - // This is a fast removal by swapping with the last element - S32 sz = this->size(); - if (i < 0 || i >= sz) - { - return FAIL; - } - if (i < sz-1) - { - this->operator[](i) = this->back(); - } - this->pop_back(); - return i; -} - -template <typename Type,int BlockSize> -inline S32 LLDynamicArray<Type,BlockSize>::removeObj(const Type& obj) -{ - typename std::vector<Type>::iterator iter = std::find(this->begin(), this->end(), obj); - if (iter != this->end()) - { - S32 res = iter - this->begin(); - typename std::vector<Type>::iterator last = this->end(); - --last; - *iter = *last; - this->pop_back(); - return res; - } - return FAIL; -} - -template <typename Type,int BlockSize> -inline S32 LLDynamicArray<Type,BlockSize>::removeLast() -{ - if (!this->empty()) - { - this->pop_back(); - return OKAY; - } - return FAIL; -} - -template <typename Type,int BlockSize> -inline Type* LLDynamicArray<Type,BlockSize>::reserve_block(U32 num) -{ - U32 sz = this->size(); - this->resize(sz+num); - return &(this->operator[](sz)); -} - -template <typename Type,int BlockSize> -inline S32 LLDynamicArray<Type,BlockSize>::put(const Type &obj) -{ - this->push_back(obj); - return this->size() - 1; -} - -template <typename Type,int BlockSize> -inline void LLDynamicArray<Type,BlockSize>::operator+=(const LLDynamicArray<Type,BlockSize> &other) -{ - insert(this->end(), other.begin(), other.end()); -} - -//-------------------------------------------------------- -// LLDynamicArrayIndexed declaration -//-------------------------------------------------------- - -template <typename Type, typename Key, int BlockSize = 32> -class LLDynamicArrayIndexed -{ -public: - typedef typename std::vector<Type>::iterator iterator; - typedef typename std::vector<Type>::const_iterator const_iterator; - typedef typename std::vector<Type>::reverse_iterator reverse_iterator; - typedef typename std::vector<Type>::const_reverse_iterator const_reverse_iterator; - typedef typename std::vector<Type>::size_type size_type; -protected: - std::vector<Type> mVector; - std::map<Key, U32> mIndexMap; - -public: - LLDynamicArrayIndexed() { mVector.reserve(BlockSize); } - - iterator begin() { return mVector.begin(); } - const_iterator begin() const { return mVector.begin(); } - iterator end() { return mVector.end(); } - const_iterator end() const { return mVector.end(); } - - reverse_iterator rbegin() { return mVector.rbegin(); } - const_reverse_iterator rbegin() const { return mVector.rbegin(); } - reverse_iterator rend() { return mVector.rend(); } - const_reverse_iterator rend() const { return mVector.rend(); } - - void reset() { mVector.resize(0); mIndexMap.resize(0); } - bool empty() const { return mVector.empty(); } - size_type size() const { return mVector.size(); } - - Type& operator[](const Key& k) - { - typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); - if (iter == mIndexMap.end()) - { - U32 n = mVector.size(); - mIndexMap[k] = n; - mVector.push_back(Type()); - llassert(mVector.size() == mIndexMap.size()); - return mVector[n]; - } - else - { - return mVector[iter->second]; - } - } - - const_iterator find(const Key& k) const - { - typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); - if(iter == mIndexMap.end()) - { - return mVector.end(); - } - else - { - return mVector.begin() + iter->second; - } - } -}; - -#endif diff --git a/indra/llcommon/lldate.cpp b/indra/llcommon/lldate.cpp index 030ef6a3c73652b03dfb17c01607390b80415bc0..7a2a0869f49188aed322188496952e7c494de994 100755 --- a/indra/llcommon/lldate.cpp +++ b/indra/llcommon/lldate.cpp @@ -39,6 +39,7 @@ #include "lltimer.h" #include "llstring.h" +#include "llfasttimer.h" static const F64 DATE_EPOCH = 0.0; @@ -48,25 +49,22 @@ static const F64 LL_APR_USEC_PER_SEC = 1000000.0; LLDate::LLDate() : mSecondsSinceEpoch(DATE_EPOCH) -{ -} +{} LLDate::LLDate(const LLDate& date) : mSecondsSinceEpoch(date.mSecondsSinceEpoch) -{ -} +{} -LLDate::LLDate(F64 seconds_since_epoch) : - mSecondsSinceEpoch(seconds_since_epoch) -{ -} +LLDate::LLDate(F64SecondsImplicit seconds_since_epoch) : + mSecondsSinceEpoch(seconds_since_epoch.value()) +{} LLDate::LLDate(const std::string& iso8601_date) { if(!fromString(iso8601_date)) { - llwarns << "date " << iso8601_date << " failed to parse; " - << "ZEROING IT OUT" << llendl; + LL_WARNS() << "date " << iso8601_date << " failed to parse; " + << "ZEROING IT OUT" << LL_ENDL; mSecondsSinceEpoch = DATE_EPOCH; } } @@ -88,11 +86,11 @@ std::string LLDate::asRFC1123() const return toHTTPDateString (std::string ("%A, %d %b %Y %H:%M:%S GMT")); } -LLFastTimer::DeclareTimer FT_DATE_FORMAT("Date Format"); +LLTrace::BlockTimerStatHandle FT_DATE_FORMAT("Date Format"); std::string LLDate::toHTTPDateString (std::string fmt) const { - LLFastTimer ft1(FT_DATE_FORMAT); + LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT); time_t locSeconds = (time_t) mSecondsSinceEpoch; struct tm * gmt = gmtime (&locSeconds); @@ -101,7 +99,7 @@ std::string LLDate::toHTTPDateString (std::string fmt) const std::string LLDate::toHTTPDateString (tm * gmt, std::string fmt) { - LLFastTimer ft1(FT_DATE_FORMAT); + LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT); // avoid calling setlocale() unnecessarily - it's expensive. static std::string prev_locale = ""; diff --git a/indra/llcommon/lldate.h b/indra/llcommon/lldate.h index 7ff8b550adfc6c35008bf70af312db49d12f2526..be2cd2d05104496de8cc0292cb6f255cac54c1c6 100755 --- a/indra/llcommon/lldate.h +++ b/indra/llcommon/lldate.h @@ -33,6 +33,7 @@ #include <string> #include "stdtypes.h" +#include "llunits.h" /** * @class LLDate @@ -56,9 +57,9 @@ class LL_COMMON_API LLDate /** * @brief Construct a date from a seconds since epoch value. * - * @pararm seconds_since_epoch The number of seconds since UTC epoch. + * @param seconds_since_epoch The number of seconds since UTC epoch. */ - LLDate(F64 seconds_since_epoch); + LLDate(F64SecondsImplicit seconds_since_epoch); /** * @brief Construct a date from a string representation diff --git a/indra/llcommon/lldeadmantimer.cpp b/indra/llcommon/lldeadmantimer.cpp index 7d9097e344313044507134d781fa3c48dfd756f9..830443b956ceaa63213d45341d2c231712938d4f 100644 --- a/indra/llcommon/lldeadmantimer.cpp +++ b/indra/llcommon/lldeadmantimer.cpp @@ -43,7 +43,7 @@ // true true Not allowed // LLDeadmanTimer::LLDeadmanTimer(F64 horizon, bool inc_cpu) - : mHorizon(time_type(llmax(horizon, F64(0.0)) * gClockFrequency)), + : mHorizon(time_type(llmax(horizon, F64(0.0)) * get_timer_info().mClockFrequency)), mActive(false), // If true, a timer is running. mDone(false), // If true, timer has completed and can be read (once) mStarted(U64L(0)), @@ -144,8 +144,8 @@ bool LLDeadmanTimer::isExpired(time_type now, F64 & started, F64 & stopped, U64 return false; } - started = mStarted * gClockFrequencyInv; - stopped = mStopped * gClockFrequencyInv; + started = mStarted * get_timer_info().mClockFrequencyInv; + stopped = mStopped * get_timer_info().mClockFrequencyInv; count = mCount; mDone = false; diff --git a/indra/llcommon/lldeleteutils.h b/indra/llcommon/lldeleteutils.h deleted file mode 100755 index f250dc3028ee36d19b0e648591b6a4ab94db54f2..0000000000000000000000000000000000000000 --- a/indra/llcommon/lldeleteutils.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file lldeleteutils.h - * @brief Utility functions to simplify some common pointer-munging idioms. - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#ifndef LL_DELETE_UTILS_H -#define LL_DELETE_UTILS_H - -// Simple utility functions to eventually replace the common 2-line -// idiom scattered throughout the viewer codebase. Note that where -// possible we would rather be using smart pointers of some sort. - -template <class T> -inline void deleteAndClear(T*& ptr) -{ - delete ptr; - ptr = NULL; -} - -template <class T> -inline void deleteAndClearArray(T*& array_ptr) -{ - delete[] array_ptr; - array_ptr = NULL; -} - -#endif diff --git a/indra/llcommon/lldepthstack.h b/indra/llcommon/lldepthstack.h index d9db54efc77894719d079b75fb7d69785a0a3ac5..b65840d342cc7176a383f22aa421b7d2bf3f0fd7 100755 --- a/indra/llcommon/lldepthstack.h +++ b/indra/llcommon/lldepthstack.h @@ -27,18 +27,19 @@ #ifndef LL_LLDEPTHSTACK_H #define LL_LLDEPTHSTACK_H -#include "linked_lists.h" +#include "llstl.h" template <class DATA_TYPE> class LLDepthStack { private: - LLLinkedList<DATA_TYPE> mStack; + std::deque<DATA_TYPE*> mStack; U32 mCurrentDepth; U32 mMaxDepth; public: - LLDepthStack() : mCurrentDepth(0), mMaxDepth(0) {} - ~LLDepthStack() {} + LLDepthStack() + : mCurrentDepth(0), mMaxDepth(0) + {} void setDepth(U32 depth) { @@ -54,24 +55,27 @@ template <class DATA_TYPE> class LLDepthStack { if (mCurrentDepth < mMaxDepth) { - mStack.addData(data); + mStack.push_back(data); mCurrentDepth++; } else { // the last item falls off stack and is deleted - mStack.getLastData(); - mStack.deleteCurrentData(); - mStack.addData(data); + if (!mStack.empty()) + { + mStack.pop_front(); + } + mStack.push_back(data); } } DATA_TYPE *pop() { - DATA_TYPE *tempp = mStack.getFirstData(); - if (tempp) + DATA_TYPE *tempp = NULL; + if (!mStack.empty()) { - mStack.removeCurrentData(); + tempp = mStack.back(); + mStack.pop_back(); mCurrentDepth--; } return tempp; @@ -79,20 +83,13 @@ template <class DATA_TYPE> class LLDepthStack DATA_TYPE *check() { - DATA_TYPE *tempp = mStack.getFirstData(); - return tempp; + return mStack.empty() ? NULL : mStack.back(); } - - void deleteAllData() - { - mCurrentDepth = 0; - mStack.deleteAllData(); - } - + void removeAllNodes() { mCurrentDepth = 0; - mStack.removeAllNodes(); + mStack.clear(); } }; diff --git a/indra/llcommon/lldictionary.h b/indra/llcommon/lldictionary.h index c752859a3661f1116f8bc41ec43a36282dfc40ad..5800ec5e5d8541ded1f8c651550b194511645642 100755 --- a/indra/llcommon/lldictionary.h +++ b/indra/llcommon/lldictionary.h @@ -89,7 +89,7 @@ class LLDictionary : public std::map<Index, Entry *> { if (lookup(index)) { - llerrs << "Dictionary entry already added (attempted to add duplicate entry)" << llendl; + LL_ERRS() << "Dictionary entry already added (attempted to add duplicate entry)" << LL_ENDL; } (*this)[index] = entry; } diff --git a/indra/llcommon/lldlinked.h b/indra/llcommon/lldlinked.h deleted file mode 100755 index 3f7c197be7b32967e815f30bba53df3ee59ce53d..0000000000000000000000000000000000000000 --- a/indra/llcommon/lldlinked.h +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @file lldlinked.h - * @brief Declaration of the LLDLinked class. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#ifndef LL_LLDLINKED_H -#define LL_LLDLINKED_H - -template <class Type> class LLDLinked -{ - LLDLinked* mNextp; - LLDLinked* mPrevp; -public: - - Type* getNext() { return (Type*)mNextp; } - Type* getPrev() { return (Type*)mPrevp; } - Type* getFirst() { return (Type*)mNextp; } - - void init() - { - mNextp = mPrevp = NULL; - } - - void unlink() - { - if (mPrevp) mPrevp->mNextp = mNextp; - if (mNextp) mNextp->mPrevp = mPrevp; - } - - LLDLinked() { mNextp = mPrevp = NULL; } - virtual ~LLDLinked() { unlink(); } - - virtual void deleteAll() - { - Type *curp = getFirst(); - while(curp) - { - Type *nextp = curp->getNext(); - curp->unlink(); - delete curp; - curp = nextp; - } - } - - void relink(Type &after) - { - LLDLinked *afterp = (LLDLinked*)&after; - afterp->mPrevp = this; - mNextp = afterp; - } - - virtual void append(Type& after) - { - LLDLinked *afterp = (LLDLinked*)&after; - afterp->mPrevp = this; - afterp->mNextp = mNextp; - if (mNextp) mNextp->mPrevp = afterp; - mNextp = afterp; - } - - virtual void insert(Type& before) - { - LLDLinked *beforep = (LLDLinked*)&before; - beforep->mNextp = this; - beforep->mPrevp = mPrevp; - if (mPrevp) mPrevp->mNextp = beforep; - mPrevp = beforep; - } - - virtual void put(Type& obj) { append(obj); } -}; - -#endif diff --git a/indra/llcommon/lldqueueptr.h b/indra/llcommon/lldqueueptr.h deleted file mode 100755 index 9fe08191e175399b0db99781308f03663d84f493..0000000000000000000000000000000000000000 --- a/indra/llcommon/lldqueueptr.h +++ /dev/null @@ -1,352 +0,0 @@ -/** - * @file lldqueueptr.h - * @brief LLDynamicQueuePtr declaration - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#ifndef LL_LLDQUEUEPTR_H -#define LL_LLDQUEUEPTR_H - -template <class Type> -class LLDynamicQueuePtr -{ -public: - enum - { - OKAY = 0, - FAIL = -1 - }; - - LLDynamicQueuePtr(const S32 size=8); - ~LLDynamicQueuePtr(); - - void init(); - void destroy(); - void reset(); - void reallocate(U32 newsize); - - // ACCESSORS - const Type& get(const S32 index) const; // no bounds checking - Type& get(const S32 index); // no bounds checking - const Type& operator [] (const S32 index) const { return get(index); } - Type& operator [] (const S32 index) { return get(index); } - S32 find(const Type &obj) const; - - S32 count() const { return (mLastObj >= mFirstObj ? mLastObj - mFirstObj : mLastObj + mMaxObj - mFirstObj); } - S32 getMax() const { return mMaxObj; } - S32 getFirst() const { return mFirstObj; } - S32 getLast () const { return mLastObj; } - - // MANIPULATE - S32 push(const Type &obj); // add to end of Queue, returns index from start - S32 pull( Type &obj); // pull from Queue, returns index from start - - S32 remove (S32 index); // remove by index - S32 removeObj(const Type &obj); // remove by object - -protected: - S32 mFirstObj, mLastObj, mMaxObj; - Type* mMemory; - -public: - - void print() - { - /* - Convert this to llinfos if it's intended to be used - djs 08/30/02 - - printf("Printing from %d to %d (of %d): ",mFirstObj, mLastObj, mMaxObj); - - if (mFirstObj <= mLastObj) - { - for (S32 i=mFirstObj;i<mLastObj;i++) - { - printf("%d ",mMemory[i]); - } - } - else - { - for (S32 i=mFirstObj;i<mMaxObj;i++) - { - printf("%d ",mMemory[i]); - } - for (i=0;i<mLastObj;i++) - { - printf("%d ",mMemory[i]); - } - } - printf("\n"); - */ - } - -}; - - -//-------------------------------------------------------- -// LLDynamicQueuePtrPtr implementation -//-------------------------------------------------------- - - -template <class Type> -inline LLDynamicQueuePtr<Type>::LLDynamicQueuePtr(const S32 size) -{ - init(); - reallocate(size); -} - -template <class Type> -inline LLDynamicQueuePtr<Type>::~LLDynamicQueuePtr() -{ - destroy(); -} - -template <class Type> -inline void LLDynamicQueuePtr<Type>::init() -{ - mFirstObj = 0; - mLastObj = 0; - mMaxObj = 0; - mMemory = NULL; -} - -template <class Type> -inline void LLDynamicQueuePtr<Type>::reallocate(U32 newsize) -{ - if (newsize) - { - if (mFirstObj > mLastObj && newsize > mMaxObj) - { - Type* new_memory = new Type[newsize]; - - llassert(new_memory); - - S32 _count = count(); - S32 i, m = 0; - for (i=mFirstObj; i < mMaxObj; i++) - { - new_memory[m++] = mMemory[i]; - } - for (i=0; i <=mLastObj; i++) - { - new_memory[m++] = mMemory[i]; - } - - delete[] mMemory; - mMemory = new_memory; - - mFirstObj = 0; - mLastObj = _count; - } - else - { - Type* new_memory = new Type[newsize]; - - llassert(new_memory); - - S32 i, m = 0; - for (i=0; i < mLastObj; i++) - { - new_memory[m++] = mMemory[i]; - } - delete[] mMemory; - mMemory = new_memory; - } - } - else if (mMemory) - { - delete[] mMemory; - mMemory = NULL; - } - - mMaxObj = newsize; -} - -template <class Type> -inline void LLDynamicQueuePtr<Type>::destroy() -{ - reset(); - delete[] mMemory; - mMemory = NULL; -} - - -template <class Type> -void LLDynamicQueuePtr<Type>::reset() -{ - for (S32 i=0; i < mMaxObj; i++) - { - get(i) = NULL; // unrefs for pointers - } - - mFirstObj = 0; - mLastObj = 0; -} - - -template <class Type> -inline S32 LLDynamicQueuePtr<Type>::find(const Type &obj) const -{ - S32 i; - if (mFirstObj <= mLastObj) - { - for ( i = mFirstObj; i < mLastObj; i++ ) - { - if (mMemory[i] == obj) - { - return i; - } - } - } - else - { - for ( i = mFirstObj; i < mMaxObj; i++ ) - { - if (mMemory[i] == obj) - { - return i; - } - } - for ( i = 0; i < mLastObj; i++ ) - { - if (mMemory[i] == obj) - { - return i; - } - } - } - - return FAIL; -} - -template <class Type> -inline S32 LLDynamicQueuePtr<Type>::remove(S32 i) -{ - if (mFirstObj > mLastObj) - { - if (i >= mFirstObj && i < mMaxObj) - { - while( i > mFirstObj) - { - mMemory[i] = mMemory[i-1]; - i--; - } - mMemory[mFirstObj] = NULL; - mFirstObj++; - if (mFirstObj >= mMaxObj) mFirstObj = 0; - - return count(); - } - else if (i < mLastObj && i >= 0) - { - while(i < mLastObj) - { - mMemory[i] = mMemory[i+1]; - i++; - } - mMemory[mLastObj] = NULL; - mLastObj--; - if (mLastObj < 0) mLastObj = mMaxObj-1; - - return count(); - } - } - else if (i <= mLastObj && i >= mFirstObj) - { - while(i < mLastObj) - { - mMemory[i] = mMemory[i+1]; - i++; - } - mMemory[mLastObj] = NULL; - mLastObj--; - if (mLastObj < 0) mLastObj = mMaxObj-1; - - return count(); - } - - - return FAIL; -} - -template <class Type> -inline S32 LLDynamicQueuePtr<Type>::removeObj(const Type& obj) -{ - S32 ind = find(obj); - if (ind >= 0) - { - return remove(ind); - } - return FAIL; -} - -template <class Type> -inline S32 LLDynamicQueuePtr<Type>::push(const Type &obj) -{ - if (mMaxObj - count() <= 1) - { - reallocate(mMaxObj * 2); - } - - mMemory[mLastObj++] = obj; - - if (mLastObj >= mMaxObj) - { - mLastObj = 0; - } - - return count(); -} - -template <class Type> -inline S32 LLDynamicQueuePtr<Type>::pull(Type &obj) -{ - obj = NULL; - - if (count() < 1) return -1; - - obj = mMemory[mFirstObj]; - mMemory[mFirstObj] = NULL; - - mFirstObj++; - - if (mFirstObj >= mMaxObj) - { - mFirstObj = 0; - } - - return count(); -} - -template <class Type> -inline const Type& LLDynamicQueuePtr<Type>::get(const S32 i) const -{ - return mMemory[i]; -} - -template <class Type> -inline Type& LLDynamicQueuePtr<Type>::get(const S32 i) -{ - return mMemory[i]; -} - - -#endif // LL_LLDQUEUEPTR_H diff --git a/indra/llcommon/llenum.h b/indra/llcommon/llenum.h deleted file mode 100755 index f57b2bc0b59b5b857ec3a050ec0a87afdf85b316..0000000000000000000000000000000000000000 --- a/indra/llcommon/llenum.h +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file llenum.h - * @author Tom Yedwab - * @brief Utility class for storing enum value <-> string lookup. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLENUM_H -#define LL_LLENUM_H - -class LLEnum -{ -public: - typedef std::pair<const std::string, const U32> enum_t; - enum - { - UNDEFINED = 0xffffffff, - }; - - LLEnum(const enum_t values_array[], const U32 length) - { - for (U32 i=0; i<length; ++i) - { - mEnumMap.insert(values_array[i]); - if (values_array[i].second >= mEnumArray.size()) - { - mEnumArray.resize(values_array[i].second+1); - } - mEnumArray[values_array[i].second] = values_array[i].first; - } - } - - U32 operator[](std::string str) - { - std::map<const std::string, const U32>::iterator itor; - itor = mEnumMap.find(str); - if (itor != mEnumMap.end()) - { - return itor->second; - } - return UNDEFINED; - } - - const std::string operator[](U32 index) - { - if (index < mEnumArray.size()) - { - return mEnumArray[index]; - } - return ""; - } - -private: - std::map<const std::string, const U32> mEnumMap; - std::vector<std::string> mEnumArray; -}; - -#endif // LL_LLENUM_H diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 853f279c95aca53e113fda0de32892e79845e45b..a7963174adde80b2e2541b5103998b8ca130734c 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -51,7 +51,26 @@ #include "lltimer.h" namespace { -#if !LL_WINDOWS +#if LL_WINDOWS + void debugger_print(const std::string& s) + { + // Be careful when calling OutputDebugString as it throws DBG_PRINTEXCEPTION_C + // which works just fine under the windows debugger, but can cause users who + // have enabled SEHOP exception chain validation to crash due to interactions + // between the Win 32-bit exception handling and boost coroutine fiber stacks. BUG-2707 + // + if (IsDebuggerPresent()) + { + // Need UTF16 for Unicode OutputDebugString + // + if (s.size()) + { + OutputDebugString(utf8str_to_utf16str(s).c_str()); + OutputDebugString(TEXT("\n")); + } + } + } +#else class RecordToSyslog : public LLError::Recorder { public: @@ -96,8 +115,9 @@ namespace { mFile.open(filename, llofstream::out | llofstream::app); if (!mFile) { - llinfos << "Error setting log file to " << filename << llendl; + LL_INFOS() << "Error setting log file to " << filename << LL_ENDL; } + mWantsTime = true; } ~RecordToFile() @@ -107,14 +127,10 @@ namespace { bool okay() { return mFile; } - virtual bool wantsTime() { return true; } - virtual void recordMessage(LLError::ELevel level, const std::string& message) { mFile << message << std::endl; - // mFile.flush(); - // *FIX: should we do this? } private: @@ -125,9 +141,10 @@ namespace { class RecordToStderr : public LLError::Recorder { public: - RecordToStderr(bool timestamp) : mTimestamp(timestamp), mUseANSI(ANSI_PROBE) { } - - virtual bool wantsTime() { return mTimestamp; } + RecordToStderr(bool timestamp) : mUseANSI(ANSI_PROBE) + { + mWantsTime = timestamp; + } virtual void recordMessage(LLError::ELevel level, const std::string& message) @@ -158,14 +175,19 @@ namespace { } private: - bool mTimestamp; - enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO}; - ANSIState mUseANSI; + enum ANSIState + { + ANSI_PROBE, + ANSI_YES, + ANSI_NO + } mUseANSI; + void colorANSI(const std::string color) { // ANSI color code escape sequence fprintf(stderr, "\033[%sm", color.c_str() ); }; + bool checkANSI(void) { #if LL_LINUX || LL_DARWIN @@ -198,10 +220,13 @@ namespace { class RecordToWinDebug: public LLError::Recorder { public: + RecordToWinDebug() + {} + virtual void recordMessage(LLError::ELevel level, const std::string& message) { - LL_WINDOWS_OUTPUT_DEBUG(message); + debugger_print(message); } }; #endif @@ -213,7 +238,7 @@ namespace std::string className(const std::type_info& type) { #ifdef __GNUC__ - // GCC: type_info::name() returns a mangled class name, must demangle + // GCC: type_info::name() returns a mangled class name,st demangle static size_t abi_name_len = 100; static char* abi_name_buf = (char*)malloc(abi_name_len); @@ -317,15 +342,15 @@ namespace if (configuration.isUndefined()) { - llwarns << filename() << " missing, ill-formed," + LL_WARNS() << filename() << " missing, ill-formed," " or simply undefined; not changing configuration" - << llendl; + << LL_ENDL; return false; } } LLError::configure(configuration); - llinfos << "logging reconfigured from " << filename() << llendl; + LL_INFOS() << "logging reconfigured from " << filename() << LL_ENDL; return true; } @@ -390,25 +415,25 @@ namespace LLError class Settings { public: - bool printLocation; + bool mPrintLocation; - LLError::ELevel defaultLevel; + LLError::ELevel mDefaultLevel; - LevelMap functionLevelMap; - LevelMap classLevelMap; - LevelMap fileLevelMap; - LevelMap tagLevelMap; - std::map<std::string, unsigned int> uniqueLogMessages; + LevelMap mFunctionLevelMap; + LevelMap mClassLevelMap; + LevelMap mFileLevelMap; + LevelMap mTagLevelMap; + std::map<std::string, unsigned int> mUniqueLogMessages; - LLError::FatalFunction crashFunction; - LLError::TimeFunction timeFunction; + LLError::FatalFunction mCrashFunction; + LLError::TimeFunction mTimeFunction; - Recorders recorders; - Recorder* fileRecorder; - Recorder* fixedBufferRecorder; - std::string fileRecorderFileName; + Recorders mRecorders; + Recorder* mFileRecorder; + Recorder* mFixedBufferRecorder; + std::string mFileRecorderFileName; - int shouldLogCallCounter; + int mShouldLogCallCounter; static Settings& get(); @@ -418,19 +443,19 @@ namespace LLError private: Settings() - : printLocation(false), - defaultLevel(LLError::LEVEL_DEBUG), - crashFunction(), - timeFunction(NULL), - fileRecorder(NULL), - fixedBufferRecorder(NULL), - shouldLogCallCounter(0) + : mPrintLocation(false), + mDefaultLevel(LLError::LEVEL_DEBUG), + mCrashFunction(), + mTimeFunction(NULL), + mFileRecorder(NULL), + mFixedBufferRecorder(NULL), + mShouldLogCallCounter(0) { } ~Settings() { - for_each(recorders.begin(), recorders.end(), DeletePointer()); - recorders.clear(); + for_each(mRecorders.begin(), mRecorders.end(), DeletePointer()); + mRecorders.clear(); } static Settings*& getPtr(); @@ -489,18 +514,64 @@ namespace LLError int line, const std::type_info& class_info, const char* function, - const char* broadTag, - const char* narrowTag, - bool printOnce) - : mLevel(level), mFile(file), mLine(line), - mClassInfo(class_info), mFunction(function), - mCached(false), mShouldLog(false), - mBroadTag(broadTag), mNarrowTag(narrowTag), mPrintOnce(printOnce) - { } + bool printOnce, + const char** tags, + size_t tag_count) + : mLevel(level), + mFile(file), + mLine(line), + mClassInfo(class_info), + mFunction(function), + mCached(false), + mShouldLog(false), + mPrintOnce(printOnce), + mTags(new const char* [tag_count]), + mTagCount(tag_count) + { + for (int i = 0; i < tag_count; i++) + { + mTags[i] = tags[i]; + } + + switch (mLevel) + { + case LEVEL_DEBUG: mLevelString = "DEBUG:"; break; + case LEVEL_INFO: mLevelString = "INFO:"; break; + case LEVEL_WARN: mLevelString = "WARNING:"; break; + case LEVEL_ERROR: mLevelString = "ERROR:"; break; + default: mLevelString = "XXX:"; break; + }; + mLocationString = llformat("%s(%d) :", abbreviateFile(mFile).c_str(), mLine); +#if LL_WINDOWS + // DevStudio: __FUNCTION__ already includes the full class name +#else +#if LL_LINUX + // gross, but typeid comparison seems to always fail here with gcc4.1 + if (0 != strcmp(mClassInfo.name(), typeid(NoClassInfo).name())) +#else + if (mClassInfo != typeid(NoClassInfo)) +#endif // LL_LINUX + { + mFunctionString = className(mClassInfo) + "::"; + } +#endif + mFunctionString += std::string(mFunction) + ":"; + for (size_t i = 0; i < mTagCount; i++) + { + mTagString += std::string("#") + mTags[i] + ((i == mTagCount - 1) ? "" : " "); + } + } + + CallSite::~CallSite() + { + delete []mTags; + } void CallSite::invalidate() - { mCached = false; } + { + mCached = false; + } } namespace @@ -586,25 +657,25 @@ namespace LLError void setPrintLocation(bool print) { Settings& s = Settings::get(); - s.printLocation = print; + s.mPrintLocation = print; } void setFatalFunction(const FatalFunction& f) { Settings& s = Settings::get(); - s.crashFunction = f; + s.mCrashFunction = f; } FatalFunction getFatalFunction() { Settings& s = Settings::get(); - return s.crashFunction; + return s.mCrashFunction; } void setTimeFunction(TimeFunction f) { Settings& s = Settings::get(); - s.timeFunction = f; + s.mTimeFunction = f; } void setDefaultLevel(ELevel level) @@ -612,13 +683,13 @@ namespace LLError Globals& g = Globals::get(); Settings& s = Settings::get(); g.invalidateCallSites(); - s.defaultLevel = level; + s.mDefaultLevel = level; } ELevel getDefaultLevel() { Settings& s = Settings::get(); - return s.defaultLevel; + return s.mDefaultLevel; } void setFunctionLevel(const std::string& function_name, ELevel level) @@ -626,7 +697,7 @@ namespace LLError Globals& g = Globals::get(); Settings& s = Settings::get(); g.invalidateCallSites(); - s.functionLevelMap[function_name] = level; + s.mFunctionLevelMap[function_name] = level; } void setClassLevel(const std::string& class_name, ELevel level) @@ -634,7 +705,7 @@ namespace LLError Globals& g = Globals::get(); Settings& s = Settings::get(); g.invalidateCallSites(); - s.classLevelMap[class_name] = level; + s.mClassLevelMap[class_name] = level; } void setFileLevel(const std::string& file_name, ELevel level) @@ -642,7 +713,7 @@ namespace LLError Globals& g = Globals::get(); Settings& s = Settings::get(); g.invalidateCallSites(); - s.fileLevelMap[file_name] = level; + s.mFileLevelMap[file_name] = level; } void setTagLevel(const std::string& tag_name, ELevel level) @@ -650,7 +721,7 @@ namespace LLError Globals& g = Globals::get(); Settings& s = Settings::get(); g.invalidateCallSites(); - s.tagLevelMap[tag_name] = level; + s.mTagLevelMap[tag_name] = level; } LLError::ELevel decodeLevel(std::string name) @@ -671,7 +742,7 @@ namespace LLError LevelMap::const_iterator i = level_names.find(name); if (i == level_names.end()) { - llwarns << "unrecognized logging level: '" << name << "'" << llendl; + LL_WARNS() << "unrecognized logging level: '" << name << "'" << LL_ENDL; return LLError::LEVEL_INFO; } @@ -698,11 +769,11 @@ namespace LLError Settings& s = Settings::get(); g.invalidateCallSites(); - s.functionLevelMap.clear(); - s.classLevelMap.clear(); - s.fileLevelMap.clear(); - s.tagLevelMap.clear(); - s.uniqueLogMessages.clear(); + s.mFunctionLevelMap.clear(); + s.mClassLevelMap.clear(); + s.mFileLevelMap.clear(); + s.mTagLevelMap.clear(); + s.mUniqueLogMessages.clear(); setPrintLocation(config["print-location"]); setDefaultLevel(decodeLevel(config["default-level"])); @@ -715,10 +786,10 @@ namespace LLError ELevel level = decodeLevel(entry["level"]); - setLevels(s.functionLevelMap, entry["functions"], level); - setLevels(s.classLevelMap, entry["classes"], level); - setLevels(s.fileLevelMap, entry["files"], level); - setLevels(s.tagLevelMap, entry["tags"], level); + setLevels(s.mFunctionLevelMap, entry["functions"], level); + setLevels(s.mClassLevelMap, entry["classes"], level); + setLevels(s.mFileLevelMap, entry["files"], level); + setLevels(s.mTagLevelMap, entry["tags"], level); } } } @@ -726,14 +797,45 @@ namespace LLError namespace LLError { + Recorder::Recorder() + : mWantsTime(false), + mWantsTags(false), + mWantsLevel(true), + mWantsLocation(false), + mWantsFunctionName(true) + {} + Recorder::~Recorder() { } - // virtual bool Recorder::wantsTime() - { return false; } + { + return mWantsTime; + } + // virtual + bool Recorder::wantsTags() + { + return mWantsTags; + } + // virtual + bool Recorder::wantsLevel() + { + return mWantsLevel; + } + + // virtual + bool Recorder::wantsLocation() + { + return mWantsLocation; + } + + // virtual + bool Recorder::wantsFunctionName() + { + return mWantsFunctionName; + } void addRecorder(Recorder* recorder) { @@ -742,7 +844,7 @@ namespace LLError return; } Settings& s = Settings::get(); - s.recorders.push_back(recorder); + s.mRecorders.push_back(recorder); } void removeRecorder(Recorder* recorder) @@ -752,9 +854,8 @@ namespace LLError return; } Settings& s = Settings::get(); - s.recorders.erase( - std::remove(s.recorders.begin(), s.recorders.end(), recorder), - s.recorders.end()); + s.mRecorders.erase(std::remove(s.mRecorders.begin(), s.mRecorders.end(), recorder), + s.mRecorders.end()); } } @@ -764,10 +865,10 @@ namespace LLError { LLError::Settings& s = LLError::Settings::get(); - removeRecorder(s.fileRecorder); - delete s.fileRecorder; - s.fileRecorder = NULL; - s.fileRecorderFileName.clear(); + removeRecorder(s.mFileRecorder); + delete s.mFileRecorder; + s.mFileRecorder = NULL; + s.mFileRecorderFileName.clear(); if (file_name.empty()) { @@ -781,8 +882,8 @@ namespace LLError return; } - s.fileRecorderFileName = file_name; - s.fileRecorder = f; + s.mFileRecorderFileName = file_name; + s.mFileRecorder = f; addRecorder(f); } @@ -790,98 +891,112 @@ namespace LLError { LLError::Settings& s = LLError::Settings::get(); - removeRecorder(s.fixedBufferRecorder); - delete s.fixedBufferRecorder; - s.fixedBufferRecorder = NULL; + removeRecorder(s.mFixedBufferRecorder); + delete s.mFixedBufferRecorder; + s.mFixedBufferRecorder = NULL; if (!fixedBuffer) { return; } - s.fixedBufferRecorder = new RecordToFixedBuffer(fixedBuffer); - addRecorder(s.fixedBufferRecorder); + s.mFixedBufferRecorder = new RecordToFixedBuffer(fixedBuffer); + addRecorder(s.mFixedBufferRecorder); } std::string logFileName() { LLError::Settings& s = LLError::Settings::get(); - return s.fileRecorderFileName; + return s.mFileRecorderFileName; } } namespace { - void writeToRecorders(LLError::ELevel level, const std::string& message) + void writeToRecorders(const LLError::CallSite& site, const std::string& message, bool show_location = true, bool show_time = true, bool show_tags = true, bool show_level = true, bool show_function = true) { + LLError::ELevel level = site.mLevel; LLError::Settings& s = LLError::Settings::get(); - std::string messageWithTime; - - for (Recorders::const_iterator i = s.recorders.begin(); - i != s.recorders.end(); + for (Recorders::const_iterator i = s.mRecorders.begin(); + i != s.mRecorders.end(); ++i) { LLError::Recorder* r = *i; - if (r->wantsTime() && s.timeFunction != NULL) + std::ostringstream message_stream; + + if (show_location && (r->wantsLocation() || level == LLError::LEVEL_ERROR || s.mPrintLocation)) + { + message_stream << site.mLocationString << " "; + } + + if (show_time && r->wantsTime() && s.mTimeFunction != NULL) { - if (messageWithTime.empty()) + message_stream << s.mTimeFunction() << " "; + } + + if (show_level && r->wantsLevel()) { - messageWithTime = s.timeFunction() + " " + message; + message_stream << site.mLevelString << " "; } - r->recordMessage(level, messageWithTime); + if (show_tags && r->wantsTags()) + { + message_stream << site.mTagString << " "; } - else + + if (show_function && r->wantsFunctionName()) { - r->recordMessage(level, message); + message_stream << site.mFunctionString << " "; } + + message_stream << message; + + r->recordMessage(level, message_stream.str()); } } } - -/* -Recorder formats: - -$type = "ERROR" | "WARNING" | "ALERT" | "INFO" | "DEBUG" -$loc = "$file($line)" -$msg = "$loc : " if FATAL or printing loc - "" otherwise -$msg += "$type: " -$msg += contents of stringstream - -$time = "%Y-%m-%dT%H:%M:%SZ" if UTC - or "%Y-%m-%dT%H:%M:%S %Z" if local - -syslog: "$msg" -file: "$time $msg\n" -stderr: "$time $msg\n" except on windows, "$msg\n" -fixedbuf: "$msg" -winddebug: "$msg\n" - -Note: if FATAL, an additional line gets logged first, with $msg set to - "$loc : error" - -You get: - llfoo.cpp(42) : error - llfoo.cpp(42) : ERROR: something - -*/ - namespace { bool checkLevelMap(const LevelMap& map, const std::string& key, LLError::ELevel& level) { + bool stop_checking; LevelMap::const_iterator i = map.find(key); if (i == map.end()) { - return false; + return stop_checking = false; } level = i->second; - return true; + return stop_checking = true; + } + + bool checkLevelMap( const LevelMap& map, + const char *const * keys, + size_t count, + LLError::ELevel& level) + { + bool found_level = false; + + LLError::ELevel tag_level = LLError::LEVEL_NONE; + + for (size_t i = 0; i < count; i++) + { + LevelMap::const_iterator it = map.find(keys[i]); + if (it != map.end()) + { + found_level = true; + tag_level = llmin(tag_level, it->second); + } + } + + if (found_level) + { + level = tag_level; + } + return found_level; } class LogLock @@ -948,9 +1063,9 @@ namespace LLError Globals& g = Globals::get(); Settings& s = Settings::get(); - s.shouldLogCallCounter += 1; + s.mShouldLogCallCounter++; - std::string class_name = className(site.mClassInfo); + const std::string& class_name = className(site.mClassInfo); std::string function_name = functionName(site.mFunction); #if LL_LINUX // gross, but typeid comparison seems to always fail here with gcc4.1 @@ -962,17 +1077,18 @@ namespace LLError function_name = class_name + "::" + function_name; } - ELevel compareLevel = s.defaultLevel; + ELevel compareLevel = s.mDefaultLevel; // The most specific match found will be used as the log level, // since the computation short circuits. // So, in increasing order of importance: - // Default < Broad Tag < File < Class < Function < Narrow Tag - ((site.mNarrowTag != NULL) ? checkLevelMap(s.tagLevelMap, site.mNarrowTag, compareLevel) : false) - || checkLevelMap(s.functionLevelMap, function_name, compareLevel) - || checkLevelMap(s.classLevelMap, class_name, compareLevel) - || checkLevelMap(s.fileLevelMap, abbreviateFile(site.mFile), compareLevel) - || ((site.mBroadTag != NULL) ? checkLevelMap(s.tagLevelMap, site.mBroadTag, compareLevel) : false); + // Default < Tags < File < Class < Function + checkLevelMap(s.mFunctionLevelMap, function_name, compareLevel) + || checkLevelMap(s.mClassLevelMap, class_name, compareLevel) + || checkLevelMap(s.mFileLevelMap, abbreviateFile(site.mFile), compareLevel) + || (site.mTagCount > 0 + ? checkLevelMap(s.mTagLevelMap, site.mTags, site.mTagCount, compareLevel) + : false); site.mCached = true; g.addCallSite(site); @@ -1016,6 +1132,7 @@ namespace LLError } Globals& g = Globals::get(); + if (out == &g.messageStream) { g.messageStream.clear(); @@ -1054,56 +1171,21 @@ namespace LLError if (site.mLevel == LEVEL_ERROR) { - std::ostringstream fatalMessage; - fatalMessage << abbreviateFile(site.mFile) - << "(" << site.mLine << ") : error"; - - writeToRecorders(site.mLevel, fatalMessage.str()); - } - - - std::ostringstream prefix; - - switch (site.mLevel) - { - case LEVEL_DEBUG: prefix << "DEBUG: "; break; - case LEVEL_INFO: prefix << "INFO: "; break; - case LEVEL_WARN: prefix << "WARNING: "; break; - case LEVEL_ERROR: prefix << "ERROR: "; break; - default: prefix << "XXX: "; break; - }; - - if (s.printLocation) - { - prefix << abbreviateFile(site.mFile) - << "(" << site.mLine << ") : "; + writeToRecorders(site, "error", true, true, true, false, false); } - #if LL_WINDOWS - // DevStudio: __FUNCTION__ already includes the full class name - #else - #if LL_LINUX - // gross, but typeid comparison seems to always fail here with gcc4.1 - if (0 != strcmp(site.mClassInfo.name(), typeid(NoClassInfo).name())) - #else - if (site.mClassInfo != typeid(NoClassInfo)) - #endif // LL_LINUX - { - prefix << className(site.mClassInfo) << "::"; - } - #endif - prefix << site.mFunction << ": "; + std::ostringstream message_stream; if (site.mPrintOnce) { - std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message); - if (messageIter != s.uniqueLogMessages.end()) + std::map<std::string, unsigned int>::iterator messageIter = s.mUniqueLogMessages.find(message); + if (messageIter != s.mUniqueLogMessages.end()) { messageIter->second++; unsigned int num_messages = messageIter->second; if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0) { - prefix << "ONCE (" << num_messages << "th time seen): "; + message_stream << "ONCE (" << num_messages << "th time seen): "; } else { @@ -1112,26 +1194,22 @@ namespace LLError } else { - prefix << "ONCE: "; - s.uniqueLogMessages[message] = 1; + message_stream << "ONCE: "; + s.mUniqueLogMessages[message] = 1; } } - prefix << message; - message = prefix.str(); + message_stream << message; - writeToRecorders(site.mLevel, message); + writeToRecorders(site, message_stream.str()); - if (site.mLevel == LEVEL_ERROR && s.crashFunction) + if (site.mLevel == LEVEL_ERROR && s.mCrashFunction) { - s.crashFunction(message); + s.mCrashFunction(message_stream.str()); } } } - - - namespace LLError { Settings* saveAndResetSettings() @@ -1188,7 +1266,7 @@ namespace LLError int shouldLogCallCount() { Settings& s = Settings::get(); - return s.shouldLogCallCounter; + return s.mShouldLogCallCounter; } #if LL_WINDOWS @@ -1376,13 +1454,13 @@ namespace LLError if(sIndex > 0) { - llinfos << " ************* PRINT OUT LL CALL STACKS ************* " << llendl ; + LL_INFOS() << " ************* PRINT OUT LL CALL STACKS ************* " << LL_ENDL; while(sIndex > 0) { sIndex-- ; - llinfos << sBuffer[sIndex] << llendl ; + LL_INFOS() << sBuffer[sIndex] << LL_ENDL; } - llinfos << " *************** END OF LL CALL STACKS *************** " << llendl ; + LL_INFOS() << " *************** END OF LL CALL STACKS *************** " << LL_ENDL; } if(sBuffer) @@ -1399,26 +1477,5 @@ namespace LLError sIndex = 0 ; } -#if LL_WINDOWS - void LLOutputDebugUTF8(const std::string& s) - { - // Be careful when calling OutputDebugString as it throws DBG_PRINTEXCEPTION_C - // which works just fine under the windows debugger, but can cause users who - // have enabled SEHOP exception chain validation to crash due to interactions - // between the Win 32-bit exception handling and boost coroutine fiber stacks. BUG-2707 - // - if (IsDebuggerPresent()) - { - // Need UTF16 for Unicode OutputDebugString - // - if (s.size()) - { - OutputDebugString(utf8str_to_utf16str(s).c_str()); - OutputDebugString(TEXT("\n")); - } - } - } -#endif - } diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 0b723aeb5d00df1565a0852b7ca05e6ea81d40ab..bc80e64423ba9ba5ab852ee6ff643c5a211de4b3 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -31,9 +31,68 @@ #include <sstream> #include <typeinfo> -#include "llerrorlegacy.h" #include "stdtypes.h" +#include "llpreprocessor.h" +#include <boost/static_assert.hpp> + +const int LL_ERR_NOERR = 0; + +// Define one of these for different error levels in release... +// #define RELEASE_SHOW_DEBUG // Define this if you want your release builds to show lldebug output. +#define RELEASE_SHOW_INFO // Define this if you want your release builds to show llinfo output +#define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output. + +#ifdef _DEBUG +#define SHOW_DEBUG +#define SHOW_WARN +#define SHOW_INFO +#define SHOW_ASSERT +#else // _DEBUG + +#ifdef LL_RELEASE_WITH_DEBUG_INFO +#define SHOW_ASSERT +#endif // LL_RELEASE_WITH_DEBUG_INFO + +#ifdef RELEASE_SHOW_DEBUG +#define SHOW_DEBUG +#endif + +#ifdef RELEASE_SHOW_WARN +#define SHOW_WARN +#endif + +#ifdef RELEASE_SHOW_INFO +#define SHOW_INFO +#endif + +#ifdef RELEASE_SHOW_ASSERT +#define SHOW_ASSERT +#endif + +#endif // !_DEBUG + +#define llassert_always_msg(func, msg) if (LL_UNLIKELY(!(func))) LL_ERRS() << "ASSERT (" << msg << ")" << LL_ENDL + +#define llassert_always(func) llassert_always_msg(func, #func) + +#ifdef SHOW_ASSERT +#define llassert(func) llassert_always_msg(func, #func) +#define llverify(func) llassert_always_msg(func, #func) +#else +#define llassert(func) +#define llverify(func) do {if (func) {}} while(0) +#endif + +#ifdef LL_WINDOWS +#define LL_STATIC_ASSERT(func, msg) static_assert(func, msg) +#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) static_assert(false, msg) +#else +#define LL_STATIC_ASSERT(func, msg) BOOST_STATIC_ASSERT(func) +#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) BOOST_STATIC_ASSERT(sizeof(type) != 0 && false); +#endif + + /** Error Logging Facility Information for most users: @@ -121,50 +180,62 @@ namespace LLError They are not intended for general use. */ - class CallSite; + struct CallSite; class LL_COMMON_API Log { public: static bool shouldLog(CallSite&); static std::ostringstream* out(); - static void flush(std::ostringstream* out, char* message) ; + static void flush(std::ostringstream* out, char* message); static void flush(std::ostringstream*, const CallSite&); }; - class LL_COMMON_API CallSite + struct LL_COMMON_API CallSite { // Represents a specific place in the code where a message is logged // This is public because it is used by the macros below. It is not // intended for public use. - public: - CallSite(ELevel, const char* file, int line, - const std::type_info& class_info, const char* function, const char* broadTag, const char* narrowTag, bool printOnce); - + CallSite(ELevel level, + const char* file, + int line, + const std::type_info& class_info, + const char* function, + bool print_once, + const char** tags, + size_t tag_count); + + ~CallSite(); + #ifdef LL_LIBRARY_INCLUDE bool shouldLog(); #else // LL_LIBRARY_INCLUDE bool shouldLog() - { return mCached ? mShouldLog : Log::shouldLog(*this); } + { + return mCached + ? mShouldLog + : Log::shouldLog(*this); + } // this member function needs to be in-line for efficiency #endif // LL_LIBRARY_INCLUDE void invalidate(); - private: // these describe the call site and never change const ELevel mLevel; const char* const mFile; - const int mLine; - const std::type_info& mClassInfo; + const int mLine; + const std::type_info& mClassInfo; const char* const mFunction; - const char* const mBroadTag; - const char* const mNarrowTag; - const bool mPrintOnce; - - // these implement a cache of the call to shouldLog() - bool mCached; - bool mShouldLog; + const char** mTags; + size_t mTagCount; + const bool mPrintOnce; + const char* mLevelString; + std::string mLocationString, + mFunctionString, + mTagString; + bool mCached, + mShouldLog; friend class Log; }; @@ -198,32 +269,23 @@ namespace LLError static void clear() ; static void end(std::ostringstream* _out) ; }; - -#if LL_WINDOWS - void LLOutputDebugUTF8(const std::string& s); -#endif - } -#if LL_WINDOWS - // Macro accepting a std::string for display in windows debugging console - #define LL_WINDOWS_OUTPUT_DEBUG(a) LLError::LLOutputDebugUTF8(a) -#else - #define LL_WINDOWS_OUTPUT_DEBUG(a) -#endif - //this is cheaper than llcallstacks if no need to output other variables to call stacks. -#define llpushcallstacks LLError::LLCallStacks::push(__FUNCTION__, __LINE__) -#define llcallstacks \ - {\ +#define LL_PUSH_CALLSTACKS() LLError::LLCallStacks::push(__FUNCTION__, __LINE__) + +#define llcallstacks \ + { \ std::ostringstream* _out = LLError::LLCallStacks::insert(__FUNCTION__, __LINE__) ; \ (*_out) -#define llcallstacksendl \ - LLError::End(); \ + +#define llcallstacksendl \ + LLError::End(); \ LLError::LLCallStacks::end(_out) ; \ } -#define llclearcallstacks LLError::LLCallStacks::clear() -#define llprintcallstacks LLError::LLCallStacks::print() + +#define LL_CLEAR_CALLSTACKS() LLError::LLCallStacks::clear() +#define LL_PRINT_CALLSTACKS() LLError::LLCallStacks::print() /* Class type information for logging @@ -237,78 +299,72 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG; // Outside a class declaration, or in class without LOG_CLASS(), this // typedef causes the messages to not be associated with any class. +///////////////////////////////// +// Error Logging Macros +// See top of file for common usage. +///////////////////////////////// +// this macro uses a one-shot do statement to avoid parsing errors when writing control flow statements +// without braces: +// if (condition) LL_INFOS() << "True" << LL_ENDL; else LL_INFOS()() << "False" << LL_ENDL +#define lllog(level, once, ...) \ + do { \ + const char* tags[] = {"", ##__VA_ARGS__}; \ + ::size_t tag_count = LL_ARRAY_SIZE(tags) - 1; \ + static LLError::CallSite _site( \ + level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, once, &tags[1], tag_count);\ + if (LL_UNLIKELY(_site.shouldLog())) \ + { \ + std::ostringstream* _out = LLError::Log::out(); \ + (*_out) +//Use this construct if you need to do computation in the middle of a +//message: +// +// LL_INFOS("AgentGesture") << "the agent " << agend_id; +// switch (f) +// { +// case FOP_SHRUGS: LL_CONT << "shrugs"; break; +// case FOP_TAPS: LL_CONT << "points at " << who; break; +// case FOP_SAYS: LL_CONT << "says " << message; break; +// } +// LL_CONT << " for " << t << " seconds" << LL_ENDL; +// +//Such computation is done iff the message will be logged. +#define LL_CONT (*_out) -/* - Error Logging Macros - See top of file for common usage. -*/ - -#define lllog(level, broadTag, narrowTag, once) \ - do { \ - static LLError::CallSite _site( \ - level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, broadTag, narrowTag, once);\ - if (LL_UNLIKELY(_site.shouldLog())) \ - { \ - std::ostringstream* _out = LLError::Log::out(); \ - (*_out) +#define LL_NEWLINE '\n' -// DEPRECATED: Don't call directly, use LL_ENDL instead, which actually looks like a macro -#define llendl \ - LLError::End(); \ +#define LL_ENDL \ + LLError::End(); \ LLError::Log::flush(_out, _site); \ - } \ + } \ } while(0) -// DEPRECATED: Use the new macros that allow tags and *look* like macros. -#define lldebugs lllog(LLError::LEVEL_DEBUG, NULL, NULL, false) -#define llinfos lllog(LLError::LEVEL_INFO, NULL, NULL, false) -#define llwarns lllog(LLError::LEVEL_WARN, NULL, NULL, false) -#define llerrs lllog(LLError::LEVEL_ERROR, NULL, NULL, false) -#define llcont (*_out) - // NEW Macros for debugging, allow the passing of a string tag -// One Tag -#define LL_DEBUGS(broadTag) lllog(LLError::LEVEL_DEBUG, broadTag, NULL, false) -#define LL_INFOS(broadTag) lllog(LLError::LEVEL_INFO, broadTag, NULL, false) -#define LL_WARNS(broadTag) lllog(LLError::LEVEL_WARN, broadTag, NULL, false) -#define LL_ERRS(broadTag) lllog(LLError::LEVEL_ERROR, broadTag, NULL, false) -// Two Tags -#define LL_DEBUGS2(broadTag, narrowTag) lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, false) -#define LL_INFOS2(broadTag, narrowTag) lllog(LLError::LEVEL_INFO, broadTag, narrowTag, false) -#define LL_WARNS2(broadTag, narrowTag) lllog(LLError::LEVEL_WARN, broadTag, narrowTag, false) -#define LL_ERRS2(broadTag, narrowTag) lllog(LLError::LEVEL_ERROR, broadTag, narrowTag, false) +// Pass comma separated list of tags (currently only supports up to 0, 1, or 2) +#define LL_DEBUGS(...) lllog(LLError::LEVEL_DEBUG, false, ##__VA_ARGS__) +#define LL_INFOS(...) lllog(LLError::LEVEL_INFO, false, ##__VA_ARGS__) +#define LL_WARNS(...) lllog(LLError::LEVEL_WARN, false, ##__VA_ARGS__) +#define LL_ERRS(...) lllog(LLError::LEVEL_ERROR, false, ##__VA_ARGS__) +// alternative to llassert_always that prints explanatory message +#define LL_ERRS_IF(exp, ...) if (exp) LL_ERRS(##__VA_ARGS__) << "(" #exp ")" // Only print the log message once (good for warnings or infos that would otherwise // spam the log file over and over, such as tighter loops). -#define LL_DEBUGS_ONCE(broadTag) lllog(LLError::LEVEL_DEBUG, broadTag, NULL, true) -#define LL_INFOS_ONCE(broadTag) lllog(LLError::LEVEL_INFO, broadTag, NULL, true) -#define LL_WARNS_ONCE(broadTag) lllog(LLError::LEVEL_WARN, broadTag, NULL, true) -#define LL_DEBUGS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, true) -#define LL_INFOS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_INFO, broadTag, narrowTag, true) -#define LL_WARNS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_WARN, broadTag, narrowTag, true) - -#define LL_ENDL llendl -#define LL_CONT (*_out) +#define LL_DEBUGS_ONCE(...) lllog(LLError::LEVEL_DEBUG, true, ##__VA_ARGS__) +#define LL_INFOS_ONCE(...) lllog(LLError::LEVEL_INFO, true, ##__VA_ARGS__) +#define LL_WARNS_ONCE(...) lllog(LLError::LEVEL_WARN, true, ##__VA_ARGS__) - /* - Use this construct if you need to do computation in the middle of a - message: - - LL_INFOS("AgentGesture") << "the agent " << agend_id; - switch (f) - { - case FOP_SHRUGS: LL_CONT << "shrugs"; break; - case FOP_TAPS: LL_CONT << "points at " << who; break; - case FOP_SAYS: LL_CONT << "says " << message; break; - } - LL_CONT << " for " << t << " seconds" << LL_ENDL; - - Such computation is done iff the message will be logged. - */ +// DEPRECATED: Use the new macros that allow tags and *look* like macros. +#define lldebugs LL_COMPILE_TIME_MESSAGE("Warning: lldebugs deprecated, use LL_DEBUGS() instead") LL_DEBUGS() +#define llinfos LL_COMPILE_TIME_MESSAGE("Warning: llinfos deprecated, use LL_INFOS() instead") LL_INFOS() +#define llwarns LL_COMPILE_TIME_MESSAGE("Warning: llwarns deprecated, use LL_WARNS() instead") LL_WARNS() +#define llerrs LL_COMPILE_TIME_MESSAGE("Warning: llerrs deprecated, use LL_ERRS() instead") LL_ERRS() +#define llcont LL_COMPILE_TIME_MESSAGE("Warning: llcont deprecated, use LL_CONT instead") LL_CONT +#define llendl LL_COMPILE_TIME_MESSAGE("Warning: llendl deprecated, use LL_ENDL instead") LL_ENDL #endif // LL_LLERROR_H diff --git a/indra/llcommon/llerrorcontrol.h b/indra/llcommon/llerrorcontrol.h index 480654b1a2b433d1ec07bce8c82a50d9155da901..aab695094c7d50ce9ad23fd318f4c19c10ce0a3b 100755 --- a/indra/llcommon/llerrorcontrol.h +++ b/indra/llcommon/llerrorcontrol.h @@ -136,14 +136,24 @@ namespace LLError { // An object that handles the actual output or error messages. public: + Recorder(); virtual ~Recorder(); virtual void recordMessage(LLError::ELevel, const std::string& message) = 0; // use the level for better display, not for filtering - virtual bool wantsTime(); // default returns false - // override and return true if the recorder wants the time string - // included in the text of the message + bool wantsTime(); + bool wantsTags(); + bool wantsLevel(); + bool wantsLocation(); + bool wantsFunctionName(); + + protected: + bool mWantsTime, + mWantsTags, + mWantsLevel, + mWantsLocation, + mWantsFunctionName; }; /** diff --git a/indra/llcommon/llerrorlegacy.h b/indra/llcommon/llerrorlegacy.h index 37cee579cd2171f8d2378932df6181b45316adb6..31dd20700824d3eb3bb5fd708ba5c6376501c219 100755 --- a/indra/llcommon/llerrorlegacy.h +++ b/indra/llcommon/llerrorlegacy.h @@ -28,91 +28,5 @@ #ifndef LL_LLERRORLEGACY_H #define LL_LLERRORLEGACY_H -#include "llpreprocessor.h" - -/* - LEGACY -- DO NOT USE THIS STUFF ANYMORE -*/ - -// Specific error codes -const int LL_ERR_NOERR = 0; -const int LL_ERR_ASSET_REQUEST_FAILED = -1; -//const int LL_ERR_ASSET_REQUEST_INVALID = -2; -const int LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE = -3; -const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4; -const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5; -const int LL_ERR_EOF = -39; -const int LL_ERR_CANNOT_OPEN_FILE = -42; -const int LL_ERR_FILE_NOT_FOUND = -43; -const int LL_ERR_FILE_EMPTY = -44; -const int LL_ERR_TCP_TIMEOUT = -23016; -const int LL_ERR_CIRCUIT_GONE = -23017; -const int LL_ERR_PRICE_MISMATCH = -23018; - - - -// Define one of these for different error levels in release... -// #define RELEASE_SHOW_DEBUG // Define this if you want your release builds to show lldebug output. -#define RELEASE_SHOW_INFO // Define this if you want your release builds to show llinfo output -#define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output. - - -////////////////////////////////////////// -// -// Implementation - ignore -// -// -#ifdef _DEBUG -#define SHOW_DEBUG -#define SHOW_WARN -#define SHOW_INFO -#define SHOW_ASSERT -#else // _DEBUG - -#ifdef LL_RELEASE_WITH_DEBUG_INFO -#define SHOW_ASSERT -#endif // LL_RELEASE_WITH_DEBUG_INFO - -#ifdef RELEASE_SHOW_DEBUG -#define SHOW_DEBUG -#endif - -#ifdef RELEASE_SHOW_WARN -#define SHOW_WARN -#endif - -#ifdef RELEASE_SHOW_INFO -#define SHOW_INFO -#endif - -#ifdef RELEASE_SHOW_ASSERT -#define SHOW_ASSERT -#endif - -#endif // _DEBUG - - - -#define lldebugst(type) lldebugs -#define llendflush llendl - - -#define llerror(msg, num) llerrs << "Error # " << num << ": " << msg << llendl; - -#define llwarning(msg, num) llwarns << "Warning # " << num << ": " << msg << llendl; - -#define llassert_always(func) if (LL_UNLIKELY(!(func))) llerrs << "ASSERT (" << #func << ")" << llendl; - -#ifdef SHOW_ASSERT -#define llassert(func) llassert_always(func) -#define llverify(func) llassert_always(func) -#else -#define llassert(func) -#define llverify(func) do {if (func) {}} while(0) -#endif - -// handy compile-time assert - enforce those template parameters! -#define cassert(expn) typedef char __C_ASSERT__[(expn)?1:-1] /* Flawfinder: ignore */ - //XXX: used in two places in llcommon/llskipmap.h #endif // LL_LLERRORLEGACY_H diff --git a/indra/llcommon/llerrorthread.cpp b/indra/llcommon/llerrorthread.cpp index ebfbe19ff7705635a1cee3bb8e35350ecba86d0d..f6bc68b5c1d7d60318883f4022b423c27ef0e68d 100755 --- a/indra/llcommon/llerrorthread.cpp +++ b/indra/llcommon/llerrorthread.cpp @@ -65,7 +65,7 @@ void get_child_status(const int waitpid_status, int &process_status, bool &exite exited = true; if (do_logging) { - llinfos << "get_child_status - Child exited cleanly with return of " << process_status << llendl; + LL_INFOS() << "get_child_status - Child exited cleanly with return of " << process_status << LL_ENDL; } return; } @@ -75,15 +75,15 @@ void get_child_status(const int waitpid_status, int &process_status, bool &exite exited = true; if (do_logging) { - llinfos << "get_child_status - Child died because of uncaught signal " << process_status << llendl; + LL_INFOS() << "get_child_status - Child died because of uncaught signal " << process_status << LL_ENDL; #ifdef WCOREDUMP if (WCOREDUMP(waitpid_status)) { - llinfos << "get_child_status - Child dumped core" << llendl; + LL_INFOS() << "get_child_status - Child dumped core" << LL_ENDL; } else { - llinfos << "get_child_status - Child didn't dump core" << llendl; + LL_INFOS() << "get_child_status - Child didn't dump core" << LL_ENDL; } #endif } @@ -93,7 +93,7 @@ void get_child_status(const int waitpid_status, int &process_status, bool &exite { // This is weird. I just dump the waitpid status into the status code, // not that there's any way of telling what it is... - llinfos << "get_child_status - Got SIGCHILD but child didn't exit" << llendl; + LL_INFOS() << "get_child_status - Got SIGCHILD but child didn't exit" << LL_ENDL; process_status = waitpid_status; } @@ -106,7 +106,7 @@ void LLErrorThread::run() // This thread sits and waits for the sole purpose // of waiting for the signal/exception handlers to flag the // application state as APP_STATUS_ERROR. - llinfos << "thread_error - Waiting for an error" << llendl; + LL_INFOS() << "thread_error - Waiting for an error" << LL_ENDL; S32 counter = 0; while (! (LLApp::isError() || LLApp::isStopped())) @@ -117,17 +117,17 @@ void LLErrorThread::run() if (LLApp::isError()) { // The app is in an error state, run the application's error handler. - //llinfos << "thread_error - An error has occurred, running error callback!" << llendl; + //LL_INFOS() << "thread_error - An error has occurred, running error callback!" << LL_ENDL; // Run the error handling callback LLApp::runErrorHandler(); } else { // Everything is okay, a clean exit. - //llinfos << "thread_error - Application exited cleanly" << llendl; + //LL_INFOS() << "thread_error - Application exited cleanly" << LL_ENDL; } - //llinfos << "thread_error - Exiting" << llendl; + //LL_INFOS() << "thread_error - Exiting" << LL_ENDL; LLApp::sErrorThreadRunning = FALSE; } diff --git a/indra/llcommon/llevent.h b/indra/llcommon/llevent.h index 8cd682b8bf492e017c18006ad51f6bc603260b90..28ce7de102e579d7af85e2da3acd90ac508cab9a 100755 --- a/indra/llcommon/llevent.h +++ b/indra/llcommon/llevent.h @@ -29,8 +29,8 @@ #define LL_EVENT_H #include "llsd.h" +#include "llrefcount.h" #include "llpointer.h" -#include "llthread.h" namespace LLOldEvents { diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 0855180dcd66956a39048907311097a7c6b6abb1..1c928b3db890e54a3c3a665b381d897c2de3810b 100755 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -41,7 +41,6 @@ #include <algorithm> // std headers #include <typeinfo> -#include <cassert> #include <cmath> #include <cctype> // external library headers diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index 65b0fef354eab6f78efaea6103d01f27dc1104d8..0cbd1da32d0d82e5be8139827e13482b7831fbe3 100755 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -61,7 +61,7 @@ #include "llsd.h" #include "llsingleton.h" #include "lldependencies.h" -#include "ll_template_cast.h" +#include "llstl.h" /*==========================================================================*| // override this to allow binding free functions with more parameters diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 58db7d0d1784896759a137996f59041edc840684..3d28cd15b02234f3c28756d53f570bc21ea07ba2 100755 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -32,8 +32,13 @@ #include "llsingleton.h" #include "lltreeiterators.h" #include "llsdserialize.h" +#include "llunits.h" +#include "llsd.h" +#include "lltracerecording.h" +#include "lltracethreadrecorder.h" #include <boost/bind.hpp> +#include <queue> #if LL_WINDOWS @@ -49,140 +54,115 @@ #error "architecture not supported" #endif +namespace LLTrace +{ + ////////////////////////////////////////////////////////////////////////////// // statics -S32 LLFastTimer::sCurFrameIndex = -1; -S32 LLFastTimer::sLastFrameIndex = -1; -U64 LLFastTimer::sLastFrameTime = LLFastTimer::getCPUClockCount64(); -bool LLFastTimer::sPauseHistory = 0; -bool LLFastTimer::sResetHistory = 0; -LLFastTimer::CurTimerData LLFastTimer::sCurTimerData; -BOOL LLFastTimer::sLog = FALSE; -std::string LLFastTimer::sLogName = ""; -BOOL LLFastTimer::sMetricLog = FALSE; -LLMutex* LLFastTimer::sLogLock = NULL; -std::queue<LLSD> LLFastTimer::sLogQueue; +bool BlockTimer::sLog = false; +std::string BlockTimer::sLogName = ""; +bool BlockTimer::sMetricLog = false; #if LL_LINUX || LL_SOLARIS -U64 LLFastTimer::sClockResolution = 1000000000; // Nanosecond resolution +U64 BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution #else -U64 LLFastTimer::sClockResolution = 1000000; // Microsecond resolution +U64 BlockTimer::sClockResolution = 1000000; // Microsecond resolution #endif -// FIXME: move these declarations to the relevant modules - -// helper functions -typedef LLTreeDFSPostIter<LLFastTimer::NamedTimer, LLFastTimer::NamedTimer::child_const_iter> timer_tree_bottom_up_iterator_t; +static LLMutex* sLogLock = NULL; +static std::queue<LLSD> sLogQueue; -static timer_tree_bottom_up_iterator_t begin_timer_tree_bottom_up(LLFastTimer::NamedTimer& id) +block_timer_tree_df_iterator_t begin_block_timer_tree_df(BlockTimerStatHandle& id) { - return timer_tree_bottom_up_iterator_t(&id, - boost::bind(boost::mem_fn(&LLFastTimer::NamedTimer::beginChildren), _1), - boost::bind(boost::mem_fn(&LLFastTimer::NamedTimer::endChildren), _1)); + return block_timer_tree_df_iterator_t(&id, + boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1), + boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); } -static timer_tree_bottom_up_iterator_t end_timer_tree_bottom_up() +block_timer_tree_df_iterator_t end_block_timer_tree_df() { - return timer_tree_bottom_up_iterator_t(); + return block_timer_tree_df_iterator_t(); } -typedef LLTreeDFSIter<LLFastTimer::NamedTimer, LLFastTimer::NamedTimer::child_const_iter> timer_tree_dfs_iterator_t; - +block_timer_tree_df_post_iterator_t begin_block_timer_tree_df_post(BlockTimerStatHandle& id) +{ + return block_timer_tree_df_post_iterator_t(&id, + boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1), + boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); +} -static timer_tree_dfs_iterator_t begin_timer_tree(LLFastTimer::NamedTimer& id) +block_timer_tree_df_post_iterator_t end_block_timer_tree_df_post() { - return timer_tree_dfs_iterator_t(&id, - boost::bind(boost::mem_fn(&LLFastTimer::NamedTimer::beginChildren), _1), - boost::bind(boost::mem_fn(&LLFastTimer::NamedTimer::endChildren), _1)); + return block_timer_tree_df_post_iterator_t(); } -static timer_tree_dfs_iterator_t end_timer_tree() +block_timer_tree_bf_iterator_t begin_block_timer_tree_bf(BlockTimerStatHandle& id) { - return timer_tree_dfs_iterator_t(); + return block_timer_tree_bf_iterator_t(&id, + boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1), + boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); } -// factory class that creates NamedTimers via static DeclareTimer objects -class NamedTimerFactory : public LLSingleton<NamedTimerFactory> -{ -public: - NamedTimerFactory() - : mTimerRoot(new LLFastTimer::NamedTimer("root")) +block_timer_tree_bf_iterator_t end_block_timer_tree_bf() { - mRootFrameState.setNamedTimer(mTimerRoot); - mTimerRoot->setFrameState(&mRootFrameState); - mTimerRoot->mParent = mTimerRoot; - mTimerRoot->setCollapsed(false); - mRootFrameState.mParent = &mRootFrameState; + return block_timer_tree_bf_iterator_t(); } - ~NamedTimerFactory() +block_timer_tree_df_iterator_t begin_timer_tree(BlockTimerStatHandle& id) { - std::for_each(mTimers.begin(), mTimers.end(), DeletePairedPointer()); - mTimers.clear(); - - delete mTimerRoot; + return block_timer_tree_df_iterator_t(&id, + boost::bind(boost::mem_fn(&BlockTimerStatHandle::beginChildren), _1), + boost::bind(boost::mem_fn(&BlockTimerStatHandle::endChildren), _1)); } - LLFastTimer::NamedTimer& createNamedTimer(const std::string& name, LLFastTimer::FrameState* state) +block_timer_tree_df_iterator_t end_timer_tree() { - LLFastTimer::NamedTimer* timer = new LLFastTimer::NamedTimer(name); - timer->setFrameState(state); - timer->setParent(mTimerRoot); - mTimers.insert(std::make_pair(name, timer)); + return block_timer_tree_df_iterator_t(); +} - return *timer; - } - LLFastTimer::NamedTimer* getTimerByName(const std::string& name) +// sort child timers by name +struct SortTimerByName { - timer_map_t::iterator found_it = mTimers.find(name); - if (found_it != mTimers.end()) + bool operator()(const BlockTimerStatHandle* i1, const BlockTimerStatHandle* i2) { - return found_it->second; + return i1->getName() < i2->getName(); } - return NULL; - } - - LLFastTimer::NamedTimer* getRootTimer() { return mTimerRoot; } - - typedef std::multimap<std::string, LLFastTimer::NamedTimer*> timer_map_t; - timer_map_t::iterator beginTimers() { return mTimers.begin(); } - timer_map_t::iterator endTimers() { return mTimers.end(); } - S32 timerCount() { return mTimers.size(); } - -private: - timer_map_t mTimers; - - LLFastTimer::NamedTimer* mTimerRoot; - LLFastTimer::FrameState mRootFrameState; }; -LLFastTimer::DeclareTimer::DeclareTimer(const std::string& name, bool open ) -: mTimer(NamedTimerFactory::instance().createNamedTimer(name, &mFrameState)) +static BlockTimerStatHandle sRootTimer("root", NULL); +BlockTimerStatHandle& BlockTimer::getRootTimeBlock() { - mTimer.setCollapsed(!open); + return sRootTimer; + } + +void BlockTimer::pushLog(LLSD log) +{ + LLMutexLock lock(sLogLock); + + sLogQueue.push(log); } -LLFastTimer::DeclareTimer::DeclareTimer(const std::string& name) -: mTimer(NamedTimerFactory::instance().createNamedTimer(name, &mFrameState)) +void BlockTimer::setLogLock(LLMutex* lock) { + sLogLock = lock; } + //static #if (LL_DARWIN || LL_LINUX || LL_SOLARIS) && !(defined(__i386__) || defined(__amd64__)) -U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer +U64 BlockTimer::countsPerSecond() { - return sClockResolution >> 8; + return sClockResolution; } #else // windows or x86-mac or x86-linux or x86-solaris -U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer +U64 BlockTimer::countsPerSecond() { #if LL_FASTTIMER_USE_RDTSC || !LL_WINDOWS //getCPUFrequency returns MHz and sCPUClockFrequency wants to be in Hz - static U64 sCPUClockFrequency = U64(LLProcessorInfo().getCPUFrequency()*1000000.0); - - // we drop the low-order byte in our timers, so report a lower frequency + static LLUnit<U64, LLUnits::Hertz> sCPUClockFrequency = LLProcessorInfo().getCPUFrequency(); + return sCPUClockFrequency.value(); #else // If we're not using RDTSC, each fasttimer tick is just a performance counter tick. // Not redefining the clock frequency itself (in llprocessor.cpp/calculate_cpu_frequency()) @@ -194,270 +174,211 @@ U64 LLFastTimer::countsPerSecond() // counts per second for the *32-bit* timer QueryPerformanceFrequency((LARGE_INTEGER*)&sCPUClockFrequency); firstcall = false; } + return sCPUClockFrequency.value(); #endif - return sCPUClockFrequency >> 8; } #endif -LLFastTimer::FrameState::FrameState() -: mActiveCount(0), - mCalls(0), - mSelfTimeCounter(0), - mParent(NULL), - mLastCaller(NULL), - mMoveUpTree(false) +BlockTimerStatHandle::BlockTimerStatHandle(const char* name, const char* description) +: StatType<TimeBlockAccumulator>(name, description) {} - -LLFastTimer::NamedTimer::NamedTimer(const std::string& name) -: mName(name), - mCollapsed(true), - mParent(NULL), - mTotalTimeCounter(0), - mCountAverage(0), - mCallAverage(0), - mNeedsSorting(false), - mFrameState(NULL) +TimeBlockTreeNode& BlockTimerStatHandle::getTreeNode() const { - mCountHistory = new U32[HISTORY_NUM]; - memset(mCountHistory, 0, sizeof(U32) * HISTORY_NUM); - mCallHistory = new U32[HISTORY_NUM]; - memset(mCallHistory, 0, sizeof(U32) * HISTORY_NUM); + TimeBlockTreeNode* nodep = LLTrace::get_thread_recorder()->getTimeBlockTreeNode(getIndex()); + llassert(nodep); + return *nodep; } -LLFastTimer::NamedTimer::~NamedTimer() -{ - delete[] mCountHistory; - delete[] mCallHistory; -} -std::string LLFastTimer::NamedTimer::getToolTip(S32 history_idx) +void BlockTimer::bootstrapTimerTree() { - F64 ms_multiplier = 1000.0 / (F64)LLFastTimer::countsPerSecond(); - if (history_idx < 0) - { - // by default, show average number of call - return llformat("%s (%d ms, %d calls)", getName().c_str(), (S32)(getCountAverage() * ms_multiplier), (S32)getCallAverage()); - } - else + for (BlockTimerStatHandle::instance_tracker_t::instance_iter it = BlockTimerStatHandle::instance_tracker_t::beginInstances(), end_it = BlockTimerStatHandle::instance_tracker_t::endInstances(); + it != end_it; + ++it) { - return llformat("%s (%d ms, %d calls)", getName().c_str(), (S32)(getHistoricalCount(history_idx) * ms_multiplier), (S32)getHistoricalCalls(history_idx)); - } -} + BlockTimerStatHandle& timer = static_cast<BlockTimerStatHandle&>(*it); + if (&timer == &BlockTimer::getRootTimeBlock()) continue; -void LLFastTimer::NamedTimer::setParent(NamedTimer* parent) + // bootstrap tree construction by attaching to last timer to be on stack + // when this timer was called + if (timer.getParent() == &BlockTimer::getRootTimeBlock()) { - llassert_always(parent != this); - llassert_always(parent != NULL); + TimeBlockAccumulator& accumulator = timer.getCurrentAccumulator(); - if (mParent) + if (accumulator.mLastCaller) { - // subtract our accumulated from previous parent - for (S32 i = 0; i < HISTORY_NUM; i++) - { - mParent->mCountHistory[i] -= mCountHistory[i]; - } - - // subtract average timing from previous parent - mParent->mCountAverage -= mCountAverage; - - std::vector<NamedTimer*>& children = mParent->getChildren(); - std::vector<NamedTimer*>::iterator found_it = std::find(children.begin(), children.end(), this); - if (found_it != children.end()) - { - children.erase(found_it); + timer.setParent(accumulator.mLastCaller); + accumulator.mParent = accumulator.mLastCaller; } + // no need to push up tree on first use, flag can be set spuriously + accumulator.mMoveUpTree = false; } - - mParent = parent; - if (parent) - { - getFrameState().mParent = &parent->getFrameState(); - parent->getChildren().push_back(this); - parent->mNeedsSorting = true; } } -S32 LLFastTimer::NamedTimer::getDepth() +// bump timers up tree if they have been flagged as being in the wrong place +// do this in a bottom up order to promote descendants first before promoting ancestors +// this preserves partial order derived from current frame's observations +void BlockTimer::incrementalUpdateTimerTree() { - S32 depth = 0; - NamedTimer* timerp = mParent; - while(timerp) + for(block_timer_tree_df_post_iterator_t it = begin_block_timer_tree_df_post(BlockTimer::getRootTimeBlock()); + it != end_block_timer_tree_df_post(); + ++it) { - depth++; - if (timerp->getParent() == timerp) break; - timerp = timerp->mParent; - } - return depth; -} + BlockTimerStatHandle* timerp = *it; -// static -void LLFastTimer::NamedTimer::processTimes() + // sort timers by time last called, so call graph makes sense + TimeBlockTreeNode& tree_node = timerp->getTreeNode(); + if (tree_node.mNeedsSorting) { - if (sCurFrameIndex < 0) return; - - buildHierarchy(); - accumulateTimings(); + std::sort(tree_node.mChildren.begin(), tree_node.mChildren.end(), SortTimerByName()); } -// sort child timers by name -struct SortTimerByName + // skip root timer + if (timerp != &BlockTimer::getRootTimeBlock()) { - bool operator()(const LLFastTimer::NamedTimer* i1, const LLFastTimer::NamedTimer* i2) - { - return i1->getName() < i2->getName(); - } -}; + TimeBlockAccumulator& accumulator = timerp->getCurrentAccumulator(); -//static -void LLFastTimer::NamedTimer::buildHierarchy() + if (accumulator.mMoveUpTree) { - if (sCurFrameIndex < 0 ) return; - - // set up initial tree - { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) - { - NamedTimer& timer = *it; - if (&timer == NamedTimerFactory::instance().getRootTimer()) continue; - - // bootstrap tree construction by attaching to last timer to be on stack - // when this timer was called - if (timer.getFrameState().mLastCaller && timer.mParent == NamedTimerFactory::instance().getRootTimer()) - { - timer.setParent(timer.getFrameState().mLastCaller->mTimer); - // no need to push up tree on first use, flag can be set spuriously - timer.getFrameState().mMoveUpTree = false; - } - } - } - - // bump timers up tree if they've been flagged as being in the wrong place - // do this in a bottom up order to promote descendants first before promoting ancestors - // this preserves partial order derived from current frame's observations - for(timer_tree_bottom_up_iterator_t it = begin_timer_tree_bottom_up(*NamedTimerFactory::instance().getRootTimer()); - it != end_timer_tree_bottom_up(); - ++it) - { - NamedTimer* timerp = *it; - // skip root timer - if (timerp == NamedTimerFactory::instance().getRootTimer()) continue; - - if (timerp->getFrameState().mMoveUpTree) - { - // since ancestors have already been visited, reparenting won't affect tree traversal + // since ancestors have already been visited, re-parenting won't affect tree traversal //step up tree, bringing our descendants with us LL_DEBUGS("FastTimers") << "Moving " << timerp->getName() << " from child of " << timerp->getParent()->getName() << " to child of " << timerp->getParent()->getParent()->getName() << LL_ENDL; timerp->setParent(timerp->getParent()->getParent()); - timerp->getFrameState().mMoveUpTree = false; + accumulator.mParent = timerp->getParent(); + accumulator.mMoveUpTree = false; // don't bubble up any ancestors until descendants are done bubbling up + // as ancestors may call this timer only on certain paths, so we want to resolve + // child-most block locations before their parents it.skipAncestors(); } } + } +} - // sort timers by time last called, so call graph makes sense - for(timer_tree_dfs_iterator_t it = begin_timer_tree(*NamedTimerFactory::instance().getRootTimer()); - it != end_timer_tree(); - ++it) + +void BlockTimer::updateTimes() { - NamedTimer* timerp = (*it); - if (timerp->mNeedsSorting) + // walk up stack of active timers and accumulate current time while leaving timing structures active + BlockTimerStackRecord* stack_record = LLThreadLocalSingletonPointer<BlockTimerStackRecord>::getInstance(); + if (!stack_record) return; + + U64 cur_time = getCPUClockCount64(); + BlockTimer* cur_timer = stack_record->mActiveTimer; + TimeBlockAccumulator* accumulator = &stack_record->mTimeBlock->getCurrentAccumulator(); + + while(cur_timer + && cur_timer->mParentTimerData.mActiveTimer != cur_timer) // root defined by parent pointing to self { - std::sort(timerp->getChildren().begin(), timerp->getChildren().end(), SortTimerByName()); - } - timerp->mNeedsSorting = false; + U64 cumulative_time_delta = cur_time - cur_timer->mStartTime; + cur_timer->mStartTime = cur_time; + + accumulator->mTotalTimeCounter += cumulative_time_delta; + accumulator->mSelfTimeCounter += cumulative_time_delta - stack_record->mChildTime; + stack_record->mChildTime = 0; + + stack_record = &cur_timer->mParentTimerData; + accumulator = &stack_record->mTimeBlock->getCurrentAccumulator(); + cur_timer = stack_record->mActiveTimer; + + stack_record->mChildTime += cumulative_time_delta; } } +static LLTrace::BlockTimerStatHandle FTM_PROCESS_TIMES("Process FastTimer Times"); + +// not thread safe, so only call on main thread //static -void LLFastTimer::NamedTimer::accumulateTimings() +void BlockTimer::processTimes() { - U32 cur_time = getCPUClockCount32(); +#if LL_TRACE_ENABLED + LL_RECORD_BLOCK_TIME(FTM_PROCESS_TIMES); + get_clock_count(); // good place to calculate clock frequency - // walk up stack of active timers and accumulate current time while leaving timing structures active - LLFastTimer* cur_timer = sCurTimerData.mCurTimer; - // root defined by parent pointing to self - CurTimerData* cur_data = &sCurTimerData; - while(cur_timer && cur_timer->mLastTimerData.mCurTimer != cur_timer) - { - U32 cumulative_time_delta = cur_time - cur_timer->mStartTime; - U32 self_time_delta = cumulative_time_delta - cur_data->mChildTime; - cur_data->mChildTime = 0; - cur_timer->mFrameState->mSelfTimeCounter += self_time_delta; - cur_timer->mStartTime = cur_time; + // set up initial tree + bootstrapTimerTree(); - cur_data = &cur_timer->mLastTimerData; - cur_data->mChildTime += cumulative_time_delta; + incrementalUpdateTimerTree(); - cur_timer = cur_timer->mLastTimerData.mCurTimer; - } + updateTimes(); - // traverse tree in DFS post order, or bottom up - for(timer_tree_bottom_up_iterator_t it = begin_timer_tree_bottom_up(*NamedTimerFactory::instance().getRootTimer()); - it != end_timer_tree_bottom_up(); + // reset for next frame + for (BlockTimerStatHandle::instance_tracker_t::instance_iter it = BlockTimerStatHandle::instance_tracker_t::beginInstances(), + end_it = BlockTimerStatHandle::instance_tracker_t::endInstances(); + it != end_it; ++it) { - NamedTimer* timerp = (*it); - timerp->mTotalTimeCounter = timerp->getFrameState().mSelfTimeCounter; - for (child_const_iter child_it = timerp->beginChildren(); child_it != timerp->endChildren(); ++child_it) + BlockTimerStatHandle& timer = static_cast<BlockTimerStatHandle&>(*it); + TimeBlockAccumulator& accumulator = timer.getCurrentAccumulator(); + + accumulator.mLastCaller = NULL; + accumulator.mMoveUpTree = false; + } +#endif +} + +std::vector<BlockTimerStatHandle*>::iterator BlockTimerStatHandle::beginChildren() { - timerp->mTotalTimeCounter += (*child_it)->mTotalTimeCounter; + return getTreeNode().mChildren.begin(); } - S32 cur_frame = sCurFrameIndex; - if (cur_frame >= 0) +std::vector<BlockTimerStatHandle*>::iterator BlockTimerStatHandle::endChildren() { - // update timer history - int hidx = cur_frame % HISTORY_NUM; + return getTreeNode().mChildren.end(); +} - timerp->mCountHistory[hidx] = timerp->mTotalTimeCounter; - timerp->mCountAverage = ((U64)timerp->mCountAverage * cur_frame + timerp->mTotalTimeCounter) / (cur_frame+1); - timerp->mCallHistory[hidx] = timerp->getFrameState().mCalls; - timerp->mCallAverage = ((U64)timerp->mCallAverage * cur_frame + timerp->getFrameState().mCalls) / (cur_frame+1); - } +std::vector<BlockTimerStatHandle*>& BlockTimerStatHandle::getChildren() +{ + return getTreeNode().mChildren; } + +bool BlockTimerStatHandle::hasChildren() +{ + return ! getTreeNode().mChildren.empty(); } // static -void LLFastTimer::NamedTimer::resetFrame() +void BlockTimer::logStats() { + // get ready for next frame if (sLog) { //output current frame counts to performance log static S32 call_count = 0; if (call_count % 100 == 0) { - LL_DEBUGS("FastTimers") << "countsPerSecond (32 bit): " << countsPerSecond() << LL_ENDL; - LL_DEBUGS("FastTimers") << "get_clock_count (64 bit): " << get_clock_count() << llendl; + LL_DEBUGS("FastTimers") << "countsPerSecond: " << countsPerSecond() << LL_ENDL; LL_DEBUGS("FastTimers") << "LLProcessorInfo().getCPUFrequency() " << LLProcessorInfo().getCPUFrequency() << LL_ENDL; LL_DEBUGS("FastTimers") << "getCPUClockCount32() " << getCPUClockCount32() << LL_ENDL; LL_DEBUGS("FastTimers") << "getCPUClockCount64() " << getCPUClockCount64() << LL_ENDL; - LL_DEBUGS("FastTimers") << "elapsed sec " << ((F64)getCPUClockCount64())/((F64)LLProcessorInfo().getCPUFrequency()*1000000.0) << LL_ENDL; + LL_DEBUGS("FastTimers") << "elapsed sec " << ((F64)getCPUClockCount64() / (F64HertzImplicit)LLProcessorInfo().getCPUFrequency()) << LL_ENDL; } call_count++; - F64 iclock_freq = 1000.0 / countsPerSecond(); // good place to calculate clock frequency - - F64 total_time = 0; + F64Seconds total_time(0); LLSD sd; { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) + for (BlockTimerStatHandle::instance_tracker_t::instance_iter it = BlockTimerStatHandle::instance_tracker_t::beginInstances(), + end_it = BlockTimerStatHandle::instance_tracker_t::endInstances(); + it != end_it; + ++it) { - NamedTimer& timer = *it; - FrameState& info = timer.getFrameState(); - sd[timer.getName()]["Time"] = (LLSD::Real) (info.mSelfTimeCounter*iclock_freq); - sd[timer.getName()]["Calls"] = (LLSD::Integer) info.mCalls; + BlockTimerStatHandle& timer = static_cast<BlockTimerStatHandle&>(*it); + LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording(); + sd[timer.getName()]["Time"] = (LLSD::Real) (frame_recording.getLastRecording().getSum(timer).value()); + sd[timer.getName()]["Calls"] = (LLSD::Integer) (frame_recording.getLastRecording().getSum(timer.callCount())); // computing total time here because getting the root timer's getCountHistory // doesn't work correctly on the first frame - total_time = total_time + info.mSelfTimeCounter * iclock_freq; + total_time += frame_recording.getLastRecording().getSum(timer); } } - sd["Total"]["Time"] = (LLSD::Real) total_time; + sd["Total"]["Time"] = (LLSD::Real) total_time.value(); sd["Total"]["Calls"] = (LLSD::Integer) 1; { @@ -466,168 +387,44 @@ void LLFastTimer::NamedTimer::resetFrame() } } - // reset for next frame - for (instance_iter it = beginInstances(); it != endInstances(); ++it) - { - NamedTimer& timer = *it; - - FrameState& info = timer.getFrameState(); - info.mSelfTimeCounter = 0; - info.mCalls = 0; - info.mLastCaller = NULL; - info.mMoveUpTree = false; - // update parent pointer in timer state struct - if (timer.mParent) - { - info.mParent = &timer.mParent->getFrameState(); - } - } -} - -//static -void LLFastTimer::NamedTimer::reset() -{ - resetFrame(); // reset frame data - - // walk up stack of active timers and reset start times to current time - // effectively zeroing out any accumulated time - U32 cur_time = getCPUClockCount32(); - - // root defined by parent pointing to self - CurTimerData* cur_data = &sCurTimerData; - LLFastTimer* cur_timer = cur_data->mCurTimer; - while(cur_timer && cur_timer->mLastTimerData.mCurTimer != cur_timer) - { - cur_timer->mStartTime = cur_time; - cur_data->mChildTime = 0; - - cur_data = &cur_timer->mLastTimerData; - cur_timer = cur_data->mCurTimer; - } - - // reset all history - { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) - { - NamedTimer& timer = *it; - if (&timer != NamedTimerFactory::instance().getRootTimer()) - { - timer.setParent(NamedTimerFactory::instance().getRootTimer()); - } - - timer.mCountAverage = 0; - timer.mCallAverage = 0; - memset(timer.mCountHistory, 0, sizeof(U32) * HISTORY_NUM); - memset(timer.mCallHistory, 0, sizeof(U32) * HISTORY_NUM); - } - } - - sLastFrameIndex = 0; - sCurFrameIndex = 0; -} - -U32 LLFastTimer::NamedTimer::getHistoricalCount(S32 history_index) const -{ - S32 history_idx = (getLastFrameIndex() + history_index) % LLFastTimer::NamedTimer::HISTORY_NUM; - return mCountHistory[history_idx]; -} - -U32 LLFastTimer::NamedTimer::getHistoricalCalls(S32 history_index ) const -{ - S32 history_idx = (getLastFrameIndex() + history_index) % LLFastTimer::NamedTimer::HISTORY_NUM; - return mCallHistory[history_idx]; -} - -LLFastTimer::FrameState& LLFastTimer::NamedTimer::getFrameState() const -{ - return *mFrameState; -} - -std::vector<LLFastTimer::NamedTimer*>::const_iterator LLFastTimer::NamedTimer::beginChildren() -{ - return mChildren.begin(); -} - -std::vector<LLFastTimer::NamedTimer*>::const_iterator LLFastTimer::NamedTimer::endChildren() -{ - return mChildren.end(); -} - -std::vector<LLFastTimer::NamedTimer*>& LLFastTimer::NamedTimer::getChildren() -{ - return mChildren; -} - -//static -LLFastTimer::NamedTimer& LLFastTimer::NamedTimer::getRootNamedTimer() -{ - return *NamedTimerFactory::instance().getRootTimer(); -} - -//static -void LLFastTimer::nextFrame() -{ - countsPerSecond(); // good place to calculate clock frequency - U64 frame_time = getCPUClockCount64(); - if ((frame_time - sLastFrameTime) >> 8 > 0xffffffff) - { - llinfos << "Slow frame, fast timers inaccurate" << llendl; - } - - if (!sPauseHistory) - { - NamedTimer::processTimes(); - sLastFrameIndex = sCurFrameIndex++; - } - - // get ready for next frame - NamedTimer::resetFrame(); - sLastFrameTime = frame_time; } //static -void LLFastTimer::dumpCurTimes() +void BlockTimer::dumpCurTimes() { - // accumulate timings, etc. - NamedTimer::processTimes(); - - F64 clock_freq = (F64)countsPerSecond(); - F64 iclock_freq = 1000.0 / clock_freq; // clock_ticks -> milliseconds + LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording(); + LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); // walk over timers in depth order and output timings - for(timer_tree_dfs_iterator_t it = begin_timer_tree(*NamedTimerFactory::instance().getRootTimer()); + for(block_timer_tree_df_iterator_t it = begin_timer_tree(BlockTimer::getRootTimeBlock()); it != end_timer_tree(); ++it) { - NamedTimer* timerp = (*it); - F64 total_time_ms = ((F64)timerp->getHistoricalCount(0) * iclock_freq); + BlockTimerStatHandle* timerp = (*it); + F64Seconds total_time = last_frame_recording.getSum(*timerp); + U32 num_calls = last_frame_recording.getSum(timerp->callCount()); + // Don't bother with really brief times, keep output concise - if (total_time_ms < 0.1) continue; + if (total_time < F32Milliseconds(0.1f)) continue; std::ostringstream out_str; - for (S32 i = 0; i < timerp->getDepth(); i++) + BlockTimerStatHandle* parent_timerp = timerp; + while(parent_timerp && parent_timerp != parent_timerp->getParent()) { out_str << "\t"; + parent_timerp = parent_timerp->getParent(); } - out_str << timerp->getName() << " " - << std::setprecision(3) << total_time_ms << " ms, " - << timerp->getHistoricalCalls(0) << " calls"; + << std::setprecision(3) << total_time.valueInUnits<LLUnits::Milliseconds>() << " ms, " + << num_calls << " calls"; - llinfos << out_str.str() << llendl; - } + LL_INFOS() << out_str.str() << LL_ENDL; } - -//static -void LLFastTimer::reset() -{ - NamedTimer::reset(); } - //static -void LLFastTimer::writeLog(std::ostream& os) +void BlockTimer::writeLog(std::ostream& os) { while (!sLogQueue.empty()) { @@ -638,22 +435,57 @@ void LLFastTimer::writeLog(std::ostream& os) } } -//static -const LLFastTimer::NamedTimer* LLFastTimer::getTimerByName(const std::string& name) +////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// TimeBlockAccumulator +////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +TimeBlockAccumulator::TimeBlockAccumulator() +: mTotalTimeCounter(0), + mSelfTimeCounter(0), + mCalls(0), + mLastCaller(NULL), + mActiveCount(0), + mMoveUpTree(false), + mParent(NULL) +{} + +void TimeBlockAccumulator::addSamples( const TimeBlockAccumulator& other, EBufferAppendType append_type ) { - return NamedTimerFactory::instance().getTimerByName(name); +#if LL_TRACE_ENABLED + // we can't merge two unrelated time block samples, as that will screw with the nested timings + // due to the call hierarchy of each thread + llassert(append_type == SEQUENTIAL); + mTotalTimeCounter += other.mTotalTimeCounter; + mSelfTimeCounter += other.mSelfTimeCounter; + mCalls += other.mCalls; + mLastCaller = other.mLastCaller; + mActiveCount = other.mActiveCount; + mMoveUpTree = other.mMoveUpTree; + mParent = other.mParent; +#endif } -LLFastTimer::LLFastTimer(LLFastTimer::FrameState* state) -: mFrameState(state) +void TimeBlockAccumulator::reset( const TimeBlockAccumulator* other ) +{ + mCalls = 0; + mSelfTimeCounter = 0; + mTotalTimeCounter = 0; + + if (other) { - U32 start_time = getCPUClockCount32(); - mStartTime = start_time; - mFrameState->mActiveCount++; - LLFastTimer::sCurTimerData.mCurTimer = this; - LLFastTimer::sCurTimerData.mFrameState = mFrameState; - LLFastTimer::sCurTimerData.mChildTime = 0; - mLastTimerData = LLFastTimer::sCurTimerData; + mLastCaller = other->mLastCaller; + mActiveCount = other->mActiveCount; + mMoveUpTree = other->mMoveUpTree; + mParent = other->mParent; + } +} + +F64Seconds BlockTimer::getElapsedTime() +{ + U64 total_time = getCPUClockCount64() - mStartTime; + + return F64Seconds((F64)total_time / (F64)BlockTimer::countsPerSecond()); } +} // namespace LLTrace diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index a99a1d88af0859ebbe9d90b5c14ff747cfc4021a..237025307843de532441cb8416c41f13dd190414 100755 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -28,218 +28,30 @@ #define LL_FASTTIMER_H #include "llinstancetracker.h" +#include "lltrace.h" +#include "lltreeiterators.h" -#define FAST_TIMER_ON 1 -#define DEBUG_FAST_TIMER_THREADS 1 - -class LLMutex; - -#include <queue> -#include "llsd.h" - +#define LL_FAST_TIMER_ON 1 #define LL_FASTTIMER_USE_RDTSC 1 +#define LL_RECORD_BLOCK_TIME(timer_stat) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(timer_stat)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); -LL_COMMON_API void assert_main_thread(); - -class LL_COMMON_API LLFastTimer +namespace LLTrace { -public: - class NamedTimer; - - struct LL_COMMON_API FrameState - { - FrameState(); - void setNamedTimer(NamedTimer* timerp) { mTimer = timerp; } - - U32 mSelfTimeCounter; - U32 mCalls; - FrameState* mParent; // info for caller timer - FrameState* mLastCaller; // used to bootstrap tree construction - NamedTimer* mTimer; - U16 mActiveCount; // number of timers with this ID active on stack - bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame - }; - - // stores a "named" timer instance to be reused via multiple LLFastTimer stack instances - class LL_COMMON_API NamedTimer - : public LLInstanceTracker<NamedTimer> - { - friend class DeclareTimer; - public: - ~NamedTimer(); - - enum { HISTORY_NUM = 300 }; - - const std::string& getName() const { return mName; } - NamedTimer* getParent() const { return mParent; } - void setParent(NamedTimer* parent); - S32 getDepth(); - std::string getToolTip(S32 history_index = -1); - - typedef std::vector<NamedTimer*>::const_iterator child_const_iter; - child_const_iter beginChildren(); - child_const_iter endChildren(); - std::vector<NamedTimer*>& getChildren(); - - void setCollapsed(bool collapsed) { mCollapsed = collapsed; } - bool getCollapsed() const { return mCollapsed; } - - U32 getCountAverage() const { return mCountAverage; } - U32 getCallAverage() const { return mCallAverage; } - - U32 getHistoricalCount(S32 history_index = 0) const; - U32 getHistoricalCalls(S32 history_index = 0) const; - - static NamedTimer& getRootNamedTimer(); - - void setFrameState(FrameState* state) { mFrameState = state; state->setNamedTimer(this); } - FrameState& getFrameState() const; - - private: - friend class LLFastTimer; - friend class NamedTimerFactory; - - // - // methods - // - NamedTimer(const std::string& name); - // recursive call to gather total time from children - static void accumulateTimings(); - - // updates cumulative times and hierarchy, - // can be called multiple times in a frame, at any point - static void processTimes(); - - static void buildHierarchy(); - static void resetFrame(); - static void reset(); - - // - // members - // - FrameState* mFrameState; - - std::string mName; - - U32 mTotalTimeCounter; - - U32 mCountAverage; - U32 mCallAverage; - - U32* mCountHistory; - U32* mCallHistory; - - // tree structure - NamedTimer* mParent; // NamedTimer of caller(parent) - std::vector<NamedTimer*> mChildren; - bool mCollapsed; // don't show children - bool mNeedsSorting; // sort children whenever child added - }; - - // used to statically declare a new named timer - class LL_COMMON_API DeclareTimer - : public LLInstanceTracker< DeclareTimer > - { - friend class LLFastTimer; - public: - - DeclareTimer(const std::string& name, bool open); - DeclareTimer(const std::string& name); - - NamedTimer& getNamedTimer() { return mTimer; } - - private: - FrameState mFrameState; - NamedTimer& mTimer; - }; - -public: - LLFastTimer(LLFastTimer::FrameState* state); - - LL_FORCE_INLINE LLFastTimer(LLFastTimer::DeclareTimer& timer) - : mFrameState(&timer.mFrameState) - { -#if FAST_TIMER_ON - LLFastTimer::FrameState* frame_state = mFrameState; - mStartTime = getCPUClockCount32(); - - frame_state->mActiveCount++; - frame_state->mCalls++; - // keep current parent as long as it is active when we are - frame_state->mMoveUpTree |= (frame_state->mParent->mActiveCount == 0); - - LLFastTimer::CurTimerData* cur_timer_data = &LLFastTimer::sCurTimerData; - mLastTimerData = *cur_timer_data; - cur_timer_data->mCurTimer = this; - cur_timer_data->mFrameState = frame_state; - cur_timer_data->mChildTime = 0; -#endif -#if DEBUG_FAST_TIMER_THREADS -#if !LL_RELEASE - assert_main_thread(); -#endif -#endif - } - - LL_FORCE_INLINE ~LLFastTimer() - { -#if FAST_TIMER_ON - LLFastTimer::FrameState* frame_state = mFrameState; - U32 total_time = getCPUClockCount32() - mStartTime; - - frame_state->mSelfTimeCounter += total_time - LLFastTimer::sCurTimerData.mChildTime; - frame_state->mActiveCount--; - - // store last caller to bootstrap tree creation - // do this in the destructor in case of recursion to get topmost caller - frame_state->mLastCaller = mLastTimerData.mFrameState; - - // we are only tracking self time, so subtract our total time delta from parents - mLastTimerData.mChildTime += total_time; - - LLFastTimer::sCurTimerData = mLastTimerData; -#endif - } +// use to create blocktimer rvalue to be captured in a reference so that the BlockTimer lives to the end of the block. +class BlockTimer timeThisBlock(class BlockTimerStatHandle& timer); +class BlockTimer +{ public: - static LLMutex* sLogLock; - static std::queue<LLSD> sLogQueue; - static BOOL sLog; - static BOOL sMetricLog; - static std::string sLogName; - static bool sPauseHistory; - static bool sResetHistory; - - // call this once a frame to reset timers - static void nextFrame(); + typedef BlockTimer self_t; + typedef class BlockTimerStatHandle DeclareTimer; - // dumps current cumulative frame stats to log - // call nextFrame() to reset timers - static void dumpCurTimes(); + ~BlockTimer(); - // call this to reset timer hierarchy, averages, etc. - static void reset(); + F64Seconds getElapsedTime(); - static U64 countsPerSecond(); - static S32 getLastFrameIndex() { return sLastFrameIndex; } - static S32 getCurFrameIndex() { return sCurFrameIndex; } - - static void writeLog(std::ostream& os); - static const NamedTimer* getTimerByName(const std::string& name); - - struct CurTimerData - { - LLFastTimer* mCurTimer; - FrameState* mFrameState; - U32 mChildTime; - }; - static CurTimerData sCurTimerData; - -private: - - - ////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// // // Important note: These implementations must be FAST! // @@ -261,14 +73,14 @@ class LL_COMMON_API LLFastTimer //#undef _interlockedbittestandset //#undef _interlockedbittestandreset - //inline U32 LLFastTimer::getCPUClockCount32() + //inline U32 getCPUClockCount32() //{ // U64 time_stamp = __rdtsc(); // return (U32)(time_stamp >> 8); //} // //// return full timer value, *not* shifted by 8 bits - //inline U64 LLFastTimer::getCPUClockCount64() + //inline U64 getCPUClockCount64() //{ // return __rdtsc(); //} @@ -308,7 +120,7 @@ class LL_COMMON_API LLFastTimer } #else - //LL_COMMON_API U64 get_clock_count(); // in lltimer.cpp + //U64 get_clock_count(); // in lltimer.cpp // These use QueryPerformanceCounter, which is arguably fine and also works on AMD architectures. static U32 getCPUClockCount32() { @@ -375,18 +187,160 @@ class LL_COMMON_API LLFastTimer #endif - static U64 sClockResolution; + static BlockTimerStatHandle& getRootTimeBlock(); + static void pushLog(LLSD sd); + static void setLogLock(class LLMutex* mutex); + static void writeLog(std::ostream& os); + static void updateTimes(); + + static U64 countsPerSecond(); + + // updates cumulative times and hierarchy, + // can be called multiple times in a frame, at any point + static void processTimes(); - static S32 sCurFrameIndex; - static S32 sLastFrameIndex; - static U64 sLastFrameTime; + static void bootstrapTimerTree(); + static void incrementalUpdateTimerTree(); - U32 mStartTime; - LLFastTimer::FrameState* mFrameState; - LLFastTimer::CurTimerData mLastTimerData; + // call this once a frame to periodically log timers + static void logStats(); + + // dumps current cumulative frame stats to log + // call nextFrame() to reset timers + static void dumpCurTimes(); + +private: + friend class BlockTimerStatHandle; + // FIXME: this friendship exists so that each thread can instantiate a root timer, + // which could be a derived class with a public constructor instead, possibly + friend class ThreadRecorder; + friend BlockTimer timeThisBlock(BlockTimerStatHandle&); + + BlockTimer(BlockTimerStatHandle& timer); +#if !defined(MSC_VER) || MSC_VER < 1700 + // Visual Studio 2010 has a bug where capturing an object returned by value + // into a local reference requires access to the copy constructor at the call site. + // This appears to be fixed in 2012. +public: +#endif + // no-copy + BlockTimer(const BlockTimer& other) {}; + +private: + U64 mStartTime; + BlockTimerStackRecord mParentTimerData; + +public: + // statics + static std::string sLogName; + static bool sMetricLog, + sLog; + static U64 sClockResolution; }; -typedef class LLFastTimer LLFastTimer; +// this dummy function assists in allocating a block timer with stack-based lifetime. +// this is done by capturing the return value in a stack-allocated const reference variable. +// (This is most easily done using the macro LL_RECORD_BLOCK_TIME) +// Otherwise, it would be possible to store a BlockTimer on the heap, resulting in non-nested lifetimes, +// which would break the invariants of the timing hierarchy logic +LL_FORCE_INLINE class BlockTimer timeThisBlock(class BlockTimerStatHandle& timer) +{ + return BlockTimer(timer); +} + +// stores a "named" timer instance to be reused via multiple BlockTimer stack instances +class BlockTimerStatHandle +: public StatType<TimeBlockAccumulator> +{ +public: + BlockTimerStatHandle(const char* name, const char* description = ""); + + TimeBlockTreeNode& getTreeNode() const; + BlockTimerStatHandle* getParent() const { return getTreeNode().getParent(); } + void setParent(BlockTimerStatHandle* parent) { getTreeNode().setParent(parent); } + + typedef std::vector<BlockTimerStatHandle*>::iterator child_iter; + typedef std::vector<BlockTimerStatHandle*>::const_iterator child_const_iter; + child_iter beginChildren(); + child_iter endChildren(); + bool hasChildren(); + std::vector<BlockTimerStatHandle*>& getChildren(); + + StatType<TimeBlockAccumulator::CallCountFacet>& callCount() + { + return static_cast<StatType<TimeBlockAccumulator::CallCountFacet>&>(*(StatType<TimeBlockAccumulator>*)this); + } + + StatType<TimeBlockAccumulator::SelfTimeFacet>& selfTime() + { + return static_cast<StatType<TimeBlockAccumulator::SelfTimeFacet>&>(*(StatType<TimeBlockAccumulator>*)this); + } + + bool mCollapsed; // don't show children +}; + +// iterators and helper functions for walking the call hierarchy of block timers in different ways +typedef LLTreeDFSIter<BlockTimerStatHandle, BlockTimerStatHandle::child_const_iter> block_timer_tree_df_iterator_t; +typedef LLTreeDFSPostIter<BlockTimerStatHandle, BlockTimerStatHandle::child_const_iter> block_timer_tree_df_post_iterator_t; +typedef LLTreeBFSIter<BlockTimerStatHandle, BlockTimerStatHandle::child_const_iter> block_timer_tree_bf_iterator_t; + +block_timer_tree_df_iterator_t begin_block_timer_tree_df(BlockTimerStatHandle& id); +block_timer_tree_df_iterator_t end_block_timer_tree_df(); +block_timer_tree_df_post_iterator_t begin_block_timer_tree_df_post(BlockTimerStatHandle& id); +block_timer_tree_df_post_iterator_t end_block_timer_tree_df_post(); +block_timer_tree_bf_iterator_t begin_block_timer_tree_bf(BlockTimerStatHandle& id); +block_timer_tree_bf_iterator_t end_block_timer_tree_bf(); + +LL_FORCE_INLINE BlockTimer::BlockTimer(BlockTimerStatHandle& timer) +{ +#if LL_FAST_TIMER_ON + BlockTimerStackRecord* cur_timer_data = LLThreadLocalSingletonPointer<BlockTimerStackRecord>::getInstance(); + if (!cur_timer_data) return; + TimeBlockAccumulator& accumulator = timer.getCurrentAccumulator(); + accumulator.mActiveCount++; + // keep current parent as long as it is active when we are + accumulator.mMoveUpTree |= (accumulator.mParent->getCurrentAccumulator().mActiveCount == 0); + + // store top of stack + mParentTimerData = *cur_timer_data; + // push new information + cur_timer_data->mActiveTimer = this; + cur_timer_data->mTimeBlock = &timer; + cur_timer_data->mChildTime = 0; + + mStartTime = getCPUClockCount64(); +#endif +} + +LL_FORCE_INLINE BlockTimer::~BlockTimer() +{ +#if LL_FAST_TIMER_ON + U64 total_time = getCPUClockCount64() - mStartTime; + BlockTimerStackRecord* cur_timer_data = LLThreadLocalSingletonPointer<BlockTimerStackRecord>::getInstance(); + if (!cur_timer_data) return; + + TimeBlockAccumulator& accumulator = cur_timer_data->mTimeBlock->getCurrentAccumulator(); + + accumulator.mCalls++; + accumulator.mTotalTimeCounter += total_time; + accumulator.mSelfTimeCounter += total_time - cur_timer_data->mChildTime; + accumulator.mActiveCount--; + + // store last caller to bootstrap tree creation + // do this in the destructor in case of recursion to get topmost caller + accumulator.mLastCaller = mParentTimerData.mTimeBlock; + + // we are only tracking self time, so subtract our total time delta from parents + mParentTimerData.mChildTime += total_time; + + //pop stack + *cur_timer_data = mParentTimerData; +#endif +} + +} + +typedef LLTrace::BlockTimer LLFastTimer; #endif // LL_LLFASTTIMER_H diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 761d7f430cfb4a6d6ceb5688a8f51bdc5680e6d7..259187c52f60ea38dfa8adf4d3af22d2ea023c71 100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -28,7 +28,7 @@ */ #if LL_WINDOWS -#include <windows.h> +#include "llwin32headerslean.h" #include <stdlib.h> // Windows errno #else #include <errno.h> @@ -469,7 +469,7 @@ llstdio_filebuf::int_type llstdio_filebuf::overflow(llstdio_filebuf::int_type __ _M_set_buffer(0); __ret = traits_type::not_eof(__c); } - } + } else if (_M_buf_size > 1) { // Overflow in 'uncommitted' mode: set _M_writing, set @@ -527,11 +527,11 @@ bool llstdio_filebuf::_convert_to_external(char_type* __ibuf, if (__r == codecvt_base::ok || __r == codecvt_base::partial) __blen = __bend - __buf; else if (__r == codecvt_base::noconv) - { + { // Same as the always_noconv case above. __buf = reinterpret_cast<char*>(__ibuf); __blen = __ilen; - } + } else __throw_ios_failure(__N("llstdio_filebuf::_convert_to_external " "conversion error")); @@ -674,9 +674,9 @@ llstdio_filebuf::int_type llstdio_filebuf::underflow() _M_ext_end, _M_ext_next, this->eback(), this->eback() + __buflen, __iend); -} + } if (__r == codecvt_base::noconv) -{ + { size_t __avail = _M_ext_end - _M_ext_buf; __ilen = std::min(__avail, __buflen); traits_type::copy(this->eback(), @@ -837,15 +837,15 @@ std::streamsize llstdio_filebuf::xsputn(char_type* __s, std::streamsize __n) __ret = fwrite(__buf, 1, __buffill, _M_file.file()); } if (__ret == __buffill) - { + { __ret += fwrite(reinterpret_cast<const char*>(__s), 1, __n, _M_file.file()); - } + } if (__ret == __buffill + __n) { _M_set_buffer(0); _M_writing = true; -} + } if (__ret > __buffill) __ret -= __buffill; else @@ -879,7 +879,7 @@ llifstream::llifstream() : _M_filebuf(), #endif // explicit -llifstream::llifstream(const std::string& _Filename, +llifstream::llifstream(const std::string& _Filename, ios_base::openmode _Mode) : _M_filebuf(), #if LL_WINDOWS std::istream(&_M_filebuf) @@ -908,7 +908,7 @@ llifstream::llifstream(const char* _Filename, if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) { _Myios::setstate(ios_base::failbit); -} + } } #else std::istream() @@ -982,8 +982,8 @@ void llifstream::close() #else this->setstate(ios_base::failbit); #endif - } } +} /************** output file stream ********************************/ @@ -1073,7 +1073,7 @@ void llofstream::open(const char* _Filename, ios_base::openmode _Mode) #if LL_WINDOWS llutf16string wideName = utf8str_to_utf16str( _Filename ); if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) -{ + { _Myios::setstate(ios_base::failbit); } else diff --git a/indra/llcommon/llfindlocale.cpp b/indra/llcommon/llfindlocale.cpp index cd7c0c7c09da5328bc559f5ef797efadd0abbd9d..f019bd0c647f675bba5c3fbfd57d499812189dfc 100755 --- a/indra/llcommon/llfindlocale.cpp +++ b/indra/llcommon/llfindlocale.cpp @@ -33,7 +33,7 @@ #include <ctype.h> #ifdef WIN32 -#include <windows.h> +#include "llwin32headers.h" #include <winnt.h> #endif diff --git a/indra/llcommon/llformat.h b/indra/llcommon/llformat.h index a4ec5e01de9f372453205fcd8c8c149d5d9221fa..fb8e7cd0456c1381d80f4b8e3e3be092a412bf2f 100755 --- a/indra/llcommon/llformat.h +++ b/indra/llcommon/llformat.h @@ -29,7 +29,7 @@ #define LL_LLFORMAT_H // Use as follows: -// llinfos << llformat("Test:%d (%.2f %.2f)", idx, x, y) << llendl; +// LL_INFOS() << llformat("Test:%d (%.2f %.2f)", idx, x, y) << LL_ENDL; // // *NOTE: buffer limited to 1024, (but vsnprintf prevents overrun) // should perhaps be replaced with boost::format. diff --git a/indra/llcommon/llframetimer.cpp b/indra/llcommon/llframetimer.cpp index ec64195b218c2078cef60f5f91be88d17534547a..1af2cb8afd5615ac8a816914616d31473bdab113 100755 --- a/indra/llcommon/llframetimer.cpp +++ b/indra/llcommon/llframetimer.cpp @@ -115,10 +115,10 @@ F64 LLFrameTimer::expiresAt() const BOOL LLFrameTimer::checkExpirationAndReset(F32 expiration) { - //llinfos << "LLFrameTimer::checkExpirationAndReset()" << llendl; - //llinfos << " mStartTime:" << mStartTime << llendl; - //llinfos << " sFrameTime:" << sFrameTime << llendl; - //llinfos << " mExpiry: " << mExpiry << llendl; + //LL_INFOS() << "LLFrameTimer::checkExpirationAndReset()" << LL_ENDL; + //LL_INFOS() << " mStartTime:" << mStartTime << LL_ENDL; + //LL_INFOS() << " sFrameTime:" << sFrameTime << LL_ENDL; + //LL_INFOS() << " mExpiry: " << mExpiry << LL_ENDL; if(hasExpired()) { diff --git a/indra/llcommon/llframetimer.h b/indra/llcommon/llframetimer.h index 45754f3785e6f23481677021d393f35d68d7f1ea..81bd5da8a3e79e91bf69c61e6d3893a0dc5a9f7b 100755 --- a/indra/llcommon/llframetimer.h +++ b/indra/llcommon/llframetimer.h @@ -35,7 +35,6 @@ */ #include "lltimer.h" -#include "timing.h" class LL_COMMON_API LLFrameTimer { @@ -44,7 +43,7 @@ class LL_COMMON_API LLFrameTimer // Return the number of seconds since the start of this // application instance. - static F64 getElapsedSeconds() + static F64SecondsImplicit getElapsedSeconds() { // Loses msec precision after ~4.5 hours... return sFrameTime; @@ -53,7 +52,7 @@ class LL_COMMON_API LLFrameTimer // Return a low precision usec since epoch static U64 getTotalTime() { - return sTotalTime ? sTotalTime : totalTime(); + return sTotalTime ? U64MicrosecondsImplicit(sTotalTime) : totalTime(); } // Return a low precision seconds since epoch diff --git a/indra/llcommon/llheartbeat.cpp b/indra/llcommon/llheartbeat.cpp index 18a0c489bdb295ba2b180cea62faf792f3a765aa..19b7452748d930fdcad31318cc2473ff234f2b69 100755 --- a/indra/llcommon/llheartbeat.cpp +++ b/indra/llcommon/llheartbeat.cpp @@ -98,7 +98,7 @@ LLHeartbeat::rawSendWithTimeout(F32 timeout_sec) mTimeoutTimer.setTimerExpirySec(timeout_sec); do { result = rawSend(); - //llinfos << " HEARTSENDc=" << result << llendl; + //LL_INFOS() << " HEARTSENDc=" << result << LL_ENDL; } while (result==1 && !mTimeoutTimer.hasExpired()); return result; @@ -118,7 +118,7 @@ LLHeartbeat::send(F32 timeout_sec) // zero-timeout; we don't care too much whether our // heartbeat was digested. result = rawSend(); - //llinfos << " HEARTSENDb=" << result << llendl; + //LL_INFOS() << " HEARTSENDb=" << result << LL_ENDL; } } @@ -146,14 +146,14 @@ LLHeartbeat::send(F32 timeout_sec) // It's been ages since we successfully had a heartbeat // digested by the watchdog. Sit here and spin a while // in the hope that we can force it through. - llwarns << "Unable to deliver heartbeat to launcher for " << mPanicTimer.getElapsedTimeF32() << " seconds. Going to try very hard for up to " << mAggressiveHeartbeatMaxBlockingSecs << " seconds." << llendl; + LL_WARNS() << "Unable to deliver heartbeat to launcher for " << mPanicTimer.getElapsedTimeF32() << " seconds. Going to try very hard for up to " << mAggressiveHeartbeatMaxBlockingSecs << " seconds." << LL_ENDL; result = rawSendWithTimeout(mAggressiveHeartbeatMaxBlockingSecs); if (result == 0) { total_success = true; } else { // we couldn't even force it through. That's bad, // but we'll try again in a while. - llwarns << "Could not deliver heartbeat to launcher even after trying very hard for " << mAggressiveHeartbeatMaxBlockingSecs << " seconds." << llendl; + LL_WARNS() << "Could not deliver heartbeat to launcher even after trying very hard for " << mAggressiveHeartbeatMaxBlockingSecs << " seconds." << LL_ENDL; } // in any case, reset the panic timer. diff --git a/indra/llcommon/llindexedqueue.h b/indra/llcommon/llindexedqueue.h deleted file mode 100755 index aa2675d87d5a08fd1c22719f55298b38ee359066..0000000000000000000000000000000000000000 --- a/indra/llcommon/llindexedqueue.h +++ /dev/null @@ -1,155 +0,0 @@ -/** - * @file llindexedqueue.h - * @brief An indexed FIFO queue, where only one element with each key - * can be in the queue. - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLINDEXEDQUEUE_H -#define LL_LLINDEXEDQUEUE_H - -// An indexed FIFO queue, where only one element with each key can be in the queue. -// This is ONLY used in the interest list, you'll probably want to review this code -// carefully if you want to use it elsewhere - Doug - -template <typename Type> -class LLIndexedQueue -{ -protected: - typedef std::deque<Type> type_deque; - type_deque mQueue; - std::set<Type> mKeySet; - -public: - LLIndexedQueue() {} - - // move_if_there is an O(n) operation - bool push_back(const Type &value, bool move_if_there = false) - { - if (mKeySet.find(value) != mKeySet.end()) - { - // Already on the queue - if (move_if_there) - { - // Remove the existing entry. - typename type_deque::iterator it; - for (it = mQueue.begin(); it != mQueue.end(); ++it) - { - if (*it == value) - { - break; - } - } - - // This HAS to succeed, otherwise there's a serious bug in the keyset implementation - // (although this isn't thread safe, at all) - - mQueue.erase(it); - } - else - { - // We're not moving it, leave it alone - return false; - } - } - else - { - // Doesn't exist, add it to the key set - mKeySet.insert(value); - } - - mQueue.push_back(value); - - // We succeeded in adding the new element. - return true; - } - - bool push_front(const Type &value, bool move_if_there = false) - { - if (mKeySet.find(value) != mKeySet.end()) - { - // Already on the queue - if (move_if_there) - { - // Remove the existing entry. - typename type_deque::iterator it; - for (it = mQueue.begin(); it != mQueue.end(); ++it) - { - if (*it == value) - { - break; - } - } - - // This HAS to succeed, otherwise there's a serious bug in the keyset implementation - // (although this isn't thread safe, at all) - - mQueue.erase(it); - } - else - { - // We're not moving it, leave it alone - return false; - } - } - else - { - // Doesn't exist, add it to the key set - mKeySet.insert(value); - } - - mQueue.push_front(value); - return true; - } - - void pop() - { - Type value = mQueue.front(); - mKeySet.erase(value); - mQueue.pop_front(); - } - - Type &front() - { - return mQueue.front(); - } - - S32 size() const - { - return mQueue.size(); - } - - bool empty() const - { - return mQueue.empty(); - } - - void clear() - { - // Clear out all elements on the queue - mQueue.clear(); - mKeySet.clear(); - } -}; - -#endif // LL_LLINDEXEDQUEUE_H diff --git a/indra/llcommon/llindexedvector.h b/indra/llcommon/llindexedvector.h new file mode 100755 index 0000000000000000000000000000000000000000..68c3821802b0822b7f1dbc04d8e281f8fc2a3a00 --- /dev/null +++ b/indra/llcommon/llindexedvector.h @@ -0,0 +1,100 @@ +/** + * @file lldarray.h + * @brief Wrapped std::vector for backward compatibility. + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLDARRAY_H +#define LL_LLDARRAY_H + +#include "llerror.h" + +#include <vector> +#include <map> + +//-------------------------------------------------------- +// LLIndexedVector +//-------------------------------------------------------- + +template <typename Type, typename Key, int BlockSize = 32> +class LLIndexedVector +{ +public: + typedef typename std::vector<Type>::iterator iterator; + typedef typename std::vector<Type>::const_iterator const_iterator; + typedef typename std::vector<Type>::reverse_iterator reverse_iterator; + typedef typename std::vector<Type>::const_reverse_iterator const_reverse_iterator; + typedef typename std::vector<Type>::size_type size_type; +protected: + std::vector<Type> mVector; + std::map<Key, U32> mIndexMap; + +public: + LLIndexedVector() { mVector.reserve(BlockSize); } + + iterator begin() { return mVector.begin(); } + const_iterator begin() const { return mVector.begin(); } + iterator end() { return mVector.end(); } + const_iterator end() const { return mVector.end(); } + + reverse_iterator rbegin() { return mVector.rbegin(); } + const_reverse_iterator rbegin() const { return mVector.rbegin(); } + reverse_iterator rend() { return mVector.rend(); } + const_reverse_iterator rend() const { return mVector.rend(); } + + void reset() { mVector.resize(0); mIndexMap.resize(0); } + bool empty() const { return mVector.empty(); } + size_type size() const { return mVector.size(); } + + Type& operator[](const Key& k) + { + typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); + if (iter == mIndexMap.end()) + { + U32 n = mVector.size(); + mIndexMap[k] = n; + mVector.push_back(Type()); + llassert(mVector.size() == mIndexMap.size()); + return mVector[n]; + } + else + { + return mVector[iter->second]; + } + } + + const_iterator find(const Key& k) const + { + typename std::map<Key, U32>::const_iterator iter = mIndexMap.find(k); + if(iter == mIndexMap.end()) + { + return mVector.end(); + } + else + { + return mVector.begin() + iter->second; + } + } +}; + +#endif diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp index 89c831d296861561a71bdc0bf0afe5d3b21fa5ad..aa2f4eb289b5e3e47d09f1cb99bb05ebc3274287 100755 --- a/indra/llcommon/llinitparam.cpp +++ b/indra/llcommon/llinitparam.cpp @@ -28,10 +28,17 @@ #include "linden_common.h" #include "llinitparam.h" +#include "llformat.h" namespace LLInitParam { + + predicate_rule_t default_parse_rules() + { + return ll_make_predicate(PROVIDED) && !ll_make_predicate(EMPTY); + } + // // Param // @@ -93,13 +100,13 @@ namespace LLInitParam void Parser::parserWarning(const std::string& message) { if (mParseSilently) return; - llwarns << message << llendl; + LL_WARNS() << message << LL_ENDL; } void Parser::parserError(const std::string& message) { if (mParseSilently) return; - llerrs << message << llendl; + LL_ERRS() << message << LL_ENDL; } @@ -124,7 +131,7 @@ namespace LLInitParam std::string name(char_name); if ((size_t)param->mParamHandle > mMaxParamOffset) { - llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl; + LL_ERRS() << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << LL_ENDL; } if (name.empty()) @@ -196,6 +203,9 @@ namespace LLInitParam bool BaseBlock::validateBlock(bool emit_errors) const { + // only validate block when it hasn't already passed validation with current data + if (!mValidated) + { const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); for (BlockDescriptor::param_validation_list_t::const_iterator it = block_data.mValidationList.begin(); it != block_data.mValidationList.end(); ++it) { @@ -204,16 +214,23 @@ namespace LLInitParam { if (emit_errors) { - llwarns << "Invalid param \"" << getParamName(block_data, param) << "\"" << llendl; + LL_WARNS() << "Invalid param \"" << getParamName(block_data, param) << "\"" << LL_ENDL; } return false; } } - return true; + mValidated = true; + } + return mValidated; } - void BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const LLInitParam::BaseBlock* diff_block) const + bool BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const LLInitParam::BaseBlock* diff_block) const { + bool serialized = false; + if (!predicate_rule.check(ll_make_predicate(PROVIDED, isProvided()))) + { + return false; + } // named param is one like LLView::Params::follows // unnamed param is like LLView::Params::rect - implicit const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); @@ -225,10 +242,10 @@ namespace LLInitParam param_handle_t param_handle = (*it)->mParamHandle; const Param* param = getParamFromHandle(param_handle); ParamDescriptor::serialize_func_t serialize_func = (*it)->mSerializeFunc; - if (serialize_func) + if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided()))) { const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; - serialize_func(*param, parser, name_stack, diff_param); + serialized |= serialize_func(*param, parser, name_stack, predicate_rule, diff_param); } } @@ -239,7 +256,7 @@ namespace LLInitParam param_handle_t param_handle = it->second->mParamHandle; const Param* param = getParamFromHandle(param_handle); ParamDescriptor::serialize_func_t serialize_func = it->second->mSerializeFunc; - if (serialize_func && param->anyProvided()) + if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided()))) { // Ensure this param has not already been serialized // Prevents <rect> from being serialized as its own tag. @@ -264,10 +281,17 @@ namespace LLInitParam name_stack.push_back(std::make_pair(it->first, !duplicate)); const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; - serialize_func(*param, parser, name_stack, diff_param); + serialized |= serialize_func(*param, parser, name_stack, predicate_rule, diff_param); name_stack.pop_back(); } } + + if (!serialized && predicate_rule.check(ll_make_predicate(EMPTY))) + { + serialized |= parser.writeValue(Flag(), name_stack); + } + // was anything serialized in this block? + return serialized; } bool BaseBlock::inspectBlock(Parser& parser, Parser::name_stack_t name_stack, S32 min_count, S32 max_count) const @@ -393,7 +417,7 @@ namespace LLInitParam // Block<T, Base_Class> if ((size_t)handle > block_data.mMaxParamOffset) { - llerrs << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << llendl; + LL_ERRS() << "Attempted to register param with block defined for parent class, make sure to derive from LLInitParam::Block<YOUR_CLASS, PARAM_BLOCK_BASE_CLASS>" << LL_ENDL; } ParamDescriptorPtr param_descriptor = findParamDescriptor(param); diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 4bad0062a7ac7372b63b964865f5830fa082ff27..25325663191cac0094207b80328fc7dec86ae31a 100755 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -29,14 +29,16 @@ #define LL_LLPARAM_H #include <vector> +#include <list> #include <boost/function.hpp> #include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_enum.hpp> #include <boost/unordered_map.hpp> -#include <boost/shared_ptr.hpp> #include "llerror.h" #include "llstl.h" +#include "llpredicate.h" +#include "llsd.h" namespace LLTypeTags { @@ -195,6 +197,8 @@ namespace LLInitParam return mValue; } + bool isValid() const { return true; } + protected: T mValue; }; @@ -209,13 +213,11 @@ namespace LLInitParam typedef T value_t; ParamValue() - : T(), - mValidated(false) + : T() {} ParamValue(const default_value_t& other) - : T(other), - mValidated(false) + : T(other) {} void setValue(const value_t& val) @@ -232,9 +234,6 @@ namespace LLInitParam { return *this; } - - protected: - mutable bool mValidated; // lazy validation flag }; @@ -579,6 +578,19 @@ namespace LLInitParam class Param; + enum ESerializePredicates + { + PROVIDED, + REQUIRED, + VALID, + HAS_DEFAULT_VALUE, + EMPTY + }; + + typedef LLPredicate::Rule<ESerializePredicates> predicate_rule_t; + + predicate_rule_t default_parse_rules(); + // various callbacks and constraints associated with an individual param struct LL_COMMON_API ParamDescriptor { @@ -589,7 +601,7 @@ namespace LLInitParam typedef bool(*merge_func_t)(Param&, const Param&, bool); typedef bool(*deserialize_func_t)(Param&, Parser&, Parser::name_stack_range_t&, bool); - typedef void(*serialize_func_t)(const Param&, Parser&, Parser::name_stack_t&, const Param* diff_param); + typedef bool(*serialize_func_t)(const Param&, Parser&, Parser::name_stack_t&, const predicate_rule_t rules, const Param* diff_param); typedef void(*inspect_func_t)(const Param&, Parser&, Parser::name_stack_t&, S32 min_count, S32 max_count); typedef bool(*validation_func_t)(const Param*); @@ -617,7 +629,7 @@ namespace LLInitParam UserData* mUserData; }; - typedef boost::shared_ptr<ParamDescriptor> ParamDescriptorPtr; + typedef ParamDescriptor* ParamDescriptorPtr; // each derived Block class keeps a static data structure maintaining offsets to various params class LL_COMMON_API BlockDescriptor @@ -829,12 +841,28 @@ namespace LLInitParam LOG_CLASS(BaseBlock); friend class Param; + BaseBlock() + : mValidated(false), + mParamProvided(false) + {} + virtual ~BaseBlock() {} bool submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent=false); param_handle_t getHandleFromParam(const Param* param) const; bool validateBlock(bool emit_errors = true) const; + bool isProvided() const + { + return mParamProvided; + } + + bool isValid() const + { + return validateBlock(false); + } + + Param* getParamFromHandle(const param_handle_t param_handle) { if (param_handle == 0) return NULL; @@ -852,10 +880,19 @@ namespace LLInitParam void addSynonym(Param& param, const std::string& synonym); // Blocks can override this to do custom tracking of changes - virtual void paramChanged(const Param& changed_param, bool user_provided) {} + virtual void paramChanged(const Param& changed_param, bool user_provided) + { + if (user_provided) + { + // a child param has been explicitly changed + // so *some* aspect of this block is now provided + mValidated = false; + mParamProvided = true; + } + } bool deserializeBlock(Parser& p, Parser::name_stack_range_t& name_stack_range, bool new_name); - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t rule, const BaseBlock* diff_block = NULL) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const; virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return getBlockDescriptor(); } @@ -893,6 +930,9 @@ namespace LLInitParam return mergeBlock(block_data, source, overwrite); } + mutable bool mValidated; // lazy validation flag + bool mParamProvided; + private: const std::string& getParamName(const BlockDescriptor& block_data, const Param* paramp) const; }; @@ -986,6 +1026,8 @@ namespace LLInitParam bool isProvided() const { return Param::anyProvided(); } + bool isValid() const { return true; } + static bool deserializeParam(Param& param, Parser& parser, Parser::name_stack_range_t& name_stack_range, bool new_name) { self_t& typed_param = static_cast<self_t&>(param); @@ -1014,10 +1056,23 @@ namespace LLInitParam return false; } - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) + static bool serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const Param* diff_param) { + bool serialized = false; const self_t& typed_param = static_cast<const self_t&>(param); - if (!typed_param.isProvided()) return; + const self_t* diff_typed_param = static_cast<const self_t*>(diff_param); + + LLPredicate::Value<ESerializePredicates> predicate; + if (diff_typed_param && ParamCompare<T>::equals(typed_param.getValue(), diff_typed_param->getValue())) + { + predicate.set(HAS_DEFAULT_VALUE); + } + + predicate.set(VALID, typed_param.isValid()); + predicate.set(PROVIDED, typed_param.anyProvided()); + predicate.set(EMPTY, false); + + if (!predicate_rule.check(predicate)) return false; if (!name_stack.empty()) { @@ -1030,25 +1085,27 @@ namespace LLInitParam if (!key.empty()) { - if (!diff_param || !ParamCompare<std::string>::equals(static_cast<const self_t*>(diff_param)->getValueName(), key)) + if (!diff_typed_param || !ParamCompare<std::string>::equals(diff_typed_param->getValueName(), key)) { - parser.writeValue(key, name_stack); + serialized = parser.writeValue(key, name_stack); } } // then try to serialize value directly - else if (!diff_param || !ParamCompare<T>::equals(typed_param.getValue(), static_cast<const self_t*>(diff_param)->getValue())) + else if (!diff_typed_param || ParamCompare<T>::equals(typed_param.getValue(), diff_typed_param->getValue())) { - if (!parser.writeValue(typed_param.getValue(), name_stack)) + serialized = parser.writeValue(typed_param.getValue(), name_stack); + if (!serialized) { std::string calculated_key = typed_param.calcValueName(typed_param.getValue()); if (calculated_key.size() - && (!diff_param + && (!diff_typed_param || !ParamCompare<std::string>::equals(static_cast<const self_t*>(diff_param)->getValueName(), calculated_key))) { - parser.writeValue(calculated_key, name_stack); + serialized = parser.writeValue(calculated_key, name_stack); } } } + return serialized; } static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) @@ -1113,19 +1170,19 @@ namespace LLInitParam }; // parameter that is a block - template <typename T, typename NAME_VALUE_LOOKUP> - class TypedParam<T, NAME_VALUE_LOOKUP, false, IS_A_BLOCK> + template <typename BLOCK_T, typename NAME_VALUE_LOOKUP> + class TypedParam<BLOCK_T, NAME_VALUE_LOOKUP, false, IS_A_BLOCK> : public Param, public NAME_VALUE_LOOKUP::type_value_t { protected: - typedef ParamValue<typename LLTypeTags::Sorted<T>::value_t> param_value_t; - typedef typename param_value_t::default_value_t default_value_t; - typedef TypedParam<T, NAME_VALUE_LOOKUP, false, IS_A_BLOCK> self_t; - typedef typename NAME_VALUE_LOOKUP::type_value_t named_value_t; + typedef ParamValue<typename LLTypeTags::Sorted<BLOCK_T>::value_t> param_value_t; + typedef typename param_value_t::default_value_t default_value_t; + typedef TypedParam<BLOCK_T, NAME_VALUE_LOOKUP, false, IS_A_BLOCK> self_t; + typedef typename NAME_VALUE_LOOKUP::type_value_t named_value_t; public: using named_value_t::operator(); - typedef typename param_value_t::value_t value_t; + typedef typename param_value_t::value_t value_t; TypedParam(BlockDescriptor& block_descriptor, const char* name, const default_value_t& value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) : Param(block_descriptor.mCurrentBlockPtr), @@ -1148,11 +1205,11 @@ namespace LLInitParam if(named_value_t::valueNamesExist() && parser.readValue(name) && named_value_t::getValueFromName(name, typed_param.getValue())) - { - typed_param.setValueName(name); - typed_param.setProvided(); - return true; - } + { + typed_param.setValueName(name); + typed_param.setProvided(); + return true; + } } if(typed_param.deserializeBlock(parser, name_stack_range, new_name)) @@ -1166,10 +1223,16 @@ namespace LLInitParam return false; } - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) + static bool serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const Param* diff_param) { const self_t& typed_param = static_cast<const self_t&>(param); - if (!typed_param.isProvided()) return; + + LLPredicate::Value<ESerializePredicates> predicate; + + predicate.set(VALID, typed_param.isValid()); + predicate.set(PROVIDED, typed_param.anyProvided()); + + if (!predicate_rule.check(predicate)) return false; if (!name_stack.empty()) { @@ -1182,12 +1245,15 @@ namespace LLInitParam if (!diff_param || !ParamCompare<std::string>::equals(static_cast<const self_t*>(diff_param)->getValueName(), key)) { parser.writeValue(key, name_stack); + return true; } } else { - typed_param.serializeBlock(parser, name_stack, static_cast<const self_t*>(diff_param)); + return typed_param.serializeBlock(parser, name_stack, predicate_rule, static_cast<const self_t*>(diff_param)); } + + return false; } static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) @@ -1209,13 +1275,12 @@ namespace LLInitParam // *and* the block as a whole validates bool isProvided() const { - // only validate block when it hasn't already passed validation with current data - if (Param::anyProvided() && !param_value_t::mValidated) - { - // a sub-block is "provided" when it has been filled in enough to be valid - param_value_t::mValidated = param_value_t::validateBlock(false); - } - return Param::anyProvided() && param_value_t::mValidated; + return Param::anyProvided() && isValid(); + } + + bool isValid() const + { + return param_value_t::isValid(); } // assign block contents to this param-that-is-a-block @@ -1223,9 +1288,6 @@ namespace LLInitParam { setValue(val); named_value_t::clearValueName(); - // force revalidation of block - // next call to isProvided() will update provision status based on validity - param_value_t::mValidated = false; setProvided(flag_as_provided); } @@ -1242,9 +1304,6 @@ namespace LLInitParam if (user_provided) { - // a child param has been explicitly changed - // so *some* aspect of this block is now provided - param_value_t::mValidated = false; setProvided(); named_value_t::clearValueName(); } @@ -1296,13 +1355,13 @@ namespace LLInitParam }; // list of non-block parameters - template <typename VALUE_TYPE, typename NAME_VALUE_LOOKUP> - class TypedParam<VALUE_TYPE, NAME_VALUE_LOOKUP, true, NOT_BLOCK> + template <typename MULTI_VALUE_T, typename NAME_VALUE_LOOKUP> + class TypedParam<MULTI_VALUE_T, NAME_VALUE_LOOKUP, true, NOT_BLOCK> : public Param { protected: - typedef TypedParam<VALUE_TYPE, NAME_VALUE_LOOKUP, true, NOT_BLOCK> self_t; - typedef ParamValue<typename LLTypeTags::Sorted<VALUE_TYPE>::value_t> param_value_t; + typedef TypedParam<MULTI_VALUE_T, NAME_VALUE_LOOKUP, true, NOT_BLOCK> self_t; + typedef ParamValue<typename LLTypeTags::Sorted<MULTI_VALUE_T>::value_t> param_value_t; typedef typename std::vector<typename NAME_VALUE_LOOKUP::type_value_t> container_t; typedef container_t default_value_t; typedef typename NAME_VALUE_LOOKUP::type_value_t named_value_t; @@ -1311,7 +1370,9 @@ namespace LLInitParam typedef typename param_value_t::value_t value_t; TypedParam(BlockDescriptor& block_descriptor, const char* name, const default_value_t& value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr) + : Param(block_descriptor.mCurrentBlockPtr), + mMinCount(min_count), + mMaxCount(max_count) { std::copy(value.begin(), value.end(), std::back_inserter(mValues)); @@ -1322,7 +1383,13 @@ namespace LLInitParam } } - bool isProvided() const { return Param::anyProvided(); } + bool isProvided() const { return Param::anyProvided() && isValid(); } + + bool isValid() const + { + size_t num_elements = numValidElements(); + return mMinCount < num_elements && num_elements < mMaxCount; + } static bool deserializeParam(Param& param, Parser& parser, Parser::name_stack_range_t& name_stack_range, bool new_name) { @@ -1337,7 +1404,7 @@ namespace LLInitParam } // no further names in stack, attempt to parse value now - if (name_stack_range.first == name_stack_range.second) + if (new_name_stack_range.first == new_name_stack_range.second) { std::string name; @@ -1359,10 +1426,19 @@ namespace LLInitParam return false; } - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) + static bool serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const Param* diff_param) { + bool serialized = false; const self_t& typed_param = static_cast<const self_t&>(param); - if (!typed_param.isProvided()) return; + + LLPredicate::Value<ESerializePredicates> predicate; + + predicate.set(REQUIRED, typed_param.mMinCount > 0); + predicate.set(VALID, typed_param.isValid()); + predicate.set(PROVIDED, typed_param.anyProvided()); + predicate.set(EMPTY, typed_param.mValues.empty()); + + if (!predicate_rule.check(predicate)) return false; for (const_iterator it = typed_param.mValues.begin(), end_it = typed_param.mValues.end(); it != end_it; @@ -1378,7 +1454,11 @@ namespace LLInitParam if (!value_written) { std::string calculated_key = it->calcValueName(it->getValue()); - if (!parser.writeValue(calculated_key, name_stack)) + if (parser.writeValue(calculated_key, name_stack)) + { + serialized = true; + } + else { break; } @@ -1386,19 +1466,23 @@ namespace LLInitParam } else { - if(!parser.writeValue(key, name_stack)) + if(parser.writeValue(key, name_stack)) + { + serialized = true; + } + else { break; } } - - name_stack.pop_back(); } + + return serialized; } static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) { - parser.inspectValue<VALUE_TYPE>(name_stack, min_count, max_count, NULL); + parser.inspectValue<MULTI_VALUE_T>(name_stack, min_count, max_count, NULL); if (named_value_t::getPossibleValues()) { parser.inspectValue<std::string>(name_stack, min_count, max_count, named_value_t::getPossibleValues()); @@ -1453,7 +1537,7 @@ namespace LLInitParam bool empty() const { return mValues.empty(); } size_t size() const { return mValues.size(); } - U32 numValidElements() const + size_t numValidElements() const { return mValues.size(); } @@ -1483,6 +1567,8 @@ namespace LLInitParam } container_t mValues; + size_t mMinCount, + mMaxCount; private: void init( BlockDescriptor &block_descriptor, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count, const char* name ) @@ -1500,13 +1586,13 @@ namespace LLInitParam }; // list of block parameters - template <typename VALUE_TYPE, typename NAME_VALUE_LOOKUP> - class TypedParam<VALUE_TYPE, NAME_VALUE_LOOKUP, true, IS_A_BLOCK> + template <typename MULTI_BLOCK_T, typename NAME_VALUE_LOOKUP> + class TypedParam<MULTI_BLOCK_T, NAME_VALUE_LOOKUP, true, IS_A_BLOCK> : public Param { protected: - typedef TypedParam<VALUE_TYPE, NAME_VALUE_LOOKUP, true, IS_A_BLOCK> self_t; - typedef ParamValue<typename LLTypeTags::Sorted<VALUE_TYPE>::value_t> param_value_t; + typedef TypedParam<MULTI_BLOCK_T, NAME_VALUE_LOOKUP, true, IS_A_BLOCK> self_t; + typedef ParamValue<typename LLTypeTags::Sorted<MULTI_BLOCK_T>::value_t> param_value_t; typedef typename std::vector<typename NAME_VALUE_LOOKUP::type_value_t> container_t; typedef typename NAME_VALUE_LOOKUP::type_value_t named_value_t; typedef container_t default_value_t; @@ -1516,7 +1602,9 @@ namespace LLInitParam typedef typename param_value_t::value_t value_t; TypedParam(BlockDescriptor& block_descriptor, const char* name, const default_value_t& value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr) + : Param(block_descriptor.mCurrentBlockPtr), + mMinCount(min_count), + mMaxCount(max_count) { std::copy(value.begin(), value.end(), back_inserter(mValues)); @@ -1526,7 +1614,14 @@ namespace LLInitParam } } - bool isProvided() const { return Param::anyProvided(); } + bool isProvided() const { return Param::anyProvided() && isValid(); } + + bool isValid() const + { + size_t num_elements = numValidElements(); + return mMinCount < num_elements && num_elements < mMaxCount; + } + static bool deserializeParam(Param& param, Parser& parser, Parser::name_stack_range_t& name_stack_range, bool new_name) { @@ -1549,7 +1644,7 @@ namespace LLInitParam } param_value_t& value = typed_param.mValues.back(); - if (name_stack_range.first == name_stack_range.second) + if (new_name_stack_range.first == new_name_stack_range.second) { // try to parse a known named value std::string name; @@ -1559,6 +1654,10 @@ namespace LLInitParam { typed_param.mValues.back().setValueName(name); typed_param.setProvided(); + if (new_array_value) + { + name_stack_range.first->second = false; + } return true; } } @@ -1583,10 +1682,18 @@ namespace LLInitParam return false; } - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) + static bool serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const Param* diff_param) { + bool serialized = false; const self_t& typed_param = static_cast<const self_t&>(param); - if (!typed_param.isProvided()) return; + LLPredicate::Value<ESerializePredicates> predicate; + + predicate.set(REQUIRED, typed_param.mMinCount > 0); + predicate.set(VALID, typed_param.isValid()); + predicate.set(PROVIDED, typed_param.anyProvided()); + predicate.set(EMPTY, typed_param.mValues.empty()); + + if (!predicate_rule.check(predicate)) return false; for (const_iterator it = typed_param.mValues.begin(), end_it = typed_param.mValues.end(); it != end_it; @@ -1597,17 +1704,24 @@ namespace LLInitParam std::string key = it->getValueName(); if (!key.empty()) { - parser.writeValue(key, name_stack); + serialized |= parser.writeValue(key, name_stack); } // Not parsed via named values, write out value directly - // NOTE: currently we don't worry about removing default values in Multiple + // NOTE: currently we don't do diffing of Multiples else { - it->serializeBlock(parser, name_stack, NULL); + serialized = it->serializeBlock(parser, name_stack, predicate_rule, NULL); } name_stack.pop_back(); } + + if (!serialized && predicate_rule.check(ll_make_predicate(EMPTY))) + { + serialized |= parser.writeValue(Flag(), name_stack); + } + + return serialized; } static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) @@ -1670,14 +1784,14 @@ namespace LLInitParam bool empty() const { return mValues.empty(); } size_t size() const { return mValues.size(); } - U32 numValidElements() const + size_t numValidElements() const { - U32 count = 0; + size_t count = 0; for (const_iterator it = mValues.begin(), end_it = mValues.end(); it != end_it; ++it) { - if(it->validateBlock(false)) count++; + if(it->isValid()) count++; } return count; } @@ -1709,6 +1823,8 @@ namespace LLInitParam } container_t mValues; + size_t mMinCount, + mMaxCount; private: void init( BlockDescriptor &block_descriptor, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count, const char* name ) @@ -2015,7 +2131,7 @@ namespace LLInitParam static bool validate(const Param* paramp) { - U32 num_valid = ((super_t*)paramp)->numValidElements(); + size_t num_valid = ((super_t*)paramp)->numValidElements(); return RANGE::minCount <= num_valid && num_valid <= RANGE::maxCount; } }; @@ -2158,13 +2274,11 @@ namespace LLInitParam typedef T default_value_t; ParamValue() - : mValue(), - mValidated(false) + : mValue() {} ParamValue(const default_value_t& value) - : mValue(value), - mValidated(false) + : mValue(value) {} void setValue(const value_t& val) @@ -2191,18 +2305,18 @@ namespace LLInitParam return mValue.deserializeBlock(p, name_stack_range, new_name); } - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const self_t* diff_block = NULL) const + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = NULL) const { const BaseBlock* base_block = diff_block ? &(diff_block->mValue) : NULL; - mValue.serializeBlock(p, name_stack, base_block); + return mValue.serializeBlock(p, name_stack, predicate_rule, base_block); } bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const - { + { return mValue.inspectBlock(p, name_stack, min_count, max_count); - } + } bool mergeBlockParam(bool source_provided, bool dst_provided, BlockDescriptor& block_data, const self_t& source, bool overwrite) { @@ -2212,9 +2326,7 @@ namespace LLInitParam // clear away what is there and take the new stuff as a whole resetToDefault(); return mValue.mergeBlock(block_data, source.getValue(), overwrite); - } - - + } return mValue.mergeBlock(block_data, source.getValue(), overwrite); } @@ -2223,14 +2335,17 @@ namespace LLInitParam return mValue.validateBlock(emit_errors); } + bool isValid() const + { + return validateBlock(false); + } + static BlockDescriptor& getBlockDescriptor() { return value_t::getBlockDescriptor(); } - mutable bool mValidated; // lazy validation flag - private: void resetToDefault() { @@ -2251,15 +2366,13 @@ namespace LLInitParam typedef T default_value_t; ParamValue() - : mValue(), - mValidated(false) + : mValue() { mCurParam = getBlockDescriptor().mAllParams.begin(); } ParamValue(const default_value_t& value) - : mValue(value), - mValidated(false) + : mValue(value) { mCurParam = getBlockDescriptor().mAllParams.begin(); } @@ -2284,7 +2397,7 @@ namespace LLInitParam if (new_name) { mCurParam = getBlockDescriptor().mAllParams.begin(); - } + } if (name_stack_range.first == name_stack_range.second && mCurParam != getBlockDescriptor().mAllParams.end()) { @@ -2296,7 +2409,7 @@ namespace LLInitParam if (deserialize_func && paramp && deserialize_func(*paramp, p, name_stack_range, new_name)) - { + { ++mCurParam; return true; } @@ -2304,19 +2417,19 @@ namespace LLInitParam { return false; } - } + } else { return mValue.deserializeBlock(p, name_stack_range, new_name); } } - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const self_t* diff_block = NULL) const + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = NULL) const { const BaseBlock* base_block = diff_block ? &(diff_block->mValue) : NULL; - mValue.serializeBlock(p, name_stack, base_block); + return mValue.serializeBlock(p, name_stack, predicate_rule, base_block); } bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const @@ -2334,13 +2447,16 @@ namespace LLInitParam return mValue.validateBlock(emit_errors); } + bool isValid() const + { + return validateBlock(false); + } + static BlockDescriptor& getBlockDescriptor() { return value_t::getBlockDescriptor(); } - mutable bool mValidated; // lazy validation flag - private: BlockDescriptor::all_params_list_t::iterator mCurParam; @@ -2358,16 +2474,14 @@ namespace LLInitParam typedef T default_value_t; ParamValue() - : T(), - mValidated(false) + : T() {} ParamValue(const default_value_t& value) - : T(value.getValue()), - mValidated(false) + : T(value.getValue()) {} - mutable bool mValidated; // lazy validation flag + bool isValid() const { return true; } }; template<typename T, typename BLOCK_T> @@ -2380,18 +2494,15 @@ namespace LLInitParam typedef LazyValue<T> default_value_t; ParamValue() - : mValue(), - mValidated(false) + : mValue() {} ParamValue(const default_value_t& other) - : mValue(other), - mValidated(false) + : mValue(other) {} ParamValue(const T& value) - : mValue(value), - mValidated(false) + : mValue(value) {} void setValue(const value_t& val) @@ -2414,14 +2525,14 @@ namespace LLInitParam return mValue.get().deserializeBlock(p, name_stack_range, new_name); } - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const self_t* diff_block = NULL) const + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = NULL) const { - if (mValue.empty()) return; + if (mValue.empty()) return false; const BaseBlock* base_block = (diff_block && !diff_block->mValue.empty()) ? &(diff_block->mValue.get().getValue()) : NULL; - mValue.get().serializeBlock(p, name_stack, base_block); + return mValue.get().serializeBlock(p, name_stack, predicate_rule, base_block); } bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const @@ -2433,26 +2544,29 @@ namespace LLInitParam { return source.mValue.empty() || mValue.get().mergeBlock(block_data, source.getValue(), overwrite); } - + bool validateBlock(bool emit_errors = true) const { return mValue.empty() || mValue.get().validateBlock(emit_errors); } + bool isValid() const + { + return validateBlock(false); + } + static BlockDescriptor& getBlockDescriptor() { return value_t::getBlockDescriptor(); } - mutable bool mValidated; // lazy validation flag - private: LazyValue<T> mValue; }; template<typename T, typename BLOCK_T> class ParamValue <BaseBlock::Lazy<T, NOT_BLOCK>, BLOCK_T> - { + { typedef ParamValue <BaseBlock::Lazy<T, NOT_BLOCK>, BLOCK_T> self_t; public: @@ -2460,18 +2574,15 @@ namespace LLInitParam typedef LazyValue<T> default_value_t; ParamValue() - : mValue(), - mValidated(false) + : mValue() {} ParamValue(const default_value_t& other) - : mValue(other), - mValidated(false) + : mValue(other) {} ParamValue(const T& value) - : mValue(value), - mValidated(false) + : mValue(value) {} void setValue(const value_t& val) @@ -2489,7 +2600,10 @@ namespace LLInitParam return mValue.get().getValue(); } - mutable bool mValidated; // lazy validation flag + bool isValid() const + { + return true; + } private: LazyValue<T> mValue; @@ -2504,12 +2618,10 @@ namespace LLInitParam typedef LLSD default_value_t; ParamValue() - : mValidated(false) {} ParamValue(const default_value_t& other) - : mValue(other), - mValidated(false) + : mValue(other) {} void setValue(const value_t& val) { mValue = val; } @@ -2519,16 +2631,13 @@ namespace LLInitParam // block param interface LL_COMMON_API bool deserializeBlock(Parser& p, Parser::name_stack_range_t& name_stack_range, bool new_name); - LL_COMMON_API void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; + LL_COMMON_API bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const BaseBlock* diff_block = NULL) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const { //TODO: implement LLSD params as schema type Any return true; } - protected: - mutable bool mValidated; // lazy validation flag - private: static void serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack); @@ -2547,18 +2656,17 @@ namespace LLInitParam BLOCK_AUTHORITATIVE // mValue is derived from the block parameters, which are authoritative } EValueAge; - typedef ParamValue<T> derived_t; - typedef CustomParamValue<T> self_t; - typedef Block<derived_t> block_t; + typedef TypeValues<T> derived_t; + typedef CustomParamValue<T> self_t; + typedef Block<ParamValue<T> > block_t; typedef T default_value_t; - typedef T value_t; + typedef T value_t; typedef void baseblock_base_class_t; CustomParamValue(const default_value_t& value = T()) : mValue(value), - mValueAge(VALUE_AUTHORITATIVE), - mValidated(false) + mValueAge(VALUE_AUTHORITATIVE) {} bool deserializeBlock(Parser& parser, Parser::name_stack_range_t& name_stack_range, bool new_name) @@ -2580,16 +2688,30 @@ namespace LLInitParam return typed_param.BaseBlock::deserializeBlock(parser, name_stack_range, new_name); } - void serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const + bool serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const BaseBlock* diff_block = NULL) const { const derived_t& typed_param = static_cast<const derived_t&>(*this); const derived_t* diff_param = static_cast<const derived_t*>(diff_block); + //std::string key = typed_param.getValueName(); + + //// first try to write out name of name/value pair + //if (!key.empty()) + //{ + // if (!diff_param || !ParamCompare<std::string>::equals(diff_param->getValueName(), key)) + // { + // return parser.writeValue(key, name_stack); + // } + //} // then try to serialize value directly if (!diff_param || !ParamCompare<T>::equals(typed_param.getValue(), diff_param->getValue())) { - if (!parser.writeValue(typed_param.getValue(), name_stack)) + if (parser.writeValue(typed_param.getValue(), name_stack)) + { + return true; + } + else { //RN: *always* serialize provided components of BlockValue (don't pass diff_param on), // since these tend to be viewed as the constructor arguments for the value T. It seems @@ -2606,14 +2728,15 @@ namespace LLInitParam // and serialize those params derived_t copy(typed_param); copy.updateBlockFromValue(true); - copy.block_t::serializeBlock(parser, name_stack, NULL); + return copy.block_t::serializeBlock(parser, name_stack, predicate_rule, NULL); } else { - block_t::serializeBlock(parser, name_stack, NULL); + return block_t::serializeBlock(parser, name_stack, predicate_rule, NULL); } } } + return false; } bool validateBlock(bool emit_errors = true) const @@ -2705,8 +2828,6 @@ namespace LLInitParam return block_t::mergeBlock(block_data, source, overwrite); } - mutable bool mValidated; // lazy validation flag - private: mutable T mValue; mutable EValueAge mValueAge; diff --git a/indra/llcommon/llinstancetracker.cpp b/indra/llcommon/llinstancetracker.cpp index 64a313b5ff29bdf6be44b20d56ad518d363f9683..11fc53f8c88edbf717270ceb5976a7c900bdbbbe 100755 --- a/indra/llcommon/llinstancetracker.cpp +++ b/indra/llcommon/llinstancetracker.cpp @@ -27,8 +27,26 @@ #include "linden_common.h" // associated header #include "llinstancetracker.h" +#include "llapr.h" + // STL headers // std headers // external library headers // other Linden headers +void LLInstanceTrackerBase::StaticBase::incrementDepth() +{ + apr_atomic_inc32(&sIterationNestDepth); +} + +void LLInstanceTrackerBase::StaticBase::decrementDepth() +{ + llassert(sIterationNestDepth); + apr_atomic_dec32(&sIterationNestDepth); +} + +U32 LLInstanceTrackerBase::StaticBase::getDepth() +{ + apr_uint32_t data = apr_atomic_read32(&sIterationNestDepth); + return data; +} diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 55187d8325cf554d8c89e80ecaec61efdff47199..9783644e66199625000e2debb200aaced5a1019c 100755 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -31,10 +31,7 @@ #include <map> #include <typeinfo> -#include "string_table.h" -#include <boost/utility.hpp> -#include <boost/function.hpp> -#include <boost/bind.hpp> +#include "llstringtable.h" #include <boost/iterator/transform_iterator.hpp> #include <boost/iterator/indirect_iterator.hpp> @@ -46,8 +43,6 @@ class LL_COMMON_API LLInstanceTrackerBase { protected: - - /// It's not essential to derive your STATICDATA (for use with /// getStatic()) from StaticBase; it's just that both known /// implementations do. @@ -56,31 +51,39 @@ class LL_COMMON_API LLInstanceTrackerBase StaticBase(): sIterationNestDepth(0) {} - S32 sIterationNestDepth; + + void incrementDepth(); + void decrementDepth(); + U32 getDepth(); + private: + U32 sIterationNestDepth; }; }; LL_COMMON_API void assert_main_thread(); +enum EInstanceTrackerAllowKeyCollisions +{ + LLInstanceTrackerErrorOnCollision, + LLInstanceTrackerReplaceOnCollision +}; + /// This mix-in class adds support for tracking all instances of the specified class parameter T /// The (optional) key associates a value of type KEY with a given instance of T, for quick lookup /// If KEY is not provided, then instances are stored in a simple set -/// @NOTE: see explicit specialization below for default KEY==T* case -template<typename T, typename KEY = T*> +/// @NOTE: see explicit specialization below for default KEY==void case +/// @NOTE: this class is not thread-safe unless used as read-only +template<typename T, typename KEY = void, EInstanceTrackerAllowKeyCollisions KEY_COLLISION_BEHAVIOR = LLInstanceTrackerErrorOnCollision> class LLInstanceTracker : public LLInstanceTrackerBase { typedef LLInstanceTracker<T, KEY> self_t; - typedef typename std::map<KEY, T*> InstanceMap; + typedef typename std::multimap<KEY, T*> InstanceMap; struct StaticData: public StaticBase { InstanceMap sMap; }; static StaticData& getStatic() { static StaticData sData; return sData;} - static InstanceMap& getMap_() - { - // assert_main_thread(); fwiw this class is not thread safe, and it used by multiple threads. Bad things happen. - return getStatic().sMap; - } + static InstanceMap& getMap_() { return getStatic().sMap; } public: class instance_iter : public boost::iterator_facade<instance_iter, T, boost::forward_traversal_tag> @@ -91,12 +94,12 @@ class LLInstanceTracker : public LLInstanceTrackerBase instance_iter(const typename InstanceMap::iterator& it) : mIterator(it) { - ++getStatic().sIterationNestDepth; + getStatic().incrementDepth(); } ~instance_iter() { - --getStatic().sIterationNestDepth; + getStatic().decrementDepth(); } @@ -123,20 +126,20 @@ class LLInstanceTracker : public LLInstanceTrackerBase typedef boost::iterator_facade<key_iter, KEY, boost::forward_traversal_tag> super_t; key_iter(typename InstanceMap::iterator it) - : mIterator(it) + : mIterator(it) { - ++getStatic().sIterationNestDepth; + getStatic().incrementDepth(); } key_iter(const key_iter& other) - : mIterator(other.mIterator) + : mIterator(other.mIterator) { - ++getStatic().sIterationNestDepth; + getStatic().incrementDepth(); } ~key_iter() { - --getStatic().sIterationNestDepth; + getStatic().decrementDepth(); } @@ -174,7 +177,10 @@ class LLInstanceTracker : public LLInstanceTrackerBase return instance_iter(getMap_().end()); } - static S32 instanceCount() { return getMap_().size(); } + static S32 instanceCount() + { + return getMap_().size(); + } static key_iter beginKeys() { @@ -186,7 +192,7 @@ class LLInstanceTracker : public LLInstanceTrackerBase } protected: - LLInstanceTracker(KEY key) + LLInstanceTracker(const KEY& key) { // make sure static data outlives all instances getStatic(); @@ -195,7 +201,7 @@ class LLInstanceTracker : public LLInstanceTrackerBase virtual ~LLInstanceTracker() { // it's unsafe to delete instances of this type while all instances are being iterated over. - llassert_always(getStatic().sIterationNestDepth == 0); + llassert_always(getStatic().getDepth() == 0); remove_(); } virtual void setKey(KEY key) { remove_(); add_(key); } @@ -205,17 +211,44 @@ class LLInstanceTracker : public LLInstanceTrackerBase LLInstanceTracker( const LLInstanceTracker& ); const LLInstanceTracker& operator=( const LLInstanceTracker& ); - void add_(KEY key) + void add_(const KEY& key) { mInstanceKey = key; - getMap_()[key] = static_cast<T*>(this); + InstanceMap& map = getMap_(); + typename InstanceMap::iterator insertion_point_it = map.lower_bound(key); + if (insertion_point_it != map.end() + && insertion_point_it->first == key) + { // found existing entry with that key + switch(KEY_COLLISION_BEHAVIOR) + { + case LLInstanceTrackerErrorOnCollision: + { + // use assert here instead of LL_ERRS(), otherwise the error will be ignored since this call is made during global object initialization + llassert_always_msg(false, "Instance with this same key already exists!"); + break; + } + case LLInstanceTrackerReplaceOnCollision: + { + // replace pointer, but leave key (should have compared equal anyway) + insertion_point_it->second = static_cast<T*>(this); + break; + } + default: + break; + } + } + else + { // new key + map.insert(insertion_point_it, std::make_pair(key, static_cast<T*>(this))); + } } void remove_() { - typename InstanceMap::iterator iter = getMap_().find(mInstanceKey); - if (iter != getMap_().end()) + InstanceMap& map = getMap_(); + typename InstanceMap::iterator iter = map.find(mInstanceKey); + if (iter != map.end()) { - getMap_().erase(iter); + map.erase(iter); } } @@ -223,12 +256,12 @@ class LLInstanceTracker : public LLInstanceTrackerBase KEY mInstanceKey; }; -/// explicit specialization for default case where KEY is T* +/// explicit specialization for default case where KEY is void /// use a simple std::set<T*> -template<typename T> -class LLInstanceTracker<T, T*> : public LLInstanceTrackerBase +template<typename T, EInstanceTrackerAllowKeyCollisions KEY_COLLISION_BEHAVIOR> +class LLInstanceTracker<T, void, KEY_COLLISION_BEHAVIOR> : public LLInstanceTrackerBase { - typedef LLInstanceTracker<T, T*> self_t; + typedef LLInstanceTracker<T, void> self_t; typedef typename std::set<T*> InstanceSet; struct StaticData: public StaticBase { @@ -261,18 +294,18 @@ class LLInstanceTracker<T, T*> : public LLInstanceTrackerBase instance_iter(const typename InstanceSet::iterator& it) : mIterator(it) { - ++getStatic().sIterationNestDepth; + getStatic().incrementDepth(); } instance_iter(const instance_iter& other) : mIterator(other.mIterator) { - ++getStatic().sIterationNestDepth; + getStatic().incrementDepth(); } ~instance_iter() { - --getStatic().sIterationNestDepth; + getStatic().decrementDepth(); } private: @@ -305,7 +338,7 @@ class LLInstanceTracker<T, T*> : public LLInstanceTrackerBase virtual ~LLInstanceTracker() { // it's unsafe to delete instances of this type while all instances are being iterated over. - llassert_always(getStatic().sIterationNestDepth == 0); + llassert_always(getStatic().getDepth() == 0); getSet_().erase(static_cast<T*>(this)); } diff --git a/indra/llcommon/lllazy.cpp b/indra/llcommon/lllazy.cpp deleted file mode 100755 index 29fa0403871c563f66cdbd75d7eff8ff28028f37..0000000000000000000000000000000000000000 --- a/indra/llcommon/lllazy.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file lllazy.cpp - * @author Nat Goodspeed - * @date 2009-01-28 - * @brief Implementation for lllazy. - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// Precompiled header -#include "linden_common.h" -// associated header -#include "lllazy.h" -// STL headers -// std headers -// external library headers -// other Linden headers - -// lllazy.h is presently header-only. This file exists only because our CMake -// test macro ADD_BUILD_TEST requires it. -int dummy = 0; diff --git a/indra/llcommon/lllazy.h b/indra/llcommon/lllazy.h deleted file mode 100755 index 5f3bbce79e9e71874c1733f426aa66b648da6087..0000000000000000000000000000000000000000 --- a/indra/llcommon/lllazy.h +++ /dev/null @@ -1,399 +0,0 @@ -/** - * @file lllazy.h - * @author Nat Goodspeed - * @date 2009-01-22 - * @brief Lazy instantiation of specified type. Useful in conjunction with - * Michael Feathers's "Extract and Override Getter" ("Working - * Effectively with Legacy Code", p. 352). - * - * Quoting his synopsis of steps on p.355: - * - * 1. Identify the object you need a getter for. - * 2. Extract all of the logic needed to create the object into a getter. - * 3. Replace all uses of the object with calls to the getter, and initialize - * the reference that holds the object to null in all constructors. - * 4. Add the first-time logic to the getter so that the object is constructed - * and assigned to the reference whenever the reference is null. - * 5. Subclass the class and override the getter to provide an alternative - * object for testing. - * - * It's the second half of bullet 3 (3b, as it were) that bothers me. I find - * it all too easy to imagine adding pointer initializers to all but one - * constructor... the one not exercised by my tests. That suggested using - * (e.g.) boost::scoped_ptr<MyObject> so you don't have to worry about - * destroying it either. - * - * However, introducing additional machinery allows us to encapsulate bullet 4 - * as well. - * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#if ! defined(LL_LLLAZY_H) -#define LL_LLLAZY_H - -#include <boost/function.hpp> -#include <boost/scoped_ptr.hpp> -#include <boost/lambda/construct.hpp> -#include <stdexcept> - -/// LLLazyCommon simply factors out of LLLazy<T> things that don't depend on -/// its template parameter. -class LLLazyCommon -{ -public: - /** - * This exception is thrown if you try to replace an LLLazy<T>'s factory - * (or T* instance) after it already has an instance in hand. Since T - * might well be stateful, we can't know the effect of silently discarding - * and replacing an existing instance, so we disallow it. This facility is - * intended for testing, and in a test scenario we can definitely control - * that. - */ - struct InstanceChange: public std::runtime_error - { - InstanceChange(const std::string& what): std::runtime_error(what) {} - }; - -protected: - /** - * InstanceChange might be appropriate in a couple of different LLLazy<T> - * methods. Factor out the common logic. - */ - template <typename PTR> - static void ensureNoInstance(const PTR& ptr) - { - if (ptr) - { - // Too late: we've already instantiated the lazy object. We don't - // know whether it's stateful or not, so it's not safe to discard - // the existing instance in favor of a replacement. - throw InstanceChange("Too late to replace LLLazy instance"); - } - } -}; - -/** - * LLLazy<T> is useful when you have an outer class Outer that you're trying - * to bring under unit test, that contains a data member difficult to - * instantiate in a test harness. Typically the data member's class Inner has - * many thorny dependencies. Feathers generally advocates "Extract and - * Override Factory Method" (p. 350). But in C++, you can't call a derived - * class override of a virtual method from the derived class constructor, - * which limits applicability of "Extract and Override Factory Method." For - * such cases Feathers presents "Extract and Override Getter" (p. 352). - * - * So we'll assume that your class Outer contains a member like this: - * @code - * Inner mInner; - * @endcode - * - * LLLazy<Inner> can be used to replace this member. You can directly declare: - * @code - * LLLazy<Inner> mInner; - * @endcode - * and change references to mInner accordingly. - * - * (Alternatively, you can add a base class of the form - * <tt>LLLazyBase<Inner></tt>. This is discussed further in the LLLazyBase<T> - * documentation.) - * - * LLLazy<T> binds a <tt>boost::scoped_ptr<T></tt> and a factory functor - * returning T*. You can either bind that functor explicitly or let it default - * to the expression <tt>new T()</tt>. - * - * As long as LLLazy<T> remains unreferenced, its T remains uninstantiated. - * The first time you use get(), <tt>operator*()</tt> or <tt>operator->()</tt> - * it will instantiate its T and thereafter behave like a pointer to it. - * - * Thus, any existing reference to <tt>mInner.member</tt> should be replaced - * with <tt>mInner->member</tt>. Any simple reference to @c mInner should be - * replaced by <tt>*mInner</tt>. - * - * (If the original declaration was a pointer initialized in Outer's - * constructor, e.g. <tt>Inner* mInner</tt>, so much the better. In that case - * you should be able to drop in <tt>LLLazy<Inner></tt> without much change.) - * - * The support for "Extract and Override Getter" lies in the fact that you can - * replace the factory functor -- or provide an explicit T*. Presumably this - * is most useful from a test subclass -- which suggests that your @c mInner - * member should be @c protected. - * - * Note that <tt>boost::lambda::new_ptr<T>()</tt> makes a dandy factory - * functor, for either the set() method or LLLazy<T>'s constructor. If your T - * requires constructor arguments, use an expression more like - * <tt>boost::lambda::bind(boost::lambda::new_ptr<T>(), arg1, arg2, ...)</tt>. - * - * Of course the point of replacing the functor is to substitute a class that, - * though referenced as Inner*, is not an Inner; presumably this is a testing - * subclass of Inner (e.g. TestInner). Thus your test subclass TestOuter for - * the containing class Outer will contain something like this: - * @code - * class TestOuter: public Outer - * { - * public: - * TestOuter() - * { - * // mInner must be 'protected' rather than 'private' - * mInner.set(boost::lambda::new_ptr<TestInner>()); - * } - * ... - * }; - * @endcode - */ -template <typename T> -class LLLazy: public LLLazyCommon -{ -public: - /// Any nullary functor returning T* will work as a Factory - typedef boost::function<T* ()> Factory; - - /// The default LLLazy constructor uses <tt>new T()</tt> as its Factory - LLLazy(): - mFactory(boost::lambda::new_ptr<T>()) - {} - - /// Bind an explicit Factory functor - LLLazy(const Factory& factory): - mFactory(factory) - {} - - /// Reference T, instantiating it if this is the first access - const T& get() const - { - if (! mInstance) - { - // use the bound Factory functor - mInstance.reset(mFactory()); - } - return *mInstance; - } - - /// non-const get() - T& get() - { - return const_cast<T&>(const_cast<const LLLazy<T>*>(this)->get()); - } - - /// operator*() is equivalent to get() - const T& operator*() const { return get(); } - /// operator*() is equivalent to get() - T& operator*() { return get(); } - - /** - * operator->() must return (something resembling) T*. It's tempting to - * return the underlying boost::scoped_ptr<T>, but that would require - * breaking out the lazy-instantiation logic from get() into a common - * private method. Assume the pointer used for operator->() access is very - * short-lived. - */ - const T* operator->() const { return &get(); } - /// non-const operator->() - T* operator->() { return &get(); } - - /// set(Factory). This will throw InstanceChange if mInstance has already - /// been set. - void set(const Factory& factory) - { - ensureNoInstance(mInstance); - mFactory = factory; - } - - /// set(T*). This will throw InstanceChange if mInstance has already been - /// set. - void set(T* instance) - { - ensureNoInstance(mInstance); - mInstance.reset(instance); - } - -private: - Factory mFactory; - // Consider an LLLazy<T> member of a class we're accessing by const - // reference. We want to allow even const methods to touch the LLLazy<T> - // member. Hence the actual pointer must be mutable because such access - // might assign it. - mutable boost::scoped_ptr<T> mInstance; -}; - -#if (! defined(__GNUC__)) || (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 3) -// Not gcc at all, or a gcc more recent than gcc 3.3 -#define GCC33 0 -#else -#define GCC33 1 -#endif - -/** - * LLLazyBase<T> wraps LLLazy<T>, giving you an alternative way to replace - * <tt>Inner mInner;</tt>. Instead of coding <tt>LLLazy<Inner> mInner</tt>, - * you can add LLLazyBase<Inner> to your Outer class's bases, e.g.: - * @code - * class Outer: public LLLazyBase<Inner> - * { - * ... - * }; - * @endcode - * - * This gives you @c public get() and @c protected set() methods without - * having to make your LLLazy<Inner> member @c protected. The tradeoff is that - * you must access the wrapped LLLazy<Inner> using get() and set() rather than - * with <tt>operator*()</tt> or <tt>operator->()</tt>. - * - * This mechanism can be used for more than one member, but only if they're of - * different types. That is, you can replace: - * @code - * DifficultClass mDifficult; - * AwkwardType mAwkward; - * @endcode - * with: - * @code - * class Outer: public LLLazyBase<DifficultClass>, public LLLazyBase<AwkwardType> - * { - * ... - * }; - * @endcode - * but for a situation like this: - * @code - * DifficultClass mMainDifficult, mAuxDifficult; - * @endcode - * you should directly embed LLLazy<DifficultClass> (q.v.). - * - * For multiple LLLazyBase bases, e.g. the <tt>LLLazyBase<DifficultClass>, - * LLLazyBase<AwkwardType></tt> example above, access the relevant get()/set() - * as (e.g.) <tt>LLLazyBase<DifficultClass>::get()</tt>. (This is why you - * can't have multiple LLLazyBase<T> of the same T.) For a bit of syntactic - * sugar, please see getLazy()/setLazy(). - */ -template <typename T> -class LLLazyBase -{ -public: - /// invoke default LLLazy constructor - LLLazyBase() {} - /// make wrapped LLLazy bind an explicit Factory - LLLazyBase(const typename LLLazy<T>::Factory& factory): - mInstance(factory) - {} - - /// access to LLLazy::get() - T& get() { return *mInstance; } - /// access to LLLazy::get() - const T& get() const { return *mInstance; } - -protected: - // see getLazy()/setLazy() - #if (! GCC33) - template <typename T2, class MYCLASS> friend T2& getLazy(MYCLASS* this_); - template <typename T2, class MYCLASS> friend const T2& getLazy(const MYCLASS* this_); - #else // gcc 3.3 - template <typename T2, class MYCLASS> friend T2& getLazy(const MYCLASS* this_); - #endif // gcc 3.3 - template <typename T2, class MYCLASS> friend void setLazy(MYCLASS* this_, T2* instance); - template <typename T2, class MYCLASS> - friend void setLazy(MYCLASS* this_, const typename LLLazy<T2>::Factory& factory); - - /// access to LLLazy::set(Factory) - void set(const typename LLLazy<T>::Factory& factory) - { - mInstance.set(factory); - } - - /// access to LLLazy::set(T*) - void set(T* instance) - { - mInstance.set(instance); - } - -private: - LLLazy<T> mInstance; -}; - -/** - * @name getLazy()/setLazy() - * Suppose you have something like the following: - * @code - * class Outer: public LLLazyBase<DifficultClass>, public LLLazyBase<AwkwardType> - * { - * ... - * }; - * @endcode - * - * Your methods can reference the @c DifficultClass instance using - * <tt>LLLazyBase<DifficultClass>::get()</tt>, which is admittedly a bit ugly. - * Alternatively, you can write <tt>getLazy<DifficultClass>(this)</tt>, which - * is somewhat more straightforward to read. - * - * Similarly, - * @code - * LLLazyBase<DifficultClass>::set(new TestDifficultClass()); - * @endcode - * could instead be written: - * @code - * setLazy<DifficultClass>(this, new TestDifficultClass()); - * @endcode - * - * @note - * I wanted to provide getLazy() and setLazy() without explicitly passing @c - * this. That would imply making them methods on a base class rather than free - * functions. But if <tt>LLLazyBase<T></tt> derives normally from (say) @c - * LLLazyGrandBase providing those methods, then unqualified getLazy() would - * be ambiguous: you'd have to write <tt>LLLazyBase<T>::getLazy<T>()</tt>, - * which is even uglier than <tt>LLLazyBase<T>::get()</tt>, and therefore - * pointless. You can make the compiler not care which @c LLLazyGrandBase - * instance you're talking about by making @c LLLazyGrandBase a @c virtual - * base class of @c LLLazyBase. But in that case, - * <tt>LLLazyGrandBase::getLazy<T>()</tt> can't access - * <tt>LLLazyBase<T>::get()</tt>! - * - * We want <tt>getLazy<T>()</tt> to access <tt>LLLazyBase<T>::get()</tt> as if - * in the lexical context of some subclass method. Ironically, free functions - * let us do that better than methods on a @c virtual base class -- but that - * implies passing @c this explicitly. So be it. - */ -//@{ -#if (! GCC33) -template <typename T, class MYCLASS> -T& getLazy(MYCLASS* this_) { return this_->LLLazyBase<T>::get(); } -template <typename T, class MYCLASS> -const T& getLazy(const MYCLASS* this_) { return this_->LLLazyBase<T>::get(); } -#else // gcc 3.3 -// For const-correctness, we really should have two getLazy() variants: one -// accepting const MYCLASS* and returning const T&, the other accepting -// non-const MYCLASS* and returning non-const T&. This works fine on the Mac -// (gcc 4.0.1) and Windows (MSVC 8.0), but fails on our Linux 32-bit Debian -// Sarge stations (gcc 3.3.5). Since I really don't know how to beat that aging -// compiler over the head to make it do the right thing, I'm going to have to -// move forward with the wrong thing: a single getLazy() function that accepts -// const MYCLASS* and returns non-const T&. -template <typename T, class MYCLASS> -T& getLazy(const MYCLASS* this_) { return const_cast<MYCLASS*>(this_)->LLLazyBase<T>::get(); } -#endif // gcc 3.3 -template <typename T, class MYCLASS> -void setLazy(MYCLASS* this_, T* instance) { this_->LLLazyBase<T>::set(instance); } -template <typename T, class MYCLASS> -void setLazy(MYCLASS* this_, const typename LLLazy<T>::Factory& factory) -{ - this_->LLLazyBase<T>::set(factory); -} -//@} - -#endif /* ! defined(LL_LLLAZY_H) */ diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index 0a57ef1c48c57d32674e0e7f8f4ec4c377847581..84d2a12f657364de4c170673bdeda1bb2b88a209 100755 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -394,7 +394,7 @@ class LLLeapImpl: public LLLeap LLProcess::WritePipe& childin(mChild->getWritePipe(LLProcess::STDIN)); LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); LLSD nop; - F64 until(LLTimer::getElapsedSeconds() + 2); + F64 until = (LLTimer::getElapsedSeconds() + 2).value(); while (childin.size() && LLTimer::getElapsedSeconds() < until) { mainloop.post(nop); diff --git a/indra/llcommon/lllinkedqueue.h b/indra/llcommon/lllinkedqueue.h deleted file mode 100755 index 8336608809c47f291349b76ac44a15a045289dc2..0000000000000000000000000000000000000000 --- a/indra/llcommon/lllinkedqueue.h +++ /dev/null @@ -1,309 +0,0 @@ -/** - * @file lllinkedqueue.h - * @brief Declaration of linked queue classes. - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLLINKEDQUEUE_H -#define LL_LLLINKEDQUEUE_H - -#include "llerror.h" - -// node that actually contains the data -template <class DATA_TYPE> class LLLinkedQueueNode -{ -public: - DATA_TYPE mData; - LLLinkedQueueNode *mNextp; - LLLinkedQueueNode *mPrevp; - - -public: - LLLinkedQueueNode(); - LLLinkedQueueNode(const DATA_TYPE data); - - // destructor does not, by default, destroy associated data - // however, the mDatap must be NULL to ensure that we aren't causing memory leaks - ~LLLinkedQueueNode(); -}; - - - -template <class DATA_TYPE> class LLLinkedQueue -{ - -public: - LLLinkedQueue(); - - // destructor destroys list and nodes, but not data in nodes - ~LLLinkedQueue(); - - // Puts at end of FIFO - void push(const DATA_TYPE data); - - // Takes off front of FIFO - BOOL pop(DATA_TYPE &data); - BOOL peek(DATA_TYPE &data); - - void reset(); - - S32 getLength() const; - - BOOL isEmpty() const; - - BOOL remove(const DATA_TYPE data); - - BOOL checkData(const DATA_TYPE data) const; - -private: - // add node to end of list - // set mCurrentp to mQueuep - void addNodeAtEnd(LLLinkedQueueNode<DATA_TYPE> *nodep); - -private: - LLLinkedQueueNode<DATA_TYPE> mHead; // head node - LLLinkedQueueNode<DATA_TYPE> mTail; // tail node - S32 mLength; -}; - - -// -// Nodes -// - -template <class DATA_TYPE> -LLLinkedQueueNode<DATA_TYPE>::LLLinkedQueueNode() : - mData(), mNextp(NULL), mPrevp(NULL) -{ } - -template <class DATA_TYPE> -LLLinkedQueueNode<DATA_TYPE>::LLLinkedQueueNode(const DATA_TYPE data) : - mData(data), mNextp(NULL), mPrevp(NULL) -{ } - -template <class DATA_TYPE> -LLLinkedQueueNode<DATA_TYPE>::~LLLinkedQueueNode() -{ } - - -// -// Queue itself -// - -template <class DATA_TYPE> -LLLinkedQueue<DATA_TYPE>::LLLinkedQueue() -: mHead(), - mTail(), - mLength(0) -{ } - - -// destructor destroys list and nodes, but not data in nodes -template <class DATA_TYPE> -LLLinkedQueue<DATA_TYPE>::~LLLinkedQueue() -{ - reset(); -} - - -// put data into a node and stick it at the end of the list -template <class DATA_TYPE> -void LLLinkedQueue<DATA_TYPE>::push(const DATA_TYPE data) -{ - // make the new node - LLLinkedQueueNode<DATA_TYPE> *nodep = new LLLinkedQueueNode<DATA_TYPE>(data); - - addNodeAtEnd(nodep); -} - - -// search the list starting at mHead.mNextp and remove the link with mDatap == data -// set mCurrentp to mQueuep, or NULL if mQueuep points to node with mDatap == data -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLLinkedQueue<DATA_TYPE>::remove(const DATA_TYPE data) -{ - BOOL b_found = FALSE; - - LLLinkedQueueNode<DATA_TYPE> *currentp = mHead.mNextp; - - while (currentp) - { - if (currentp->mData == data) - { - b_found = TRUE; - - // if there is a next one, fix it - if (currentp->mNextp) - { - currentp->mNextp->mPrevp = currentp->mPrevp; - } - else // we are at end of list - { - mTail.mPrevp = currentp->mPrevp; - } - - // if there is a previous one, fix it - if (currentp->mPrevp) - { - currentp->mPrevp->mNextp = currentp->mNextp; - } - else // we are at beginning of list - { - mHead.mNextp = currentp->mNextp; - } - - // remove the node - delete currentp; - mLength--; - break; - } - currentp = currentp->mNextp; - } - - return b_found; -} - - -// remove all nodes from the list but do not delete associated data -template <class DATA_TYPE> -void LLLinkedQueue<DATA_TYPE>::reset() -{ - LLLinkedQueueNode<DATA_TYPE> *currentp; - LLLinkedQueueNode<DATA_TYPE> *nextp; - currentp = mHead.mNextp; - - while (currentp) - { - nextp = currentp->mNextp; - delete currentp; - currentp = nextp; - } - - // reset mHead and mCurrentp - mHead.mNextp = NULL; - mTail.mPrevp = NULL; - mLength = 0; -} - -template <class DATA_TYPE> -S32 LLLinkedQueue<DATA_TYPE>::getLength() const -{ - return mLength; -} - -template <class DATA_TYPE> -BOOL LLLinkedQueue<DATA_TYPE>::isEmpty() const -{ - return mLength <= 0; -} - -// check to see if data is in list -// set mCurrentp and mQueuep to the target of search if found, otherwise set mCurrentp to mQueuep -// return TRUE if found, FALSE if not found -template <class DATA_TYPE> -BOOL LLLinkedQueue<DATA_TYPE>::checkData(const DATA_TYPE data) const -{ - LLLinkedQueueNode<DATA_TYPE> *currentp = mHead.mNextp; - - while (currentp) - { - if (currentp->mData == data) - { - return TRUE; - } - currentp = currentp->mNextp; - } - return FALSE; -} - -template <class DATA_TYPE> -BOOL LLLinkedQueue<DATA_TYPE>::pop(DATA_TYPE &data) -{ - LLLinkedQueueNode<DATA_TYPE> *currentp; - - currentp = mHead.mNextp; - if (!currentp) - { - return FALSE; - } - - mHead.mNextp = currentp->mNextp; - if (currentp->mNextp) - { - currentp->mNextp->mPrevp = currentp->mPrevp; - } - else - { - mTail.mPrevp = currentp->mPrevp; - } - - data = currentp->mData; - delete currentp; - mLength--; - return TRUE; -} - -template <class DATA_TYPE> -BOOL LLLinkedQueue<DATA_TYPE>::peek(DATA_TYPE &data) -{ - LLLinkedQueueNode<DATA_TYPE> *currentp; - - currentp = mHead.mNextp; - if (!currentp) - { - return FALSE; - } - data = currentp->mData; - return TRUE; -} - - -////////////////////////////////////////////////////////////////////////////////////////// -// private members -////////////////////////////////////////////////////////////////////////////////////////// - - -// add node to end of list -// set mCurrentp to mQueuep -template <class DATA_TYPE> -void LLLinkedQueue<DATA_TYPE>::addNodeAtEnd(LLLinkedQueueNode<DATA_TYPE> *nodep) -{ - // add the node to the end of the list - nodep->mNextp = NULL; - nodep->mPrevp = mTail.mPrevp; - mTail.mPrevp = nodep; - - // if there's something in the list, fix its back pointer - if (nodep->mPrevp) - { - nodep->mPrevp->mNextp = nodep; - } - else // otherwise fix the head node - { - mHead.mNextp = nodep; - } - mLength++; -} - -#endif diff --git a/indra/llcommon/llliveappconfig.cpp b/indra/llcommon/llliveappconfig.cpp index 3a3dfa9f28901f78a896714bca01fd1e87cc99bd..7c87c5a1a03574444ffa443ddea4091028e9b752 100755 --- a/indra/llcommon/llliveappconfig.cpp +++ b/indra/llcommon/llliveappconfig.cpp @@ -47,8 +47,8 @@ LLLiveAppConfig::~LLLiveAppConfig() // virtual bool LLLiveAppConfig::loadFile() { - llinfos << "LLLiveAppConfig::loadFile(): reading from " - << filename() << llendl; + LL_INFOS() << "LLLiveAppConfig::loadFile(): reading from " + << filename() << LL_ENDL; llifstream file(filename()); LLSD config; if (file.is_open()) @@ -56,15 +56,15 @@ bool LLLiveAppConfig::loadFile() LLSDSerialize::fromXML(config, file); if(!config.isMap()) { - llwarns << "Live app config not an map in " << filename() - << " Ignoring the data." << llendl; + LL_WARNS() << "Live app config not an map in " << filename() + << " Ignoring the data." << LL_ENDL; return false; } file.close(); } else { - llinfos << "Live file " << filename() << " does not exit." << llendl; + LL_INFOS() << "Live file " << filename() << " does not exit." << LL_ENDL; } // *NOTE: we do not handle the else case here because we would not // have attempted to load the file unless LLLiveFile had diff --git a/indra/llcommon/lllocalidhashmap.h b/indra/llcommon/lllocalidhashmap.h deleted file mode 100755 index 8f4f91a56022f42d430be0722c412fc9ca2248a6..0000000000000000000000000000000000000000 --- a/indra/llcommon/lllocalidhashmap.h +++ /dev/null @@ -1,895 +0,0 @@ -/** - * @file lllocalidhashmap.h - * @brief Map specialized for dealing with local ids - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLLOCALIDHASHMAP_H -#define LL_LLLOCALIDHASHMAP_H - -#include "stdtypes.h" -#include "llerror.h" - -const S32 MAX_ITERS = 4; -// LocalID hash map - -// -// LLLocalIDHashNode -// - -template <class DATA, int SIZE> -class LLLocalIDHashNode -{ -public: - LLLocalIDHashNode(); - -public: - S32 mCount; - U32 mKey[SIZE]; - DATA mData[SIZE]; - LLLocalIDHashNode<DATA, SIZE> *mNextNodep; -}; - - -// -// LLLocalIDHashNode implementation -// -template <class DATA, int SIZE> -LLLocalIDHashNode<DATA, SIZE>::LLLocalIDHashNode() -{ - mCount = 0; - mNextNodep = NULL; -} - -// -// LLLocalIDHashMapIter -// -template <class DATA_TYPE, int SIZE> -class LLLocalIDHashMap; - -template <class DATA_TYPE, int SIZE> -class LLLocalIDHashMapIter -{ -public: - LLLocalIDHashMapIter(LLLocalIDHashMap<DATA_TYPE, SIZE> *hash_mapp); - ~LLLocalIDHashMapIter(); - - void setMap(LLLocalIDHashMap<DATA_TYPE, SIZE> *hash_mapp); - inline void first(); - inline void next(); - inline DATA_TYPE& current(); // *NOTE: Deprecate? Phoenix 2005-04-15 - inline BOOL done() const; - inline S32 currentBin() const; - inline void setBin(S32 bin); - - DATA_TYPE& operator*() const - { - return mCurHashNodep->mData[mCurHashNodeKey]; - } - DATA_TYPE* operator->() const - { - return &(operator*()); - } - - LLLocalIDHashMap<DATA_TYPE, SIZE> *mHashMapp; - LLLocalIDHashNode<DATA_TYPE, SIZE> *mCurHashNodep; - - S32 mCurHashMapNodeNum; - S32 mCurHashNodeKey; - - DATA_TYPE mNull; - - S32 mIterID; -}; - - - -template <class DATA_TYPE, int SIZE> -class LLLocalIDHashMap -{ -public: - friend class LLLocalIDHashMapIter<DATA_TYPE, SIZE>; - - LLLocalIDHashMap(); // DO NOT use this unless you explicitly setNull, or the data type constructs a "null" - // object by default - // basic constructor including sorter - LLLocalIDHashMap(const DATA_TYPE &null_data); - // Hack, this should really be a const ref, but I'm not doing it that way because the sim - // usually uses pointers. - ~LLLocalIDHashMap(); - - inline DATA_TYPE &get(const U32 local_id); - inline BOOL check(const U32 local_id) const; - inline DATA_TYPE &set(const U32 local_id, const DATA_TYPE data); - inline BOOL remove(const U32 local_id); - void removeAll(); - - void setNull(const DATA_TYPE data) { mNull = data; } - - inline S32 getLength() const; // Warning, NOT O(1!) - - void dumpIter(); - void dumpBin(U32 bin); - -protected: - // Only used by the iterator. - void addIter(LLLocalIDHashMapIter<DATA_TYPE, SIZE> *iter); - void removeIter(LLLocalIDHashMapIter<DATA_TYPE, SIZE> *iter); - - // Remove the item and shift all items afterward down the list, - // fixing up iterators as we go. - BOOL removeWithShift(const U32 local_id); - -protected: - LLLocalIDHashNode<DATA_TYPE, SIZE> mNodes[256]; - - S32 mIterCount; - LLLocalIDHashMapIter<DATA_TYPE, SIZE> *mIters[MAX_ITERS]; - - DATA_TYPE mNull; -}; - - -// -// LLLocalIDHashMap implementation -// - -template <class DATA_TYPE, int SIZE> -LLLocalIDHashMap<DATA_TYPE, SIZE>::LLLocalIDHashMap() -: mIterCount(0), - mNull() -{ - S32 i; - for (i = 0; i < MAX_ITERS; i++) - { - mIters[i] = NULL; - } -} - -template <class DATA_TYPE, int SIZE> -LLLocalIDHashMap<DATA_TYPE, SIZE>::LLLocalIDHashMap(const DATA_TYPE &null_data) -: mIterCount(0), - mNull(null_data) -{ - S32 i; - for (i = 0; i < MAX_ITERS; i++) - { - mIters[i] = NULL; - } -} - -template <class DATA_TYPE, int SIZE> -LLLocalIDHashMap<DATA_TYPE, SIZE>::~LLLocalIDHashMap() -{ - S32 i; - for (i = 0; i < MAX_ITERS; i++) - { - if (mIters[i]) - { - mIters[i]->mHashMapp = NULL; - mIterCount--; - } - } - removeAll(); -} - -template <class DATA_TYPE, int SIZE> -void LLLocalIDHashMap<DATA_TYPE, SIZE>::removeAll() -{ - S32 bin; - for (bin = 0; bin < 256; bin++) - { - LLLocalIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[bin]; - - BOOL first = TRUE; - do // First node guaranteed to be there - { - S32 i; - const S32 count = nodep->mCount; - - // Iterate through all members of this node - for (i = 0; i < count; i++) - { - nodep->mData[i] = mNull; - } - - nodep->mCount = 0; - // Done with all objects in this node, go to the next. - - LLLocalIDHashNode<DATA_TYPE, SIZE>* curp = nodep; - nodep = nodep->mNextNodep; - - // Delete the node if it's not the first node - if (first) - { - first = FALSE; - curp->mNextNodep = NULL; - } - else - { - delete curp; - } - } while (nodep); - } -} - -template <class DATA_TYPE, int SIZE> -void LLLocalIDHashMap<DATA_TYPE, SIZE>::dumpIter() -{ - std::cout << "Hash map with " << mIterCount << " iterators" << std::endl; - - std::cout << "Hash Map Iterators:" << std::endl; - S32 i; - for (i = 0; i < MAX_ITERS; i++) - { - if (mIters[i]) - { - llinfos << i << " " << mIters[i]->mCurHashNodep << " " << mIters[i]->mCurHashNodeKey << llendl; - } - else - { - llinfos << i << "null" << llendl; - } - } -} - -template <class DATA_TYPE, int SIZE> -void LLLocalIDHashMap<DATA_TYPE, SIZE>::dumpBin(U32 bin) -{ - std::cout << "Dump bin " << bin << std::endl; - - LLLocalIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[bin]; - S32 node = 0; - do // First node guaranteed to be there. - { - std::cout << "Bin " << bin - << " node " << node - << " count " << nodep->mCount - << " contains " << std::flush; - - S32 i; - for (i = 0; i < nodep->mCount; i++) - { - std::cout << nodep->mData[i] << " " << std::flush; - } - - std::cout << std::endl; - - nodep = nodep->mNextNodep; - node++; - } while (nodep); -} - -template <class DATA_TYPE, int SIZE> -inline S32 LLLocalIDHashMap<DATA_TYPE, SIZE>::getLength() const -{ - S32 count = 0; - S32 bin; - for (bin = 0; bin < 256; bin++) - { - const LLLocalIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[bin]; - while (nodep) - { - count += nodep->mCount; - nodep = nodep->mNextNodep; - } - } - return count; -} - -template <class DATA_TYPE, int SIZE> -inline DATA_TYPE &LLLocalIDHashMap<DATA_TYPE, SIZE>::get(const U32 local_id) -{ - LLLocalIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[local_id & 0xff]; - - do // First node guaranteed to be there - { - S32 i; - const S32 count = nodep->mCount; - - // Iterate through all members of this node - for (i = 0; i < count; i++) - { - if (nodep->mKey[i] == local_id) - { - // We found it. - return nodep->mData[i]; - } - } - - // Done with all objects in this node, go to the next. - nodep = nodep->mNextNodep; - } while (nodep); - - return mNull; -} - - -template <class DATA_TYPE, int SIZE> -inline BOOL LLLocalIDHashMap<DATA_TYPE, SIZE>::check(const U32 local_id) const -{ - const LLLocalIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[local_id & 0xff]; - - do // First node guaranteed to be there - { - S32 i; - const S32 count = nodep->mCount; - - // Iterate through all members of this node - for (i = 0; i < count; i++) - { - if (nodep->mKey[i] == local_id) - { - // We found it. - return TRUE; - } - } - - // Done with all objects in this node, go to the next. - nodep = nodep->mNextNodep; - } while (nodep); - - // Didn't find anything - return FALSE; -} - - -template <class DATA_TYPE, int SIZE> -inline DATA_TYPE &LLLocalIDHashMap<DATA_TYPE, SIZE>::set(const U32 local_id, const DATA_TYPE data) -{ - // Set is just like a normal find, except that if we find a match - // we replace it with the input value. - // If we don't find a match, we append to the end of the list. - - LLLocalIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[local_id & 0xff]; - - while (1) - { - const S32 count = nodep->mCount; - - S32 i; - for (i = 0; i < count; i++) - { - if (nodep->mKey[i] == local_id) - { - // We found a match for this key, replace the data with - // the incoming data. - nodep->mData[i] = data; - return nodep->mData[i]; - } - } - if (!nodep->mNextNodep) - { - // We've iterated through all of the keys without finding a match - if (i < SIZE) - { - // There's still some space on this node, append - // the key and data to it. - nodep->mKey[i] = local_id; - nodep->mData[i] = data; - nodep->mCount++; - - return nodep->mData[i]; - } - else - { - // This node is full, append a new node to the end. - nodep->mNextNodep = new LLLocalIDHashNode<DATA_TYPE, SIZE>; - nodep->mNextNodep->mKey[0] = local_id; - nodep->mNextNodep->mData[0] = data; - nodep->mNextNodep->mCount = 1; - - return nodep->mNextNodep->mData[0]; - } - } - - // No match on this node, go to the next - nodep = nodep->mNextNodep; - } -} - - -template <class DATA_TYPE, int SIZE> -inline BOOL LLLocalIDHashMap<DATA_TYPE, SIZE>::remove(const U32 local_id) -{ - // Remove is the trickiest operation. - // What we want to do is swap the last element of the last - // node if we find the one that we want to remove, but we have - // to deal with deleting the node from the tail if it's empty, but - // NOT if it's the only node left. - - const S32 node_index = local_id & 0xff; - - LLLocalIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[node_index]; - - // A modification of the standard search algorithm. - do // First node guaranteed to be there - { - const S32 count = nodep->mCount; - - S32 i; - for (i = 0; i < count; i++) - { - if (nodep->mKey[i] == local_id) - { - // If we're removing the item currently pointed to by one - // or more iterators, we can just swap in the last item - // and back the iterator(s) up by one. - // Otherwise, we need to do a slow and safe shift of all - // items back to one position to fill the hole and fix up - // all iterators we find. - BOOL need_shift = FALSE; - S32 cur_iter; - if (mIterCount) - { - for (cur_iter = 0; cur_iter < MAX_ITERS; cur_iter++) - { - if (mIters[cur_iter]) - { - // We only care if the hash map node is on the one - // that we're working on. If it's before, we've already - // traversed it, if it's after, changing the order doesn't - // matter. - if (mIters[cur_iter]->mCurHashMapNodeNum == node_index) - { - if ((mIters[cur_iter]->mCurHashNodep == nodep) - && (mIters[cur_iter]->mCurHashNodeKey == i)) - { - // it's on the one we're deleting, we'll - // fix the iterator quickly below. - } - else - { - // We're trying to remove an item on this - // iterator's chain that this - // iterator doesn't point to! We need to do - // the slow remove-and-shift-down case. - need_shift = TRUE; - } - } - } - } - } - - // Removing an item that isn't pointed to by all iterators - if (need_shift) - { - return removeWithShift(local_id); - } - - // Fix the iterators that point to this node/i pair, the - // one we're deleting - for (cur_iter = 0; cur_iter < MAX_ITERS; cur_iter++) - { - if (mIters[cur_iter]) - { - // We only care if the hash map node is on the one - // that we're working on. If it's before, we've already - // traversed it, if it's after, changing the order doesn't - // matter. - if (mIters[cur_iter]->mCurHashMapNodeNum == node_index) - { - if ((mIters[cur_iter]->mCurHashNodep == nodep) - && (mIters[cur_iter]->mCurHashNodeKey == i)) - { - // We can handle the case where we're deleting - // the element we're on trivially (sort of). - if (nodep->mCount > 1) - { - // If we're not going to delete this node, - // it's OK. - mIters[cur_iter]->mCurHashNodeKey--; - } - else - { - // We're going to delete this node, because this - // is the last element on it. - - // Find the next node, and then back up one. - mIters[cur_iter]->next(); - mIters[cur_iter]->mCurHashNodeKey--; - } - } - } - } - } - - // We found the node that we want to remove. - // Find the last (and next-to-last) node, and the index of the last - // element. We could conceviably start from the node we're on, - // but that makes it more complicated, this is easier. - - LLLocalIDHashNode<DATA_TYPE, SIZE> *prevp = &mNodes[node_index]; - LLLocalIDHashNode<DATA_TYPE, SIZE> *lastp = prevp; - - // Find the last and next-to-last - while (lastp->mNextNodep) - { - prevp = lastp; - lastp = lastp->mNextNodep; - } - - // First, swap in the last to the current location. - nodep->mKey[i] = lastp->mKey[lastp->mCount - 1]; - nodep->mData[i] = lastp->mData[lastp->mCount - 1]; - - // Now, we delete the entry - lastp->mCount--; - lastp->mData[lastp->mCount] = mNull; - - if (!lastp->mCount) - { - // We deleted the last element! - if (lastp != &mNodes[local_id & 0xff]) - { - // Only blitz the node if it's not the head - // Set the previous node to point to NULL, then - // blitz the empty last node - prevp->mNextNodep = NULL; - delete lastp; - } - } - - return TRUE; - } - } - - // Iterate to the next node, we've scanned all the entries in this one. - nodep = nodep->mNextNodep; - } while (nodep); - - return FALSE; -} - -template <class DATA_TYPE, int SIZE> -BOOL LLLocalIDHashMap<DATA_TYPE, SIZE>::removeWithShift(const U32 local_id) -{ - const S32 node_index = local_id & 0xFF; - LLLocalIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[node_index]; - LLLocalIDHashNode<DATA_TYPE, SIZE>* prevp = NULL; - BOOL found = FALSE; - - do // First node guaranteed to be there - { - const S32 count = nodep->mCount; - S32 i; - for (i = 0; i < count; i++) - { - if (nodep->mKey[i] == local_id) - { - // Found the item. Start shifting items from later - // in the list over this item. - found = TRUE; - } - - if (found) - { - // If there is an iterator on this node, we need to - // back it up. - S32 cur_iter; - for (cur_iter = 0; cur_iter <MAX_ITERS; cur_iter++) - { - LLLocalIDHashMapIter<DATA_TYPE, SIZE>* iter; - iter = mIters[cur_iter]; - // If an iterator is on this node,i pair, then back it up. - if (iter - && iter->mCurHashMapNodeNum == node_index - && iter->mCurHashNodep == nodep - && iter->mCurHashNodeKey == i) - { - if (i > 0) - { - // Don't need to move iterator nodep, since - // we're in the same node. - iter->mCurHashNodeKey--; - } - else if (prevp) - { - // need to go the previous node, last item - iter->mCurHashNodep = prevp; - iter->mCurHashNodeKey = prevp->mCount - 1; - } - else - { - // we're on the first item in the list, but - // need to go back anyhow. - - // BUG: If this deletion empties the list, - // iter->done() will be wrong until - // iter->next() is called. - iter->mCurHashNodeKey = -1; - } - } - } - - // Copy data from the next position into this position. - if (i < count-1) - { - // we're not on the last item in the node, - // so we can copy within the node - nodep->mKey[i] = nodep->mKey[i+1]; - nodep->mData[i] = nodep->mData[i+1]; - } - else if (nodep->mNextNodep) - { - // we're on the last item in the node, - // but there's a next node we can copy from - nodep->mKey[i] = nodep->mNextNodep->mKey[0]; - nodep->mData[i] = nodep->mNextNodep->mData[0]; - } - else - { - // We're on the last position in the list. - // No one to copy from. Replace with nothing. - nodep->mKey[i] = 0; - nodep->mData[i] = mNull; - } - } - } - - // Last node in chain, so delete the last node - if (found - && !nodep->mNextNodep) - { - // delete the last item off the last node - nodep->mCount--; - - if (nodep->mCount == 0) - { - // We deleted the last element! - if (nodep != &mNodes[node_index]) - { - // Always have a prevp if we're not the head. - llassert(prevp); - - // Only blitz the node if it's not the head - // Set the previous node to point to NULL, then - // blitz the empty last node - prevp->mNextNodep = NULL; - delete nodep; - nodep = NULL; - } - } - - // Deleted last item in chain, so we're done. - return found; - } - - prevp = nodep; - nodep = nodep->mNextNodep; - } while (nodep); - - return found; -} - -template <class DATA_TYPE, int SIZE> -void LLLocalIDHashMap<DATA_TYPE, SIZE>::removeIter(LLLocalIDHashMapIter<DATA_TYPE, SIZE> *iter) -{ - S32 i; - for (i = 0; i < MAX_ITERS; i++) - { - if (mIters[i] == iter) - { - mIters[i] = NULL; - mIterCount--; - return; - } - } - llerrs << "Iterator " << iter << " not found for removal in hash map!" << llendl; -} - -template <class DATA_TYPE, int SIZE> -void LLLocalIDHashMap<DATA_TYPE, SIZE>::addIter(LLLocalIDHashMapIter<DATA_TYPE, SIZE> *iter) -{ - S32 i; - for (i = 0; i < MAX_ITERS; i++) - { - if (mIters[i] == NULL) - { - mIters[i] = iter; - mIterCount++; - return; - } - } - llerrs << "More than " << MAX_ITERS << " iterating over a map simultaneously!" << llendl; -} - - - -// -// LLLocalIDHashMapIter Implementation -// -template <class DATA_TYPE, int SIZE> -LLLocalIDHashMapIter<DATA_TYPE, SIZE>::LLLocalIDHashMapIter(LLLocalIDHashMap<DATA_TYPE, SIZE> *hash_mapp) -{ - mHashMapp = NULL; - setMap(hash_mapp); -} - -template <class DATA_TYPE, int SIZE> -LLLocalIDHashMapIter<DATA_TYPE, SIZE>::~LLLocalIDHashMapIter() -{ - if (mHashMapp) - { - mHashMapp->removeIter(this); - } -} - -template <class DATA_TYPE, int SIZE> -void LLLocalIDHashMapIter<DATA_TYPE, SIZE>::setMap(LLLocalIDHashMap<DATA_TYPE, SIZE> *hash_mapp) -{ - if (mHashMapp) - { - mHashMapp->removeIter(this); - } - mHashMapp = hash_mapp; - if (mHashMapp) - { - mHashMapp->addIter(this); - } - - mCurHashNodep = NULL; - mCurHashMapNodeNum = -1; - mCurHashNodeKey = 0; -} - -template <class DATA_TYPE, int SIZE> -inline void LLLocalIDHashMapIter<DATA_TYPE, SIZE>::first() -{ - // Iterate through until we find the first non-empty node; - S32 i; - for (i = 0; i < 256; i++) - { - if (mHashMapp->mNodes[i].mCount) - { - - mCurHashNodep = &mHashMapp->mNodes[i]; - mCurHashMapNodeNum = i; - mCurHashNodeKey = 0; - //return mCurHashNodep->mData[0]; - return; - } - } - - // Completely empty! - mCurHashNodep = NULL; - //return mNull; - return; -} - -template <class DATA_TYPE, int SIZE> -inline BOOL LLLocalIDHashMapIter<DATA_TYPE, SIZE>::done() const -{ - return mCurHashNodep ? FALSE : TRUE; -} - -template <class DATA_TYPE, int SIZE> -inline S32 LLLocalIDHashMapIter<DATA_TYPE, SIZE>::currentBin() const -{ - if ( (mCurHashMapNodeNum > 255) - ||(mCurHashMapNodeNum < 0)) - { - return 0; - } - else - { - return mCurHashMapNodeNum; - } -} - -template <class DATA_TYPE, int SIZE> -inline void LLLocalIDHashMapIter<DATA_TYPE, SIZE>::setBin(S32 bin) -{ - // Iterate through until we find the first non-empty node; - S32 i; - bin = llclamp(bin, 0, 255); - for (i = bin; i < 256; i++) - { - if (mHashMapp->mNodes[i].mCount) - { - - mCurHashNodep = &mHashMapp->mNodes[i]; - mCurHashMapNodeNum = i; - mCurHashNodeKey = 0; - return; - } - } - for (i = 0; i < bin; i++) - { - if (mHashMapp->mNodes[i].mCount) - { - - mCurHashNodep = &mHashMapp->mNodes[i]; - mCurHashMapNodeNum = i; - mCurHashNodeKey = 0; - return; - } - } - // Completely empty! - mCurHashNodep = NULL; -} - -template <class DATA_TYPE, int SIZE> -inline DATA_TYPE &LLLocalIDHashMapIter<DATA_TYPE, SIZE>::current() -{ - if (!mCurHashNodep) - { - return mNull; - } - return mCurHashNodep->mData[mCurHashNodeKey]; -} - -template <class DATA_TYPE, int SIZE> -inline void LLLocalIDHashMapIter<DATA_TYPE, SIZE>::next() -{ - // No current entry, this iterator is done - if (!mCurHashNodep) - { - //return mNull; - return; - } - - // Go to the next element - mCurHashNodeKey++; - if (mCurHashNodeKey < mCurHashNodep->mCount) - { - // We're not done with this node, return the current element - //return mCurHashNodep->mData[mCurHashNodeKey]; - return; - } - - // Done with this node, move to the next - mCurHashNodep = mCurHashNodep->mNextNodep; - if (mCurHashNodep) - { - // Return the first element - mCurHashNodeKey = 0; - //return mCurHashNodep->mData[0]; - return; - } - - // Find the next non-empty node (keyed on the first byte) - mCurHashMapNodeNum++; - - S32 i; - for (i = mCurHashMapNodeNum; i < 256; i++) - { - if (mHashMapp->mNodes[i].mCount) - { - // We found one that wasn't empty - mCurHashNodep = &mHashMapp->mNodes[i]; - mCurHashMapNodeNum = i; - mCurHashNodeKey = 0; - //return mCurHashNodep->mData[0]; - return; - } - } - - // OK, we're done, nothing else to iterate - mCurHashNodep = NULL; - mHashMapp->mIterCount--; // Decrement since we're safe to do removes now - //return mNull; - return; -} - -#endif // LL_LLLOCALIDHASHMAP_H diff --git a/indra/llcommon/lllog.cpp b/indra/llcommon/lllog.cpp deleted file mode 100755 index fc4058b5c921beef1e41efc6632ed14e10617332..0000000000000000000000000000000000000000 --- a/indra/llcommon/lllog.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @file lllog.cpp - * @author Don - * @date 2007-11-27 - * @brief Class to log messages to syslog for streambase to process. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" -#include "lllog.h" - -#include "llapp.h" -#include "llsd.h" -#include "llsdserialize.h" - - -class LLLogImpl -{ -public: - LLLogImpl(LLApp* app) : mApp(app) {} - ~LLLogImpl() {} - - void log(const std::string &message, LLSD& info); - bool useLegacyLogMessage(const std::string &message); - -private: - LLApp* mApp; -}; - - -//@brief Function to log a message to syslog for streambase to collect. -void LLLogImpl::log(const std::string &message, LLSD& info) -{ - static S32 sequence = 0; - LLSD log_config = mApp->getOption("log-messages"); - if (log_config.has(message)) - { - LLSD message_config = log_config[message]; - if (message_config.has("use-syslog")) - { - if (! message_config["use-syslog"].asBoolean()) - { - return; - } - } - } - llinfos << "LLLOGMESSAGE (" << (sequence++) << ") " << message - << " " << LLSDNotationStreamer(info) << llendl; -} - -//@brief Function to check if specified legacy log message should be sent. -bool LLLogImpl::useLegacyLogMessage(const std::string &message) -{ - LLSD log_config = mApp->getOption("log-messages"); - if (log_config.has(message)) - { - LLSD message_config = log_config[message]; - if (message_config.has("use-legacy")) - { - return message_config["use-legacy"].asBoolean(); - } - } - return true; -} - - -LLLog::LLLog(LLApp* app) -{ - mImpl = new LLLogImpl(app); -} - -LLLog::~LLLog() -{ - delete mImpl; - mImpl = NULL; -} - -void LLLog::log(const std::string &message, LLSD& info) -{ - if (mImpl) mImpl->log(message, info); -} - -bool LLLog::useLegacyLogMessage(const std::string &message) -{ - if (mImpl) - { - return mImpl->useLegacyLogMessage(message); - } - return true; -} - diff --git a/indra/llcommon/llmap.h b/indra/llcommon/llmap.h deleted file mode 100755 index 6294a15d3b23e5af87722876f584167c0e4ccd49..0000000000000000000000000000000000000000 --- a/indra/llcommon/llmap.h +++ /dev/null @@ -1,245 +0,0 @@ -/** - * @file llmap.h - * @brief LLMap class header file - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLMAP_H -#define LL_LLMAP_H - -// llmap uses the fast stl library code in a manner consistant with LLSkipMap, et. al. - -template<class INDEX_TYPE, class MAPPED_TYPE> class LLMap -{ -private: - typedef typename std::map<INDEX_TYPE, MAPPED_TYPE> stl_map_t; - typedef typename stl_map_t::iterator stl_iter_t; - typedef typename stl_map_t::value_type stl_value_t; - - stl_map_t mStlMap; - stl_iter_t mCurIter; // *iterator = pair<const INDEX_TYPE, MAPPED_TYPE> - MAPPED_TYPE dummy_data; - INDEX_TYPE dummy_index; - -public: - LLMap() : mStlMap() - { - memset((void*)(&dummy_data), 0x0, sizeof(MAPPED_TYPE)); - memset((void*)(&dummy_index), 0x0, sizeof(INDEX_TYPE)); - mCurIter = mStlMap.begin(); - } - ~LLMap() - { - mStlMap.clear(); - } - - // use these functions to itterate through a list - void resetMap() - { - mCurIter = mStlMap.begin(); - } - - // get the current data and bump mCurrentp - // This is kind of screwy since it returns a reference; - // We have to have a dummy value for when we reach the end - // or in case we have an empty list. Presumably, this value - // will initialize to some NULL value that will end the iterator. - // We really shouldn't be using getNextData() or getNextKey() anyway... - MAPPED_TYPE &getNextData() - { - if (mCurIter == mStlMap.end()) - { - return dummy_data; - } - else - { - return (*mCurIter++).second; - } - } - - const INDEX_TYPE &getNextKey() - { - if (mCurIter == mStlMap.end()) - { - return dummy_index; - } - else - { - return (*mCurIter++).first; - } - } - - MAPPED_TYPE &getFirstData() - { - resetMap(); - return getNextData(); - } - - const INDEX_TYPE &getFirstKey() - { - resetMap(); - return getNextKey(); - } - - S32 getLength() - { - return mStlMap.size(); - } - - void addData(const INDEX_TYPE &index, MAPPED_TYPE pointed_to) - { - mStlMap.insert(stl_value_t(index, pointed_to)); - } - - void addData(const INDEX_TYPE &index) - { - mStlMap.insert(stl_value_t(index, dummy_data)); - } - - // if index doesn't exist, then insert a new node and return it - MAPPED_TYPE &getData(const INDEX_TYPE &index) - { - std::pair<stl_iter_t, bool> res; - res = mStlMap.insert(stl_value_t(index, dummy_data)); - return res.first->second; - } - - // if index doesn't exist, then insert a new node, return it, and set b_new_entry to true - MAPPED_TYPE &getData(const INDEX_TYPE &index, BOOL &b_new_entry) - { - std::pair<stl_iter_t, bool> res; - res = mStlMap.insert(stl_value_t(index, dummy_data)); - b_new_entry = res.second; - return res.first->second; - } - - // If there, returns the data. - // If not, returns NULL. - // Never adds entries to the map. - MAPPED_TYPE getIfThere(const INDEX_TYPE &index) - { - stl_iter_t iter; - iter = mStlMap.find(index); - if (iter == mStlMap.end()) - { - return (MAPPED_TYPE)0; - } - else - { - return (*iter).second; - } - } - - - // if index doesn't exist, then make a new node and return it - MAPPED_TYPE &operator[](const INDEX_TYPE &index) - { - return getData(index); - } - - // do a reverse look-up, return NULL if failed - INDEX_TYPE reverseLookup(const MAPPED_TYPE data) - { - stl_iter_t iter; - stl_iter_t end_iter; - iter = mStlMap.begin(); - end_iter = mStlMap.end(); - while (iter != end_iter) - { - if ((*iter).second == data) - return (*iter).first; - iter++; - } - return (INDEX_TYPE)0; - } - - BOOL removeData(const INDEX_TYPE &index) - { - mCurIter = mStlMap.find(index); - if (mCurIter == mStlMap.end()) - { - return FALSE; - } - else - { - stl_iter_t iter = mCurIter++; // incrament mCurIter to the next element - mStlMap.erase(iter); - return TRUE; - } - } - - // does this index exist? - BOOL checkData(const INDEX_TYPE &index) - { - stl_iter_t iter; - iter = mStlMap.find(index); - if (iter == mStlMap.end()) - { - return FALSE; - } - else - { - mCurIter = iter; - return TRUE; - } - } - - BOOL deleteData(const INDEX_TYPE &index) - { - mCurIter = mStlMap.find(index); - if (mCurIter == mStlMap.end()) - { - return FALSE; - } - else - { - stl_iter_t iter = mCurIter++; // incrament mCurIter to the next element - delete (*iter).second; - mStlMap.erase(iter); - return TRUE; - } - } - - void deleteAllData() - { - stl_iter_t iter; - stl_iter_t end_iter; - iter = mStlMap.begin(); - end_iter = mStlMap.end(); - while (iter != end_iter) - { - delete (*iter).second; - iter++; - } - mStlMap.clear(); - mCurIter = mStlMap.end(); - } - - void removeAllData() - { - mStlMap.clear(); - } -}; - - -#endif diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp index 1409c55d1c5080265eb93ffcfb670bad90917d3f..ed80af36d895231bb722eecee1bb180fb85dc0fd 100755 --- a/indra/llcommon/llmd5.cpp +++ b/indra/llcommon/llmd5.cpp @@ -76,7 +76,6 @@ documentation and/or software. #include "llmd5.h" -#include <cassert> #include <iostream> // cerr // how many bytes to grab at a time when checking files diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 70ad10ad5529a3ec39228bac56a72d9b0e3a38d7..e0b2aa87c2e5f9d0ee60bee3d5ebf6799f074513 100755 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -27,12 +27,9 @@ #include "linden_common.h" -//#if MEM_TRACK_MEM #include "llthread.h" -//#endif #if defined(LL_WINDOWS) -//# include <windows.h> # include <psapi.h> #elif defined(LL_DARWIN) # include <sys/types.h> @@ -46,15 +43,18 @@ #include "llsys.h" #include "llframetimer.h" +#include "lltrace.h" //---------------------------------------------------------------------------- //static char* LLMemory::reserveMem = 0; -U32 LLMemory::sAvailPhysicalMemInKB = U32_MAX ; -U32 LLMemory::sMaxPhysicalMemInKB = 0; -U32 LLMemory::sAllocatedMemInKB = 0; -U32 LLMemory::sAllocatedPageSizeInKB = 0 ; -U32 LLMemory::sMaxHeapSizeInKB = U32_MAX ; +U32Kilobytes LLMemory::sAvailPhysicalMemInKB(U32_MAX); +U32Kilobytes LLMemory::sMaxPhysicalMemInKB(0); +static LLTrace::SampleStatHandle<F64Megabytes> sAllocatedMem("allocated_mem", "active memory in use by application"); +static LLTrace::SampleStatHandle<F64Megabytes> sVirtualMem("virtual_mem", "virtual memory assigned to application"); +U32Kilobytes LLMemory::sAllocatedMemInKB(0); +U32Kilobytes LLMemory::sAllocatedPageSizeInKB(0); +U32Kilobytes LLMemory::sMaxHeapSizeInKB(U32_MAX); BOOL LLMemory::sEnableMemoryFailurePrevention = FALSE; #if __DEBUG_PRIVATE_MEM__ @@ -67,7 +67,7 @@ void ll_assert_aligned_func(uintptr_t ptr,U32 alignment) // Redundant, place to set breakpoints. if (ptr%alignment!=0) { - llwarns << "alignment check failed" << llendl; + LL_WARNS() << "alignment check failed" << LL_ENDL; } llassert(ptr%alignment==0); #endif @@ -97,9 +97,9 @@ void LLMemory::freeReserve() } //static -void LLMemory::initMaxHeapSizeGB(F32 max_heap_size_gb, BOOL prevent_heap_failure) +void LLMemory::initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure) { - sMaxHeapSizeInKB = (U32)(max_heap_size_gb * 1024 * 1024) ; + sMaxHeapSizeInKB = max_heap_size; sEnableMemoryFailurePrevention = prevent_heap_failure ; } @@ -112,14 +112,16 @@ void LLMemory::updateMemoryInfo() if (!GetProcessMemoryInfo(self, &counters, sizeof(counters))) { - llwarns << "GetProcessMemoryInfo failed" << llendl; + LL_WARNS() << "GetProcessMemoryInfo failed" << LL_ENDL; return ; } - sAllocatedMemInKB = (U32)(counters.WorkingSetSize / 1024) ; - sAllocatedPageSizeInKB = (U32)(counters.PagefileUsage / 1024) ; + sAllocatedMemInKB = (U32Bytes)(counters.WorkingSetSize) ; + sample(sAllocatedMem, sAllocatedMemInKB); + sAllocatedPageSizeInKB = (U32Bytes)(counters.PagefileUsage) ; + sample(sVirtualMem, sAllocatedPageSizeInKB); - U32 avail_phys, avail_virtual; + U32Kilobytes avail_phys, avail_virtual; LLMemoryInfo::getAvailableMemoryKB(avail_phys, avail_virtual) ; sMaxPhysicalMemInKB = llmin(avail_phys + sAllocatedMemInKB, sMaxHeapSizeInKB); @@ -129,13 +131,13 @@ void LLMemory::updateMemoryInfo() } else { - sAvailPhysicalMemInKB = 0 ; + sAvailPhysicalMemInKB = U32Kilobytes(0); } #else //not valid for other systems for now. - sAllocatedMemInKB = (U32)(LLMemory::getCurrentRSS() / 1024) ; - sMaxPhysicalMemInKB = U32_MAX ; - sAvailPhysicalMemInKB = U32_MAX ; + sAllocatedMemInKB = (U32Bytes)LLMemory::getCurrentRSS(); + sMaxPhysicalMemInKB = (U32Bytes)U32_MAX ; + sAvailPhysicalMemInKB = (U32Bytes)U32_MAX ; #endif return ; @@ -156,7 +158,7 @@ void* LLMemory::tryToAlloc(void* address, U32 size) { if(!VirtualFree(address, 0, MEM_RELEASE)) { - llerrs << "error happens when free some memory reservation." << llendl ; + LL_ERRS() << "error happens when free some memory reservation." << LL_ENDL ; } } return address ; @@ -174,14 +176,14 @@ void LLMemory::logMemoryInfo(BOOL update) LLPrivateMemoryPoolManager::getInstance()->updateStatistics() ; } - llinfos << "Current allocated physical memory(KB): " << sAllocatedMemInKB << llendl ; - llinfos << "Current allocated page size (KB): " << sAllocatedPageSizeInKB << llendl ; - llinfos << "Current availabe physical memory(KB): " << sAvailPhysicalMemInKB << llendl ; - llinfos << "Current max usable memory(KB): " << sMaxPhysicalMemInKB << llendl ; + LL_INFOS() << "Current allocated physical memory(KB): " << sAllocatedMemInKB << LL_ENDL ; + LL_INFOS() << "Current allocated page size (KB): " << sAllocatedPageSizeInKB << LL_ENDL ; + LL_INFOS() << "Current availabe physical memory(KB): " << sAvailPhysicalMemInKB << LL_ENDL ; + LL_INFOS() << "Current max usable memory(KB): " << sMaxPhysicalMemInKB << LL_ENDL ; - llinfos << "--- private pool information -- " << llendl ; - llinfos << "Total reserved (KB): " << LLPrivateMemoryPoolManager::getInstance()->mTotalReservedSize / 1024 << llendl ; - llinfos << "Total allocated (KB): " << LLPrivateMemoryPoolManager::getInstance()->mTotalAllocatedSize / 1024 << llendl ; + LL_INFOS() << "--- private pool information -- " << LL_ENDL ; + LL_INFOS() << "Total reserved (KB): " << LLPrivateMemoryPoolManager::getInstance()->mTotalReservedSize / 1024 << LL_ENDL ; + LL_INFOS() << "Total allocated (KB): " << LLPrivateMemoryPoolManager::getInstance()->mTotalAllocatedSize / 1024 << LL_ENDL ; } //return 0: everything is normal; @@ -190,8 +192,8 @@ void LLMemory::logMemoryInfo(BOOL update) //static bool LLMemory::isMemoryPoolLow() { - static const U32 LOW_MEMEOY_POOL_THRESHOLD_KB = 64 * 1024 ; //64 MB for emergency use - const static U32 MAX_SIZE_CHECKED_MEMORY_BLOCK = 64 * 1024 * 1024 ; //64 MB + static const U32Megabytes LOW_MEMORY_POOL_THRESHOLD(64); + const static U32Megabytes MAX_SIZE_CHECKED_MEMORY_BLOCK(64); static void* last_reserved_address = NULL ; if(!sEnableMemoryFailurePrevention) @@ -199,32 +201,32 @@ bool LLMemory::isMemoryPoolLow() return false ; //no memory failure prevention. } - if(sAvailPhysicalMemInKB < (LOW_MEMEOY_POOL_THRESHOLD_KB >> 2)) //out of physical memory + if(sAvailPhysicalMemInKB < (LOW_MEMORY_POOL_THRESHOLD / 4)) //out of physical memory { return true ; } - if(sAllocatedPageSizeInKB + (LOW_MEMEOY_POOL_THRESHOLD_KB >> 2) > sMaxHeapSizeInKB) //out of virtual address space. + if(sAllocatedPageSizeInKB + (LOW_MEMORY_POOL_THRESHOLD / 4) > sMaxHeapSizeInKB) //out of virtual address space. { return true ; } - bool is_low = (S32)(sAvailPhysicalMemInKB < LOW_MEMEOY_POOL_THRESHOLD_KB || - sAllocatedPageSizeInKB + LOW_MEMEOY_POOL_THRESHOLD_KB > sMaxHeapSizeInKB) ; + bool is_low = (S32)(sAvailPhysicalMemInKB < LOW_MEMORY_POOL_THRESHOLD + || sAllocatedPageSizeInKB + LOW_MEMORY_POOL_THRESHOLD > sMaxHeapSizeInKB) ; //check the virtual address space fragmentation if(!is_low) { if(!last_reserved_address) { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ; + last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; } else { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ; + last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; if(!last_reserved_address) //failed, try once more { - last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ; + last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK.value()) ; } } @@ -235,19 +237,19 @@ bool LLMemory::isMemoryPoolLow() } //static -U32 LLMemory::getAvailableMemKB() +U32Kilobytes LLMemory::getAvailableMemKB() { return sAvailPhysicalMemInKB ; } //static -U32 LLMemory::getMaxMemKB() +U32Kilobytes LLMemory::getMaxMemKB() { return sMaxPhysicalMemInKB ; } //static -U32 LLMemory::getAllocatedMemKB() +U32Kilobytes LLMemory::getAllocatedMemKB() { return sAllocatedMemInKB ; } @@ -263,7 +265,7 @@ U64 LLMemory::getCurrentRSS() if (!GetProcessMemoryInfo(self, &counters, sizeof(counters))) { - llwarns << "GetProcessMemoryInfo failed" << llendl; + LL_WARNS() << "GetProcessMemoryInfo failed" << LL_ENDL; return 0; } @@ -301,7 +303,7 @@ U32 LLMemory::getWorkingSetSize() // if (sysctl(ctl, 2, &page_size, &size, NULL, 0) == -1) // { -// llwarns << "Couldn't get page size" << llendl; +// LL_WARNS() << "Couldn't get page size" << LL_ENDL; // return 0; // } else { // return page_size; @@ -320,11 +322,11 @@ U64 LLMemory::getCurrentRSS() // If we ever wanted it, the process virtual size is also available as: // virtualSize = basicInfo.virtual_size; -// llinfos << "resident size is " << residentSize << llendl; +// LL_INFOS() << "resident size is " << residentSize << LL_ENDL; } else { - llwarns << "task_info failed" << llendl; + LL_WARNS() << "task_info failed" << LL_ENDL; } return residentSize; @@ -345,7 +347,7 @@ U64 LLMemory::getCurrentRSS() if (fp == NULL) { - llwarns << "couldn't open " << statPath << llendl; + LL_WARNS() << "couldn't open " << statPath << LL_ENDL; goto bail; } @@ -358,7 +360,7 @@ U64 LLMemory::getCurrentRSS() &rss); if (ret != 1) { - llwarns << "couldn't parse contents of " << statPath << llendl; + LL_WARNS() << "couldn't parse contents of " << statPath << LL_ENDL; rss = 0; } } @@ -388,12 +390,12 @@ U64 LLMemory::getCurrentRSS() sprintf(path, "/proc/%d/psinfo", (int)getpid()); int proc_fd = -1; if((proc_fd = open(path, O_RDONLY)) == -1){ - llwarns << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << llendl; + LL_WARNS() << "LLmemory::getCurrentRSS() unable to open " << path << ". Returning 0 RSS!" << LL_ENDL; return 0; } psinfo_t proc_psinfo; if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - llwarns << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << llendl; + LL_WARNS() << "LLmemory::getCurrentRSS() Unable to read from " << path << ". Returning 0 RSS!" << LL_ENDL; close(proc_fd); return 0; } @@ -422,141 +424,6 @@ U32 LLMemory::getWorkingSetSize() #endif -//-------------------------------------------------------------------------------------------------- -#if MEM_TRACK_MEM -#include "llframetimer.h" - -//static -LLMemTracker* LLMemTracker::sInstance = NULL ; - -LLMemTracker::LLMemTracker() -{ - mLastAllocatedMem = LLMemory::getWorkingSetSize() ; - mCapacity = 128 ; - mCurIndex = 0 ; - mCounter = 0 ; - mDrawnIndex = 0 ; - mPaused = FALSE ; - - mMutexp = new LLMutex() ; - mStringBuffer = new char*[128] ; - mStringBuffer[0] = new char[mCapacity * 128] ; - for(S32 i = 1 ; i < mCapacity ; i++) - { - mStringBuffer[i] = mStringBuffer[i-1] + 128 ; - } -} - -LLMemTracker::~LLMemTracker() -{ - delete[] mStringBuffer[0] ; - delete[] mStringBuffer; - delete mMutexp ; -} - -//static -LLMemTracker* LLMemTracker::getInstance() -{ - if(!sInstance) - { - sInstance = new LLMemTracker() ; - } - return sInstance ; -} - -//static -void LLMemTracker::release() -{ - if(sInstance) - { - delete sInstance ; - sInstance = NULL ; - } -} - -//static -void LLMemTracker::track(const char* function, const int line) -{ - static const S32 MIN_ALLOCATION = 0 ; //1KB - - if(mPaused) - { - return ; - } - - U32 allocated_mem = LLMemory::getWorkingSetSize() ; - - LLMutexLock lock(mMutexp) ; - - S32 delta_mem = allocated_mem - mLastAllocatedMem ; - mLastAllocatedMem = allocated_mem ; - - if(delta_mem <= 0) - { - return ; //occupied memory does not grow - } - - if(delta_mem < MIN_ALLOCATION) - { - return ; - } - - char* buffer = mStringBuffer[mCurIndex++] ; - F32 time = (F32)LLFrameTimer::getElapsedSeconds() ; - S32 hours = (S32)(time / (60*60)); - S32 mins = (S32)((time - hours*(60*60)) / 60); - S32 secs = (S32)((time - hours*(60*60) - mins*60)); - strcpy(buffer, function) ; - sprintf(buffer + strlen(function), " line: %d DeltaMem: %d (bytes) Time: %d:%02d:%02d", line, delta_mem, hours,mins,secs) ; - - if(mCounter < mCapacity) - { - mCounter++ ; - } - if(mCurIndex >= mCapacity) - { - mCurIndex = 0 ; - } -} - - -//static -void LLMemTracker::preDraw(BOOL pause) -{ - mMutexp->lock() ; - - mPaused = pause ; - mDrawnIndex = mCurIndex - 1; - mNumOfDrawn = 0 ; -} - -//static -void LLMemTracker::postDraw() -{ - mMutexp->unlock() ; -} - -//static -const char* LLMemTracker::getNextLine() -{ - if(mNumOfDrawn >= mCounter) - { - return NULL ; - } - mNumOfDrawn++; - - if(mDrawnIndex < 0) - { - mDrawnIndex = mCapacity - 1 ; - } - - return mStringBuffer[mDrawnIndex--] ; -} - -#endif //MEM_TRACK_MEM -//-------------------------------------------------------------------------------------------------- - - //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- //minimum slot size and minimal slot size interval @@ -961,7 +828,7 @@ void LLPrivateMemoryPool::LLMemoryChunk::dump() total_size += blk_list[i]->getBufferSize() ; if((U32)blk_list[i]->getBuffer() < (U32)blk_list[i-1]->getBuffer() + blk_list[i-1]->getBufferSize()) { - llerrs << "buffer corrupted." << llendl ; + LL_ERRS() << "buffer corrupted." << LL_ENDL ; } } @@ -982,32 +849,32 @@ void LLPrivateMemoryPool::LLMemoryChunk::dump() } else { - llerrs << "gap happens" << llendl ; + LL_ERRS() << "gap happens" << LL_ENDL ; } } #endif #if 0 - llinfos << "---------------------------" << llendl ; - llinfos << "Chunk buffer: " << (U32)getBuffer() << " size: " << getBufferSize() << llendl ; + LL_INFOS() << "---------------------------" << LL_ENDL ; + LL_INFOS() << "Chunk buffer: " << (U32)getBuffer() << " size: " << getBufferSize() << LL_ENDL ; - llinfos << "available blocks ... " << llendl ; + LL_INFOS() << "available blocks ... " << LL_ENDL ; for(S32 i = 0 ; i < mBlockLevels ; i++) { LLMemoryBlock* blk = mAvailBlockList[i] ; while(blk) { - llinfos << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << llendl ; + LL_INFOS() << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << LL_ENDL ; blk = blk->mNext ; } } - llinfos << "free blocks ... " << llendl ; + LL_INFOS() << "free blocks ... " << LL_ENDL ; for(S32 i = 0 ; i < mPartitionLevels ; i++) { LLMemoryBlock* blk = mFreeSpaceList[i] ; while(blk) { - llinfos << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << llendl ; + LL_INFOS() << "blk buffer " << (U32)blk->getBuffer() << " size: " << blk->getBufferSize() << LL_ENDL ; blk = blk->mNext ; } } @@ -1403,7 +1270,7 @@ char* LLPrivateMemoryPool::allocate(U32 size) if(to_log) { - llwarns << "The memory pool overflows, now using heap directly!" << llendl ; + LL_WARNS() << "The memory pool overflows, now using heap directly!" << LL_ENDL ; to_log = false ; } @@ -1496,7 +1363,7 @@ void LLPrivateMemoryPool::destroyPool() if(mNumOfChunks > 0) { - llwarns << "There is some memory not freed when destroy the memory pool!" << llendl ; + LL_WARNS() << "There is some memory not freed when destroy the memory pool!" << LL_ENDL ; } mNumOfChunks = 0 ; @@ -1514,11 +1381,11 @@ bool LLPrivateMemoryPool::checkSize(U32 asked_size) { if(mReservedPoolSize + asked_size > mMaxPoolSize) { - llinfos << "Max pool size: " << mMaxPoolSize << llendl ; - llinfos << "Total reserved size: " << mReservedPoolSize + asked_size << llendl ; - llinfos << "Total_allocated Size: " << getTotalAllocatedSize() << llendl ; + LL_INFOS() << "Max pool size: " << mMaxPoolSize << LL_ENDL ; + LL_INFOS() << "Total reserved size: " << mReservedPoolSize + asked_size << LL_ENDL ; + LL_INFOS() << "Total_allocated Size: " << getTotalAllocatedSize() << LL_ENDL ; - //llerrs << "The pool is overflowing..." << llendl ; + //LL_ERRS() << "The pool is overflowing..." << LL_ENDL ; return false ; } @@ -1731,7 +1598,7 @@ void LLPrivateMemoryPool::removeFromHashTable(LLMemoryChunk* chunk) void LLPrivateMemoryPool::rehash() { - llinfos << "new hash factor: " << mHashFactor << llendl ; + LL_INFOS() << "new hash factor: " << mHashFactor << LL_ENDL ; mChunkHashList.clear() ; mChunkHashList.resize(mHashFactor) ; @@ -1811,7 +1678,7 @@ void LLPrivateMemoryPool::LLChunkHashElement::remove(LLPrivateMemoryPool::LLMemo } else { - llerrs << "This slot does not contain this chunk!" << llendl ; + LL_ERRS() << "This slot does not contain this chunk!" << LL_ENDL ; } } @@ -1843,12 +1710,12 @@ LLPrivateMemoryPoolManager::~LLPrivateMemoryPoolManager() #if __DEBUG_PRIVATE_MEM__ if(!sMemAllocationTracker.empty()) { - llwarns << "there is potential memory leaking here. The list of not freed memory blocks are from: " <<llendl ; + LL_WARNS() << "there is potential memory leaking here. The list of not freed memory blocks are from: " <<LL_ENDL ; S32 k = 0 ; for(mem_allocation_info_t::iterator iter = sMemAllocationTracker.begin() ; iter != sMemAllocationTracker.end() ; ++iter) { - llinfos << k++ << ", " << (U32)iter->first << " : " << iter->second << llendl ; + LL_INFOS() << k++ << ", " << (U32)iter->first << " : " << iter->second << LL_ENDL ; } sMemAllocationTracker.clear() ; } @@ -2044,7 +1911,7 @@ void LLPrivateMemoryPoolManager::freeMem(LLPrivateMemoryPool* poolp, void* addr } else { - llerrs << "private pool is used before initialized.!" << llendl ; + LL_ERRS() << "private pool is used before initialized.!" << LL_ENDL ; } } } @@ -2118,7 +1985,7 @@ void LLPrivateMemoryPoolTester::test(U32 min_size, U32 max_size, U32 stride, U32 //allocate space for p ; if(!(p = ::new char**[times]) || !(*p = ::new char*[times * levels])) { - llerrs << "memory initialization for p failed" << llendl ; + LL_ERRS() << "memory initialization for p failed" << LL_ENDL ; } //init @@ -2190,8 +2057,8 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) { LLTimer timer ; - llinfos << " -**********************- " << llendl ; - llinfos << "test size: " << size << " test times: " << times << llendl ; + LL_INFOS() << " -**********************- " << LL_ENDL ; + LL_INFOS() << "test size: " << size << " test times: " << times << LL_ENDL ; timer.reset() ; char** p = new char*[times] ; @@ -2203,7 +2070,7 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) p[i] = ALLOCATE_MEM(sPool, size) ; if(!p[i]) { - llerrs << "allocation failed" << llendl ; + LL_ERRS() << "allocation failed" << LL_ENDL ; } } //de-allocation @@ -2212,7 +2079,7 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) FREE_MEM(sPool, p[i]) ; p[i] = NULL ; } - llinfos << "time spent using customized memory pool: " << timer.getElapsedTimeF32() << llendl ; + LL_INFOS() << "time spent using customized memory pool: " << timer.getElapsedTimeF32() << LL_ENDL ; timer.reset() ; @@ -2223,7 +2090,7 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) p[i] = ::new char[size] ; if(!p[i]) { - llerrs << "allocation failed" << llendl ; + LL_ERRS() << "allocation failed" << LL_ENDL ; } } //de-allocation @@ -2232,7 +2099,7 @@ void LLPrivateMemoryPoolTester::testAndTime(U32 size, U32 times) ::delete[] p[i] ; p[i] = NULL ; } - llinfos << "time spent using standard allocator/de-allocator: " << timer.getElapsedTimeF32() << llendl ; + LL_INFOS() << "time spent using standard allocator/de-allocator: " << timer.getElapsedTimeF32() << LL_ENDL ; delete[] p; } diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 61e30f11cc12d54b7643a8a1bbb2ed014ef61ab6..db52f2b1f478e624f96af05d03aa9ff8384394f1 100755 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -27,15 +27,35 @@ #define LLMEMORY_H #include "linden_common.h" +#include "llunits.h" +#if !LL_WINDOWS +#include <stdint.h> +#endif class LLMutex ; #if LL_WINDOWS && LL_DEBUG #define LL_CHECK_MEMORY llassert(_CrtCheckMemory()); #else -#define LL_CHECK_MEMORY +#define LL_CHECK_MEMORY +#endif + + +#if LL_WINDOWS +#define LL_ALIGN_OF __alignof +#else +#define LL_ALIGN_OF __align_of__ +#endif + +#if LL_WINDOWS +#define LL_DEFAULT_HEAP_ALIGN 8 +#elif LL_DARWIN +#define LL_DEFAULT_HEAP_ALIGN 16 +#elif LL_LINUX +#define LL_DEFAULT_HEAP_ALIGN 8 #endif + LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment); #ifdef SHOW_ASSERT @@ -74,7 +94,8 @@ template <typename T> T* LL_NEXT_ALIGNED_ADDRESS_64(T* address) #define LL_ALIGN_16(var) LL_ALIGN_PREFIX(16) var LL_ALIGN_POSTFIX(16) -inline void* ll_aligned_malloc( size_t size, int align ) + +inline void* ll_aligned_malloc_fallback( size_t size, int align ) { #if defined(LL_WINDOWS) return _aligned_malloc(size, align); @@ -88,7 +109,7 @@ inline void* ll_aligned_malloc( size_t size, int align ) #endif } -inline void ll_aligned_free( void* ptr ) +inline void ll_aligned_free_fallback( void* ptr ) { #if defined(LL_WINDOWS) _aligned_free(ptr); @@ -161,7 +182,7 @@ inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed wi #if defined(LL_WINDOWS) return _aligned_malloc(size, 32); #elif defined(LL_DARWIN) - return ll_aligned_malloc( size, 32 ); + return ll_aligned_malloc_fallback( size, 32 ); #else void *rtn; if (LL_LIKELY(0 == posix_memalign(&rtn, 32, size))) @@ -176,12 +197,54 @@ inline void ll_aligned_free_32(void *p) #if defined(LL_WINDOWS) _aligned_free(p); #elif defined(LL_DARWIN) - ll_aligned_free( p ); + ll_aligned_free_fallback( p ); #else free(p); // posix_memalign() is compatible with heap deallocator #endif } +// general purpose dispatch functions that are forced inline so they can compile down to a single call +template<size_t ALIGNMENT> +LL_FORCE_INLINE void* ll_aligned_malloc(size_t size) +{ + if (LL_DEFAULT_HEAP_ALIGN % ALIGNMENT == 0) + { + return malloc(size); + } + else if (ALIGNMENT == 16) + { + return ll_aligned_malloc_16(size); + } + else if (ALIGNMENT == 32) + { + return ll_aligned_malloc_32(size); + } + else + { + return ll_aligned_malloc_fallback(size, ALIGNMENT); + } +} + +template<size_t ALIGNMENT> +LL_FORCE_INLINE void ll_aligned_free(void* ptr) +{ + if (ALIGNMENT == LL_DEFAULT_HEAP_ALIGN) + { + free(ptr); + } + else if (ALIGNMENT == 16) + { + ll_aligned_free_16(ptr); + } + else if (ALIGNMENT == 32) + { + return ll_aligned_free_32(ptr); + } + else + { + return ll_aligned_free_fallback(ptr); + } +} // Copy words 16-byte blocks from src to dst. Source and destination MUST NOT OVERLAP. // Source and dest must be 16-byte aligned and size must be multiple of 16. @@ -269,70 +332,25 @@ class LL_COMMON_API LLMemory static U64 getCurrentRSS(); static U32 getWorkingSetSize(); static void* tryToAlloc(void* address, U32 size); - static void initMaxHeapSizeGB(F32 max_heap_size_gb, BOOL prevent_heap_failure); + static void initMaxHeapSizeGB(F32Gigabytes max_heap_size, BOOL prevent_heap_failure); static void updateMemoryInfo() ; static void logMemoryInfo(BOOL update = FALSE); static bool isMemoryPoolLow(); - static U32 getAvailableMemKB() ; - static U32 getMaxMemKB() ; - static U32 getAllocatedMemKB() ; + static U32Kilobytes getAvailableMemKB() ; + static U32Kilobytes getMaxMemKB() ; + static U32Kilobytes getAllocatedMemKB() ; private: static char* reserveMem; - static U32 sAvailPhysicalMemInKB ; - static U32 sMaxPhysicalMemInKB ; - static U32 sAllocatedMemInKB; - static U32 sAllocatedPageSizeInKB ; + static U32Kilobytes sAvailPhysicalMemInKB ; + static U32Kilobytes sMaxPhysicalMemInKB ; + static U32Kilobytes sAllocatedMemInKB; + static U32Kilobytes sAllocatedPageSizeInKB ; - static U32 sMaxHeapSizeInKB; + static U32Kilobytes sMaxHeapSizeInKB; static BOOL sEnableMemoryFailurePrevention; }; -//---------------------------------------------------------------------------- -#if MEM_TRACK_MEM -class LLMutex ; -class LL_COMMON_API LLMemTracker -{ -private: - LLMemTracker() ; - ~LLMemTracker() ; - -public: - static void release() ; - static LLMemTracker* getInstance() ; - - void track(const char* function, const int line) ; - void preDraw(BOOL pause) ; - void postDraw() ; - const char* getNextLine() ; - -private: - static LLMemTracker* sInstance ; - - char** mStringBuffer ; - S32 mCapacity ; - U32 mLastAllocatedMem ; - S32 mCurIndex ; - S32 mCounter; - S32 mDrawnIndex; - S32 mNumOfDrawn; - BOOL mPaused; - LLMutex* mMutexp ; -}; - -#define MEM_TRACK_RELEASE LLMemTracker::release() ; -#define MEM_TRACK LLMemTracker::getInstance()->track(__FUNCTION__, __LINE__) ; - -#else // MEM_TRACK_MEM - -#define MEM_TRACK_RELEASE -#define MEM_TRACK - -#endif // MEM_TRACK_MEM - -//---------------------------------------------------------------------------- - - // //class LLPrivateMemoryPool defines a private memory pool for an application to use, so the application does not //need to access the heap directly fro each memory allocation. Throught this, the allocation speed is faster, diff --git a/indra/llcommon/llmemorystream.cpp b/indra/llcommon/llmemorystream.cpp index 723d94f025d517505bdcc59e26e43b31047f3dc1..707ac8fd0ff714f6ac4aad169480b7660e613c47 100755 --- a/indra/llcommon/llmemorystream.cpp +++ b/indra/llcommon/llmemorystream.cpp @@ -45,7 +45,7 @@ void LLMemoryStreamBuf::reset(const U8* start, S32 length) int LLMemoryStreamBuf::underflow() { - //lldebugs << "LLMemoryStreamBuf::underflow()" << llendl; + //LL_DEBUGS() << "LLMemoryStreamBuf::underflow()" << LL_ENDL; if(gptr() < egptr()) { return *gptr(); diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index 731e58bd20e5af682a31611f5f8bbee5080b9ef1..1fc821d9a9622c3cb589ff7ec7b85770fea9cbc6 100755 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -29,9 +29,9 @@ #include "indra_constants.h" #include "llerror.h" #include "llsdserialize.h" -#include "llstat.h" #include "lltreeiterators.h" #include "llmetricperformancetester.h" +#include "llfasttimer.h" //---------------------------------------------------------------------------------------------- // LLMetricPerformanceTesterBasic : static methods and testers management @@ -56,7 +56,7 @@ BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* t std::string name = tester->getTesterName() ; if (getTester(name)) { - llerrs << "Tester name is already used by some other tester : " << name << llendl ; + LL_ERRS() << "Tester name is already used by some other tester : " << name << LL_ENDL ; return FALSE; } @@ -91,7 +91,7 @@ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::s // Return TRUE if this metric is requested or if the general default "catch all" metric is requested BOOL LLMetricPerformanceTesterBasic::isMetricLogRequested(std::string name) { - return (LLFastTimer::sMetricLog && ((LLFastTimer::sLogName == name) || (LLFastTimer::sLogName == DEFAULT_METRIC_NAME))); + return (LLTrace::BlockTimer::sMetricLog && ((LLTrace::BlockTimer::sLogName == name) || (LLTrace::BlockTimer::sLogName == DEFAULT_METRIC_NAME))); } /*static*/ @@ -136,7 +136,7 @@ void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std std::ifstream target_is(target.c_str()); if (!base_is.is_open() || !target_is.is_open()) { - llwarns << "'-analyzeperformance' error : baseline or current target file inexistent" << llendl; + LL_WARNS() << "'-analyzeperformance' error : baseline or current target file inexistent" << LL_ENDL; base_is.close(); target_is.close(); return; @@ -176,7 +176,7 @@ LLMetricPerformanceTesterBasic::LLMetricPerformanceTesterBasic(std::string name) { if (mName == std::string()) { - llerrs << "LLMetricPerformanceTesterBasic construction invalid : Empty name passed to constructor" << llendl ; + LL_ERRS() << "LLMetricPerformanceTesterBasic construction invalid : Empty name passed to constructor" << LL_ENDL ; } mValidInstance = LLMetricPerformanceTesterBasic::addTester(this) ; @@ -194,8 +194,7 @@ void LLMetricPerformanceTesterBasic::preOutputTestResults(LLSD* sd) void LLMetricPerformanceTesterBasic::postOutputTestResults(LLSD* sd) { - LLMutexLock lock(LLFastTimer::sLogLock); - LLFastTimer::sLogQueue.push((*sd)); + LLTrace::BlockTimer::pushLog(*sd); } void LLMetricPerformanceTesterBasic::outputTestResults() @@ -242,7 +241,7 @@ void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD* (F32)((*base)[label][ mMetricStrings[index] ].asReal()), (F32)((*current)[label][ mMetricStrings[index] ].asReal())) ; break; default: - llerrs << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << llendl ; + LL_ERRS() << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << LL_ENDL ; } } } @@ -306,7 +305,7 @@ void LLMetricPerformanceTesterWithSession::analyzePerformance(std::ofstream* os, if (!mBaseSessionp || !mCurrentSessionp) { - llerrs << "Error loading test sessions." << llendl ; + LL_ERRS() << "Error loading test sessions." << LL_ENDL ; } // Compare diff --git a/indra/llcommon/llmetrics.cpp b/indra/llcommon/llmetrics.cpp index 3078139f43c0bed18d3acfa4f40fbe37bf8fad75..d40afe5160805740494ec176c96c9a4f2e32cab5 100755 --- a/indra/llcommon/llmetrics.cpp +++ b/indra/llcommon/llmetrics.cpp @@ -65,7 +65,7 @@ void LLMetricsImpl::recordEventDetails(const std::string& location, metrics["location"] = location; metrics["stats"] = stats; - llinfos << "LLMETRICS: " << (LLSDNotationStreamer(metrics)) << llendl; + LL_INFOS() << "LLMETRICS: " << (LLSDNotationStreamer(metrics)) << LL_ENDL; } // Store this: @@ -128,7 +128,7 @@ void LLMetricsImpl::printTotals(LLSD metadata) out_sd["stats"] = stats; - llinfos << "LLMETRICS: AGGREGATE: " << LLSDOStreamer<LLSDNotationFormatter>(out_sd) << llendl; + LL_INFOS() << "LLMETRICS: AGGREGATE: " << LLSDOStreamer<LLSDNotationFormatter>(out_sd) << LL_ENDL; } LLMetrics::LLMetrics() diff --git a/indra/llcommon/llmetrics.h b/indra/llcommon/llmetrics.h index 4f0ae5633806d616aba80bc282854fb9ddd122a3..85a6986049bf388c892af3b8ba7c5704cf8a8b46 100755 --- a/indra/llcommon/llmetrics.h +++ b/indra/llcommon/llmetrics.h @@ -38,7 +38,7 @@ class LL_COMMON_API LLMetrics LLMetrics(); virtual ~LLMetrics(); - // Adds this event to aggregate totals and records details to syslog (llinfos) + // Adds this event to aggregate totals and records details to syslog (LL_INFOS()) virtual void recordEventDetails(const std::string& location, const std::string& mesg, bool success, diff --git a/indra/llcommon/llmortician.h b/indra/llcommon/llmortician.h index 319955ef9377acb172cddf1c7c1286800b0c46fb..9517e2db5e2eabb1424f7d87f637f20bb50b311d 100755 --- a/indra/llcommon/llmortician.h +++ b/indra/llcommon/llmortician.h @@ -28,6 +28,7 @@ #define LLMORTICIAN_H #include "stdtypes.h" +#include <list> class LL_COMMON_API LLMortician { diff --git a/indra/llcommon/llmutex.cpp b/indra/llcommon/llmutex.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9c13ef9e309a94dda09dfa19929c69297a0cfc05 --- /dev/null +++ b/indra/llcommon/llmutex.cpp @@ -0,0 +1,205 @@ +/** + * @file llmutex.cpp + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "llapr.h" + +#include "apr_portable.h" + +#include "llmutex.h" +#include "llthread.h" + +//============================================================================ + +LLMutex::LLMutex(apr_pool_t *poolp) : + mAPRMutexp(NULL), mCount(0), mLockingThread(NO_THREAD) +{ + //if (poolp) + //{ + // mIsLocalPool = FALSE; + // mAPRPoolp = poolp; + //} + //else + { + mIsLocalPool = TRUE; + apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread + } + apr_thread_mutex_create(&mAPRMutexp, APR_THREAD_MUTEX_UNNESTED, mAPRPoolp); +} + + +LLMutex::~LLMutex() +{ +#if MUTEX_DEBUG + //bad assertion, the subclass LLSignal might be "locked", and that's OK + //llassert_always(!isLocked()); // better not be locked! +#endif + if (ll_apr_is_initialized()) + { + apr_thread_mutex_destroy(mAPRMutexp); + if (mIsLocalPool) + { + apr_pool_destroy(mAPRPoolp); + } + } + mAPRMutexp = NULL; +} + + +void LLMutex::lock() +{ + if(isSelfLocked()) + { //redundant lock + mCount++; + return; + } + + apr_thread_mutex_lock(mAPRMutexp); + +#if MUTEX_DEBUG + // Have to have the lock before we can access the debug info + U32 id = LLThread::currentID(); + if (mIsLocked[id] != FALSE) + LL_ERRS() << "Already locked in Thread: " << id << LL_ENDL; + mIsLocked[id] = TRUE; +#endif + + mLockingThread = LLThread::currentID(); +} + +void LLMutex::unlock() +{ + if (mCount > 0) + { //not the root unlock + mCount--; + return; + } + +#if MUTEX_DEBUG + // Access the debug info while we have the lock + U32 id = LLThread::currentID(); + if (mIsLocked[id] != TRUE) + LL_ERRS() << "Not locked in Thread: " << id << LL_ENDL; + mIsLocked[id] = FALSE; +#endif + + mLockingThread = NO_THREAD; + apr_thread_mutex_unlock(mAPRMutexp); +} + +bool LLMutex::isLocked() +{ + apr_status_t status = apr_thread_mutex_trylock(mAPRMutexp); + if (APR_STATUS_IS_EBUSY(status)) + { + return true; + } + else + { + apr_thread_mutex_unlock(mAPRMutexp); + return false; + } +} + +bool LLMutex::isSelfLocked() +{ + return mLockingThread == LLThread::currentID(); +} + +U32 LLMutex::lockingThread() const +{ + return mLockingThread; +} + +bool LLMutex::trylock() +{ + if(isSelfLocked()) + { //redundant lock + mCount++; + return true; + } + + apr_status_t status(apr_thread_mutex_trylock(mAPRMutexp)); + if (APR_STATUS_IS_EBUSY(status)) + { + return false; + } + +#if MUTEX_DEBUG + // Have to have the lock before we can access the debug info + U32 id = LLThread::currentID(); + if (mIsLocked[id] != FALSE) + LL_ERRS() << "Already locked in Thread: " << id << LL_ENDL; + mIsLocked[id] = TRUE; +#endif + + mLockingThread = LLThread::currentID(); + return true; +} + +//============================================================================ + +LLCondition::LLCondition(apr_pool_t *poolp) : + LLMutex(poolp) +{ + // base class (LLMutex) has already ensured that mAPRPoolp is set up. + + apr_thread_cond_create(&mAPRCondp, mAPRPoolp); +} + + +LLCondition::~LLCondition() +{ + apr_thread_cond_destroy(mAPRCondp); + mAPRCondp = NULL; +} + + +void LLCondition::wait() +{ + if (!isLocked()) + { //mAPRMutexp MUST be locked before calling apr_thread_cond_wait + apr_thread_mutex_lock(mAPRMutexp); +#if MUTEX_DEBUG + // avoid asserts on destruction in non-release builds + U32 id = LLThread::currentID(); + mIsLocked[id] = TRUE; +#endif + } + apr_thread_cond_wait(mAPRCondp, mAPRMutexp); +} + +void LLCondition::signal() +{ + apr_thread_cond_signal(mAPRCondp); +} + +void LLCondition::broadcast() +{ + apr_thread_cond_broadcast(mAPRCondp); +} + + +//============================================================================ diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h new file mode 100644 index 0000000000000000000000000000000000000000..3659a319a2efd3e90d267a800ac05e24950ce901 --- /dev/null +++ b/indra/llcommon/llmutex.h @@ -0,0 +1,141 @@ +/** + * @file llmutex.h + * @brief Base classes for mutex and condition handling. + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLMUTEX_H +#define LL_LLMUTEX_H + +#include "stdtypes.h" + +//============================================================================ + +#define MUTEX_DEBUG (LL_DEBUG || LL_RELEASE_WITH_DEBUG_INFO) + +struct apr_thread_mutex_t; +struct apr_pool_t; +struct apr_thread_cond_t; + +class LL_COMMON_API LLMutex +{ +public: + typedef enum + { + NO_THREAD = 0xFFFFFFFF + } e_locking_thread; + + LLMutex(apr_pool_t *apr_poolp = NULL); // NULL pool constructs a new pool for the mutex + virtual ~LLMutex(); + + void lock(); // blocks + bool trylock(); // non-blocking, returns true if lock held. + void unlock(); // undefined behavior when called on mutex not being held + bool isLocked(); // non-blocking, but does do a lock/unlock so not free + bool isSelfLocked(); //return true if locked in a same thread + U32 lockingThread() const; //get ID of locking thread + +protected: + apr_thread_mutex_t *mAPRMutexp; + mutable U32 mCount; + mutable U32 mLockingThread; + + apr_pool_t *mAPRPoolp; + BOOL mIsLocalPool; + +#if MUTEX_DEBUG + std::map<U32, BOOL> mIsLocked; +#endif +}; + +// Actually a condition/mutex pair (since each condition needs to be associated with a mutex). +class LL_COMMON_API LLCondition : public LLMutex +{ +public: + LLCondition(apr_pool_t* apr_poolp); // Defaults to global pool, could use the thread pool as well. + ~LLCondition(); + + void wait(); // blocks + void signal(); + void broadcast(); + +protected: + apr_thread_cond_t* mAPRCondp; +}; + +class LLMutexLock +{ +public: + LLMutexLock(LLMutex* mutex) + { + mMutex = mutex; + + if(mMutex) + mMutex->lock(); + } + ~LLMutexLock() + { + if(mMutex) + mMutex->unlock(); + } +private: + LLMutex* mMutex; +}; + +//============================================================================ + +// Scoped locking class similar in function to LLMutexLock but uses +// the trylock() method to conditionally acquire lock without +// blocking. Caller resolves the resulting condition by calling +// the isLocked() method and either punts or continues as indicated. +// +// Mostly of interest to callers needing to avoid stalls who can +// guarantee another attempt at a later time. + +class LLMutexTrylock +{ +public: + LLMutexTrylock(LLMutex* mutex) + : mMutex(mutex), + mLocked(false) + { + if (mMutex) + mLocked = mMutex->trylock(); + } + + ~LLMutexTrylock() + { + if (mMutex && mLocked) + mMutex->unlock(); + } + + bool isLocked() const + { + return mLocked; + } + +private: + LLMutex* mMutex; + bool mLocked; +}; +#endif // LL_LLTHREAD_H diff --git a/indra/llcommon/llnametable.h b/indra/llcommon/llnametable.h old mode 100755 new mode 100644 diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 88c09c8dca83b606167be45e79728e6d78780ba4..c9ebc70d193f68831c145241b4dd5b0641b27221 100755 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -27,6 +27,7 @@ #define LLPOINTER_H #include "llerror.h" // *TODO: consider eliminating this +#include "llmutex.h" //---------------------------------------------------------------------------- // RefCount objects should generally only be accessed by way of LLPointer<>'s @@ -97,24 +98,13 @@ template <class Type> class LLPointer LLPointer<Type>& operator =(Type* ptr) { - if( mPointer != ptr ) - { - unref(); - mPointer = ptr; - ref(); - } - + assign(ptr); return *this; } LLPointer<Type>& operator =(const LLPointer<Type>& ptr) { - if( mPointer != ptr.mPointer ) - { - unref(); - mPointer = ptr.mPointer; - ref(); - } + assign(ptr); return *this; } @@ -122,12 +112,7 @@ template <class Type> class LLPointer template<typename Subclass> LLPointer<Type>& operator =(const LLPointer<Subclass>& ptr) { - if( mPointer != ptr.get() ) - { - unref(); - mPointer = ptr.get(); - ref(); - } + assign(ptr.get()); return *this; } @@ -144,6 +129,16 @@ template <class Type> class LLPointer void ref(); void unref(); #else + + void assign(const LLPointer<Type>& ptr) + { + if( mPointer != ptr.mPointer ) + { + unref(); + mPointer = ptr.mPointer; + ref(); + } + } void ref() { if (mPointer) @@ -156,12 +151,12 @@ template <class Type> class LLPointer { if (mPointer) { - Type *tempp = mPointer; + Type *temp = mPointer; mPointer = NULL; - tempp->unref(); + temp->unref(); if (mPointer != NULL) { - llwarns << "Unreference did assignment to non-NULL because of destructor" << llendl; + LL_WARNS() << "Unreference did assignment to non-NULL because of destructor" << LL_ENDL; unref(); } } @@ -171,4 +166,52 @@ template <class Type> class LLPointer Type* mPointer; }; +template<typename Type> +class LLCopyOnWritePointer : public LLPointer<Type> +{ +public: + typedef LLCopyOnWritePointer<Type> self_t; + typedef LLPointer<Type> pointer_t; + + LLCopyOnWritePointer() + : mStayUnique(false) + {} + + LLCopyOnWritePointer(Type* ptr) + : LLPointer<Type>(ptr), + mStayUnique(false) + {} + + LLCopyOnWritePointer(LLPointer<Type>& ptr) + : LLPointer<Type>(ptr), + mStayUnique(false) + { + if (ptr.mForceUnique) + { + makeUnique(); + } + } + + Type* write() + { + makeUnique(); + return pointer_t::mPointer; + } + + void makeUnique() + { + if (pointer_t::notNull() && pointer_t::mPointer->getNumRefs() > 1) + { + *(pointer_t* )(this) = new Type(*pointer_t::mPointer); + } + } + + const Type* operator->() const { return pointer_t::mPointer; } + const Type& operator*() const { return *pointer_t::mPointer; } + + void setStayUnique(bool stay) { makeUnique(); mStayUnique = stay; } +private: + bool mStayUnique; +}; + #endif diff --git a/indra/llui/llfunctorregistry.cpp b/indra/llcommon/llpredicate.cpp old mode 100755 new mode 100644 similarity index 66% rename from indra/llui/llfunctorregistry.cpp rename to indra/llcommon/llpredicate.cpp index 80033249731efd5f2d82d0335c37dda40f9c2d2b..1278948e2478ddb353665d91c9a1028d10f42c78 --- a/indra/llui/llfunctorregistry.cpp +++ b/indra/llcommon/llpredicate.cpp @@ -1,7 +1,6 @@ -/** - * @file llfunctorregistry.cpp - * @author Kent Quirk - * @brief Maintains a registry of named callback functors taking a single LLSD parameter +/** + * @file llpredicate.cpp + * @brief abstraction for filtering objects by predicates, with arbitrary boolean expressions * * $LicenseInfo:firstyear=2008&license=viewerlgpl$ * Second Life Viewer Source Code @@ -23,11 +22,20 @@ * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ - **/ - + */ #include "linden_common.h" -#include "llfunctorregistry.h" -// This is a default functor always resident in the system. -// It's used whenever a functor isn't found in the registry, so that -// we at least log the data relating to the user response. +#include "llpredicate.h" + +namespace LLPredicate +{ + const U32 cPredicateFlagsFromEnum[5] = + { + 0xAAAAaaaa, // 10101010101010101010101010101010 + 0xCCCCcccc, // 11001100110011001100110011001100 + 0xF0F0F0F0, // 11110000111100001111000011110000 + 0xFF00FF00, // 11111111000000001111111100000000 + 0xFFFF0000 // 11111111111111110000000000000000 + }; +} + diff --git a/indra/llcommon/llpredicate.h b/indra/llcommon/llpredicate.h new file mode 100644 index 0000000000000000000000000000000000000000..a0e970a79975ba1bc768d9984aca1ccd50de14b8 --- /dev/null +++ b/indra/llcommon/llpredicate.h @@ -0,0 +1,210 @@ +/** + * @file llpredicate.h + * @brief abstraction for filtering objects by predicates, with arbitrary boolean expressions + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPREDICATE_H +#define LL_LLPREDICATE_H + +#include "llerror.h" + +namespace LLPredicate +{ + template<typename ENUM> class Rule; + + extern const U32 cPredicateFlagsFromEnum[5]; + + template<typename ENUM> + class Value + { + public: + typedef U32 predicate_flag_t; + static const S32 cMaxEnum = 5; + + Value(ENUM e, bool predicate_value = true) + : mPredicateFlags(predicate_value ? cPredicateFlagsFromEnum[e] : ~cPredicateFlagsFromEnum[e]) + { + llassert(0 <= e && e < cMaxEnum); + } + + Value() + : mPredicateFlags(0xFFFFffff) + {} + + Value operator!() const + { + Value new_value; + new_value.mPredicateFlags = ~mPredicateFlags; + return new_value; + } + + Value operator &&(const Value other) const + { + Value new_value; + new_value.mPredicateFlags = mPredicateFlags & other.mPredicateFlags; + return new_value; + } + + Value operator ||(const Value other) const + { + Value new_value; + new_value.mPredicateFlags = mPredicateFlags | other.mPredicateFlags; + return new_value; + } + + void set(ENUM e, bool value = true) + { + llassert(0 <= e && e < cMaxEnum); + predicate_flag_t flags_to_modify; + predicate_flag_t mask = cPredicateFlagsFromEnum[e]; + if (value) + { // add predicate "e" to flags that don't contain it already + flags_to_modify = (mPredicateFlags & ~mask); + // clear flags not containing e + mPredicateFlags &= mask; + // add back flags shifted to contain e + mPredicateFlags |= flags_to_modify << (0x1 << e); + } + else + { // remove predicate "e" from flags that contain it + flags_to_modify = (mPredicateFlags & mask); + // clear flags containing e + mPredicateFlags &= ~mask; + // add back flags shifted to not contain e + mPredicateFlags |= flags_to_modify >> (0x1 << e); + } + } + + void forget(ENUM e) + { + set(e, true); + U32 flags_with_predicate = mPredicateFlags; + set(e, false); + // ambiguous value is result of adding and removing predicate at the same time! + mPredicateFlags |= flags_with_predicate; + } + + bool allSet() const + { + return mPredicateFlags == ~0; + } + + bool noneSet() const + { + return mPredicateFlags == 0; + } + + bool someSet() const + { + return mPredicateFlags != 0; + } + + private: + predicate_flag_t mPredicateFlags; + }; + + template<typename ENUM> + class Rule + { + public: + Rule(ENUM value) + : mRule(value) + {} + + Rule(const Value<ENUM> other) + : mRule(other) + {} + + Rule() + {} + + void require(ENUM e) + { + mRule.set(e, require); + } + + void allow(ENUM e) + { + mRule.forget(e); + } + + bool check(const Value<ENUM> value) const + { + return (mRule && value).someSet(); + } + + bool requires(const Value<ENUM> value) const + { + return (mRule && value).someSet() && (!mRule && value).noneSet(); + } + + bool isAmbivalent(const Value<ENUM> value) const + { + return (mRule && value).someSet() && (!mRule && value).someSet(); + } + + bool acceptsAll() const + { + return mRule.allSet(); + } + + bool acceptsNone() const + { + return mRule.noneSet(); + } + + Rule operator!() const + { + Rule new_rule; + new_rule.mRule = !mRule; + return new_rule; + } + + Rule operator &&(const Rule other) const + { + Rule new_rule; + new_rule.mRule = mRule && other.mRule; + return new_rule; + } + + Rule operator ||(const Rule other) const + { + Rule new_rule; + new_rule.mRule = mRule || other.mRule; + return new_rule; + } + + private: + Value<ENUM> mRule; + }; +} + +template<typename ENUM> +LLPredicate::Value<ENUM> ll_make_predicate(ENUM e, bool predicate_value = true) +{ + return LLPredicate::Value<ENUM>(e, predicate_value); +} + + +#endif // LL_LLPREDICATE_H diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index 7fdb537ab526b30ba693e0046d9102de0ff76fcb..309165da7f4a76413f9f8b6074e4683aa5d5c315 100755 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -181,4 +181,25 @@ # define LL_COMMON_API #endif // LL_COMMON_LINK_SHARED +#if LL_WINDOWS +#define LL_TYPEOF(exp) decltype(exp) +#elif LL_LINUX +#define LL_TYPEOF(exp) typeof(exp) +#elif LL_DARWIN +#define LL_TYPEOF(exp) typeof(exp) +#endif + +#define LL_TO_STRING_HELPER(x) #x +#define LL_TO_STRING(x) LL_TO_STRING_HELPER(x) +#define LL_FILE_LINENO_MSG(msg) __FILE__ "(" LL_TO_STRING(__LINE__) ") : " msg +#define LL_GLUE_IMPL(x, y) x##y +#define LL_GLUE_TOKENS(x, y) LL_GLUE_IMPL(x, y) + +#if LL_WINDOWS +#define LL_COMPILE_TIME_MESSAGE(msg) __pragma(message(LL_FILE_LINENO_MSG(msg))) +#else +// no way to get gcc 4.2 to print a user-defined diagnostic message only when a macro is used +#define LL_COMPILE_TIME_MESSAGE(msg) +#endif + #endif // not LL_LINDEN_PREPROCESSOR_H diff --git a/indra/llcommon/llpriqueuemap.h b/indra/llcommon/llpriqueuemap.h index da997c7b04936cee087ccc1d4ae8c0d32521e285..d8d3edd48ae52403a2af3ac5f7660b0ebadafcae 100755 --- a/indra/llcommon/llpriqueuemap.h +++ b/indra/llcommon/llpriqueuemap.h @@ -84,7 +84,7 @@ class LLPriQueueMap pqm_iter iter = mMap.find(LLPQMKey<DATA_TYPE>(priority, data)); if (iter != mMap.end()) { - llerrs << "Pushing already existing data onto queue!" << llendl; + LL_ERRS() << "Pushing already existing data onto queue!" << LL_ENDL; } #endif mMap.insert(pqm_pair(LLPQMKey<DATA_TYPE>(priority, data), data)); @@ -112,14 +112,14 @@ class LLPriQueueMap iter = mMap.find(cur_key); if (iter == mMap.end()) { - llwarns << "Data not on priority queue!" << llendl; + LL_WARNS() << "Data not on priority queue!" << LL_ENDL; // OK, try iterating through all of the data and seeing if we just screwed up the priority // somehow. for (iter = mMap.begin(); iter != mMap.end(); iter++) { if ((*(iter)).second == data) { - llerrs << "Data on priority queue but priority not matched!" << llendl; + LL_ERRS() << "Data on priority queue but priority not matched!" << LL_ENDL; } } return; diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index d711ce2f743c98c18b1727937710b2e46d622163..43ccadc41278be52dcecb8acdd5a2b646fbee530 100755 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -29,6 +29,7 @@ #include "llinitparam.h" #include "llsdparam.h" +#include "llwin32headerslean.h" #include "apr_thread_proc.h" #include <boost/shared_ptr.hpp> #include <boost/ptr_container/ptr_vector.hpp> @@ -38,8 +39,7 @@ #include <stdexcept> #if LL_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include <windows.h> // HANDLE (eye roll) +#include "llwin32headerslean.h" // for HANDLE #elif LL_LINUX #if defined(Status) #undef Status diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index fd8f603d21c2da349ab812aa4a8fe149333281b5..69043dc1736cecdf18d4127f73df6aea3963df66 100755 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -32,9 +32,7 @@ //#include <memory> #if LL_WINDOWS -# define WIN32_LEAN_AND_MEAN -# include <winsock2.h> -# include <windows.h> +# include "llwin32headerslean.h" # define _interlockedbittestandset _renamed_interlockedbittestandset # define _interlockedbittestandreset _renamed_interlockedbittestandreset # include <intrin.h> @@ -702,7 +700,7 @@ class LLProcessorInfoDarwinImpl : public LLProcessorInfoImpl __cpuid(0x1, eax, ebx, ecx, edx); if(feature_infos[0] != (S32)edx) { - llerrs << "machdep.cpu.feature_bits doesn't match expected cpuid result!" << llendl; + LL_ERRS() << "machdep.cpu.feature_bits doesn't match expected cpuid result!" << LL_ENDL; } #endif // LL_RELEASE_FOR_DOWNLOAD @@ -877,7 +875,7 @@ LLProcessorInfo::LLProcessorInfo() : mImpl(NULL) LLProcessorInfo::~LLProcessorInfo() {} -F64 LLProcessorInfo::getCPUFrequency() const { return mImpl->getCPUFrequency(); } +F64MegahertzImplicit LLProcessorInfo::getCPUFrequency() const { return mImpl->getCPUFrequency(); } bool LLProcessorInfo::hasSSE() const { return mImpl->hasSSE(); } bool LLProcessorInfo::hasSSE2() const { return mImpl->hasSSE2(); } bool LLProcessorInfo::hasAltivec() const { return mImpl->hasAltivec(); } diff --git a/indra/llcommon/llprocessor.h b/indra/llcommon/llprocessor.h index 6364d3c8bb2f46ed95b68d22cb54f5f009d0054b..90e5bc59ee24638243342e814de4a761006f13c1 100755 --- a/indra/llcommon/llprocessor.h +++ b/indra/llcommon/llprocessor.h @@ -27,6 +27,8 @@ #ifndef LLPROCESSOR_H #define LLPROCESSOR_H +#include "llunits.h" + class LLProcessorInfoImpl; class LL_COMMON_API LLProcessorInfo @@ -35,7 +37,7 @@ class LL_COMMON_API LLProcessorInfo LLProcessorInfo(); ~LLProcessorInfo(); - F64 getCPUFrequency() const; + F64MegahertzImplicit getCPUFrequency() const; bool hasSSE() const; bool hasSSE2() const; bool hasAltivec() const; diff --git a/indra/llcommon/llptrskiplist.h b/indra/llcommon/llptrskiplist.h deleted file mode 100755 index 67c7cde3523f420ecad3661bce9bb7fc95ae4066..0000000000000000000000000000000000000000 --- a/indra/llcommon/llptrskiplist.h +++ /dev/null @@ -1,724 +0,0 @@ -/** - * @file llptrskiplist.h - * @brief Skip list implementation. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLPTRSKIPLIST_H -#define LL_LLPTRSKIPLIST_H - -#include "llerror.h" -#include "llrand.h" -//#include "vmath.h" -#include "llrand.h" - -///////////////////////////////////////////// -// -// LLPtrSkipList implementation - skip list for pointers to objects -// - -template <class DATA_TYPE, S32 BINARY_DEPTH = 8> -class LLPtrSkipList -{ -public: - friend class LLPtrSkipNode; - - // basic constructor - LLPtrSkipList(); - // basic constructor including sorter - LLPtrSkipList(BOOL (*insert_first)(DATA_TYPE *first, DATA_TYPE *second), - BOOL (*equals)(DATA_TYPE *first, DATA_TYPE *second)); - ~LLPtrSkipList(); - - inline void setInsertFirst(BOOL (*insert_first)(const DATA_TYPE *first, const DATA_TYPE *second)); - inline void setEquals(BOOL (*equals)(const DATA_TYPE *first, const DATA_TYPE *second)); - - inline BOOL addData(DATA_TYPE *data); - - inline BOOL checkData(const DATA_TYPE *data); - - inline S32 getLength(); // returns number of items in the list - NOT constant time! - - inline BOOL removeData(const DATA_TYPE *data); - - // note that b_sort is ignored - inline BOOL moveData(const DATA_TYPE *data, LLPtrSkipList *newlist, BOOL b_sort); - - inline BOOL moveCurrentData(LLPtrSkipList *newlist, BOOL b_sort); - - // resort -- use when the value we're sorting by changes - /* IW 12/6/02 - This doesn't work! - Instead, remove the data BEFORE you change it - Then re-insert it after you change it - BOOL resortData(DATA_TYPE *data) - */ - - // remove all nodes from the list but do not delete data - inline void removeAllNodes(); - - inline BOOL deleteData(const DATA_TYPE *data); - - // remove all nodes from the list and delete data - inline void deleteAllData(); - - // place mCurrentp on first node - inline void resetList(); - - // return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - inline DATA_TYPE *getCurrentData(); - - // same as getCurrentData() but a more intuitive name for the operation - inline DATA_TYPE *getNextData(); - - // remove the Node at mCurentOperatingp - // leave mCurrentp and mCurentOperatingp on the next entry - inline void removeCurrentData(); - - // delete the Node at mCurentOperatingp - // leave mCurrentp and mCurentOperatingp on the next entry - inline void deleteCurrentData(); - - // reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - inline DATA_TYPE *getFirstData(); - - // TRUE if nodes are not in sorted order - inline BOOL corrupt(); - -protected: - class LLPtrSkipNode - { - public: - LLPtrSkipNode() - : mData(NULL) - { - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mForward[i] = NULL; - } - } - - LLPtrSkipNode(DATA_TYPE *data) - : mData(data) - { - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mForward[i] = NULL; - } - } - - ~LLPtrSkipNode() - { - if (mData) - { - llerror("Attempting to call LLPtrSkipNode destructor with a non-null mDatap!", 1); - } - } - - // delete associated data and NULLs out pointer - void deleteData() - { - delete mData; - mData = NULL; - } - - // NULLs out pointer - void removeData() - { - mData = NULL; - } - - DATA_TYPE *mData; - LLPtrSkipNode *mForward[BINARY_DEPTH]; - }; - - static BOOL defaultEquals(const DATA_TYPE *first, const DATA_TYPE *second) - { - return first == second; - } - - - LLPtrSkipNode mHead; - LLPtrSkipNode *mUpdate[BINARY_DEPTH]; - LLPtrSkipNode *mCurrentp; - LLPtrSkipNode *mCurrentOperatingp; - S32 mLevel; - BOOL (*mInsertFirst)(const DATA_TYPE *first, const DATA_TYPE *second); - BOOL (*mEquals)(const DATA_TYPE *first, const DATA_TYPE *second); -}; - - -// basic constructor -template <class DATA_TYPE, S32 BINARY_DEPTH> -LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::LLPtrSkipList() - : mInsertFirst(NULL), mEquals(defaultEquals) -{ - if (BINARY_DEPTH < 2) - { - llerrs << "Trying to create skip list with too little depth, " - "must be 2 or greater" << llendl; - } - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mUpdate[i] = NULL; - } - mLevel = 1; - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -// basic constructor including sorter -template <class DATA_TYPE, S32 BINARY_DEPTH> -LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::LLPtrSkipList(BOOL (*insert_first)(DATA_TYPE *first, DATA_TYPE *second), - BOOL (*equals)(DATA_TYPE *first, DATA_TYPE *second)) - :mInsertFirst(insert_first), mEquals(equals) -{ - if (BINARY_DEPTH < 2) - { - llerrs << "Trying to create skip list with too little depth, " - "must be 2 or greater" << llendl; - } - mLevel = 1; - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mHead.mForward[i] = NULL; - mUpdate[i] = NULL; - } - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::~LLPtrSkipList() -{ - removeAllNodes(); -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::setInsertFirst(BOOL (*insert_first)(const DATA_TYPE *first, const DATA_TYPE *second)) -{ - mInsertFirst = insert_first; -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::setEquals(BOOL (*equals)(const DATA_TYPE *first, const DATA_TYPE *second)) -{ - mEquals = equals; -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::addData(DATA_TYPE *data) -{ - S32 level; - LLPtrSkipNode *current = &mHead; - LLPtrSkipNode *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mData, data))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mData < data)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - // now add the new node - S32 newlevel; - for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) - { - if (ll_frand() < 0.5f) - break; - } - - LLPtrSkipNode *snode = new LLPtrSkipNode(data); - - if (newlevel > mLevel) - { - mHead.mForward[mLevel] = NULL; - mUpdate[mLevel] = &mHead; - mLevel = newlevel; - } - - for (level = 0; level < newlevel; level++) - { - snode->mForward[level] = mUpdate[level]->mForward[level]; - mUpdate[level]->mForward[level] = snode; - } - return TRUE; -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::checkData(const DATA_TYPE *data) -{ - S32 level; - LLPtrSkipNode *current = &mHead; - LLPtrSkipNode *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mData, data))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mData < data)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - if (current) - { - return mEquals(current->mData, data); - } - else - { - return FALSE; - } -} - -// returns number of items in the list -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline S32 LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::getLength() -{ - U32 length = 0; - for (LLPtrSkipNode* temp = *(mHead.mForward); temp != NULL; temp = temp->mForward[0]) - { - length++; - } - return length; -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::removeData(const DATA_TYPE *data) -{ - S32 level; - LLPtrSkipNode *current = &mHead; - LLPtrSkipNode *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mData, data))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mData < data)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - if (!current) - { - // empty list or beyond the end! - return FALSE; - } - - // is this the one we want? - if (!mEquals(current->mData, data)) - { - // nope! - return FALSE; - } - else - { - // yes it is! change pointers as required - for (level = 0; level < mLevel; level++) - { - if (mUpdate[level]->mForward[level] != current) - { - // cool, we've fixed all the pointers! - break; - } - mUpdate[level]->mForward[level] = current->mForward[level]; - } - - // clean up cuurent - current->removeData(); - delete current; - - // clean up mHead - while ( (mLevel > 1) - &&(!mHead.mForward[mLevel - 1])) - { - mLevel--; - } - } - return TRUE; -} - -// note that b_sort is ignored -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::moveData(const DATA_TYPE *data, LLPtrSkipList *newlist, BOOL b_sort) -{ - BOOL removed = removeData(data); - BOOL added = newlist->addData(data); - return removed && added; -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::moveCurrentData(LLPtrSkipList *newlist, BOOL b_sort) -{ - if (mCurrentOperatingp) - { - mCurrentp = mCurrentOperatingp->mForward[0]; - BOOL removed = removeData(mCurrentOperatingp); - BOOL added = newlist->addData(mCurrentOperatingp); - mCurrentOperatingp = mCurrentp; - return removed && added; - } - return FALSE; -} - -// resort -- use when the value we're sorting by changes -/* IW 12/6/02 - This doesn't work! - Instead, remove the data BEFORE you change it - Then re-insert it after you change it -BOOL resortData(DATA_TYPE *data) -{ - removeData(data); - addData(data); -} -*/ - -// remove all nodes from the list but do not delete data -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::removeAllNodes() -{ - LLPtrSkipNode *temp; - // reset mCurrentp - mCurrentp = *(mHead.mForward); - - while (mCurrentp) - { - temp = mCurrentp->mForward[0]; - mCurrentp->removeData(); - delete mCurrentp; - mCurrentp = temp; - } - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mHead.mForward[i] = NULL; - mUpdate[i] = NULL; - } - - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::deleteData(const DATA_TYPE *data) -{ - S32 level; - LLPtrSkipNode *current = &mHead; - LLPtrSkipNode *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mData, data))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mData < data)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - if (!current) - { - // empty list or beyond the end! - return FALSE; - } - - // is this the one we want? - if (!mEquals(current->mData, data)) - { - // nope! - return FALSE; - } - else - { - // do we need to fix current or currentop? - if (current == mCurrentp) - { - mCurrentp = current->mForward[0]; - } - - if (current == mCurrentOperatingp) - { - mCurrentOperatingp = current->mForward[0]; - } - - // yes it is! change pointers as required - for (level = 0; level < mLevel; level++) - { - if (mUpdate[level]->mForward[level] != current) - { - // cool, we've fixed all the pointers! - break; - } - mUpdate[level]->mForward[level] = current->mForward[level]; - } - - // clean up cuurent - current->deleteData(); - delete current; - - // clean up mHead - while ( (mLevel > 1) - &&(!mHead.mForward[mLevel - 1])) - { - mLevel--; - } - } - return TRUE; -} - -// remove all nodes from the list and delete data -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::deleteAllData() -{ - LLPtrSkipNode *temp; - // reset mCurrentp - mCurrentp = *(mHead.mForward); - - while (mCurrentp) - { - temp = mCurrentp->mForward[0]; - mCurrentp->deleteData(); - delete mCurrentp; - mCurrentp = temp; - } - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mHead.mForward[i] = NULL; - mUpdate[i] = NULL; - } - - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -// place mCurrentp on first node -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::resetList() -{ - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -// return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE *LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::getCurrentData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = *mCurrentp->mForward; - return mCurrentOperatingp->mData; - } - else - { - //return NULL; // causes compile warning - return 0; // equivalent, but no warning - } -} - -// same as getCurrentData() but a more intuitive name for the operation -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE *LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::getNextData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = *mCurrentp->mForward; - return mCurrentOperatingp->mData; - } - else - { - //return NULL; // causes compile warning - return 0; // equivalent, but no warning - } -} - -// remove the Node at mCurentOperatingp -// leave mCurrentp and mCurentOperatingp on the next entry -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::removeCurrentData() -{ - if (mCurrentOperatingp) - { - removeData(mCurrentOperatingp->mData); - } -} - -// delete the Node at mCurentOperatingp -// leave mCurrentp and mCurentOperatingp on the next entry -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::deleteCurrentData() -{ - if (mCurrentOperatingp) - { - deleteData(mCurrentOperatingp->mData); - } -} - -// reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE *LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::getFirstData() -{ - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mData; - } - else - { - //return NULL; // causes compile warning - return 0; // equivalent, but no warning - } -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipList<DATA_TYPE, BINARY_DEPTH>::corrupt() -{ - LLPtrSkipNode *previous = mHead.mForward[0]; - - // Empty lists are not corrupt. - if (!previous) return FALSE; - - LLPtrSkipNode *current = previous->mForward[0]; - while(current) - { - if (!mInsertFirst(previous->mData, current->mData)) - { - // prev shouldn't be in front of cur! - return TRUE; - } - current = current->mForward[0]; - } - return FALSE; -} - -#endif diff --git a/indra/llcommon/llptrskipmap.h b/indra/llcommon/llptrskipmap.h deleted file mode 100755 index 94bc71ec554c3f2693c0d20b3f1cbe83173128e4..0000000000000000000000000000000000000000 --- a/indra/llcommon/llptrskipmap.h +++ /dev/null @@ -1,1239 +0,0 @@ -/** - * @file llptrskipmap.h - * @brief Just like a LLSkipMap, but since it's pointers, you can call - * deleteAllData - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#ifndef LL_LLPTRSKIPMAP_H -#define LL_LLPTRSKIPMAP_H - -#include "llerror.h" -#include "llrand.h" - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH = 8> -class LLPtrSkipMapNode -{ -public: - LLPtrSkipMapNode() - { - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mForward[i] = NULL; - } - - U8 *zero = (U8 *)&mIndex; - - for (i = 0; i < (S32)sizeof(INDEX_T); i++) - { - *(zero + i) = 0; - } - - zero = (U8 *)&mData; - - for (i = 0; i < (S32)sizeof(DATA_T); i++) - { - *(zero + i) = 0; - } - } - - LLPtrSkipMapNode(const INDEX_T &index) - : mIndex(index) - { - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mForward[i] = NULL; - } - - U8 *zero = (U8 *)&mData; - - for (i = 0; i < (S32)sizeof(DATA_T); i++) - { - *(zero + i) = 0; - } - } - - LLPtrSkipMapNode(const INDEX_T &index, DATA_T datap) - : mIndex(index) - { - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mForward[i] = NULL; - } - - mData = datap; - } - - ~LLPtrSkipMapNode() - { - } - - // delete associated data and NULLs out pointer - void deleteData() - { - delete mData; - mData = 0; - } - - // NULLs out pointer - void removeData() - { - mData = 0; - } - - INDEX_T mIndex; - DATA_T mData; - LLPtrSkipMapNode *mForward[BINARY_DEPTH]; - -private: - // Disallow copying of LLPtrSkipMapNodes by not implementing these methods. - LLPtrSkipMapNode(const LLPtrSkipMapNode &); - LLPtrSkipMapNode &operator=(const LLPtrSkipMapNode &rhs); -}; - -//--------------------------------------------------------------------------- - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH = 8> -class LLPtrSkipMap -{ -public: - typedef BOOL (*compare)(const DATA_T& first, const DATA_T& second); - typedef compare insert_func; - typedef compare equals_func; - - void init(); - - // basic constructor - LLPtrSkipMap(); - - // basic constructor including sorter - LLPtrSkipMap(insert_func insert_first, equals_func equals); - - ~LLPtrSkipMap(); - - void setInsertFirst(insert_func insert_first); - void setEquals(equals_func equals); - - DATA_T &addData(const INDEX_T &index, DATA_T datap); - DATA_T &addData(const INDEX_T &index); - DATA_T &getData(const INDEX_T &index); - DATA_T &operator[](const INDEX_T &index); - - // If index present, returns data. - // If index not present, adds <index,NULL> and returns NULL. - DATA_T &getData(const INDEX_T &index, BOOL &b_new_entry); - - // returns data entry before and after index - BOOL getInterval(const INDEX_T &index, INDEX_T &index_before, INDEX_T &index_after, - DATA_T &data_before, DATA_T &data_after ); - - // Returns TRUE if data present in map. - BOOL checkData(const INDEX_T &index); - - // Returns TRUE if key is present in map. This is useful if you - // are potentially storing NULL pointers in the map - BOOL checkKey(const INDEX_T &index); - - // If there, returns the data. - // If not, returns NULL. - // Never adds entries to the map. - DATA_T getIfThere(const INDEX_T &index); - - INDEX_T reverseLookup(const DATA_T datap); - - // returns number of items in the list - S32 getLength(); // WARNING! getLength is O(n), not O(1)! - - BOOL removeData(const INDEX_T &index); - BOOL deleteData(const INDEX_T &index); - - // remove all nodes from the list but do not delete data - void removeAllData(); - void deleteAllData(); - - // place mCurrentp on first node - void resetList(); - - // return the data currently pointed to - DATA_T getCurrentDataWithoutIncrement(); - - // return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - DATA_T getCurrentData(); - - // same as getCurrentData() but a more intuitive name for the operation - DATA_T getNextData(); - - INDEX_T getNextKey(); - - // return the key currently pointed to - INDEX_T getCurrentKeyWithoutIncrement(); - - // remove the Node at mCurentOperatingp - // leave mCurrentp and mCurentOperatingp on the next entry - void removeCurrentData(); - - void deleteCurrentData(); - - // reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - DATA_T getFirstData(); - - INDEX_T getFirstKey(); - - static BOOL defaultEquals(const INDEX_T &first, const INDEX_T &second) - { - return first == second; - } - -private: - // don't generate implicit copy constructor or copy assignment - LLPtrSkipMap(const LLPtrSkipMap &); - LLPtrSkipMap &operator=(const LLPtrSkipMap &); - -private: - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *mUpdate[BINARY_DEPTH]; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *mCurrentp; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *mCurrentOperatingp; - S32 mLevel; - BOOL (*mInsertFirst)(const INDEX_T &first, const INDEX_T &second); - BOOL (*mEquals)(const INDEX_T &first, const INDEX_T &second); - S32 mNumberOfSteps; -}; - -////////////////////////////////////////////////// -// -// LLPtrSkipMap implementation -// -// - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::LLPtrSkipMap() - : mInsertFirst(NULL), - mEquals(defaultEquals), - mNumberOfSteps(0) -{ - if (BINARY_DEPTH < 2) - { - llerrs << "Trying to create skip list with too little depth, " - "must be 2 or greater" << llendl; - } - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mUpdate[i] = NULL; - } - mLevel = 1; - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::LLPtrSkipMap(insert_func insert_first, - equals_func equals) -: mInsertFirst(insert_first), - mEquals(equals), - mNumberOfSteps(0) -{ - if (BINARY_DEPTH < 2) - { - llerrs << "Trying to create skip list with too little depth, " - "must be 2 or greater" << llendl; - } - mLevel = 1; - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mHead.mForward[i] = NULL; - mUpdate[i] = NULL; - } - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::~LLPtrSkipMap() -{ - removeAllData(); -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline void LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::setInsertFirst(insert_func insert_first) -{ - mInsertFirst = insert_first; -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline void LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::setEquals(equals_func equals) -{ - mEquals = equals; -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline DATA_T &LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::addData(const INDEX_T &index, DATA_T datap) -{ - S32 level; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - // replace the existing data if a node is already there - if ( (current) - &&(mEquals(current->mIndex, index))) - { - current->mData = datap; - return current->mData; - } - - // now add the new node - S32 newlevel; - for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) - { - if (ll_frand() < 0.5f) - { - break; - } - } - - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *snode - = new LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH>(index, datap); - - if (newlevel > mLevel) - { - mHead.mForward[mLevel] = NULL; - mUpdate[mLevel] = &mHead; - mLevel = newlevel; - } - - for (level = 0; level < newlevel; level++) - { - snode->mForward[level] = mUpdate[level]->mForward[level]; - mUpdate[level]->mForward[level] = snode; - } - return snode->mData; -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline DATA_T &LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::addData(const INDEX_T &index) -{ - S32 level; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - // now add the new node - S32 newlevel; - for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) - { - if (ll_frand() < 0.5f) - break; - } - - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *snode - = new LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH>(index); - - if (newlevel > mLevel) - { - mHead.mForward[mLevel] = NULL; - mUpdate[mLevel] = &mHead; - mLevel = newlevel; - } - - for (level = 0; level < newlevel; level++) - { - snode->mForward[level] = mUpdate[level]->mForward[level]; - mUpdate[level]->mForward[level] = snode; - } - return snode->mData; -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline DATA_T &LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getData(const INDEX_T &index) -{ - S32 level; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - - mNumberOfSteps = 0; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - mNumberOfSteps++; - - if ( (current) - &&(mEquals(current->mIndex, index))) - { - - return current->mData; - } - - // now add the new node - S32 newlevel; - for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) - { - if (ll_frand() < 0.5f) - break; - } - - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *snode - = new LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH>(index); - - if (newlevel > mLevel) - { - mHead.mForward[mLevel] = NULL; - mUpdate[mLevel] = &mHead; - mLevel = newlevel; - } - - for (level = 0; level < newlevel; level++) - { - snode->mForward[level] = mUpdate[level]->mForward[level]; - mUpdate[level]->mForward[level] = snode; - } - - return snode->mData; -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getInterval(const INDEX_T &index, - INDEX_T &index_before, - INDEX_T &index_after, - DATA_T &data_before, - DATA_T &data_after) -{ - S32 level; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - - mNumberOfSteps = 0; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - - BOOL both_found = TRUE; - - if (current != &mHead) - { - index_before = current->mIndex; - data_before = current->mData; - } - else - { - data_before = 0; - index_before = 0; - both_found = FALSE; - } - - // we're now just in front of where we want to be . . . take one step forward - mNumberOfSteps++; - current = *current->mForward; - - if (current) - { - data_after = current->mData; - index_after = current->mIndex; - } - else - { - data_after = 0; - index_after = 0; - both_found = FALSE; - } - - return both_found; -} - - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline DATA_T &LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::operator[](const INDEX_T &index) -{ - - return getData(index); -} - -// If index present, returns data. -// If index not present, adds <index,NULL> and returns NULL. -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline DATA_T &LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getData(const INDEX_T &index, BOOL &b_new_entry) -{ - S32 level; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - - mNumberOfSteps = 0; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - mNumberOfSteps++; - current = *current->mForward; - - if ( (current) - &&(mEquals(current->mIndex, index))) - { - - return current->mData; - } - b_new_entry = TRUE; - addData(index); - - return current->mData; -} - -// Returns TRUE if data present in map. -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::checkData(const INDEX_T &index) -{ - S32 level; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - if (current) - { - // Gets rid of some compiler ambiguity for the LLPointer<> templated class. - if (current->mData) - { - return mEquals(current->mIndex, index); - } - } - - return FALSE; -} - -// Returns TRUE if key is present in map. This is useful if you -// are potentially storing NULL pointers in the map -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::checkKey(const INDEX_T &index) -{ - S32 level; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - if (current) - { - return mEquals(current->mIndex, index); - } - - return FALSE; -} - -// If there, returns the data. -// If not, returns NULL. -// Never adds entries to the map. -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline DATA_T LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getIfThere(const INDEX_T &index) -{ - S32 level; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - - mNumberOfSteps = 0; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - mNumberOfSteps++; - current = *current->mForward; - - if (current) - { - if (mEquals(current->mIndex, index)) - { - return current->mData; - } - } - - // Avoid Linux compiler warning on returning NULL. - return (DATA_T)0; -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline INDEX_T LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::reverseLookup(const DATA_T datap) -{ - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - - while (current) - { - if (datap == current->mData) - { - - return current->mIndex; - } - current = *current->mForward; - } - - // not found! return NULL - return INDEX_T(); -} - -// returns number of items in the list -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline S32 LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getLength() -{ - U32 length = 0; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH>* temp; - for (temp = *(mHead.mForward); temp != NULL; temp = temp->mForward[0]) - { - length++; - } - - return length; -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::removeData(const INDEX_T &index) -{ - S32 level; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - if (!current) - { - // empty list or beyond the end! - - return FALSE; - } - - // is this the one we want? - if (!mEquals(current->mIndex, index)) - { - // nope! - - return FALSE; - } - else - { - // do we need to fix current or currentop? - if (current == mCurrentp) - { - mCurrentp = *current->mForward; - } - - if (current == mCurrentOperatingp) - { - mCurrentOperatingp = *current->mForward; - } - // yes it is! change pointers as required - for (level = 0; level < mLevel; level++) - { - if (*((*(mUpdate + level))->mForward + level) != current) - { - // cool, we've fixed all the pointers! - break; - } - *((*(mUpdate + level))->mForward + level) = *(current->mForward + level); - } - - // clean up cuurent - current->removeData(); - delete current; - - // clean up mHead - while ( (mLevel > 1) - &&(!*(mHead.mForward + mLevel - 1))) - { - mLevel--; - } - } - - return TRUE; -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline BOOL LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::deleteData(const INDEX_T &index) -{ - S32 level; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *current = &mHead; - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - if (!current) - { - // empty list or beyond the end! - - return FALSE; - } - - // is this the one we want? - if (!mEquals(current->mIndex, index)) - { - // nope! - - return FALSE; - } - else - { - // do we need to fix current or currentop? - if (current == mCurrentp) - { - mCurrentp = *current->mForward; - } - - if (current == mCurrentOperatingp) - { - mCurrentOperatingp = *current->mForward; - } - // yes it is! change pointers as required - for (level = 0; level < mLevel; level++) - { - if (*((*(mUpdate + level))->mForward + level) != current) - { - // cool, we've fixed all the pointers! - break; - } - *((*(mUpdate + level))->mForward + level) = *(current->mForward + level); - } - - // clean up cuurent - current->deleteData(); - delete current; - - // clean up mHead - while ( (mLevel > 1) - &&(!*(mHead.mForward + mLevel - 1))) - { - mLevel--; - } - } - - return TRUE; -} - -// remove all nodes from the list but do not delete data -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -void LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::removeAllData() -{ - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - // reset mCurrentp - mCurrentp = *(mHead.mForward); - - while (mCurrentp) - { - temp = mCurrentp->mForward[0]; - mCurrentp->removeData(); - delete mCurrentp; - mCurrentp = temp; - } - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mHead.mForward[i] = NULL; - mUpdate[i] = NULL; - } - - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline void LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::deleteAllData() -{ - LLPtrSkipMapNode<INDEX_T, DATA_T, BINARY_DEPTH> *temp; - // reset mCurrentp - mCurrentp = *(mHead.mForward); - - while (mCurrentp) - { - temp = mCurrentp->mForward[0]; - mCurrentp->deleteData(); - delete mCurrentp; - mCurrentp = temp; - } - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mHead.mForward[i] = NULL; - mUpdate[i] = NULL; - } - - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -// place mCurrentp on first node -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline void LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::resetList() -{ - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - - -// return the data currently pointed to -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline DATA_T LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getCurrentDataWithoutIncrement() -{ - if (mCurrentOperatingp) - { - return mCurrentOperatingp->mData; - } - else - { - //return NULL; // causes warning - return (DATA_T)0; // equivalent, but no warning - } -} - -// return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline DATA_T LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getCurrentData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mData; - } - else - { - //return NULL; // causes warning - return (DATA_T)0; // equivalent, but no warning - } -} - -// same as getCurrentData() but a more intuitive name for the operation -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline DATA_T LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getNextData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mData; - } - else - { - //return NULL; // causes compile warning - return (DATA_T)0; // equivalent, but removes warning - } -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline INDEX_T LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getNextKey() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mIndex; - } - else - { - return mHead.mIndex; - } -} - -// return the key currently pointed to -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline INDEX_T LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getCurrentKeyWithoutIncrement() -{ - if (mCurrentOperatingp) - { - return mCurrentOperatingp->mIndex; - } - else - { - //return NULL; // causes compile warning - return (INDEX_T)0; // equivalent, but removes warning - } -} - - -// remove the Node at mCurentOperatingp -// leave mCurrentp and mCurentOperatingp on the next entry -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline void LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::removeCurrentData() -{ - if (mCurrentOperatingp) - { - removeData(mCurrentOperatingp->mIndex); - } -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline void LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::deleteCurrentData() -{ - if (mCurrentOperatingp) - { - deleteData(mCurrentOperatingp->mIndex); - } -} - -// reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline DATA_T LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getFirstData() -{ - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mData; - } - else - { - //return NULL; // causes compile warning - return (DATA_T)0; // equivalent, but removes warning - } -} - -template <class INDEX_T, class DATA_T, S32 BINARY_DEPTH> -inline INDEX_T LLPtrSkipMap<INDEX_T, DATA_T, BINARY_DEPTH>::getFirstKey() -{ - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mIndex; - } - else - { - return mHead.mIndex; - } -} - -#endif diff --git a/indra/llcommon/llptrto.h b/indra/llcommon/llptrto.h index 7091d36f6b094a7a4e3f2995c1fa1f6e48b14b95..4082e30de670bebdb422074b5b6f45f72847c7c8 100755 --- a/indra/llcommon/llptrto.h +++ b/indra/llcommon/llptrto.h @@ -33,7 +33,6 @@ #include "llpointer.h" #include "llrefcount.h" // LLRefCount -#include "llthread.h" // LLThreadSafeRefCount #include <boost/type_traits/is_base_of.hpp> #include <boost/type_traits/remove_pointer.hpp> #include <boost/utility/enable_if.hpp> diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index abf47a0f57239b204459f9fa51fea631e81b1f21..8cef4293cd7cdb4ec204a6ad59e8ba37cf4fe6a1 100755 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -28,6 +28,7 @@ #include "llstl.h" #include "lltimer.h" // ms_sleep() +#include "lltracethreadrecorder.h" //============================================================================ @@ -80,7 +81,7 @@ void LLQueuedThread::shutdown() } if (timeout == 0) { - llwarns << "~LLQueuedThread (" << mName << ") timed out!" << llendl; + LL_WARNS() << "~LLQueuedThread (" << mName << ") timed out!" << LL_ENDL; } } else @@ -101,7 +102,7 @@ void LLQueuedThread::shutdown() } if (active_count) { - llwarns << "~LLQueuedThread() called with active requests: " << active_count << llendl; + LL_WARNS() << "~LLQueuedThread() called with active requests: " << active_count << LL_ENDL; } } @@ -134,8 +135,8 @@ S32 LLQueuedThread::updateQueue(F32 max_time_ms) pending = getPending(); if(pending > 0) { - unpause(); - } + unpause(); + } } else { @@ -198,11 +199,11 @@ void LLQueuedThread::printQueueStats() if (!mRequestQueue.empty()) { QueuedRequest *req = *mRequestQueue.begin(); - llinfos << llformat("Pending Requests:%d Current status:%d", mRequestQueue.size(), req->getStatus()) << llendl; + LL_INFOS() << llformat("Pending Requests:%d Current status:%d", mRequestQueue.size(), req->getStatus()) << LL_ENDL; } else { - llinfos << "Queued Thread Idle" << llendl; + LL_INFOS() << "Queued Thread Idle" << LL_ENDL; } unlockData(); } @@ -233,7 +234,7 @@ bool LLQueuedThread::addRequest(QueuedRequest* req) mRequestQueue.insert(req); mRequestHash.insert(req); #if _DEBUG -// llinfos << llformat("LLQueuedThread::Added req [%08d]",handle) << llendl; +// LL_INFOS() << llformat("LLQueuedThread::Added req [%08d]",handle) << LL_ENDL; #endif unlockData(); @@ -245,7 +246,7 @@ bool LLQueuedThread::addRequest(QueuedRequest* req) // MAIN thread bool LLQueuedThread::waitForResult(LLQueuedThread::handle_t handle, bool auto_complete) { - llassert (handle != nullHandle()) + llassert (handle != nullHandle()); bool res = false; bool waspaused = isPaused(); bool done = false; @@ -364,7 +365,7 @@ bool LLQueuedThread::completeRequest(handle_t handle) llassert_always(req->getStatus() != STATUS_QUEUED); llassert_always(req->getStatus() != STATUS_INPROGRESS); #if _DEBUG -// llinfos << llformat("LLQueuedThread::Completed req [%08d]",handle) << llendl; +// LL_INFOS() << llformat("LLQueuedThread::Completed req [%08d]",handle) << LL_ENDL; #endif mRequestHash.erase(handle); req->deleteRequest(); @@ -385,7 +386,7 @@ bool LLQueuedThread::check() { if (entry->getHashKey() > mNextHandle) { - llerrs << "Hash Error" << llendl; + LL_ERRS() << "Hash Error" << LL_ENDL; return false; } entry = entry->getNextEntry(); @@ -403,6 +404,7 @@ S32 LLQueuedThread::processNextRequest() QueuedRequest *req; // Get next request from pool lockData(); + while(1) { req = NULL; @@ -467,10 +469,11 @@ S32 LLQueuedThread::processNextRequest() ms_sleep(1); // sleep the thread a little } } + + LLTrace::get_thread_recorder()->pushToParent(); } S32 pending = getPending(); - return pending; } @@ -499,6 +502,7 @@ void LLQueuedThread::run() if (isQuitting()) { + LLTrace::get_thread_recorder()->pushToParent(); endThread(); break; } @@ -507,15 +511,16 @@ void LLQueuedThread::run() threadedUpdate(); - int res = processNextRequest(); - if (res == 0) + int pending_work = processNextRequest(); + + if (pending_work == 0) { mIdleThread = TRUE; ms_sleep(1); } //LLThread::yield(); // thread should yield after each request } - llinfos << "LLQueuedThread " << mName << " EXITING." << llendl; + LL_INFOS() << "LLQueuedThread " << mName << " EXITING." << LL_ENDL; } // virtual diff --git a/indra/llcommon/llrefcount.cpp b/indra/llcommon/llrefcount.cpp index e1876599fccbc6a3154c5d1da5c7caf38ceda3ef..a638df2c7ccd5dfb29d5cc31f36b704d741025c4 100755 --- a/indra/llcommon/llrefcount.cpp +++ b/indra/llcommon/llrefcount.cpp @@ -76,7 +76,7 @@ LLRefCount::~LLRefCount() { if (mRef != 0) { - llerrs << "deleting non-zero reference" << llendl; + LL_ERRS() << "deleting non-zero reference" << LL_ENDL; } #if LL_REF_COUNT_DEBUG @@ -95,8 +95,8 @@ void LLRefCount::ref() const if(mMutexp->isLocked()) { mCrashAtUnlock = TRUE ; - llerrs << "the mutex is locked by the thread: " << mLockedThreadID - << " Current thread: " << LLThread::currentID() << llendl ; + LL_ERRS() << "the mutex is locked by the thread: " << mLockedThreadID + << " Current thread: " << LLThread::currentID() << LL_ENDL ; } mMutexp->lock() ; @@ -123,8 +123,8 @@ S32 LLRefCount::unref() const if(mMutexp->isLocked()) { mCrashAtUnlock = TRUE ; - llerrs << "the mutex is locked by the thread: " << mLockedThreadID - << " Current thread: " << LLThread::currentID() << llendl ; + LL_ERRS() << "the mutex is locked by the thread: " << mLockedThreadID + << " Current thread: " << LLThread::currentID() << LL_ENDL ; } mMutexp->lock() ; diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h index 32ae15435a89e349a4605f0d943ef44f4b5a8cf8..72011d04a0b350e107a5fd223ddb1a8752405041 100755 --- a/indra/llcommon/llrefcount.h +++ b/indra/llcommon/llrefcount.h @@ -28,6 +28,8 @@ #include <boost/noncopyable.hpp> #include <boost/intrusive_ptr.hpp> +#include "llmutex.h" +#include "llapr.h" #define LL_REF_COUNT_DEBUG 0 #if LL_REF_COUNT_DEBUG @@ -61,7 +63,7 @@ class LL_COMMON_API LLRefCount inline S32 unref() const { llassert(mRef >= 1); - if (0 == --mRef) + if (0 == --mRef) { delete this; return 0; @@ -87,22 +89,91 @@ class LL_COMMON_API LLRefCount #endif }; + +//============================================================================ + +// see llmemory.h for LLPointer<> definition + +class LL_COMMON_API LLThreadSafeRefCount +{ +public: + static void initThreadSafeRefCount(); // creates sMutex + static void cleanupThreadSafeRefCount(); // destroys sMutex + +private: + static LLMutex* sMutex; + +protected: + virtual ~LLThreadSafeRefCount(); // use unref() + +public: + LLThreadSafeRefCount(); + LLThreadSafeRefCount(const LLThreadSafeRefCount&); + LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref) + { + mRef = 0; + return *this; + } + + void ref() + { + mRef++; + } + + void unref() + { + llassert(mRef >= 1); + if ((--mRef) == 0) // See note in llapr.h on atomic decrement operator return value. + { + // If we hit zero, the caller should be the only smart pointer owning the object and we can delete it. + // It is technically possible for a vanilla pointer to mess this up, or another thread to + // jump in, find this object, create another smart pointer and end up dangling, but if + // the code is that bad and not thread-safe, it's trouble already. + delete this; + } + } + + S32 getNumRefs() const + { + const S32 currentVal = mRef.CurrentValue(); + return currentVal; + } + +private: + LLAtomic32< S32 > mRef; +}; + /** * intrusive pointer support * this allows you to use boost::intrusive_ptr with any LLRefCount-derived type */ +/** + * intrusive pointer support for LLThreadSafeRefCount + * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type + */ namespace boost { - inline void intrusive_ptr_add_ref(LLRefCount* p) + inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p) { p->ref(); } - inline void intrusive_ptr_release(LLRefCount* p) + inline void intrusive_ptr_release(LLThreadSafeRefCount* p) { - p->unref(); + p->unref(); + } + + inline void intrusive_ptr_add_ref(LLRefCount* p) + { + p->ref(); + } + + inline void intrusive_ptr_release(LLRefCount* p) + { + p->unref(); } }; + #endif diff --git a/indra/llcommon/llregistry.h b/indra/llcommon/llregistry.h index bb0d60247e2c1ad63ada25668b5fd1385a1e2fdc..29950c108dbe104a54f5eb42e41583e25cb8787e 100755 --- a/indra/llcommon/llregistry.h +++ b/indra/llcommon/llregistry.h @@ -29,7 +29,6 @@ #include <list> -#include <boost/type_traits.hpp> #include "llsingleton.h" #include "llstl.h" @@ -47,12 +46,11 @@ template <typename KEY, typename VALUE, typename COMPARATOR = LLRegistryDefaultC class LLRegistry { public: - typedef LLRegistry<KEY, VALUE, COMPARATOR> registry_t; - typedef typename boost::add_reference<typename boost::add_const<KEY>::type>::type ref_const_key_t; - typedef typename boost::add_reference<typename boost::add_const<VALUE>::type>::type ref_const_value_t; - typedef typename boost::add_reference<VALUE>::type ref_value_t; - typedef typename boost::add_pointer<typename boost::add_const<VALUE>::type>::type ptr_const_value_t; - typedef typename boost::add_pointer<VALUE>::type ptr_value_t; + typedef LLRegistry<KEY, VALUE, COMPARATOR> registry_t; + typedef const KEY& ref_const_key_t; + typedef const VALUE& ref_const_value_t; + typedef const VALUE* ptr_const_value_t; + typedef VALUE* ptr_value_t; class Registrar { @@ -64,7 +62,7 @@ class LLRegistry { if (mMap.insert(std::make_pair(key, value)).second == false) { - llwarns << "Tried to register " << key << " but it was already registered!" << llendl; + LL_WARNS() << "Tried to register " << key << " but it was already registered!" << LL_ENDL; return false; } return true; @@ -309,7 +307,7 @@ class LLRegistrySingleton { if (singleton_t::instance().exists(key)) { - llerrs << "Duplicate registry entry under key \"" << key << "\"" << llendl; + LL_ERRS() << "Duplicate registry entry under key \"" << key << "\"" << LL_ENDL; } singleton_t::instance().mStaticScope->add(key, value); } diff --git a/indra/llcommon/llsafehandle.h b/indra/llcommon/llsafehandle.h index 8d52d9bb15925813f8fb7b0fea772bdd5c4a798f..4226bf04f0610d5f7b51d7455b09edc158a38ef8 100755 --- a/indra/llcommon/llsafehandle.h +++ b/indra/llcommon/llsafehandle.h @@ -134,7 +134,7 @@ class LLSafeHandle tempp->unref(); if (mPointer != NULL) { - llwarns << "Unreference did assignment to non-NULL because of destructor" << llendl; + LL_WARNS() << "Unreference did assignment to non-NULL because of destructor" << LL_ENDL; unref(); } } diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp index 9f4460a988c20a25a808ee052f466f36b15ae3cd..2e7b46f8858694867d6e3ca0ba142a23b9b32d03 100755 --- a/indra/llcommon/llsdparam.cpp +++ b/indra/llcommon/llsdparam.cpp @@ -30,13 +30,14 @@ // Project includes #include "llsdparam.h" #include "llsdutil.h" +#include "boost/bind.hpp" static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; static LLInitParam::Parser::parser_inspect_func_map_t sInspectFuncs; static const LLSD NO_VALUE_MARKER; -LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR("LLSD to LLInitParam conversion"); +LLTrace::BlockTimerStatHandle FTM_SD_PARAM_ADAPTOR("LLSD to LLInitParam conversion"); // // LLParamSDParser @@ -102,13 +103,13 @@ void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool //readSDValues(sd, block); } -void LLParamSDParser::writeSD(LLSD& sd, const LLInitParam::BaseBlock& block) +void LLParamSDParser::writeSDImpl(LLSD& sd, const LLInitParam::BaseBlock& block, const LLInitParam::predicate_rule_t rules, const LLInitParam::BaseBlock* diff_block) { mNameStack.clear(); mWriteRootSD = &sd; name_stack_t name_stack; - block.serializeBlock(*this, name_stack); + block.serializeBlock(*this, name_stack, rules, diff_block); } /*virtual*/ std::string LLParamSDParser::getCurrentElementName() @@ -299,6 +300,7 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd) LLInitParam::Parser::name_stack_t stack = LLInitParam::Parser::name_stack_t(); readSDValues(cb, sd, stack); } + namespace LLInitParam { // LLSD specialization @@ -329,13 +331,14 @@ namespace LLInitParam p.writeValue<LLSD::String>(sd.asString(), name_stack); } - void ParamValue<LLSD, NOT_BLOCK>::serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block) const + bool ParamValue<LLSD, NOT_BLOCK>::serializeBlock(Parser& p, Parser::name_stack_t& name_stack_range, const predicate_rule_t predicate_rule, const BaseBlock* diff_block) const { // attempt to write LLSD out directly - if (!p.writeValue<LLSD>(mValue, name_stack)) + if (!p.writeValue<LLSD>(mValue, name_stack_range)) { // otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) - LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack); + LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack_range); } + return true; } } diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h index 6ef5debd7b74eddf82a4d961e5491faab62f7758..1542f95e6845f032fe61178fba074aa9280a7b07 100755 --- a/indra/llcommon/llsdparam.h +++ b/indra/llcommon/llsdparam.h @@ -30,6 +30,7 @@ #include "llinitparam.h" #include "boost/function.hpp" +#include "llfasttimer.h" struct LL_COMMON_API LLParamSDParserUtilities { @@ -50,11 +51,28 @@ typedef LLInitParam::Parser parser_t; public: LLParamSDParser(); void readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent = false); - void writeSD(LLSD& sd, const LLInitParam::BaseBlock& block); + template<typename BLOCK> + void writeSD(LLSD& sd, + const BLOCK& block, + const LLInitParam::predicate_rule_t rules = LLInitParam::default_parse_rules(), + const LLInitParam::BaseBlock* diff_block = NULL) + { + if (!diff_block + && !rules.isAmbivalent(LLInitParam::HAS_DEFAULT_VALUE)) + { + diff_block = &LLInitParam::defaultValue<BLOCK>(); + } + writeSDImpl(sd, block, rules, diff_block); + } /*virtual*/ std::string getCurrentElementName(); private: + void writeSDImpl(LLSD& sd, + const LLInitParam::BaseBlock& block, + const LLInitParam::predicate_rule_t, + const LLInitParam::BaseBlock* diff_block); + void submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLInitParam::Parser::name_stack_t& name_stack); template<typename T> @@ -92,7 +110,7 @@ typedef LLInitParam::Parser parser_t; }; -extern LL_COMMON_API LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR; +extern LL_COMMON_API LLTrace::BlockTimerStatHandle FTM_SD_PARAM_ADAPTOR; template<typename T> class LLSDParamAdapter : public T { @@ -100,7 +118,7 @@ class LLSDParamAdapter : public T LLSDParamAdapter() {} LLSDParamAdapter(const LLSD& sd) { - LLFastTimer _(FTM_SD_PARAM_ADAPTOR); + LL_RECORD_BLOCK_TIME(FTM_SD_PARAM_ADAPTOR); LLParamSDParser parser; // don't spam for implicit parsing of LLSD, as we want to allow arbitrary freeform data and ignore most of it bool parse_silently = true; diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index ad4fce6f359b8dbb6277402ed615394c98de118a..04d7a6ed5674eb89cb648eac53838b2111f58e8d 100755 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -81,7 +81,7 @@ void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize break; default: - llwarns << "serialize request for unknown ELLSD_Serialize" << llendl; + LL_WARNS() << "serialize request for unknown ELLSD_Serialize" << LL_ENDL; } if (f.notNull()) @@ -169,7 +169,7 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes) } else { - llwarns << "deserialize request for unknown ELLSD_Serialize" << llendl; + LL_WARNS() << "deserialize request for unknown ELLSD_Serialize" << LL_ENDL; } if (p.notNull()) @@ -179,7 +179,7 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes) } fail: - llwarns << "deserialize LLSD parse failure" << llendl; + LL_WARNS() << "deserialize LLSD parse failure" << LL_ENDL; return false; } @@ -445,7 +445,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading map." << llendl; + LL_INFOS() << "STREAM FAILURE reading map." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -464,7 +464,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading array." << llendl; + LL_INFOS() << "STREAM FAILURE reading array." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -500,7 +500,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading boolean." << llendl; + LL_INFOS() << "STREAM FAILURE reading boolean." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -526,7 +526,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading boolean." << llendl; + LL_INFOS() << "STREAM FAILURE reading boolean." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -539,7 +539,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const data = integer; if(istr.fail()) { - llinfos << "STREAM FAILURE reading integer." << llendl; + LL_INFOS() << "STREAM FAILURE reading integer." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -553,7 +553,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const data = real; if(istr.fail()) { - llinfos << "STREAM FAILURE reading real." << llendl; + LL_INFOS() << "STREAM FAILURE reading real." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -567,7 +567,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const data = id; if(istr.fail()) { - llinfos << "STREAM FAILURE reading uuid." << llendl; + LL_INFOS() << "STREAM FAILURE reading uuid." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -582,7 +582,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading string." << llendl; + LL_INFOS() << "STREAM FAILURE reading string." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -604,7 +604,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading link." << llendl; + LL_INFOS() << "STREAM FAILURE reading link." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -627,7 +627,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading date." << llendl; + LL_INFOS() << "STREAM FAILURE reading date." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -640,15 +640,15 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading data." << llendl; + LL_INFOS() << "STREAM FAILURE reading data." << LL_ENDL; parse_count = PARSE_FAILURE; } break; default: parse_count = PARSE_FAILURE; - llinfos << "Unrecognized character while parsing: int(" << (int)c - << ")" << llendl; + LL_INFOS() << "Unrecognized character while parsing: int(" << (int)c + << ")" << LL_ENDL; break; } if(PARSE_FAILURE == parse_count) @@ -909,7 +909,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading binary map." << llendl; + LL_INFOS() << "STREAM FAILURE reading binary map." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -928,7 +928,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading binary array." << llendl; + LL_INFOS() << "STREAM FAILURE reading binary array." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -953,7 +953,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const data = (S32)ntohl(value_nbo); if(istr.fail()) { - llinfos << "STREAM FAILURE reading binary integer." << llendl; + LL_INFOS() << "STREAM FAILURE reading binary integer." << LL_ENDL; } break; } @@ -965,7 +965,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const data = ll_ntohd(real_nbo); if(istr.fail()) { - llinfos << "STREAM FAILURE reading binary real." << llendl; + LL_INFOS() << "STREAM FAILURE reading binary real." << LL_ENDL; } break; } @@ -977,7 +977,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const data = id; if(istr.fail()) { - llinfos << "STREAM FAILURE reading binary uuid." << llendl; + LL_INFOS() << "STREAM FAILURE reading binary uuid." << LL_ENDL; } break; } @@ -998,8 +998,8 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading binary (notation-style) string." - << llendl; + LL_INFOS() << "STREAM FAILURE reading binary (notation-style) string." + << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -1018,7 +1018,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading binary string." << llendl; + LL_INFOS() << "STREAM FAILURE reading binary string." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -1037,7 +1037,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading binary link." << llendl; + LL_INFOS() << "STREAM FAILURE reading binary link." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -1050,7 +1050,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const data = LLDate(real); if(istr.fail()) { - llinfos << "STREAM FAILURE reading binary date." << llendl; + LL_INFOS() << "STREAM FAILURE reading binary date." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -1079,7 +1079,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const } if(istr.fail()) { - llinfos << "STREAM FAILURE reading binary." << llendl; + LL_INFOS() << "STREAM FAILURE reading binary." << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -1087,8 +1087,8 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const default: parse_count = PARSE_FAILURE; - llinfos << "Unrecognized character while parsing: int(" << (int)c - << ")" << llendl; + LL_INFOS() << "Unrecognized character while parsing: int(" << (int)c + << ")" << LL_ENDL; break; } if(PARSE_FAILURE == parse_count) @@ -2017,7 +2017,7 @@ std::string zip_llsd(LLSD& data) S32 ret = deflateInit(&strm, Z_BEST_COMPRESSION); if (ret != Z_OK) { - llwarns << "Failed to compress LLSD block." << llendl; + LL_WARNS() << "Failed to compress LLSD block." << LL_ENDL; return std::string(); } @@ -2044,7 +2044,7 @@ std::string zip_llsd(LLSD& data) if (strm.avail_out >= CHUNK) { free(output); - llwarns << "Failed to compress LLSD block." << llendl; + LL_WARNS() << "Failed to compress LLSD block." << LL_ENDL; return std::string(); } @@ -2056,7 +2056,7 @@ std::string zip_llsd(LLSD& data) else { free(output); - llwarns << "Failed to compress LLSD block." << llendl; + LL_WARNS() << "Failed to compress LLSD block." << LL_ENDL; return std::string(); } } @@ -2073,7 +2073,7 @@ std::string zip_llsd(LLSD& data) LLSD test_sd; if (!unzip_llsd(test_sd, test, result.size())) { - llerrs << "Invalid compression result!" << llendl; + LL_ERRS() << "Invalid compression result!" << LL_ENDL; } #endif @@ -2163,7 +2163,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) if (!LLSDSerialize::fromBinary(data, istr, cur_size)) { - llwarns << "Failed to unzip LLSD block" << llendl; + LL_WARNS() << "Failed to unzip LLSD block" << LL_ENDL; free(result); return false; } diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index 614a2d563656693ec5950a13b5968faa30a80c23..4e2af0e5890ec181a167018ae24098800fa3f49e 100755 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -406,7 +406,7 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) } if (mEmitErrors) { - llinfos << "LLSDXMLParser::Impl::parse: XML_STATUS_ERROR parsing:" << (char*) buffer << llendl; + LL_INFOS() << "LLSDXMLParser::Impl::parse: XML_STATUS_ERROR parsing:" << (char*) buffer << LL_ENDL; } data = LLSD(); return LLSDParser::PARSE_FAILURE; @@ -487,7 +487,7 @@ S32 LLSDXMLParser::Impl::parseLines(std::istream& input, LLSD& data) { if (mEmitErrors) { - llinfos << "LLSDXMLParser::Impl::parseLines: XML_STATUS_ERROR" << llendl; + LL_INFOS() << "LLSDXMLParser::Impl::parseLines: XML_STATUS_ERROR" << LL_ENDL; } return LLSDParser::PARSE_FAILURE; } @@ -549,7 +549,7 @@ void LLSDXMLParser::Impl::parsePart(const char* buf, int len) XML_Status status = XML_Parse(mParser, buf, len, false); if (status == XML_STATUS_ERROR) { - llinfos << "Unexpected XML parsing error at start" << llendl; + LL_INFOS() << "Unexpected XML parsing error at start" << LL_ENDL; } } } diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index 532d3f934139c5542617d163204d5727e47464aa..d0b536c39af64bf68379b7748ece61c6a6cfc164 100755 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -29,7 +29,7 @@ #ifndef LL_LLSDUTIL_H #define LL_LLSDUTIL_H -class LLSD; +#include "llsd.h" // U32 LL_COMMON_API LLSD ll_sd_from_U32(const U32); diff --git a/indra/llcommon/llsecondlifeurls.cpp b/indra/llcommon/llsecondlifeurls.cpp deleted file mode 100755 index 9154e05e4310d7f8e4997ef0c20e1e86cdf50737..0000000000000000000000000000000000000000 --- a/indra/llcommon/llsecondlifeurls.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @file llsecondlifeurls.cpp - * @brief Urls used in the product - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" -#include "llsecondlifeurls.h" -/* -const std::string CREATE_ACCOUNT_URL ( - "http://join.secondlife.com/"); - -const std::string MANAGE_ACCOUNT ( - "http://secondlife.com/account/"); // *TODO: NOT USED - -const std::string AUCTION_URL ( - "http://secondlife.com/auctions/auction-detail.php?id="); - -const std::string EVENTS_URL ( - "http://secondlife.com/events/"); -*/ -const std::string TIER_UP_URL ( - "http://secondlife.com/app/landtier"); // *TODO: Translate (simulator) - -const std::string DIRECTX_9_URL ( - "http://secondlife.com/support/"); // *TODO: NOT USED -/* -const std::string LAND_URL ( - "http://secondlife.com/app/landtier"); // *TODO: NOT USED - -const std::string UPGRADE_TO_PREMIUM_URL ( - "http://secondlife.com/app/upgrade/"); // *TODO: NOT USED - -const std::string AMD_AGP_URL ( - "http://secondlife.com/support/"); // *TODO: NOT USED - -const std::string VIA_URL ( - "http://secondlife.com/support/"); // *TODO: NOT USED - -const std::string SUPPORT_URL ( - "http://secondlife.com/support/"); - -const std::string INTEL_CHIPSET_URL ( - "http://secondlife.com/support/"); // *TODO: NOT USED - -const std::string SIS_CHIPSET_URL ( - "http://secondlife.com/support/"); // *TODO: NOT USED - -const std::string BLOGS_URL ( - "http://blog.secondlife.com/"); // *TODO: NOT USED - -const std::string BUY_CURRENCY_URL ( - "http://secondlife.com/app/currency/"); - -const std::string LSL_DOC_URL ( - "http://secondlife.com/app/lsldoc/"); // *TODO: NOT USED - -const std::string SL_KB_URL ( - "http://secondlife.com/knowledgebase/"); // *TODO: NOT USED - -const std::string RELEASE_NOTES_BASE_URL ( - "http://secondlife.com/app/releasenotes/"); -*/ - diff --git a/indra/llcommon/llsecondlifeurls.h b/indra/llcommon/llsecondlifeurls.h deleted file mode 100755 index 62f357ffed2ece1a381c09123876efcb554b45f4..0000000000000000000000000000000000000000 --- a/indra/llcommon/llsecondlifeurls.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @file llsecondlifeurls.h - * @brief Global URLs to pages on our web site - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLSECONDLIFEURLS_H -#define LL_LLSECONDLIFEURLS_H -/* -// Account registration web page -LL_COMMON_API extern const std::string CREATE_ACCOUNT_URL; - -// Manage Account -LL_COMMON_API extern const std::string MANAGE_ACCOUNT; - -LL_COMMON_API extern const std::string AUCTION_URL; - -LL_COMMON_API extern const std::string EVENTS_URL; -*/ -// Tier up to a new land level. -LL_COMMON_API extern const std::string TIER_UP_URL; - - -// Tier up to a new land level. -LL_COMMON_API extern const std::string LAND_URL; - -// How to get DirectX 9 -LL_COMMON_API extern const std::string DIRECTX_9_URL; - -/* -// Upgrade from basic membership to premium membership -LL_COMMON_API extern const std::string UPGRADE_TO_PREMIUM_URL; - - -// Out of date VIA chipset -LL_COMMON_API extern const std::string VIA_URL; - -// Support URL -LL_COMMON_API extern const std::string SUPPORT_URL; - -// Linden Blogs page -LL_COMMON_API extern const std::string BLOGS_URL; - -// Currency page -LL_COMMON_API extern const std::string BUY_CURRENCY_URL; - -// LSL script wiki -LL_COMMON_API extern const std::string LSL_DOC_URL; - -// SL KnowledgeBase page -LL_COMMON_API extern const std::string SL_KB_URL; - -// Release Notes Redirect URL for Server and Viewer -LL_COMMON_API extern const std::string RELEASE_NOTES_BASE_URL; -*/ -#endif diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 40002313f186720e3c5f6ca85888f190d5e9a2f7..6e6291a1653c97ac014a4913b937747898697542 100755 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -67,6 +67,11 @@ class LLSingleton : private boost::noncopyable INITIALIZED, DELETED } EInitState; + + static DERIVED_TYPE* constructSingleton() + { + return new DERIVED_TYPE(); + } // stores pointer to singleton instance struct SingletonLifetimeManager @@ -79,7 +84,7 @@ class LLSingleton : private boost::noncopyable static void construct() { sData.mInitState = CONSTRUCTING; - sData.mInstance = new DERIVED_TYPE(); + sData.mInstance = constructSingleton(); sData.mInitState = INITIALIZING; } @@ -138,18 +143,21 @@ class LLSingleton : private boost::noncopyable llassert(false); return NULL; case CONSTRUCTING: - llerrs << "Tried to access singleton " << typeid(DERIVED_TYPE).name() << " from singleton constructor!" << llendl; + LL_ERRS() << "Tried to access singleton " << typeid(DERIVED_TYPE).name() << " from singleton constructor!" << LL_ENDL; return NULL; case INITIALIZING: // go ahead and flag ourselves as initialized so we can be reentrant during initialization sData.mInitState = INITIALIZED; + // initialize singleton after constructing it so that it can reference other singletons which in turn depend on it, + // thus breaking cyclic dependencies sData.mInstance->initSingleton(); return sData.mInstance; case INITIALIZED: return sData.mInstance; case DELETED: - llwarns << "Trying to access deleted singleton " << typeid(DERIVED_TYPE).name() << " creating new instance" << llendl; + LL_WARNS() << "Trying to access deleted singleton " << typeid(DERIVED_TYPE).name() << " creating new instance" << LL_ENDL; SingletonLifetimeManager::construct(); + // same as first time construction sData.mInitState = INITIALIZED; sData.mInstance->initSingleton(); return sData.mInstance; @@ -190,6 +198,8 @@ class LLSingleton : private boost::noncopyable struct SingletonData { + // explicitly has a default constructor so that member variables are zero initialized in BSS + // and only changed by singleton logic, not constructor running during startup EInitState mInitState; DERIVED_TYPE* mInstance; }; diff --git a/indra/llcommon/llskiplist.h b/indra/llcommon/llskiplist.h deleted file mode 100755 index ed132381f96b70166e4341f433d864b035450fa7..0000000000000000000000000000000000000000 --- a/indra/llcommon/llskiplist.h +++ /dev/null @@ -1,517 +0,0 @@ -/** - * @file llskiplist.h - * @brief skip list implementation - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#ifndef LL_LLSKIPLIST_H -#define LL_LLSKIPLIST_H - -#include "llrand.h" -#include "llrand.h" - -// NOTA BENE: Insert first needs to be < NOT <= -// Binary depth must be >= 2 -template <class DATA_TYPE, S32 BINARY_DEPTH = 10> -class LLSkipList -{ -public: - typedef BOOL (*compare)(const DATA_TYPE& first, const DATA_TYPE& second); - typedef compare insert_func; - typedef compare equals_func; - - void init(); - - // basic constructor - LLSkipList(); - - // basic constructor including sorter - LLSkipList(insert_func insert_first, equals_func equals); - ~LLSkipList(); - - inline void setInsertFirst(insert_func insert_first); - inline void setEquals(equals_func equals); - - inline BOOL addData(const DATA_TYPE& data); - inline BOOL checkData(const DATA_TYPE& data); - - // returns number of items in the list - inline S32 getLength() const; // NOT a constant time operation, traverses entire list! - - inline BOOL moveData(const DATA_TYPE& data, LLSkipList *newlist); - - inline BOOL removeData(const DATA_TYPE& data); - - // remove all nodes from the list but do not delete data - inline void removeAllNodes(); - - // place mCurrentp on first node - inline void resetList(); - - // return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - inline DATA_TYPE getCurrentData(); - - // same as getCurrentData() but a more intuitive name for the operation - inline DATA_TYPE getNextData(); - - // remove the Node at mCurentOperatingp - // leave mCurrentp and mCurentOperatingp on the next entry - inline void removeCurrentData(); - - // reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - inline DATA_TYPE getFirstData(); - - class LLSkipNode - { - public: - LLSkipNode() - : mData(0) - { - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mForward[i] = NULL; - } - } - - LLSkipNode(DATA_TYPE data) - : mData(data) - { - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mForward[i] = NULL; - } - } - - ~LLSkipNode() - { - } - - DATA_TYPE mData; - LLSkipNode *mForward[BINARY_DEPTH]; - - private: - // Disallow copying of LLSkipNodes by not implementing these methods. - LLSkipNode(const LLSkipNode &); - LLSkipNode &operator=(const LLSkipNode &); - }; - - static BOOL defaultEquals(const DATA_TYPE& first, const DATA_TYPE& second) - { - return first == second; - } - -private: - LLSkipNode mHead; - LLSkipNode *mUpdate[BINARY_DEPTH]; - LLSkipNode *mCurrentp; - LLSkipNode *mCurrentOperatingp; - S32 mLevel; - insert_func mInsertFirst; - equals_func mEquals; - -private: - // Disallow copying of LLSkipNodes by not implementing these methods. - LLSkipList(const LLSkipList &); - LLSkipList &operator=(const LLSkipList &); -}; - - -/////////////////////// -// -// Implementation -// - - -// Binary depth must be >= 2 -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipList<DATA_TYPE, BINARY_DEPTH>::init() -{ - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mHead.mForward[i] = NULL; - mUpdate[i] = NULL; - } - mLevel = 1; - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - - -// basic constructor -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline LLSkipList<DATA_TYPE, BINARY_DEPTH>::LLSkipList() -: mInsertFirst(NULL), - mEquals(defaultEquals) -{ - init(); -} - -// basic constructor including sorter -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline LLSkipList<DATA_TYPE, BINARY_DEPTH>::LLSkipList(insert_func insert, - equals_func equals) -: mInsertFirst(insert), - mEquals(equals) -{ - init(); -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline LLSkipList<DATA_TYPE, BINARY_DEPTH>::~LLSkipList() -{ - removeAllNodes(); -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipList<DATA_TYPE, BINARY_DEPTH>::setInsertFirst(insert_func insert_first) -{ - mInsertFirst = insert_first; -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipList<DATA_TYPE, BINARY_DEPTH>::setEquals(equals_func equals) -{ - mEquals = equals; -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLSkipList<DATA_TYPE, BINARY_DEPTH>::addData(const DATA_TYPE& data) -{ - S32 level; - LLSkipNode *current = &mHead; - LLSkipNode *temp; - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mData, data))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mData < data)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - // now add the new node - S32 newlevel; - for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) - { - if (ll_frand() < 0.5f) - break; - } - - LLSkipNode *snode = new LLSkipNode(data); - - if (newlevel > mLevel) - { - mHead.mForward[mLevel] = NULL; - mUpdate[mLevel] = &mHead; - mLevel = newlevel; - } - - for (level = 0; level < newlevel; level++) - { - snode->mForward[level] = mUpdate[level]->mForward[level]; - mUpdate[level]->mForward[level] = snode; - } - return TRUE; -} - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLSkipList<DATA_TYPE, BINARY_DEPTH>::checkData(const DATA_TYPE& data) -{ - S32 level; - LLSkipNode *current = &mHead; - LLSkipNode *temp; - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mData, data))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mData < data)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - - if (current) - { - return mEquals(current->mData, data); - } - - return FALSE; -} - -// returns number of items in the list -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline S32 LLSkipList<DATA_TYPE, BINARY_DEPTH>::getLength() const -{ - U32 length = 0; - for (LLSkipNode* temp = *(mHead.mForward); temp != NULL; temp = temp->mForward[0]) - { - length++; - } - return length; -} - - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLSkipList<DATA_TYPE, BINARY_DEPTH>::moveData(const DATA_TYPE& data, LLSkipList *newlist) -{ - BOOL removed = removeData(data); - BOOL added = newlist->addData(data); - return removed && added; -} - - -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLSkipList<DATA_TYPE, BINARY_DEPTH>::removeData(const DATA_TYPE& data) -{ - S32 level; - LLSkipNode *current = &mHead; - LLSkipNode *temp; - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mData, data))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mData < data)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - - if (!current) - { - // empty list or beyond the end! - return FALSE; - } - - // is this the one we want? - if (!mEquals(current->mData, data)) - { - // nope! - return FALSE; - } - else - { - // do we need to fix current or currentop? - if (current == mCurrentp) - { - mCurrentp = current->mForward[0]; - } - - if (current == mCurrentOperatingp) - { - mCurrentOperatingp = current->mForward[0]; - } - // yes it is! change pointers as required - for (level = 0; level < mLevel; level++) - { - if (mUpdate[level]->mForward[level] != current) - { - // cool, we've fixed all the pointers! - break; - } - mUpdate[level]->mForward[level] = current->mForward[level]; - } - - // clean up cuurent - delete current; - - // clean up mHead - while ( (mLevel > 1) - &&(!mHead.mForward[mLevel - 1])) - { - mLevel--; - } - } - return TRUE; -} - -// remove all nodes from the list but do not delete data -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipList<DATA_TYPE, BINARY_DEPTH>::removeAllNodes() -{ - LLSkipNode *temp; - // reset mCurrentp - mCurrentp = *(mHead.mForward); - - while (mCurrentp) - { - temp = mCurrentp->mForward[0]; - delete mCurrentp; - mCurrentp = temp; - } - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mHead.mForward[i] = NULL; - mUpdate[i] = NULL; - } - - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -// place mCurrentp on first node -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipList<DATA_TYPE, BINARY_DEPTH>::resetList() -{ - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -// return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE LLSkipList<DATA_TYPE, BINARY_DEPTH>::getCurrentData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mData; - } - else - { - //return NULL; // causes compile warning - return (DATA_TYPE)0; // equivalent, but no warning - } -} - -// same as getCurrentData() but a more intuitive name for the operation -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE LLSkipList<DATA_TYPE, BINARY_DEPTH>::getNextData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mData; - } - else - { - //return NULL; // causes compile warning - return (DATA_TYPE)0; // equivalent, but no warning - } -} - -// remove the Node at mCurentOperatingp -// leave mCurrentp and mCurentOperatingp on the next entry -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipList<DATA_TYPE, BINARY_DEPTH>::removeCurrentData() -{ - if (mCurrentOperatingp) - { - removeData(mCurrentOperatingp->mData); - } -} - -// reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE LLSkipList<DATA_TYPE, BINARY_DEPTH>::getFirstData() -{ - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mData; - } - else - { - //return NULL; // causes compile warning - return (DATA_TYPE)0; // equivalent, but no warning - } -} - - -#endif diff --git a/indra/llcommon/llskipmap.h b/indra/llcommon/llskipmap.h deleted file mode 100755 index 49ff2928d13b4a61111eccb30b72dd29167404fd..0000000000000000000000000000000000000000 --- a/indra/llcommon/llskipmap.h +++ /dev/null @@ -1,1022 +0,0 @@ -/** - * @file llskipmap.h - * @brief Associative container based on the skiplist algorithm. - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLSKIPMAP_H -#define LL_LLSKIPMAP_H - -#include "llerror.h" - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH = 8> -class LLSkipMap -{ -public: - // basic constructor - LLSkipMap(); - - // basic constructor including sorter - LLSkipMap(BOOL (*insert_first)(const INDEX_TYPE &first, const INDEX_TYPE &second), - BOOL (*equals)(const INDEX_TYPE &first, const INDEX_TYPE &second)); - - ~LLSkipMap(); - - void setInsertFirst(BOOL (*insert_first)(const INDEX_TYPE &first, const INDEX_TYPE &second)); - void setEquals(BOOL (*equals)(const INDEX_TYPE &first, const INDEX_TYPE &second)); - - DATA_TYPE &addData(const INDEX_TYPE &index, DATA_TYPE datap); - DATA_TYPE &addData(const INDEX_TYPE &index); - DATA_TYPE &getData(const INDEX_TYPE &index); - DATA_TYPE &operator[](const INDEX_TYPE &index); - - // If index present, returns data. - // If index not present, adds <index,NULL> and returns NULL. - DATA_TYPE &getData(const INDEX_TYPE &index, BOOL &b_new_entry); - - // Returns TRUE if data present in map. - BOOL checkData(const INDEX_TYPE &index); - - // Returns TRUE if key is present in map. This is useful if you - // are potentially storing NULL pointers in the map - BOOL checkKey(const INDEX_TYPE &index); - - // If there, returns the data. - // If not, returns NULL. - // Never adds entries to the map. - DATA_TYPE getIfThere(const INDEX_TYPE &index); - - INDEX_TYPE reverseLookup(const DATA_TYPE datap); - - // returns number of items in the list - S32 getLength(); // WARNING! getLength is O(n), not O(1)! - - BOOL removeData(const INDEX_TYPE &index); - - // remove all nodes from the list but do not delete data - void removeAllData(); - - // place mCurrentp on first node - void resetList(); - - // return the data currently pointed to - DATA_TYPE getCurrentDataWithoutIncrement(); - - // return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - DATA_TYPE getCurrentData(); - - // same as getCurrentData() but a more intuitive name for the operation - DATA_TYPE getNextData(); - - INDEX_TYPE getNextKey(); - - // return the key currently pointed to - INDEX_TYPE getCurrentKeyWithoutIncrement(); - - // The internal iterator is at the end of the list. - BOOL notDone() const; - - // remove the Node at mCurentOperatingp - // leave mCurrentp and mCurentOperatingp on the next entry - void removeCurrentData(); - - void deleteCurrentData(); - - // reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp - DATA_TYPE getFirstData(); - - INDEX_TYPE getFirstKey(); - - class LLSkipMapNode - { - public: - LLSkipMapNode() - { - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mForward[i] = NULL; - } - - U8 *zero = (U8 *)&mIndex; - - for (i = 0; i < (S32)sizeof(INDEX_TYPE); i++) - { - *(zero + i) = 0; - } - - zero = (U8 *)&mData; - - for (i = 0; i < (S32)sizeof(DATA_TYPE); i++) - { - *(zero + i) = 0; - } - } - - LLSkipMapNode(const INDEX_TYPE &index) - : mIndex(index) - { - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mForward[i] = NULL; - } - - U8 *zero = (U8 *)&mData; - - for (i = 0; i < (S32)sizeof(DATA_TYPE); i++) - { - *(zero + i) = 0; - } - } - - LLSkipMapNode(const INDEX_TYPE &index, DATA_TYPE datap) - : mIndex(index) - { - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mForward[i] = NULL; - } - - mData = datap; - } - - ~LLSkipMapNode() - { - } - - - INDEX_TYPE mIndex; - DATA_TYPE mData; - LLSkipMapNode *mForward[BINARY_DEPTH]; - - private: - // Disallow copying of LLSkipMapNodes by not implementing these methods. - LLSkipMapNode(const LLSkipMapNode &); - LLSkipMapNode &operator=(const LLSkipMapNode &rhs); - }; - - static BOOL defaultEquals(const INDEX_TYPE &first, const INDEX_TYPE &second) - { - return first == second; - } - -private: - // don't generate implicit copy constructor or copy assignment - LLSkipMap(const LLSkipMap &); - LLSkipMap &operator=(const LLSkipMap &); - -private: - LLSkipMapNode mHead; - LLSkipMapNode *mUpdate[BINARY_DEPTH]; - LLSkipMapNode *mCurrentp; - LLSkipMapNode *mCurrentOperatingp; - S32 mLevel; - BOOL (*mInsertFirst)(const INDEX_TYPE &first, const INDEX_TYPE &second); - BOOL (*mEquals)(const INDEX_TYPE &first, const INDEX_TYPE &second); - S32 mNumberOfSteps; -}; - -////////////////////////////////////////////////// -// -// LLSkipMap implementation -// - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::LLSkipMap() - : mInsertFirst(NULL), - mEquals(defaultEquals) -{ - // Skipmaps must have binary depth of at least 2 - cassert(BINARY_DEPTH >= 2); - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mUpdate[i] = NULL; - } - mLevel = 1; - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::LLSkipMap(BOOL (*insert_first)(const INDEX_TYPE &first, const INDEX_TYPE &second), - BOOL (*equals)(const INDEX_TYPE &first, const INDEX_TYPE &second)) - : mInsertFirst(insert_first), - mEquals(equals) -{ - // Skipmaps must have binary depth of at least 2 - cassert(BINARY_DEPTH >= 2); - - mLevel = 1; - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mHead.mForward[i] = NULL; - mUpdate[i] = NULL; - } - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::~LLSkipMap() -{ - removeAllData(); -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::setInsertFirst(BOOL (*insert_first)(const INDEX_TYPE &first, const INDEX_TYPE &second)) -{ - mInsertFirst = insert_first; -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::setEquals(BOOL (*equals)(const INDEX_TYPE &first, const INDEX_TYPE &second)) -{ - mEquals = equals; -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE &LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::addData(const INDEX_TYPE &index, DATA_TYPE datap) -{ - S32 level; - LLSkipMapNode *current = &mHead; - LLSkipMapNode *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - // replace the existing data if a node is already there - if ( (current) - &&(mEquals(current->mIndex, index))) - { - current->mData = datap; - return current->mData; - } - - // now add the new node - S32 newlevel; - for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) - { - if (rand() & 1) - { - break; - } - } - - LLSkipMapNode *snode = new LLSkipMapNode(index, datap); - - if (newlevel > mLevel) - { - mHead.mForward[mLevel] = NULL; - mUpdate[mLevel] = &mHead; - mLevel = newlevel; - } - - for (level = 0; level < newlevel; level++) - { - snode->mForward[level] = mUpdate[level]->mForward[level]; - mUpdate[level]->mForward[level] = snode; - } - return snode->mData; -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE &LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::addData(const INDEX_TYPE &index) -{ - S32 level; - LLSkipMapNode *current = &mHead; - LLSkipMapNode *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - // now add the new node - S32 newlevel; - for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) - { - if (rand() & 1) - break; - } - - LLSkipMapNode *snode = new LLSkipMapNode(index); - - if (newlevel > mLevel) - { - mHead.mForward[mLevel] = NULL; - mUpdate[mLevel] = &mHead; - mLevel = newlevel; - } - - for (level = 0; level < newlevel; level++) - { - snode->mForward[level] = mUpdate[level]->mForward[level]; - mUpdate[level]->mForward[level] = snode; - } - return snode->mData; -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE &LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getData(const INDEX_TYPE &index) -{ - S32 level; - LLSkipMapNode *current = &mHead; - LLSkipMapNode *temp; - - mNumberOfSteps = 0; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - mNumberOfSteps++; - - if ( (current) - &&(mEquals(current->mIndex, index))) - { - - return current->mData; - } - - // now add the new node - S32 newlevel; - for (newlevel = 1; newlevel <= mLevel && newlevel < BINARY_DEPTH; newlevel++) - { - if (rand() & 1) - break; - } - - LLSkipMapNode *snode = new LLSkipMapNode(index); - - if (newlevel > mLevel) - { - mHead.mForward[mLevel] = NULL; - mUpdate[mLevel] = &mHead; - mLevel = newlevel; - } - - for (level = 0; level < newlevel; level++) - { - snode->mForward[level] = mUpdate[level]->mForward[level]; - mUpdate[level]->mForward[level] = snode; - } - - return snode->mData; -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE &LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::operator[](const INDEX_TYPE &index) -{ - - return getData(index); -} - -// If index present, returns data. -// If index not present, adds <index,NULL> and returns NULL. -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE &LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getData(const INDEX_TYPE &index, BOOL &b_new_entry) -{ - S32 level; - LLSkipMapNode *current = &mHead; - LLSkipMapNode *temp; - - mNumberOfSteps = 0; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - mNumberOfSteps++; - current = *current->mForward; - - if ( (current) - &&(mEquals(current->mIndex, index))) - { - - return current->mData; - } - b_new_entry = TRUE; - addData(index); - - return current->mData; -} - -// Returns TRUE if data present in map. -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::checkData(const INDEX_TYPE &index) -{ - S32 level; - LLSkipMapNode *current = &mHead; - LLSkipMapNode *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - if (current) - { - // Gets rid of some compiler ambiguity for the LLPointer<> templated class. - if (current->mData) - { - return mEquals(current->mIndex, index); - } - } - - return FALSE; -} - -// Returns TRUE if key is present in map. This is useful if you -// are potentially storing NULL pointers in the map -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::checkKey(const INDEX_TYPE &index) -{ - S32 level; - LLSkipMapNode *current = &mHead; - LLSkipMapNode *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - if (current) - { - return mEquals(current->mIndex, index); - } - - return FALSE; -} - -// If there, returns the data. -// If not, returns NULL. -// Never adds entries to the map. -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getIfThere(const INDEX_TYPE &index) -{ - S32 level; - LLSkipMapNode *current = &mHead; - LLSkipMapNode *temp; - - mNumberOfSteps = 0; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - mNumberOfSteps++; - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - mNumberOfSteps++; - current = *current->mForward; - - if (current) - { - if (mEquals(current->mIndex, index)) - { - return current->mData; - } - } - - // Avoid Linux compiler warning on returning NULL. - return DATA_TYPE(); -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline INDEX_TYPE LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::reverseLookup(const DATA_TYPE datap) -{ - LLSkipMapNode *current = &mHead; - - while (current) - { - if (datap == current->mData) - { - - return current->mIndex; - } - current = *current->mForward; - } - - // not found! return NULL - return INDEX_TYPE(); -} - -// returns number of items in the list -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline S32 LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getLength() -{ - U32 length = 0; - for (LLSkipMapNode* temp = *(mHead.mForward); temp != NULL; temp = temp->mForward[0]) - { - length++; - } - - return length; -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::removeData(const INDEX_TYPE &index) -{ - S32 level; - LLSkipMapNode *current = &mHead; - LLSkipMapNode *temp; - - // find the pointer one in front of the one we want - if (mInsertFirst) - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(mInsertFirst(temp->mIndex, index))) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - else - { - for (level = mLevel - 1; level >= 0; level--) - { - temp = *(current->mForward + level); - while ( (temp) - &&(temp->mIndex < index)) - { - current = temp; - temp = *(current->mForward + level); - } - *(mUpdate + level) = current; - } - } - - // we're now just in front of where we want to be . . . take one step forward - current = *current->mForward; - - if (!current) - { - // empty list or beyond the end! - - return FALSE; - } - - // is this the one we want? - if (!mEquals(current->mIndex, index)) - { - // nope! - - return FALSE; - } - else - { - // do we need to fix current or currentop? - if (current == mCurrentp) - { - mCurrentp = *current->mForward; - } - - if (current == mCurrentOperatingp) - { - mCurrentOperatingp = *current->mForward; - } - // yes it is! change pointers as required - for (level = 0; level < mLevel; level++) - { - if (*((*(mUpdate + level))->mForward + level) != current) - { - // cool, we've fixed all the pointers! - break; - } - *((*(mUpdate + level))->mForward + level) = *(current->mForward + level); - } - - delete current; - - // clean up mHead - while ( (mLevel > 1) - &&(!*(mHead.mForward + mLevel - 1))) - { - mLevel--; - } - } - - return TRUE; -} - - -// remove all nodes from the list but do not delete data -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -void LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::removeAllData() -{ - LLSkipMapNode *temp; - // reset mCurrentp - mCurrentp = *(mHead.mForward); - - while (mCurrentp) - { - temp = mCurrentp->mForward[0]; - delete mCurrentp; - mCurrentp = temp; - } - - S32 i; - for (i = 0; i < BINARY_DEPTH; i++) - { - mHead.mForward[i] = NULL; - mUpdate[i] = NULL; - } - - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - - -// place mCurrentp on first node -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::resetList() -{ - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); -} - - -// return the data currently pointed to -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getCurrentDataWithoutIncrement() -{ - if (mCurrentOperatingp) - { - return mCurrentOperatingp->mData; - } - else - { - return DATA_TYPE(); - } -} - -// return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getCurrentData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mData; - } - else - { - // Basic types, like int, have default constructors that initialize - // them to zero. g++ 2.95 supports this. "int()" is zero. - // This also is nice for LLUUID() - return DATA_TYPE(); - } -} - -// same as getCurrentData() but a more intuitive name for the operation -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getNextData() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mData; - } - else - { - // Basic types, like int, have default constructors that initialize - // them to zero. g++ 2.95 supports this. "int()" is zero. - // This also is nice for LLUUID() - return DATA_TYPE(); - } -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline INDEX_TYPE LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getNextKey() -{ - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mIndex; - } - else - { - return mHead.mIndex; - } -} - -// return the key currently pointed to -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline INDEX_TYPE LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getCurrentKeyWithoutIncrement() -{ - if (mCurrentOperatingp) - { - return mCurrentOperatingp->mIndex; - } - else - { - // See comment for getNextData() - return INDEX_TYPE(); - } -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline BOOL LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::notDone() const -{ - if (mCurrentOperatingp) - { - return TRUE; - } - else - { - return FALSE; - } -} - - -// remove the Node at mCurentOperatingp -// leave mCurrentp and mCurentOperatingp on the next entry -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::removeCurrentData() -{ - if (mCurrentOperatingp) - { - removeData(mCurrentOperatingp->mIndex); - } -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline void LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::deleteCurrentData() -{ - if (mCurrentOperatingp) - { - deleteData(mCurrentOperatingp->mIndex); - } -} - -// reset the list and return the data currently pointed to, set mCurentOperatingp to that node and bump mCurrentp -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline DATA_TYPE LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getFirstData() -{ - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mData; - } - else - { - // See comment for getNextData() - return DATA_TYPE(); - } -} - -template <class INDEX_TYPE, class DATA_TYPE, S32 BINARY_DEPTH> -inline INDEX_TYPE LLSkipMap<INDEX_TYPE, DATA_TYPE, BINARY_DEPTH>::getFirstKey() -{ - mCurrentp = *(mHead.mForward); - mCurrentOperatingp = *(mHead.mForward); - if (mCurrentp) - { - mCurrentOperatingp = mCurrentp; - mCurrentp = mCurrentp->mForward[0]; - return mCurrentOperatingp->mIndex; - } - else - { - return mHead.mIndex; - } -} - -#endif diff --git a/indra/llcommon/llsortedvector.h b/indra/llcommon/llsortedvector.h deleted file mode 100755 index 391b82ee4461033d6bb57a1acca4c41762831d96..0000000000000000000000000000000000000000 --- a/indra/llcommon/llsortedvector.h +++ /dev/null @@ -1,152 +0,0 @@ -/** - * @file llsortedvector.h - * @author Nat Goodspeed - * @date 2012-04-08 - * @brief LLSortedVector class wraps a vector that we maintain in sorted - * order so we can perform binary-search lookups. - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Copyright (c) 2012, Linden Research, Inc. - * $/LicenseInfo$ - */ - -#if ! defined(LL_LLSORTEDVECTOR_H) -#define LL_LLSORTEDVECTOR_H - -#include <vector> -#include <algorithm> - -/** - * LLSortedVector contains a std::vector<std::pair> that we keep sorted on the - * first of the pair. This makes insertion somewhat more expensive than simple - * std::vector::push_back(), but allows us to use binary search for lookups. - * It's intended for small aggregates where lookup is far more performance- - * critical than insertion; in such cases a binary search on a small, sorted - * std::vector can be more performant than a std::map lookup. - */ -template <typename KEY, typename VALUE> -class LLSortedVector -{ -public: - typedef LLSortedVector<KEY, VALUE> self; - typedef KEY key_type; - typedef VALUE mapped_type; - typedef std::pair<key_type, mapped_type> value_type; - typedef std::vector<value_type> PairVector; - typedef typename PairVector::iterator iterator; - typedef typename PairVector::const_iterator const_iterator; - - /// Empty - LLSortedVector() {} - - /// Fixed initial size - LLSortedVector(std::size_t size): - mVector(size) - {} - - /// Bulk load - template <typename ITER> - LLSortedVector(ITER begin, ITER end): - mVector(begin, end) - { - // Allow caller to dump in a bunch of (pairs convertible to) - // value_type if desired, but make sure we sort afterwards. - std::sort(mVector.begin(), mVector.end()); - } - - /// insert(key, value) - std::pair<iterator, bool> insert(const key_type& key, const mapped_type& value) - { - return insert(value_type(key, value)); - } - - /// insert(value_type) - std::pair<iterator, bool> insert(const value_type& pair) - { - typedef std::pair<iterator, bool> iterbool; - iterator found = std::lower_bound(mVector.begin(), mVector.end(), pair, - less<value_type>()); - // have to check for end() before it's even valid to dereference - if (found == mVector.end()) - { - std::size_t index(mVector.size()); - mVector.push_back(pair); - // don't forget that push_back() invalidates 'found' - return iterbool(mVector.begin() + index, true); - } - if (found->first == pair.first) - { - return iterbool(found, false); - } - // remember that insert() invalidates 'found' -- save index - std::size_t index(found - mVector.begin()); - mVector.insert(found, pair); - // okay, convert from index back to iterator - return iterbool(mVector.begin() + index, true); - } - - iterator begin() { return mVector.begin(); } - iterator end() { return mVector.end(); } - const_iterator begin() const { return mVector.begin(); } - const_iterator end() const { return mVector.end(); } - - bool empty() const { return mVector.empty(); } - std::size_t size() const { return mVector.size(); } - - /// find - iterator find(const key_type& key) - { - iterator found = std::lower_bound(mVector.begin(), mVector.end(), - value_type(key, mapped_type()), - less<value_type>()); - if (found == mVector.end() || found->first != key) - return mVector.end(); - return found; - } - - const_iterator find(const key_type& key) const - { - return const_cast<self*>(this)->find(key); - } - -private: - // Define our own 'less' comparator so we can specialize without messing - // with std::less. - template <typename T> - struct less: public std::less<T> {}; - - // Specialize 'less' for an LLSortedVector::value_type involving - // std::type_info*. This is one of LLSortedVector's foremost use cases. We - // specialize 'less' rather than just defining a specific comparator - // because LLSortedVector should be usable for other key_types as well. - template <typename T> - struct less< std::pair<std::type_info*, T> >: - public std::binary_function<std::pair<std::type_info*, T>, - std::pair<std::type_info*, T>, - bool> - { - bool operator()(const std::pair<std::type_info*, T>& lhs, - const std::pair<std::type_info*, T>& rhs) const - { - return lhs.first->before(*rhs.first); - } - }; - - // Same as above, but with const std::type_info*. - template <typename T> - struct less< std::pair<const std::type_info*, T> >: - public std::binary_function<std::pair<const std::type_info*, T>, - std::pair<const std::type_info*, T>, - bool> - { - bool operator()(const std::pair<const std::type_info*, T>& lhs, - const std::pair<const std::type_info*, T>& rhs) const - { - return lhs.first->before(*rhs.first); - } - }; - - PairVector mVector; -}; - -#endif /* ! defined(LL_LLSORTEDVECTOR_H) */ diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp index ccd7ef91c2ed54d97bed8ddd971827c58fbe49c5..e0e905638079cad672f6e3adf61e7d81a0316a41 100755 --- a/indra/llcommon/llstacktrace.cpp +++ b/indra/llcommon/llstacktrace.cpp @@ -32,7 +32,7 @@ #include <iostream> #include <sstream> -#include "windows.h" +#include "llwin32headerslean.h" #include "Dbghelp.h" typedef USHORT NTAPI RtlCaptureStackBackTrace_Function( diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp deleted file mode 100755 index 3678c8e1c1d5564ae463685717696a60a65501fd..0000000000000000000000000000000000000000 --- a/indra/llcommon/llstat.cpp +++ /dev/null @@ -1,404 +0,0 @@ -/** - * @file llstat.cpp - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llstat.h" -#include "lllivefile.h" -#include "llerrorcontrol.h" -#include "llframetimer.h" -#include "timing.h" -#include "llsd.h" -#include "llsdserialize.h" -#include "llstl.h" -#include "u64.h" - - -// statics -//------------------------------------------------------------------------ -LLTimer LLStat::sTimer; -LLFrameTimer LLStat::sFrameTimer; - -void LLStat::reset() -{ - mNumValues = 0; - mLastValue = 0.f; - delete[] mBins; - mBins = new ValueEntry[mNumBins]; - mCurBin = mNumBins-1; - mNextBin = 0; -} - -LLStat::LLStat(std::string name, S32 num_bins, BOOL use_frame_timer) -: mUseFrameTimer(use_frame_timer), - mNumBins(num_bins), - mName(name), - mBins(NULL) -{ - llassert(mNumBins > 0); - mLastTime = 0.f; - - reset(); - - if (!mName.empty()) - { - stat_map_t::iterator iter = getStatList().find(mName); - if (iter != getStatList().end()) - llwarns << "LLStat with duplicate name: " << mName << llendl; - getStatList().insert(std::make_pair(mName, this)); - } -} - -LLStat::stat_map_t& LLStat::getStatList() -{ - static LLStat::stat_map_t stat_list; - return stat_list; -} - - -LLStat::~LLStat() -{ - delete[] mBins; - - if (!mName.empty()) - { - // handle multiple entries with the same name - stat_map_t::iterator iter = getStatList().find(mName); - while (iter != getStatList().end() && iter->second != this) - ++iter; - getStatList().erase(iter); - } -} - -void LLStat::start() -{ - if (mUseFrameTimer) - { - mBins[mNextBin].mBeginTime = sFrameTimer.getElapsedSeconds(); - } - else - { - mBins[mNextBin].mBeginTime = sTimer.getElapsedTimeF64(); - } -} - -void LLStat::addValue(const F32 value) -{ - if (mNumValues < mNumBins) - { - mNumValues++; - } - - // Increment the bin counters. - mCurBin++; - if (mCurBin >= mNumBins) - { - mCurBin = 0; - } - mNextBin++; - if (mNextBin >= mNumBins) - { - mNextBin = 0; - } - - mBins[mCurBin].mValue = value; - if (mUseFrameTimer) - { - mBins[mCurBin].mTime = sFrameTimer.getElapsedSeconds(); - } - else - { - mBins[mCurBin].mTime = sTimer.getElapsedTimeF64(); - } - mBins[mCurBin].mDT = (F32)(mBins[mCurBin].mTime - mBins[mCurBin].mBeginTime); - - //this value is used to prime the min/max calls - mLastTime = mBins[mCurBin].mTime; - mLastValue = value; - - // Set the begin time for the next stat segment. - mBins[mNextBin].mBeginTime = mBins[mCurBin].mTime; - mBins[mNextBin].mTime = mBins[mCurBin].mTime; - mBins[mNextBin].mDT = 0.f; -} - - -F32 LLStat::getMax() const -{ - S32 i; - F32 current_max = mLastValue; - if (mNumBins == 0) - { - current_max = 0.f; - } - else - { - for (i = 0; (i < mNumBins) && (i < mNumValues); i++) - { - // Skip the bin we're currently filling. - if (i == mNextBin) - { - continue; - } - if (mBins[i].mValue > current_max) - { - current_max = mBins[i].mValue; - } - } - } - return current_max; -} - -F32 LLStat::getMean() const -{ - S32 i; - F32 current_mean = 0.f; - S32 samples = 0; - for (i = 0; (i < mNumBins) && (i < mNumValues); i++) - { - // Skip the bin we're currently filling. - if (i == mNextBin) - { - continue; - } - current_mean += mBins[i].mValue; - samples++; - } - - // There will be a wrap error at 2^32. :) - if (samples != 0) - { - current_mean /= samples; - } - else - { - current_mean = 0.f; - } - return current_mean; -} - -F32 LLStat::getMin() const -{ - S32 i; - F32 current_min = mLastValue; - - if (mNumBins == 0) - { - current_min = 0.f; - } - else - { - for (i = 0; (i < mNumBins) && (i < mNumValues); i++) - { - // Skip the bin we're currently filling. - if (i == mNextBin) - { - continue; - } - if (mBins[i].mValue < current_min) - { - current_min = mBins[i].mValue; - } - } - } - return current_min; -} - -F32 LLStat::getPrev(S32 age) const -{ - S32 bin; - bin = mCurBin - age; - - while (bin < 0) - { - bin += mNumBins; - } - - if (bin == mNextBin) - { - // Bogus for bin we're currently working on. - return 0.f; - } - return mBins[bin].mValue; -} - -F32 LLStat::getPrevPerSec(S32 age) const -{ - S32 bin; - bin = mCurBin - age; - - while (bin < 0) - { - bin += mNumBins; - } - - if (bin == mNextBin) - { - // Bogus for bin we're currently working on. - return 0.f; - } - return mBins[bin].mValue / mBins[bin].mDT; -} - -F32 LLStat::getCurrent() const -{ - return mBins[mCurBin].mValue; -} - -F32 LLStat::getCurrentPerSec() const -{ - return mBins[mCurBin].mValue / mBins[mCurBin].mDT; -} - -F32 LLStat::getMeanPerSec() const -{ - S32 i; - F32 value = 0.f; - F32 dt = 0.f; - - for (i = 0; (i < mNumBins) && (i < mNumValues); i++) - { - // Skip the bin we're currently filling. - if (i == mNextBin) - { - continue; - } - value += mBins[i].mValue; - dt += mBins[i].mDT; - } - - if (dt > 0.f) - { - return value/dt; - } - else - { - return 0.f; - } -} - -F32 LLStat::getMeanDuration() const -{ - F32 dur = 0.0f; - S32 count = 0; - for (S32 i=0; (i < mNumBins) && (i < mNumValues); i++) - { - if (i == mNextBin) - { - continue; - } - dur += mBins[i].mDT; - count++; - } - - if (count > 0) - { - dur /= F32(count); - return dur; - } - else - { - return 0.f; - } -} - -F32 LLStat::getMaxPerSec() const -{ - F32 value; - - if (mNextBin != 0) - { - value = mBins[0].mValue/mBins[0].mDT; - } - else if (mNumValues > 0) - { - value = mBins[1].mValue/mBins[1].mDT; - } - else - { - value = 0.f; - } - - for (S32 i = 0; (i < mNumBins) && (i < mNumValues); i++) - { - // Skip the bin we're currently filling. - if (i == mNextBin) - { - continue; - } - value = llmax(value, mBins[i].mValue/mBins[i].mDT); - } - return value; -} - -F32 LLStat::getMinPerSec() const -{ - S32 i; - F32 value; - - if (mNextBin != 0) - { - value = mBins[0].mValue/mBins[0].mDT; - } - else if (mNumValues > 0) - { - value = mBins[1].mValue/mBins[0].mDT; - } - else - { - value = 0.f; - } - - for (i = 0; (i < mNumBins) && (i < mNumValues); i++) - { - // Skip the bin we're currently filling. - if (i == mNextBin) - { - continue; - } - value = llmin(value, mBins[i].mValue/mBins[i].mDT); - } - return value; -} - -U32 LLStat::getNumValues() const -{ - return mNumValues; -} - -S32 LLStat::getNumBins() const -{ - return mNumBins; -} - -S32 LLStat::getNextBin() const -{ - return mNextBin; -} - -F64 LLStat::getLastTime() const -{ - return mLastTime; -} diff --git a/indra/llcommon/llstat.h b/indra/llcommon/llstat.h deleted file mode 100755 index 38377a010b9c01ad08f464ba02aa817281648237..0000000000000000000000000000000000000000 --- a/indra/llcommon/llstat.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - * @file llstat.h - * @brief Runtime statistics accumulation. - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLSTAT_H -#define LL_LLSTAT_H - -#include <map> - -#include "lltimer.h" -#include "llframetimer.h" - -class LLSD; - -// ---------------------------------------------------------------------------- -class LL_COMMON_API LLStat -{ -private: - typedef std::multimap<std::string, LLStat*> stat_map_t; - - static stat_map_t& getStatList(); - -public: - LLStat(std::string name = std::string(), S32 num_bins = 32, BOOL use_frame_timer = FALSE); - ~LLStat(); - - void start(); // Start the timer for the current "frame", otherwise uses the time tracked from - // the last addValue - void reset(); - void addValue(const F32 value = 1.f); // Adds the current value being tracked, and tracks the DT. - void addValue(const S32 value) { addValue((F32)value); } - void addValue(const U32 value) { addValue((F32)value); } - - S32 getNextBin() const; - - F32 getPrev(S32 age) const; // Age is how many "addValues" previously - zero is current - F32 getPrevPerSec(S32 age) const; // Age is how many "addValues" previously - zero is current - F32 getCurrent() const; - F32 getCurrentPerSec() const; - - F32 getMin() const; - F32 getMinPerSec() const; - F32 getMean() const; - F32 getMeanPerSec() const; - F32 getMeanDuration() const; - F32 getMax() const; - F32 getMaxPerSec() const; - - U32 getNumValues() const; - S32 getNumBins() const; - - F64 getLastTime() const; -private: - BOOL mUseFrameTimer; - U32 mNumValues; - U32 mNumBins; - F32 mLastValue; - F64 mLastTime; - - struct ValueEntry - { - ValueEntry() - : mValue(0.f), - mBeginTime(0.0), - mTime(0.0), - mDT(0.f) - {} - F32 mValue; - F64 mBeginTime; - F64 mTime; - F32 mDT; - }; - ValueEntry* mBins; - S32 mCurBin; - S32 mNextBin; - - std::string mName; - - static LLTimer sTimer; - static LLFrameTimer sFrameTimer; - -public: - static LLStat* getStat(const std::string& name) - { - // return the first stat that matches 'name' - stat_map_t::iterator iter = getStatList().find(name); - if (iter != getStatList().end()) - return iter->second; - else - return NULL; - } -}; - -#endif // LL_STAT_ diff --git a/indra/llcommon/llstatenums.h b/indra/llcommon/llstatenums.h old mode 100755 new mode 100644 index 81c4085d16829a5f73f640e787e20cf46d58b319..6515a3e3cb0521e012efcc5741dc3e96b0755a8b --- a/indra/llcommon/llstatenums.h +++ b/indra/llcommon/llstatenums.h @@ -26,50 +26,6 @@ #ifndef LL_LLSTATENUMS_H #define LL_LLSTATENUMS_H -enum -{ - LL_SIM_STAT_TIME_DILATION = 0, - LL_SIM_STAT_FPS = 1, - LL_SIM_STAT_PHYSFPS = 2, - LL_SIM_STAT_AGENTUPS = 3, - LL_SIM_STAT_FRAMEMS = 4, - LL_SIM_STAT_NETMS = 5, - LL_SIM_STAT_SIMOTHERMS = 6, - LL_SIM_STAT_SIMPHYSICSMS = 7, - LL_SIM_STAT_AGENTMS = 8, - LL_SIM_STAT_IMAGESMS = 9, - LL_SIM_STAT_SCRIPTMS = 10, - LL_SIM_STAT_NUMTASKS = 11, - LL_SIM_STAT_NUMTASKSACTIVE = 12, - LL_SIM_STAT_NUMAGENTMAIN = 13, - LL_SIM_STAT_NUMAGENTCHILD = 14, - LL_SIM_STAT_NUMSCRIPTSACTIVE = 15, - LL_SIM_STAT_LSLIPS = 16, - LL_SIM_STAT_INPPS = 17, - LL_SIM_STAT_OUTPPS = 18, - LL_SIM_STAT_PENDING_DOWNLOADS = 19, - LL_SIM_STAT_PENDING_UPLOADS = 20, - LL_SIM_STAT_VIRTUAL_SIZE_KB = 21, - LL_SIM_STAT_RESIDENT_SIZE_KB = 22, - LL_SIM_STAT_PENDING_LOCAL_UPLOADS = 23, - LL_SIM_STAT_TOTAL_UNACKED_BYTES = 24, - LL_SIM_STAT_PHYSICS_PINNED_TASKS = 25, - LL_SIM_STAT_PHYSICS_LOD_TASKS = 26, - LL_SIM_STAT_SIMPHYSICSSTEPMS = 27, - LL_SIM_STAT_SIMPHYSICSSHAPEMS = 28, - LL_SIM_STAT_SIMPHYSICSOTHERMS = 29, - LL_SIM_STAT_SIMPHYSICSMEMORY = 30, - LL_SIM_STAT_SCRIPT_EPS = 31, - LL_SIM_STAT_SIMSPARETIME = 32, - LL_SIM_STAT_SIMSLEEPTIME = 33, - LL_SIM_STAT_IOPUMPTIME = 34, - LL_SIM_STAT_PCTSCRIPTSRUN = 35, - LL_SIM_STAT_REGION_IDLE = 36, // dataserver only - LL_SIM_STAT_REGION_IDLE_POSSIBLE = 37, // dataserver only - LL_SIM_STAT_SIMAISTEPTIMEMS = 38, - LL_SIM_STAT_SKIPPEDAISILSTEPS_PS = 39, - LL_SIM_STAT_PCTSTEPPEDCHARACTERS = 40 -}; #endif diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index 0a39288f5a0c61e523a6e960ef3d0ca184ff6131..02f10fa2ba470d19ed5b743fa327438e970954bf 100755 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -31,8 +31,8 @@ #include <algorithm> #include <map> #include <vector> +#include <list> #include <set> -#include <deque> #include <typeinfo> // Use to compare the first element only of a pair @@ -125,7 +125,7 @@ struct DeletePairedPointerArray // compiler, the second unary_function template parameter can be set // to void. // -// Here's a snippit showing how you use this object: +// Here's a snippet showing how you use this object: // // typedef std::map<int, widget*> map_type; // map_type widget_map; @@ -170,6 +170,49 @@ struct CopyNewPointer } }; +template<typename T, typename ALLOC> +void delete_and_clear(std::list<T*, ALLOC>& list) +{ + std::for_each(list.begin(), list.end(), DeletePointer()); + list.clear(); +} + +template<typename T, typename ALLOC> +void delete_and_clear(std::vector<T*, ALLOC>& vector) +{ + std::for_each(vector.begin(), vector.end(), DeletePointer()); + vector.clear(); +} + +template<typename T, typename COMPARE, typename ALLOC> +void delete_and_clear(std::set<T*, COMPARE, ALLOC>& set) +{ + std::for_each(set.begin(), set.end(), DeletePointer()); + set.clear(); +} + +template<typename K, typename V, typename COMPARE, typename ALLOC> +void delete_and_clear(std::map<K, V*, COMPARE, ALLOC>& map) +{ + std::for_each(map.begin(), map.end(), DeletePairedPointer()); + map.clear(); +} + +template<typename T> +void delete_and_clear(T*& ptr) +{ + delete ptr; + ptr = NULL; +} + + +template<typename T> +void delete_and_clear_array(T*& ptr) +{ + delete[] ptr; + ptr = NULL; +} + // Simple function to help with finding pointers in maps. // For example: // typedef map_t; @@ -229,7 +272,6 @@ inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value) } }; -// Useful for replacing the removeObj() functionality of LLDynamicArray // Example: // for (std::vector<T>::iterator iter = mList.begin(); iter != mList.end(); ) // { @@ -238,8 +280,8 @@ inline T get_if_there(const std::map<K,T>& inmap, const K& key, T default_value) // else // ++iter; // } -template <typename T, typename Iter> -inline Iter vector_replace_with_last(std::vector<T>& invec, Iter iter) +template <typename T> +inline typename std::vector<T>::iterator vector_replace_with_last(std::vector<T>& invec, typename std::vector<T>::iterator iter) { typename std::vector<T>::iterator last = invec.end(); --last; if (iter == invec.end()) @@ -259,7 +301,6 @@ inline Iter vector_replace_with_last(std::vector<T>& invec, Iter iter) } }; -// Useful for replacing the removeObj() functionality of LLDynamicArray // Example: // vector_replace_with_last(mList, x); template <typename T> @@ -522,4 +563,151 @@ namespace std }; } // std + +/** + * Implementation for ll_template_cast() (q.v.). + * + * Default implementation: trying to cast two completely unrelated types + * returns 0. Typically you'd specify T and U as pointer types, but in fact T + * can be any type that can be initialized with 0. + */ +template <typename T, typename U> +struct ll_template_cast_impl +{ + T operator()(U) + { + return 0; + } +}; + +/** + * ll_template_cast<T>(some_value) is for use in a template function when + * some_value might be of arbitrary type, but you want to recognize type T + * specially. + * + * It's designed for use with pointer types. Example: + * @code + * struct SpecialClass + * { + * void someMethod(const std::string&) const; + * }; + * + * template <class REALCLASS> + * void somefunc(const REALCLASS& instance) + * { + * const SpecialClass* ptr = ll_template_cast<const SpecialClass*>(&instance); + * if (ptr) + * { + * ptr->someMethod("Call method only available on SpecialClass"); + * } + * } + * @endcode + * + * Why is this better than dynamic_cast<>? Because unless OtherClass is + * polymorphic, the following won't even compile (gcc 4.0.1): + * @code + * OtherClass other; + * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&other); + * @endcode + * to say nothing of this: + * @code + * void function(int); + * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&function); + * @endcode + * ll_template_cast handles these kinds of cases by returning 0. + */ +template <typename T, typename U> +T ll_template_cast(U value) +{ + return ll_template_cast_impl<T, U>()(value); +} + +/** + * Implementation for ll_template_cast() (q.v.). + * + * Implementation for identical types: return same value. + */ +template <typename T> +struct ll_template_cast_impl<T, T> +{ + T operator()(T value) + { + return value; + } +}; + +/** + * LL_TEMPLATE_CONVERTIBLE(dest, source) asserts that, for a value @c s of + * type @c source, <tt>ll_template_cast<dest>(s)</tt> will return @c s -- + * presuming that @c source can be converted to @c dest by the normal rules of + * C++. + * + * By default, <tt>ll_template_cast<dest>(s)</tt> will return 0 unless @c s's + * type is literally identical to @c dest. (This is because of the + * straightforward application of template specialization rules.) That can + * lead to surprising results, e.g.: + * + * @code + * Foo myFoo; + * const Foo* fooptr = ll_template_cast<const Foo*>(&myFoo); + * @endcode + * + * Here @c fooptr will be 0 because <tt>&myFoo</tt> is of type <tt>Foo*</tt> + * -- @em not <tt>const Foo*</tt>. (Declaring <tt>const Foo myFoo;</tt> would + * force the compiler to do the right thing.) + * + * More disappointingly: + * @code + * struct Base {}; + * struct Subclass: public Base {}; + * Subclass object; + * Base* ptr = ll_template_cast<Base*>(&object); + * @endcode + * + * Here @c ptr will be 0 because <tt>&object</tt> is of type + * <tt>Subclass*</tt> rather than <tt>Base*</tt>. We @em want this cast to + * succeed, but without our help ll_template_cast can't recognize it. + * + * The following would suffice: + * @code + * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*); + * ... + * Base* ptr = ll_template_cast<Base*>(&object); + * @endcode + * + * However, as noted earlier, this is easily fooled: + * @code + * const Base* ptr = ll_template_cast<const Base*>(&object); + * @endcode + * would still produce 0 because we haven't yet seen: + * @code + * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*); + * @endcode + * + * @TODO + * This macro should use Boost type_traits facilities for stripping and + * re-adding @c const and @c volatile qualifiers so that invoking + * LL_TEMPLATE_CONVERTIBLE(dest, source) will automatically generate all + * permitted permutations. It's really not fair to the coder to require + * separate: + * @code + * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*); + * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*); + * LL_TEMPLATE_CONVERTIBLE(const Base*, const Subclass*); + * @endcode + * + * (Naturally we omit <tt>LL_TEMPLATE_CONVERTIBLE(Base*, const Subclass*)</tt> + * because that's not permitted by normal C++ assignment anyway.) + */ +#define LL_TEMPLATE_CONVERTIBLE(DEST, SOURCE) \ +template <> \ +struct ll_template_cast_impl<DEST, SOURCE> \ +{ \ + DEST operator()(SOURCE wrapper) \ + { \ + return wrapper; \ + } \ +} + + #endif // LL_LLSTL_H diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 22c8681983cb8277d9fa478cad6cccf3396dda8b..76979f29f644df1effc3ac0e9abc10a0f1bf11b3 100755 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -28,15 +28,15 @@ #include "llstring.h" #include "llerror.h" +#include "llfasttimer.h" +#include "llsd.h" #if LL_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> +#include "llwin32headerslean.h" #include <winnls.h> // for WideCharToMultiByte #endif -LLFastTimer::DeclareTimer FT_STRING_FORMAT("String Format"); +LLTrace::BlockTimerStatHandle FT_STRING_FORMAT("String Format"); std::string ll_safe_string(const char* in) @@ -110,7 +110,7 @@ bool _read_file_into_string(std::string& str, const std::string& filename) llifstream ifs(filename, llifstream::binary); if (!ifs.is_open()) { - llinfos << "Unable to open file " << filename << llendl; + LL_INFOS() << "Unable to open file " << filename << LL_ENDL; return false; } @@ -188,7 +188,7 @@ S32 wchar_to_utf8chars(llwchar in_char, char* outchars) } else { - llwarns << "Invalid Unicode character " << cur_char << "!" << llendl; + LL_WARNS() << "Invalid Unicode character " << cur_char << "!" << LL_ENDL; *outchars++ = LL_UNKNOWN_CHAR; } return outchars - base; @@ -1195,7 +1195,7 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token, template<> S32 LLStringUtil::format(std::string& s, const format_map_t& substitutions) { - LLFastTimer ft(FT_STRING_FORMAT); + LL_RECORD_BLOCK_TIME(FT_STRING_FORMAT); S32 res = 0; std::string output; @@ -1268,7 +1268,7 @@ S32 LLStringUtil::format(std::string& s, const format_map_t& substitutions) template<> S32 LLStringUtil::format(std::string& s, const LLSD& substitutions) { - LLFastTimer ft(FT_STRING_FORMAT); + LL_RECORD_BLOCK_TIME(FT_STRING_FORMAT); S32 res = 0; if (!substitutions.isMap()) diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index 16a19e7021a85e1f39157f2217e16cfe7c44f457..0177f48bf5d08a722abb8de1f72c34bb9a3714fc 100755 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -29,10 +29,12 @@ #include <string> #include <cstdio> -#include <locale> +//#include <locale> #include <iomanip> -#include "llsd.h" -#include "llfasttimer.h" +#include <algorithm> +#include <vector> +#include <map> +#include "llformat.h" #if LL_LINUX || LL_SOLARIS #include <wctype.h> @@ -49,6 +51,7 @@ #endif const char LL_UNKNOWN_CHAR = '?'; +class LLSD; #if LL_DARWIN || LL_LINUX || LL_SOLARIS // Template specialization of char_traits for U16s. Only necessary on Mac and Linux (exists on Windows already) diff --git a/indra/llcommon/llstringtable.cpp b/indra/llcommon/llstringtable.cpp index 7ad3805351d543f357aa3fb596753692f7cf6c8b..f288999964b2dd5336fc6a03792f0160e2a6bf6f 100755 --- a/indra/llcommon/llstringtable.cpp +++ b/indra/llcommon/llstringtable.cpp @@ -317,7 +317,7 @@ void LLStringTable::removeString(const char *str) mUniqueEntries--; if (mUniqueEntries < 0) { - llerror("LLStringTable:removeString trying to remove too many strings!", 0); + LL_ERRS() << "LLStringTable:removeString trying to remove too many strings!" << LL_ENDL; } delete iter->second; mStringHash.erase(iter); @@ -343,7 +343,7 @@ void LLStringTable::removeString(const char *str) mUniqueEntries--; if (mUniqueEntries < 0) { - llerror("LLStringTable:removeString trying to remove too many strings!", 0); + LL_ERRS() << "LLStringTable:removeString trying to remove too many strings!" << LL_ENDL; } strlist->remove(entry); delete entry; diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index e63045659e22c803656405743660c8609fbb701b..07fe259e475e57f746bcbdf233574319103ed89d 100755 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -42,6 +42,7 @@ #include "llprocessor.h" #include "llerrorcontrol.h" #include "llevents.h" +#include "llformat.h" #include "lltimer.h" #include "llsdserialize.h" #include "llsdutil.h" @@ -58,9 +59,7 @@ using namespace llsd; #if LL_WINDOWS -# define WIN32_LEAN_AND_MEAN -# include <winsock2.h> -# include <windows.h> +# include "llwin32headerslean.h" # include <psapi.h> // GetPerformanceInfo() et al. #elif LL_DARWIN # include <errno.h> @@ -645,7 +644,7 @@ S32 LLOSInfo::getMaxOpenFiles() } else { - llerrs << "LLOSInfo::getMaxOpenFiles: sysconf error for _SC_OPEN_MAX" << llendl; + LL_ERRS() << "LLOSInfo::getMaxOpenFiles: sysconf error for _SC_OPEN_MAX" << LL_ENDL; } } } @@ -704,12 +703,12 @@ U32 LLOSInfo::getProcessVirtualSizeKB() sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); int proc_fd = -1; if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ - llwarns << "unable to open " << proc_ps << llendl; + LL_WARNS() << "unable to open " << proc_ps << LL_ENDL; return 0; } psinfo_t proc_psinfo; if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - llwarns << "Unable to read " << proc_ps << llendl; + LL_WARNS() << "Unable to read " << proc_ps << LL_ENDL; close(proc_fd); return 0; } @@ -750,12 +749,12 @@ U32 LLOSInfo::getProcessResidentSizeKB() sprintf(proc_ps, "/proc/%d/psinfo", (int)getpid()); int proc_fd = -1; if((proc_fd = open(proc_ps, O_RDONLY)) == -1){ - llwarns << "unable to open " << proc_ps << llendl; + LL_WARNS() << "unable to open " << proc_ps << LL_ENDL; return 0; } psinfo_t proc_psinfo; if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - llwarns << "Unable to read " << proc_ps << llendl; + LL_WARNS() << "Unable to read " << proc_ps << LL_ENDL; close(proc_fd); return 0; } @@ -870,7 +869,7 @@ LLMemoryInfo::LLMemoryInfo() } #if LL_WINDOWS -static U32 LLMemoryAdjustKBResult(U32 inKB) +static U32Kilobytes LLMemoryAdjustKBResult(U32Kilobytes inKB) { // Moved this here from llfloaterabout.cpp @@ -881,16 +880,16 @@ static U32 LLMemoryAdjustKBResult(U32 inKB) // returned from the GetMemoryStatusEx function. Here we keep the // original adjustment from llfoaterabout.cpp until this can be // fixed somehow. - inKB += 1024; + inKB += U32Megabytes(1); return inKB; } #endif -U32 LLMemoryInfo::getPhysicalMemoryKB() const +U32Kilobytes LLMemoryInfo::getPhysicalMemoryKB() const { #if LL_WINDOWS - return LLMemoryAdjustKBResult(mStatsMap["Total Physical KB"].asInteger()); + return LLMemoryAdjustKBResult(U32Kilobytes(mStatsMap["Total Physical KB"].asInteger())); #elif LL_DARWIN // This might work on Linux as well. Someone check... @@ -900,17 +899,17 @@ U32 LLMemoryInfo::getPhysicalMemoryKB() const size_t len = sizeof(phys); sysctl(mib, 2, &phys, &len, NULL, 0); - return (U32)(phys >> 10); + return U64Bytes(phys); #elif LL_LINUX U64 phys = 0; phys = (U64)(getpagesize()) * (U64)(get_phys_pages()); - return (U32)(phys >> 10); + return U64Bytes(phys); #elif LL_SOLARIS U64 phys = 0; phys = (U64)(getpagesize()) * (U64)(sysconf(_SC_PHYS_PAGES)); - return (U32)(phys >> 10); + return U64Bytes(phys); #else return 0; @@ -918,32 +917,32 @@ U32 LLMemoryInfo::getPhysicalMemoryKB() const #endif } -U32 LLMemoryInfo::getPhysicalMemoryClamped() const +U32Bytes LLMemoryInfo::getPhysicalMemoryClamped() const { // Return the total physical memory in bytes, but clamp it // to no more than U32_MAX - U32 phys_kb = getPhysicalMemoryKB(); - if (phys_kb >= 4194304 /* 4GB in KB */) + U32Kilobytes phys_kb = getPhysicalMemoryKB(); + if (phys_kb >= U32Gigabytes(4)) { - return U32_MAX; + return U32Bytes(U32_MAX); } else { - return phys_kb << 10; + return phys_kb; } } //static -void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) +void LLMemoryInfo::getAvailableMemoryKB(U32Kilobytes& avail_physical_mem_kb, U32Kilobytes& avail_virtual_mem_kb) { #if LL_WINDOWS // Sigh, this shouldn't be a static method, then we wouldn't have to // reload this data separately from refresh() LLSD statsMap(loadStatsMap()); - avail_physical_mem_kb = statsMap["Avail Physical KB"].asInteger(); - avail_virtual_mem_kb = statsMap["Avail Virtual KB"].asInteger(); + avail_physical_mem_kb = (U32Kilobytes)statsMap["Avail Physical KB"].asInteger(); + avail_virtual_mem_kb = (U32Kilobytes)statsMap["Avail Virtual KB"].asInteger(); #elif LL_DARWIN // mStatsMap is derived from vm_stat, look for (e.g.) "kb free": @@ -960,8 +959,8 @@ void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_v // Pageins: 2097212. // Pageouts: 41759. // Object cache: 841598 hits of 7629869 lookups (11% hit rate) - avail_physical_mem_kb = -1 ; - avail_virtual_mem_kb = -1 ; + avail_physical_mem_kb = (U32Kilobytes)-1 ; + avail_virtual_mem_kb = (U32Kilobytes)-1 ; #elif LL_LINUX // mStatsMap is derived from MEMINFO_FILE: @@ -1012,15 +1011,15 @@ void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_v // DirectMap4k: 434168 kB // DirectMap2M: 477184 kB // (could also run 'free', but easier to read a file than run a program) - avail_physical_mem_kb = -1 ; - avail_virtual_mem_kb = -1 ; + avail_physical_mem_kb = (U32Kilobytes)-1 ; + avail_virtual_mem_kb = (U32Kilobytes)-1 ; #else //do not know how to collect available memory info for other systems. //leave it blank here for now. - avail_physical_mem_kb = -1 ; - avail_virtual_mem_kb = -1 ; + avail_physical_mem_kb = (U32Kilobytes)-1 ; + avail_virtual_mem_kb = (U32Kilobytes)-1 ; #endif } @@ -1433,9 +1432,14 @@ class FrameWatcher LL_CONT << "slowest framerate for last " << int(prevSize * MEM_INFO_THROTTLE) << " seconds "; } + + S32 precision = LL_CONT.precision(); + LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' - << LLMemoryInfo() << LL_ENDL; + << LLMemoryInfo(); + LL_CONT.precision(precision); + LL_CONT << LL_ENDL; return false; } @@ -1482,7 +1486,7 @@ BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile) size_t nwrit = fwrite(buffer, sizeof(U8), bytes, dst); if (nwrit < (size_t) bytes) { - llwarns << "Short write on " << tmpfile << ": Wrote " << nwrit << " of " << bytes << " bytes." << llendl; + LL_WARNS() << "Short write on " << tmpfile << ": Wrote " << nwrit << " of " << bytes << " bytes." << LL_ENDL; goto err; } } while(gzeof(src) == 0); @@ -1515,14 +1519,14 @@ BOOL gzip_file(const std::string& srcfile, const std::string& dstfile) { if (gzwrite(dst, buffer, bytes) <= 0) { - llwarns << "gzwrite failed: " << gzerror(dst, NULL) << llendl; + LL_WARNS() << "gzwrite failed: " << gzerror(dst, NULL) << LL_ENDL; goto err; } } if (ferror(src)) { - llwarns << "Error reading " << srcfile << llendl; + LL_WARNS() << "Error reading " << srcfile << LL_ENDL; goto err; } diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index cfed0fff179b04e9522db33950582706bc33ba77..962367f69fe37a5af9af741e73d8f7017611218e 100755 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -33,7 +33,7 @@ // use an LLCPUInfo object: // // LLCPUInfo info; -// llinfos << info << llendl; +// LL_INFOS() << info << LL_ENDL; // #include "llsd.h" @@ -105,22 +105,22 @@ class LL_COMMON_API LLMemoryInfo Here's how you use an LLMemoryInfo: LLMemoryInfo info; -<br> llinfos << info << llendl; +<br> LL_INFOS() << info << LL_ENDL; */ { public: LLMemoryInfo(); ///< Default constructor void stream(std::ostream& s) const; ///< output text info to s - U32 getPhysicalMemoryKB() const; ///< Memory size in KiloBytes + U32Kilobytes getPhysicalMemoryKB() const; /*! Memory size in bytes, if total memory is >= 4GB then U32_MAX will ** be returned. */ - U32 getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes + U32Bytes getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes //get the available memory infomation in KiloBytes. - static void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb); + static void getAvailableMemoryKB(U32Kilobytes& avail_physical_mem_kb, U32Kilobytes& avail_virtual_mem_kb); // Retrieve a map of memory statistics. The keys of the map are platform- // dependent. The values are in kilobytes to try to avoid integer overflow. diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index e67d1bc57b25a702874168eef49e977172520149..51c89e1eaf42ae2528c4b11962278b5d38b56a51 100755 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -29,13 +29,49 @@ #include "apr_portable.h" #include "llthread.h" +#include "llmutex.h" #include "lltimer.h" +#include "lltrace.h" +#include "lltracethreadrecorder.h" #if LL_LINUX || LL_SOLARIS #include <sched.h> #endif + +#ifdef LL_WINDOWS +const DWORD MS_VC_EXCEPTION=0x406D1388; + +#pragma pack(push,8) +typedef struct tagTHREADNAME_INFO +{ + DWORD dwType; // Must be 0x1000. + LPCSTR szName; // Pointer to name (in user addr space). + DWORD dwThreadID; // Thread ID (-1=caller thread). + DWORD dwFlags; // Reserved for future use, must be zero. +} THREADNAME_INFO; +#pragma pack(pop) + +void set_thread_name( DWORD dwThreadID, const char* threadName) +{ + THREADNAME_INFO info; + info.dwType = 0x1000; + info.szName = threadName; + info.dwThreadID = dwThreadID; + info.dwFlags = 0; + + __try + { + ::RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(DWORD), (DWORD*)&info ); + } + __except(EXCEPTION_CONTINUE_EXECUTION) + { + } +} +#endif + + //---------------------------------------------------------------------------- // Usage: // void run_func(LLThread* thread) @@ -56,19 +92,24 @@ // //---------------------------------------------------------------------------- -#if !LL_DARWIN -U32 ll_thread_local sThreadID = 0; +#if LL_DARWIN +// statically allocated thread local storage not supported in Darwin executable formats +#elif LL_WINDOWS +U32 __declspec(thread) sThreadID = 0; +#elif LL_LINUX +U32 __thread sThreadID = 0; #endif U32 LLThread::sIDIter = 0; + LL_COMMON_API void assert_main_thread() { static U32 s_thread_id = LLThread::currentID(); if (LLThread::currentID() != s_thread_id) { - llwarns << "Illegal execution from thread id " << (S32) LLThread::currentID() - << " outside main thread " << (S32) s_thread_id << llendl; + LL_WARNS() << "Illegal execution from thread id " << (S32) LLThread::currentID() + << " outside main thread " << (S32) s_thread_id << LL_ENDL; } } @@ -86,6 +127,13 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap { LLThread *threadp = (LLThread *)datap; +#ifdef LL_WINDOWS + set_thread_name(-1, threadp->mName.c_str()); +#endif + + // for now, hard code all LLThreads to report to single master thread recorder, which is known to be running on main thread + threadp->mRecorder = new LLTrace::ThreadRecorder(*LLTrace::get_master_thread_recorder()); + #if !LL_DARWIN sThreadID = threadp->mID; #endif @@ -93,21 +141,26 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap // Run the user supplied function threadp->run(); - //llinfos << "LLThread::staticRun() Exiting: " << threadp->mName << llendl; + //LL_INFOS() << "LLThread::staticRun() Exiting: " << threadp->mName << LL_ENDL; + + delete threadp->mRecorder; + threadp->mRecorder = NULL; // We're done with the run function, this thread is done executing now. + //NB: we are using this flag to sync across threads...we really need memory barriers here threadp->mStatus = STOPPED; return NULL; } - LLThread::LLThread(const std::string& name, apr_pool_t *poolp) : mPaused(FALSE), mName(name), mAPRThreadp(NULL), - mStatus(STOPPED) + mStatus(STOPPED), + mRecorder(NULL) { + mID = ++sIDIter; // Thread creation probably CAN be paranoid about APR being initialized, if necessary @@ -150,10 +203,10 @@ void LLThread::shutdown() // First, set the flag that indicates that we're ready to die setQuitting(); - //llinfos << "LLThread::~LLThread() Killing thread " << mName << " Status: " << mStatus << llendl; + //LL_INFOS() << "LLThread::~LLThread() Killing thread " << mName << " Status: " << mStatus << LL_ENDL; // Now wait a bit for the thread to exit // It's unclear whether I should even bother doing this - this destructor - // should netver get called unless we're already stopped, really... + // should never get called unless we're already stopped, really... S32 counter = 0; const S32 MAX_WAIT = 600; while (counter < MAX_WAIT) @@ -172,8 +225,10 @@ void LLThread::shutdown() if (!isStopped()) { // This thread just wouldn't stop, even though we gave it time - //llwarns << "LLThread::~LLThread() exiting thread before clean exit!" << llendl; + //LL_WARNS() << "LLThread::~LLThread() exiting thread before clean exit!" << LL_ENDL; // Put a stake in its heart. + delete mRecorder; + apr_thread_exit(mAPRThreadp, -1); return; } @@ -191,6 +246,14 @@ void LLThread::shutdown() apr_pool_destroy(mAPRPoolp); mAPRPoolp = 0; } + + if (mRecorder) + { + // missed chance to properly shut down recorder (needs to be done in thread context) + // probably due to abnormal thread termination + // so just leak it and remove it from parent + LLTrace::get_master_thread_recorder()->removeChildRecorder(mRecorder); + } } @@ -212,9 +275,10 @@ void LLThread::start() else { mStatus = STOPPED; - llwarns << "failed to start thread " << mName << llendl; + LL_WARNS() << "failed to start thread " << mName << LL_ENDL; ll_apr_warn_status(status); } + } //============================================================================ @@ -283,7 +347,13 @@ void LLThread::setQuitting() // static U32 LLThread::currentID() { +#if LL_DARWIN + // statically allocated thread local storage not supported in Darwin executable formats return (U32)apr_os_thread_current(); +#else + return sThreadID; +#endif + } // static @@ -316,185 +386,6 @@ void LLThread::wakeLocked() //============================================================================ -LLMutex::LLMutex(apr_pool_t *poolp) : - mAPRMutexp(NULL), mCount(0), mLockingThread(NO_THREAD) -{ - //if (poolp) - //{ - // mIsLocalPool = FALSE; - // mAPRPoolp = poolp; - //} - //else - { - mIsLocalPool = TRUE; - apr_pool_create(&mAPRPoolp, NULL); // Create a subpool for this thread - } - apr_thread_mutex_create(&mAPRMutexp, APR_THREAD_MUTEX_UNNESTED, mAPRPoolp); -} - - -LLMutex::~LLMutex() -{ -#if MUTEX_DEBUG - //bad assertion, the subclass LLSignal might be "locked", and that's OK - //llassert_always(!isLocked()); // better not be locked! -#endif - apr_thread_mutex_destroy(mAPRMutexp); - mAPRMutexp = NULL; - if (mIsLocalPool) - { - apr_pool_destroy(mAPRPoolp); - } -} - - -void LLMutex::lock() -{ - if(isSelfLocked()) - { //redundant lock - mCount++; - return; - } - - apr_thread_mutex_lock(mAPRMutexp); - -#if MUTEX_DEBUG - // Have to have the lock before we can access the debug info - U32 id = LLThread::currentID(); - if (mIsLocked[id] != FALSE) - llerrs << "Already locked in Thread: " << id << llendl; - mIsLocked[id] = TRUE; -#endif - -#if LL_DARWIN - mLockingThread = LLThread::currentID(); -#else - mLockingThread = sThreadID; -#endif -} - -bool LLMutex::trylock() -{ - if(isSelfLocked()) - { //redundant lock - mCount++; - return true; - } - - apr_status_t status(apr_thread_mutex_trylock(mAPRMutexp)); - if (APR_STATUS_IS_EBUSY(status)) - { - return false; - } - -#if MUTEX_DEBUG - // Have to have the lock before we can access the debug info - U32 id = LLThread::currentID(); - if (mIsLocked[id] != FALSE) - llerrs << "Already locked in Thread: " << id << llendl; - mIsLocked[id] = TRUE; -#endif - -#if LL_DARWIN - mLockingThread = LLThread::currentID(); -#else - mLockingThread = sThreadID; -#endif - return true; -} - -void LLMutex::unlock() -{ - if (mCount > 0) - { //not the root unlock - mCount--; - return; - } - -#if MUTEX_DEBUG - // Access the debug info while we have the lock - U32 id = LLThread::currentID(); - if (mIsLocked[id] != TRUE) - llerrs << "Not locked in Thread: " << id << llendl; - mIsLocked[id] = FALSE; -#endif - - mLockingThread = NO_THREAD; - apr_thread_mutex_unlock(mAPRMutexp); -} - -bool LLMutex::isLocked() -{ - apr_status_t status = apr_thread_mutex_trylock(mAPRMutexp); - if (APR_STATUS_IS_EBUSY(status)) - { - return true; - } - else - { - apr_thread_mutex_unlock(mAPRMutexp); - return false; - } -} - -bool LLMutex::isSelfLocked() -{ -#if LL_DARWIN - return mLockingThread == LLThread::currentID(); -#else - return mLockingThread == sThreadID; -#endif -} - -U32 LLMutex::lockingThread() const -{ - return mLockingThread; -} - -//============================================================================ - -LLCondition::LLCondition(apr_pool_t *poolp) : - LLMutex(poolp) -{ - // base class (LLMutex) has already ensured that mAPRPoolp is set up. - - apr_thread_cond_create(&mAPRCondp, mAPRPoolp); -} - - -LLCondition::~LLCondition() -{ - apr_thread_cond_destroy(mAPRCondp); - mAPRCondp = NULL; -} - - -void LLCondition::wait() -{ - if (!isLocked()) - { //mAPRMutexp MUST be locked before calling apr_thread_cond_wait - apr_thread_mutex_lock(mAPRMutexp); -#if MUTEX_DEBUG - // avoid asserts on destruction in non-release builds - U32 id = LLThread::currentID(); - mIsLocked[id] = TRUE; -#endif - } - apr_thread_cond_wait(mAPRCondp, mAPRMutexp); -} - -void LLCondition::signal() -{ - apr_thread_cond_signal(mAPRCondp); -} - -void LLCondition::broadcast() -{ - apr_thread_cond_broadcast(mAPRCondp); -} - -//============================================================================ - //---------------------------------------------------------------------------- //static @@ -533,11 +424,10 @@ LLThreadSafeRefCount::~LLThreadSafeRefCount() { if (mRef != 0) { - llerrs << "deleting non-zero reference" << llendl; + LL_ERRS() << "deleting non-zero reference" << LL_ENDL; } } - //============================================================================ LLResponder::~LLResponder() diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 8c7143304f34b550dc1c32cd06d88afcb81ea279..6f9ec10fd3be441656e8db27bb6b9a198d3cff52 100755 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -31,20 +31,20 @@ #include "llapr.h" #include "apr_thread_cond.h" #include "boost/intrusive_ptr.hpp" +#include "llmutex.h" +#include "llrefcount.h" -class LLThread; -class LLMutex; -class LLCondition; +LL_COMMON_API void assert_main_thread(); -#if LL_WINDOWS -#define ll_thread_local __declspec(thread) -#else -#define ll_thread_local __thread -#endif +namespace LLTrace +{ + class ThreadRecorder; +} class LL_COMMON_API LLThread { private: + friend class LLMutex; static U32 sIDIter; public: @@ -98,11 +98,11 @@ class LL_COMMON_API LLThread BOOL mPaused; // static function passed to APR thread creation routine - static void *APR_THREAD_FUNC staticRun(apr_thread_t *apr_threadp, void *datap); + static void *APR_THREAD_FUNC staticRun(struct apr_thread_t *apr_threadp, void *datap); protected: std::string mName; - LLCondition* mRunCondition; + class LLCondition* mRunCondition; LLMutex* mDataLock; apr_thread_t *mAPRThreadp; @@ -110,6 +110,7 @@ class LL_COMMON_API LLThread BOOL mIsLocalPool; EThreadStatus mStatus; U32 mID; + LLTrace::ThreadRecorder* mRecorder; //a local apr_pool for APRFile operations in this thread. If it exists, LLAPRFile::sAPRFilePoolp should not be used. //Note: this pool is used by APRFile ONLY, do NOT use it for any other purposes. @@ -140,117 +141,6 @@ class LL_COMMON_API LLThread // mDataLock->unlock(); }; -//============================================================================ - -#define MUTEX_DEBUG (LL_DEBUG || LL_RELEASE_WITH_DEBUG_INFO) - -class LL_COMMON_API LLMutex -{ -public: - typedef enum - { - NO_THREAD = 0xFFFFFFFF - } e_locking_thread; - - LLMutex(apr_pool_t *apr_poolp); // NULL pool constructs a new pool for the mutex - virtual ~LLMutex(); - - void lock(); // blocks - bool trylock(); // non-blocking, returns true if lock held. - void unlock(); // undefined behavior when called on mutex not being held - bool isLocked(); // non-blocking, but does do a lock/unlock so not free - bool isSelfLocked(); //return true if locked in a same thread - U32 lockingThread() const; //get ID of locking thread - -protected: - apr_thread_mutex_t *mAPRMutexp; - mutable U32 mCount; - mutable U32 mLockingThread; - - apr_pool_t *mAPRPoolp; - BOOL mIsLocalPool; - -#if MUTEX_DEBUG - std::map<U32, BOOL> mIsLocked; -#endif -}; - -//============================================================================ - -// Actually a condition/mutex pair (since each condition needs to be associated with a mutex). -class LL_COMMON_API LLCondition : public LLMutex -{ -public: - LLCondition(apr_pool_t *apr_poolp); // Defaults to global pool, could use the thread pool as well. - ~LLCondition(); - - void wait(); // blocks - void signal(); - void broadcast(); - -protected: - apr_thread_cond_t *mAPRCondp; -}; - -//============================================================================ - -class LLMutexLock -{ -public: - LLMutexLock(LLMutex* mutex) - { - mMutex = mutex; - - if(mMutex) - mMutex->lock(); - } - ~LLMutexLock() - { - if(mMutex) - mMutex->unlock(); - } -private: - LLMutex* mMutex; -}; - -//============================================================================ - -// Scoped locking class similar in function to LLMutexLock but uses -// the trylock() method to conditionally acquire lock without -// blocking. Caller resolves the resulting condition by calling -// the isLocked() method and either punts or continues as indicated. -// -// Mostly of interest to callers needing to avoid stalls who can -// guarantee another attempt at a later time. - -class LLMutexTrylock -{ -public: - LLMutexTrylock(LLMutex* mutex) - : mMutex(mutex), - mLocked(false) - { - if (mMutex) - mLocked = mMutex->trylock(); - } - - ~LLMutexTrylock() - { - if (mMutex && mLocked) - mMutex->unlock(); - } - - bool isLocked() const - { - return mLocked; - } - -private: - LLMutex* mMutex; - bool mLocked; -}; - -//============================================================================ void LLThread::lockData() { @@ -265,76 +155,6 @@ void LLThread::unlockData() //============================================================================ -// see llmemory.h for LLPointer<> definition - -class LL_COMMON_API LLThreadSafeRefCount -{ -public: - static void initThreadSafeRefCount(); // creates sMutex - static void cleanupThreadSafeRefCount(); // destroys sMutex - -private: - static LLMutex* sMutex; - -protected: - virtual ~LLThreadSafeRefCount(); // use unref() - -public: - LLThreadSafeRefCount(); - LLThreadSafeRefCount(const LLThreadSafeRefCount&); - LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref) - { - mRef = 0; - return *this; - } - - void ref() - { - mRef++; - } - - void unref() - { - llassert(mRef >= 1); - if ((--mRef) == 0) // See note in llapr.h on atomic decrement operator return value. - { - // If we hit zero, the caller should be the only smart pointer owning the object and we can delete it. - // It is technically possible for a vanilla pointer to mess this up, or another thread to - // jump in, find this object, create another smart pointer and end up dangling, but if - // the code is that bad and not thread-safe, it's trouble already. - delete this; - } - } - - S32 getNumRefs() const - { - const S32 currentVal = mRef.CurrentValue(); - return currentVal; - } - -private: - LLAtomic32< S32 > mRef; -}; - - -/** - * intrusive pointer support for LLThreadSafeRefCount - * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type - */ -namespace boost -{ - inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p) - { - p->ref(); - } - - inline void intrusive_ptr_release(LLThreadSafeRefCount* p) - { - p->unref(); - } -}; -//============================================================================ - // Simple responder for self destructing callbacks // Pure virtual class class LL_COMMON_API LLResponder : public LLThreadSafeRefCount diff --git a/indra/llcommon/llthreadlocalstorage.cpp b/indra/llcommon/llthreadlocalstorage.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8cef05caac272241f62e8349d1b46315dc4b65c0 --- /dev/null +++ b/indra/llcommon/llthreadlocalstorage.cpp @@ -0,0 +1,119 @@ +/** + * @file llthreadlocalstorage.cpp + * @author Richard + * @date 2013-1-11 + * @brief implementation of thread local storage utility classes + * + * $LicenseInfo:firstyear=2013&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include "llthreadlocalstorage.h" +#include "llapr.h" + +// +//LLThreadLocalPointerBase +// +bool LLThreadLocalPointerBase::sInitialized = false; + +void LLThreadLocalPointerBase::set( void* value ) +{ + llassert(sInitialized && mThreadKey); + + apr_status_t result = apr_threadkey_private_set((void*)value, mThreadKey); + if (result != APR_SUCCESS) + { + ll_apr_warn_status(result); + LL_ERRS() << "Failed to set thread local data" << LL_ENDL; + } +} + +void* LLThreadLocalPointerBase::get() const +{ + // llassert(sInitialized); + void* ptr; + apr_status_t result = + apr_threadkey_private_get(&ptr, mThreadKey); + if (result != APR_SUCCESS) + { + ll_apr_warn_status(result); + LL_ERRS() << "Failed to get thread local data" << LL_ENDL; + } + return ptr; +} + + +void LLThreadLocalPointerBase::initStorage( ) +{ + apr_status_t result = apr_threadkey_private_create(&mThreadKey, NULL, gAPRPoolp); + if (result != APR_SUCCESS) + { + ll_apr_warn_status(result); + LL_ERRS() << "Failed to allocate thread local data" << LL_ENDL; + } +} + +void LLThreadLocalPointerBase::destroyStorage() +{ + if (sInitialized) + { + if (mThreadKey) + { + apr_status_t result = apr_threadkey_private_delete(mThreadKey); + if (result != APR_SUCCESS) + { + ll_apr_warn_status(result); + LL_ERRS() << "Failed to delete thread local data" << LL_ENDL; + } + } + } +} + +//static +void LLThreadLocalPointerBase::initAllThreadLocalStorage() +{ + if (!sInitialized) + { + for (LLInstanceTracker<LLThreadLocalPointerBase>::instance_iter it = beginInstances(), end_it = endInstances(); + it != end_it; + ++it) + { + (*it).initStorage(); + } + sInitialized = true; + } +} + +//static +void LLThreadLocalPointerBase::destroyAllThreadLocalStorage() +{ + if (sInitialized) + { + //for (LLInstanceTracker<LLThreadLocalPointerBase>::instance_iter it = beginInstances(), end_it = endInstances(); + // it != end_it; + // ++it) + //{ + // (*it).destroyStorage(); + //} + sInitialized = false; + } +} diff --git a/indra/llcommon/llthreadlocalstorage.h b/indra/llcommon/llthreadlocalstorage.h new file mode 100644 index 0000000000000000000000000000000000000000..ec3b52c8cb74a5fc363217f488e6ca48a6020f59 --- /dev/null +++ b/indra/llcommon/llthreadlocalstorage.h @@ -0,0 +1,185 @@ +/** + * @file llthreadlocalstorage.h + * @author Richard + * @brief Class wrappers for thread local storage + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTHREADLOCALSTORAGE_H +#define LL_LLTHREADLOCALSTORAGE_H + +#include "llinstancetracker.h" + +class LLThreadLocalPointerBase : public LLInstanceTracker<LLThreadLocalPointerBase> +{ +public: + LLThreadLocalPointerBase() + : mThreadKey(NULL) + { + if (sInitialized) + { + initStorage(); + } + } + + LLThreadLocalPointerBase( const LLThreadLocalPointerBase& other) + : mThreadKey(NULL) + { + if (sInitialized) + { + initStorage(); + } + } + + ~LLThreadLocalPointerBase() + { + destroyStorage(); + } + + static void initAllThreadLocalStorage(); + static void destroyAllThreadLocalStorage(); + +protected: + void set(void* value); + + void* get() const; + + void initStorage(); + void destroyStorage(); + +protected: + struct apr_threadkey_t* mThreadKey; + static bool sInitialized; +}; + +template <typename T> +class LLThreadLocalPointer : public LLThreadLocalPointerBase +{ +public: + + LLThreadLocalPointer() + {} + + explicit LLThreadLocalPointer(T* value) + { + set(value); + } + + + LLThreadLocalPointer(const LLThreadLocalPointer<T>& other) + : LLThreadLocalPointerBase(other) + { + set(other.get()); + } + + LL_FORCE_INLINE T* get() const + { + return (T*)LLThreadLocalPointerBase::get(); + } + + T* operator -> () const + { + return (T*)get(); + } + + T& operator*() const + { + return *(T*)get(); + } + + LLThreadLocalPointer<T>& operator = (T* value) + { + set((void*)value); + return *this; + } + + bool operator ==(const T* other) const + { + if (!sInitialized) return false; + return get() == other; + } + + bool isNull() const { return !sInitialized || get() == NULL; } + + bool notNull() const { return sInitialized && get() != NULL; } +}; + +template<typename DERIVED_TYPE> +class LLThreadLocalSingletonPointer +{ +public: + LL_FORCE_INLINE static DERIVED_TYPE* getInstance() + { +#if LL_DARWIN + createTLSKey(); + return (DERIVED_TYPE*)pthread_getspecific(sInstanceKey); +#else + return sInstance; +#endif + } + + static void setInstance(DERIVED_TYPE* instance) + { +#if LL_DARWIN + createTLSKey(); + pthread_setspecific(sInstanceKey, (void*)instance); +#else + sInstance = instance; +#endif + } + +private: + +#if LL_WINDOWS + static __declspec(thread) DERIVED_TYPE* sInstance; +#elif LL_LINUX + static __thread DERIVED_TYPE* sInstance; +#elif LL_DARWIN + static void TLSError() + { + LL_ERRS() << "Could not create thread local storage" << LL_ENDL; + } + static void createTLSKey() + { + static S32 key_created = pthread_key_create(&sInstanceKey, NULL); + if (key_created != 0) + { + LL_ERRS() << "Could not create thread local storage" << LL_ENDL; + } + } + static pthread_key_t sInstanceKey; +#endif +}; + +#if LL_WINDOWS +template<typename DERIVED_TYPE> +__declspec(thread) DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL; +#elif LL_LINUX +template<typename DERIVED_TYPE> +__thread DERIVED_TYPE* LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstance = NULL; +#elif LL_DARWIN +template<typename DERIVED_TYPE> +pthread_key_t LLThreadLocalSingletonPointer<DERIVED_TYPE>::sInstanceKey; +#endif + +#endif // LL_LLTHREADLOCALSTORAGE_H diff --git a/indra/llcommon/llthreadsafequeue.cpp b/indra/llcommon/llthreadsafequeue.cpp index 8a73e632a9ada2249b4353f88828d5d66fcfe00d..185f0d63fb4d536d9ac11ce064c2666ff15e7bc7 100755 --- a/indra/llcommon/llthreadsafequeue.cpp +++ b/indra/llcommon/llthreadsafequeue.cpp @@ -54,7 +54,7 @@ LLThreadSafeQueueImplementation::LLThreadSafeQueueImplementation(apr_pool_t * po LLThreadSafeQueueImplementation::~LLThreadSafeQueueImplementation() { if(mQueue != 0) { - if(apr_queue_size(mQueue) != 0) llwarns << + if(apr_queue_size(mQueue) != 0) LL_WARNS() << "terminating queue which still contains " << apr_queue_size(mQueue) << " elements;" << "memory will be leaked" << LL_ENDL; apr_queue_term(mQueue); diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 9ebc6de7f40826a4829cdc0603fc371c405957e1..ab105a82e6c371d323c0a6b6a440b51ce02f1f8f 100755 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -31,11 +31,9 @@ #include "u64.h" #if LL_WINDOWS -# define WIN32_LEAN_AND_MEAN -# include <winsock2.h> -# include <windows.h> +# include "llwin32headerslean.h" #elif LL_LINUX || LL_SOLARIS || LL_DARWIN -# include <errno.h> +# include <errno.h> # include <sys/time.h> #else # error "architecture not supported" @@ -45,7 +43,6 @@ // // Locally used constants // -const U32 SEC_PER_DAY = 86400; const F64 SEC_TO_MICROSEC = 1000000.f; const U64 SEC_TO_MICROSEC_U64 = 1000000; const F64 USEC_TO_SEC_F64 = 0.000001; @@ -58,11 +55,6 @@ const F64 USEC_TO_SEC_F64 = 0.000001; S32 gUTCOffset = 0; // viewer's offset from server UTC, in seconds LLTimer* LLTimer::sTimer = NULL; -F64 gClockFrequency = 0.0; -F64 gClockFrequencyInv = 0.0; -F64 gClocksToMicroseconds = 0.0; -U64 gTotalTimeClockCount = 0; -U64 gLastTotalTimeClockCount = 0; // // Forward declarations @@ -190,7 +182,7 @@ U64 get_clock_count() return clock_count.QuadPart - offset; } -F64 calc_clock_frequency(U32 uiMeasureMSecs) +F64 calc_clock_frequency() { __int64 freq; QueryPerformanceFrequency((LARGE_INTEGER *) &freq); @@ -201,7 +193,7 @@ F64 calc_clock_frequency(U32 uiMeasureMSecs) #if LL_LINUX || LL_DARWIN || LL_SOLARIS // Both Linux and Mac use gettimeofday for accurate time -F64 calc_clock_frequency(unsigned int uiMeasureMSecs) +F64 calc_clock_frequency() { return 1000000.0; // microseconds, so 1 MHz. } @@ -216,56 +208,68 @@ U64 get_clock_count() #endif -void update_clock_frequencies() +TimerInfo::TimerInfo() +: mClockFrequency(0.0), + mTotalTimeClockCount(0), + mLastTotalTimeClockCount(0) +{} + +void TimerInfo::update() { - gClockFrequency = calc_clock_frequency(50U); - gClockFrequencyInv = 1.0/gClockFrequency; - gClocksToMicroseconds = gClockFrequencyInv * SEC_TO_MICROSEC; + mClockFrequency = calc_clock_frequency(); + mClockFrequencyInv = 1.0/mClockFrequency; + mClocksToMicroseconds = mClockFrequencyInv; } +TimerInfo& get_timer_info() +{ + static TimerInfo sTimerInfo; + return sTimerInfo; +} /////////////////////////////////////////////////////////////////////////////// // returns a U64 number that represents the number of -// microseconds since the unix epoch - Jan 1, 1970 -U64 totalTime() +// microseconds since the Unix epoch - Jan 1, 1970 +U64MicrosecondsImplicit totalTime() { U64 current_clock_count = get_clock_count(); - if (!gTotalTimeClockCount) + if (!get_timer_info().mTotalTimeClockCount || get_timer_info().mClocksToMicroseconds.value() == 0) { - update_clock_frequencies(); - gTotalTimeClockCount = current_clock_count; + get_timer_info().update(); + get_timer_info().mTotalTimeClockCount = current_clock_count; #if LL_WINDOWS - // Synch us up with local time (even though we PROBABLY don't need to, this is how it was implemented) + // Sync us up with local time (even though we PROBABLY don't need to, this is how it was implemented) // Unix platforms use gettimeofday so they are synced, although this probably isn't a good assumption to // make in the future. - gTotalTimeClockCount = (U64)(time(NULL) * gClockFrequency); + get_timer_info().mTotalTimeClockCount = (U64)(time(NULL) * get_timer_info().mClockFrequency); #endif // Update the last clock count - gLastTotalTimeClockCount = current_clock_count; + get_timer_info().mLastTotalTimeClockCount = current_clock_count; } else { - if (current_clock_count >= gLastTotalTimeClockCount) + if (current_clock_count >= get_timer_info().mLastTotalTimeClockCount) { // No wrapping, we're all okay. - gTotalTimeClockCount += current_clock_count - gLastTotalTimeClockCount; + get_timer_info().mTotalTimeClockCount += current_clock_count - get_timer_info().mLastTotalTimeClockCount; } else { // We've wrapped. Compensate correctly - gTotalTimeClockCount += (0xFFFFFFFFFFFFFFFFULL - gLastTotalTimeClockCount) + current_clock_count; + get_timer_info().mTotalTimeClockCount += (0xFFFFFFFFFFFFFFFFULL - get_timer_info().mLastTotalTimeClockCount) + current_clock_count; } // Update the last clock count - gLastTotalTimeClockCount = current_clock_count; + get_timer_info().mLastTotalTimeClockCount = current_clock_count; } // Return the total clock tick count in microseconds. - return (U64)(gTotalTimeClockCount*gClocksToMicroseconds); + U64Microseconds time(get_timer_info().mTotalTimeClockCount*get_timer_info().mClocksToMicroseconds); + return time; } @@ -273,9 +277,9 @@ U64 totalTime() LLTimer::LLTimer() { - if (!gClockFrequency) + if (!get_timer_info().mClockFrequency) { - update_clock_frequencies(); + get_timer_info().update(); } mStarted = TRUE; @@ -283,20 +287,32 @@ LLTimer::LLTimer() } LLTimer::~LLTimer() +{} + +// static +void LLTimer::initClass() +{ + if (!sTimer) sTimer = new LLTimer; +} + +// static +void LLTimer::cleanupClass() { + delete sTimer; sTimer = NULL; } // static -U64 LLTimer::getTotalTime() +U64MicrosecondsImplicit LLTimer::getTotalTime() { // simply call into the implementation function. - return totalTime(); + U64MicrosecondsImplicit total_time = totalTime(); + return total_time; } // static -F64 LLTimer::getTotalSeconds() +F64SecondsImplicit LLTimer::getTotalSeconds() { - return U64_to_F64(getTotalTime()) * USEC_TO_SEC_F64; + return F64Microseconds(U64_to_F64(getTotalTime())); } void LLTimer::reset() @@ -343,43 +359,43 @@ U64 getElapsedTimeAndUpdate(U64& lastClockCount) } -F64 LLTimer::getElapsedTimeF64() const +F64SecondsImplicit LLTimer::getElapsedTimeF64() const { U64 last = mLastClockCount; - return (F64)getElapsedTimeAndUpdate(last) * gClockFrequencyInv; + return (F64)getElapsedTimeAndUpdate(last) * get_timer_info().mClockFrequencyInv; } -F32 LLTimer::getElapsedTimeF32() const +F32SecondsImplicit LLTimer::getElapsedTimeF32() const { return (F32)getElapsedTimeF64(); } -F64 LLTimer::getElapsedTimeAndResetF64() +F64SecondsImplicit LLTimer::getElapsedTimeAndResetF64() { - return (F64)getElapsedTimeAndUpdate(mLastClockCount) * gClockFrequencyInv; + return (F64)getElapsedTimeAndUpdate(mLastClockCount) * get_timer_info().mClockFrequencyInv; } -F32 LLTimer::getElapsedTimeAndResetF32() +F32SecondsImplicit LLTimer::getElapsedTimeAndResetF32() { return (F32)getElapsedTimeAndResetF64(); } /////////////////////////////////////////////////////////////////////////////// -void LLTimer::setTimerExpirySec(F32 expiration) +void LLTimer::setTimerExpirySec(F32SecondsImplicit expiration) { mExpirationTicks = get_clock_count() - + (U64)((F32)(expiration * gClockFrequency)); + + (U64)((F32)(expiration * get_timer_info().mClockFrequency.value())); } -F32 LLTimer::getRemainingTimeF32() const +F32SecondsImplicit LLTimer::getRemainingTimeF32() const { U64 cur_ticks = get_clock_count(); if (cur_ticks > mExpirationTicks) { return 0.0f; } - return F32((mExpirationTicks - cur_ticks) * gClockFrequencyInv); + return F32((mExpirationTicks - cur_ticks) * get_timer_info().mClockFrequencyInv); } @@ -392,7 +408,7 @@ BOOL LLTimer::checkExpirationAndReset(F32 expiration) } mExpirationTicks = cur_ticks - + (U64)((F32)(expiration * gClockFrequency)); + + (U64)((F32)(expiration * get_timer_info().mClockFrequency)); return TRUE; } @@ -448,7 +464,7 @@ BOOL LLTimer::knownBadTimer() { if (!wcscmp(pci_id, bad_pci_list[check])) { -// llwarns << "unreliable PCI chipset found!! " << pci_id << endl; +// LL_WARNS() << "unreliable PCI chipset found!! " << pci_id << endl; failed = TRUE; break; } @@ -491,20 +507,20 @@ BOOL is_daylight_savings() struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time) { - S32 pacific_offset_hours; + S32Hours pacific_offset_hours; if (pacific_daylight_time) { - pacific_offset_hours = 7; + pacific_offset_hours = S32Hours(7); } else { - pacific_offset_hours = 8; + pacific_offset_hours = S32Hours(8); } // We subtract off the PST/PDT offset _before_ getting // "UTC" time, because this will handle wrapping around // for 5 AM UTC -> 10 PM PDT of the previous day. - utc_time -= pacific_offset_hours * MIN_PER_HOUR * SEC_PER_MIN; + utc_time -= S32SecondsImplicit(pacific_offset_hours); // Internal buffer to PST/PDT (see above) struct tm* internal_time = gmtime(&utc_time); @@ -521,7 +537,7 @@ struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time) } -void microsecondsToTimecodeString(U64 current_time, std::string& tcstring) +void microsecondsToTimecodeString(U64MicrosecondsImplicit current_time, std::string& tcstring) { U64 hours; U64 minutes; @@ -543,9 +559,9 @@ void microsecondsToTimecodeString(U64 current_time, std::string& tcstring) } -void secondsToTimecodeString(F32 current_time, std::string& tcstring) +void secondsToTimecodeString(F32SecondsImplicit current_time, std::string& tcstring) { - microsecondsToTimecodeString((U64)((F64)(SEC_TO_MICROSEC*current_time)), tcstring); + microsecondsToTimecodeString(current_time, tcstring); } diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index e73741217c711d16675ffe4b58e7cd698d93414e..ec70213447cfd3079f599abe3b69befc0837e091 100755 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -37,6 +37,7 @@ #include <string> #include <list> // units conversions +#include "llunits.h" #ifndef USEC_PER_SEC const U32 USEC_PER_SEC = 1000000; #endif @@ -55,27 +56,34 @@ class LL_COMMON_API LLTimer protected: U64 mLastClockCount; U64 mExpirationTicks; - BOOL mStarted; + bool mStarted; public: LLTimer(); ~LLTimer(); - static void initClass() { if (!sTimer) sTimer = new LLTimer; } - static void cleanupClass() { delete sTimer; sTimer = NULL; } + static void initClass(); + static void cleanupClass(); // Return a high precision number of seconds since the start of // this application instance. - static F64 getElapsedSeconds() + static F64SecondsImplicit getElapsedSeconds() + { + if (sTimer) { return sTimer->getElapsedTimeF64(); } + else + { + return 0; + } + } // Return a high precision usec since epoch - static U64 getTotalTime(); + static U64MicrosecondsImplicit getTotalTime(); // Return a high precision seconds since epoch - static F64 getTotalSeconds(); + static F64SecondsImplicit getTotalSeconds(); // MANIPULATORS @@ -83,21 +91,21 @@ class LL_COMMON_API LLTimer void stop() { mStarted = FALSE; } void reset(); // Resets the timer void setLastClockCount(U64 current_count); // Sets the timer so that the next elapsed call will be relative to this time - void setTimerExpirySec(F32 expiration); + void setTimerExpirySec(F32SecondsImplicit expiration); BOOL checkExpirationAndReset(F32 expiration); BOOL hasExpired() const; - F32 getElapsedTimeAndResetF32(); // Returns elapsed time in seconds with reset - F64 getElapsedTimeAndResetF64(); + F32SecondsImplicit getElapsedTimeAndResetF32(); // Returns elapsed time in seconds with reset + F64SecondsImplicit getElapsedTimeAndResetF64(); - F32 getRemainingTimeF32() const; + F32SecondsImplicit getRemainingTimeF32() const; static BOOL knownBadTimer(); // ACCESSORS - F32 getElapsedTimeF32() const; // Returns elapsed time in seconds - F64 getElapsedTimeF64() const; // Returns elapsed time in seconds + F32SecondsImplicit getElapsedTimeF32() const; // Returns elapsed time in seconds + F64SecondsImplicit getElapsedTimeF64() const; // Returns elapsed time in seconds - BOOL getStarted() const { return mStarted; } + bool getStarted() const { return mStarted; } static U64 getCurrentClockCount(); // Returns the raw clockticks @@ -106,9 +114,21 @@ class LL_COMMON_API LLTimer // // Various functions for initializing/accessing clock and timing stuff. Don't use these without REALLY knowing how they work. // +struct TimerInfo +{ + TimerInfo(); + void update(); + + F64HertzImplicit mClockFrequency; + F64SecondsImplicit mClockFrequencyInv; + F64MicrosecondsImplicit mClocksToMicroseconds; + U64 mTotalTimeClockCount; + U64 mLastTotalTimeClockCount; +}; + +TimerInfo& get_timer_info(); + LL_COMMON_API U64 get_clock_count(); -LL_COMMON_API F64 calc_clock_frequency(U32 msecs); -LL_COMMON_API void update_clock_frequencies(); // Sleep for milliseconds LL_COMMON_API void ms_sleep(U32 ms); @@ -146,13 +166,6 @@ static inline time_t time_max() } } -// These are really statics but they've been global for awhile -// and they're material to other timing classes. If you are -// not implementing a timer class, do not use these directly. -extern LL_COMMON_API F64 gClockFrequency; -extern LL_COMMON_API F64 gClockFrequencyInv; -extern LL_COMMON_API F64 gClocksToMicroseconds; - // Correction factor used by time_corrected() above. extern LL_COMMON_API S32 gUTCOffset; @@ -167,9 +180,9 @@ LL_COMMON_API BOOL is_daylight_savings(); // struct tm* internal_time = utc_to_pacific_time(utc_time, gDaylight); LL_COMMON_API struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time); -LL_COMMON_API void microsecondsToTimecodeString(U64 current_time, std::string& tcstring); -LL_COMMON_API void secondsToTimecodeString(F32 current_time, std::string& tcstring); +LL_COMMON_API void microsecondsToTimecodeString(U64MicrosecondsImplicit current_time, std::string& tcstring); +LL_COMMON_API void secondsToTimecodeString(F32SecondsImplicit current_time, std::string& tcstring); -U64 LL_COMMON_API totalTime(); // Returns current system time in microseconds +U64MicrosecondsImplicit LL_COMMON_API totalTime(); // Returns current system time in microseconds #endif diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp new file mode 100644 index 0000000000000000000000000000000000000000..54079a4689e34db6c5006f14f93d0b8313b0d9c8 --- /dev/null +++ b/indra/llcommon/lltrace.cpp @@ -0,0 +1,86 @@ +/** + * @file lltrace.cpp + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "lltrace.h" +#include "lltracerecording.h" +#include "lltracethreadrecorder.h" +#include "llfasttimer.h" + +namespace LLTrace +{ + +MemStatHandle gTraceMemStat("LLTrace"); + +StatBase::StatBase( const char* name, const char* description ) +: mName(name), + mDescription(description ? description : "") +{ +#ifndef LL_RELEASE_FOR_DOWNLOAD + if (LLTrace::get_thread_recorder().notNull()) + { + LL_ERRS() << "Attempting to declare trace object after program initialization. Trace objects should be statically initialized." << LL_ENDL; + } +#endif +} + +const char* StatBase::getUnitLabel() const +{ + return ""; +} + +TimeBlockTreeNode::TimeBlockTreeNode() +: mBlock(NULL), + mParent(NULL), + mNeedsSorting(false), + mCollapsed(true) +{} + +void TimeBlockTreeNode::setParent( BlockTimerStatHandle* parent ) +{ + llassert_always(parent != mBlock); + llassert_always(parent != NULL); + + TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(parent->getIndex()); + if (!parent_tree_node) return; + + if (mParent) + { + std::vector<BlockTimerStatHandle*>& children = mParent->getChildren(); + std::vector<BlockTimerStatHandle*>::iterator found_it = std::find(children.begin(), children.end(), mBlock); + if (found_it != children.end()) + { + children.erase(found_it); + } + } + + mParent = parent; + mBlock->getCurrentAccumulator().mParent = parent; + parent_tree_node->mChildren.push_back(mBlock); + parent_tree_node->mNeedsSorting = true; +} + +} diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h new file mode 100644 index 0000000000000000000000000000000000000000..5f1289dad8d4df7f585c587ff17f1bde9910ff0e --- /dev/null +++ b/indra/llcommon/lltrace.h @@ -0,0 +1,492 @@ +/** + * @file lltrace.h + * @brief Runtime statistics accumulation. + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTRACE_H +#define LL_LLTRACE_H + +#include "stdtypes.h" +#include "llpreprocessor.h" + +#include "llmemory.h" +#include "llrefcount.h" +#include "lltraceaccumulators.h" +#include "llthreadlocalstorage.h" +#include "lltimer.h" +#include "llpointer.h" +#include "llunits.h" + +#define LL_TRACE_ENABLED 1 + +namespace LLTrace +{ +class Recording; + +template<typename T> +T storage_value(T val) { return val; } + +template<typename UNIT_TYPE, typename STORAGE_TYPE> +STORAGE_TYPE storage_value(LLUnit<STORAGE_TYPE, UNIT_TYPE> val) { return val.value(); } + +template<typename UNIT_TYPE, typename STORAGE_TYPE> +STORAGE_TYPE storage_value(LLUnitImplicit<STORAGE_TYPE, UNIT_TYPE> val) { return val.value(); } + +class StatBase +{ +public: + StatBase(const char* name, const char* description); + virtual ~StatBase() {}; + virtual const char* getUnitLabel() const; + + const std::string& getName() const { return mName; } + const std::string& getDescription() const { return mDescription; } + +protected: + std::string mName; + std::string mDescription; +}; + +template<typename ACCUMULATOR> +class StatType +: public StatBase, + public LLInstanceTracker<StatType<ACCUMULATOR>, std::string> +{ +public: + typedef LLInstanceTracker<StatType<ACCUMULATOR>, std::string> instance_tracker_t; + StatType(const char* name, const char* description) + : instance_tracker_t(name), + StatBase(name, description), + mAccumulatorIndex(AccumulatorBuffer<ACCUMULATOR>::getDefaultBuffer()->reserveSlot()) + {} + + LL_FORCE_INLINE ACCUMULATOR& getCurrentAccumulator() const + { + ACCUMULATOR* accumulator_storage = LLThreadLocalSingletonPointer<ACCUMULATOR>::getInstance(); + return accumulator_storage ? accumulator_storage[mAccumulatorIndex] : (*AccumulatorBuffer<ACCUMULATOR>::getDefaultBuffer())[mAccumulatorIndex]; + } + + size_t getIndex() const { return mAccumulatorIndex; } + static size_t getNumIndices() { return AccumulatorBuffer<ACCUMULATOR>::getNumIndices(); } + +protected: + const size_t mAccumulatorIndex; +}; + + +template<> +class StatType<TimeBlockAccumulator::CallCountFacet> +: public StatType<TimeBlockAccumulator> +{ +public: + + StatType(const char* name, const char* description = "") + : StatType<TimeBlockAccumulator>(name, description) + {} +}; + +template<> +class StatType<TimeBlockAccumulator::SelfTimeFacet> + : public StatType<TimeBlockAccumulator> +{ +public: + + StatType(const char* name, const char* description = "") + : StatType<TimeBlockAccumulator>(name, description) + {} +}; + +template <typename T = F64> +class EventStatHandle +: public StatType<EventAccumulator> +{ +public: + typedef F64 storage_t; + typedef StatType<EventAccumulator> stat_t; + typedef EventStatHandle<T> self_t; + + EventStatHandle(const char* name, const char* description = NULL) + : stat_t(name, description) + {} + + /*virtual*/ const char* getUnitLabel() const { return LLGetUnitLabel<T>::getUnitLabel(); } + +}; + +template<typename T, typename VALUE_T> +void record(EventStatHandle<T>& measurement, VALUE_T value) +{ +#if LL_TRACE_ENABLED + T converted_value(value); + measurement.getCurrentAccumulator().record(storage_value(converted_value)); +#endif +} + +template <typename T = F64> +class SampleStatHandle +: public StatType<SampleAccumulator> +{ +public: + typedef F64 storage_t; + typedef StatType<SampleAccumulator> stat_t; + typedef SampleStatHandle<T> self_t; + + SampleStatHandle(const char* name, const char* description = NULL) + : stat_t(name, description) + {} + + /*virtual*/ const char* getUnitLabel() const { return LLGetUnitLabel<T>::getUnitLabel(); } +}; + +template<typename T, typename VALUE_T> +void sample(SampleStatHandle<T>& measurement, VALUE_T value) +{ +#if LL_TRACE_ENABLED + T converted_value(value); + measurement.getCurrentAccumulator().sample(storage_value(converted_value)); +#endif +} + +template <typename T = F64> +class CountStatHandle +: public StatType<CountAccumulator> +{ +public: + typedef F64 storage_t; + typedef StatType<CountAccumulator> stat_t; + typedef CountStatHandle<T> self_t; + + CountStatHandle(const char* name, const char* description = NULL) + : stat_t(name, description) + {} + + /*virtual*/ const char* getUnitLabel() const { return LLGetUnitLabel<T>::getUnitLabel(); } +}; + +template<typename T, typename VALUE_T> +void add(CountStatHandle<T>& count, VALUE_T value) +{ +#if LL_TRACE_ENABLED + T converted_value(value); + count.getCurrentAccumulator().add(storage_value(converted_value)); +#endif +} + +template<> +class StatType<MemAccumulator::AllocationFacet> +: public StatType<MemAccumulator> +{ +public: + + StatType(const char* name, const char* description = "") + : StatType<MemAccumulator>(name, description) + {} +}; + +template<> +class StatType<MemAccumulator::DeallocationFacet> +: public StatType<MemAccumulator> +{ +public: + + StatType(const char* name, const char* description = "") + : StatType<MemAccumulator>(name, description) + {} +}; + +class MemStatHandle : public StatType<MemAccumulator> +{ +public: + typedef StatType<MemAccumulator> stat_t; + MemStatHandle(const char* name, const char* description = "") + : stat_t(name, description) + { + mName = name; + } + + void setName(const char* name) + { + mName = name; + setKey(name); + } + + /*virtual*/ const char* getUnitLabel() const { return "KB"; } + + StatType<MemAccumulator::AllocationFacet>& allocations() + { + return static_cast<StatType<MemAccumulator::AllocationFacet>&>(*(StatType<MemAccumulator>*)this); + } + + StatType<MemAccumulator::DeallocationFacet>& deallocations() + { + return static_cast<StatType<MemAccumulator::DeallocationFacet>&>(*(StatType<MemAccumulator>*)this); + } +}; + + +// measures effective memory footprint of specified type +// specialize to cover different types +template<typename T, typename IS_MEM_TRACKABLE = void, typename IS_UNITS = void> +struct MeasureMem +{ + static size_t measureFootprint(const T& value) + { + return sizeof(T); + } +}; + +template<typename T, typename IS_BYTES> +struct MeasureMem<T, typename T::mem_trackable_tag_t, IS_BYTES> +{ + static size_t measureFootprint(const T& value) + { + return sizeof(T) + value.getMemFootprint(); + } +}; + +template<typename T, typename IS_MEM_TRACKABLE> +struct MeasureMem<T, IS_MEM_TRACKABLE, typename T::is_unit_t> +{ + static size_t measureFootprint(const T& value) + { + return U32Bytes(value).value(); + } +}; + +template<typename T, typename IS_MEM_TRACKABLE, typename IS_BYTES> +struct MeasureMem<T*, IS_MEM_TRACKABLE, IS_BYTES> +{ + static size_t measureFootprint(const T* value) + { + if (!value) + { + return 0; + } + return MeasureMem<T>::measureFootprint(*value); + } +}; + +template<typename T, typename IS_MEM_TRACKABLE, typename IS_BYTES> +struct MeasureMem<LLPointer<T>, IS_MEM_TRACKABLE, IS_BYTES> +{ + static size_t measureFootprint(const LLPointer<T> value) + { + if (value.isNull()) + { + return 0; + } + return MeasureMem<T>::measureFootprint(*value); + } +}; + +template<typename IS_MEM_TRACKABLE, typename IS_BYTES> +struct MeasureMem<S32, IS_MEM_TRACKABLE, IS_BYTES> +{ + static size_t measureFootprint(S32 value) + { + return value; + } +}; + +template<typename IS_MEM_TRACKABLE, typename IS_BYTES> +struct MeasureMem<U32, IS_MEM_TRACKABLE, IS_BYTES> +{ + static size_t measureFootprint(U32 value) + { + return value; + } +}; + +template<typename T, typename IS_MEM_TRACKABLE, typename IS_BYTES> +struct MeasureMem<std::basic_string<T>, IS_MEM_TRACKABLE, IS_BYTES> +{ + static size_t measureFootprint(const std::basic_string<T>& value) + { + return value.capacity() * sizeof(T); + } +}; + + +template<typename T> +inline void claim_alloc(MemStatHandle& measurement, const T& value) +{ +#if LL_TRACE_ENABLED + S32 size = MeasureMem<T>::measureFootprint(value); + if(size == 0) return; + MemAccumulator& accumulator = measurement.getCurrentAccumulator(); + accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size); + accumulator.mAllocations.record(size); +#endif +} + +template<typename T> +inline void disclaim_alloc(MemStatHandle& measurement, const T& value) +{ +#if LL_TRACE_ENABLED + S32 size = MeasureMem<T>::measureFootprint(value); + if(size == 0) return; + MemAccumulator& accumulator = measurement.getCurrentAccumulator(); + accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size); + accumulator.mDeallocations.add(size); +#endif +} + +template<typename DERIVED, size_t ALIGNMENT = LL_DEFAULT_HEAP_ALIGN> +class MemTrackableNonVirtual +{ +public: + typedef void mem_trackable_tag_t; + + MemTrackableNonVirtual(const char* name) +#if LL_TRACE_ENABLED + : mMemFootprint(0) +#endif + { +#if LL_TRACE_ENABLED + static bool name_initialized = false; + if (!name_initialized) + { + name_initialized = true; + sMemStat.setName(name); + } +#endif + } + +#if LL_TRACE_ENABLED + ~MemTrackableNonVirtual() + { + disclaimMem(mMemFootprint); + } + + static MemStatHandle& getMemStatHandle() + { + return sMemStat; + } + + S32 getMemFootprint() const { return mMemFootprint; } +#endif + + void* operator new(size_t size) + { +#if LL_TRACE_ENABLED + claim_alloc(sMemStat, size); +#endif + return ll_aligned_malloc<ALIGNMENT>(size); + } + + template<int CUSTOM_ALIGNMENT> + static void* aligned_new(size_t size) + { +#if LL_TRACE_ENABLED + claim_alloc(sMemStat, size); +#endif + return ll_aligned_malloc<CUSTOM_ALIGNMENT>(size); + } + + void operator delete(void* ptr, size_t size) + { +#if LL_TRACE_ENABLED + disclaim_alloc(sMemStat, size); +#endif + ll_aligned_free<ALIGNMENT>(ptr); + } + + template<int CUSTOM_ALIGNMENT> + static void aligned_delete(void* ptr, size_t size) + { +#if LL_TRACE_ENABLED + disclaim_alloc(sMemStat, size); +#endif + ll_aligned_free<CUSTOM_ALIGNMENT>(ptr); + } + + void* operator new [](size_t size) + { +#if LL_TRACE_ENABLED + claim_alloc(sMemStat, size); +#endif + return ll_aligned_malloc<ALIGNMENT>(size); + } + + void operator delete[](void* ptr, size_t size) + { +#if LL_TRACE_ENABLED + disclaim_alloc(sMemStat, size); +#endif + ll_aligned_free<ALIGNMENT>(ptr); + } + + // claim memory associated with other objects/data as our own, adding to our calculated footprint + template<typename CLAIM_T> + void claimMem(const CLAIM_T& value) const + { +#if LL_TRACE_ENABLED + S32 size = MeasureMem<CLAIM_T>::measureFootprint(value); + claim_alloc(sMemStat, size); + mMemFootprint += size; +#endif + } + + // remove memory we had claimed from our calculated footprint + template<typename CLAIM_T> + void disclaimMem(const CLAIM_T& value) const + { +#if LL_TRACE_ENABLED + S32 size = MeasureMem<CLAIM_T>::measureFootprint(value); + disclaim_alloc(sMemStat, size); + mMemFootprint -= size; +#endif + } + +private: +#if LL_TRACE_ENABLED + // use signed values so that we can temporarily go negative + // and reconcile in destructor + // NB: this assumes that no single class is responsible for > 2GB of allocations + mutable S32 mMemFootprint; + + static MemStatHandle sMemStat; +#endif + +}; + +#if LL_TRACE_ENABLED +template<typename DERIVED, size_t ALIGNMENT> +MemStatHandle MemTrackableNonVirtual<DERIVED, ALIGNMENT>::sMemStat(typeid(MemTrackableNonVirtual<DERIVED, ALIGNMENT>).name()); +#endif + +template<typename DERIVED, size_t ALIGNMENT = LL_DEFAULT_HEAP_ALIGN> +class MemTrackable : public MemTrackableNonVirtual<DERIVED, ALIGNMENT> +{ +public: + MemTrackable(const char* name) + : MemTrackableNonVirtual<DERIVED, ALIGNMENT>(name) + {} + + virtual ~MemTrackable() + {} +}; +} + +#endif // LL_LLTRACE_H diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp new file mode 100644 index 0000000000000000000000000000000000000000..385d31edd7b7055115a8fdec30510b93bab6c505 --- /dev/null +++ b/indra/llcommon/lltraceaccumulators.cpp @@ -0,0 +1,302 @@ +/** + * @file lltracesampler.cpp + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "lltraceaccumulators.h" +#include "lltrace.h" +#include "lltracethreadrecorder.h" + +namespace LLTrace +{ + +extern MemStatHandle gTraceMemStat; + + +/////////////////////////////////////////////////////////////////////// +// AccumulatorBufferGroup +/////////////////////////////////////////////////////////////////////// + +AccumulatorBufferGroup::AccumulatorBufferGroup() +{ + claim_alloc(gTraceMemStat, mCounts.capacity() * sizeof(CountAccumulator)); + claim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator)); + claim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator)); + claim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator)); + claim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemAccumulator)); +} + +AccumulatorBufferGroup::AccumulatorBufferGroup(const AccumulatorBufferGroup& other) +: mCounts(other.mCounts), + mSamples(other.mSamples), + mEvents(other.mEvents), + mStackTimers(other.mStackTimers), + mMemStats(other.mMemStats) +{ + claim_alloc(gTraceMemStat, mCounts.capacity() * sizeof(CountAccumulator)); + claim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator)); + claim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator)); + claim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator)); + claim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemAccumulator)); +} + +AccumulatorBufferGroup::~AccumulatorBufferGroup() +{ + disclaim_alloc(gTraceMemStat, mCounts.capacity() * sizeof(CountAccumulator)); + disclaim_alloc(gTraceMemStat, mSamples.capacity() * sizeof(SampleAccumulator)); + disclaim_alloc(gTraceMemStat, mEvents.capacity() * sizeof(EventAccumulator)); + disclaim_alloc(gTraceMemStat, mStackTimers.capacity() * sizeof(TimeBlockAccumulator)); + disclaim_alloc(gTraceMemStat, mMemStats.capacity() * sizeof(MemAccumulator)); +} + +void AccumulatorBufferGroup::handOffTo(AccumulatorBufferGroup& other) +{ + other.mCounts.reset(&mCounts); + other.mSamples.reset(&mSamples); + other.mEvents.reset(&mEvents); + other.mStackTimers.reset(&mStackTimers); + other.mMemStats.reset(&mMemStats); +} + +void AccumulatorBufferGroup::makeCurrent() +{ + mCounts.makeCurrent(); + mSamples.makeCurrent(); + mEvents.makeCurrent(); + mStackTimers.makeCurrent(); + mMemStats.makeCurrent(); + + ThreadRecorder* thread_recorder = get_thread_recorder().get(); + AccumulatorBuffer<TimeBlockAccumulator>& timer_accumulator_buffer = mStackTimers; + // update stacktimer parent pointers + for (S32 i = 0, end_i = mStackTimers.size(); i < end_i; i++) + { + TimeBlockTreeNode* tree_node = thread_recorder->getTimeBlockTreeNode(i); + if (tree_node) + { + timer_accumulator_buffer[i].mParent = tree_node->mParent; + } + } +} + +//static +void AccumulatorBufferGroup::clearCurrent() +{ + AccumulatorBuffer<CountAccumulator>::clearCurrent(); + AccumulatorBuffer<SampleAccumulator>::clearCurrent(); + AccumulatorBuffer<EventAccumulator>::clearCurrent(); + AccumulatorBuffer<TimeBlockAccumulator>::clearCurrent(); + AccumulatorBuffer<MemAccumulator>::clearCurrent(); +} + +bool AccumulatorBufferGroup::isCurrent() const +{ + return mCounts.isCurrent(); +} + +void AccumulatorBufferGroup::append( const AccumulatorBufferGroup& other ) +{ + mCounts.addSamples(other.mCounts, SEQUENTIAL); + mSamples.addSamples(other.mSamples, SEQUENTIAL); + mEvents.addSamples(other.mEvents, SEQUENTIAL); + mMemStats.addSamples(other.mMemStats, SEQUENTIAL); + mStackTimers.addSamples(other.mStackTimers, SEQUENTIAL); +} + +void AccumulatorBufferGroup::merge( const AccumulatorBufferGroup& other) +{ + mCounts.addSamples(other.mCounts, NON_SEQUENTIAL); + mSamples.addSamples(other.mSamples, NON_SEQUENTIAL); + mEvents.addSamples(other.mEvents, NON_SEQUENTIAL); + mMemStats.addSamples(other.mMemStats, NON_SEQUENTIAL); + // for now, hold out timers from merge, need to be displayed per thread + //mStackTimers.addSamples(other.mStackTimers, NON_SEQUENTIAL); +} + +void AccumulatorBufferGroup::reset(AccumulatorBufferGroup* other) +{ + mCounts.reset(other ? &other->mCounts : NULL); + mSamples.reset(other ? &other->mSamples : NULL); + mEvents.reset(other ? &other->mEvents : NULL); + mStackTimers.reset(other ? &other->mStackTimers : NULL); + mMemStats.reset(other ? &other->mMemStats : NULL); +} + +void AccumulatorBufferGroup::sync() +{ + if (isCurrent()) + { + F64SecondsImplicit time_stamp = LLTimer::getTotalSeconds(); + + mSamples.sync(time_stamp); + mMemStats.sync(time_stamp); + } +} + +F64 SampleAccumulator::mergeSumsOfSquares(const SampleAccumulator& a, const SampleAccumulator& b) +{ + const F64 epsilon = 0.0000001; + + if (a.getSamplingTime() > epsilon && b.getSamplingTime() > epsilon) + { + // combine variance (and hence standard deviation) of 2 different sized sample groups using + // the following formula: http://www.mrc-bsu.cam.ac.uk/cochrane/handbook/chapter_7/7_7_3_8_combining_groups.htm + F64 n_1 = a.getSamplingTime(), + n_2 = b.getSamplingTime(); + F64 m_1 = a.getMean(), + m_2 = b.getMean(); + F64 v_1 = a.getSumOfSquares() / a.getSamplingTime(), + v_2 = b.getSumOfSquares() / b.getSamplingTime(); + if (n_1 < epsilon) + { + return b.getSumOfSquares(); + } + else + { + return a.getSamplingTime() + * ((((n_1 - epsilon) * v_1) + + ((n_2 - epsilon) * v_2) + + (((n_1 * n_2) / (n_1 + n_2)) + * ((m_1 * m_1) + (m_2 * m_2) - (2.f * m_1 * m_2)))) + / (n_1 + n_2 - epsilon)); + } + } + + return a.getSumOfSquares(); +} + + +void SampleAccumulator::addSamples( const SampleAccumulator& other, EBufferAppendType append_type ) +{ + if (append_type == NON_SEQUENTIAL) + { + return; + } + + if (!mHasValue) + { + *this = other; + + if (append_type == NON_SEQUENTIAL) + { + // restore own last value state + mLastValue = NaN; + mHasValue = false; + } + } + else if (other.mHasValue) + { + mSum += other.mSum; + + if (other.mMin < mMin) { mMin = other.mMin; } + if (other.mMax > mMax) { mMax = other.mMax; } + + mSumOfSquares = mergeSumsOfSquares(*this, other); + + if (append_type == SEQUENTIAL) + { + mLastValue = other.mLastValue; + mLastSampleTimeStamp = other.mLastSampleTimeStamp; + } + } +} + +void SampleAccumulator::reset( const SampleAccumulator* other ) +{ + mLastValue = other ? other->mLastValue : NaN; + mHasValue = other ? other->mHasValue : false; + mNumSamples = 0; + mSum = 0; + mMin = mLastValue; + mMax = mLastValue; + mMean = mLastValue; + llassert(!mHasValue || mMean < 0 || mMean >= 0); + mSumOfSquares = 0; + mLastSampleTimeStamp = LLTimer::getTotalSeconds(); + mTotalSamplingTime = 0; +} + +F64 EventAccumulator::mergeSumsOfSquares(const EventAccumulator& a, const EventAccumulator& b) +{ + if (a.mNumSamples && b.mNumSamples) + { + // combine variance (and hence standard deviation) of 2 different sized sample groups using + // the following formula: http://www.mrc-bsu.cam.ac.uk/cochrane/handbook/chapter_7/7_7_3_8_combining_groups.htm + F64 n_1 = a.mNumSamples, + n_2 = b.mNumSamples; + F64 m_1 = a.mMean, + m_2 = b.mMean; + F64 v_1 = a.mSumOfSquares / a.mNumSamples, + v_2 = b.mSumOfSquares / b.mNumSamples; + return (F64)a.mNumSamples + * ((((n_1 - 1.f) * v_1) + + ((n_2 - 1.f) * v_2) + + (((n_1 * n_2) / (n_1 + n_2)) + * ((m_1 * m_1) + (m_2 * m_2) - (2.f * m_1 * m_2)))) + / (n_1 + n_2 - 1.f)); + } + + return a.mSumOfSquares; +} + +void EventAccumulator::addSamples( const EventAccumulator& other, EBufferAppendType append_type ) +{ + if (other.mNumSamples) + { + if (!mNumSamples) + { + *this = other; + } + else + { + mSum += other.mSum; + + // NOTE: both conditions will hold first time through + if (other.mMin < mMin) { mMin = other.mMin; } + if (other.mMax > mMax) { mMax = other.mMax; } + + mSumOfSquares = mergeSumsOfSquares(*this, other); + + F64 weight = (F64)mNumSamples / (F64)(mNumSamples + other.mNumSamples); + mNumSamples += other.mNumSamples; + mMean = mMean * weight + other.mMean * (1.f - weight); + if (append_type == SEQUENTIAL) mLastValue = other.mLastValue; + } + } +} + +void EventAccumulator::reset( const EventAccumulator* other ) +{ + mNumSamples = 0; + mSum = 0; + mMin = NaN; + mMax = NaN; + mMean = NaN; + mSumOfSquares = 0; + mLastValue = other ? other->mLastValue : NaN; +} + + +} diff --git a/indra/llcommon/lltraceaccumulators.h b/indra/llcommon/lltraceaccumulators.h new file mode 100644 index 0000000000000000000000000000000000000000..42fad8a7937b18f88d3b664ceb85181e375d362d --- /dev/null +++ b/indra/llcommon/lltraceaccumulators.h @@ -0,0 +1,590 @@ + +/** + * @file lltraceaccumulators.h + * @brief Storage for accumulating statistics + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTRACEACCUMULATORS_H +#define LL_LLTRACEACCUMULATORS_H + + +#include "stdtypes.h" +#include "llpreprocessor.h" +#include "llunits.h" +#include "lltimer.h" +#include "llrefcount.h" +#include "llthreadlocalstorage.h" +#include "llmemory.h" +#include <limits> + +namespace LLTrace +{ + const F64 NaN = std::numeric_limits<double>::quiet_NaN(); + + enum EBufferAppendType + { + SEQUENTIAL, + NON_SEQUENTIAL + }; + + template<typename ACCUMULATOR> + class AccumulatorBuffer : public LLRefCount + { + typedef AccumulatorBuffer<ACCUMULATOR> self_t; + static const S32 DEFAULT_ACCUMULATOR_BUFFER_SIZE = 32; + private: + struct StaticAllocationMarker { }; + + AccumulatorBuffer(StaticAllocationMarker m) + : mStorageSize(0), + mStorage(NULL) + {} + + public: + + AccumulatorBuffer(const AccumulatorBuffer& other = *getDefaultBuffer()) + : mStorageSize(0), + mStorage(NULL) + { + resize(sNextStorageSlot); + for (S32 i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } + } + + ~AccumulatorBuffer() + { + if (isCurrent()) + { + LLThreadLocalSingletonPointer<ACCUMULATOR>::setInstance(NULL); + } + delete[] mStorage; + } + + LL_FORCE_INLINE ACCUMULATOR& operator[](size_t index) + { + return mStorage[index]; + } + + LL_FORCE_INLINE const ACCUMULATOR& operator[](size_t index) const + { + return mStorage[index]; + } + + void addSamples(const AccumulatorBuffer<ACCUMULATOR>& other, EBufferAppendType append_type) + { + llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize >= sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) + { + mStorage[i].addSamples(other.mStorage[i], append_type); + } + } + + void copyFrom(const AccumulatorBuffer<ACCUMULATOR>& other) + { + llassert(mStorageSize >= sNextStorageSlot && other.mStorageSize >= sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) + { + mStorage[i] = other.mStorage[i]; + } + } + + void reset(const AccumulatorBuffer<ACCUMULATOR>* other = NULL) + { + llassert(mStorageSize >= sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) + { + mStorage[i].reset(other ? &other->mStorage[i] : NULL); + } + } + + void sync(F64SecondsImplicit time_stamp) + { + llassert(mStorageSize >= sNextStorageSlot); + for (size_t i = 0; i < sNextStorageSlot; i++) + { + mStorage[i].sync(time_stamp); + } + } + + void makeCurrent() + { + LLThreadLocalSingletonPointer<ACCUMULATOR>::setInstance(mStorage); + } + + bool isCurrent() const + { + return LLThreadLocalSingletonPointer<ACCUMULATOR>::getInstance() == mStorage; + } + + static void clearCurrent() + { + LLThreadLocalSingletonPointer<ACCUMULATOR>::setInstance(NULL); + } + + // NOTE: this is not thread-safe. We assume that slots are reserved in the main thread before any child threads are spawned + size_t reserveSlot() + { + size_t next_slot = sNextStorageSlot++; + if (next_slot >= mStorageSize) + { + // don't perform doubling, as this should only happen during startup + // want to keep a tight bounds as we will have a lot of these buffers + resize(mStorageSize + mStorageSize / 2); + } + llassert(mStorage && next_slot < mStorageSize); + return next_slot; + } + + void resize(size_t new_size) + { + if (new_size <= mStorageSize) return; + + ACCUMULATOR* old_storage = mStorage; + mStorage = new ACCUMULATOR[new_size]; + if (old_storage) + { + for (S32 i = 0; i < mStorageSize; i++) + { + mStorage[i] = old_storage[i]; + } + } + mStorageSize = new_size; + delete[] old_storage; + + self_t* default_buffer = getDefaultBuffer(); + if (this != default_buffer + && new_size > default_buffer->size()) + { + //NB: this is not thread safe, but we assume that all resizing occurs during static initialization + default_buffer->resize(new_size); + } + } + + size_t size() const + { + return getNumIndices(); + } + + size_t capacity() const + { + return mStorageSize; + } + + static size_t getNumIndices() + { + return sNextStorageSlot; + } + + static self_t* getDefaultBuffer() + { + static bool sInitialized = false; + if (!sInitialized) + { + // this buffer is allowed to leak so that trace calls from global destructors have somewhere to put their data + // so as not to trigger an access violation + sDefaultBuffer = new AccumulatorBuffer(StaticAllocationMarker()); + sInitialized = true; + sDefaultBuffer->resize(DEFAULT_ACCUMULATOR_BUFFER_SIZE); + } + return sDefaultBuffer; + } + + private: + ACCUMULATOR* mStorage; + size_t mStorageSize; + static size_t sNextStorageSlot; + static self_t* sDefaultBuffer; + }; + + template<typename ACCUMULATOR> size_t AccumulatorBuffer<ACCUMULATOR>::sNextStorageSlot = 0; + template<typename ACCUMULATOR> AccumulatorBuffer<ACCUMULATOR>* AccumulatorBuffer<ACCUMULATOR>::sDefaultBuffer = NULL; + + class EventAccumulator + { + public: + typedef F64 value_t; + static F64 getDefaultValue() { return NaN; } + + EventAccumulator() + : mSum(0), + mMin(NaN), + mMax(NaN), + mMean(NaN), + mSumOfSquares(0), + mNumSamples(0), + mLastValue(NaN) + {} + + void record(F64 value) + { + if (mNumSamples == 0) + { + mSum = value; + mMean = value; + mMin = value; + mMax = value; + } + else + { + mSum += value; + F64 old_mean = mMean; + mMean += (value - old_mean) / (F64)mNumSamples; + mSumOfSquares += (value - old_mean) * (value - mMean); + + if (value < mMin) { mMin = value; } + else if (value > mMax) { mMax = value; } + } + + mNumSamples++; + mLastValue = value; + } + + void addSamples(const EventAccumulator& other, EBufferAppendType append_type); + void reset(const EventAccumulator* other); + void sync(F64SecondsImplicit) {} + + F64 getSum() const { return mSum; } + F32 getMin() const { return mMin; } + F32 getMax() const { return mMax; } + F64 getLastValue() const { return mLastValue; } + F64 getMean() const { return mMean; } + F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mNumSamples); } + F64 getSumOfSquares() const { return mSumOfSquares; } + S32 getSampleCount() const { return mNumSamples; } + bool hasValue() const { return mNumSamples > 0; } + + // helper utility to calculate combined sumofsquares total + static F64 mergeSumsOfSquares(const EventAccumulator& a, const EventAccumulator& b); + + private: + F64 mSum, + mLastValue; + + F64 mMean, + mSumOfSquares; + + F32 mMin, + mMax; + + S32 mNumSamples; + }; + + + class SampleAccumulator + { + public: + typedef F64 value_t; + static F64 getDefaultValue() { return NaN; } + + SampleAccumulator() + : mSum(0), + mMin(NaN), + mMax(NaN), + mMean(NaN), + mSumOfSquares(0), + mLastSampleTimeStamp(0), + mTotalSamplingTime(0), + mNumSamples(0), + mLastValue(NaN), + mHasValue(false) + {} + + void sample(F64 value) + { + F64SecondsImplicit time_stamp = LLTimer::getTotalSeconds(); + + // store effect of last value + sync(time_stamp); + + if (!mHasValue) + { + mHasValue = true; + + mMin = value; + mMax = value; + mMean = value; + mLastSampleTimeStamp = time_stamp; + } + else + { + if (value < mMin) { mMin = value; } + else if (value > mMax) { mMax = value; } + } + + mLastValue = value; + mNumSamples++; + } + + void addSamples(const SampleAccumulator& other, EBufferAppendType append_type); + void reset(const SampleAccumulator* other); + + void sync(F64SecondsImplicit time_stamp) + { + if (mHasValue && time_stamp != mLastSampleTimeStamp) + { + F64SecondsImplicit delta_time = time_stamp - mLastSampleTimeStamp; + mSum += mLastValue * delta_time; + mTotalSamplingTime += delta_time; + F64 old_mean = mMean; + mMean += (delta_time / mTotalSamplingTime) * (mLastValue - old_mean); + mSumOfSquares += delta_time * (mLastValue - old_mean) * (mLastValue - mMean); + } + mLastSampleTimeStamp = time_stamp; + } + + F64 getSum() const { return mSum; } + F32 getMin() const { return mMin; } + F32 getMax() const { return mMax; } + F64 getLastValue() const { return mLastValue; } + F64 getMean() const { return mMean; } + F64 getStandardDeviation() const { return sqrtf(mSumOfSquares / mTotalSamplingTime); } + F64 getSumOfSquares() const { return mSumOfSquares; } + F64SecondsImplicit getSamplingTime() const { return mTotalSamplingTime; } + S32 getSampleCount() const { return mNumSamples; } + bool hasValue() const { return mHasValue; } + + // helper utility to calculate combined sumofsquares total + static F64 mergeSumsOfSquares(const SampleAccumulator& a, const SampleAccumulator& b); + + private: + F64 mSum, + mLastValue; + + F64 mMean, + mSumOfSquares; + + F64SecondsImplicit + mLastSampleTimeStamp, + mTotalSamplingTime; + + F32 mMin, + mMax; + + S32 mNumSamples; + // distinct from mNumSamples, since we might have inherited a last value from + // a previous sampling period + bool mHasValue; + }; + + class CountAccumulator + { + public: + typedef F64 value_t; + static F64 getDefaultValue() { return 0; } + + CountAccumulator() + : mSum(0), + mNumSamples(0) + {} + + void add(F64 value) + { + mNumSamples++; + mSum += value; + } + + void addSamples(const CountAccumulator& other, EBufferAppendType /*type*/) + { + mSum += other.mSum; + mNumSamples += other.mNumSamples; + } + + void reset(const CountAccumulator* other) + { + mNumSamples = 0; + mSum = 0; + } + + void sync(F64SecondsImplicit) {} + + F64 getSum() const { return mSum; } + + S32 getSampleCount() const { return mNumSamples; } + + bool hasValue() const { return true; } + + private: + F64 mSum; + + S32 mNumSamples; + }; + + class TimeBlockAccumulator + { + public: + typedef F64Seconds value_t; + static F64Seconds getDefaultValue() { return F64Seconds(0); } + + typedef TimeBlockAccumulator self_t; + + // fake classes that allows us to view different facets of underlying statistic + struct CallCountFacet + { + typedef S32 value_t; + }; + + struct SelfTimeFacet + { + typedef F64Seconds value_t; + }; + + // arrays are allocated with 32 byte alignment + void *operator new [](size_t size) + { + return ll_aligned_malloc<32>(size); + } + + void operator delete[](void* ptr, size_t size) + { + ll_aligned_free<32>(ptr); + } + + TimeBlockAccumulator(); + void addSamples(const self_t& other, EBufferAppendType append_type); + void reset(const self_t* other); + void sync(F64SecondsImplicit) {} + bool hasValue() const { return true; } + + // + // members + // + U64 mTotalTimeCounter, + mSelfTimeCounter; + S32 mCalls; + class BlockTimerStatHandle* mParent; // last acknowledged parent of this time block + class BlockTimerStatHandle* mLastCaller; // used to bootstrap tree construction + U16 mActiveCount; // number of timers with this ID active on stack + bool mMoveUpTree; // needs to be moved up the tree of timers at the end of frame + + }; + + class BlockTimerStatHandle; + + class TimeBlockTreeNode + { + public: + TimeBlockTreeNode(); + + void setParent(BlockTimerStatHandle* parent); + BlockTimerStatHandle* getParent() { return mParent; } + + BlockTimerStatHandle* mBlock; + BlockTimerStatHandle* mParent; + std::vector<BlockTimerStatHandle*> mChildren; + bool mCollapsed; + bool mNeedsSorting; + }; + + struct BlockTimerStackRecord + { + class BlockTimer* mActiveTimer; + class BlockTimerStatHandle* mTimeBlock; + U64 mChildTime; + }; + + struct MemAccumulator + { + typedef F64Bytes value_t; + static F64Bytes getDefaultValue() { return F64Bytes(0); } + + typedef MemAccumulator self_t; + + // fake classes that allows us to view different facets of underlying statistic + struct AllocationFacet + { + typedef F64Bytes value_t; + static F64Bytes getDefaultValue() { return F64Bytes(0); } + }; + + struct DeallocationFacet + { + typedef F64Bytes value_t; + static F64Bytes getDefaultValue() { return F64Bytes(0); } + }; + + void addSamples(const MemAccumulator& other, EBufferAppendType append_type) + { + mAllocations.addSamples(other.mAllocations, append_type); + mDeallocations.addSamples(other.mDeallocations, append_type); + + if (append_type == SEQUENTIAL) + { + mSize.addSamples(other.mSize, SEQUENTIAL); + } + else + { + F64 allocation_delta(other.mAllocations.getSum() - other.mDeallocations.getSum()); + mSize.sample(mSize.hasValue() + ? mSize.getLastValue() + allocation_delta + : allocation_delta); + } + } + + void reset(const MemAccumulator* other) + { + mSize.reset(other ? &other->mSize : NULL); + mAllocations.reset(other ? &other->mAllocations : NULL); + mDeallocations.reset(other ? &other->mDeallocations : NULL); + } + + void sync(F64SecondsImplicit time_stamp) + { + mSize.sync(time_stamp); + } + + bool hasValue() const { return mSize.hasValue(); } + + SampleAccumulator mSize; + EventAccumulator mAllocations; + CountAccumulator mDeallocations; + }; + + struct AccumulatorBufferGroup : public LLRefCount + { + AccumulatorBufferGroup(); + AccumulatorBufferGroup(const AccumulatorBufferGroup&); + ~AccumulatorBufferGroup(); + + void handOffTo(AccumulatorBufferGroup& other); + void makeCurrent(); + bool isCurrent() const; + static void clearCurrent(); + + void append(const AccumulatorBufferGroup& other); + void merge(const AccumulatorBufferGroup& other); + void reset(AccumulatorBufferGroup* other = NULL); + void sync(); + + AccumulatorBuffer<CountAccumulator> mCounts; + AccumulatorBuffer<SampleAccumulator> mSamples; + AccumulatorBuffer<EventAccumulator> mEvents; + AccumulatorBuffer<TimeBlockAccumulator> mStackTimers; + AccumulatorBuffer<MemAccumulator> mMemStats; + }; +} + +#endif // LL_LLTRACEACCUMULATORS_H + diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0b10438b9f1380da1b340fbc2c050a90c0592a14 --- /dev/null +++ b/indra/llcommon/lltracerecording.cpp @@ -0,0 +1,1251 @@ +/** + * @file lltracesampler.cpp + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "lltracerecording.h" + +#include "lltrace.h" +#include "llfasttimer.h" +#include "lltracethreadrecorder.h" +#include "llthread.h" + +inline F64 lerp(F64 a, F64 b, F64 u) +{ + return a + ((b - a) * u); +} + +namespace LLTrace +{ + +extern MemStatHandle gTraceMemStat; + +/////////////////////////////////////////////////////////////////////// +// Recording +/////////////////////////////////////////////////////////////////////// + +Recording::Recording(EPlayState state) +: mElapsedSeconds(0), + mActiveBuffers(NULL) +{ + claim_alloc(gTraceMemStat, this); + mBuffers = new AccumulatorBufferGroup(); + claim_alloc(gTraceMemStat, mBuffers); + setPlayState(state); +} + +Recording::Recording( const Recording& other ) +: mActiveBuffers(NULL) +{ + claim_alloc(gTraceMemStat, this); + *this = other; +} + +Recording& Recording::operator = (const Recording& other) +{ + // this will allow us to seamlessly start without affecting any data we've acquired from other + setPlayState(PAUSED); + + const_cast<Recording&>(other).update(); + EPlayState other_play_state = other.getPlayState(); + + mBuffers = other.mBuffers; + + // above call will clear mElapsedSeconds as a side effect, so copy it here + mElapsedSeconds = other.mElapsedSeconds; + mSamplingTimer = other.mSamplingTimer; + + setPlayState(other_play_state); + + return *this; +} + + +Recording::~Recording() +{ + disclaim_alloc(gTraceMemStat, this); + disclaim_alloc(gTraceMemStat, mBuffers); + + // allow recording destruction without thread recorder running, + // otherwise thread shutdown could crash if a recording outlives the thread recorder + // besides, recording construction and destruction is fine without a recorder...just don't attempt to start one + if (isStarted() && LLTrace::get_thread_recorder().notNull()) + { + LLTrace::get_thread_recorder()->deactivate(mBuffers.write()); + } +} + +// brings recording to front of recorder stack, with up to date info +void Recording::update() +{ +#if LL_TRACE_ENABLED + if (isStarted()) + { + mElapsedSeconds += mSamplingTimer.getElapsedTimeF64(); + + // must have + llassert(mActiveBuffers != NULL + && LLTrace::get_thread_recorder().notNull()); + + if(!mActiveBuffers->isCurrent()) + { + AccumulatorBufferGroup* buffers = mBuffers.write(); + LLTrace::get_thread_recorder()->deactivate(buffers); + mActiveBuffers = LLTrace::get_thread_recorder()->activate(buffers); + } + + mSamplingTimer.reset(); + } +#endif +} + +void Recording::handleReset() +{ +#if LL_TRACE_ENABLED + mBuffers.write()->reset(); + + mElapsedSeconds = F64Seconds(0.0); + mSamplingTimer.reset(); +#endif +} + +void Recording::handleStart() +{ +#if LL_TRACE_ENABLED + mSamplingTimer.reset(); + mBuffers.setStayUnique(true); + // must have thread recorder running on this thread + llassert(LLTrace::get_thread_recorder().notNull()); + mActiveBuffers = LLTrace::get_thread_recorder()->activate(mBuffers.write()); +#endif +} + +void Recording::handleStop() +{ +#if LL_TRACE_ENABLED + mElapsedSeconds += mSamplingTimer.getElapsedTimeF64(); + // must have thread recorder running on this thread + llassert(LLTrace::get_thread_recorder().notNull()); + LLTrace::get_thread_recorder()->deactivate(mBuffers.write()); + mActiveBuffers = NULL; + mBuffers.setStayUnique(false); +#endif +} + +void Recording::handleSplitTo(Recording& other) +{ +#if LL_TRACE_ENABLED + mBuffers.write()->handOffTo(*other.mBuffers.write()); +#endif +} + +void Recording::appendRecording( Recording& other ) +{ +#if LL_TRACE_ENABLED + update(); + other.update(); + mBuffers.write()->append(*other.mBuffers); + mElapsedSeconds += other.mElapsedSeconds; +#endif +} + +bool Recording::hasValue(const StatType<TimeBlockAccumulator>& stat) +{ + update(); + const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + return accumulator.hasValue() || (active_accumulator && active_accumulator->hasValue()); +} + +F64Seconds Recording::getSum(const StatType<TimeBlockAccumulator>& stat) +{ + update(); + const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + return F64Seconds((F64)(accumulator.mTotalTimeCounter) + (F64)(active_accumulator ? active_accumulator->mTotalTimeCounter : 0)) + / (F64)LLTrace::BlockTimer::countsPerSecond(); +} + +F64Seconds Recording::getSum(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat) +{ + update(); + const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + return F64Seconds(((F64)(accumulator.mSelfTimeCounter) + (F64)(active_accumulator ? active_accumulator->mSelfTimeCounter : 0)) / (F64)LLTrace::BlockTimer::countsPerSecond()); +} + + +S32 Recording::getSum(const StatType<TimeBlockAccumulator::CallCountFacet>& stat) +{ + update(); + const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + return accumulator.mCalls + (active_accumulator ? active_accumulator->mCalls : 0); +} + +F64Seconds Recording::getPerSec(const StatType<TimeBlockAccumulator>& stat) +{ + update(); + const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + + return F64Seconds((F64)(accumulator.mTotalTimeCounter + (active_accumulator ? active_accumulator->mTotalTimeCounter : 0)) + / ((F64)LLTrace::BlockTimer::countsPerSecond() * mElapsedSeconds.value())); +} + +F64Seconds Recording::getPerSec(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat) +{ + update(); + const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + + return F64Seconds((F64)(accumulator.mSelfTimeCounter + (active_accumulator ? active_accumulator->mSelfTimeCounter : 0)) + / ((F64)LLTrace::BlockTimer::countsPerSecond() * mElapsedSeconds.value())); +} + +F32 Recording::getPerSec(const StatType<TimeBlockAccumulator::CallCountFacet>& stat) +{ + update(); + const TimeBlockAccumulator& accumulator = mBuffers->mStackTimers[stat.getIndex()]; + const TimeBlockAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mStackTimers[stat.getIndex()] : NULL; + return (F32)(accumulator.mCalls + (active_accumulator ? active_accumulator->mCalls : 0)) / mElapsedSeconds.value(); +} + +bool Recording::hasValue(const StatType<MemAccumulator>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return accumulator.mSize.hasValue() || (active_accumulator && active_accumulator->mSize.hasValue() ? active_accumulator->mSize.hasValue() : false); +} + +F64Kilobytes Recording::getMin(const StatType<MemAccumulator>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return F64Bytes(llmin(accumulator.mSize.getMin(), (active_accumulator && active_accumulator->mSize.hasValue() ? active_accumulator->mSize.getMin() : F32_MAX))); +} + +F64Kilobytes Recording::getMean(const StatType<MemAccumulator>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + + if (active_accumulator && active_accumulator->mSize.hasValue()) + { + return F64Bytes(lerp(accumulator.mSize.getMean(), active_accumulator->mSize.getMean(), active_accumulator->mSize.getSampleCount() / (accumulator.mSize.getSampleCount() + active_accumulator->mSize.getSampleCount()))); + } + else + { + return F64Bytes(accumulator.mSize.getMean()); + } +} + +F64Kilobytes Recording::getMax(const StatType<MemAccumulator>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return F64Bytes(llmax(accumulator.mSize.getMax(), active_accumulator && active_accumulator->mSize.hasValue() ? active_accumulator->mSize.getMax() : F32_MIN)); +} + +F64Kilobytes Recording::getStandardDeviation(const StatType<MemAccumulator>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + if (active_accumulator && active_accumulator->hasValue()) + { + F64 sum_of_squares = SampleAccumulator::mergeSumsOfSquares(accumulator.mSize, active_accumulator->mSize); + return F64Bytes(sqrtf(sum_of_squares / (accumulator.mSize.getSamplingTime().value() + active_accumulator->mSize.getSamplingTime().value()))); + } + else + { + return F64Bytes(accumulator.mSize.getStandardDeviation()); + } +} + +F64Kilobytes Recording::getLastValue(const StatType<MemAccumulator>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return F64Bytes(active_accumulator ? active_accumulator->mSize.getLastValue() : accumulator.mSize.getLastValue()); +} + +bool Recording::hasValue(const StatType<MemAccumulator::AllocationFacet>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return accumulator.mAllocations.hasValue() || (active_accumulator ? active_accumulator->mAllocations.hasValue() : false); +} + +F64Kilobytes Recording::getSum(const StatType<MemAccumulator::AllocationFacet>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return F64Bytes(accumulator.mAllocations.getSum() + (active_accumulator ? active_accumulator->mAllocations.getSum() : 0)); +} + +F64Kilobytes Recording::getPerSec(const StatType<MemAccumulator::AllocationFacet>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return F64Bytes((accumulator.mAllocations.getSum() + (active_accumulator ? active_accumulator->mAllocations.getSum() : 0)) / mElapsedSeconds.value()); +} + +S32 Recording::getSampleCount(const StatType<MemAccumulator::AllocationFacet>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return accumulator.mAllocations.getSampleCount() + (active_accumulator ? active_accumulator->mAllocations.getSampleCount() : 0); +} + +bool Recording::hasValue(const StatType<MemAccumulator::DeallocationFacet>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return accumulator.mDeallocations.hasValue() || (active_accumulator ? active_accumulator->mDeallocations.hasValue() : false); +} + + +F64Kilobytes Recording::getSum(const StatType<MemAccumulator::DeallocationFacet>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return F64Bytes(accumulator.mDeallocations.getSum() + (active_accumulator ? active_accumulator->mDeallocations.getSum() : 0)); +} + +F64Kilobytes Recording::getPerSec(const StatType<MemAccumulator::DeallocationFacet>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return F64Bytes((accumulator.mDeallocations.getSum() + (active_accumulator ? active_accumulator->mDeallocations.getSum() : 0)) / mElapsedSeconds.value()); +} + +S32 Recording::getSampleCount(const StatType<MemAccumulator::DeallocationFacet>& stat) +{ + update(); + const MemAccumulator& accumulator = mBuffers->mMemStats[stat.getIndex()]; + const MemAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mMemStats[stat.getIndex()] : NULL; + return accumulator.mDeallocations.getSampleCount() + (active_accumulator ? active_accumulator->mDeallocations.getSampleCount() : 0); +} + +bool Recording::hasValue(const StatType<CountAccumulator>& stat) +{ + update(); + const CountAccumulator& accumulator = mBuffers->mCounts[stat.getIndex()]; + const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : NULL; + return accumulator.hasValue() || (active_accumulator ? active_accumulator->hasValue() : false); +} + +F64 Recording::getSum(const StatType<CountAccumulator>& stat) +{ + update(); + const CountAccumulator& accumulator = mBuffers->mCounts[stat.getIndex()]; + const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : NULL; + return accumulator.getSum() + (active_accumulator ? active_accumulator->getSum() : 0); +} + +F64 Recording::getPerSec( const StatType<CountAccumulator>& stat ) +{ + update(); + const CountAccumulator& accumulator = mBuffers->mCounts[stat.getIndex()]; + const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : NULL; + F64 sum = accumulator.getSum() + (active_accumulator ? active_accumulator->getSum() : 0); + return sum / mElapsedSeconds.value(); +} + +S32 Recording::getSampleCount( const StatType<CountAccumulator>& stat ) +{ + update(); + const CountAccumulator& accumulator = mBuffers->mCounts[stat.getIndex()]; + const CountAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mCounts[stat.getIndex()] : NULL; + return accumulator.getSampleCount() + (active_accumulator ? active_accumulator->getSampleCount() : 0); +} + +bool Recording::hasValue(const StatType<SampleAccumulator>& stat) +{ + update(); + const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + return accumulator.hasValue() || (active_accumulator && active_accumulator->hasValue()); +} + +F64 Recording::getMin( const StatType<SampleAccumulator>& stat ) +{ + update(); + const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + return llmin(accumulator.getMin(), active_accumulator && active_accumulator->hasValue() ? active_accumulator->getMin() : F32_MAX); +} + +F64 Recording::getMax( const StatType<SampleAccumulator>& stat ) +{ + update(); + const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + return llmax(accumulator.getMax(), active_accumulator && active_accumulator->hasValue() ? active_accumulator->getMax() : F32_MIN); +} + +F64 Recording::getMean( const StatType<SampleAccumulator>& stat ) +{ + update(); + const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + if (active_accumulator && active_accumulator->hasValue()) + { + return lerp(accumulator.getMean(), active_accumulator->getMean(), active_accumulator->getSampleCount() / (accumulator.getSampleCount() + active_accumulator->getSampleCount())); + } + else + { + return accumulator.getMean(); + } +} + +F64 Recording::getStandardDeviation( const StatType<SampleAccumulator>& stat ) +{ + update(); + const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + + if (active_accumulator && active_accumulator->hasValue()) + { + F64 sum_of_squares = SampleAccumulator::mergeSumsOfSquares(accumulator, *active_accumulator); + return sqrtf(sum_of_squares / (accumulator.getSamplingTime() + active_accumulator->getSamplingTime())); + } + else + { + return accumulator.getStandardDeviation(); + } +} + +F64 Recording::getLastValue( const StatType<SampleAccumulator>& stat ) +{ + update(); + const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + return (active_accumulator && active_accumulator->hasValue() ? active_accumulator->getLastValue() : accumulator.getLastValue()); +} + +S32 Recording::getSampleCount( const StatType<SampleAccumulator>& stat ) +{ + update(); + const SampleAccumulator& accumulator = mBuffers->mSamples[stat.getIndex()]; + const SampleAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mSamples[stat.getIndex()] : NULL; + return accumulator.getSampleCount() + (active_accumulator && active_accumulator->hasValue() ? active_accumulator->getSampleCount() : 0); +} + +bool Recording::hasValue(const StatType<EventAccumulator>& stat) +{ + update(); + const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + return accumulator.hasValue() || (active_accumulator && active_accumulator->hasValue()); +} + +F64 Recording::getSum( const StatType<EventAccumulator>& stat) +{ + update(); + const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + return (F64)(accumulator.getSum() + (active_accumulator && active_accumulator->hasValue() ? active_accumulator->getSum() : 0)); +} + +F64 Recording::getMin( const StatType<EventAccumulator>& stat ) +{ + update(); + const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + return llmin(accumulator.getMin(), active_accumulator && active_accumulator->hasValue() ? active_accumulator->getMin() : F32_MAX); +} + +F64 Recording::getMax( const StatType<EventAccumulator>& stat ) +{ + update(); + const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + return llmax(accumulator.getMax(), active_accumulator && active_accumulator->hasValue() ? active_accumulator->getMax() : F32_MIN); +} + +F64 Recording::getMean( const StatType<EventAccumulator>& stat ) +{ + update(); + const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + if (active_accumulator && active_accumulator->hasValue()) + { + return lerp(accumulator.getMean(), active_accumulator->getMean(), active_accumulator->getSampleCount() / (accumulator.getSampleCount() + active_accumulator->getSampleCount())); + } + else + { + return accumulator.getMean(); + } +} + +F64 Recording::getStandardDeviation( const StatType<EventAccumulator>& stat ) +{ + update(); + const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + + if (active_accumulator && active_accumulator->hasValue()) + { + F64 sum_of_squares = EventAccumulator::mergeSumsOfSquares(accumulator, *active_accumulator); + return sqrtf(sum_of_squares / (accumulator.getSampleCount() + active_accumulator->getSampleCount())); + } + else + { + return accumulator.getStandardDeviation(); + } +} + +F64 Recording::getLastValue( const StatType<EventAccumulator>& stat ) +{ + update(); + const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + return active_accumulator ? active_accumulator->getLastValue() : accumulator.getLastValue(); +} + +S32 Recording::getSampleCount( const StatType<EventAccumulator>& stat ) +{ + update(); + const EventAccumulator& accumulator = mBuffers->mEvents[stat.getIndex()]; + const EventAccumulator* active_accumulator = mActiveBuffers ? &mActiveBuffers->mEvents[stat.getIndex()] : NULL; + return accumulator.getSampleCount() + (active_accumulator ? active_accumulator->getSampleCount() : 0); +} + +/////////////////////////////////////////////////////////////////////// +// PeriodicRecording +/////////////////////////////////////////////////////////////////////// + +PeriodicRecording::PeriodicRecording( S32 num_periods, EPlayState state) +: mAutoResize(num_periods == 0), + mCurPeriod(0), + mNumRecordedPeriods(0), + mRecordingPeriods(num_periods ? num_periods : 1) +{ + setPlayState(state); + claim_alloc(gTraceMemStat, this); +} + +PeriodicRecording::~PeriodicRecording() +{ + disclaim_alloc(gTraceMemStat, this); +} + +void PeriodicRecording::nextPeriod() +{ + if (mAutoResize) + { + mRecordingPeriods.push_back(Recording()); + } + + Recording& old_recording = getCurRecording(); + mCurPeriod = (mCurPeriod + 1) % mRecordingPeriods.size(); + old_recording.splitTo(getCurRecording()); + + mNumRecordedPeriods = llmin((S32)mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1); +} + +void PeriodicRecording::appendRecording(Recording& recording) +{ + getCurRecording().appendRecording(recording); + nextPeriod(); +} + + +void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other ) +{ + if (other.mRecordingPeriods.empty()) return; + + getCurRecording().update(); + other.getCurRecording().update(); + + const S32 other_recording_slots = other.mRecordingPeriods.size(); + const S32 other_num_recordings = other.getNumRecordedPeriods(); + const S32 other_current_recording_index = other.mCurPeriod; + const S32 other_oldest_recording_index = (other_current_recording_index + other_recording_slots - other_num_recordings) % other_recording_slots; + + // append first recording into our current slot + getCurRecording().appendRecording(other.mRecordingPeriods[other_oldest_recording_index]); + + // from now on, add new recordings for everything after the first + S32 other_index = (other_oldest_recording_index + 1) % other_recording_slots; + + if (mAutoResize) + { + // push back recordings for everything in the middle + S32 other_index = (other_oldest_recording_index + 1) % other_recording_slots; + while (other_index != other_current_recording_index) + { + mRecordingPeriods.push_back(other.mRecordingPeriods[other_index]); + other_index = (other_index + 1) % other_recording_slots; + } + + // add final recording, if it wasn't already added as the first + if (other_num_recordings > 1) + { + mRecordingPeriods.push_back(other.mRecordingPeriods[other_current_recording_index]); + } + + mCurPeriod = mRecordingPeriods.size() - 1; + mNumRecordedPeriods = mRecordingPeriods.size() - 1; + } + else + { + S32 num_to_copy = llmin((S32)mRecordingPeriods.size(), (S32)other_num_recordings); + + std::vector<Recording>::iterator src_it = other.mRecordingPeriods.begin() + other_index ; + std::vector<Recording>::iterator dest_it = mRecordingPeriods.begin() + mCurPeriod; + + // already consumed the first recording from other, so start counting at 1 + for(S32 i = 1; i < num_to_copy; i++) + { + *dest_it = *src_it; + + if (++src_it == other.mRecordingPeriods.end()) + { + src_it = other.mRecordingPeriods.begin(); + } + + if (++dest_it == mRecordingPeriods.end()) + { + dest_it = mRecordingPeriods.begin(); + } + } + + // want argument to % to be positive, otherwise result could be negative and thus out of bounds + llassert(num_to_copy >= 1); + // advance to last recording period copied, and make that our current period + mCurPeriod = (mCurPeriod + num_to_copy - 1) % mRecordingPeriods.size(); + mNumRecordedPeriods = llmin((S32)mRecordingPeriods.size() - 1, mNumRecordedPeriods + num_to_copy - 1); + } + + // end with fresh period, otherwise next appendPeriodicRecording() will merge the first + // recording period with the last one appended here + nextPeriod(); + getCurRecording().setPlayState(getPlayState()); +} + +F64Seconds PeriodicRecording::getDuration() const +{ + F64Seconds duration; + S32 num_periods = mRecordingPeriods.size(); + for (S32 i = 1; i <= num_periods; i++) + { + S32 index = (mCurPeriod + num_periods - i) % num_periods; + duration += mRecordingPeriods[index].getDuration(); + } + return duration; +} + + +LLTrace::Recording PeriodicRecording::snapshotCurRecording() const +{ + Recording recording_copy(getCurRecording()); + recording_copy.stop(); + return recording_copy; +} + + +Recording& PeriodicRecording::getLastRecording() +{ + return getPrevRecording(1); +} + +const Recording& PeriodicRecording::getLastRecording() const +{ + return getPrevRecording(1); +} + +Recording& PeriodicRecording::getCurRecording() +{ + return mRecordingPeriods[mCurPeriod]; +} + +const Recording& PeriodicRecording::getCurRecording() const +{ + return mRecordingPeriods[mCurPeriod]; +} + +Recording& PeriodicRecording::getPrevRecording( S32 offset ) +{ + S32 num_periods = mRecordingPeriods.size(); + offset = llclamp(offset, 0, num_periods - 1); + return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; +} + +const Recording& PeriodicRecording::getPrevRecording( S32 offset ) const +{ + S32 num_periods = mRecordingPeriods.size(); + offset = llclamp(offset, 0, num_periods - 1); + return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; +} + +void PeriodicRecording::handleStart() +{ + getCurRecording().start(); +} + +void PeriodicRecording::handleStop() +{ + getCurRecording().pause(); +} + +void PeriodicRecording::handleReset() +{ + getCurRecording().stop(); + + if (mAutoResize) + { + mRecordingPeriods.clear(); + mRecordingPeriods.push_back(Recording()); + } + else + { + for (std::vector<Recording>::iterator it = mRecordingPeriods.begin(), end_it = mRecordingPeriods.end(); + it != end_it; + ++it) + { + it->reset(); + } + } + mCurPeriod = 0; + mNumRecordedPeriods = 0; + getCurRecording().setPlayState(getPlayState()); +} + +void PeriodicRecording::handleSplitTo(PeriodicRecording& other) +{ + getCurRecording().splitTo(other.getCurRecording()); +} + +F64 PeriodicRecording::getPeriodMin( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ ) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + bool has_value = false; + F64 min_val = std::numeric_limits<F64>::max(); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + min_val = llmin(min_val, recording.getMin(stat)); + has_value = true; + } + } + + return has_value + ? min_val + : NaN; +} + +F64 PeriodicRecording::getPeriodMax( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ ) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + bool has_value = false; + F64 max_val = std::numeric_limits<F64>::min(); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + max_val = llmax(max_val, recording.getMax(stat)); + has_value = true; + } + } + + return has_value + ? max_val + : NaN; +} + +// calculates means using aggregates per period +F64 PeriodicRecording::getPeriodMean( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ ) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + F64 mean = 0; + S32 valid_period_count = 0; + + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + mean += recording.getMean(stat); + valid_period_count++; + } + } + + return valid_period_count + ? mean / (F64)valid_period_count + : NaN; +} + + +F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ ) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + F64 period_mean = getPeriodMean(stat, num_periods); + F64 sum_of_squares = 0; + S32 valid_period_count = 0; + + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + F64 delta = recording.getMean(stat) - period_mean; + sum_of_squares += delta * delta; + valid_period_count++; + } + } + + return valid_period_count + ? sqrt((F64)sum_of_squares / (F64)valid_period_count) + : NaN; +} + +F64 PeriodicRecording::getPeriodMin( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ ) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + bool has_value = false; + F64 min_val = std::numeric_limits<F64>::max(); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + min_val = llmin(min_val, recording.getMin(stat)); + has_value = true; + } + } + + return has_value + ? min_val + : NaN; +} + +F64 PeriodicRecording::getPeriodMax(const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + bool has_value = false; + F64 max_val = std::numeric_limits<F64>::min(); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + max_val = llmax(max_val, recording.getMax(stat)); + has_value = true; + } + } + + return has_value + ? max_val + : NaN; +} + + +F64 PeriodicRecording::getPeriodMean( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ ) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + S32 valid_period_count = 0; + F64 mean = 0; + + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + mean += recording.getMean(stat); + valid_period_count++; + } + } + + return valid_period_count + ? mean / F64(valid_period_count) + : NaN; +} + +F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ ) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + F64 period_mean = getPeriodMean(stat, num_periods); + S32 valid_period_count = 0; + F64 sum_of_squares = 0; + + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + F64 delta = recording.getMean(stat) - period_mean; + sum_of_squares += delta * delta; + valid_period_count++; + } + } + + return valid_period_count + ? sqrt(sum_of_squares / (F64)valid_period_count) + : NaN; +} + + +F64Kilobytes PeriodicRecording::getPeriodMin( const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/ ) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + F64Kilobytes min_val(std::numeric_limits<F64>::max()); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + min_val = llmin(min_val, recording.getMin(stat)); + } + + return min_val; +} + +F64Kilobytes PeriodicRecording::getPeriodMin(const MemStatHandle& stat, S32 num_periods) +{ + return getPeriodMin(static_cast<const StatType<MemAccumulator>&>(stat), num_periods); +} + +F64Kilobytes PeriodicRecording::getPeriodMax(const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + F64Kilobytes max_val(0.0); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + max_val = llmax(max_val, recording.getMax(stat)); + } + + return max_val; +} + +F64Kilobytes PeriodicRecording::getPeriodMax(const MemStatHandle& stat, S32 num_periods) +{ + return getPeriodMax(static_cast<const StatType<MemAccumulator>&>(stat), num_periods); +} + +F64Kilobytes PeriodicRecording::getPeriodMean( const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/ ) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + F64Kilobytes mean(0); + + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + mean += recording.getMean(stat); + } + + return mean / F64(num_periods); +} + +F64Kilobytes PeriodicRecording::getPeriodMean(const MemStatHandle& stat, S32 num_periods) +{ + return getPeriodMean(static_cast<const StatType<MemAccumulator>&>(stat), num_periods); +} + +F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/ ) +{ + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + F64Kilobytes period_mean = getPeriodMean(stat, num_periods); + S32 valid_period_count = 0; + F64 sum_of_squares = 0; + + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + F64Kilobytes delta = recording.getMean(stat) - period_mean; + sum_of_squares += delta.value() * delta.value(); + valid_period_count++; + } + } + + return F64Kilobytes(valid_period_count + ? sqrt(sum_of_squares / (F64)valid_period_count) + : NaN); +} + +F64Kilobytes PeriodicRecording::getPeriodStandardDeviation(const MemStatHandle& stat, S32 num_periods) +{ + return getPeriodStandardDeviation(static_cast<const StatType<MemAccumulator>&>(stat), num_periods); +} + +/////////////////////////////////////////////////////////////////////// +// ExtendableRecording +/////////////////////////////////////////////////////////////////////// + +void ExtendableRecording::extend() +{ + // push the data back to accepted recording + mAcceptedRecording.appendRecording(mPotentialRecording); + // flush data, so we can start from scratch + mPotentialRecording.reset(); +} + +void ExtendableRecording::handleStart() +{ + mPotentialRecording.start(); +} + +void ExtendableRecording::handleStop() +{ + mPotentialRecording.pause(); +} + +void ExtendableRecording::handleReset() +{ + mAcceptedRecording.reset(); + mPotentialRecording.reset(); +} + +void ExtendableRecording::handleSplitTo(ExtendableRecording& other) +{ + mPotentialRecording.splitTo(other.mPotentialRecording); +} + + +/////////////////////////////////////////////////////////////////////// +// ExtendablePeriodicRecording +/////////////////////////////////////////////////////////////////////// + + +ExtendablePeriodicRecording::ExtendablePeriodicRecording() +: mAcceptedRecording(0), + mPotentialRecording(0) +{} + +void ExtendablePeriodicRecording::extend() +{ + // push the data back to accepted recording + mAcceptedRecording.appendPeriodicRecording(mPotentialRecording); + // flush data, so we can start from scratch + mPotentialRecording.reset(); +} + + +void ExtendablePeriodicRecording::handleStart() +{ + mPotentialRecording.start(); +} + +void ExtendablePeriodicRecording::handleStop() +{ + mPotentialRecording.pause(); +} + +void ExtendablePeriodicRecording::handleReset() +{ + mAcceptedRecording.reset(); + mPotentialRecording.reset(); +} + +void ExtendablePeriodicRecording::handleSplitTo(ExtendablePeriodicRecording& other) +{ + mPotentialRecording.splitTo(other.mPotentialRecording); +} + + +PeriodicRecording& get_frame_recording() +{ + static LLThreadLocalPointer<PeriodicRecording> sRecording(new PeriodicRecording(200, PeriodicRecording::STARTED)); + return *sRecording; +} + +} + +void LLStopWatchControlsMixinCommon::start() +{ + switch (mPlayState) + { + case STOPPED: + handleReset(); + handleStart(); + mPlayState = STARTED; + break; + case PAUSED: + handleStart(); + mPlayState = STARTED; + break; + case STARTED: + break; + default: + llassert(false); + break; + } +} + +void LLStopWatchControlsMixinCommon::stop() +{ + switch (mPlayState) + { + case STOPPED: + break; + case PAUSED: + mPlayState = STOPPED; + break; + case STARTED: + handleStop(); + mPlayState = STOPPED; + break; + default: + llassert(false); + break; + } +} + +void LLStopWatchControlsMixinCommon::pause() +{ + switch (mPlayState) + { + case STOPPED: + // stay stopped, don't go to pause + break; + case PAUSED: + break; + case STARTED: + handleStop(); + mPlayState = PAUSED; + break; + default: + llassert(false); + break; + } +} + +void LLStopWatchControlsMixinCommon::unpause() +{ + switch (mPlayState) + { + case STOPPED: + // stay stopped, don't start + break; + case PAUSED: + handleStart(); + mPlayState = STARTED; + break; + case STARTED: + break; + default: + llassert(false); + break; + } +} + +void LLStopWatchControlsMixinCommon::resume() +{ + switch (mPlayState) + { + case STOPPED: + handleStart(); + mPlayState = STARTED; + break; + case PAUSED: + handleStart(); + mPlayState = STARTED; + break; + case STARTED: + break; + default: + llassert(false); + break; + } +} + +void LLStopWatchControlsMixinCommon::restart() +{ + switch (mPlayState) + { + case STOPPED: + handleReset(); + handleStart(); + mPlayState = STARTED; + break; + case PAUSED: + handleReset(); + handleStart(); + mPlayState = STARTED; + break; + case STARTED: + handleReset(); + break; + default: + llassert(false); + break; + } +} + +void LLStopWatchControlsMixinCommon::reset() +{ + handleReset(); +} + +void LLStopWatchControlsMixinCommon::setPlayState( EPlayState state ) +{ + switch(state) + { + case STOPPED: + stop(); + break; + case PAUSED: + pause(); + break; + case STARTED: + start(); + break; + default: + llassert(false); + break; + } + + mPlayState = state; +} diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h new file mode 100644 index 0000000000000000000000000000000000000000..d0b4a842a64aee82b234b894551b9df94ac1161e --- /dev/null +++ b/indra/llcommon/lltracerecording.h @@ -0,0 +1,670 @@ +/** + * @file lltracerecording.h + * @brief Sampling object for collecting runtime statistics originating from lltrace. + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTRACERECORDING_H +#define LL_LLTRACERECORDING_H + +#include "stdtypes.h" +#include "llpreprocessor.h" + +#include "lltimer.h" +#include "lltraceaccumulators.h" +#include "llpointer.h" + +class LLStopWatchControlsMixinCommon +{ +public: + virtual ~LLStopWatchControlsMixinCommon() {} + + enum EPlayState + { + STOPPED, + PAUSED, + STARTED + }; + + void start(); // moves to started state, resetting if stopped + void stop(); // moves to stopped state + void pause(); // moves to paused state, unless stopped + void unpause(); // moves to started state if paused + void resume(); // moves to started state, without resetting + void restart(); // moves to started state, always resetting + void reset(); // resets + + bool isStarted() const { return mPlayState == STARTED; } + bool isPaused() const { return mPlayState == PAUSED; } + bool isStopped() const { return mPlayState == STOPPED; } + + EPlayState getPlayState() const { return mPlayState; } + // force play state to specific value by calling appropriate handle* methods + void setPlayState(EPlayState state); + +protected: + LLStopWatchControlsMixinCommon() + : mPlayState(STOPPED) + {} + +private: + // override these methods to provide started/stopped semantics + + // activate behavior (without reset) + virtual void handleStart() = 0; + // deactivate behavior + virtual void handleStop() = 0; + // clear accumulated state, may be called while started + virtual void handleReset() = 0; + + EPlayState mPlayState; +}; + +template<typename DERIVED> +class LLStopWatchControlsMixin +: public LLStopWatchControlsMixinCommon +{ +public: + + typedef LLStopWatchControlsMixin<DERIVED> self_t; + virtual void splitTo(DERIVED& other) + { + EPlayState play_state = getPlayState(); + stop(); + other.reset(); + + handleSplitTo(other); + + other.setPlayState(play_state); + } + + virtual void splitFrom(DERIVED& other) + { + static_cast<self_t&>(other).handleSplitTo(*static_cast<DERIVED*>(this)); + } +private: + self_t& operator = (const self_t& other) + { + // don't do anything, derived class must implement logic + } + + // atomically stop this object while starting the other + // no data can be missed in between stop and start + virtual void handleSplitTo(DERIVED& other) {}; + +}; + +namespace LLTrace +{ + template<typename T> + class StatType; + + template<typename T> + class CountStatHandle; + + template<typename T> + class SampleStatHandle; + + template<typename T> + class EventStatHandle; + + class MemStatHandle; + + template<typename T> + struct RelatedTypes + { + typedef F64 fractional_t; + typedef T sum_t; + }; + + template<typename T, typename UNIT_T> + struct RelatedTypes<LLUnit<T, UNIT_T> > + { + typedef LLUnit<typename RelatedTypes<T>::fractional_t, UNIT_T> fractional_t; + typedef LLUnit<typename RelatedTypes<T>::sum_t, UNIT_T> sum_t; + }; + + template<> + struct RelatedTypes<bool> + { + typedef F64 fractional_t; + typedef S32 sum_t; + }; + + class Recording + : public LLStopWatchControlsMixin<Recording> + { + public: + Recording(EPlayState state = LLStopWatchControlsMixinCommon::STOPPED); + + Recording(const Recording& other); + ~Recording(); + + Recording& operator = (const Recording& other); + + // accumulate data from subsequent, non-overlapping recording + void appendRecording(Recording& other); + + // grab latest recorded data + void update(); + + // ensure that buffers are exclusively owned by this recording + void makeUnique() { mBuffers.makeUnique(); } + + // Timer accessors + bool hasValue(const StatType<TimeBlockAccumulator>& stat); + F64Seconds getSum(const StatType<TimeBlockAccumulator>& stat); + F64Seconds getSum(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat); + S32 getSum(const StatType<TimeBlockAccumulator::CallCountFacet>& stat); + + F64Seconds getPerSec(const StatType<TimeBlockAccumulator>& stat); + F64Seconds getPerSec(const StatType<TimeBlockAccumulator::SelfTimeFacet>& stat); + F32 getPerSec(const StatType<TimeBlockAccumulator::CallCountFacet>& stat); + + // Memory accessors + bool hasValue(const StatType<MemAccumulator>& stat); + F64Kilobytes getMin(const StatType<MemAccumulator>& stat); + F64Kilobytes getMean(const StatType<MemAccumulator>& stat); + F64Kilobytes getMax(const StatType<MemAccumulator>& stat); + F64Kilobytes getStandardDeviation(const StatType<MemAccumulator>& stat); + F64Kilobytes getLastValue(const StatType<MemAccumulator>& stat); + + bool hasValue(const StatType<MemAccumulator::AllocationFacet>& stat); + F64Kilobytes getSum(const StatType<MemAccumulator::AllocationFacet>& stat); + F64Kilobytes getPerSec(const StatType<MemAccumulator::AllocationFacet>& stat); + S32 getSampleCount(const StatType<MemAccumulator::AllocationFacet>& stat); + + bool hasValue(const StatType<MemAccumulator::DeallocationFacet>& stat); + F64Kilobytes getSum(const StatType<MemAccumulator::DeallocationFacet>& stat); + F64Kilobytes getPerSec(const StatType<MemAccumulator::DeallocationFacet>& stat); + S32 getSampleCount(const StatType<MemAccumulator::DeallocationFacet>& stat); + + // CountStatHandle accessors + bool hasValue(const StatType<CountAccumulator>& stat); + F64 getSum(const StatType<CountAccumulator>& stat); + template <typename T> + typename RelatedTypes<T>::sum_t getSum(const CountStatHandle<T>& stat) + { + return (typename RelatedTypes<T>::sum_t)getSum(static_cast<const StatType<CountAccumulator>&> (stat)); + } + + F64 getPerSec(const StatType<CountAccumulator>& stat); + template <typename T> + typename RelatedTypes<T>::fractional_t getPerSec(const CountStatHandle<T>& stat) + { + return (typename RelatedTypes<T>::fractional_t)getPerSec(static_cast<const StatType<CountAccumulator>&> (stat)); + } + + S32 getSampleCount(const StatType<CountAccumulator>& stat); + + + // SampleStatHandle accessors + bool hasValue(const StatType<SampleAccumulator>& stat); + + F64 getMin(const StatType<SampleAccumulator>& stat); + template <typename T> + T getMin(const SampleStatHandle<T>& stat) + { + return (T)getMin(static_cast<const StatType<SampleAccumulator>&> (stat)); + } + + F64 getMax(const StatType<SampleAccumulator>& stat); + template <typename T> + T getMax(const SampleStatHandle<T>& stat) + { + return (T)getMax(static_cast<const StatType<SampleAccumulator>&> (stat)); + } + + F64 getMean(const StatType<SampleAccumulator>& stat); + template <typename T> + typename RelatedTypes<T>::fractional_t getMean(SampleStatHandle<T>& stat) + { + return (typename RelatedTypes<T>::fractional_t)getMean(static_cast<const StatType<SampleAccumulator>&> (stat)); + } + + F64 getStandardDeviation(const StatType<SampleAccumulator>& stat); + template <typename T> + typename RelatedTypes<T>::fractional_t getStandardDeviation(const SampleStatHandle<T>& stat) + { + return (typename RelatedTypes<T>::fractional_t)getStandardDeviation(static_cast<const StatType<SampleAccumulator>&> (stat)); + } + + F64 getLastValue(const StatType<SampleAccumulator>& stat); + template <typename T> + T getLastValue(const SampleStatHandle<T>& stat) + { + return (T)getLastValue(static_cast<const StatType<SampleAccumulator>&> (stat)); + } + + S32 getSampleCount(const StatType<SampleAccumulator>& stat); + + // EventStatHandle accessors + bool hasValue(const StatType<EventAccumulator>& stat); + + F64 getSum(const StatType<EventAccumulator>& stat); + template <typename T> + typename RelatedTypes<T>::sum_t getSum(const EventStatHandle<T>& stat) + { + return (typename RelatedTypes<T>::sum_t)getSum(static_cast<const StatType<EventAccumulator>&> (stat)); + } + + F64 getMin(const StatType<EventAccumulator>& stat); + template <typename T> + T getMin(const EventStatHandle<T>& stat) + { + return (T)getMin(static_cast<const StatType<EventAccumulator>&> (stat)); + } + + F64 getMax(const StatType<EventAccumulator>& stat); + template <typename T> + T getMax(const EventStatHandle<T>& stat) + { + return (T)getMax(static_cast<const StatType<EventAccumulator>&> (stat)); + } + + F64 getMean(const StatType<EventAccumulator>& stat); + template <typename T> + typename RelatedTypes<T>::fractional_t getMean(EventStatHandle<T>& stat) + { + return (typename RelatedTypes<T>::fractional_t)getMean(static_cast<const StatType<EventAccumulator>&> (stat)); + } + + F64 getStandardDeviation(const StatType<EventAccumulator>& stat); + template <typename T> + typename RelatedTypes<T>::fractional_t getStandardDeviation(const EventStatHandle<T>& stat) + { + return (typename RelatedTypes<T>::fractional_t)getStandardDeviation(static_cast<const StatType<EventAccumulator>&> (stat)); + } + + F64 getLastValue(const StatType<EventAccumulator>& stat); + template <typename T> + T getLastValue(const EventStatHandle<T>& stat) + { + return (T)getLastValue(static_cast<const StatType<EventAccumulator>&> (stat)); + } + + S32 getSampleCount(const StatType<EventAccumulator>& stat); + + F64Seconds getDuration() const { return mElapsedSeconds; } + + protected: + friend class ThreadRecorder; + + // implementation for LLStopWatchControlsMixin + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(Recording& other); + + // returns data for current thread + class ThreadRecorder* getThreadRecorder(); + + LLTimer mSamplingTimer; + F64Seconds mElapsedSeconds; + LLCopyOnWritePointer<AccumulatorBufferGroup> mBuffers; + AccumulatorBufferGroup* mActiveBuffers; + + }; + + class LL_COMMON_API PeriodicRecording + : public LLStopWatchControlsMixin<PeriodicRecording> + { + public: + PeriodicRecording(S32 num_periods, EPlayState state = STOPPED); + ~PeriodicRecording(); + + void nextPeriod(); + S32 getNumRecordedPeriods() + { + // current period counts if not active + return mNumRecordedPeriods + (isStarted() ? 0 : 1); + } + + F64Seconds getDuration() const; + + void appendPeriodicRecording(PeriodicRecording& other); + void appendRecording(Recording& recording); + Recording& getLastRecording(); + const Recording& getLastRecording() const; + Recording& getCurRecording(); + const Recording& getCurRecording() const; + Recording& getPrevRecording(S32 offset); + const Recording& getPrevRecording(S32 offset) const; + Recording snapshotCurRecording() const; + + template <typename T> + S32 getSampleCount(const StatType<T>& stat, S32 num_periods = S32_MAX) + { + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + S32 num_samples = 0; + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + num_samples += recording.getSampleCount(stat); + } + return num_samples; + } + + // + // PERIODIC MIN + // + + // catch all for stats that have a defined sum + template <typename T> + typename T::value_t getPeriodMin(const StatType<T>& stat, S32 num_periods = S32_MAX) + { + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + bool has_value = false; + typename T::value_t min_val(std::numeric_limits<typename T::value_t>::max()); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + min_val = llmin(min_val, recording.getSum(stat)); + has_value = true; + } + } + + return has_value + ? min_val + : T::getDefaultValue(); + } + + template<typename T> + T getPeriodMin(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return T(getPeriodMin(static_cast<const StatType<CountAccumulator>&>(stat), num_periods)); + } + + F64 getPeriodMin(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX); + template<typename T> + T getPeriodMin(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return T(getPeriodMin(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods)); + } + + F64 getPeriodMin(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX); + template<typename T> + T getPeriodMin(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return T(getPeriodMin(static_cast<const StatType<EventAccumulator>&>(stat), num_periods)); + } + + F64Kilobytes getPeriodMin(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMin(const MemStatHandle& stat, S32 num_periods = S32_MAX); + + template <typename T> + typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMinPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX) + { + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + typename RelatedTypes<typename T::value_t>::fractional_t min_val(std::numeric_limits<F64>::max()); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + min_val = llmin(min_val, recording.getPerSec(stat)); + } + return (typename RelatedTypes<typename T::value_t>::fractional_t) min_val; + } + + template<typename T> + typename RelatedTypes<T>::fractional_t getPeriodMinPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return typename RelatedTypes<T>::fractional_t(getPeriodMinPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods)); + } + + // + // PERIODIC MAX + // + + // catch all for stats that have a defined sum + template <typename T> + typename T::value_t getPeriodMax(const StatType<T>& stat, S32 num_periods = S32_MAX) + { + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + bool has_value = false; + typename T::value_t max_val(std::numeric_limits<typename T::value_t>::min()); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.hasValue(stat)) + { + max_val = llmax(max_val, recording.getSum(stat)); + has_value = true; + } + } + + return has_value + ? max_val + : T::getDefaultValue(); + } + + template<typename T> + T getPeriodMax(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return T(getPeriodMax(static_cast<const StatType<CountAccumulator>&>(stat), num_periods)); + } + + F64 getPeriodMax(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX); + template<typename T> + T getPeriodMax(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return T(getPeriodMax(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods)); + } + + F64 getPeriodMax(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX); + template<typename T> + T getPeriodMax(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return T(getPeriodMax(static_cast<const StatType<EventAccumulator>&>(stat), num_periods)); + } + + F64Kilobytes getPeriodMax(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMax(const MemStatHandle& stat, S32 num_periods = S32_MAX); + + template <typename T> + typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMaxPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX) + { + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + F64 max_val = std::numeric_limits<F64>::min(); + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + max_val = llmax(max_val, recording.getPerSec(stat)); + } + return (typename RelatedTypes<typename T::value_t>::fractional_t)max_val; + } + + template<typename T> + typename RelatedTypes<T>::fractional_t getPeriodMaxPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return typename RelatedTypes<T>::fractional_t(getPeriodMaxPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods)); + } + + // + // PERIODIC MEAN + // + + // catch all for stats that have a defined sum + template <typename T> + typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMean(const StatType<T >& stat, S32 num_periods = S32_MAX) + { + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + typename RelatedTypes<typename T::value_t>::fractional_t mean(0); + + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.getDuration() > (F32Seconds)0.f) + { + mean += recording.getSum(stat); + } + } + return (num_periods + ? typename RelatedTypes<typename T::value_t>::fractional_t(mean / num_periods) + : typename RelatedTypes<typename T::value_t>::fractional_t(NaN)); + } + + template<typename T> + typename RelatedTypes<T>::fractional_t getPeriodMean(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<CountAccumulator>&>(stat), num_periods)); + } + F64 getPeriodMean(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX); + template<typename T> + typename RelatedTypes<T>::fractional_t getPeriodMean(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods)); + } + + F64 getPeriodMean(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX); + template<typename T> + typename RelatedTypes<T>::fractional_t getPeriodMean(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<EventAccumulator>&>(stat), num_periods)); + } + + F64Kilobytes getPeriodMean(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMean(const MemStatHandle& stat, S32 num_periods = S32_MAX); + + template <typename T> + typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMeanPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX) + { + num_periods = llmin(num_periods, getNumRecordedPeriods()); + + typename RelatedTypes<typename T::value_t>::fractional_t mean = 0; + + for (S32 i = 1; i <= num_periods; i++) + { + Recording& recording = getPrevRecording(i); + if (recording.getDuration() > (F32Seconds)0.f) + { + mean += recording.getPerSec(stat); + } + } + + return (num_periods + ? typename RelatedTypes<typename T::value_t>::fractional_t(mean / num_periods) + : typename RelatedTypes<typename T::value_t>::fractional_t(NaN)); + } + + template<typename T> + typename RelatedTypes<T>::fractional_t getPeriodMeanPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return typename RelatedTypes<T>::fractional_t(getPeriodMeanPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods)); + } + + // + // PERIODIC STANDARD DEVIATION + // + + F64 getPeriodStandardDeviation(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX); + + template<typename T> + typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods)); + } + + F64 getPeriodStandardDeviation(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX); + template<typename T> + typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX) + { + return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const StatType<EventAccumulator>&>(stat), num_periods)); + } + + F64Kilobytes getPeriodStandardDeviation(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, S32 num_periods = S32_MAX); + + private: + // implementation for LLStopWatchControlsMixin + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(PeriodicRecording& other); + + private: + std::vector<Recording> mRecordingPeriods; + const bool mAutoResize; + S32 mCurPeriod; + S32 mNumRecordedPeriods; + }; + + PeriodicRecording& get_frame_recording(); + + class ExtendableRecording + : public LLStopWatchControlsMixin<ExtendableRecording> + { + public: + void extend(); + + Recording& getAcceptedRecording() { return mAcceptedRecording; } + const Recording& getAcceptedRecording() const {return mAcceptedRecording;} + + Recording& getPotentialRecording() { return mPotentialRecording; } + const Recording& getPotentialRecording() const { return mPotentialRecording;} + + private: + // implementation for LLStopWatchControlsMixin + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(ExtendableRecording& other); + + private: + Recording mAcceptedRecording; + Recording mPotentialRecording; + }; + + class ExtendablePeriodicRecording + : public LLStopWatchControlsMixin<ExtendablePeriodicRecording> + { + public: + ExtendablePeriodicRecording(); + void extend(); + + PeriodicRecording& getResults() { return mAcceptedRecording; } + const PeriodicRecording& getResults() const {return mAcceptedRecording;} + + void nextPeriod() { mPotentialRecording.nextPeriod(); } + + private: + // implementation for LLStopWatchControlsMixin + /*virtual*/ void handleStart(); + /*virtual*/ void handleStop(); + /*virtual*/ void handleReset(); + /*virtual*/ void handleSplitTo(ExtendablePeriodicRecording& other); + + private: + PeriodicRecording mAcceptedRecording; + PeriodicRecording mPotentialRecording; + }; +} + +#endif // LL_LLTRACERECORDING_H diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp new file mode 100644 index 0000000000000000000000000000000000000000..181fc2f058f4e7b575ce6c363f99367262ce076d --- /dev/null +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -0,0 +1,329 @@ +/** + * @file lltracethreadrecorder.cpp + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "lltracethreadrecorder.h" +#include "llfasttimer.h" +#include "lltrace.h" + +namespace LLTrace +{ +extern MemStatHandle gTraceMemStat; + +static ThreadRecorder* sMasterThreadRecorder = NULL; + +/////////////////////////////////////////////////////////////////////// +// ThreadRecorder +/////////////////////////////////////////////////////////////////////// + +ThreadRecorder::ThreadRecorder() +: mParentRecorder(NULL) +{ + init(); +} + +void ThreadRecorder::init() +{ +#if LL_TRACE_ENABLED + LLThreadLocalSingletonPointer<BlockTimerStackRecord>::setInstance(&mBlockTimerStackRecord); + //NB: the ordering of initialization in this function is very fragile due to a large number of implicit dependencies + set_thread_recorder(this); + BlockTimerStatHandle& root_time_block = BlockTimer::getRootTimeBlock(); + + BlockTimerStackRecord* timer_stack = LLThreadLocalSingletonPointer<BlockTimerStackRecord>::getInstance(); + timer_stack->mTimeBlock = &root_time_block; + timer_stack->mActiveTimer = NULL; + + mNumTimeBlockTreeNodes = AccumulatorBuffer<TimeBlockAccumulator>::getDefaultBuffer()->size(); + + mTimeBlockTreeNodes = new TimeBlockTreeNode[mNumTimeBlockTreeNodes]; + + activate(&mThreadRecordingBuffers); + + // initialize time block parent pointers + for (BlockTimerStatHandle::instance_tracker_t::instance_iter it = BlockTimerStatHandle::instance_tracker_t::beginInstances(), end_it = BlockTimerStatHandle::instance_tracker_t::endInstances(); + it != end_it; + ++it) + { + BlockTimerStatHandle& time_block = static_cast<BlockTimerStatHandle&>(*it); + TimeBlockTreeNode& tree_node = mTimeBlockTreeNodes[it->getIndex()]; + tree_node.mBlock = &time_block; + tree_node.mParent = &root_time_block; + + it->getCurrentAccumulator().mParent = &root_time_block; + } + + mRootTimer = new BlockTimer(root_time_block); + timer_stack->mActiveTimer = mRootTimer; + + BlockTimer::getRootTimeBlock().getCurrentAccumulator().mActiveCount = 1; + + claim_alloc(gTraceMemStat, this); + claim_alloc(gTraceMemStat, mRootTimer); + claim_alloc(gTraceMemStat, sizeof(TimeBlockTreeNode) * mNumTimeBlockTreeNodes); +#endif +} + + +ThreadRecorder::ThreadRecorder( ThreadRecorder& parent ) +: mParentRecorder(&parent) +{ + init(); + mParentRecorder->addChildRecorder(this); +} + + +ThreadRecorder::~ThreadRecorder() +{ +#if LL_TRACE_ENABLED + LLThreadLocalSingletonPointer<BlockTimerStackRecord>::setInstance(NULL); + + disclaim_alloc(gTraceMemStat, this); + disclaim_alloc(gTraceMemStat, sizeof(BlockTimer)); + disclaim_alloc(gTraceMemStat, sizeof(TimeBlockTreeNode) * mNumTimeBlockTreeNodes); + + deactivate(&mThreadRecordingBuffers); + + delete mRootTimer; + + if (!mActiveRecordings.empty()) + { + std::for_each(mActiveRecordings.begin(), mActiveRecordings.end(), DeletePointer()); + mActiveRecordings.clear(); + } + + set_thread_recorder(NULL); + delete[] mTimeBlockTreeNodes; + + if (mParentRecorder) + { + mParentRecorder->removeChildRecorder(this); + } +#endif +} + +TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( S32 index ) +{ +#if LL_TRACE_ENABLED + if (0 <= index && index < mNumTimeBlockTreeNodes) + { + return &mTimeBlockTreeNodes[index]; + } +#endif + return NULL; +} + +AccumulatorBufferGroup* ThreadRecorder::activate( AccumulatorBufferGroup* recording) +{ +#if LL_TRACE_ENABLED + ActiveRecording* active_recording = new ActiveRecording(recording); + if (!mActiveRecordings.empty()) + { + AccumulatorBufferGroup& prev_active_recording = mActiveRecordings.back()->mPartialRecording; + prev_active_recording.sync(); + BlockTimer::updateTimes(); + prev_active_recording.handOffTo(active_recording->mPartialRecording); + } + mActiveRecordings.push_back(active_recording); + + mActiveRecordings.back()->mPartialRecording.makeCurrent(); + return &active_recording->mPartialRecording; +#else + return NULL; +#endif +} + +ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate( AccumulatorBufferGroup* recording ) +{ +#if LL_TRACE_ENABLED + if (mActiveRecordings.empty()) return mActiveRecordings.end(); + + mActiveRecordings.back()->mPartialRecording.sync(); + BlockTimer::updateTimes(); + + active_recording_list_t::reverse_iterator it, end_it; + for (it = mActiveRecordings.rbegin(), end_it = mActiveRecordings.rend(); + it != end_it; + ++it) + { + ActiveRecording* cur_recording = *it; + + active_recording_list_t::reverse_iterator next_it = it; + ++next_it; + + // if we have another recording further down in the stack... + if (next_it != mActiveRecordings.rend()) + { + // ...push our gathered data down to it + (*next_it)->mPartialRecording.append(cur_recording->mPartialRecording); + } + + // copy accumulated measurements into result buffer and clear accumulator (mPartialRecording) + cur_recording->movePartialToTarget(); + + if (cur_recording->mTargetRecording == recording) + { + // found the recording, so return it + break; + } + } + + if (it == end_it) + { + LL_WARNS() << "Recording not active on this thread" << LL_ENDL; + } + + return (++it).base(); +#else + return ThreadRecorder::active_recording_list_t::iterator(); +#endif +} + +void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording ) +{ +#if LL_TRACE_ENABLED + active_recording_list_t::iterator recording_it = bringUpToDate(recording); + // this method should only be called on a thread where the recorder is active + llassert_always(recording_it != mActiveRecordings.end()); + + ActiveRecording* recording_to_remove = *recording_it; + bool was_current = recording_to_remove->mPartialRecording.isCurrent(); + llassert(recording_to_remove->mTargetRecording == recording); + mActiveRecordings.erase(recording_it); + if (was_current) + { + if (mActiveRecordings.empty()) + { + AccumulatorBufferGroup::clearCurrent(); + } + else + { + mActiveRecordings.back()->mPartialRecording.makeCurrent(); + } + } + delete recording_to_remove; +#endif +} + +ThreadRecorder::ActiveRecording::ActiveRecording( AccumulatorBufferGroup* target ) +: mTargetRecording(target) +{} + +void ThreadRecorder::ActiveRecording::movePartialToTarget() +{ +#if LL_TRACE_ENABLED + mTargetRecording->append(mPartialRecording); + // reset based on self to keep history + mPartialRecording.reset(&mPartialRecording); +#endif +} + + +// called by child thread +void ThreadRecorder::addChildRecorder( class ThreadRecorder* child ) +{ +#if LL_TRACE_ENABLED + { LLMutexLock lock(&mChildListMutex); + mChildThreadRecorders.push_back(child); + } +#endif +} + +// called by child thread +void ThreadRecorder::removeChildRecorder( class ThreadRecorder* child ) +{ +#if LL_TRACE_ENABLED + { LLMutexLock lock(&mChildListMutex); + mChildThreadRecorders.remove(child); + } +#endif +} + +void ThreadRecorder::pushToParent() +{ +#if LL_TRACE_ENABLED + { LLMutexLock lock(&mSharedRecordingMutex); + LLTrace::get_thread_recorder()->bringUpToDate(&mThreadRecordingBuffers); + mSharedRecordingBuffers.append(mThreadRecordingBuffers); + mThreadRecordingBuffers.reset(); + } +#endif +} + + +static LLTrace::BlockTimerStatHandle FTM_PULL_TRACE_DATA_FROM_CHILDREN("Pull child thread trace data"); + +void ThreadRecorder::pullFromChildren() +{ +#if LL_TRACE_ENABLED + LL_RECORD_BLOCK_TIME(FTM_PULL_TRACE_DATA_FROM_CHILDREN); + if (mActiveRecordings.empty()) return; + + { LLMutexLock lock(&mChildListMutex); + + AccumulatorBufferGroup& target_recording_buffers = mActiveRecordings.back()->mPartialRecording; + target_recording_buffers.sync(); + for (child_thread_recorder_list_t::iterator it = mChildThreadRecorders.begin(), end_it = mChildThreadRecorders.end(); + it != end_it; + ++it) + { LLMutexLock lock(&(*it)->mSharedRecordingMutex); + + target_recording_buffers.merge((*it)->mSharedRecordingBuffers); + (*it)->mSharedRecordingBuffers.reset(); + } + } +#endif +} + + +void set_master_thread_recorder( ThreadRecorder* recorder ) +{ + sMasterThreadRecorder = recorder; +} + + +ThreadRecorder* get_master_thread_recorder() +{ + return sMasterThreadRecorder; +} + +LLThreadLocalPointer<ThreadRecorder>& get_thread_recorder_ptr() +{ + static LLThreadLocalPointer<ThreadRecorder> s_thread_recorder; + return s_thread_recorder; +} + +const LLThreadLocalPointer<ThreadRecorder>& get_thread_recorder() +{ + return get_thread_recorder_ptr(); +} + +void set_thread_recorder( ThreadRecorder* recorder ) +{ + get_thread_recorder_ptr() = recorder; +} + +} diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h new file mode 100644 index 0000000000000000000000000000000000000000..a797c6687eaa60e9cda6d1c57b990043346bf706 --- /dev/null +++ b/indra/llcommon/lltracethreadrecorder.h @@ -0,0 +1,102 @@ +/** + * @file lltrace.h + * @brief Runtime statistics accumulation. + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTRACETHREADRECORDER_H +#define LL_LLTRACETHREADRECORDER_H + +#include "stdtypes.h" +#include "llpreprocessor.h" + +#include "llmutex.h" +#include "lltraceaccumulators.h" +#include "llthreadlocalstorage.h" + +namespace LLTrace +{ + class LL_COMMON_API ThreadRecorder + { + protected: + struct ActiveRecording; + typedef std::vector<ActiveRecording*> active_recording_list_t; + public: + ThreadRecorder(); + explicit ThreadRecorder(ThreadRecorder& parent); + + ~ThreadRecorder(); + + AccumulatorBufferGroup* activate(AccumulatorBufferGroup* recording); + void deactivate(AccumulatorBufferGroup* recording); + active_recording_list_t::iterator bringUpToDate(AccumulatorBufferGroup* recording); + + void addChildRecorder(class ThreadRecorder* child); + void removeChildRecorder(class ThreadRecorder* child); + + // call this periodically to gather stats data from child threads + void pullFromChildren(); + void pushToParent(); + + TimeBlockTreeNode* getTimeBlockTreeNode(S32 index); + + protected: + void init(); + + protected: + struct ActiveRecording + { + ActiveRecording(AccumulatorBufferGroup* target); + + AccumulatorBufferGroup* mTargetRecording; + AccumulatorBufferGroup mPartialRecording; + + void movePartialToTarget(); + }; + + AccumulatorBufferGroup mThreadRecordingBuffers; + + BlockTimerStackRecord mBlockTimerStackRecord; + active_recording_list_t mActiveRecordings; + + class BlockTimer* mRootTimer; + TimeBlockTreeNode* mTimeBlockTreeNodes; + size_t mNumTimeBlockTreeNodes; + typedef std::list<class ThreadRecorder*> child_thread_recorder_list_t; + + child_thread_recorder_list_t mChildThreadRecorders; // list of child thread recorders associated with this master + LLMutex mChildListMutex; // protects access to child list + LLMutex mSharedRecordingMutex; + AccumulatorBufferGroup mSharedRecordingBuffers; + ThreadRecorder* mParentRecorder; + + }; + + const LLThreadLocalPointer<ThreadRecorder>& get_thread_recorder(); + void set_thread_recorder(ThreadRecorder*); + + void set_master_thread_recorder(ThreadRecorder*); + ThreadRecorder* get_master_thread_recorder(); +} + +#endif // LL_LLTRACETHREADRECORDER_H diff --git a/indra/llcommon/lltypeinfolookup.h b/indra/llcommon/lltypeinfolookup.h deleted file mode 100755 index 0b6862444ee76811b42d1c6383c223df04dcf414..0000000000000000000000000000000000000000 --- a/indra/llcommon/lltypeinfolookup.h +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @file lltypeinfolookup.h - * @author Nat Goodspeed - * @date 2012-04-08 - * @brief Template data structure like std::map<std::type_info*, T> - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Copyright (c) 2012, Linden Research, Inc. - * $/LicenseInfo$ - */ - -#if ! defined(LL_LLTYPEINFOLOOKUP_H) -#define LL_LLTYPEINFOLOOKUP_H - -#include <boost/unordered_map.hpp> -#include <boost/functional/hash.hpp> -#include <boost/optional.hpp> -#include <functional> // std::binary_function -#include <typeinfo> - -/** - * The following helper classes are based on the Boost.Unordered documentation: - * http://www.boost.org/doc/libs/1_45_0/doc/html/unordered/hash_equality.html - */ - -/** - * Compute hash for a string passed as const char* - */ -struct const_char_star_hash: public std::unary_function<const char*, std::size_t> -{ - std::size_t operator()(const char* str) const - { - std::size_t seed = 0; - for ( ; *str; ++str) - { - boost::hash_combine(seed, *str); - } - return seed; - } -}; - -/** - * Compute equality for strings passed as const char* - * - * I (nat) suspect that this is where the default behavior breaks for the - * const char* values returned from std::type_info::name(). If you compare the - * two const char* pointer values, as a naive, unspecialized implementation - * will surely do, they'll compare unequal. - */ -struct const_char_star_equal: public std::binary_function<const char*, const char*, bool> -{ - bool operator()(const char* lhs, const char* rhs) const - { - return strcmp(lhs, rhs) == 0; - } -}; - -/** - * LLTypeInfoLookup is specifically designed for use cases for which you might - * consider std::map<std::type_info*, VALUE>. We have several such data - * structures in the viewer. The trouble with them is that at least on Linux, - * you can't rely on always getting the same std::type_info* for a given type: - * different load modules will produce different std::type_info*. - * LLTypeInfoLookup contains a workaround to address this issue. - * - * The API deliberately diverges from std::map in several respects: - * * It avoids iterators, not only begin()/end() but also as return values - * from insert() and find(). This bypasses transform_iterator overhead. - * * Since we literally use compile-time types as keys, the essential insert() - * and find() methods accept the key type as a @em template parameter, - * accepting and returning value_type as a normal runtime value. This is to - * permit future optimization (e.g. compile-time type hashing) without - * changing the API. - */ -template <typename VALUE> -class LLTypeInfoLookup -{ - // Use this for our underlying implementation: lookup by - // std::type_info::name() string. This is one of the rare cases in which I - // dare use const char* directly, rather than std::string, because I'm - // sure that every value returned by std::type_info::name() is static. - // HOWEVER, specify our own hash + equality functors: naively comparing - // distinct const char* values won't work. - typedef boost::unordered_map<const char*, VALUE, - const_char_star_hash, const_char_star_equal> impl_map_type; - -public: - typedef VALUE value_type; - - LLTypeInfoLookup() {} - - bool empty() const { return mMap.empty(); } - std::size_t size() const { return mMap.size(); } - - template <typename KEY> - bool insert(const value_type& value) - { - // Obtain and store the std::type_info::name() string as the key. - // Return just the bool from std::map::insert()'s return pair. - return mMap.insert(typename impl_map_type::value_type(typeid(KEY).name(), value)).second; - } - - template <typename KEY> - boost::optional<value_type> find() const - { - // Use the std::type_info::name() string as the key. - typename impl_map_type::const_iterator found = mMap.find(typeid(KEY).name()); - if (found == mMap.end()) - return boost::optional<value_type>(); - return found->second; - } - -private: - impl_map_type mMap; -}; - -#endif /* ! defined(LL_LLTYPEINFOLOOKUP_H) */ diff --git a/indra/llcommon/llunits.h b/indra/llcommon/llunits.h new file mode 100644 index 0000000000000000000000000000000000000000..0fcb8281a02776b4c61c491a527ca0041c282e27 --- /dev/null +++ b/indra/llcommon/llunits.h @@ -0,0 +1,129 @@ +/** + * @file llunits.h + * @brief Unit definitions + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLUNITTYPE_H +#define LL_LLUNITTYPE_H + +#include "stdtypes.h" +#include "llunittype.h" + +// +// Unit declarations +// + +namespace LLUnits +{ +LL_DECLARE_BASE_UNIT(Bytes, "B"); +// technically, these are kibibytes, mibibytes, etc. but we should stick with commonly accepted terminology +LL_DECLARE_DERIVED_UNIT(Kilobytes, "KB", Bytes, / 1024); +LL_DECLARE_DERIVED_UNIT(Megabytes, "MB", Kilobytes, / 1024); +LL_DECLARE_DERIVED_UNIT(Gigabytes, "GB", Megabytes, / 1024); +} + +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Bytes); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilobytes); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Megabytes); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Gigabytes); + +namespace LLUnits +{ +// technically, these are kibibits, mibibits, etc. but we should stick with commonly accepted terminology +LL_DECLARE_DERIVED_UNIT(Bits, "b", Bytes, * 8 ); +LL_DECLARE_DERIVED_UNIT(Kilobits, "Kb", Bits, / 1024); +LL_DECLARE_DERIVED_UNIT(Megabits, "Mb", Kilobits, / 1024); +LL_DECLARE_DERIVED_UNIT(Gigabits, "Gb", Megabits, / 1024); +} + +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Bits); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilobits); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Megabits); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Gigabits); + +namespace LLUnits +{ +LL_DECLARE_BASE_UNIT(Seconds, "s"); +LL_DECLARE_DERIVED_UNIT(Minutes, "min", Seconds, / 60); +LL_DECLARE_DERIVED_UNIT(Hours, "h", Minutes, / 60); +LL_DECLARE_DERIVED_UNIT(Days, "d", Hours, / 24); +LL_DECLARE_DERIVED_UNIT(Milliseconds, "ms", Seconds, * 1000); +LL_DECLARE_DERIVED_UNIT(Microseconds, "\x09\x3cs", Milliseconds, * 1000); +LL_DECLARE_DERIVED_UNIT(Nanoseconds, "ns", Microseconds, * 1000); +} + +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Seconds); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Minutes); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Hours); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Days); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Milliseconds); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Microseconds); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Nanoseconds); + +namespace LLUnits +{ +LL_DECLARE_BASE_UNIT(Meters, "m"); +LL_DECLARE_DERIVED_UNIT(Kilometers, "km", Meters, / 1000); +LL_DECLARE_DERIVED_UNIT(Centimeters, "cm", Meters, * 100); +LL_DECLARE_DERIVED_UNIT(Millimeters, "mm", Meters, * 1000); +} + +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Meters); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilometers); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Centimeters); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Millimeters); + +namespace LLUnits +{ +// rare units +LL_DECLARE_BASE_UNIT(Hertz, "Hz"); +LL_DECLARE_DERIVED_UNIT(Kilohertz, "KHz", Hertz, / 1000); +LL_DECLARE_DERIVED_UNIT(Megahertz, "MHz", Kilohertz, / 1000); +LL_DECLARE_DERIVED_UNIT(Gigahertz, "GHz", Megahertz, / 1000); + +LL_DECLARE_BASE_UNIT(Radians, "rad"); +LL_DECLARE_DERIVED_UNIT(Degrees, "deg", Radians, * 57.29578f); + +LL_DECLARE_BASE_UNIT(Percent, "%"); +LL_DECLARE_DERIVED_UNIT(Ratio, "x", Percent, / 100); + +LL_DECLARE_BASE_UNIT(Triangles, "tris"); +LL_DECLARE_DERIVED_UNIT(Kilotriangles, "ktris", Triangles, / 1000); + +} // namespace LLUnits + +// rare units +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Hertz); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilohertz); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Megahertz); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Gigahertz); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Radians); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Degrees); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Percent); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Ratio); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Triangles); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kilotriangles); + + +#endif // LL_LLUNITTYPE_H diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h new file mode 100644 index 0000000000000000000000000000000000000000..0e05ecd683f7d7d5b78a485073c83f64e212a097 --- /dev/null +++ b/indra/llcommon/llunittype.h @@ -0,0 +1,836 @@ +/** + * @file llunit.h + * @brief Unit conversion classes + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2012, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_UNITTYPE_H +#define LL_UNITTYPE_H + +#include "stdtypes.h" +#include "llpreprocessor.h" +#include "llerror.h" + +//lightweight replacement of type traits for simple type equality check +template<typename S, typename T> +struct LLIsSameType +{ + static const bool value = false; +}; + +template<typename T> +struct LLIsSameType<T, T> +{ + static const bool value = true; +}; + +// workaround for decltype() not existing and typeof() not working inline in gcc 4.2 +template<typename S, typename T> +struct LLResultTypeAdd +{ + typedef LL_TYPEOF(S() + T()) type_t; +}; + +template<typename S, typename T> +struct LLResultTypeSubtract +{ + typedef LL_TYPEOF(S() - T()) type_t; +}; + +template<typename S, typename T> +struct LLResultTypeMultiply +{ + typedef LL_TYPEOF(S() * T()) type_t; +}; + +template<typename S, typename T> +struct LLResultTypeDivide +{ + typedef LL_TYPEOF(S() / T(1)) type_t; +}; + +template<typename S, typename T> +struct LLResultTypePromote +{ + typedef LL_TYPEOF((true) ? S() : T()) type_t; +}; + +template<typename STORAGE_TYPE, typename UNITS> +struct LLUnit +{ + typedef LLUnit<STORAGE_TYPE, UNITS> self_t; + typedef STORAGE_TYPE storage_t; + typedef void is_unit_t; + + // value initialization + LL_FORCE_INLINE explicit LLUnit(storage_t value = storage_t()) + : mValue(value) + {} + + // unit initialization and conversion + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE LLUnit(LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) + : mValue(convert(other).mValue) + {} + + LL_FORCE_INLINE storage_t value() const + { + return mValue; + } + + LL_FORCE_INLINE void value(storage_t value) + { + mValue = value; + } + + template<typename NEW_UNITS> + storage_t valueInUnits() + { + return LLUnit<storage_t, NEW_UNITS>(*this).value(); + } + + template<typename NEW_UNITS> + void valueInUnits(storage_t value) + { + *this = LLUnit<storage_t, NEW_UNITS>(value); + } + + LL_FORCE_INLINE void operator += (self_t other) + { + mValue += convert(other).mValue; + } + + LL_FORCE_INLINE void operator -= (self_t other) + { + mValue -= convert(other).mValue; + } + + LL_FORCE_INLINE void operator *= (storage_t multiplicand) + { + mValue *= multiplicand; + } + + LL_FORCE_INLINE void operator *= (self_t multiplicand) + { + // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template + LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE, "Multiplication of unit types not supported."); + } + + LL_FORCE_INLINE void operator /= (storage_t divisor) + { + mValue /= divisor; + } + + void operator /= (self_t divisor) + { + // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template + LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE, "Illegal in-place division of unit types."); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator == (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return mValue == convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator != (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return mValue != convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator < (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return mValue < convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator <= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return mValue <= convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator > (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return mValue > convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator >= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return mValue >= convert(other).value(); + } + + LL_FORCE_INLINE static self_t convert(self_t v) + { + return v; + } + + template<typename FROM_STORAGE_TYPE> + LL_FORCE_INLINE static self_t convert(LLUnit<FROM_STORAGE_TYPE, UNITS> v) + { + self_t result; + result.mValue = (STORAGE_TYPE)v.value(); + return result; + } + + template<typename FROM_UNITS> + LL_FORCE_INLINE static self_t convert(LLUnit<STORAGE_TYPE, FROM_UNITS> v) + { + self_t result; + STORAGE_TYPE divisor = ll_convert_units(v, result); + result.mValue /= divisor; + return result; + } + + template<typename FROM_STORAGE_TYPE, typename FROM_UNITS> + LL_FORCE_INLINE static self_t convert(LLUnit<FROM_STORAGE_TYPE, FROM_UNITS> v) + { + typedef typename LLResultTypePromote<FROM_STORAGE_TYPE, STORAGE_TYPE>::type_t result_storage_t; + LLUnit<result_storage_t, UNITS> result; + result_storage_t divisor = ll_convert_units(v, result); + result.value(result.value() / divisor); + return self_t(result.value()); + } + +protected: + storage_t mValue; +}; + +template<typename STORAGE_TYPE, typename UNITS> +std::ostream& operator <<(std::ostream& s, const LLUnit<STORAGE_TYPE, UNITS>& unit) +{ + s << unit.value() << UNITS::getUnitLabel(); + return s; +} + +template<typename STORAGE_TYPE, typename UNITS> +std::istream& operator >>(std::istream& s, LLUnit<STORAGE_TYPE, UNITS>& unit) +{ + STORAGE_TYPE val; + s >> val; + unit.value(val); + return s; +} + +template<typename STORAGE_TYPE, typename UNITS> +struct LLUnitImplicit : public LLUnit<STORAGE_TYPE, UNITS> +{ + typedef LLUnitImplicit<STORAGE_TYPE, UNITS> self_t; + typedef typename LLUnit<STORAGE_TYPE, UNITS>::storage_t storage_t; + typedef LLUnit<STORAGE_TYPE, UNITS> base_t; + + LL_FORCE_INLINE LLUnitImplicit(storage_t value = storage_t()) + : base_t(value) + {} + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE LLUnitImplicit(LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) + : base_t(other) + {} + + // unlike LLUnit, LLUnitImplicit is *implicitly* convertable to a POD value (F32, S32, etc) + // this allows for interoperability with legacy code + LL_FORCE_INLINE operator storage_t() const + { + return base_t::value(); + } + + using base_t::operator +=; + LL_FORCE_INLINE void operator += (storage_t value) + { + base_t::mValue += value; + } + + // this overload exists to explicitly catch use of another implicit unit + // without ambiguity between conversion to storage_t vs conversion to base_t + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE void operator += (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) + { + base_t::mValue += convert(other).value(); + } + + using base_t::operator -=; + LL_FORCE_INLINE void operator -= (storage_t value) + { + base_t::mValue -= value; + } + + // this overload exists to explicitly catch use of another implicit unit + // without ambiguity between conversion to storage_t vs conversion to base_t + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE void operator -= (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) + { + base_t::mValue -= convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator == (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue == convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator == (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue == convert(other).value(); + } + + template<typename STORAGE_T> + LL_FORCE_INLINE bool operator == (STORAGE_T other) const + { + return base_t::mValue == other; + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator != (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue != convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator != (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue != convert(other).value(); + } + + template<typename STORAGE_T> + LL_FORCE_INLINE bool operator != (STORAGE_T other) const + { + return base_t::mValue != other; + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator < (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue < convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator < (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue < convert(other).value(); + } + + template<typename STORAGE_T> + LL_FORCE_INLINE bool operator < (STORAGE_T other) const + { + return base_t::mValue < other; + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator <= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue <= convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator <= (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue <= convert(other).value(); + } + + template<typename STORAGE_T> + LL_FORCE_INLINE bool operator <= (STORAGE_T other) const + { + return base_t::mValue <= other; + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator > (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue > convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator > (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue > convert(other).value(); + } + + template<typename STORAGE_T> + LL_FORCE_INLINE bool operator > (STORAGE_T other) const + { + return base_t::mValue > other; + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator >= (LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue >= convert(other).value(); + } + + template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS> + LL_FORCE_INLINE bool operator >= (LLUnitImplicit<OTHER_STORAGE_TYPE, OTHER_UNITS> other) const + { + return base_t::mValue >= convert(other).value(); + } + + template<typename STORAGE_T> + LL_FORCE_INLINE bool operator >= (STORAGE_T other) const + { + return base_t::mValue >= other; + } +}; + +template<typename STORAGE_TYPE, typename UNITS> +std::ostream& operator <<(std::ostream& s, const LLUnitImplicit<STORAGE_TYPE, UNITS>& unit) +{ + s << unit.value() << UNITS::getUnitLabel(); + return s; +} + +template<typename STORAGE_TYPE, typename UNITS> +std::istream& operator >>(std::istream& s, LLUnitImplicit<STORAGE_TYPE, UNITS>& unit) +{ + STORAGE_TYPE val; + s >> val; + unit = val; + return s; +} + +template<typename S1, typename T1, typename S2, typename T2> +LL_FORCE_INLINE S2 ll_convert_units(LLUnit<S1, T1> in, LLUnit<S2, T2>& out) +{ + S2 divisor(1); + + LL_STATIC_ASSERT((LLIsSameType<T1, T2>::value + || !LLIsSameType<T1, typename T1::base_unit_t>::value + || !LLIsSameType<T2, typename T2::base_unit_t>::value), + "conversion requires compatible units"); + + if (LLIsSameType<T1, T2>::value) + { + // T1 and T2 same type, just assign + out.value((S2)in.value()); + } + else if (T1::sLevel > T2::sLevel) + { + // reduce T1 + LLUnit<S2, typename T1::base_unit_t> new_in; + divisor *= (S2)ll_convert_units(in, new_in); + divisor *= (S2)ll_convert_units(new_in, out); + } + else + { + // reduce T2 + LLUnit<S2, typename T2::base_unit_t> new_out; + divisor *= (S2)ll_convert_units(in, new_out); + divisor *= (S2)ll_convert_units(new_out, out); + } + return divisor; +} + +template<typename T> +struct LLStorageType +{ + typedef T type_t; +}; + +template<typename STORAGE_TYPE, typename UNITS> +struct LLStorageType<LLUnit<STORAGE_TYPE, UNITS> > +{ + typedef STORAGE_TYPE type_t; +}; + +// all of these operators need to perform type promotion on the storage type of the units, so they +// cannot be expressed as operations on identical types with implicit unit conversion +// e.g. typeof(S32Bytes(x) + F32Megabytes(y)) <==> F32Bytes + +// +// operator + +// +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE LLUnit<typename LLResultTypeAdd<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> operator + (LLUnit<STORAGE_TYPE1, UNITS1> first, LLUnit<STORAGE_TYPE2, UNITS2> second) +{ + LLUnit<typename LLResultTypeAdd<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> result(first); + result += second; + return result; +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS> +LLUnit<STORAGE_TYPE, UNITS> operator + (LLUnit<STORAGE_TYPE, UNITS> first, UNITLESS second) +{ + LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE, "operator + requires compatible unit types"); + return LLUnit<STORAGE_TYPE, UNITS>(0); +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS> +LLUnit<STORAGE_TYPE, UNITS> operator + (UNITLESS first, LLUnit<STORAGE_TYPE, UNITS> second) +{ + LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE, "operator + requires compatible unit types"); + return LLUnit<STORAGE_TYPE, UNITS>(0); +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeAdd<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNITS1> first, LLUnitImplicit<STORAGE_TYPE2, UNITS2> second) +{ + LLUnitImplicit<typename LLResultTypeAdd<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> result(first); + result += second; + return result; +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeAdd<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> operator + (LLUnit<STORAGE_TYPE1, UNITS1> first, LLUnitImplicit<STORAGE_TYPE2, UNITS2> second) +{ + LLUnitImplicit<typename LLResultTypeAdd<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> result(first); + result += second; + return result; +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeAdd<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> operator + (LLUnitImplicit<STORAGE_TYPE1, UNITS1> first, LLUnit<STORAGE_TYPE2, UNITS2> second) +{ + LLUnitImplicit<typename LLResultTypeAdd<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> result(first); + result += LLUnitImplicit<STORAGE_TYPE1, UNITS1>(second); + return result; +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS_TYPE> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeAdd<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS> operator + (LLUnitImplicit<STORAGE_TYPE, UNITS> first, UNITLESS_TYPE second) +{ + LLUnitImplicit<typename LLResultTypeAdd<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS> result(first); + result += second; + return result; +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS_TYPE> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeAdd<typename LLStorageType<UNITLESS_TYPE>::type_t, STORAGE_TYPE>:: + type_t, UNITS> operator + (UNITLESS_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNITS> second) +{ + LLUnitImplicit<typename LLResultTypeAdd<typename LLStorageType<UNITLESS_TYPE>::type_t, STORAGE_TYPE>::type_t, UNITS> result(first); + result += second; + return result; +} + +// +// operator - +// +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE LLUnit<typename LLResultTypeSubtract<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> operator - (LLUnit<STORAGE_TYPE1, UNITS1> first, LLUnit<STORAGE_TYPE2, UNITS2> second) +{ + LLUnit<typename LLResultTypeSubtract<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> result(first); + result -= second; + return result; +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS> +LLUnit<STORAGE_TYPE, UNITS> operator - (LLUnit<STORAGE_TYPE, UNITS> first, UNITLESS second) +{ + LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE, "operator - requires compatible unit types"); + return LLUnit<STORAGE_TYPE, UNITS>(0); +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS> +LLUnit<STORAGE_TYPE, UNITS> operator - (UNITLESS first, LLUnit<STORAGE_TYPE, UNITS> second) +{ + LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE, "operator - requires compatible unit types"); + return LLUnit<STORAGE_TYPE, UNITS>(0); +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeSubtract<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> operator - (LLUnitImplicit<STORAGE_TYPE1, UNITS1> first, LLUnitImplicit<STORAGE_TYPE2, UNITS2> second) +{ + LLUnitImplicit<typename LLResultTypeSubtract<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> result(first); + result -= second; + return result; +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeSubtract<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> operator - (LLUnit<STORAGE_TYPE1, UNITS1> first, LLUnitImplicit<STORAGE_TYPE2, UNITS2> second) +{ + LLUnitImplicit<typename LLResultTypeSubtract<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> result(first); + result -= second; + return result; +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeSubtract<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> operator - (LLUnitImplicit<STORAGE_TYPE1, UNITS1> first, LLUnit<STORAGE_TYPE2, UNITS2> second) +{ + LLUnitImplicit<typename LLResultTypeSubtract<STORAGE_TYPE1, STORAGE_TYPE2>::type_t, UNITS1> result(first); + result -= LLUnitImplicit<STORAGE_TYPE1, UNITS1>(second); + return result; +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS_TYPE> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeSubtract<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS> operator - (LLUnitImplicit<STORAGE_TYPE, UNITS> first, UNITLESS_TYPE second) +{ + LLUnitImplicit<typename LLResultTypeSubtract<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS> result(first); + result -= second; + return result; +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS_TYPE> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeSubtract<typename LLStorageType<UNITLESS_TYPE>::type_t, STORAGE_TYPE>::type_t, UNITS> operator - (UNITLESS_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNITS> second) +{ + LLUnitImplicit<typename LLResultTypeSubtract<typename LLStorageType<UNITLESS_TYPE>::type_t, STORAGE_TYPE>::type_t, UNITS> result(first); + result -= second; + return result; +} + +// +// operator * +// +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LLUnit<STORAGE_TYPE1, UNITS1> operator * (LLUnit<STORAGE_TYPE1, UNITS1>, LLUnit<STORAGE_TYPE2, UNITS2>) +{ + // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template + LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE1, "multiplication of unit types results in new unit type - not supported."); + return LLUnit<STORAGE_TYPE1, UNITS1>(); +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS_TYPE> +LL_FORCE_INLINE LLUnit<typename LLResultTypeMultiply<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS> operator * (LLUnit<STORAGE_TYPE, UNITS> first, UNITLESS_TYPE second) +{ + return LLUnit<typename LLResultTypeMultiply<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS>(first.value() * second); +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS_TYPE> +LL_FORCE_INLINE LLUnit<typename LLResultTypeMultiply<typename LLStorageType<UNITLESS_TYPE>::type_t, STORAGE_TYPE>::type_t, UNITS> operator * (UNITLESS_TYPE first, LLUnit<STORAGE_TYPE, UNITS> second) +{ + return LLUnit<typename LLResultTypeMultiply<typename LLStorageType<UNITLESS_TYPE>::type_t, STORAGE_TYPE>::type_t, UNITS>(first * second.value()); +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LLUnitImplicit<STORAGE_TYPE1, UNITS1> operator * (LLUnitImplicit<STORAGE_TYPE1, UNITS1>, LLUnitImplicit<STORAGE_TYPE2, UNITS2>) +{ + // spurious use of dependent type to stop gcc from triggering the static assertion before instantiating the template + LL_BAD_TEMPLATE_INSTANTIATION(STORAGE_TYPE1, "multiplication of unit types results in new unit type - not supported."); + return LLUnitImplicit<STORAGE_TYPE1, UNITS1>(); +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS_TYPE> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeMultiply<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS> operator * (LLUnitImplicit<STORAGE_TYPE, UNITS> first, UNITLESS_TYPE second) +{ + return LLUnitImplicit<typename LLResultTypeMultiply<STORAGE_TYPE, UNITLESS_TYPE>::type_t, UNITS>(first.value() * second); +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS_TYPE> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeMultiply<typename LLStorageType<UNITLESS_TYPE>::type_t, STORAGE_TYPE>::type_t, UNITS> operator * (UNITLESS_TYPE first, LLUnitImplicit<STORAGE_TYPE, UNITS> second) +{ + return LLUnitImplicit<typename LLResultTypeMultiply<typename LLStorageType<UNITLESS_TYPE>::type_t, STORAGE_TYPE>::type_t, UNITS>(first * second.value()); +} + + +// +// operator / +// + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS_TYPE> +LL_FORCE_INLINE LLUnit<typename LLResultTypeDivide<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS> operator / (LLUnit<STORAGE_TYPE, UNITS> first, UNITLESS_TYPE second) +{ + return LLUnit<typename LLResultTypeDivide<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS>(first.value() / second); +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE typename LLResultTypeDivide<STORAGE_TYPE1, STORAGE_TYPE2>::type_t operator / (LLUnit<STORAGE_TYPE1, UNITS1> first, LLUnit<STORAGE_TYPE2, UNITS2> second) +{ + return first.value() / first.convert(second).value(); +} + +template<typename STORAGE_TYPE, typename UNITS, typename UNITLESS_TYPE> +LL_FORCE_INLINE LLUnitImplicit<typename LLResultTypeDivide<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS> operator / (LLUnitImplicit<STORAGE_TYPE, UNITS> first, UNITLESS_TYPE second) +{ + return LLUnitImplicit<typename LLResultTypeDivide<STORAGE_TYPE, typename LLStorageType<UNITLESS_TYPE>::type_t>::type_t, UNITS>(first.value() / second); +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE typename LLResultTypeDivide<STORAGE_TYPE1, STORAGE_TYPE2>::type_t operator / (LLUnitImplicit<STORAGE_TYPE1, UNITS1> first, LLUnitImplicit<STORAGE_TYPE2, UNITS2> second) +{ + return (typename LLResultTypeDivide<STORAGE_TYPE1, STORAGE_TYPE2>::type_t)(first.value() / first.convert(second).value()); +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE typename LLResultTypeDivide<STORAGE_TYPE1, STORAGE_TYPE2>::type_t operator / (LLUnit<STORAGE_TYPE1, UNITS1> first, LLUnitImplicit<STORAGE_TYPE2, UNITS2> second) +{ + return (typename LLResultTypeDivide<STORAGE_TYPE1, STORAGE_TYPE2>::type_t)(first.value() / first.convert(second).value()); +} + +template<typename STORAGE_TYPE1, typename UNITS1, typename STORAGE_TYPE2, typename UNITS2> +LL_FORCE_INLINE typename LLResultTypeDivide<STORAGE_TYPE1, STORAGE_TYPE2>::type_t operator / (LLUnitImplicit<STORAGE_TYPE1, UNITS1> first, LLUnit<STORAGE_TYPE2, UNITS2> second) +{ + return (typename LLResultTypeDivide<STORAGE_TYPE1, STORAGE_TYPE2>::type_t)(first.value() / first.convert(second).value()); +} + +template<typename T> +struct LLGetUnitLabel +{ + static const char* getUnitLabel() { return ""; } +}; + +template<typename T, typename STORAGE_T> +struct LLGetUnitLabel<LLUnit<STORAGE_T, T> > +{ + static const char* getUnitLabel() { return T::getUnitLabel(); } +}; + +template<typename T> +struct LLUnitLinearOps +{ + typedef LLUnitLinearOps<T> self_t; + + LLUnitLinearOps(T val) + : mValue(val), + mDivisor(1) + {} + + template<typename OTHER_T> + self_t operator * (OTHER_T other) + { + return mValue * other; + } + + template<typename OTHER_T> + self_t operator / (OTHER_T other) + { + mDivisor *= other; + return *this; + } + + template<typename OTHER_T> + self_t operator + (OTHER_T other) + { + mValue += other * mDivisor; + return *this; + } + + template<typename OTHER_T> + self_t operator - (OTHER_T other) + { + mValue -= other * mDivisor; + return *this; + } + + T mValue; + T mDivisor; +}; + +template<typename T> +struct LLUnitInverseLinearOps +{ + typedef LLUnitInverseLinearOps<T> self_t; + + LLUnitInverseLinearOps(T val) + : mValue(val), + mDivisor(1), + mMultiplicand(1) + {} + + template<typename OTHER_T> + self_t operator * (OTHER_T other) + { + mDivisor *= other; + return *this; + } + + template<typename OTHER_T> + self_t operator / (OTHER_T other) + { + mValue *= other; + mMultiplicand *= other; + return *this; + } + + template<typename OTHER_T> + self_t operator + (OTHER_T other) + { + mValue -= other * mMultiplicand; + return *this; + } + + template<typename OTHER_T> + self_t operator - (OTHER_T other) + { + mValue += other * mMultiplicand; + return *this; + } + + T mValue; + T mDivisor; + T mMultiplicand; +}; + +#define LL_DECLARE_BASE_UNIT(base_unit_name, unit_label) \ +struct base_unit_name \ +{ \ + static const int sLevel = 0; \ + typedef base_unit_name base_unit_t; \ + static const char* getUnitLabel() { return unit_label; } \ + template<typename T> \ + static LLUnit<T, base_unit_name> fromValue(T value) { return LLUnit<T, base_unit_name>(value); } \ + template<typename STORAGE_T, typename UNIT_T> \ + static LLUnit<STORAGE_T, base_unit_name> fromValue(LLUnit<STORAGE_T, UNIT_T> value) \ + { return LLUnit<STORAGE_T, base_unit_name>(value); } \ +} + + +#define LL_DECLARE_DERIVED_UNIT(unit_name, unit_label, base_unit_name, conversion_operation) \ +struct unit_name \ +{ \ + static const int sLevel = base_unit_name::sLevel + 1; \ + typedef base_unit_name base_unit_t; \ + static const char* getUnitLabel() { return unit_label; } \ + template<typename T> \ + static LLUnit<T, unit_name> fromValue(T value) { return LLUnit<T, unit_name>(value); } \ + template<typename STORAGE_T, typename UNIT_T> \ + static LLUnit<STORAGE_T, unit_name> fromValue(LLUnit<STORAGE_T, UNIT_T> value) \ + { return LLUnit<STORAGE_T, unit_name>(value); } \ +}; \ + \ +template<typename S1, typename S2> \ +LL_FORCE_INLINE S2 ll_convert_units(LLUnit<S1, unit_name> in, LLUnit<S2, base_unit_name>& out) \ +{ \ + typedef typename LLResultTypePromote<S1, S2>::type_t result_storage_t; \ + LLUnitInverseLinearOps<result_storage_t> result = \ + LLUnitInverseLinearOps<result_storage_t>(in.value()) conversion_operation; \ + out = LLUnit<S2, base_unit_name>((S2)result.mValue); \ + return result.mDivisor; \ +} \ + \ +template<typename S1, typename S2> \ +LL_FORCE_INLINE S2 ll_convert_units(LLUnit<S1, base_unit_name> in, LLUnit<S2, unit_name>& out) \ +{ \ + typedef typename LLResultTypePromote<S1, S2>::type_t result_storage_t; \ + LLUnitLinearOps<result_storage_t> result = \ + LLUnitLinearOps<result_storage_t>(in.value()) conversion_operation; \ + out = LLUnit<S2, unit_name>((S2)result.mValue); \ + return result.mDivisor; \ +} + +#define LL_DECLARE_UNIT_TYPEDEFS(ns, unit_name) \ + typedef LLUnit<F32, ns::unit_name> F32##unit_name; \ + typedef LLUnitImplicit<F32, ns::unit_name> F32##unit_name##Implicit;\ + typedef LLUnit<F64, ns::unit_name> F64##unit_name; \ + typedef LLUnitImplicit<F64, ns::unit_name> F64##unit_name##Implicit;\ + typedef LLUnit<S32, ns::unit_name> S32##unit_name; \ + typedef LLUnitImplicit<S32, ns::unit_name> S32##unit_name##Implicit;\ + typedef LLUnit<S64, ns::unit_name> S64##unit_name; \ + typedef LLUnitImplicit<S64, ns::unit_name> S64##unit_name##Implicit;\ + typedef LLUnit<U32, ns::unit_name> U32##unit_name; \ + typedef LLUnitImplicit<U32, ns::unit_name> U32##unit_name##Implicit;\ + typedef LLUnit<U64, ns::unit_name> U64##unit_name; \ + typedef LLUnitImplicit<U64, ns::unit_name> U64##unit_name##Implicit + +#endif //LL_UNITTYPE_H diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index 37f5b3d6a38b167430f96e0a8bf85d562ed61cb4..9f12d49244d328d111426970a40d685f90d2b97b 100755 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -359,7 +359,7 @@ LLURI LLURI::buildHTTP(const std::string& prefix, it != path.endArray(); ++it) { - lldebugs << "PATH: inserting " << it->asString() << llendl; + LL_DEBUGS() << "PATH: inserting " << it->asString() << LL_ENDL; result.mEscapedPath += "/" + escapePathComponent(it->asString()); } } @@ -399,8 +399,8 @@ LLURI LLURI::buildHTTP(const std::string& prefix, } else { - llwarns << "Valid path arguments to buildHTTP are array, string, or undef, you passed type" - << path.type() << llendl; + LL_WARNS() << "Valid path arguments to buildHTTP are array, string, or undef, you passed type" + << path.type() << LL_ENDL; } result.mEscapedOpaque = "//" + result.mEscapedAuthority + result.mEscapedPath; @@ -584,7 +584,7 @@ LLSD LLURI::queryMap() const // static LLSD LLURI::queryMap(std::string escaped_query_string) { - lldebugs << "LLURI::queryMap query params: " << escaped_query_string << llendl; + LL_DEBUGS() << "LLURI::queryMap query params: " << escaped_query_string << LL_ENDL; LLSD result = LLSD::emptyArray(); while(!escaped_query_string.empty()) @@ -610,12 +610,12 @@ LLSD LLURI::queryMap(std::string escaped_query_string) { std::string key = unescape(tuple.substr(0,key_end)); std::string value = unescape(tuple.substr(key_end+1)); - lldebugs << "inserting key " << key << " value " << value << llendl; + LL_DEBUGS() << "inserting key " << key << " value " << value << LL_ENDL; result[key] = value; } else { - lldebugs << "inserting key " << unescape(tuple) << " value true" << llendl; + LL_DEBUGS() << "inserting key " << unescape(tuple) << " value true" << LL_ENDL; result[unescape(tuple)] = true; } } diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 0aaa50d231bf646fdf91c34b31173a14d9af13f2..e3671047b4a3375921aa6bbec95726931f227f47 100755 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -27,9 +27,7 @@ // We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes. #if LL_WINDOWS -#undef WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> +#include "llwin32headers.h" // ugh, this is ugly. We need to straighten out our linking for this library #pragma comment(lib, "IPHLPAPI.lib") #include <iphlpapi.h> @@ -234,7 +232,7 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit) { if(emit) { - llwarns << "Warning! Using broken UUID string format" << llendl; + LL_WARNS() << "Warning! Using broken UUID string format" << LL_ENDL; } broken_format = TRUE; } @@ -244,7 +242,7 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit) if(emit) { //don't spam the logs because a resident can't spell. - llwarns << "Bad UUID string: " << in_string << llendl; + LL_WARNS() << "Bad UUID string: " << in_string << LL_ENDL; } setNull(); return FALSE; @@ -283,7 +281,7 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit) { if(emit) { - llwarns << "Invalid UUID string character" << llendl; + LL_WARNS() << "Invalid UUID string character" << LL_ENDL; } setNull(); return FALSE; @@ -308,7 +306,7 @@ BOOL LLUUID::set(const std::string& in_string, BOOL emit) { if(emit) { - llwarns << "Invalid UUID string character" << llendl; + LL_WARNS() << "Invalid UUID string character" << LL_ENDL; } setNull(); return FALSE; diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index 7889828c85144422d57f725d3946b5fcfc56383d..0699dcda83b8d66851278b3436bf6fc287d45506 100755 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -28,6 +28,7 @@ #include <iostream> #include <set> +#include <vector> #include "stdtypes.h" #include "llpreprocessor.h" diff --git a/indra/llcommon/lluuidhashmap.h b/indra/llcommon/lluuidhashmap.h deleted file mode 100755 index e2946700306072414378a601108d7f77b56dfe65..0000000000000000000000000000000000000000 --- a/indra/llcommon/lluuidhashmap.h +++ /dev/null @@ -1,583 +0,0 @@ -/** - * @file lluuidhashmap.h - * @brief A uuid based hash map. - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLUUIDHASHMAP_H -#define LL_LLUUIDHASHMAP_H - -#include "stdtypes.h" -#include "llerror.h" -#include "lluuid.h" - -// UUID hash map - - /* - LLUUIDHashMap<uuid_pair, 32> foo(test_equals); - LLUUIDHashMapIter<uuid_pair, 32> bar(&foo); - - LLDynamicArray<LLUUID> source_ids; - const S32 COUNT = 100000; - S32 q; - for (q = 0; q < COUNT; q++) - { - llinfos << "Creating" << llendl; - LLUUID id; - id.generate(); - //llinfos << q << ":" << id << llendl; - uuid_pair pair; - pair.mUUID = id; - pair.mValue = q; - foo.set(id, pair); - source_ids.put(id); - //ms_sleep(1); - } - - uuid_pair cur; - llinfos << "Iterating" << llendl; - for (cur = bar.first(); !bar.done(); cur = bar.next()) - { - if (source_ids[cur.mValue] != cur.mUUID) - { - llerrs << "Incorrect value iterated!" << llendl; - } - //llinfos << cur.mValue << ":" << cur.mUUID << llendl; - //ms_sleep(1); - } - - llinfos << "Finding" << llendl; - for (q = 0; q < COUNT; q++) - { - cur = foo.get(source_ids[q]); - if (source_ids[cur.mValue] != cur.mUUID) - { - llerrs << "Incorrect value found!" << llendl; - } - //llinfos << res.mValue << ":" << res.mUUID << llendl; - //ms_sleep(1); - } - - llinfos << "Removing" << llendl; - for (q = 0; q < COUNT/2; q++) - { - if (!foo.remove(source_ids[q])) - { - llerrs << "Remove failed!" << llendl; - } - //ms_sleep(1); - } - - llinfos << "Iterating" << llendl; - for (cur = bar.first(); !bar.done(); cur = bar.next()) - { - if (source_ids[cur.mValue] != cur.mUUID) - { - llerrs << "Incorrect value found!" << llendl; - } - //llinfos << cur.mValue << ":" << cur.mUUID << llendl; - //ms_sleep(1); - } - llinfos << "Done with UUID map test" << llendl; - - return 0; - */ - - -// -// LLUUIDHashNode -// - -template <class DATA, int SIZE> -class LLUUIDHashNode -{ -public: - LLUUIDHashNode(); - -public: - S32 mCount; - U8 mKey[SIZE]; - DATA mData[SIZE]; - LLUUIDHashNode<DATA, SIZE> *mNextNodep; -}; - - -// -// LLUUIDHashNode implementation -// -template <class DATA, int SIZE> -LLUUIDHashNode<DATA, SIZE>::LLUUIDHashNode() -{ - mCount = 0; - mNextNodep = NULL; -} - - -template <class DATA_TYPE, int SIZE> -class LLUUIDHashMap -{ -public: - // basic constructor including sorter - LLUUIDHashMap(BOOL (*equals)(const LLUUID &uuid, const DATA_TYPE &data), - const DATA_TYPE &null_data); - ~LLUUIDHashMap(); - - inline DATA_TYPE &get(const LLUUID &uuid); - inline BOOL check(const LLUUID &uuid) const; - inline DATA_TYPE &set(const LLUUID &uuid, const DATA_TYPE &type); - inline BOOL remove(const LLUUID &uuid); - void removeAll(); - - inline S32 getLength() const; // Warning, NOT O(1!) -public: - BOOL (*mEquals)(const LLUUID &uuid, const DATA_TYPE &data); - LLUUIDHashNode<DATA_TYPE, SIZE> mNodes[256]; - - S32 mIterCount; -protected: - DATA_TYPE mNull; -}; - - -// -// LLUUIDHashMap implementation -// - -template <class DATA_TYPE, int SIZE> -LLUUIDHashMap<DATA_TYPE, SIZE>::LLUUIDHashMap(BOOL (*equals)(const LLUUID &uuid, const DATA_TYPE &data), - const DATA_TYPE &null_data) -: mEquals(equals), - mIterCount(0), - mNull(null_data) -{ } - -template <class DATA_TYPE, int SIZE> -LLUUIDHashMap<DATA_TYPE, SIZE>::~LLUUIDHashMap() -{ - removeAll(); -} - -template <class DATA_TYPE, int SIZE> -void LLUUIDHashMap<DATA_TYPE, SIZE>::removeAll() -{ - S32 bin; - for (bin = 0; bin < 256; bin++) - { - LLUUIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[bin]; - - BOOL first = TRUE; - while (nodep) - { - S32 i; - const S32 count = nodep->mCount; - - // Iterate through all members of this node - for (i = 0; i < count; i++) - { - nodep->mData[i] = mNull; - } - - nodep->mCount = 0; - // Done with all objects in this node, go to the next. - - LLUUIDHashNode<DATA_TYPE, SIZE>* curp = nodep; - nodep = nodep->mNextNodep; - - // Delete the node if it's not the first node - if (first) - { - first = FALSE; - curp->mNextNodep = NULL; - } - else - { - delete curp; - } - } - } -} - -template <class DATA_TYPE, int SIZE> -inline S32 LLUUIDHashMap<DATA_TYPE, SIZE>::getLength() const -{ - S32 count = 0; - S32 bin; - for (bin = 0; bin < 256; bin++) - { - LLUUIDHashNode<DATA_TYPE, SIZE>* nodep = (LLUUIDHashNode<DATA_TYPE, SIZE>*) &mNodes[bin]; - while (nodep) - { - count += nodep->mCount; - nodep = nodep->mNextNodep; - } - } - return count; -} - -template <class DATA_TYPE, int SIZE> -inline DATA_TYPE &LLUUIDHashMap<DATA_TYPE, SIZE>::get(const LLUUID &uuid) -{ - LLUUIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[uuid.mData[0]]; - - // Grab the second byte of the UUID, which is the key for the node data - const S32 second_byte = uuid.mData[1]; - while (nodep) - { - S32 i; - const S32 count = nodep->mCount; - - // Iterate through all members of this node - for (i = 0; i < count; i++) - { - if ((nodep->mKey[i] == second_byte) && mEquals(uuid, nodep->mData[i])) - { - // The second byte matched, and our equality test passed. - // We found it. - return nodep->mData[i]; - } - } - - // Done with all objects in this node, go to the next. - nodep = nodep->mNextNodep; - } - return mNull; -} - - -template <class DATA_TYPE, int SIZE> -inline BOOL LLUUIDHashMap<DATA_TYPE, SIZE>::check(const LLUUID &uuid) const -{ - const LLUUIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[uuid.mData[0]]; - - // Grab the second byte of the UUID, which is the key for the node data - const S32 second_byte = uuid.mData[1]; - while (nodep) - { - S32 i; - const S32 count = nodep->mCount; - - // Iterate through all members of this node - for (i = 0; i < count; i++) - { - if ((nodep->mKey[i] == second_byte) && mEquals(uuid, nodep->mData[i])) - { - // The second byte matched, and our equality test passed. - // We found it. - return TRUE; - } - } - - // Done with all objects in this node, go to the next. - nodep = nodep->mNextNodep; - } - - // Didn't find anything - return FALSE; -} - - -template <class DATA_TYPE, int SIZE> -inline DATA_TYPE &LLUUIDHashMap<DATA_TYPE, SIZE>::set(const LLUUID &uuid, const DATA_TYPE &data) -{ - // Set is just like a normal find, except that if we find a match - // we replace it with the input value. - // If we don't find a match, we append to the end of the list. - - LLUUIDHashNode<DATA_TYPE, SIZE>* nodep = &mNodes[uuid.mData[0]]; - - const S32 second_byte = uuid.mData[1]; - while (1) - { - const S32 count = nodep->mCount; - - S32 i; - for (i = 0; i < count; i++) - { - if ((nodep->mKey[i] == second_byte) && mEquals(uuid, nodep->mData[i])) - { - // We found a match for this key, replace the data with - // the incoming data. - nodep->mData[i] = data; - return nodep->mData[i]; - } - } - if (!nodep->mNextNodep) - { - // We've iterated through all of the keys without finding a match - if (i < SIZE) - { - // There's still some space on this node, append - // the key and data to it. - nodep->mKey[i] = second_byte; - nodep->mData[i] = data; - nodep->mCount++; - - return nodep->mData[i]; - } - else - { - // This node is full, append a new node to the end. - nodep->mNextNodep = new LLUUIDHashNode<DATA_TYPE, SIZE>; - nodep->mNextNodep->mKey[0] = second_byte; - nodep->mNextNodep->mData[0] = data; - nodep->mNextNodep->mCount = 1; - - return nodep->mNextNodep->mData[0]; - } - } - - // No match on this node, go to the next - nodep = nodep->mNextNodep; - } -} - - -template <class DATA_TYPE, int SIZE> -inline BOOL LLUUIDHashMap<DATA_TYPE, SIZE>::remove(const LLUUID &uuid) -{ - if (mIterCount) - { - // We don't allow remove when we're iterating, it's bad karma! - llerrs << "Attempted remove while an outstanding iterator in LLUUIDHashMap!" << llendl; - } - // Remove is the trickiest operation. - // What we want to do is swap the last element of the last - // node if we find the one that we want to remove, but we have - // to deal with deleting the node from the tail if it's empty, but - // NOT if it's the only node left. - - LLUUIDHashNode<DATA_TYPE, SIZE> *nodep = &mNodes[uuid.mData[0]]; - - // Not empty, we need to search through the nodes - const S32 second_byte = uuid.mData[1]; - - // A modification of the standard search algorithm. - while (nodep) - { - const S32 count = nodep->mCount; - - S32 i; - for (i = 0; i < count; i++) - { - if ((nodep->mKey[i] == second_byte) && mEquals(uuid, nodep->mData[i])) - { - // We found the node that we want to remove. - // Find the last (and next-to-last) node, and the index of the last - // element. We could conceviably start from the node we're on, - // but that makes it more complicated, this is easier. - - LLUUIDHashNode<DATA_TYPE, SIZE> *prevp = &mNodes[uuid.mData[0]]; - LLUUIDHashNode<DATA_TYPE, SIZE> *lastp = prevp; - - // Find the last and next-to-last - while (lastp->mNextNodep) - { - prevp = lastp; - lastp = lastp->mNextNodep; - } - - // First, swap in the last to the current location. - nodep->mKey[i] = lastp->mKey[lastp->mCount - 1]; - nodep->mData[i] = lastp->mData[lastp->mCount - 1]; - - // Now, we delete the entry - lastp->mCount--; - lastp->mData[lastp->mCount] = mNull; - - if (!lastp->mCount) - { - // We deleted the last element! - if (lastp != &mNodes[uuid.mData[0]]) - { - // Only blitz the node if it's not the head - // Set the previous node to point to NULL, then - // blitz the empty last node - prevp->mNextNodep = NULL; - delete lastp; - } - } - return TRUE; - } - } - - // Iterate to the next node, we've scanned all the entries in this one. - nodep = nodep->mNextNodep; - } - return FALSE; -} - - -// -// LLUUIDHashMapIter -// - -template <class DATA_TYPE, int SIZE> -class LLUUIDHashMapIter -{ -public: - LLUUIDHashMapIter(LLUUIDHashMap<DATA_TYPE, SIZE> *hash_mapp); - ~LLUUIDHashMapIter(); - - - inline void reset(); - inline void first(); - inline void next(); - inline BOOL done() const; - - DATA_TYPE& operator*() const - { - return mCurHashNodep->mData[mCurHashNodeKey]; - } - DATA_TYPE* operator->() const - { - return &(operator*()); - } - -protected: - LLUUIDHashMap<DATA_TYPE, SIZE> *mHashMapp; - LLUUIDHashNode<DATA_TYPE, SIZE> *mCurHashNodep; - - S32 mCurHashMapNodeNum; - S32 mCurHashNodeKey; - - DATA_TYPE mNull; -}; - - -// -// LLUUIDHashMapIter Implementation -// -template <class DATA_TYPE, int SIZE> -LLUUIDHashMapIter<DATA_TYPE, SIZE>::LLUUIDHashMapIter(LLUUIDHashMap<DATA_TYPE, SIZE> *hash_mapp) -{ - mHashMapp = hash_mapp; - mCurHashNodep = NULL; - mCurHashMapNodeNum = 0; - mCurHashNodeKey = 0; -} - -template <class DATA_TYPE, int SIZE> -LLUUIDHashMapIter<DATA_TYPE, SIZE>::~LLUUIDHashMapIter() -{ - reset(); -} - -template <class DATA_TYPE, int SIZE> -inline void LLUUIDHashMapIter<DATA_TYPE, SIZE>::reset() -{ - if (mCurHashNodep) - { - // We're partway through an iteration, we can clean up now - mHashMapp->mIterCount--; - mCurHashNodep = NULL; - } -} - -template <class DATA_TYPE, int SIZE> -inline void LLUUIDHashMapIter<DATA_TYPE, SIZE>::first() -{ - // Iterate through until we find the first non-empty node; - S32 i; - for (i = 0; i < 256; i++) - { - if (mHashMapp->mNodes[i].mCount) - { - if (!mCurHashNodep) - { - // Increment, since it's no longer safe for us to do a remove - mHashMapp->mIterCount++; - } - - mCurHashNodep = &mHashMapp->mNodes[i]; - mCurHashMapNodeNum = i; - mCurHashNodeKey = 0; - //return mCurHashNodep->mData[0]; - return; - } - } - - // Completely empty! - mCurHashNodep = NULL; - //return mNull; - return; -} - -template <class DATA_TYPE, int SIZE> -inline BOOL LLUUIDHashMapIter<DATA_TYPE, SIZE>::done() const -{ - return mCurHashNodep ? FALSE : TRUE; -} - -template <class DATA_TYPE, int SIZE> -inline void LLUUIDHashMapIter<DATA_TYPE, SIZE>::next() -{ - // No current entry, this iterator is done - if (!mCurHashNodep) - { - //return mNull; - return; - } - - // Go to the next element - mCurHashNodeKey++; - if (mCurHashNodeKey < mCurHashNodep->mCount) - { - // We're not done with this node, return the current element - //return mCurHashNodep->mData[mCurHashNodeKey]; - return; - } - - // Done with this node, move to the next - mCurHashNodep = mCurHashNodep->mNextNodep; - if (mCurHashNodep) - { - // Return the first element - mCurHashNodeKey = 0; - //return mCurHashNodep->mData[0]; - return; - } - - // Find the next non-empty node (keyed on the first byte) - mCurHashMapNodeNum++; - - S32 i; - for (i = mCurHashMapNodeNum; i < 256; i++) - { - if (mHashMapp->mNodes[i].mCount) - { - // We found one that wasn't empty - mCurHashNodep = &mHashMapp->mNodes[i]; - mCurHashMapNodeNum = i; - mCurHashNodeKey = 0; - //return mCurHashNodep->mData[0]; - return; - } - } - - // OK, we're done, nothing else to iterate - mCurHashNodep = NULL; - mHashMapp->mIterCount--; // Decrement since we're safe to do removes now - //return mNull; -} - -#endif // LL_LLUUIDHASHMAP_H diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llwin32headers.h old mode 100755 new mode 100644 similarity index 69% rename from indra/llcommon/llversionserver.h rename to indra/llcommon/llwin32headers.h index ef68a0eaf5cbd4b9272f8b35d70ed17b51c8f42c..8cfa40ada89dea4ddfb980a25ad2fcd0a09b5f58 --- a/indra/llcommon/llversionserver.h +++ b/indra/llcommon/llwin32headers.h @@ -1,8 +1,8 @@ /** - * @file llversionserver.h - * @brief + * @file llwin32headers.h + * @brief sanitized include of windows header files * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. * @@ -24,15 +24,19 @@ * $/LicenseInfo$ */ -#ifndef LL_LLVERSIONSERVER_H -#define LL_LLVERSIONSERVER_H - -const S32 LL_VERSION_MAJOR = 2; -const S32 LL_VERSION_MINOR = 1; -const S32 LL_VERSION_PATCH = 0; -const S32 LL_VERSION_BUILD = 264760; - -const char * const LL_CHANNEL = "Second Life Server"; +#ifndef LL_LLWINDOWS_H +#define LL_LLWINDOWS_H +#ifdef LL_WINDOWS +#ifndef NOMINMAX +#define NOMINMAX +#endif +#undef WIN32_LEAN_AND_MEAN +#include <winsock2.h> +#include <windows.h> +// reset to default, which is lean +#define WIN32_LEAN_AND_MEAN +#undef NOMINMAX +#endif #endif diff --git a/indra/llcommon/lldarrayptr.h b/indra/llcommon/llwin32headerslean.h old mode 100755 new mode 100644 similarity index 76% rename from indra/llcommon/lldarrayptr.h rename to indra/llcommon/llwin32headerslean.h index c9a0b204d1a7061815d206b552c3394cb98a2521..314e7a85d145ad272880d37c97db4bf58870ea1b --- a/indra/llcommon/lldarrayptr.h +++ b/indra/llcommon/llwin32headerslean.h @@ -1,6 +1,6 @@ /** - * @file lldarrayptr.h - * @brief Wrapped std::vector for backward compatibility. + * @file llwin32headerslean.h + * @brief sanitized include of windows header files * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -23,14 +23,18 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -#ifndef LL_LLDARRAYPTR_H -#define LL_LLDARRAYPTR_H -#include "lldarray.h" +#ifndef LL_LLWINDOWS_H +#define LL_LLWINDOWS_H -template <class Type, int BlockSize = 32> -class LLDynamicArrayPtr : public LLDynamicArray<Type, BlockSize> -{ -}; +#ifdef LL_WINDOWS +#ifndef NOMINMAX +#define NOMINMAX +#endif +#define WIN32_LEAN_AND_MEAN +#include <winsock2.h> +#include <windows.h> +#undef NOMINMAX +#endif -#endif // LL_LLDARRAYPTR_H +#endif diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 3d05a30ac2240b2d0b91f01156d7312675faa2a7..4c197dc1d6362b193fd3fe29f9f2a73880022da6 100755 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -50,8 +50,8 @@ LLWorkerThread::~LLWorkerThread() // Delete any workers in the delete queue (should be safe - had better be!) if (!mDeleteList.empty()) { - llwarns << "Worker Thread: " << mName << " destroyed with " << mDeleteList.size() - << " entries in delete list." << llendl; + LL_WARNS() << "Worker Thread: " << mName << " destroyed with " << mDeleteList.size() + << " entries in delete list." << LL_ENDL; } delete mDeleteMutex; @@ -65,8 +65,8 @@ void LLWorkerThread::clearDeleteList() // Delete any workers in the delete queue (should be safe - had better be!) if (!mDeleteList.empty()) { - llwarns << "Worker Thread: " << mName << " destroyed with " << mDeleteList.size() - << " entries in delete list." << llendl; + LL_WARNS() << "Worker Thread: " << mName << " destroyed with " << mDeleteList.size() + << " entries in delete list." << LL_ENDL; mDeleteMutex->lock(); for (delete_list_t::iterator iter = mDeleteList.begin(); iter != mDeleteList.end(); ++iter) @@ -142,7 +142,7 @@ LLWorkerThread::handle_t LLWorkerThread::addWorkRequest(LLWorkerClass* workercla bool res = addRequest(req); if (!res) { - llerrs << "add called after LLWorkerThread::cleanupClass()" << llendl; + LL_ERRS() << "add called after LLWorkerThread::cleanupClass()" << LL_ENDL; req->deleteRequest(); handle = nullHandle(); } @@ -209,7 +209,7 @@ LLWorkerClass::LLWorkerClass(LLWorkerThread* workerthread, const std::string& na { if (!mWorkerThread) { - llerrs << "LLWorkerClass() called with NULL workerthread: " << name << llendl; + LL_ERRS() << "LLWorkerClass() called with NULL workerthread: " << name << LL_ENDL; } } @@ -223,12 +223,12 @@ LLWorkerClass::~LLWorkerClass() LLWorkerThread::WorkRequest* workreq = (LLWorkerThread::WorkRequest*)mWorkerThread->getRequest(mRequestHandle); if (!workreq) { - llerrs << "LLWorkerClass destroyed with stale work handle" << llendl; + LL_ERRS() << "LLWorkerClass destroyed with stale work handle" << LL_ENDL; } if (workreq->getStatus() != LLWorkerThread::STATUS_ABORTED && workreq->getStatus() != LLWorkerThread::STATUS_COMPLETE) { - llerrs << "LLWorkerClass destroyed with active worker! Worker Status: " << workreq->getStatus() << llendl; + LL_ERRS() << "LLWorkerClass destroyed with active worker! Worker Status: " << workreq->getStatus() << LL_ENDL; } } } @@ -238,7 +238,7 @@ void LLWorkerClass::setWorkerThread(LLWorkerThread* workerthread) mMutex.lock(); if (mRequestHandle != LLWorkerThread::nullHandle()) { - llerrs << "LLWorkerClass attempt to change WorkerThread with active worker!" << llendl; + LL_ERRS() << "LLWorkerClass attempt to change WorkerThread with active worker!" << LL_ENDL; } mWorkerThread = workerthread; mMutex.unlock(); @@ -298,10 +298,10 @@ void LLWorkerClass::addWork(S32 param, U32 priority) llassert_always(!(mWorkFlags & (WCF_WORKING|WCF_HAVE_WORK))); if (mRequestHandle != LLWorkerThread::nullHandle()) { - llerrs << "LLWorkerClass attempt to add work with active worker!" << llendl; + LL_ERRS() << "LLWorkerClass attempt to add work with active worker!" << LL_ENDL; } #if _DEBUG -// llinfos << "addWork: " << mWorkerClassName << " Param: " << param << llendl; +// LL_INFOS() << "addWork: " << mWorkerClassName << " Param: " << param << LL_ENDL; #endif startWork(param); clearFlags(WCF_WORK_FINISHED|WCF_WORK_ABORTED); @@ -316,7 +316,7 @@ void LLWorkerClass::abortWork(bool autocomplete) #if _DEBUG // LLWorkerThread::WorkRequest* workreq = mWorkerThread->getRequest(mRequestHandle); // if (workreq) -// llinfos << "abortWork: " << mWorkerClassName << " Param: " << workreq->getParam() << llendl; +// LL_INFOS() << "abortWork: " << mWorkerClassName << " Param: " << workreq->getParam() << LL_ENDL; #endif if (mRequestHandle != LLWorkerThread::nullHandle()) { diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h index be46394d6eff2ad9ffd3ae99669afe2f388cd745..09776816a87f2312f8b26a4239d2af944daa2b91 100755 --- a/indra/llcommon/llworkerthread.h +++ b/indra/llcommon/llworkerthread.h @@ -26,10 +26,11 @@ #ifndef LL_LLWORKERTHREAD_H #define LL_LLWORKERTHREAD_H -#include <queue> -#include <string> +#include <list> #include <map> +#include <queue> #include <set> +#include <string> #include "llqueuedthread.h" #include "llapr.h" diff --git a/indra/llcommon/metaclass.cpp b/indra/llcommon/metaclass.cpp deleted file mode 100755 index 5e403511cfcbb686d38c53f32f9e9b8ce710b79f..0000000000000000000000000000000000000000 --- a/indra/llcommon/metaclass.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @file metaclass.cpp - * @author Babbage - * @date 2006-05-15 - * @brief Implementation of LLMetaClass - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "metaclass.h" - -#include "metaproperty.h" -#include "reflective.h" - -LLMetaClass::LLMetaClass() -{ -} - -//virtual -LLMetaClass::~LLMetaClass() -{ -} - -const LLMetaProperty* LLMetaClass::findProperty(const std::string& name) const -{ - PropertyIterator iter = mProperties.find(name); - if(iter == mProperties.end()) - { - return NULL; - } - return (*iter).second; -} - -void LLMetaClass::addProperty(const LLMetaProperty* property) -{ - mProperties.insert(std::make_pair(property->getName(), property)); -} - -U32 LLMetaClass::getPropertyCount() const -{ - return mProperties.size(); -} - -LLMetaClass::PropertyIterator LLMetaClass::beginProperties() const -{ - return mProperties.begin(); -} - -LLMetaClass::PropertyIterator LLMetaClass::endProperties() const -{ - return mProperties.end(); -} - -bool LLMetaClass::isInstance(const LLReflective* object) const -{ - // TODO: Babbage: Search through super classes of objects MetaClass. - const LLMetaClass* object_meta_class = &(object->getMetaClass()); - return (object_meta_class == this); -} - diff --git a/indra/llcommon/metaclass.h b/indra/llcommon/metaclass.h deleted file mode 100755 index 626757d58de16a7085d0a6838a22587a5f944056..0000000000000000000000000000000000000000 --- a/indra/llcommon/metaclass.h +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @file metaclass.h - * @author Babbage - * @date 2006-05-15 - * @brief Reflective meta information describing a class. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_METACLASS_H -#define LL_METACLASS_H - -#include <string> -#include <map> - -#include "stdtypes.h" - -class LLReflective; -class LLMetaProperty; -class LLMetaMethod; -class LL_COMMON_API LLMetaClass -{ -public: - - LLMetaClass(); - virtual ~LLMetaClass(); - - // Create instance of this MetaClass. NULL if class is abstract. - // Gives ownership of returned object. - // virtual LLReflective* create() const = 0; - - // Returns named property or NULL. - const LLMetaProperty* findProperty(const std::string& name) const; - - // Add property to metaclass. Takes ownership of given property. - void addProperty(const LLMetaProperty* property); - - typedef std::map<std::string, const LLMetaProperty*>::const_iterator PropertyIterator; - - U32 getPropertyCount() const; - - PropertyIterator beginProperties() const; - PropertyIterator endProperties() const; - - // Returns named property or NULL. - // const LLMetaMethod* findMethod(const std::string& name) const; - - // Add method to metaclass. Takes ownership of given method. - // void addMethod(const LLMetaMethod* method); - - // Find MetaClass by name. NULL if name is unknown. - // static LLMetaClass* findClass(const std::string& name); - - // True if object is instance of this meta class. - bool isInstance(const LLReflective* object) const; - -private: - - typedef std::map<std::string, const LLMetaProperty*> PropertyMap; - PropertyMap mProperties; -}; - -#endif // LL_METACLASS_H diff --git a/indra/llcommon/metaclasst.h b/indra/llcommon/metaclasst.h deleted file mode 100755 index b9a7ae219d8a3b754dab1bddccb43fe815ce79f0..0000000000000000000000000000000000000000 --- a/indra/llcommon/metaclasst.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * @file metaclasst.h - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_METACLASST_H -#define LL_METACLASST_H - -#include "metaclass.h" - -template<class TObject> -class LLMetaClassT : public LLMetaClass -{ - public: - - virtual ~LLMetaClassT() {;} - - static const LLMetaClassT& instance() - { - static const LLMetaClassT& instance = buildMetaClass(); - return instance; - } - - private: - - static const LLMetaClassT& buildMetaClass() - { - LLMetaClassT& meta_class = *(new LLMetaClassT()); - reflectProperties(meta_class); - return meta_class; - } - - LLMetaClassT() {;} - - static void reflectProperties(LLMetaClass&) - { - } -}; - -#endif // LL_METACLASST_H diff --git a/indra/llcommon/metaproperty.cpp b/indra/llcommon/metaproperty.cpp deleted file mode 100755 index 98d850bf1e4e64ea562a8850c6a2e3de3eca88e4..0000000000000000000000000000000000000000 --- a/indra/llcommon/metaproperty.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file metaproperty.cpp - * @author Babbage - * @date 2006-05-15 - * @brief Implementation of LLMetaProperty. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "metaproperty.h" - -#include "metaclass.h" - -LLMetaProperty::LLMetaProperty(const std::string& name, const LLMetaClass& object_class) : - mName(name), mObjectClass(object_class) -{ -} - -//virtual -LLMetaProperty::~LLMetaProperty() -{ -} - -const LLMetaClass& LLMetaProperty::getObjectMetaClass() const -{ - return mObjectClass; -} - -void LLMetaProperty::checkObjectClass(const LLReflective* object) const -{ - if(! mObjectClass.isInstance(object)) - { - throw "class cast exception"; - } -} diff --git a/indra/llcommon/metaproperty.h b/indra/llcommon/metaproperty.h deleted file mode 100755 index bd5bb1a30fd81c839cfcaecc5ab59016a20299af..0000000000000000000000000000000000000000 --- a/indra/llcommon/metaproperty.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @file metaproperty.h - * @author Babbage - * @date 2006-05-15 - * @brief Reflective meta information describing a property of a class. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_METAPROPERTY_H -#define LL_METAPROPERTY_H - -#include "stdtypes.h" -#include "llsd.h" -#include "reflective.h" - -class LLMetaClass; -class LLReflective; -class LL_COMMON_API LLMetaProperty -{ -public: - LLMetaProperty(const std::string& name, const LLMetaClass& object_class); - virtual ~LLMetaProperty(); - - // Get property name. - const std::string& getName() const {return mName;} - - // Get value of this property. - virtual const LLReflective* get(const LLReflective* object) const = 0; - - // Set value of this property. - // virtual void set(LLReflective* object, const LLReflective* value) = 0; - - // Get value of this property as LLSD. Default returns undefined LLSD. - virtual LLSD getLLSD(const LLReflective* object) const = 0; - - // Get the MetaClass of legal values of this property. - // const LLMetaClass& getValueMetaClass(); - - // Get the meta class that this property is a member of. - const LLMetaClass& getObjectMetaClass() const; - -protected: - - // Check object is instance of object class, throw exception if not. - void checkObjectClass(const LLReflective* object) const; - -private: - - std::string mName; - const LLMetaClass& mObjectClass; -}; - -#endif // LL_METAPROPERTY_H diff --git a/indra/llcommon/metapropertyt.h b/indra/llcommon/metapropertyt.h deleted file mode 100755 index 7a36c161da1456c08df517a4f9ae6bd1241fb2d4..0000000000000000000000000000000000000000 --- a/indra/llcommon/metapropertyt.h +++ /dev/null @@ -1,183 +0,0 @@ -/** - * @file metapropertyt.h - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_METAPROPERTYT_H -#define LL_METAPROPERTYT_H - -#include "llsd.h" -#include "llstring.h" -#include "metaclasst.h" -#include "metaproperty.h" -#include "reflectivet.h" - -template<class TProperty> -class LLMetaPropertyT : public LLMetaProperty -{ -public: - - virtual ~LLMetaPropertyT() {;} - - // Get value of this property. Gives ownership of returned value. - virtual const LLReflective* get(const LLReflective* object) const - { - checkObjectClass(object); - return getProperty(object); - } - - // Set value of this property. - /*virtual void set(LLReflective* object, const LLReflective* value) - { - // TODO: Babbage: Check types. - ref(object) = static_cast<const LLReflectiveT<TProperty>* >(value)->getValue(); - }*/ - - // Get value of this property as LLSD. - virtual LLSD getLLSD(const LLReflective* object) const - { - return LLSD(); - } - -protected: - - LLMetaPropertyT(const std::string& name, const LLMetaClass& object_class) : LLMetaProperty(name, object_class) {;} - - virtual const TProperty* getProperty(const LLReflective* object) const = 0; -}; - -template <> -inline const LLReflective* LLMetaPropertyT<S32>::get(const LLReflective* object) const -{ - checkObjectClass(object); - return NULL; -} - -template <> -inline const LLReflective* LLMetaPropertyT<std::string>::get(const LLReflective* object) const -{ - checkObjectClass(object); - return NULL; -} - -template <> -inline const LLReflective* LLMetaPropertyT<LLUUID>::get(const LLReflective* object) const -{ - checkObjectClass(object); - return NULL; -} - -template <> -inline const LLReflective* LLMetaPropertyT<bool>::get(const LLReflective* object) const -{ - checkObjectClass(object); - return NULL; -} - -template <> -inline LLSD LLMetaPropertyT<S32>::getLLSD(const LLReflective* object) const -{ - return *(getProperty(object)); -} - -template <> -inline LLSD LLMetaPropertyT<std::string>::getLLSD(const LLReflective* object) const -{ - return *(getProperty(object)); -} - -template <> -inline LLSD LLMetaPropertyT<LLUUID>::getLLSD(const LLReflective* object) const -{ - return *(getProperty(object)); -} - -template <> -inline LLSD LLMetaPropertyT<bool>::getLLSD(const LLReflective* object) const -{ - return *(getProperty(object)); -} - -template<class TObject, class TProperty> -class LLMetaPropertyTT : public LLMetaPropertyT<TProperty> -{ -public: - - LLMetaPropertyTT(const std::string& name, const LLMetaClass& object_class, TProperty (TObject::*property)) : - LLMetaPropertyT<TProperty>(name, object_class), mProperty(property) {;} - -protected: - - // Get void* to property. - virtual const TProperty* getProperty(const LLReflective* object) const - { - const TObject* typed_object = static_cast<const TObject*>(object); - return &(typed_object->*mProperty); - }; - -private: - - TProperty (TObject::*mProperty); -}; - -template<class TObject, class TProperty> -class LLMetaPropertyPtrTT : public LLMetaPropertyT<TProperty> -{ -public: - - LLMetaPropertyPtrTT(const std::string& name, const LLMetaClass& object_class, TProperty* (TObject::*property)) : - LLMetaPropertyT<TProperty>(name, object_class), mProperty(property) {;} - -protected: - - // Get void* to property. - virtual const TProperty* getProperty(const LLReflective* object) const - { - const TObject* typed_object = static_cast<const TObject*>(object); - return typed_object->*mProperty; - }; - -private: - - TProperty* (TObject::*mProperty); -}; - -// Utility function to simplify the registration of members. -template<class TObject, class TProperty> -void reflectProperty(LLMetaClass& meta_class, const std::string& name, TProperty (TObject::*property)) -{ - typedef LLMetaPropertyTT<TObject, TProperty> PropertyType; - const LLMetaProperty* meta_property = new PropertyType(name, meta_class, property); - meta_class.addProperty(meta_property); -} - -// Utility function to simplify the registration of ptr properties. -template<class TObject, class TProperty> -void reflectPtrProperty(LLMetaClass& meta_class, const std::string& name, TProperty* (TObject::*property)) -{ - typedef LLMetaPropertyPtrTT<TObject, TProperty> PropertyType; - const LLMetaProperty* meta_property = new PropertyType(name, meta_class, property); - meta_class.addProperty(meta_property); -} - -#endif // LL_METAPROPERTYT_H diff --git a/indra/llcommon/reflective.h b/indra/llcommon/reflective.h deleted file mode 100755 index da5c5a26305e61383c248c980796a816b38072c5..0000000000000000000000000000000000000000 --- a/indra/llcommon/reflective.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file reflective.h - * @author Babbage - * @date 2006-05-15 - * @brief Interface that must be implemented by all reflective classes. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_REFLECTIVE_H -#define LL_REFLECTIVE_H - -class LLMetaClass; -class LL_COMMON_API LLReflective -{ -public: - LLReflective(); - virtual ~LLReflective(); - - virtual const LLMetaClass& getMetaClass() const = 0; -}; - -#endif // LL_REFLECTIVE_H diff --git a/indra/llcommon/reflectivet.h b/indra/llcommon/reflectivet.h deleted file mode 100755 index 958921f23ee35c6315e4173a0271e6134225e1d4..0000000000000000000000000000000000000000 --- a/indra/llcommon/reflectivet.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file reflectivet.h - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_REFLECTIVET_H -#define LL_REFLECTIVET_H - -#include "reflective.h" - -template <class T> -class LLReflectiveT : public LLReflective -{ -public: - - LLReflectiveT(const T& value) : mValue(value) {;} - virtual ~LLReflectiveT() {;} - - virtual const LLMetaClass& getMetaClass() const {return LLMetaClassT<LLReflectiveT<T> >::instance();} - - const T& getValue() const {return mValue;} - -private: - - T mValue; -}; - -#endif diff --git a/indra/llcommon/stdenums.h b/indra/llcommon/stdenums.h deleted file mode 100755 index efcbe76795827d379aca14a7495364093f519ca6..0000000000000000000000000000000000000000 --- a/indra/llcommon/stdenums.h +++ /dev/null @@ -1,137 +0,0 @@ -/** - * @file stdenums.h - * @brief Enumerations for indra. - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_STDENUMS_H -#define LL_STDENUMS_H - -//---------------------------------------------------------------------------- -// DEPRECATED - create new, more specific files for shared enums/constants -//---------------------------------------------------------------------------- - -// this enum is used by the llview.h (viewer) and the llassetstorage.h (viewer and sim) -enum EDragAndDropType -{ - DAD_NONE = 0, - DAD_TEXTURE = 1, - DAD_SOUND = 2, - DAD_CALLINGCARD = 3, - DAD_LANDMARK = 4, - DAD_SCRIPT = 5, - DAD_CLOTHING = 6, - DAD_OBJECT = 7, - DAD_NOTECARD = 8, - DAD_CATEGORY = 9, - DAD_ROOT_CATEGORY = 10, - DAD_BODYPART = 11, - DAD_ANIMATION = 12, - DAD_GESTURE = 13, - DAD_LINK = 14, - DAD_MESH = 15, - DAD_WIDGET = 16, - DAD_PERSON = 17, - DAD_COUNT = 18, // number of types in this enum -}; - -// Reasons for drags to be denied. -// ordered by priority for multi-drag -enum EAcceptance -{ - ACCEPT_POSTPONED, // we are asynchronously determining acceptance - ACCEPT_NO, // Uninformative, general purpose denial. - ACCEPT_NO_LOCKED, // Operation would be valid, but permissions are set to disallow it. - ACCEPT_YES_COPY_SINGLE, // We'll take a copy of a single item - ACCEPT_YES_SINGLE, // Accepted. OK to drag and drop single item here. - ACCEPT_YES_COPY_MULTI, // We'll take a copy of multiple items - ACCEPT_YES_MULTI // Accepted. OK to drag and drop multiple items here. -}; - -// This is used by the DeRezObject message to determine where to put -// derezed tasks. -enum EDeRezDestination -{ - DRD_SAVE_INTO_AGENT_INVENTORY = 0, - DRD_ACQUIRE_TO_AGENT_INVENTORY = 1, // try to leave copy in world - DRD_SAVE_INTO_TASK_INVENTORY = 2, - DRD_ATTACHMENT = 3, - DRD_TAKE_INTO_AGENT_INVENTORY = 4, // delete from world - DRD_FORCE_TO_GOD_INVENTORY = 5, // force take copy - DRD_TRASH = 6, - DRD_ATTACHMENT_TO_INV = 7, - DRD_ATTACHMENT_EXISTS = 8, - DRD_RETURN_TO_OWNER = 9, // back to owner's inventory - DRD_RETURN_TO_LAST_OWNER = 10, // deeded object back to last owner's inventory - - DRD_COUNT = 11 -}; - - -// This is used by the return to owner code to determine the reason -// that this object is being returned. -enum EReturnReason -{ - RR_GENERIC = 0, - RR_SANDBOX = 1, - RR_PARCEL_OWNER = 2, - RR_PARCEL_AUTO = 3, - RR_PARCEL_FULL = 4, - RR_OFF_WORLD = 5, - - RR_COUNT = 6 -}; - -// This is used for filling in the first byte of the ExtraID field of -// the ObjectProperties message. -enum EObjectPropertiesExtraID -{ - OPEID_NONE = 0, - OPEID_ASSET_ID = 1, - OPEID_FROM_TASK_ID = 2, - - OPEID_COUNT = 3 -}; - -enum EAddPosition -{ - ADD_TOP, - ADD_BOTTOM, - ADD_DEFAULT -}; - -enum LLGroupChange -{ - GC_PROPERTIES, - GC_MEMBER_DATA, - GC_ROLE_DATA, - GC_ROLE_MEMBER_DATA, - GC_TITLES, - GC_ALL -}; - -//---------------------------------------------------------------------------- -// DEPRECATED - create new, more specific files for shared enums/constants -//---------------------------------------------------------------------------- - -#endif diff --git a/indra/llcommon/string_table.h b/indra/llcommon/string_table.h old mode 100755 new mode 100644 diff --git a/indra/llcommon/stringize.h b/indra/llcommon/stringize.h index acae74b584e83e98a9efde668a5bb00fd4db51e8..2df008febb6d9752a4038cb9fb7c2967767f7d05 100755 --- a/indra/llcommon/stringize.h +++ b/indra/llcommon/stringize.h @@ -53,7 +53,7 @@ std::basic_string<CHARTYPE> gstringize(const T& item) */ inline std::string stringize(const std::wstring& item) { - llwarns << "WARNING: Possible narrowing" << llendl; + LL_WARNS() << "WARNING: Possible narrowing" << LL_ENDL; std::string s; diff --git a/indra/llcommon/tests/bitpack_test.cpp b/indra/llcommon/tests/bitpack_test.cpp index afc0c18cd01ad7b6de21b547e1407e02bb4ba442..9bfd5670684b327fb08eccea6d610de164b5759c 100755 --- a/indra/llcommon/tests/bitpack_test.cpp +++ b/indra/llcommon/tests/bitpack_test.cpp @@ -28,7 +28,7 @@ #include "linden_common.h" -#include "../bitpack.h" +#include "../llbitpack.h" #include "../test/lltut.h" diff --git a/indra/llcommon/tests/commonmisc_test.cpp b/indra/llcommon/tests/commonmisc_test.cpp index b115c153c1713643358905a7652a955a29bbf87f..4b3e07fa75a40d13747d58fe3c459de3a8d1f16e 100755 --- a/indra/llcommon/tests/commonmisc_test.cpp +++ b/indra/llcommon/tests/commonmisc_test.cpp @@ -339,7 +339,7 @@ namespace tut /* if(actual != expected) { - llwarns << "iteration " << i << llendl; + LL_WARNS() << "iteration " << i << LL_ENDL; std::ostringstream e_str; std::string::iterator iter = expected.begin(); std::string::iterator end = expected.end(); @@ -349,8 +349,8 @@ namespace tut } e_str << std::endl; llsd_serialize_string(e_str, expected); - llwarns << "expected size: " << expected.size() << llendl; - llwarns << "expected: " << e_str.str() << llendl; + LL_WARNS() << "expected size: " << expected.size() << LL_ENDL; + LL_WARNS() << "expected: " << e_str.str() << LL_ENDL; std::ostringstream a_str; iter = actual.begin(); @@ -361,8 +361,8 @@ namespace tut } a_str << std::endl; llsd_serialize_string(a_str, actual); - llwarns << "actual size: " << actual.size() << llendl; - llwarns << "actual: " << a_str.str() << llendl; + LL_WARNS() << "actual size: " << actual.size() << LL_ENDL; + LL_WARNS() << "actual: " << a_str.str() << LL_ENDL; } */ ensure_equals("string value", actual, expected); diff --git a/indra/llcommon/tests/lldeadmantimer_test.cpp b/indra/llcommon/tests/lldeadmantimer_test.cpp index 7fd2dde6e09390da48bc894b33e8c272376c2038..23167762c328e1d6638bfc0609fff082e6315b16 100644 --- a/indra/llcommon/tests/lldeadmantimer_test.cpp +++ b/indra/llcommon/tests/lldeadmantimer_test.cpp @@ -37,12 +37,12 @@ static LLDeadmanTimer::time_type float_time_to_u64(F64 delta) { - return LLDeadmanTimer::time_type(delta * gClockFrequency); + return LLDeadmanTimer::time_type(delta * get_timer_info().mClockFrequency); } static F64 u64_time_to_float(LLDeadmanTimer::time_type delta) { - return delta * gClockFrequencyInv; + return delta * get_timer_info().mClockFrequencyInv; } @@ -54,7 +54,7 @@ struct deadmantimer_test deadmantimer_test() { // LLTimer internals updating - update_clock_frequencies(); + get_timer_info().update(); } }; diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index 279a90e51b543b9e6c21568aef4ce9b230e6aae8..b28c5ba4b316cf7df77f2e36a2a8be78fd515e28 100755 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -40,7 +40,7 @@ namespace { void test_that_error_h_includes_enough_things_to_compile_a_message() { - llinfos << "!" << llendl; + LL_INFOS() << "!" << LL_ENDL; } } @@ -55,7 +55,7 @@ namespace tut class TestRecorder : public LLError::Recorder { public: - TestRecorder() : mWantsTime(false) { } + TestRecorder() { mWantsTime = false; } ~TestRecorder() { LLError::removeRecorder(this); } void recordMessage(LLError::ELevel level, @@ -68,7 +68,6 @@ namespace tut void clearMessages() { mMessages.clear(); } void setWantsTime(bool t) { mWantsTime = t; } - bool wantsTime() { return mWantsTime; } std::string message(int n) { @@ -82,8 +81,6 @@ namespace tut private: typedef std::vector<std::string> MessageVector; MessageVector mMessages; - - bool mWantsTime; }; struct ErrorTestData @@ -144,8 +141,8 @@ namespace tut void ErrorTestObject::test<1>() // basic test of output { - llinfos << "test" << llendl; - llinfos << "bob" << llendl; + LL_INFOS() << "test" << LL_ENDL; + LL_INFOS() << "bob" << LL_ENDL; ensure_message_contains(0, "test"); ensure_message_contains(1, "bob"); @@ -156,11 +153,11 @@ namespace { void writeSome() { - lldebugs << "one" << llendl; - llinfos << "two" << llendl; - llwarns << "three" << llendl; - llerrs << "four" << llendl; - // fatal messages write out and addtional "error" message + LL_DEBUGS() << "one" << LL_ENDL; + LL_INFOS() << "two" << LL_ENDL; + LL_WARNS() << "three" << LL_ENDL; + // fatal messages write out an additional "error" message + LL_ERRS() << "four" << LL_ENDL; } }; @@ -259,19 +256,20 @@ namespace std::string writeReturningLocation() { - llinfos << "apple" << llendl; int this_line = __LINE__; + LL_INFOS() << "apple" << LL_ENDL; int this_line = __LINE__; return locationString(this_line); } - std::string writeReturningLocationAndFunction() + void writeReturningLocationAndFunction(std::string& location, std::string& function) { - llinfos << "apple" << llendl; int this_line = __LINE__; - return locationString(this_line) + __FUNCTION__; + LL_INFOS() << "apple" << LL_ENDL; int this_line = __LINE__; + location = locationString(this_line); + function = __FUNCTION__; } std::string errorReturningLocation() { - llerrs << "die" << llendl; int this_line = __LINE__; + LL_ERRS() << "die" << LL_ENDL; int this_line = __LINE__; return locationString(this_line); } } @@ -306,13 +304,13 @@ namespace tut std::string logFromGlobal(bool id) { - llinfos << (id ? "logFromGlobal: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "logFromGlobal: " : "") << "hi" << LL_ENDL; return "logFromGlobal"; } static std::string logFromStatic(bool id) { - llinfos << (id ? "logFromStatic: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "logFromStatic: " : "") << "hi" << LL_ENDL; return "logFromStatic"; } @@ -320,7 +318,7 @@ namespace { std::string logFromAnon(bool id) { - llinfos << (id ? "logFromAnon: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "logFromAnon: " : "") << "hi" << LL_ENDL; return "logFromAnon"; } } @@ -328,7 +326,7 @@ namespace namespace Foo { std::string logFromNamespace(bool id) { - llinfos << (id ? "Foo::logFromNamespace: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "Foo::logFromNamespace: " : "") << "hi" << LL_ENDL; //return "Foo::logFromNamespace"; // there is no standard way to get the namespace name, hence // we won't be testing for it @@ -342,12 +340,12 @@ namespace public: std::string logFromMember(bool id) { - llinfos << (id ? "ClassWithNoLogType::logFromMember: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "ClassWithNoLogType::logFromMember: " : "") << "hi" << LL_ENDL; return "ClassWithNoLogType::logFromMember"; } static std::string logFromStatic(bool id) { - llinfos << (id ? "ClassWithNoLogType::logFromStatic: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "ClassWithNoLogType::logFromStatic: " : "") << "hi" << LL_ENDL; return "ClassWithNoLogType::logFromStatic"; } }; @@ -357,12 +355,12 @@ namespace public: std::string logFromMember(bool id) { - llinfos << (id ? "ClassWithLogType::logFromMember: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "ClassWithLogType::logFromMember: " : "") << "hi" << LL_ENDL; return "ClassWithLogType::logFromMember"; } static std::string logFromStatic(bool id) { - llinfos << (id ? "ClassWithLogType::logFromStatic: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "ClassWithLogType::logFromStatic: " : "") << "hi" << LL_ENDL; return "ClassWithLogType::logFromStatic"; } }; @@ -434,19 +432,19 @@ namespace { std::string innerLogger() { - llinfos << "inside" << llendl; + LL_INFOS() << "inside" << LL_ENDL; return "moo"; } std::string outerLogger() { - llinfos << "outside(" << innerLogger() << ")" << llendl; + LL_INFOS() << "outside(" << innerLogger() << ")" << LL_ENDL; return "bar"; } void uberLogger() { - llinfos << "uber(" << outerLogger() << "," << innerLogger() << ")" << llendl; + LL_INFOS() << "uber(" << outerLogger() << "," << innerLogger() << ")" << LL_ENDL; } class LogWhileLogging @@ -454,7 +452,7 @@ namespace public: void print(std::ostream& out) const { - llinfos << "logging" << llendl; + LL_INFOS() << "logging" << LL_ENDL; out << "baz"; } }; @@ -465,7 +463,7 @@ namespace void metaLogger() { LogWhileLogging l; - llinfos << "meta(" << l << ")" << llendl; + LL_INFOS() << "meta(" << l << ")" << LL_ENDL; } } @@ -495,7 +493,7 @@ namespace tut } template<> template<> - // special handling of llerrs calls + // special handling of LL_ERRS() calls void ErrorTestObject::test<8>() { LLError::setPrintLocation(false); @@ -518,7 +516,7 @@ namespace void ufoSighting() { - llinfos << "ufo" << llendl; + LL_INFOS() << "ufo" << LL_ENDL; } } @@ -548,11 +546,13 @@ namespace tut LLError::setPrintLocation(true); LLError::setTimeFunction(roswell); mRecorder->setWantsTime(true); - std::string locationAndFunction = writeReturningLocationAndFunction(); + std::string location, + function; + writeReturningLocationAndFunction(location, function); - ensure_equals("order is time type location function message", + ensure_equals("order is location time type function message", mRecorder->message(0), - roswell() + " INFO: " + locationAndFunction + ": apple"); + location + roswell() + " INFO: " + function + ": apple"); } template<> template<> @@ -562,7 +562,7 @@ namespace tut TestRecorder* altRecorder(new TestRecorder); LLError::addRecorder(altRecorder); - llinfos << "boo" << llendl; + LL_INFOS() << "boo" << LL_ENDL; ensure_message_contains(0, "boo"); ensure_equals("alt recorder count", altRecorder->countMessages(), 1); @@ -574,7 +574,7 @@ namespace tut anotherRecorder->setWantsTime(true); LLError::addRecorder(anotherRecorder); - llinfos << "baz" << llendl; + LL_INFOS() << "baz" << LL_ENDL; std::string when = roswell(); @@ -590,10 +590,10 @@ class TestAlpha { LOG_CLASS(TestAlpha); public: - static void doDebug() { lldebugs << "add dice" << llendl; } - static void doInfo() { llinfos << "any idea" << llendl; } - static void doWarn() { llwarns << "aim west" << llendl; } - static void doError() { llerrs << "ate eels" << llendl; } + static void doDebug() { LL_DEBUGS() << "add dice" << LL_ENDL; } + static void doInfo() { LL_INFOS() << "any idea" << LL_ENDL; } + static void doWarn() { LL_WARNS() << "aim west" << LL_ENDL; } + static void doError() { LL_ERRS() << "ate eels" << LL_ENDL; } static void doAll() { doDebug(); doInfo(); doWarn(); doError(); } }; @@ -601,10 +601,10 @@ class TestBeta { LOG_CLASS(TestBeta); public: - static void doDebug() { lldebugs << "bed down" << llendl; } - static void doInfo() { llinfos << "buy iron" << llendl; } - static void doWarn() { llwarns << "bad word" << llendl; } - static void doError() { llerrs << "big easy" << llendl; } + static void doDebug() { LL_DEBUGS() << "bed down" << LL_ENDL; } + static void doInfo() { LL_INFOS() << "buy iron" << LL_ENDL; } + static void doWarn() { LL_WARNS() << "bad word" << LL_ENDL; } + static void doError() { LL_ERRS() << "big easy" << LL_ENDL; } static void doAll() { doDebug(); doInfo(); doWarn(); doError(); } }; diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp index 5ebde1a31df880b7e3b9de4cc911a982c38cf5d0..cb5e15eff2db623ef792888c76023c7ada0e75b7 100755 --- a/indra/llcommon/tests/lleventcoro_test.cpp +++ b/indra/llcommon/tests/lleventcoro_test.cpp @@ -346,13 +346,13 @@ namespace tut LLCoroEventPumps waiter; replyName = waiter.getName0(); errorName = waiter.getName1(); - WrapLL_ERRS capture; + WrapLLErrs capture; try { result = waiter.waitWithLog(self); debug("no exception"); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { debug(STRINGIZE("exception " << e.what())); threw = e.what(); @@ -436,7 +436,7 @@ namespace tut BEGIN { LLCoroEventPumps waiter; - WrapLL_ERRS capture; + WrapLLErrs capture; try { result = waiter.postAndWaitWithLog(self, @@ -444,7 +444,7 @@ namespace tut immediateAPI.getPump(), "reply", "error"); debug("no exception"); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { debug(STRINGIZE("exception " << e.what())); threw = e.what(); diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp index 263c9b171f97cab9d30e844e016f5e565f6a5524..5a4df81bf1ecbc9e74a1bc9f54723cff38c04dfd 100755 --- a/indra/llcommon/tests/lleventdispatcher_test.cpp +++ b/indra/llcommon/tests/lleventdispatcher_test.cpp @@ -312,7 +312,7 @@ namespace tut { struct lleventdispatcher_data { - WrapLL_ERRS redirect; + WrapLLErrs redirect; Dispatcher work; Vars v; std::string name, desc; diff --git a/indra/llcommon/tests/lleventfilter_test.cpp b/indra/llcommon/tests/lleventfilter_test.cpp index ca05ef62a9f3dfeb72de349fd7603e43ee92a42a..2cdfb52f2fe50ef667befce7e566284dbb35ed9c 100755 --- a/indra/llcommon/tests/lleventfilter_test.cpp +++ b/indra/llcommon/tests/lleventfilter_test.cpp @@ -244,7 +244,7 @@ namespace tut void filter_object::test<4>() { set_test_name("LLEventTimeout::errorAfter()"); - WrapLL_ERRS capture; + WrapLLErrs capture; LLEventPump& driver(pumps.obtain("driver")); TestEventTimeout filter(driver); listener0.reset(0); @@ -274,7 +274,7 @@ namespace tut { mainloop.post(17); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { threw = e.what(); } diff --git a/indra/llcommon/tests/llinstancetracker_test.cpp b/indra/llcommon/tests/llinstancetracker_test.cpp index e769c3e22c77c38298a7f704c40c0bc2dc75a602..c7d4b8a06bdd879d364cf14395f70f38db20df24 100755 --- a/indra/llcommon/tests/llinstancetracker_test.cpp +++ b/indra/llcommon/tests/llinstancetracker_test.cpp @@ -194,15 +194,15 @@ namespace tut { set_test_name("delete Keyed with outstanding instance_iter"); std::string what; - Keyed* keyed = new Keyed("one"); + Keyed* keyed = new Keyed("delete Keyed with outstanding instance_iter"); { - WrapLL_ERRS wrapper; + WrapLLErrs wrapper; Keyed::instance_iter i(Keyed::beginInstances()); try { delete keyed; } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { what = e.what(); } @@ -215,15 +215,15 @@ namespace tut { set_test_name("delete Keyed with outstanding key_iter"); std::string what; - Keyed* keyed = new Keyed("one"); + Keyed* keyed = new Keyed("delete Keyed with outstanding key_it"); { - WrapLL_ERRS wrapper; + WrapLLErrs wrapper; Keyed::key_iter i(Keyed::beginKeys()); try { delete keyed; } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { what = e.what(); } @@ -238,13 +238,13 @@ namespace tut std::string what; Unkeyed* unkeyed = new Unkeyed; { - WrapLL_ERRS wrapper; + WrapLLErrs wrapper; Unkeyed::instance_iter i(Unkeyed::beginInstances()); try { delete unkeyed; } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { what = e.what(); } diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 29060d4ef5903c7dcb45be3ae31f9f65ee18f627..9ea822cb8d475e7b247b7d78225e30b5d44e3c31 100755 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -22,7 +22,6 @@ // other Linden headers #include "../test/lltut.h" #include "../test/namedtempfile.h" -#include "../test/manageapr.h" #include "../test/catch_and_store_what_in.h" #include "wrapllerrs.h" #include "llevents.h" @@ -33,8 +32,6 @@ using boost::assign::list_of; -static ManageAPR manager; - StringVec sv(const StringVec& listof) { return listof; } #if defined(LL_WINDOWS) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 3e68ef068e5061d2905ee61a04a58d525f965e3d..e4e766d51b7367350f55a52e7aa432b0f352c2f6 100755 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -29,7 +29,6 @@ //#include <boost/lambda/bind.hpp> // other Linden headers #include "../test/lltut.h" -#include "../test/manageapr.h" #include "../test/namedtempfile.h" #include "../test/catch_and_store_what_in.h" #include "stringize.h" @@ -46,9 +45,12 @@ #endif //namespace lambda = boost::lambda; - -// static instance of this manages APR init/cleanup -static ManageAPR manager; + std::string apr_strerror_helper(apr_status_t rv) +{ + char errbuf[256]; + apr_strerror(rv, errbuf, sizeof(errbuf)); + return errbuf; +} /***************************************************************************** * Helpers @@ -60,7 +62,8 @@ static ManageAPR manager; #define aprchk(expr) aprchk_(#expr, (expr)) static void aprchk_(const char* call, apr_status_t rv, apr_status_t expected=APR_SUCCESS) { - tut::ensure_equals(STRINGIZE(call << " => " << rv << ": " << manager.strerror(rv)), + tut::ensure_equals(STRINGIZE(call << " => " << rv << ": " << apr_strerror_helper + (rv)), rv, expected); } diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index 4d436e8897d36dc4e218ec66c0aa36e9022e7c3a..b5893135ea4dad342a4de51c7c1cd62de9fa88b0 100755 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -56,12 +56,9 @@ namespace lambda = boost::lambda; #include "../llformat.h" #include "../test/lltut.h" -#include "../test/manageapr.h" #include "../test/namedtempfile.h" #include "stringize.h" -static ManageAPR manager; - std::vector<U8> string_to_vector(const std::string& str) { return std::vector<U8>(str.begin(), str.end()); @@ -268,7 +265,7 @@ namespace tut { std::stringstream stream; mFormatter->format(v, stream); - //llinfos << "checkRoundTrip: length " << stream.str().length() << llendl; + //LL_INFOS() << "checkRoundTrip: length " << stream.str().length() << LL_ENDL; LLSD w; mParser->reset(); // reset() call is needed since test code re-uses mParser mParser->parse(stream, w, stream.str().size()); @@ -1723,5 +1720,6 @@ namespace tut "This string\n" "has several\n" "lines."); + } } diff --git a/indra/llcommon/tests/lltrace_test.cpp b/indra/llcommon/tests/lltrace_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0a9d85ad00e27b5bc78bfce76859cc62bd97cb73 --- /dev/null +++ b/indra/llcommon/tests/lltrace_test.cpp @@ -0,0 +1,142 @@ +/** + * @file llsingleton_test.cpp + * @date 2011-08-11 + * @brief Unit test for the LLSingleton class + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "lltrace.h" +#include "lltracethreadrecorder.h" +#include "lltracerecording.h" +#include "../test/lltut.h" + +namespace LLUnits +{ + // using powers of 2 to allow strict floating point equality + LL_DECLARE_BASE_UNIT(Ounces, "oz"); + LL_DECLARE_DERIVED_UNIT(TallCup, "", Ounces, / 12); + LL_DECLARE_DERIVED_UNIT(GrandeCup, "", Ounces, / 16); + LL_DECLARE_DERIVED_UNIT(VentiCup, "", Ounces, / 20); + + LL_DECLARE_BASE_UNIT(Grams, "g"); + LL_DECLARE_DERIVED_UNIT(Milligrams, "mg", Grams, * 1000); +} + +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Ounces); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, TallCup); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, GrandeCup); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, VentiCup); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Grams); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Milligrams); + + +namespace tut +{ + using namespace LLTrace; + struct trace + { + ThreadRecorder mRecorder; + }; + + typedef test_group<trace> trace_t; + typedef trace_t::object trace_object_t; + tut::trace_t tut_singleton("LLTrace"); + + static CountStatHandle<S32> sCupsOfCoffeeConsumed("coffeeconsumed", "Delicious cup of dark roast."); + static SampleStatHandle<F32Milligrams> sCaffeineLevelStat("caffeinelevel", "Coffee buzz quotient"); + static EventStatHandle<S32Ounces> sOuncesPerCup("cupsize", "Large, huge, or ginormous"); + + static F32 sCaffeineLevel(0.f); + const F32Milligrams sCaffeinePerOz(18.f); + + void drink_coffee(S32 num_cups, S32Ounces cup_size) + { + add(sCupsOfCoffeeConsumed, num_cups); + for (S32 i = 0; i < num_cups; i++) + { + record(sOuncesPerCup, cup_size); + } + + sCaffeineLevel += F32Ounces(num_cups * cup_size).value() * sCaffeinePerOz.value(); + sample(sCaffeineLevelStat, sCaffeineLevel); + } + + // basic data collection + template<> template<> + void trace_object_t::test<1>() + { + sample(sCaffeineLevelStat, sCaffeineLevel); + + Recording all_day; + Recording at_work; + Recording after_3pm; + + all_day.start(); + { + // warm up with one grande cup + drink_coffee(1, S32TallCup(1)); + + // go to work + at_work.start(); + { + // drink 3 tall cups, 1 after 3 pm + drink_coffee(2, S32GrandeCup(1)); + after_3pm.start(); + drink_coffee(1, S32GrandeCup(1)); + } + at_work.stop(); + drink_coffee(1, S32VentiCup(1)); + } + // don't need to stop recordings to get accurate values out of them + //after_3pm.stop(); + //all_day.stop(); + + ensure("count stats are counted when recording is active", + at_work.getSum(sCupsOfCoffeeConsumed) == 3 + && all_day.getSum(sCupsOfCoffeeConsumed) == 5 + && after_3pm.getSum(sCupsOfCoffeeConsumed) == 2); + ensure("measurement sums are counted when recording is active", + at_work.getSum(sOuncesPerCup) == S32Ounces(48) + && all_day.getSum(sOuncesPerCup) == S32Ounces(80) + && after_3pm.getSum(sOuncesPerCup) == S32Ounces(36)); + ensure("measurement min is specific to when recording is active", + at_work.getMin(sOuncesPerCup) == S32GrandeCup(1) + && all_day.getMin(sOuncesPerCup) == S32TallCup(1) + && after_3pm.getMin(sOuncesPerCup) == S32GrandeCup(1)); + ensure("measurement max is specific to when recording is active", + at_work.getMax(sOuncesPerCup) == S32GrandeCup(1) + && all_day.getMax(sOuncesPerCup) == S32VentiCup(1) + && after_3pm.getMax(sOuncesPerCup) == S32VentiCup(1)); + ensure("sample min is specific to when recording is active", + at_work.getMin(sCaffeineLevelStat) == sCaffeinePerOz * ((S32Ounces)S32TallCup(1)).value() + && all_day.getMin(sCaffeineLevelStat) == F32Milligrams(0.f) + && after_3pm.getMin(sCaffeineLevelStat) == sCaffeinePerOz * ((S32Ounces)S32TallCup(1) + (S32Ounces)S32GrandeCup(2)).value()); + ensure("sample max is specific to when recording is active", + at_work.getMax(sCaffeineLevelStat) == sCaffeinePerOz * ((S32Ounces)S32TallCup(1) + (S32Ounces)S32GrandeCup(3)).value() + && all_day.getMax(sCaffeineLevelStat) == sCaffeinePerOz * ((S32Ounces)S32TallCup(1) + (S32Ounces)S32GrandeCup(3) + (S32Ounces)S32VentiCup(1)).value() + && after_3pm.getMax(sCaffeineLevelStat) == sCaffeinePerOz * ((S32Ounces)S32TallCup(1) + (S32Ounces)S32GrandeCup(3) + (S32Ounces)S32VentiCup(1)).value()); + } + +} diff --git a/indra/llcommon/tests/llunits_test.cpp b/indra/llcommon/tests/llunits_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..57cf9810af1dbcdc4e8fe4059b3cd94534aa5cde --- /dev/null +++ b/indra/llcommon/tests/llunits_test.cpp @@ -0,0 +1,388 @@ +/** + * @file llsingleton_test.cpp + * @date 2011-08-11 + * @brief Unit test for the LLSingleton class + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llunits.h" +#include "../test/lltut.h" + +namespace LLUnits +{ + // using powers of 2 to allow strict floating point equality + LL_DECLARE_BASE_UNIT(Quatloos, "Quat"); + LL_DECLARE_DERIVED_UNIT(Latinum, "Lat", Quatloos, / 4); + LL_DECLARE_DERIVED_UNIT(Solari, "Sol", Latinum, * 16); +} + +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Quatloos); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Latinum); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Solari); + +namespace LLUnits +{ + LL_DECLARE_BASE_UNIT(Celcius, "c"); + LL_DECLARE_DERIVED_UNIT(Fahrenheit, "f", Celcius, * 9 / 5 + 32); + LL_DECLARE_DERIVED_UNIT(Kelvin, "k", Celcius, + 273.15f); +} + +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Celcius); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Fahrenheit); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Kelvin); + + +namespace tut +{ + using namespace LLUnits; + struct units + { + }; + + typedef test_group<units> units_t; + typedef units_t::object units_object_t; + tut::units_t tut_singleton("LLUnit"); + + // storage type conversions + template<> template<> + void units_object_t::test<1>() + { + LLUnit<F32, Quatloos> float_quatloos; + ensure("default float unit is zero", float_quatloos == F32Quatloos(0.f)); + + LLUnit<F32, Quatloos> float_initialize_quatloos(1); + ensure("non-zero initialized unit", float_initialize_quatloos == F32Quatloos(1.f)); + + LLUnit<S32, Quatloos> int_quatloos; + ensure("default int unit is zero", int_quatloos == S32Quatloos(0)); + + int_quatloos = S32Quatloos(42); + ensure("int assignment is preserved", int_quatloos == S32Quatloos(42)); + float_quatloos = int_quatloos; + ensure("float assignment from int preserves value", float_quatloos == F32Quatloos(42.f)); + + int_quatloos = float_quatloos; + ensure("int assignment from float preserves value", int_quatloos == S32Quatloos(42)); + + float_quatloos = F32Quatloos(42.1f); + int_quatloos = float_quatloos; + ensure("int units truncate float units on assignment", int_quatloos == S32Quatloos(42)); + + LLUnit<U32, Quatloos> unsigned_int_quatloos(float_quatloos); + ensure("unsigned int can be initialized from signed int", unsigned_int_quatloos == S32Quatloos(42)); + + S32Solari int_solari(1); + + float_quatloos = int_solari; + ensure("fractional units are preserved in conversion from integer to float type", float_quatloos == F32Quatloos(0.25f)); + + int_quatloos = S32Quatloos(1); + F32Solari float_solari = int_quatloos; + ensure("can convert with fractional intermediates from integer to float type", float_solari == F32Solari(4.f)); + } + + // conversions to/from base unit + template<> template<> + void units_object_t::test<2>() + { + LLUnit<F32, Quatloos> quatloos(1.f); + LLUnit<F32, Latinum> latinum_bars(quatloos); + ensure("conversion between units is automatic via initialization", latinum_bars == F32Latinum(1.f / 4.f)); + + latinum_bars = S32Latinum(256); + quatloos = latinum_bars; + ensure("conversion between units is automatic via assignment, and bidirectional", quatloos == S32Quatloos(1024)); + + LLUnit<S32, Quatloos> single_quatloo(1); + LLUnit<F32, Latinum> quarter_latinum = single_quatloo; + ensure("division of integer unit preserves fractional values when converted to float unit", quarter_latinum == F32Latinum(0.25f)); + } + + // conversions across non-base units + template<> template<> + void units_object_t::test<3>() + { + LLUnit<F32, Quatloos> quatloos(1024); + LLUnit<F32, Solari> solari(quatloos); + ensure("conversions can work between indirectly related units: Quatloos -> Latinum -> Solari", solari == S32Solari(4096)); + + LLUnit<F32, Latinum> latinum_bars = solari; + ensure("Non base units can be converted between each other", latinum_bars == S32Latinum(256)); + } + + // math operations + template<> template<> + void units_object_t::test<4>() + { + // exercise math operations + LLUnit<F32, Quatloos> quatloos(1.f); + quatloos *= 4.f; + ensure(quatloos == S32Quatloos(4)); + quatloos = quatloos * 2; + ensure(quatloos == S32Quatloos(8)); + quatloos = 2.f * quatloos; + ensure(quatloos == S32Quatloos(16)); + + quatloos += F32Quatloos(4.f); + ensure(quatloos == S32Quatloos(20)); + quatloos += S32Quatloos(4); + ensure(quatloos == S32Quatloos(24)); + quatloos = quatloos + S32Quatloos(4); + ensure(quatloos == S32Quatloos(28)); + quatloos = S32Quatloos(4) + quatloos; + ensure(quatloos == S32Quatloos(32)); + quatloos += quatloos * 3; + ensure(quatloos == S32Quatloos(128)); + + quatloos -= quatloos / 4 * 3; + ensure(quatloos == S32Quatloos(32)); + quatloos = quatloos - S32Quatloos(8); + ensure(quatloos == S32Quatloos(24)); + quatloos -= S32Quatloos(4); + ensure(quatloos == S32Quatloos(20)); + quatloos -= F32Quatloos(4.f); + ensure(quatloos == S32Quatloos(16)); + + quatloos /= 2.f; + ensure(quatloos == S32Quatloos(8)); + quatloos = quatloos / 4; + ensure(quatloos == S32Quatloos(2)); + + F32 ratio = quatloos / LLUnit<F32, Quatloos>(2.f); + ensure(ratio == 1); + ratio = quatloos / LLUnit<F32, Solari>(8.f); + ensure(ratio == 1); + + quatloos += LLUnit<F32, Solari>(8.f); + ensure(quatloos == S32Quatloos(4)); + quatloos -= LLUnit<F32, Latinum>(1.f); + ensure(quatloos == S32Quatloos(0)); + } + + // comparison operators + template<> template<> + void units_object_t::test<5>() + { + LLUnit<S32, Quatloos> quatloos(1); + ensure("can perform less than comparison against same type", quatloos < S32Quatloos(2)); + ensure("can perform less than comparison against different storage type", quatloos < F32Quatloos(2.f)); + ensure("can perform less than comparison against different units", quatloos < S32Latinum(5)); + ensure("can perform less than comparison against different storage type and units", quatloos < F32Latinum(5.f)); + + ensure("can perform greater than comparison against same type", quatloos > S32Quatloos(0)); + ensure("can perform greater than comparison against different storage type", quatloos > F32Quatloos(0.f)); + ensure("can perform greater than comparison against different units", quatloos > S32Latinum(0)); + ensure("can perform greater than comparison against different storage type and units", quatloos > F32Latinum(0.f)); + + } + + bool accept_explicit_quatloos(S32Quatloos q) + { + return true; + } + + bool accept_implicit_quatloos(S32Quatloos q) + { + return true; + } + + // signature compatibility + template<> template<> + void units_object_t::test<6>() + { + S32Quatloos quatloos(1); + ensure("can pass unit values as argument", accept_explicit_quatloos(S32Quatloos(1))); + ensure("can pass unit values as argument", accept_explicit_quatloos(quatloos)); + } + + // implicit units + template<> template<> + void units_object_t::test<7>() + { + LLUnit<F32, Quatloos> quatloos; + LLUnitImplicit<F32, Quatloos> quatloos_implicit = quatloos + S32Quatloos(1); + ensure("can initialize implicit unit from explicit", quatloos_implicit == 1); + + quatloos = quatloos_implicit; + ensure("can assign implicit unit to explicit unit", quatloos == S32Quatloos(1)); + quatloos += quatloos_implicit; + ensure("can perform math operation using mixture of implicit and explicit units", quatloos == S32Quatloos(2)); + + // math operations on implicits + quatloos_implicit = 1; + ensure(quatloos_implicit == 1); + + quatloos_implicit += 2; + ensure(quatloos_implicit == 3); + + quatloos_implicit *= 2; + ensure(quatloos_implicit == 6); + + quatloos_implicit -= 1; + ensure(quatloos_implicit == 5); + + quatloos_implicit /= 5; + ensure(quatloos_implicit == 1); + + quatloos_implicit = quatloos_implicit + 3 + quatloos_implicit; + ensure(quatloos_implicit == 5); + + quatloos_implicit = 10 - quatloos_implicit - 1; + ensure(quatloos_implicit == 4); + + quatloos_implicit = 2 * quatloos_implicit * 2; + ensure(quatloos_implicit == 16); + + F32 one_half = quatloos_implicit / (quatloos_implicit * 2); + ensure(one_half == 0.5f); + + // implicit conversion to POD + F32 float_val = quatloos_implicit; + ensure("implicit units convert implicitly to regular values", float_val == 16); + + S32 int_val = quatloos_implicit; + ensure("implicit units convert implicitly to regular values", int_val == 16); + + // conversion of implicits + LLUnitImplicit<F32, Latinum> latinum_implicit(2); + ensure("implicit units of different types are comparable", latinum_implicit * 2 == quatloos_implicit); + + quatloos_implicit += F32Quatloos(10); + ensure("can add-assign explicit units", quatloos_implicit == 26); + + quatloos_implicit -= F32Quatloos(10); + ensure("can subtract-assign explicit units", quatloos_implicit == 16); + + // comparisons + ensure("can compare greater than implicit unit", quatloos_implicit > F32QuatloosImplicit(0.f)); + ensure("can compare greater than non-implicit unit", quatloos_implicit > F32Quatloos(0.f)); + ensure("can compare greater than or equal to implicit unit", quatloos_implicit >= F32QuatloosImplicit(0.f)); + ensure("can compare greater than or equal to non-implicit unit", quatloos_implicit >= F32Quatloos(0.f)); + ensure("can compare less than implicit unit", quatloos_implicit < F32QuatloosImplicit(20.f)); + ensure("can compare less than non-implicit unit", quatloos_implicit < F32Quatloos(20.f)); + ensure("can compare less than or equal to implicit unit", quatloos_implicit <= F32QuatloosImplicit(20.f)); + ensure("can compare less than or equal to non-implicit unit", quatloos_implicit <= F32Quatloos(20.f)); + } + + // precision tests + template<> template<> + void units_object_t::test<8>() + { + U32Bytes max_bytes(U32_MAX); + S32Megabytes mega_bytes = max_bytes; + ensure("max available precision is used when converting units", mega_bytes == (S32Megabytes)4095); + + mega_bytes = (S32Megabytes)-5 + (U32Megabytes)1; + ensure("can mix signed and unsigned in units addition", mega_bytes == (S32Megabytes)-4); + + mega_bytes = (U32Megabytes)5 + (S32Megabytes)-1; + ensure("can mix unsigned and signed in units addition", mega_bytes == (S32Megabytes)4); + } + + // default units + template<> template<> + void units_object_t::test<9>() + { + U32Gigabytes GB(1); + U32Megabytes MB(GB); + U32Kilobytes KB(GB); + U32Bytes B(GB); + + ensure("GB -> MB conversion", MB.value() == 1024); + ensure("GB -> KB conversion", KB.value() == 1024 * 1024); + ensure("GB -> B conversion", B.value() == 1024 * 1024 * 1024); + + KB = U32Kilobytes(1); + U32Kilobits Kb(KB); + U32Bits b(KB); + ensure("KB -> Kb conversion", Kb.value() == 8); + ensure("KB -> b conversion", b.value() == 8 * 1024); + + U32Days days(1); + U32Hours hours(days); + U32Minutes minutes(days); + U32Seconds seconds(days); + U32Milliseconds ms(days); + + ensure("days -> hours conversion", hours.value() == 24); + ensure("days -> minutes conversion", minutes.value() == 24 * 60); + ensure("days -> seconds conversion", seconds.value() == 24 * 60 * 60); + ensure("days -> ms conversion", ms.value() == 24 * 60 * 60 * 1000); + + U32Kilometers km(1); + U32Meters m(km); + U32Centimeters cm(km); + U32Millimeters mm(km); + + ensure("km -> m conversion", m.value() == 1000); + ensure("km -> cm conversion", cm.value() == 1000 * 100); + ensure("km -> mm conversion", mm.value() == 1000 * 1000); + + U32Gigahertz GHz(1); + U32Megahertz MHz(GHz); + U32Kilohertz KHz(GHz); + U32Hertz Hz(GHz); + + ensure("GHz -> MHz conversion", MHz.value() == 1000); + ensure("GHz -> KHz conversion", KHz.value() == 1000 * 1000); + ensure("GHz -> Hz conversion", Hz.value() == 1000 * 1000 * 1000); + + F32Radians rad(6.2831853071795f); + S32Degrees deg(rad); + ensure("radians -> degrees conversion", deg.value() == 360); + + F32Percent percent(50); + F32Ratio ratio(percent); + ensure("percent -> ratio conversion", ratio.value() == 0.5f); + + U32Kilotriangles ktris(1); + U32Triangles tris(ktris); + ensure("kilotriangles -> triangles conversion", tris.value() == 1000); + } + + bool value_near(F32 value, F32 target, F32 threshold) + { + return fabsf(value - target) < threshold; + } + + // linear transforms + template<> template<> + void units_object_t::test<10>() + { + F32Celcius float_celcius(100); + F32Fahrenheit float_fahrenheit(float_celcius); + ensure("floating point celcius -> fahrenheit conversion using linear transform", value_near(float_fahrenheit.value(), 212, 0.1f) ); + + float_celcius = float_fahrenheit; + ensure("floating point fahrenheit -> celcius conversion using linear transform (round trip)", value_near(float_celcius.value(), 100.f, 0.1f) ); + + S32Celcius int_celcius(100); + S32Fahrenheit int_fahrenheit(int_celcius); + ensure("integer celcius -> fahrenheit conversion using linear transform", int_fahrenheit.value() == 212); + + int_celcius = int_fahrenheit; + ensure("integer fahrenheit -> celcius conversion using linear transform (round trip)", int_celcius.value() == 100); + } +} diff --git a/indra/llcommon/tests/reflection_test.cpp b/indra/llcommon/tests/reflection_test.cpp deleted file mode 100755 index 8980ebb1f1d1b9c129c803808e52a59f66b2955c..0000000000000000000000000000000000000000 --- a/indra/llcommon/tests/reflection_test.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/** - * @file reflection_test.cpp - * @date May 2006 - * @brief Reflection unit tests. - * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "../linden_common.h" -#include "../reflective.h" -#include "../metaclasst.h" -#include "../metapropertyt.h" -#include "../stdtypes.h" - -#include "../test/lltut.h" - -namespace tut -{ - class TestAggregatedData : public LLReflective - { - public: - TestAggregatedData() {;} - virtual const LLMetaClass& getMetaClass() const; - - private: - }; - - class TestReflectionData : public LLReflective - { - public: - TestReflectionData() : mInt(42), mString("foo"), mNullPtr(NULL), mPtr(new TestAggregatedData()), mRef(*(new TestAggregatedData)) {;} - virtual ~TestReflectionData() {delete mPtr;} - virtual const LLMetaClass& getMetaClass() const; - - static U32 getPropertyCount() {return 5;} - - private: - - friend class LLMetaClassT<TestReflectionData>; - S32 mInt; - std::string mString; - TestAggregatedData* mNullPtr; - TestAggregatedData* mPtr; - TestAggregatedData mObj; - TestAggregatedData& mRef; - }; -} - -template <> -void LLMetaClassT<tut::TestReflectionData>::reflectProperties(LLMetaClass& meta_class) -{ - reflectProperty(meta_class, "mInt", &tut::TestReflectionData::mInt); - reflectProperty(meta_class, "mString", &tut::TestReflectionData::mString); - reflectPtrProperty(meta_class, "mNullPtr", &tut::TestReflectionData::mNullPtr); - reflectPtrProperty(meta_class, "mPtr", &tut::TestReflectionData::mPtr); - reflectProperty(meta_class, "mObj", &tut::TestReflectionData::mObj); - //reflectProperty(meta_class, "mRef", &tut::TestReflectionData::mRef); // AARGH! -} - -namespace tut -{ - // virtual - const LLMetaClass& TestReflectionData::getMetaClass() const - { - return LLMetaClassT<TestReflectionData>::instance(); - } - - const LLMetaClass& TestAggregatedData::getMetaClass() const - { - return LLMetaClassT<TestAggregatedData>::instance(); - } -} - -namespace tut -{ - typedef tut::test_group<TestReflectionData> TestReflectionGroup; - typedef TestReflectionGroup::object TestReflectionObject; - TestReflectionGroup gTestReflectionGroup("reflection"); - - template<> template<> - void TestReflectionObject::test<1>() - { - // Check properties can be found. - const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); - const LLMetaProperty* null = NULL; - ensure_not_equals(meta_class.findProperty("mInt"), null); - ensure_not_equals(meta_class.findProperty("mString"), null); - } - - template<> template<> - void TestReflectionObject::test<2>() - { - // Check non-existent property cannot be found. - const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); - const LLMetaProperty* null = NULL; - ensure_equals(meta_class.findProperty("foo"), null); - } - - template<> template<> - void TestReflectionObject::test<3>() - { - // Check integer property has correct value. - const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); - ensure_equals(meta_class.findProperty("mInt")->getLLSD(this).asInteger(), 42); - } - - template<> template<> - void TestReflectionObject::test<4>() - { - // Check string property has correct value. - const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); - ensure_equals(meta_class.findProperty("mString")->getLLSD(this).asString(), std::string("foo")); - } - - template<> template<> - void TestReflectionObject::test<5>() - { - // Check NULL reference property has correct value. - const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); - const LLReflective* null = NULL; - ensure_equals(meta_class.findProperty("mNullPtr")->get(this), null); - } - - template<> template<> - void TestReflectionObject::test<6>() - { - // Check reference property has correct value. - const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); - const LLReflective* null = NULL; - const LLReflective* ref = meta_class.findProperty("mPtr")->get(this); - ensure_not_equals(ref, null); - } - - template<> template<> - void TestReflectionObject::test<7>() - { - // Check reflective property has correct value. - const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); - const LLReflective* null = NULL; - const LLReflective* ref = meta_class.findProperty("mObj")->get(this); - ensure_not_equals(ref, null); - } - - template<> template<> - void TestReflectionObject::test<8>() - { - // Check property count. - const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); - ensure_equals(meta_class.getPropertyCount(), TestReflectionData::getPropertyCount()); - } - - template<> template<> - void TestReflectionObject::test<9>() - { - // Check property iteration. - const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); - U32 count = 0; - LLMetaClass::PropertyIterator iter; - for(iter = meta_class.beginProperties(); iter != meta_class.endProperties(); ++iter) - { - ++count; - } - ensure_equals(count, TestReflectionData::getPropertyCount()); - } - - template<> template<> - void TestReflectionObject::test<10>() - { - // Check meta classes of different types do not compare equal. - const LLMetaClass* reflection_data_meta_class = &(LLMetaClassT<TestReflectionData>::instance()); - const LLMetaClass* aggregated_data_meta_class = &(LLMetaClassT<TestAggregatedData>::instance()); - ensure_not_equals(reflection_data_meta_class, aggregated_data_meta_class); - } - - template<> template<> - void TestReflectionObject::test<11>() - { - // Check class cast checks. - const LLMetaClass& meta_class = LLMetaClassT<TestReflectionData>::instance(); - TestAggregatedData* aggregated_data = new TestAggregatedData(); - LLMetaClass::PropertyIterator iter; - U32 exception_count = 0; - for(iter = meta_class.beginProperties(); iter != meta_class.endProperties(); ++iter) - { - try - { - const LLMetaProperty* property = (*iter).second; - const LLReflective* reflective = property->get(aggregated_data); // Wrong reflective type, should throw exception. - - // useless op to get rid of compiler warning. - reflective = reflective; - } - catch(...) - { - ++exception_count; - } - } - ensure_equals(exception_count, getPropertyCount()); - - } -} diff --git a/indra/llcommon/tests/wrapllerrs.h b/indra/llcommon/tests/wrapllerrs.h index a4d3a4e0260e30b116edaed314d5ddc2e19a57d1..3137bd8fea9199445c9c51ce19cdd94fab655adc 100755 --- a/indra/llcommon/tests/wrapllerrs.h +++ b/indra/llcommon/tests/wrapllerrs.h @@ -46,9 +46,9 @@ // replicate, but better to reuse extern void wouldHaveCrashed(const std::string& message); -struct WrapLL_ERRS +struct WrapLLErrs { - WrapLL_ERRS(): + WrapLLErrs(): // Resetting Settings discards the default Recorder that writes to // stderr. Otherwise, expected llerrs (LL_ERRS) messages clutter the // console output of successful tests, potentially confusing things. @@ -57,10 +57,10 @@ struct WrapLL_ERRS mPriorFatal(LLError::getFatalFunction()) { // Make LL_ERRS call our own operator() method - LLError::setFatalFunction(boost::bind(&WrapLL_ERRS::operator(), this, _1)); + LLError::setFatalFunction(boost::bind(&WrapLLErrs::operator(), this, _1)); } - ~WrapLL_ERRS() + ~WrapLLErrs() { LLError::setFatalFunction(mPriorFatal); LLError::restoreSettings(mPriorErrorSettings); diff --git a/indra/llcommon/u64.cpp b/indra/llcommon/u64.cpp index eea16c50369f4067f472fd20adea3a3c67b982aa..02c2c15d2605afd205a52b64da26a67566980a73 100755 --- a/indra/llcommon/u64.cpp +++ b/indra/llcommon/u64.cpp @@ -36,7 +36,7 @@ U64 str_to_U64(const std::string& str) if (!aptr) { - llwarns << "str_to_U64: Bad string to U64 conversion attempt: format\n" << llendl; + LL_WARNS() << "str_to_U64: Bad string to U64 conversion attempt: format\n" << LL_ENDL; } else { diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt index 9adfd0ed62d1d6d66830423d8e539373e0fbec9f..a0b1ea13b1f6237526d3edb816be451b53cccbe5 100755 --- a/indra/llcorehttp/CMakeLists.txt +++ b/indra/llcorehttp/CMakeLists.txt @@ -174,7 +174,7 @@ if (LL_TESTS) # The following come from LLAddBuildTest.cmake's INTEGRATION_TEST_xxxx target. set_target_properties(http_texture_load PROPERTIES - LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS ${TCMALLOC_LINK_FLAGS}" + LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE ${TCMALLOC_LINK_FLAGS}" LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO" LINK_FLAGS_RELEASE "" ) diff --git a/indra/llcorehttp/_refcounted.h b/indra/llcorehttp/_refcounted.h index 21a916b13b1dd0a6bf75ca04d3642ee3757274f6..402e7251524d1642b5a333b1534a8b49cb35c6aa 100755 --- a/indra/llcorehttp/_refcounted.h +++ b/indra/llcorehttp/_refcounted.h @@ -72,7 +72,7 @@ class RefCounted inline void RefCounted::addRef() const { - S32 count(mRefCount++); + S32 count(++mRefCount); llassert_always(count >= 0); } @@ -82,7 +82,7 @@ inline void RefCounted::release() const S32 count(mRefCount); llassert_always(count != NOT_REF_COUNTED); llassert_always(count > 0); - count = mRefCount--; + count = --mRefCount; // clean ourselves up if that was the last reference if (0 == count) diff --git a/indra/llcrashlogger/llcrashlock.cpp b/indra/llcrashlogger/llcrashlock.cpp index c3d2f944fceec60783595e2ed4577b355d3a5d5f..7fd78607074a9285a7fd4c3cf89d5b2076af902d 100644 --- a/indra/llcrashlogger/llcrashlock.cpp +++ b/indra/llcrashlogger/llcrashlock.cpp @@ -31,7 +31,6 @@ #include "lldir.h" #include "llsd.h" #include "llsdserialize.h" -#include "llnametable.h" #include "llframetimer.h" #include <boost/filesystem.hpp> #include <string> @@ -40,15 +39,9 @@ #if LL_WINDOWS //For windows platform. -#include <windows.h> +#include <llwin32headers.h> #include <TlHelp32.h> -namespace { - inline DWORD getpid() { - return GetCurrentProcessId(); - } -} - bool LLCrashLock::isProcessAlive(U32 pid, const std::string& pname) { std::wstring wpname; diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 38858a1a9110d29c5cf830d6e9422a8f8ce29f0b..c40deb2b72137b6aa5aea22bb02dc2aa49369392 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -211,8 +211,8 @@ void LLCrashLogger::gatherFiles() LLCurl::setCAFile(gDirUtilp->getCAFile()); } - llinfos << "Using log file from debug log " << mFileMap["SecondLifeLog"] << llendl; - llinfos << "Using settings file from debug log " << mFileMap["SettingsXml"] << llendl; + LL_INFOS() << "Using log file from debug log " << mFileMap["SecondLifeLog"] << LL_ENDL; + LL_INFOS() << "Using settings file from debug log " << mFileMap["SettingsXml"] << LL_ENDL; } else { @@ -491,7 +491,7 @@ bool LLCrashLogger::sendCrashLogs() } else { - llwarns << "Discarding corrupted entry from lock table." << llendl; + LL_WARNS() << "Discarding corrupted entry from lock table." << LL_ENDL; } } } @@ -509,7 +509,7 @@ void LLCrashLogger::updateApplication(const std::string& message) { gServicePump->pump(); gServicePump->callback(); - if (!message.empty()) llinfos << message << llendl; + if (!message.empty()) LL_INFOS() << message << LL_ENDL; } bool LLCrashLogger::init() @@ -563,13 +563,13 @@ bool LLCrashLogger::init() "1 = always send crash report, " "2 = never send crash report)"); - // llinfos << "Loading crash behavior setting" << llendl; + // LL_INFOS() << "Loading crash behavior setting" << LL_ENDL; // mCrashBehavior = loadCrashBehaviorSetting(); // If user doesn't want to send, bail out if (mCrashBehavior == CRASH_BEHAVIOR_NEVER_SEND) { - llinfos << "Crash behavior is never_send, quitting" << llendl; + LL_INFOS() << "Crash behavior is never_send, quitting" << LL_ENDL; return false; } diff --git a/indra/llcrashlogger/llcrashlogger.h b/indra/llcrashlogger/llcrashlogger.h index 78acc63b6a8eafc2d95b8691ea87745ec1c07647..a06bf1d6ac24dd53f99a3d7e48aa0bb8f4021bcf 100755 --- a/indra/llcrashlogger/llcrashlogger.h +++ b/indra/llcrashlogger/llcrashlogger.h @@ -35,6 +35,11 @@ #include "llcontrol.h" #include "llcrashlock.h" +// Crash reporter behavior +const S32 CRASH_BEHAVIOR_ASK = 0; +const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1; +const S32 CRASH_BEHAVIOR_NEVER_SEND = 2; + class LLCrashLogger : public LLApp { public: diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index c8a05e1faea6e0244ecc03f88c325bc7f5570879..1ca1bf55a6b717c5da191efb46f2d7a632b5f73e 100755 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -26,6 +26,7 @@ #include "linden_common.h" +#include "llimageworker.h" #include "llimage.h" #include "llmath.h" @@ -37,7 +38,6 @@ #include "llimagejpeg.h" #include "llimagepng.h" #include "llimagedxt.h" -#include "llimageworker.h" #include "llmemory.h" //--------------------------------------------------------------------------- @@ -89,15 +89,15 @@ void LLImage::setLastError(const std::string& message) //--------------------------------------------------------------------------- LLImageBase::LLImageBase() - : mData(NULL), - mDataSize(0), - mWidth(0), - mHeight(0), - mComponents(0), - mBadBufferAllocation(false), - mAllowOverSize(false) -{ -} +: LLTrace::MemTrackable<LLImageBase>("LLImage"), + mData(NULL), + mDataSize(0), + mWidth(0), + mHeight(0), + mComponents(0), + mBadBufferAllocation(false), + mAllowOverSize(false) +{} // virtual LLImageBase::~LLImageBase() @@ -127,12 +127,12 @@ void LLImageBase::destroyPrivatePool() // virtual void LLImageBase::dump() { - llinfos << "LLImageBase mComponents " << mComponents + LL_INFOS() << "LLImageBase mComponents " << mComponents << " mData " << mData << " mDataSize " << mDataSize << " mWidth " << mWidth << " mHeight " << mHeight - << llendl; + << LL_ENDL; } // virtual @@ -144,13 +144,13 @@ void LLImageBase::sanityCheck() || mComponents > (S8)MAX_IMAGE_COMPONENTS ) { - llerrs << "Failed LLImageBase::sanityCheck " + LL_ERRS() << "Failed LLImageBase::sanityCheck " << "width " << mWidth << "height " << mHeight << "datasize " << mDataSize << "components " << mComponents << "data " << mData - << llendl; + << LL_ENDL; } } @@ -158,8 +158,9 @@ void LLImageBase::sanityCheck() void LLImageBase::deleteData() { FREE_MEM(sPrivatePoolp, mData) ; - mData = NULL; + disclaimMem(mDataSize); mDataSize = 0; + mData = NULL; } // virtual @@ -170,7 +171,7 @@ U8* LLImageBase::allocateData(S32 size) size = mWidth * mHeight * mComponents; if (size <= 0) { - llerrs << llformat("LLImageBase::allocateData called with bad dimensions: %dx%dx%d",mWidth,mHeight,(S32)mComponents) << llendl; + LL_ERRS() << llformat("LLImageBase::allocateData called with bad dimensions: %dx%dx%d",mWidth,mHeight,(S32)mComponents) << LL_ENDL; } } @@ -178,14 +179,14 @@ U8* LLImageBase::allocateData(S32 size) static const U32 MAX_BUFFER_SIZE = 4096 * 4096 * 16 ; //256 MB if (size < 1 || size > MAX_BUFFER_SIZE) { - llinfos << "width: " << mWidth << " height: " << mHeight << " components: " << mComponents << llendl ; + LL_INFOS() << "width: " << mWidth << " height: " << mHeight << " components: " << mComponents << LL_ENDL ; if(mAllowOverSize) { - llinfos << "Oversize: " << size << llendl ; + LL_INFOS() << "Oversize: " << size << LL_ENDL ; } else { - llerrs << "LLImageBase::allocateData: bad size: " << size << llendl; + LL_ERRS() << "LLImageBase::allocateData: bad size: " << size << LL_ENDL; } } if (!mData || size != mDataSize) @@ -195,12 +196,13 @@ U8* LLImageBase::allocateData(S32 size) mData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); if (!mData) { - llwarns << "Failed to allocate image data size [" << size << "]" << llendl; + LL_WARNS() << "Failed to allocate image data size [" << size << "]" << LL_ENDL; size = 0 ; mWidth = mHeight = 0 ; mBadBufferAllocation = true ; } mDataSize = size; + claimMem(mDataSize); } return mData; @@ -212,7 +214,7 @@ U8* LLImageBase::reallocateData(S32 size) U8 *new_datap = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); if (!new_datap) { - llwarns << "Out of memory in LLImageBase::reallocateData" << llendl; + LL_WARNS() << "Out of memory in LLImageBase::reallocateData" << LL_ENDL; return 0; } if (mData) @@ -222,7 +224,9 @@ U8* LLImageBase::reallocateData(S32 size) FREE_MEM(sPrivatePoolp, mData) ; } mData = new_datap; + disclaimMem(mDataSize); mDataSize = size; + claimMem(mDataSize); return mData; } @@ -230,7 +234,7 @@ const U8* LLImageBase::getData() const { if(mBadBufferAllocation) { - llerrs << "Bad memory allocation for the image buffer!" << llendl ; + LL_ERRS() << "Bad memory allocation for the image buffer!" << LL_ENDL ; } return mData; @@ -240,7 +244,7 @@ U8* LLImageBase::getData() { if(mBadBufferAllocation) { - llerrs << "Bad memory allocation for the image buffer!" << llendl ; + LL_ERRS() << "Bad memory allocation for the image buffer!" << LL_ENDL ; } return mData; @@ -288,7 +292,6 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components) LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_copy) : LLImageBase() { - if(no_copy) { setDataAndSize(data, width, height, components); @@ -563,7 +566,7 @@ void LLImageRaw::composite( LLImageRaw* src ) // Src and dst can be any size. Src has 4 components. Dst has 3 components. void LLImageRaw::compositeScaled4onto3(LLImageRaw* src) { - llinfos << "compositeScaled4onto3" << llendl; + LL_INFOS() << "compositeScaled4onto3" << LL_ENDL; LLImageRaw* dst = this; // Just for clarity. @@ -706,7 +709,7 @@ void LLImageRaw::copy(LLImageRaw* src) { if (!src) { - llwarns << "LLImageRaw::copy called with a null src pointer" << llendl; + LL_WARNS() << "LLImageRaw::copy called with a null src pointer" << LL_ENDL; return; } @@ -1223,8 +1226,8 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip llifstream ifs(name, llifstream::binary); if (!ifs.is_open()) { - // SJB: changed from llinfos to lldebugs to reduce spam - lldebugs << "Unable to open image file: " << name << llendl; + // SJB: changed from LL_INFOS() to LL_DEBUGS() to reduce spam + LL_DEBUGS() << "Unable to open image file: " << name << LL_ENDL; return false; } @@ -1238,7 +1241,7 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip if (!length) { - llinfos << "Zero length file file: " << name << llendl; + LL_INFOS() << "Zero length file file: " << name << LL_ENDL; return false; } @@ -1274,7 +1277,7 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip if (!success) { deleteData(); - llwarns << "Unable to decode image" << name << llendl; + LL_WARNS() << "Unable to decode image" << name << LL_ENDL; return false; } @@ -1379,11 +1382,11 @@ void LLImageFormatted::dump() { LLImageBase::dump(); - llinfos << "LLImageFormatted" + LL_INFOS() << "LLImageFormatted" << " mDecoding " << mDecoding << " mCodec " << S32(mCodec) << " mDecoded " << mDecoded - << llendl; + << LL_ENDL; } //---------------------------------------------------------------------------- @@ -1466,11 +1469,11 @@ void LLImageFormatted::sanityCheck() if (mCodec >= IMG_CODEC_EOF) { - llerrs << "Failed LLImageFormatted::sanityCheck " + LL_ERRS() << "Failed LLImageFormatted::sanityCheck " << "decoding " << S32(mDecoding) << "decoded " << S32(mDecoded) << "codec " << S32(mCodec) - << llendl; + << LL_ENDL; } } @@ -1617,7 +1620,10 @@ static void avg4_colors2(const U8* a, const U8* b, const U8* c, const U8* d, U8* void LLImageBase::setDataAndSize(U8 *data, S32 size) { ll_assert_aligned(data, 16); - mData = data; mDataSize = size; + mData = data; + disclaimMem(mDataSize); + mDataSize = size; + claimMem(mDataSize); } //static @@ -1645,7 +1651,7 @@ void LLImageBase::generateMip(const U8* indata, U8* mipdata, S32 width, S32 heig *(U8*)data = (U8)(((U32)(indata[0]) + indata[1] + indata[in_width] + indata[in_width+1])>>2); break; default: - llerrs << "generateMmip called with bad num channels" << llendl; + LL_ERRS() << "generateMmip called with bad num channels" << LL_ENDL; } indata += nchannels*2; data += nchannels; @@ -1702,17 +1708,17 @@ F32 LLImageBase::calc_download_priority(F32 virtual_size, F32 visible_pixels, S3 bytes_weight *= bytes_weight; - //llinfos << "VS: " << virtual_size << llendl; + //LL_INFOS() << "VS: " << virtual_size << LL_ENDL; F32 virtual_size_factor = virtual_size / (10.f*10.f); // The goal is for weighted priority to be <= 0 when we've reached a point where // we've sent enough data. - //llinfos << "BytesSent: " << bytes_sent << llendl; - //llinfos << "BytesWeight: " << bytes_weight << llendl; - //llinfos << "PreLog: " << bytes_weight * virtual_size_factor << llendl; + //LL_INFOS() << "BytesSent: " << bytes_sent << LL_ENDL; + //LL_INFOS() << "BytesWeight: " << bytes_weight << LL_ENDL; + //LL_INFOS() << "PreLog: " << bytes_weight * virtual_size_factor << LL_ENDL; w_priority = (F32)log10(bytes_weight * virtual_size_factor); - //llinfos << "PreScale: " << w_priority << llendl; + //LL_INFOS() << "PreScale: " << w_priority << LL_ENDL; // We don't want to affect how MANY bytes we send based on the visible pixels, but the order // in which they're sent. We post-multiply so we don't change the zero point. diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 2277afc5852b6f21d4e1cc7e5b8bd72ad0ae6501..bf441a008a0c711f6c8505d03ae281caeb8fc5e2 100755 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -29,8 +29,8 @@ #include "lluuid.h" #include "llstring.h" -#include "llthread.h" #include "llpointer.h" +#include "lltrace.h" const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2 const S32 MAX_IMAGE_MIP = 11; // 2048x2048 @@ -111,7 +111,9 @@ class LLImage //============================================================================ // Image base class -class LLImageBase : public LLThreadSafeRefCount +class LLImageBase +: public LLThreadSafeRefCount, + public LLTrace::MemTrackable<LLImageBase> { protected: virtual ~LLImageBase(); @@ -163,6 +165,8 @@ class LLImageBase : public LLThreadSafeRefCount static void destroyPrivatePool() ; static LLPrivateMemoryPool* getPrivatePool() {return sPrivatePoolp;} + //static LLTrace::MemStatHandle sMemStat; + private: U8 *mData; S32 mDataSize; diff --git a/indra/llimage/llimagebmp.cpp b/indra/llimage/llimagebmp.cpp index 60b1c628d790f8c11ab4c0839df3074a50605547..8573fe0d91bd181165a8a3843cb1fc7937d331b8 100755 --- a/indra/llimage/llimagebmp.cpp +++ b/indra/llimage/llimagebmp.cpp @@ -321,7 +321,7 @@ BOOL LLImageBMP::updateData() mColorPalette = new U8[color_palette_size]; if (!mColorPalette) { - llerrs << "Out of memory in LLImageBMP::updateData()" << llendl; + LL_ERRS() << "Out of memory in LLImageBMP::updateData()" << LL_ENDL; return FALSE; } memcpy( mColorPalette, mdata + FILE_HEADER_SIZE + BITMAP_HEADER_SIZE + extension_size, color_palette_size ); /* Flawfinder: ignore */ @@ -528,7 +528,7 @@ BOOL LLImageBMP::encode(const LLImageRaw* raw_image, F32 encode_time) if( (2 == src_components) || (4 == src_components) ) { - llinfos << "Dropping alpha information during BMP encoding" << llendl; + LL_INFOS() << "Dropping alpha information during BMP encoding" << LL_ENDL; } setSize(raw_image->getWidth(), raw_image->getHeight(), dst_components); diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index c6bfa50b403a3babfb42c30096e8a3f188456632..5bf3f29b3ce5b2d5dbef861e7c9418c264c7dbdc 100755 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp @@ -77,7 +77,7 @@ bool LLImageDimensionsInfo::getImageDimensionsBmp() const S32 DATA_LEN = 26; // BMP header (14) + DIB header size (4) + width (4) + height (4) if (!checkFileLength(DATA_LEN)) { - llwarns << "Premature end of file" << llendl; + LL_WARNS() << "Premature end of file" << LL_ENDL; return false; } @@ -89,7 +89,7 @@ bool LLImageDimensionsInfo::getImageDimensionsBmp() // We only support Windows bitmaps (BM), according to LLImageBMP::updateData(). if (signature[0] != 'B' || signature[1] != 'M') { - llwarns << "Not a BMP" << llendl; + LL_WARNS() << "Not a BMP" << LL_ENDL; return false; } @@ -108,7 +108,7 @@ bool LLImageDimensionsInfo::getImageDimensionsTga() // Make sure the file is long enough. if (!checkFileLength(TGA_FILE_HEADER_SIZE + 1 /* width */ + 1 /* height */)) { - llwarns << "Premature end of file" << llendl; + LL_WARNS() << "Premature end of file" << LL_ENDL; return false; } @@ -127,7 +127,7 @@ bool LLImageDimensionsInfo::getImageDimensionsPng() // Make sure the file is long enough. if (!checkFileLength(PNG_MAGIC_SIZE + 8 + sizeof(S32) * 2 /* width, height */)) { - llwarns << "Premature end of file" << llendl; + LL_WARNS() << "Premature end of file" << LL_ENDL; return false; } @@ -139,7 +139,7 @@ bool LLImageDimensionsInfo::getImageDimensionsPng() // Make sure it's a PNG file. if (memcmp(signature, png_magic, PNG_MAGIC_SIZE) != 0) { - llwarns << "Not a PNG" << llendl; + LL_WARNS() << "Not a PNG" << LL_ENDL; return false; } @@ -156,7 +156,7 @@ void on_jpeg_error(j_common_ptr cinfo) { (void) cinfo; sJpegErrorEncountered = true; - llwarns << "Libjpeg has encountered an error!" << llendl; + LL_WARNS() << "Libjpeg has encountered an error!" << LL_ENDL; } bool LLImageDimensionsInfo::getImageDimensionsJpeg() @@ -172,17 +172,17 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg() /* Make sure this is a JPEG file. */ const size_t JPEG_MAGIC_SIZE = 2; - const uint8_t jpeg_magic[JPEG_MAGIC_SIZE] = {0xFF, 0xD8}; - uint8_t signature[JPEG_MAGIC_SIZE]; + const U8 jpeg_magic[JPEG_MAGIC_SIZE] = {0xFF, 0xD8}; + U8 signature[JPEG_MAGIC_SIZE]; if (fread(signature, sizeof(signature), 1, fp) != 1) { - llwarns << "Premature end of file" << llendl; + LL_WARNS() << "Premature end of file" << LL_ENDL; return false; } if (memcmp(signature, jpeg_magic, JPEG_MAGIC_SIZE) != 0) { - llwarns << "Not a JPEG" << llendl; + LL_WARNS() << "Not a JPEG" << LL_ENDL; return false; } fseek(fp, 0, SEEK_SET); // go back to start of the file diff --git a/indra/llimage/llimagedimensionsinfo.h b/indra/llimage/llimagedimensionsinfo.h index 382fdb2a0e029d752a53c24d2ce4564f847b17df..8f716c5d027e1fb401bd05a7fb0b0c0268bbbc62 100755 --- a/indra/llimage/llimagedimensionsinfo.h +++ b/indra/llimage/llimagedimensionsinfo.h @@ -27,6 +27,8 @@ #ifndef LL_LLIMAGEDIMENSIONSINFO_H #define LL_LLIMAGEDIMENSIONSINFO_H +#include "llapr.h" + //----------------------------------------------------------------------------- // LLImageDimensionsInfo // helper class to get image dimensions WITHOUT loading image to memore diff --git a/indra/llimage/llimagedxt.cpp b/indra/llimage/llimagedxt.cpp index 34c6793522134f60caa18705d9007c6f1d6b23b6..04e0e752ebd3374b85b5c12dfff8e466bb0fddea 100755 --- a/indra/llimage/llimagedxt.cpp +++ b/indra/llimage/llimagedxt.cpp @@ -52,7 +52,7 @@ S32 LLImageDXT::formatBits(EFileFormat format) case FORMAT_RGB8: return 24; case FORMAT_RGBA8: return 32; default: - llerrs << "LLImageDXT::Unknown format: " << format << llendl; + LL_ERRS() << "LLImageDXT::Unknown format: " << format << LL_ENDL; return 0; } }; @@ -82,7 +82,7 @@ S32 LLImageDXT::formatComponents(EFileFormat format) case FORMAT_RGB8: return 3; case FORMAT_RGBA8: return 4; default: - llerrs << "LLImageDXT::Unknown format: " << format << llendl; + LL_ERRS() << "LLImageDXT::Unknown format: " << format << LL_ENDL; return 0; } }; @@ -207,7 +207,7 @@ BOOL LLImageDXT::updateData() if (data_size < mHeaderSize) { - llerrs << "LLImageDXT: not enough data" << llendl; + LL_ERRS() << "LLImageDXT: not enough data" << LL_ENDL; } S32 ncomponents = formatComponents(mFileFormat); setSize(width, height, ncomponents); @@ -224,7 +224,7 @@ S32 LLImageDXT::getMipOffset(S32 discard) { if (mFileFormat >= FORMAT_DXT1 && mFileFormat <= FORMAT_DXT5) { - llerrs << "getMipOffset called with old (unsupported) format" << llendl; + LL_ERRS() << "getMipOffset called with old (unsupported) format" << LL_ENDL; } S32 width = getWidth(), height = getHeight(); S32 num_mips = calcNumMips(width, height); @@ -251,7 +251,7 @@ void LLImageDXT::setFormat() { case 3: mFileFormat = FORMAT_DXR1; break; case 4: mFileFormat = FORMAT_DXR3; break; - default: llerrs << "LLImageDXT::setFormat called with ncomponents = " << ncomponents << llendl; + default: LL_ERRS() << "LLImageDXT::setFormat called with ncomponents = " << ncomponents << LL_ENDL; } mHeaderSize = calcHeaderSize(); } @@ -265,7 +265,7 @@ BOOL LLImageDXT::decode(LLImageRaw* raw_image, F32 time) if (mFileFormat >= FORMAT_DXT1 && mFileFormat <= FORMAT_DXR5) { - llwarns << "Attempt to decode compressed LLImageDXT to Raw (unsupported)" << llendl; + LL_WARNS() << "Attempt to decode compressed LLImageDXT to Raw (unsupported)" << LL_ENDL; return FALSE; } @@ -303,7 +303,7 @@ BOOL LLImageDXT::getMipData(LLPointer<LLImageRaw>& raw, S32 discard) } else if (discard < mDiscardLevel) { - llerrs << "Request for invalid discard level" << llendl; + LL_ERRS() << "Request for invalid discard level" << LL_ENDL; } U8* data = getData() + getMipOffset(discard); S32 width = 0; @@ -331,7 +331,7 @@ BOOL LLImageDXT::encodeDXT(const LLImageRaw* raw_image, F32 time, bool explicit_ format = FORMAT_RGBA8; break; default: - llerrs << "LLImageDXT::encode: Unhandled channel number: " << ncomponents << llendl; + LL_ERRS() << "LLImageDXT::encode: Unhandled channel number: " << ncomponents << LL_ENDL; return 0; } @@ -422,7 +422,7 @@ bool LLImageDXT::convertToDXR() case FORMAT_DXT4: newformat = FORMAT_DXR4; break; case FORMAT_DXT5: newformat = FORMAT_DXR5; break; default: - llwarns << "convertToDXR: can not convert format: " << llformat("0x%08x",getFourCC(mFileFormat)) << llendl; + LL_WARNS() << "convertToDXR: can not convert format: " << llformat("0x%08x",getFourCC(mFileFormat)) << LL_ENDL; return false; } mFileFormat = newformat; @@ -433,7 +433,7 @@ bool LLImageDXT::convertToDXR() U8* newdata = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), total_bytes); if (!newdata) { - llerrs << "Out of memory in LLImageDXT::convertToDXR()" << llendl; + LL_ERRS() << "Out of memory in LLImageDXT::convertToDXR()" << LL_ENDL; return false; } llassert(total_bytes > 0); @@ -466,7 +466,7 @@ S32 LLImageDXT::calcDataSize(S32 discard_level) { if (mFileFormat == FORMAT_UNKNOWN) { - llerrs << "calcDataSize called with unloaded LLImageDXT" << llendl; + LL_ERRS() << "calcDataSize called with unloaded LLImageDXT" << LL_ENDL; return 0; } if (discard_level < 0) diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 5412f98ee5d2918182e6141b3108fa8ff411a964..7cd59a2983efe617250a58ec198eca828efa2fed 100755 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -24,11 +24,13 @@ */ #include "linden_common.h" +#include "llapr.h" #include "lldir.h" #include "llimagej2c.h" #include "lltimer.h" #include "llmath.h" #include "llmemory.h" +#include "llsd.h" typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)(); typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*); @@ -60,6 +62,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), mAreaUsedForDataSizeCalcs(0) { mImpl = fallbackCreateLLImageJ2CImpl(); + claimMem(mImpl); // Clear data size table for( S32 i = 0; i <= MAX_DISCARD_LEVEL; i++) diff --git a/indra/llimage/llimagejpeg.cpp b/indra/llimage/llimagejpeg.cpp index b70f84efc889caab7fe6cd72ffb9e991e38a43af..e419c77ff2ce4b1f8f84ba8999844a2378b17c3b 100755 --- a/indra/llimage/llimagejpeg.cpp +++ b/indra/llimage/llimagejpeg.cpp @@ -32,8 +32,7 @@ jmp_buf LLImageJPEG::sSetjmpBuffer ; LLImageJPEG::LLImageJPEG(S32 quality) - : - LLImageFormatted(IMG_CODEC_JPEG), +: LLImageFormatted(IMG_CODEC_JPEG), mOutputBuffer( NULL ), mOutputBufferSize( 0 ), mEncodeQuality( quality ) // on a scale from 1 to 100 @@ -374,7 +373,7 @@ boolean LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo ) U8* new_buffer = new U8[ new_buffer_size ]; if (!new_buffer) { - llerrs << "Out of memory in LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo )" << llendl; + LL_ERRS() << "Out of memory in LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo )" << LL_ENDL; return FALSE; } memcpy( new_buffer, self->mOutputBuffer, self->mOutputBufferSize ); /* Flawfinder: ignore */ @@ -383,7 +382,9 @@ boolean LLImageJPEG::encodeEmptyOutputBuffer( j_compress_ptr cinfo ) cinfo->dest->next_output_byte = self->mOutputBuffer + self->mOutputBufferSize; cinfo->dest->free_in_buffer = self->mOutputBufferSize; + self->disclaimMem(self->mOutputBufferSize); self->mOutputBufferSize = new_buffer_size; + self->claimMem(new_buffer_size); return TRUE; } @@ -465,7 +466,7 @@ void LLImageJPEG::errorOutputMessage( j_common_ptr cinfo ) LLImage::setLastError(error); BOOL is_decode = (cinfo->is_decompressor != 0); - llwarns << "LLImageJPEG " << (is_decode ? "decode " : "encode ") << " failed: " << buffer << llendl; + LL_WARNS() << "LLImageJPEG " << (is_decode ? "decode " : "encode ") << " failed: " << buffer << LL_ENDL; } BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) @@ -489,7 +490,9 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) // Allocate a temporary buffer big enough to hold the entire compressed image (and then some) // (Note: we make it bigger in emptyOutputBuffer() if we need to) delete[] mOutputBuffer; + disclaimMem(mOutputBufferSize); mOutputBufferSize = getWidth() * getHeight() * getComponents() + 1024; + claimMem(mOutputBufferSize); mOutputBuffer = new U8[ mOutputBufferSize ]; const U8* raw_image_data = NULL; @@ -526,6 +529,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) jpeg_destroy_compress(&cinfo); delete[] mOutputBuffer; mOutputBuffer = NULL; + disclaimMem(mOutputBufferSize); mOutputBufferSize = 0; return FALSE; } @@ -628,6 +632,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) // After finish_compress, we can release the temp output buffer. delete[] mOutputBuffer; mOutputBuffer = NULL; + disclaimMem(mOutputBufferSize); mOutputBufferSize = 0; //////////////////////////////////////// @@ -640,6 +645,7 @@ BOOL LLImageJPEG::encode( const LLImageRaw* raw_image, F32 encode_time ) jpeg_destroy_compress(&cinfo); delete[] mOutputBuffer; mOutputBuffer = NULL; + disclaimMem(mOutputBufferSize); mOutputBufferSize = 0; return FALSE; } diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index 7ac7f5d2e0ac916794b27b7cde905f46e43f3fac..5b596d9fa4bba997a24150717b8b739b075f0210 100755 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h @@ -31,6 +31,7 @@ #include "llimage.h" +#include "llwin32headerslean.h" extern "C" { #ifdef LL_STANDALONE # include <jpeglib.h> diff --git a/indra/llimage/llimagetga.cpp b/indra/llimage/llimagetga.cpp index 920ae2891f6caefa99b37ed30935047c34f21fe8..4eb8dc744014b6682e24a857893a74441e846a60 100755 --- a/indra/llimage/llimagetga.cpp +++ b/indra/llimage/llimagetga.cpp @@ -266,7 +266,7 @@ BOOL LLImageTGA::updateData() mColorMap = new U8[ color_map_bytes ]; if (!mColorMap) { - llerrs << "Out of Memory in BOOL LLImageTGA::updateData()" << llendl; + LL_ERRS() << "Out of Memory in BOOL LLImageTGA::updateData()" << LL_ENDL; return FALSE; } memcpy( mColorMap, getData() + mDataOffset, color_map_bytes ); /* Flawfinder: ignore */ @@ -1043,7 +1043,7 @@ BOOL LLImageTGA::decodeAndProcess( LLImageRaw* raw_image, F32 domain, F32 weight // Only works for unflipped monochrome RLE images if( (getComponents() != 1) || (mImageType != 11) || mOriginTopBit || mOriginRightBit ) { - llerrs << "LLImageTGA trying to alpha-gradient process an image that's not a standard RLE, one component image" << llendl; + LL_ERRS() << "LLImageTGA trying to alpha-gradient process an image that's not a standard RLE, one component image" << LL_ENDL; return FALSE; } @@ -1151,7 +1151,7 @@ bool LLImageTGA::loadFile( const std::string& path ) LLFILE* file = LLFile::fopen(path, "rb"); /* Flawfinder: ignore */ if( !file ) { - llwarns << "Couldn't open file " << path << llendl; + LL_WARNS() << "Couldn't open file " << path << LL_ENDL; return false; } @@ -1167,7 +1167,7 @@ bool LLImageTGA::loadFile( const std::string& path ) if( bytes_read != file_size ) { deleteData(); - llwarns << "Couldn't read file " << path << llendl; + LL_WARNS() << "Couldn't read file " << path << LL_ENDL; return false; } @@ -1175,7 +1175,7 @@ bool LLImageTGA::loadFile( const std::string& path ) if( !updateData() ) { - llwarns << "Couldn't decode file " << path << llendl; + LL_WARNS() << "Couldn't decode file " << path << LL_ENDL; deleteData(); return false; } diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index ad2eb0f69c56e1f9968940707f2b11567765d10f..c8b0e872f6536a7e9dd6983fe0e339e9bb9fc33b 100755 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -60,7 +60,7 @@ S32 LLImageDecodeThread::update(F32 max_time_ms) bool res = addRequest(req); if (!res) { - llerrs << "request added after LLLFSThread::cleanupClass()" << llendl; + LL_ERRS() << "request added after LLLFSThread::cleanupClass()" << LL_ENDL; } } mCreationList.clear(); diff --git a/indra/llimage/tests/llimageworker_test.cpp b/indra/llimage/tests/llimageworker_test.cpp index e255d65b43bca62c3705325204787d80113defc7..c030b105fb736f4f071c264babdae1a146365c3b 100755 --- a/indra/llimage/tests/llimageworker_test.cpp +++ b/indra/llimage/tests/llimageworker_test.cpp @@ -31,6 +31,8 @@ #include "../llimageworker.h" // For timer class #include "../llcommon/lltimer.h" +// for lltrace class +#include "../llcommon/lltrace.h" // Tut header #include "../test/lltut.h" @@ -43,7 +45,8 @@ // * A simulator for a class can be implemented here. Please comment and document thoroughly. LLImageBase::LLImageBase() -: mData(NULL), +: LLTrace::MemTrackable<LLImageBase>("LLImageBase"), +mData(NULL), mDataSize(0), mWidth(0), mHeight(0), @@ -110,7 +113,6 @@ namespace tut { // Instance to be tested LLImageDecodeThread* mThread; - // Constructor and destructor of the test wrapper imagedecodethread_test() { @@ -136,6 +138,7 @@ namespace tut imagerequest_test() { done = false; + mRequest = new LLImageDecodeThread::ImageRequest(0, 0, LLQueuedThread::PRIORITY_NORMAL, 0, FALSE, new responder_test(&done)); diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index d15824ce5afd7da462e19ba7f823f33d92d67c4f..e98f677d9b3753a57a274ddecb07dca95dd29b00 100755 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -73,21 +73,21 @@ sample error callback expecting a LLFILE* client object */ void error_callback(const char* msg, void*) { - lldebugs << "LLImageJ2COJ: " << chomp(msg) << llendl; + LL_DEBUGS() << "LLImageJ2COJ: " << chomp(msg) << LL_ENDL; } /** sample warning callback expecting a LLFILE* client object */ void warning_callback(const char* msg, void*) { - lldebugs << "LLImageJ2COJ: " << chomp(msg) << llendl; + LL_DEBUGS() << "LLImageJ2COJ: " << chomp(msg) << LL_ENDL; } /** sample debug callback expecting no client object */ void info_callback(const char* msg, void*) { - lldebugs << "LLImageJ2COJ: " << chomp(msg) << llendl; + LL_DEBUGS() << "LLImageJ2COJ: " << chomp(msg) << LL_ENDL; } // Divide a by 2 to the power of b and round upwards @@ -203,7 +203,7 @@ BOOL LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod if(image->numcomps <= first_channel) { - llwarns << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << llendl; + LL_WARNS() << "trying to decode more channels than are present in image: numcomps: " << image->numcomps << " first_channel: " << first_channel << LL_ENDL; if (image) { opj_image_destroy(image); @@ -472,7 +472,7 @@ BOOL LLImageJ2COJ::getMetadata(LLImageJ2C &base) if(!image) { - llwarns << "ERROR -> getMetadata: failed to decode image!" << llendl; + LL_WARNS() << "ERROR -> getMetadata: failed to decode image!" << LL_ENDL; return FALSE; } diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index e45c809e7e5433b6b776a93bac5843fcb15fe7ef..0a1f93bd8033807f8ed4b4373b551bddf840ee24 100755 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -19,6 +19,7 @@ include_directories( set(llinventory_SOURCE_FILES llcategory.cpp lleconomy.cpp + llfoldertype.cpp llinventory.cpp llinventorydefines.cpp llinventorytype.cpp @@ -36,6 +37,7 @@ set(llinventory_HEADER_FILES llcategory.h lleconomy.h + llfoldertype.h llinventory.h llinventorydefines.h llinventorytype.h diff --git a/indra/llinventory/llcategory.h b/indra/llinventory/llcategory.h index 19ce8fa89baccc37c568d459074cbaf665233088..390a8a1f1ee1c819fec770ec27fbe48717491321 100755 --- a/indra/llinventory/llcategory.h +++ b/indra/llinventory/llcategory.h @@ -43,7 +43,7 @@ // S32 count = LLCategory::none.getSubCategoryCount(); // for(S32 i = 0; i < count; i++) // { -// llinfos << none.getSubCategory(i).lookupNmae() << llendl; +// LL_INFOS() << none.getSubCategory(i).lookupNmae() << LL_ENDL; // } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/llinventory/lleconomy.cpp b/indra/llinventory/lleconomy.cpp index d643ea6ed9077f118d9ced6a43bf0c441f91c021..e10402196fd568e1f1154fe3d8fef45445d55523 100755 --- a/indra/llinventory/lleconomy.cpp +++ b/indra/llinventory/lleconomy.cpp @@ -101,7 +101,7 @@ void LLGlobalEconomy::processEconomyData(LLMessageSystem *msg, LLGlobalEconomy* if (fakeprice_str) { S32 fakeprice = (S32)atoi(fakeprice_str); - llwarns << "LL_FAKE_UPLOAD_PRICE: Faking upload price as L$" << fakeprice << llendl; + LL_WARNS() << "LL_FAKE_UPLOAD_PRICE: Faking upload price as L$" << fakeprice << LL_ENDL; econ_data->setPriceUpload(fakeprice); } #endif @@ -143,19 +143,19 @@ S32 LLGlobalEconomy::calculateLightRent(const LLVector3& object_size) const void LLGlobalEconomy::print() { - llinfos << "Global Economy Settings: " << llendl; - llinfos << "Object Capacity: " << mObjectCapacity << llendl; - llinfos << "Object Count: " << mObjectCount << llendl; - llinfos << "Claim Price Per Object: " << mPriceObjectClaim << llendl; - llinfos << "Claim Price Per Public Object: " << mPricePublicObjectDecay << llendl; - llinfos << "Delete Price Per Public Object: " << mPricePublicObjectDelete << llendl; - llinfos << "Release Price Per Public Object: " << getPricePublicObjectRelease() << llendl; - llinfos << "Price Per Energy Unit: " << mPriceEnergyUnit << llendl; - llinfos << "Price Per Upload: " << mPriceUpload << llendl; - llinfos << "Light Base Price: " << mPriceRentLight << llendl; - llinfos << "Teleport Min Price: " << mTeleportMinPrice << llendl; - llinfos << "Teleport Price Exponent: " << mTeleportPriceExponent << llendl; - llinfos << "Price for group creation: " << mPriceGroupCreate << llendl; + LL_INFOS() << "Global Economy Settings: " << LL_ENDL; + LL_INFOS() << "Object Capacity: " << mObjectCapacity << LL_ENDL; + LL_INFOS() << "Object Count: " << mObjectCount << LL_ENDL; + LL_INFOS() << "Claim Price Per Object: " << mPriceObjectClaim << LL_ENDL; + LL_INFOS() << "Claim Price Per Public Object: " << mPricePublicObjectDecay << LL_ENDL; + LL_INFOS() << "Delete Price Per Public Object: " << mPricePublicObjectDelete << LL_ENDL; + LL_INFOS() << "Release Price Per Public Object: " << getPricePublicObjectRelease() << LL_ENDL; + LL_INFOS() << "Price Per Energy Unit: " << mPriceEnergyUnit << LL_ENDL; + LL_INFOS() << "Price Per Upload: " << mPriceUpload << LL_ENDL; + LL_INFOS() << "Light Base Price: " << mPriceRentLight << LL_ENDL; + LL_INFOS() << "Teleport Min Price: " << mTeleportMinPrice << LL_ENDL; + LL_INFOS() << "Teleport Price Exponent: " << mTeleportPriceExponent << LL_ENDL; + LL_INFOS() << "Price for group creation: " << mPriceGroupCreate << LL_ENDL; } LLRegionEconomy::LLRegionEconomy() @@ -209,8 +209,8 @@ void LLRegionEconomy::processEconomyDataRequest(LLMessageSystem *msg, void **use LLRegionEconomy *this_ptr = (LLRegionEconomy*)user_data; if (!this_ptr->hasData()) { - llwarns << "Dropping EconomyDataRequest, because EconomyData message " - << "has not been processed" << llendl; + LL_WARNS() << "Dropping EconomyDataRequest, because EconomyData message " + << "has not been processed" << LL_ENDL; } msg->newMessageFast(_PREHASH_EconomyData); @@ -254,12 +254,12 @@ void LLRegionEconomy::print() { this->LLGlobalEconomy::print(); - llinfos << "Region Economy Settings: " << llendl; - llinfos << "Land (square meters): " << mAreaTotal << llendl; - llinfos << "Owned Land (square meters): " << mAreaOwned << llendl; - llinfos << "Daily Object Rent: " << mPriceObjectRent << llendl; - llinfos << "Daily Land Rent (per meter): " << getPriceParcelRent() << llendl; - llinfos << "Energey Efficiency: " << mEnergyEfficiency << llendl; + LL_INFOS() << "Region Economy Settings: " << LL_ENDL; + LL_INFOS() << "Land (square meters): " << mAreaTotal << LL_ENDL; + LL_INFOS() << "Owned Land (square meters): " << mAreaOwned << LL_ENDL; + LL_INFOS() << "Daily Object Rent: " << mPriceObjectRent << LL_ENDL; + LL_INFOS() << "Daily Land Rent (per meter): " << getPriceParcelRent() << LL_ENDL; + LL_INFOS() << "Energey Efficiency: " << mEnergyEfficiency << LL_ENDL; } diff --git a/indra/llinventory/lleconomy.h b/indra/llinventory/lleconomy.h index eb2ecf71ba41b70aaa905cbe7e99138688dbf869..47fcf688a26d66e9b61b70f119288d1ceb5c5303 100755 --- a/indra/llinventory/lleconomy.h +++ b/indra/llinventory/lleconomy.h @@ -27,6 +27,7 @@ #define LL_LLECONOMY_H #include "llsingleton.h" +#include <list> class LLMessageSystem; class LLVector3; diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp similarity index 97% rename from indra/llcommon/llfoldertype.cpp rename to indra/llinventory/llfoldertype.cpp index 9c38349cf722405b57189cb6fd22acf158ec0db3..8b568ea5605d13a9974a17adbd81816c5c477921 100755 --- a/indra/llcommon/llfoldertype.cpp +++ b/indra/llinventory/llfoldertype.cpp @@ -146,7 +146,7 @@ LLAssetType::EType LLFolderType::folderTypeToAssetType(LLFolderType::EType folde { if (LLAssetType::lookup(LLAssetType::EType(folder_type)) == LLAssetType::badLookup()) { - llwarns << "Converting to unknown asset type " << folder_type << llendl; + LL_WARNS() << "Converting to unknown asset type " << folder_type << LL_ENDL; } return (LLAssetType::EType)folder_type; } @@ -156,7 +156,7 @@ LLFolderType::EType LLFolderType::assetTypeToFolderType(LLAssetType::EType asset { if (LLFolderType::lookup(LLFolderType::EType(asset_type)) == LLFolderType::badLookup()) { - llwarns << "Converting to unknown folder type " << asset_type << llendl; + LL_WARNS() << "Converting to unknown folder type " << asset_type << LL_ENDL; } return (LLFolderType::EType)asset_type; } diff --git a/indra/llcommon/llfoldertype.h b/indra/llinventory/llfoldertype.h old mode 100644 new mode 100755 similarity index 100% rename from indra/llcommon/llfoldertype.h rename to indra/llinventory/llfoldertype.h diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 41d58c6deb5b2c476012deb32bccefe661a13b3e..7fb2a801b27566d282173bfcb9ae054088ec04ba 100755 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -28,6 +28,7 @@ #include "llinventory.h" #include "lldbstrings.h" +#include "llfasttimer.h" #include "llinventorydefines.h" #include "llxorcipher.h" #include "llsd.h" @@ -71,17 +72,20 @@ const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730"); LLInventoryObject::LLInventoryObject(const LLUUID& uuid, const LLUUID& parent_uuid, LLAssetType::EType type, - const std::string& name) : + const std::string& name) +: LLTrace::MemTrackable<LLInventoryObject>("LLInventoryObject"), mUUID(uuid), mParentUUID(parent_uuid), mType(type), mName(name), mCreationDate(0) { + claimMem(mName); correctInventoryName(mName); } -LLInventoryObject::LLInventoryObject() : +LLInventoryObject::LLInventoryObject() +: LLTrace::MemTrackable<LLInventoryObject>("LLInventoryObject"), mType(LLAssetType::AT_NONE), mCreationDate(0) { @@ -96,7 +100,9 @@ void LLInventoryObject::copyObject(const LLInventoryObject* other) mUUID = other->mUUID; mParentUUID = other->mParentUUID; mType = other->mType; + disclaimMem(mName); mName = other->mName; + claimMem(mName); } const LLUUID& LLInventoryObject::getUUID() const @@ -149,7 +155,9 @@ void LLInventoryObject::rename(const std::string& n) correctInventoryName(new_name); if( !new_name.empty() && new_name != mName ) { + disclaimMem(mName); mName = new_name; + claimMem(mName); } } @@ -212,8 +220,8 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) } else { - llwarns << "unknown keyword '" << keyword - << "' in LLInventoryObject::importLegacyStream() for object " << mUUID << llendl; + LL_WARNS() << "unknown keyword '" << keyword + << "' in LLInventoryObject::importLegacyStream() for object " << mUUID << LL_ENDL; } } return TRUE; @@ -253,19 +261,19 @@ BOOL LLInventoryObject::exportLegacyStream(std::ostream& output_stream, BOOL) co void LLInventoryObject::removeFromServer() { // don't do nothin' - llwarns << "LLInventoryObject::removeFromServer() called. Doesn't do anything." << llendl; + LL_WARNS() << "LLInventoryObject::removeFromServer() called. Doesn't do anything." << LL_ENDL; } void LLInventoryObject::updateParentOnServer(BOOL) const { // don't do nothin' - llwarns << "LLInventoryObject::updateParentOnServer() called. Doesn't do anything." << llendl; + LL_WARNS() << "LLInventoryObject::updateParentOnServer() called. Doesn't do anything." << LL_ENDL; } void LLInventoryObject::updateServer(BOOL) const { // don't do nothin' - llwarns << "LLInventoryObject::updateServer() called. Doesn't do anything." << llendl; + LL_WARNS() << "LLInventoryObject::updateServer() called. Doesn't do anything." << LL_ENDL; } inline @@ -325,6 +333,8 @@ LLInventoryItem::LLInventoryItem(const LLUUID& uuid, LLStringUtil::replaceNonstandardASCII(mDescription, ' '); LLStringUtil::replaceChar(mDescription, '|', ' '); + claimMem(mDescription); + mPermissions.initMasks(inv_type); } @@ -356,7 +366,9 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other) copyObject(other); mPermissions = other->mPermissions; mAssetUUID = other->mAssetUUID; + disclaimMem(mDescription); mDescription = other->mDescription; + claimMem(mDescription); mSaleInfo = other->mSaleInfo; mInventoryType = other->mInventoryType; mFlags = other->mFlags; @@ -403,23 +415,23 @@ U32 LLInventoryItem::getCRC32() const // *NOTE: We currently do not validate the name or description, // but if they change in transit, it's no big deal. U32 crc = mUUID.getCRC32(); - //lldebugs << "1 crc: " << std::hex << crc << std::dec << llendl; + //LL_DEBUGS() << "1 crc: " << std::hex << crc << std::dec << LL_ENDL; crc += mParentUUID.getCRC32(); - //lldebugs << "2 crc: " << std::hex << crc << std::dec << llendl; + //LL_DEBUGS() << "2 crc: " << std::hex << crc << std::dec << LL_ENDL; crc += mPermissions.getCRC32(); - //lldebugs << "3 crc: " << std::hex << crc << std::dec << llendl; + //LL_DEBUGS() << "3 crc: " << std::hex << crc << std::dec << LL_ENDL; crc += mAssetUUID.getCRC32(); - //lldebugs << "4 crc: " << std::hex << crc << std::dec << llendl; + //LL_DEBUGS() << "4 crc: " << std::hex << crc << std::dec << LL_ENDL; crc += mType; - //lldebugs << "5 crc: " << std::hex << crc << std::dec << llendl; + //LL_DEBUGS() << "5 crc: " << std::hex << crc << std::dec << LL_ENDL; crc += mInventoryType; - //lldebugs << "6 crc: " << std::hex << crc << std::dec << llendl; + //LL_DEBUGS() << "6 crc: " << std::hex << crc << std::dec << LL_ENDL; crc += mFlags; - //lldebugs << "7 crc: " << std::hex << crc << std::dec << llendl; + //LL_DEBUGS() << "7 crc: " << std::hex << crc << std::dec << LL_ENDL; crc += mSaleInfo.getCRC32(); - //lldebugs << "8 crc: " << std::hex << crc << std::dec << llendl; + //LL_DEBUGS() << "8 crc: " << std::hex << crc << std::dec << LL_ENDL; crc += (U32)mCreationDate; - //lldebugs << "9 crc: " << std::hex << crc << std::dec << llendl; + //LL_DEBUGS() << "9 crc: " << std::hex << crc << std::dec << LL_ENDL; return crc; } @@ -431,7 +443,9 @@ void LLInventoryItem::setDescription(const std::string& d) LLStringUtil::replaceChar(new_desc, '|', ' '); if( new_desc != mDescription ) { + disclaimMem(mDescription); mDescription = new_desc; + claimMem(mDescription); } } @@ -576,13 +590,13 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 #ifdef CRC_CHECK if(local_crc == remote_crc) { - lldebugs << "crc matches" << llendl; + LL_DEBUGS() << "crc matches" << LL_ENDL; return TRUE; } else { - llwarns << "inventory crc mismatch: local=" << std::hex << local_crc - << " remote=" << remote_crc << std::dec << llendl; + LL_WARNS() << "inventory crc mismatch: local=" << std::hex << local_crc + << " remote=" << remote_crc << std::dec << LL_ENDL; return FALSE; } #else @@ -712,13 +726,15 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) valuestr[0] = '\000'; } + disclaimMem(mDescription); mDescription.assign(valuestr); + claimMem(mDescription); LLStringUtil::replaceNonstandardASCII(mDescription, ' '); /* TODO -- ask Ian about this code const char *donkey = mDescription.c_str(); if (donkey[0] == '|') { - llerrs << "Donkey" << llendl; + LL_ERRS() << "Donkey" << LL_ENDL; } */ } @@ -730,8 +746,8 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) } else { - llwarns << "unknown keyword '" << keyword - << "' in inventory import of item " << mUUID << llendl; + LL_WARNS() << "unknown keyword '" << keyword + << "' in inventory import of item " << mUUID << LL_ENDL; } } @@ -741,7 +757,7 @@ BOOL LLInventoryItem::importFile(LLFILE* fp) if((LLInventoryType::IT_NONE == mInventoryType) || !inventory_and_asset_types_match(mInventoryType, mType)) { - lldebugs << "Resetting inventory type for " << mUUID << llendl; + LL_DEBUGS() << "Resetting inventory type for " << mUUID << LL_ENDL; mInventoryType = LLInventoryType::defaultForAssetType(mType); } @@ -918,13 +934,15 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) valuestr[0] = '\000'; } + disclaimMem(mDescription); mDescription.assign(valuestr); LLStringUtil::replaceNonstandardASCII(mDescription, ' '); + claimMem(mDescription); /* TODO -- ask Ian about this code const char *donkey = mDescription.c_str(); if (donkey[0] == '|') { - llerrs << "Donkey" << llendl; + LL_ERRS() << "Donkey" << LL_ENDL; } */ } @@ -936,8 +954,8 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) } else { - llwarns << "unknown keyword '" << keyword - << "' in inventory import of item " << mUUID << llendl; + LL_WARNS() << "unknown keyword '" << keyword + << "' in inventory import of item " << mUUID << LL_ENDL; } } @@ -947,7 +965,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream) if((LLInventoryType::IT_NONE == mInventoryType) || !inventory_and_asset_types_match(mInventoryType, mType)) { - lldebugs << "Resetting inventory type for " << mUUID << llendl; + LL_DEBUGS() << "Resetting inventory type for " << mUUID << LL_ENDL; mInventoryType = LLInventoryType::defaultForAssetType(mType); } @@ -1048,11 +1066,11 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate; } -LLFastTimer::DeclareTimer FTM_INVENTORY_SD_DESERIALIZE("Inventory SD Deserialize"); +LLTrace::BlockTimerStatHandle FTM_INVENTORY_SD_DESERIALIZE("Inventory SD Deserialize"); bool LLInventoryItem::fromLLSD(const LLSD& sd) { - LLFastTimer _(FTM_INVENTORY_SD_DESERIALIZE); + LL_RECORD_BLOCK_TIME(FTM_INVENTORY_SD_DESERIALIZE); mInventoryType = LLInventoryType::IT_NONE; mAssetUUID.setNull(); std::string w; @@ -1159,8 +1177,10 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd) w = INV_DESC_LABEL; if (sd.has(w)) { + disclaimMem(mDescription); mDescription = sd[w].asString(); LLStringUtil::replaceNonstandardASCII(mDescription, ' '); + claimMem(mDescription); } w = INV_CREATION_DATE_LABEL; if (sd.has(w)) @@ -1174,7 +1194,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd) if((LLInventoryType::IT_NONE == mInventoryType) || !inventory_and_asset_types_match(mInventoryType, mType)) { - lldebugs << "Resetting inventory type for " << mUUID << llendl; + LL_DEBUGS() << "Resetting inventory type for " << mUUID << LL_ENDL; mInventoryType = LLInventoryType::defaultForAssetType(mType); } @@ -1247,7 +1267,7 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) if (NULL == bin_bucket) { - llerrs << "unpackBinaryBucket failed. bin_bucket is NULL." << llendl; + LL_ERRS() << "unpackBinaryBucket failed. bin_bucket is NULL." << LL_ENDL; return; } @@ -1257,7 +1277,7 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) item_buffer[bin_bucket_size] = '\0'; std::string str(&item_buffer[0]); - lldebugs << "item buffer: " << str << llendl; + LL_DEBUGS() << "item buffer: " << str << LL_ENDL; // Tokenize the string. typedef boost::tokenizer<boost::char_separator<char> > tokenizer; @@ -1294,7 +1314,7 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size) perm.init(creator_id, owner_id, last_owner_id, group_id); perm.initMasks(mask_base, mask_owner, mask_group, mask_every, mask_next); setPermissions(perm); - //lldebugs << "perm: " << perm << llendl; + //LL_DEBUGS() << "perm: " << perm << LL_ENDL; LLUUID asset_id((*(iter++)).c_str()); setAssetUUID(asset_id); @@ -1495,8 +1515,8 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp) } else { - llwarns << "unknown keyword '" << keyword - << "' in inventory import category " << mUUID << llendl; + LL_WARNS() << "unknown keyword '" << keyword + << "' in inventory import category " << mUUID << LL_ENDL; } } return TRUE; @@ -1574,8 +1594,8 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) } else { - llwarns << "unknown keyword '" << keyword - << "' in inventory import category " << mUUID << llendl; + LL_WARNS() << "unknown keyword '" << keyword + << "' in inventory import category " << mUUID << LL_ENDL; } } return TRUE; @@ -1606,8 +1626,8 @@ LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item) if(item.isNull()) return rv; if (item->getType() == LLAssetType::AT_NONE) { - llwarns << "ll_create_sd_from_inventory_item() for item with AT_NONE" - << llendl; + LL_WARNS() << "ll_create_sd_from_inventory_item() for item with AT_NONE" + << LL_ENDL; return rv; } rv[INV_ITEM_ID_LABEL] = item->getUUID(); @@ -1632,8 +1652,8 @@ LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat) if(cat.isNull()) return rv; if (cat->getType() == LLAssetType::AT_NONE) { - llwarns << "ll_create_sd_from_inventory_category() for cat with AT_NONE" - << llendl; + LL_WARNS() << "ll_create_sd_from_inventory_category() for cat with AT_NONE" + << LL_ENDL; return rv; } rv[INV_FOLDER_ID_LABEL] = cat->getUUID(); diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h index 99716ed7be6d13290756c80b191385eed8c25d73..aa0b4cc24cbb4fc2ee1ed4285ccb43348edf13ba 100755 --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -27,7 +27,6 @@ #ifndef LL_LLINVENTORY_H #define LL_LLINVENTORY_H -#include "lldarray.h" #include "llfoldertype.h" #include "llinventorytype.h" #include "llpermissions.h" @@ -35,6 +34,7 @@ #include "llsaleinfo.h" #include "llsd.h" #include "lluuid.h" +#include "lltrace.h" class LLMessageSystem; @@ -44,7 +44,7 @@ class LLMessageSystem; // Base class for anything in the user's inventory. Handles the common code // between items and categories. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLInventoryObject : public LLRefCount +class LLInventoryObject : public LLRefCount, public LLTrace::MemTrackable<LLInventoryObject> { public: typedef std::list<LLPointer<LLInventoryObject> > object_list_t; @@ -124,7 +124,7 @@ class LLInventoryObject : public LLRefCount class LLInventoryItem : public LLInventoryObject { public: - typedef LLDynamicArray<LLPointer<LLInventoryItem> > item_array_t; + typedef std::vector<LLPointer<LLInventoryItem> > item_array_t; //-------------------------------------------------------------------- // Initialization @@ -235,7 +235,7 @@ class LLInventoryItem : public LLInventoryObject class LLInventoryCategory : public LLInventoryObject { public: - typedef LLDynamicArray<LLPointer<LLInventoryCategory> > cat_array_t; + typedef std::vector<LLPointer<LLInventoryCategory> > cat_array_t; //-------------------------------------------------------------------- // Initialization diff --git a/indra/llinventory/lllandmark.cpp b/indra/llinventory/lllandmark.cpp index 493909cf9c845411098dbd81f43e80647b0a0002..4c6075d6b56353f186aa1e80bf1d4db3f065e024 100755 --- a/indra/llinventory/lllandmark.cpp +++ b/indra/llinventory/lllandmark.cpp @@ -128,7 +128,7 @@ LLLandmark* LLLandmark::constructFromString(const char *buffer) goto error; } cur += chars_read; - // llinfos << "Landmark read: " << pos << llendl; + // LL_INFOS() << "Landmark read: " << pos << LL_ENDL; return new LLLandmark(pos); } @@ -155,7 +155,7 @@ LLLandmark* LLLandmark::constructFromString(const char *buffer) } error: - llinfos << "Bad Landmark Asset: bad _DATA_ block." << llendl; + LL_INFOS() << "Bad Landmark Asset: bad _DATA_ block." << LL_ENDL; return NULL; } @@ -176,7 +176,7 @@ void LLLandmark::requestRegionHandle( if(region_id.isNull()) { // don't bother with checking - it's 0. - lldebugs << "requestRegionHandle: null" << llendl; + LL_DEBUGS() << "requestRegionHandle: null" << LL_ENDL; if(callback) { const U64 U64_ZERO = 0; @@ -187,7 +187,7 @@ void LLLandmark::requestRegionHandle( { if(region_id == mLocalRegion.first) { - lldebugs << "requestRegionHandle: local" << llendl; + LL_DEBUGS() << "requestRegionHandle: local" << LL_ENDL; if(callback) { callback(region_id, mLocalRegion.second); @@ -198,14 +198,14 @@ void LLLandmark::requestRegionHandle( region_map_t::iterator it = mRegions.find(region_id); if(it == mRegions.end()) { - lldebugs << "requestRegionHandle: upstream" << llendl; + LL_DEBUGS() << "requestRegionHandle: upstream" << LL_ENDL; if(callback) { region_callback_map_t::value_type vt(region_id, callback); sRegionCallbackMap.insert(vt); } - lldebugs << "Landmark requesting information about: " - << region_id << llendl; + LL_DEBUGS() << "Landmark requesting information about: " + << region_id << LL_ENDL; msg->newMessage("RegionHandleRequest"); msg->nextBlock("RequestBlock"); msg->addUUID("RegionID", region_id); @@ -214,7 +214,7 @@ void LLLandmark::requestRegionHandle( else if(callback) { // we have the answer locally - just call the callack. - lldebugs << "requestRegionHandle: ready" << llendl; + LL_DEBUGS() << "requestRegionHandle: ready" << LL_ENDL; callback(region_id, (*it).second.mRegionHandle); } } @@ -248,8 +248,8 @@ void LLLandmark::processRegionIDAndHandle(LLMessageSystem* msg, void**) #if LL_DEBUG U32 grid_x, grid_y; grid_from_region_handle(info.mRegionHandle, &grid_x, &grid_y); - lldebugs << "Landmark got reply for region: " << region_id << " " - << grid_x << "," << grid_y << llendl; + LL_DEBUGS() << "Landmark got reply for region: " << region_id << " " + << grid_x << "," << grid_y << LL_ENDL; #endif // make all the callbacks here. diff --git a/indra/llinventory/llnotecard.cpp b/indra/llinventory/llnotecard.cpp index 69152cefe078a75c034e329f5194387a6d0d731b..908c647498f0478c2372a94cde14e85eab86931c 100755 --- a/indra/llinventory/llnotecard.cpp +++ b/indra/llinventory/llnotecard.cpp @@ -57,33 +57,33 @@ bool LLNotecard::importEmbeddedItemsStream(std::istream& str) str >> std::ws >> "LLEmbeddedItems version" >> mEmbeddedVersion >> "\n"; if (str.fail()) { - llwarns << "Invalid Linden text file header" << llendl; + LL_WARNS() << "Invalid Linden text file header" << LL_ENDL; goto import_file_failed; } if( 1 != mEmbeddedVersion ) { - llwarns << "Invalid LLEmbeddedItems version: " << mEmbeddedVersion << llendl; + LL_WARNS() << "Invalid LLEmbeddedItems version: " << mEmbeddedVersion << LL_ENDL; goto import_file_failed; } str >> std::ws >> "{\n"; if(str.fail()) { - llwarns << "Invalid Linden text file format: missing {" << llendl; + LL_WARNS() << "Invalid Linden text file format: missing {" << LL_ENDL; goto import_file_failed; } str >> std::ws >> "count " >> count >> "\n"; if(str.fail()) { - llwarns << "Invalid LLEmbeddedItems count" << llendl; + LL_WARNS() << "Invalid LLEmbeddedItems count" << LL_ENDL; goto import_file_failed; } if((count < 0)) { - llwarns << "Invalid LLEmbeddedItems count value: " << count << llendl; + LL_WARNS() << "Invalid LLEmbeddedItems count value: " << count << LL_ENDL; goto import_file_failed; } @@ -92,7 +92,7 @@ bool LLNotecard::importEmbeddedItemsStream(std::istream& str) str >> std::ws >> "{\n"; if(str.fail()) { - llwarns << "Invalid LLEmbeddedItems file format: missing {" << llendl; + LL_WARNS() << "Invalid LLEmbeddedItems file format: missing {" << LL_ENDL; goto import_file_failed; } @@ -100,21 +100,21 @@ bool LLNotecard::importEmbeddedItemsStream(std::istream& str) str >> std::ws >> "ext char index " >> index >> "\n"; if(str.fail()) { - llwarns << "Invalid LLEmbeddedItems file format: missing ext char index" << llendl; + LL_WARNS() << "Invalid LLEmbeddedItems file format: missing ext char index" << LL_ENDL; goto import_file_failed; } str >> std::ws >> "inv_item\t0\n"; if(str.fail()) { - llwarns << "Invalid LLEmbeddedItems file format: missing inv_item" << llendl; + LL_WARNS() << "Invalid LLEmbeddedItems file format: missing inv_item" << LL_ENDL; goto import_file_failed; } LLPointer<LLInventoryItem> item = new LLInventoryItem; if (!item->importLegacyStream(str)) { - llinfos << "notecard import failed" << llendl; + LL_INFOS() << "notecard import failed" << LL_ENDL; goto import_file_failed; } mItems.push_back(item); @@ -122,7 +122,7 @@ bool LLNotecard::importEmbeddedItemsStream(std::istream& str) str >> std::ws >> "}\n"; if(str.fail()) { - llwarns << "Invalid LLEmbeddedItems file format: missing }" << llendl; + LL_WARNS() << "Invalid LLEmbeddedItems file format: missing }" << LL_ENDL; goto import_file_failed; } } @@ -130,7 +130,7 @@ bool LLNotecard::importEmbeddedItemsStream(std::istream& str) str >> std::ws >> "}\n"; if(str.fail()) { - llwarns << "Invalid LLEmbeddedItems file format: missing }" << llendl; + LL_WARNS() << "Invalid LLEmbeddedItems file format: missing }" << LL_ENDL; goto import_file_failed; } @@ -161,20 +161,20 @@ bool LLNotecard::importStream(std::istream& str) str >> std::ws >> "Linden text version " >> mVersion >> "\n"; if(str.fail()) { - llwarns << "Invalid Linden text file header " << llendl; + LL_WARNS() << "Invalid Linden text file header " << LL_ENDL; return FALSE; } if( 1 != mVersion && 2 != mVersion) { - llwarns << "Invalid Linden text file version: " << mVersion << llendl; + LL_WARNS() << "Invalid Linden text file version: " << mVersion << LL_ENDL; return FALSE; } str >> std::ws >> "{\n"; if(str.fail()) { - llwarns << "Invalid Linden text file format" << llendl; + LL_WARNS() << "Invalid Linden text file format" << LL_ENDL; return FALSE; } @@ -187,7 +187,7 @@ bool LLNotecard::importStream(std::istream& str) str.getline(line_buf, STD_STRING_BUF_SIZE); if(str.fail()) { - llwarns << "Invalid Linden text length field" << llendl; + LL_WARNS() << "Invalid Linden text length field" << LL_ENDL; return FALSE; } line_buf[STD_STRING_STR_LEN] = '\0'; @@ -195,13 +195,13 @@ bool LLNotecard::importStream(std::istream& str) S32 text_len = 0; if( 1 != sscanf(line_buf, "Text length %d", &text_len) ) { - llwarns << "Invalid Linden text length field" << llendl; + LL_WARNS() << "Invalid Linden text length field" << LL_ENDL; return FALSE; } if(text_len > mMaxText || text_len < 0) { - llwarns << "Invalid Linden text length: " << text_len << llendl; + LL_WARNS() << "Invalid Linden text length: " << text_len << LL_ENDL; return FALSE; } @@ -211,7 +211,7 @@ bool LLNotecard::importStream(std::istream& str) fullread(str, text, text_len); if(str.fail()) { - llwarns << "Invalid Linden text: text shorter than text length: " << text_len << llendl; + LL_WARNS() << "Invalid Linden text: text shorter than text length: " << text_len << LL_ENDL; success = FALSE; } text[text_len] = '\0'; diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 5eb5fb442d0f958860de8691e7e54541c46c66bd..e400877b3bba53b75f7dc44c0bd8578db19c1636 100755 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -136,7 +136,7 @@ LLParcel::LLParcel(const LLUUID &owner_id, // virtual LLParcel::~LLParcel() { - // user list cleaned up by LLDynamicArray destructor. + // user list cleaned up by std::vector destructor. } void LLParcel::init(const LLUUID &owner_id, @@ -470,8 +470,8 @@ BOOL LLParcel::importAccessEntry(std::istream& input_stream, LLAccessEntry* entr } else { - llwarns << "Unknown keyword in parcel access entry section: <" - << keyword << ">" << llendl; + LL_WARNS() << "Unknown keyword in parcel access entry section: <" + << keyword << ">" << LL_ENDL; } } return input_stream.good(); @@ -971,7 +971,7 @@ void LLParcel::startSale(const LLUUID& buyer_id, BOOL is_buyer_group) mGroupID.setNull(); } mSaleTimerExpires.start(); - mSaleTimerExpires.setTimerExpirySec(DEFAULT_USEC_SALE_TIMEOUT / SEC_TO_MICROSEC); + mSaleTimerExpires.setTimerExpirySec(U64Microseconds(DEFAULT_USEC_SALE_TIMEOUT)); mStatus = OS_LEASE_PENDING; mClaimDate = time(NULL); setAuctionID(0); @@ -1096,9 +1096,9 @@ void LLParcel::clearParcel() void LLParcel::dump() { - llinfos << "parcel " << mLocalID << " area " << mArea << llendl; - llinfos << " name <" << mName << ">" << llendl; - llinfos << " desc <" << mDesc << ">" << llendl; + LL_INFOS() << "parcel " << mLocalID << " area " << mArea << LL_ENDL; + LL_INFOS() << " name <" << mName << ">" << LL_ENDL; + LL_INFOS() << " desc <" << mDesc << ">" << LL_ENDL; } const std::string& ownership_status_to_string(LLParcel::EOwnershipStatus status) @@ -1178,7 +1178,7 @@ LLParcel::ECategory category_string_to_category(const std::string& s) return (LLParcel::ECategory)i; } } - llwarns << "Parcel category outside of possibilities " << s << llendl; + LL_WARNS() << "Parcel category outside of possibilities " << s << LL_ENDL; return LLParcel::C_NONE; } diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index 7e013de11a1b90f39d7c781619fe550433dbe250..e79b753514a874b49df8f22880154a40152109aa 100755 --- a/indra/llinventory/llpermissions.cpp +++ b/indra/llinventory/llpermissions.cpp @@ -31,7 +31,6 @@ // library includes #include "message.h" -#include "metapropertyt.h" #include "llsd.h" ///---------------------------------------------------------------------------- @@ -117,7 +116,7 @@ LLUUID LLPermissions::getSafeOwner() const } else { - llwarns << "LLPermissions::getSafeOwner() called with no valid owner!" << llendl; + LL_WARNS() << "LLPermissions::getSafeOwner() called with no valid owner!" << LL_ENDL; LLUUID unused_uuid; unused_uuid.generate(); @@ -666,7 +665,7 @@ BOOL LLPermissions::importFile(LLFILE* fp) } else { - llinfos << "unknown keyword " << keyword << " in permissions import" << llendl; + LL_INFOS() << "unknown keyword " << keyword << " in permissions import" << LL_ENDL; } } fix(); @@ -800,7 +799,7 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream) } else { - llinfos << "unknown keyword " << keyword << " in permissions import" << llendl; + LL_INFOS() << "unknown keyword " << keyword << " in permissions import" << LL_ENDL; } } fix(); @@ -895,21 +894,6 @@ std::ostream& operator<<(std::ostream &s, const LLPermissions &perm) return s; } -template <> -void LLMetaClassT<LLPermissions>::reflectProperties(LLMetaClass& meta_class) -{ - reflectProperty(meta_class, "mCreator", &LLPermissions::mCreator); - reflectProperty(meta_class, "mOwner", &LLPermissions::mOwner); - reflectProperty(meta_class, "mGroup", &LLPermissions::mGroup); - reflectProperty(meta_class, "mIsGroupOwned", &LLPermissions::mIsGroupOwned); -} - -// virtual -const LLMetaClass& LLPermissions::getMetaClass() const -{ - return LLMetaClassT<LLPermissions>::instance(); -} - ///---------------------------------------------------------------------------- /// Class LLAggregatePermissions ///---------------------------------------------------------------------------- @@ -997,8 +981,8 @@ void LLAggregatePermissions::aggregateBit(EPermIndex idx, BOOL allowed) mBits[idx] = allowed ? AP_ALL : AP_SOME; break; default: - llwarns << "Bad aggregateBit " << (S32)idx << " " - << (allowed ? "true" : "false") << llendl; + LL_WARNS() << "Bad aggregateBit " << (S32)idx << " " + << (allowed ? "true" : "false") << LL_ENDL; break; } } @@ -1042,8 +1026,8 @@ void LLAggregatePermissions::aggregateIndex(EPermIndex idx, U8 bits) } break; default: - llwarns << "Bad aggregate index " << (S32)idx << " " - << (S32)bits << llendl; + LL_WARNS() << "Bad aggregate index " << (S32)idx << " " + << (S32)bits << LL_ENDL; break; } } diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h index 3ecc922370a3f3873f644424b8d1854912a0a453..89c66f6ebdc83aa531ec8ee810cf7839957f4b7c 100755 --- a/indra/llinventory/llpermissions.h +++ b/indra/llinventory/llpermissions.h @@ -31,7 +31,6 @@ #include "llsd.h" #include "lluuid.h" #include "llxmlnode.h" -#include "reflective.h" #include "llinventorytype.h" // prototypes @@ -83,7 +82,7 @@ template<class T> class LLMetaClassT; // logical consistency. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLPermissions : public LLReflective +class LLPermissions { private: LLUUID mCreator; // null if object created by system @@ -324,9 +323,6 @@ class LLPermissions : public LLReflective friend std::ostream& operator<<(std::ostream &s, const LLPermissions &perm); - // Reflection. - friend class LLMetaClassT<LLPermissions>; - virtual const LLMetaClass& getMetaClass() const; }; // Inlines diff --git a/indra/llinventory/llsaleinfo.cpp b/indra/llinventory/llsaleinfo.cpp index dd408a8efea74ac755d698ecbbbadbb91c9233a3..63e34d188ea046d9af0c70b62df05eff49f46d31 100755 --- a/indra/llinventory/llsaleinfo.cpp +++ b/indra/llinventory/llsaleinfo.cpp @@ -179,14 +179,14 @@ BOOL LLSaleInfo::importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask) } else if (!strcmp("perm_mask", keyword)) { - //llinfos << "found deprecated keyword perm_mask" << llendl; + //LL_INFOS() << "found deprecated keyword perm_mask" << LL_ENDL; has_perm_mask = TRUE; sscanf(valuestr, "%x", &perm_mask); } else { - llwarns << "unknown keyword '" << keyword - << "' in sale info import" << llendl; + LL_WARNS() << "unknown keyword '" << keyword + << "' in sale info import" << LL_ENDL; } } return success; @@ -235,14 +235,14 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m } else if (!strcmp("perm_mask", keyword)) { - //llinfos << "found deprecated keyword perm_mask" << llendl; + //LL_INFOS() << "found deprecated keyword perm_mask" << LL_ENDL; has_perm_mask = TRUE; sscanf(valuestr, "%x", &perm_mask); } else { - llwarns << "unknown keyword '" << keyword - << "' in sale info import" << llendl; + LL_WARNS() << "unknown keyword '" << keyword + << "' in sale info import" << LL_ENDL; } } return success; diff --git a/indra/llinventory/lltransactionflags.cpp b/indra/llinventory/lltransactionflags.cpp index ee0e6ae26ca0a5c313b8376f6044497d127af9fb..e21f29df41f33abb4ccea9230f4454bac52c5509 100755 --- a/indra/llinventory/lltransactionflags.cpp +++ b/indra/llinventory/lltransactionflags.cpp @@ -92,11 +92,11 @@ std::string build_transfer_message_to_source( S32 transaction_type, const std::string& description) { - lldebugs << "build_transfer_message_to_source: " << amount << " " + LL_DEBUGS() << "build_transfer_message_to_source: " << amount << " " << source_id << " " << dest_id << " " << dest_name << " " << transaction_type << " " << (description.empty() ? "(no desc)" : description) - << llendl; + << LL_ENDL; if(source_id.isNull()) { return description; @@ -144,10 +144,10 @@ std::string build_transfer_message_to_destination( S32 transaction_type, const std::string& description) { - lldebugs << "build_transfer_message_to_dest: " << amount << " " + LL_DEBUGS() << "build_transfer_message_to_dest: " << amount << " " << dest_id << " " << source_id << " " << source_name << " " << transaction_type << " " << (description.empty() ? "(no desc)" : description) - << llendl; + << LL_ENDL; if(0 == amount) { return std::string(); diff --git a/indra/llinventory/tests/inventorymisc_test.cpp b/indra/llinventory/tests/inventorymisc_test.cpp index c9af7c4eac74527461a5e90a5ec003e46d7f4fc5..7b15552f24646d5be386f93471ffea8c829be067 100755 --- a/indra/llinventory/tests/inventorymisc_test.cpp +++ b/indra/llinventory/tests/inventorymisc_test.cpp @@ -153,7 +153,7 @@ namespace tut { LLPointer<LLInventoryItem> src = create_random_inventory_item(); LLSD sd = ll_create_sd_from_inventory_item(src); - //llinfos << "sd: " << *sd << llendl; + //LL_INFOS() << "sd: " << *sd << LL_ENDL; LLPointer<LLInventoryItem> dst = new LLInventoryItem; bool successful_parse = dst->fromLLSD(sd); ensure_equals("0.LLInventoryItem::fromLLSD()", successful_parse, true); @@ -219,7 +219,7 @@ namespace tut src->setCreationDate(new_creation); sd = ll_create_sd_from_inventory_item(src); - //llinfos << "sd: " << *sd << llendl; + //LL_INFOS() << "sd: " << *sd << LL_ENDL; successful_parse = dst->fromLLSD(sd); ensure_equals("13.item id::getUUID() failed", dst->getUUID(), src->getUUID()); ensure_equals("14.parent::getParentUUID() failed", dst->getParentUUID(), src->getParentUUID()); @@ -323,7 +323,7 @@ namespace tut LLFILE* fp = LLFile::fopen("linden_file.dat","w+"); if(!fp) { - llerrs << "file could not be opened\n" << llendl; + LL_ERRS() << "file could not be opened\n" << LL_ENDL; return; } @@ -335,7 +335,7 @@ namespace tut fp = LLFile::fopen("linden_file.dat","r+"); if(!fp) { - llerrs << "file could not be opened\n" << llendl; + LL_ERRS() << "file could not be opened\n" << LL_ENDL; return; } @@ -460,7 +460,7 @@ namespace tut LLFILE* fp = LLFile::fopen("linden_file.dat","w"); if(!fp) { - llerrs << "file coudnt be opened\n" << llendl; + LL_ERRS() << "file coudnt be opened\n" << LL_ENDL; return; } @@ -472,7 +472,7 @@ namespace tut fp = LLFile::fopen("linden_file.dat","r"); if(!fp) { - llerrs << "file coudnt be opened\n" << llendl; + LL_ERRS() << "file coudnt be opened\n" << LL_ENDL; return; } diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index 0c0a844b739f30abdf4431f34f3b1b4fe2046cef..6a8959517d8ede18f71b159c5dde9b696af585a9 100755 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -156,22 +156,22 @@ class LLKDUMessageError : public kdu_message void LLKDUMessageWarning::put_text(const char *s) { - llinfos << "KDU Warning: " << s << llendl; + LL_INFOS() << "KDU Warning: " << s << LL_ENDL; } void LLKDUMessageWarning::put_text(const kdu_uint16 *s) { - llinfos << "KDU Warning: " << s << llendl; + LL_INFOS() << "KDU Warning: " << s << LL_ENDL; } void LLKDUMessageError::put_text(const char *s) { - llinfos << "KDU Error: " << s << llendl; + LL_INFOS() << "KDU Error: " << s << LL_ENDL; } void LLKDUMessageError::put_text(const kdu_uint16 *s) { - llinfos << "KDU Error: " << s << llendl; + LL_INFOS() << "KDU Error: " << s << LL_ENDL; } void LLKDUMessageError::flush(bool end_of_message) @@ -290,7 +290,7 @@ void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, BOOL keep_codestream, ECod kdu_dims dims2; mCodeStreamp->get_dims(2,dims2); if ((dims1 != dims) || (dims2 != dims)) { - llerrs << "Components don't have matching dimensions!" << llendl; + LL_ERRS() << "Components don't have matching dimensions!" << LL_ENDL; } } @@ -393,7 +393,7 @@ BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco region_kdu->size.y = region[3] - region[1]; } int discard = (discard_level != -1 ? discard_level : base.getRawDiscardLevel()); - //llinfos << "Merov debug : initDecode, discard used = " << discard << ", asked = " << discard_level << llendl; + //LL_INFOS() << "Merov debug : initDecode, discard used = " << discard << ", asked = " << discard_level << LL_ENDL; // Apply loading restrictions mCodeStreamp->apply_input_restrictions( first_channel, max_channel_count, discard, 0, region_kdu); diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp index 62c245f125b78bafeee2dda6db0ea138e21fcdcf..3f627b65e1d63a03b6bf1b45a15effd921b59909 100755 --- a/indra/llkdu/tests/llimagej2ckdu_test.cpp +++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp @@ -43,7 +43,9 @@ // End Stubbing // ------------------------------------------------------------------------------------------- -// Stubb the LL Image Classes +// Stub the LL Image Classes +//LLTrace::MemStatHandle LLImageBase::sMemStat("LLImage"); + LLImageRaw::LLImageRaw() { } LLImageRaw::~LLImageRaw() { } U8* LLImageRaw::allocateData(S32 ) { return NULL; } @@ -52,7 +54,8 @@ U8* LLImageRaw::reallocateData(S32 ) { return NULL; } BOOL LLImageRaw::resize(U16, U16, S8) { return TRUE; } // this method always returns TRUE... LLImageBase::LLImageBase() -: mData(NULL), +: LLTrace::MemTrackable<LLImageBase>("LLImageBase"), +mData(NULL), mDataSize(0), mWidth(0), mHeight(0), diff --git a/indra/llmath/llcalc.cpp b/indra/llmath/llcalc.cpp index 1b2d609b67c5683992ecde495a2e9831169ed04a..edc6986cc91140b26bf3ff84db8757b597040d97 100755 --- a/indra/llmath/llcalc.cpp +++ b/indra/llmath/llcalc.cpp @@ -141,20 +141,20 @@ bool LLCalc::evalString(const std::string& expression, F32& result) try { info = parse(start, expr_upper.end(), calc, space_p); - lldebugs << "Math expression: " << expression << " = " << result << llendl; + LL_DEBUGS() << "Math expression: " << expression << " = " << result << LL_ENDL; } catch(parser_error<std::string, std::string::iterator> &e) { mLastErrorPos = e.where - expr_upper.begin(); - llinfos << "Calc parser exception: " << e.descriptor << " at " << mLastErrorPos << " in expression: " << expression << llendl; + LL_INFOS() << "Calc parser exception: " << e.descriptor << " at " << mLastErrorPos << " in expression: " << expression << LL_ENDL; return false; } if (!info.full) { mLastErrorPos = info.stop - expr_upper.begin(); - llinfos << "Unhandled syntax error at " << mLastErrorPos << " in expression: " << expression << llendl; + LL_INFOS() << "Unhandled syntax error at " << mLastErrorPos << " in expression: " << expression << LL_ENDL; return false; } diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h index e0ad270266eb2b742697344d4d25976f53f580b2..faa699ff7b609b862dfbeeeba288ef1b59e36b53 100755 --- a/indra/llmath/llcalcparser.h +++ b/indra/llmath/llcalcparser.h @@ -163,7 +163,7 @@ struct LLCalcParser : grammar<LLCalcParser> bool checkNaN(const F32& a) const { return !llisnan(a); } - //FIX* non ambigious function fix making SIN() work for calc -Cryogenic Blitz + //FIX* non ambiguous function fix making SIN() work for calc -Cryogenic Blitz F32 _sin(const F32& a) const { return sin(DEG_TO_RAD * a); } F32 _cos(const F32& a) const { return cos(DEG_TO_RAD * a); } F32 _tan(const F32& a) const { return tan(DEG_TO_RAD * a); } @@ -176,11 +176,8 @@ struct LLCalcParser : grammar<LLCalcParser> F32 _fabs(const F32& a) const { return fabs(a); } F32 _floor(const F32& a) const { return (F32)llfloor(a); } F32 _ceil(const F32& a) const { return llceil(a); } - F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); } - - LLCalc::calc_map_t* mConstants; LLCalc::calc_map_t* mVariables; // LLCalc::calc_map_t* mUserVariables; diff --git a/indra/llmath/llcamera.cpp b/indra/llmath/llcamera.cpp index 33cf185196ad59a496f2812e2cd9eb5bfd553e69..ff90532f75959303d0adc7134d28cc465f99a98a 100755 --- a/indra/llmath/llcamera.cpp +++ b/indra/llmath/llcamera.cpp @@ -183,8 +183,30 @@ static const LLVector4a sFrustumScaler[] = LLVector4a( 1, 1, 1) // 8 entries }; -S32 LLCamera::AABBInFrustum(const LLVector4a ¢er, const LLVector4a& radius) +bool LLCamera::isChanged() { + bool changed = false; + for (U32 i = 0; i < mPlaneCount; i++) + { + U8 mask = mPlaneMask[i]; + if (mask != 0xff && !changed) + { + changed = !mAgentPlanes[i].equal(mLastAgentPlanes[i]); + } + mLastAgentPlanes[i].set(mAgentPlanes[i]); + } + + return changed; +} + +S32 LLCamera::AABBInFrustum(const LLVector4a ¢er, const LLVector4a& radius, const LLPlane* planes) +{ + if(!planes) + { + //use agent space + planes = mAgentPlanes; + } + U8 mask = 0; bool result = false; LLVector4a rscale, maxp, minp; @@ -195,7 +217,7 @@ S32 LLCamera::AABBInFrustum(const LLVector4a ¢er, const LLVector4a& radius) mask = mPlaneMask[i]; if (mask < PLANE_MASK_NUM) { - const LLPlane& p(mAgentPlanes[i]); + const LLPlane& p(planes[i]); p.getAt<3>(d); rscale.setMul(radius, sFrustumScaler[mask]); minp.setSub(center, rscale); @@ -216,9 +238,21 @@ S32 LLCamera::AABBInFrustum(const LLVector4a ¢er, const LLVector4a& radius) return result?1:2; } +//exactly same as the function AABBInFrustum(...) +//except uses mRegionPlanes instead of mAgentPlanes. +S32 LLCamera::AABBInRegionFrustum(const LLVector4a& center, const LLVector4a& radius) +{ + return AABBInFrustum(center, radius, mRegionPlanes); +} -S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius) +S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes) { + if(!planes) + { + //use agent space + planes = mAgentPlanes; + } + U8 mask = 0; bool result = false; LLVector4a rscale, maxp, minp; @@ -229,7 +263,7 @@ S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& mask = mPlaneMask[i]; if ((i != 5) && (mask < PLANE_MASK_NUM)) { - const LLPlane& p(mAgentPlanes[i]); + const LLPlane& p(planes[i]); p.getAt<3>(d); rscale.setMul(radius, sFrustumScaler[mask]); minp.setSub(center, rscale); @@ -250,6 +284,13 @@ S32 LLCamera::AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& return result?1:2; } +//exactly same as the function AABBInFrustumNoFarClip(...) +//except uses mRegionPlanes instead of mAgentPlanes. +S32 LLCamera::AABBInRegionFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius) +{ + return AABBInFrustumNoFarClip(center, radius, mRegionPlanes); +} + int LLCamera::sphereInFrustumQuick(const LLVector3 &sphere_center, const F32 radius) { LLVector3 dist = sphere_center-mFrustCenter; @@ -586,6 +627,47 @@ void LLCamera::calcAgentFrustumPlanes(LLVector3* frust) } } +//calculate regional planes from mAgentPlanes. +//vector "shift" is the vector of the region origin in the agent space. +void LLCamera::calcRegionFrustumPlanes(const LLVector3& shift, F32 far_clip_distance) +{ + F32 far_w; + { + LLVector3 p = getOrigin(); + LLVector3 n(mAgentPlanes[5][0], mAgentPlanes[5][1], mAgentPlanes[5][2]); + F32 dd = n * p; + if(dd + mAgentPlanes[5][3] < 0) //signed distance + { + far_w = -far_clip_distance - dd; + } + else + { + far_w = far_clip_distance - dd; + } + far_w += n * shift; + } + + F32 d; + LLVector3 n; + for(S32 i = 0 ; i < 7; i++) + { + if (mPlaneMask[i] != 0xff) + { + n.setVec(mAgentPlanes[i][0], mAgentPlanes[i][1], mAgentPlanes[i][2]); + + if(i != 5) + { + d = mAgentPlanes[i][3] + n * shift; + } + else + { + d = far_w; + } + mRegionPlanes[i].setVec(n, d); + } + } +} + void LLCamera::calculateFrustumPlanes(F32 left, F32 right, F32 top, F32 bottom) { LLVector3 a, b, c; diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h index 1283cfb16b63aef6eeebf1570274157046c55e71..321b8ddcc43799d136716010cacd5a857ee27349 100755 --- a/indra/llmath/llcamera.h +++ b/indra/llmath/llcamera.h @@ -122,6 +122,8 @@ class LLCamera private: LL_ALIGN_16(LLPlane mAgentPlanes[AGENT_PLANE_USER_CLIP_NUM]); //frustum planes in agent space a la gluUnproject (I'm a bastard, I know) - DaveP + LL_ALIGN_16(LLPlane mRegionPlanes[AGENT_PLANE_USER_CLIP_NUM]); //frustum planes in a local region space, derived from mAgentPlanes + LL_ALIGN_16(LLPlane mLastAgentPlanes[AGENT_PLANE_USER_CLIP_NUM]); U8 mPlaneMask[PLANE_MASK_NUM]; // 8 for alignment F32 mView; // angle between top and bottom frustum planes in radians. @@ -150,6 +152,7 @@ class LLCamera LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_pixels, F32 near_plane, F32 far_plane); virtual ~LLCamera(); + bool isChanged(); //check if mAgentPlanes changed since last frame. void setUserClipPlane(LLPlane& plane); void disableUserClipPlane(); @@ -191,6 +194,7 @@ class LLCamera // Return number of bytes copied. size_t readFrustumFromBuffer(const char *buffer); void calcAgentFrustumPlanes(LLVector3* frust); + void calcRegionFrustumPlanes(const LLVector3& shift, F32 far_clip_distance); //calculate regional planes from mAgentPlanes. void ignoreAgentFrustumPlane(S32 idx); // Returns 1 if partly in, 2 if fully in. @@ -199,8 +203,10 @@ class LLCamera S32 sphereInFrustum(const LLVector3 ¢er, const F32 radius) const; S32 pointInFrustum(const LLVector3 &point) const { return sphereInFrustum(point, 0.0f); } S32 sphereInFrustumFull(const LLVector3 ¢er, const F32 radius) const { return sphereInFrustum(center, radius); } - S32 AABBInFrustum(const LLVector4a& center, const LLVector4a& radius); - S32 AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius); + S32 AABBInFrustum(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = NULL); + S32 AABBInRegionFrustum(const LLVector4a& center, const LLVector4a& radius); + S32 AABBInFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius, const LLPlane* planes = NULL); + S32 AABBInRegionFrustumNoFarClip(const LLVector4a& center, const LLVector4a& radius); //does a quick 'n dirty sphere-sphere check S32 sphereInFrustumQuick(const LLVector3 &sphere_center, const F32 radius); diff --git a/indra/llmath/llcoordframe.cpp b/indra/llmath/llcoordframe.cpp index 7dd8e43185e9c736a8da2f516c2737dc3eaae99d..1bf51ca0eb2e0a8ebbce0780a8493629bdf871e5 100755 --- a/indra/llmath/llcoordframe.cpp +++ b/indra/llmath/llcoordframe.cpp @@ -59,7 +59,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin) : if( !mOrigin.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL; } } @@ -71,7 +71,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin, const LLVector3 &direction) if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL; } } @@ -86,7 +86,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &x_axis, if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL; } } @@ -102,7 +102,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin, if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL; } } @@ -117,7 +117,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin, if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL; } } @@ -132,7 +132,7 @@ LLCoordFrame::LLCoordFrame(const LLQuaternion &q) : if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL; } } @@ -147,7 +147,7 @@ LLCoordFrame::LLCoordFrame(const LLVector3 &origin, const LLQuaternion &q) : if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL; } } @@ -160,7 +160,7 @@ LLCoordFrame::LLCoordFrame(const LLMatrix4 &mat) : if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL; } } @@ -176,7 +176,7 @@ LLCoordFrame::LLCoordFrame(const F32 *origin, const F32 *rotation) : if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL; } } */ @@ -191,7 +191,7 @@ LLCoordFrame::LLCoordFrame(const F32 *origin_and_rotation) : if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::LLCoordFrame()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::LLCoordFrame()" << LL_ENDL; } } */ @@ -220,7 +220,7 @@ void LLCoordFrame::setOrigin(F32 x, F32 y, F32 z) if( !mOrigin.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::setOrigin()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL; } } @@ -230,7 +230,7 @@ void LLCoordFrame::setOrigin(const LLVector3 &new_origin) if( !mOrigin.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::setOrigin()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL; } } @@ -243,7 +243,7 @@ void LLCoordFrame::setOrigin(const F32 *origin) if( !mOrigin.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::setOrigin()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL; } } @@ -254,7 +254,7 @@ void LLCoordFrame::setOrigin(const LLCoordFrame &frame) if( !mOrigin.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::setOrigin()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::setOrigin()" << LL_ENDL; } } @@ -271,7 +271,7 @@ void LLCoordFrame::setAxes(const LLVector3 &x_axis, if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL; } } @@ -284,7 +284,7 @@ void LLCoordFrame::setAxes(const LLMatrix3 &rotation_matrix) if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL; } } @@ -296,7 +296,7 @@ void LLCoordFrame::setAxes(const LLQuaternion &q ) if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL; } } @@ -316,7 +316,7 @@ void LLCoordFrame::setAxes( const F32 *rotation_matrix ) if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL; } } @@ -330,7 +330,7 @@ void LLCoordFrame::setAxes(const LLCoordFrame &frame) if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::setAxes()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::setAxes()" << LL_ENDL; } } @@ -346,7 +346,7 @@ void LLCoordFrame::translate(F32 x, F32 y, F32 z) if( !mOrigin.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::translate()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::translate()" << LL_ENDL; } } @@ -358,7 +358,7 @@ void LLCoordFrame::translate(const LLVector3 &v) if( !mOrigin.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::translate()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::translate()" << LL_ENDL; } } @@ -372,7 +372,7 @@ void LLCoordFrame::translate(const F32 *origin) if( !mOrigin.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::translate()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::translate()" << LL_ENDL; } } @@ -409,7 +409,7 @@ void LLCoordFrame::rotate(const LLMatrix3 &rotation_matrix) if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::rotate()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::rotate()" << LL_ENDL; } } @@ -423,7 +423,7 @@ void LLCoordFrame::roll(F32 angle) if( !mYAxis.isFinite() || !mZAxis.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::roll()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::roll()" << LL_ENDL; } } @@ -436,7 +436,7 @@ void LLCoordFrame::pitch(F32 angle) if( !mXAxis.isFinite() || !mZAxis.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::pitch()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::pitch()" << LL_ENDL; } } @@ -449,7 +449,7 @@ void LLCoordFrame::yaw(F32 angle) if( !mXAxis.isFinite() || !mYAxis.isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::yaw()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::yaw()" << LL_ENDL; } } @@ -509,7 +509,7 @@ size_t LLCoordFrame::readOrientation(const char *buffer) if( !isFinite() ) { reset(); - llwarns << "Non Finite in LLCoordFrame::readOrientation()" << llendl; + LL_WARNS() << "Non Finite in LLCoordFrame::readOrientation()" << LL_ENDL; } return 12*sizeof(F32); diff --git a/indra/llmath/llline.cpp b/indra/llmath/llline.cpp index ef10d1e7facf7ba1027dba5b2ea18deb6fa408db..f26231840b0ce5a2415101ae6c5b079aea4a2a31 100755 --- a/indra/llmath/llline.cpp +++ b/indra/llmath/llline.cpp @@ -82,10 +82,10 @@ LLVector3 LLLine::nearestApproach( const LLLine& other_line ) const if ( one_minus_dir_dot_dir < SOME_VERY_SMALL_NUMBER ) { #ifdef LL_DEBUG - llwarns << "LLLine::nearestApproach() was given two very " + LL_WARNS() << "LLLine::nearestApproach() was given two very " << "nearly parallel lines dir1 = " << mDirection << " dir2 = " << other_line.mDirection << " with 1-dot_product = " - << one_minus_dir_dot_dir << llendl; + << one_minus_dir_dot_dir << LL_ENDL; #endif // the lines are approximately parallel // We shouldn't fall in here because this check should have been made diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index b93f89d674fce1c4a916d36ff199842e0256ce0f..29db799154d8b704ac1f79cd9576d9a29bcf61f7 100755 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -30,6 +30,7 @@ #include <cmath> #include <cstdlib> #include <vector> +#include <limits> #include "lldefs.h" //#include "llstl.h" // *TODO: Remove when LLString is gone //#include "llstring.h" // *TODO: Remove when LLString is gone @@ -75,6 +76,8 @@ const F32 OO_SQRT2 = 0.7071067811865475244008443621049f; const F32 DEG_TO_RAD = 0.017453292519943295769236907684886f; const F32 RAD_TO_DEG = 57.295779513082320876798154814105f; const F32 F_APPROXIMATELY_ZERO = 0.00001f; +const F32 F_LN10 = 2.3025850929940456840179914546844f; +const F32 OO_LN10 = 0.43429448190325182765112891891661; const F32 F_LN2 = 0.69314718056f; const F32 OO_LN2 = 1.4426950408889634073599246810019f; @@ -111,6 +114,12 @@ inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < // WARNING: Infinity is comparable with F32_MAX and negative // infinity is comparable with F32_MIN +// handles negative and positive zeros +inline bool is_zero(F32 x) +{ + return (*(U32*)(&x) & 0x7fffffff) == 0; +} + inline bool is_approx_equal(F32 x, F32 y) { const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02; diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 7348904c6165d8f987aa34a116cfb24c8843c4d3..02220c41d80c0348d11b741295875eddeeabb99d 100755 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -265,12 +265,12 @@ class LLOctreeNode : public LLTreeNode<T> if (child->getOctant() != i) { - llerrs << "Invalid child map, bad octant data." << llendl; + LL_ERRS() << "Invalid child map, bad octant data." << LL_ENDL; } if (getOctant(child->getCenter()) != child->getOctant()) { - llerrs << "Invalid child octant compared to position data." << llendl; + LL_ERRS() << "Invalid child octant compared to position data." << LL_ENDL; } } } @@ -311,7 +311,7 @@ class LLOctreeNode : public LLTreeNode<T> { if (data == NULL || data->getBinIndex() != -1) { - OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE BRANCH !!!" << llendl; + OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE BRANCH !!!" << LL_ENDL; return false; } LLOctreeNode<T>* parent = getOctParent(); @@ -374,7 +374,7 @@ class LLOctreeNode : public LLTreeNode<T> if (getChildCount() == 8) { //this really isn't possible, something bad has happened - OCT_ERRS << "Octree detected floating point error and gave up." << llendl; + OCT_ERRS << "Octree detected floating point error and gave up." << LL_ENDL; return false; } @@ -383,7 +383,7 @@ class LLOctreeNode : public LLTreeNode<T> { if (mChild[i]->getCenter().equals3(center)) { - OCT_ERRS << "Octree detected duplicate child center and gave up." << llendl; + OCT_ERRS << "Octree detected duplicate child center and gave up." << LL_ENDL; return false; } } @@ -399,7 +399,7 @@ class LLOctreeNode : public LLTreeNode<T> else { //it's not in here, give it to the root - OCT_ERRS << "Octree insertion failed, starting over from root!" << llendl; + OCT_ERRS << "Octree insertion failed, starting over from root!" << LL_ENDL; oct_node* node = this; @@ -483,7 +483,7 @@ class LLOctreeNode : public LLTreeNode<T> } //node is now root - llwarns << "!!! OCTREE REMOVING ELEMENT BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl; + LL_WARNS() << "!!! OCTREE REMOVING ELEMENT BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << LL_ENDL; node->removeByAddress(data); llassert(data->getBinIndex() == -1); return true; @@ -496,7 +496,7 @@ class LLOctreeNode : public LLTreeNode<T> if (mData[i] == data) { //we have data _remove(data, i); - llwarns << "FOUND!" << llendl; + LL_WARNS() << "FOUND!" << LL_ENDL; return; } } @@ -524,7 +524,7 @@ class LLOctreeNode : public LLTreeNode<T> mChild[i]->validate(); if (mChild[i]->getParent() != this) { - llerrs << "Octree child has invalid parent." << llendl; + LL_ERRS() << "Octree child has invalid parent." << LL_ENDL; } } #endif @@ -550,24 +550,24 @@ class LLOctreeNode : public LLTreeNode<T> if (child->getSize().equals3(getSize())) { - OCT_ERRS << "Child size is same as parent size!" << llendl; + OCT_ERRS << "Child size is same as parent size!" << LL_ENDL; } for (U32 i = 0; i < getChildCount(); i++) { if(!mChild[i]->getSize().equals3(child->getSize())) { - OCT_ERRS <<"Invalid octree child size." << llendl; + OCT_ERRS <<"Invalid octree child size." << LL_ENDL; } if (mChild[i]->getCenter().equals3(child->getCenter())) { - OCT_ERRS <<"Duplicate octree child position." << llendl; + OCT_ERRS <<"Duplicate octree child position." << LL_ENDL; } } if (mChild.size() >= 8) { - OCT_ERRS <<"Octree node has too many children... why?" << llendl; + OCT_ERRS <<"Octree node has too many children... why?" << LL_ENDL; } #endif @@ -641,7 +641,7 @@ class LLOctreeNode : public LLTreeNode<T> } } - OCT_ERRS << "Octree failed to delete requested child." << llendl; + OCT_ERRS << "Octree failed to delete requested child." << LL_ENDL; } protected: @@ -724,13 +724,13 @@ class LLOctreeRoot : public LLOctreeNode<T> { if (data == NULL) { - OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE ROOT !!!" << llendl; + OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE ROOT !!!" << LL_ENDL; return false; } if (data->getBinRadius() > 4096.0) { - OCT_ERRS << "!!! ELEMENT EXCEEDS MAXIMUM SIZE IN OCTREE ROOT !!!" << llendl; + OCT_ERRS << "!!! ELEMENT EXCEEDS MAXIMUM SIZE IN OCTREE ROOT !!!" << LL_ENDL; return false; } @@ -746,7 +746,7 @@ class LLOctreeRoot : public LLOctreeNode<T> if (lt != 0x7) { - //OCT_ERRS << "!!! ELEMENT EXCEEDS RANGE OF SPATIAL PARTITION !!!" << llendl; + //OCT_ERRS << "!!! ELEMENT EXCEEDS RANGE OF SPATIAL PARTITION !!!" << LL_ENDL; return false; } diff --git a/indra/llmath/llplane.h b/indra/llmath/llplane.h index 3c32441b11875f9503c7de564ccb7f85e346a081..64a3eed0e53eac073bacac36907ca12101ca22ce 100755 --- a/indra/llmath/llplane.h +++ b/indra/llmath/llplane.h @@ -93,7 +93,13 @@ class LLPlane { return mV.greaterEqual(LLVector4a::getZero()).getGatheredBits() & LLVector4Logical::MASK_XYZ; } - + + //check if two planes are nearly same + bool equal(const LLPlane& p) const + { + return mV.equals4(p.mV); + } + private: LLVector4a mV; } LL_ALIGN_POSTFIX(16); diff --git a/indra/llmath/lltreenode.h b/indra/llmath/lltreenode.h index c66bc26176130730e5da24c4cc0d0eb1e04ffe4e..0b479c4564fe6aa4946e87400b83e9985a5650d6 100755 --- a/indra/llmath/lltreenode.h +++ b/indra/llmath/lltreenode.h @@ -57,7 +57,14 @@ class LLTreeNode virtual bool remove(T* data); virtual void notifyRemoval(T* data); virtual U32 getListenerCount() { return mListeners.size(); } - virtual LLTreeListener<T>* getListener(U32 index) const { return mListeners[index]; } + virtual LLTreeListener<T>* getListener(U32 index) const + { + if(index < mListeners.size()) + { + return mListeners[index]; + } + return NULL; + } virtual void addListener(LLTreeListener<T>* listener) { mListeners.push_back(listener); } protected: diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index cc5742ff7adba0b150dfadf10d6a72627c2d1332..d9a68cb577a33c8b75247b0d3d9c261034cd0da5 100755 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -44,7 +44,6 @@ #include "m3math.h" #include "llmatrix3a.h" #include "lloctree.h" -#include "lldarray.h" #include "llvolume.h" #include "llvolumeoctree.h" #include "llstl.h" @@ -427,7 +426,7 @@ class LLVolumeOctreeRebound : public LLOctreeTravelerDepthFirst<LLVolumeTriangle } else { - llerrs << "Empty leaf" << llendl; + LL_ERRS() << "Empty leaf" << LL_ENDL; } for (S32 i = 0; i < branch->getChildCount(); ++i) @@ -834,7 +833,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai if (detail < MIN_LOD) { - llinfos << "Generating profile with LOD < MIN_LOD. CLAMPING" << llendl; + LL_INFOS() << "Generating profile with LOD < MIN_LOD. CLAMPING" << LL_ENDL; detail = MIN_LOD; } @@ -850,7 +849,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai // Quick validation to eliminate some server crashes. if (begin > end - 0.01f) { - llwarns << "LLProfile::generate() assertion failed (begin >= end)" << llendl; + LL_WARNS() << "LLProfile::generate() assertion failed (begin >= end)" << LL_ENDL; return FALSE; } @@ -1071,7 +1070,7 @@ BOOL LLProfile::generate(const LLProfileParams& params, BOOL path_open,F32 detai } break; default: - llerrs << "Unknown profile: getCurveType()=" << params.getCurveType() << llendl; + LL_ERRS() << "Unknown profile: getCurveType()=" << params.getCurveType() << LL_ENDL; break; }; @@ -1153,7 +1152,7 @@ BOOL LLProfileParams::importFile(LLFILE *fp) } else { - llwarns << "unknown keyword " << keyword << " in profile import" << llendl; + LL_WARNS() << "unknown keyword " << keyword << " in profile import" << LL_ENDL; } } @@ -1225,7 +1224,7 @@ BOOL LLProfileParams::importLegacyStream(std::istream& input_stream) } else { - llwarns << "unknown keyword " << keyword << " in profile import" << llendl; + LL_WARNS() << "unknown keyword " << keyword << " in profile import" << LL_ENDL; } } @@ -1547,7 +1546,7 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, if (detail < MIN_LOD) { - llinfos << "Generating path with LOD < MIN! Clamping to 1" << llendl; + LL_INFOS() << "Generating path with LOD < MIN! Clamping to 1" << LL_ENDL; detail = MIN_LOD; } @@ -1649,7 +1648,7 @@ BOOL LLPath::generate(const LLPathParams& params, F32 detail, S32 split, F32 t = (F32)i * mStep; mPath[i].mPos.set(0, lerp(0, -sin(F_PI*params.getTwist()*t)*0.5f,t), - lerp(-0.5, cos(F_PI*params.getTwist()*t)*0.5f,t)); + lerp(-0.5f, cos(F_PI*params.getTwist()*t)*0.5f,t)); mPath[i].mScale.set(lerp(1,params.getScale().mV[0],t), lerp(1,params.getScale().mV[1],t), 0,1); mPath[i].mTexT = t; @@ -1809,7 +1808,7 @@ BOOL LLPathParams::importFile(LLFILE *fp) } else { - llwarns << "unknown keyword " << " in path import" << llendl; + LL_WARNS() << "unknown keyword " << " in path import" << LL_ENDL; } } return TRUE; @@ -1949,7 +1948,7 @@ BOOL LLPathParams::importLegacyStream(std::istream& input_stream) } else { - llwarns << "unknown keyword " << " in path import" << llendl; + LL_WARNS() << "unknown keyword " << " in path import" << LL_ENDL; } } return TRUE; @@ -2040,7 +2039,7 @@ LLProfile::~LLProfile() { if(profile_delete_lock) { - llerrs << "LLProfile should not be deleted here!" << llendl ; + LL_ERRS() << "LLProfile should not be deleted here!" << LL_ENDL ; } } @@ -2087,6 +2086,7 @@ void LLVolume::resizePath(S32 length) { mPathp->resizePath(length); mVolumeFaces.clear(); + setDirty(); } void LLVolume::regen() @@ -2375,7 +2375,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) LLSD mdl; if (!unzip_llsd(mdl, is, size)) { - LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD, will probably fetch from sim again." << llendl; + LL_DEBUGS("MeshStreaming") << "Failed to unzip LLSD blob for LoD, will probably fetch from sim again." << LL_ENDL; return false; } @@ -2384,7 +2384,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) if (face_count == 0) { //no faces unpacked, treat as failed decode - llwarns << "found no faces!" << llendl; + LL_WARNS() << "found no faces!" << LL_ENDL; return false; } @@ -2417,7 +2417,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) if (idx.empty() || face.mNumIndices < 3) { //why is there an empty index list? - llwarns <<"Empty face present!" << llendl; + LL_WARNS() <<"Empty face present!" << LL_ENDL; continue; } @@ -2564,7 +2564,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) if (cur_vertex != num_verts || idx != weights.size()) { - llwarns << "Vertex weight count does not match vertex count!" << llendl; + LL_WARNS() << "Vertex weight count does not match vertex count!" << LL_ENDL; } } @@ -2730,7 +2730,7 @@ void LLVolume::createVolumeFaces() vf.mNumS = face.mCount; if (vf.mNumS < 0) { - llerrs << "Volume face corruption detected." << llendl; + LL_ERRS() << "Volume face corruption detected." << LL_ENDL; } vf.mBeginT = 0; @@ -2778,7 +2778,7 @@ void LLVolume::createVolumeFaces() vf.mNumS = vf.mNumS*2; if (vf.mNumS < 0) { - llerrs << "Volume face corruption detected." << llendl; + LL_ERRS() << "Volume face corruption detected." << LL_ENDL; } } } @@ -3107,7 +3107,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, // weird crash bug - DEV-11158 - trying to collect more data: if ((sizeS == 0) || (sizeT == 0)) { - llwarns << "sculpt bad mesh size " << sizeS << " " << sizeT << llendl; + LL_WARNS() << "sculpt bad mesh size " << sizeS << " " << sizeT << LL_ENDL; } sNumMeshPoints -= mMesh.size(); @@ -3502,16 +3502,16 @@ bool LLVolumeParams::setType(U8 profile, U8 path) // Bad profile. Make it square. profile = LL_PCODE_PROFILE_SQUARE; result = false; - llwarns << "LLVolumeParams::setType changing bad profile type (" << profile_type - << ") to be LL_PCODE_PROFILE_SQUARE" << llendl; + LL_WARNS() << "LLVolumeParams::setType changing bad profile type (" << profile_type + << ") to be LL_PCODE_PROFILE_SQUARE" << LL_ENDL; } else if (hole_type > LL_PCODE_HOLE_MAX) { // Bad hole. Make it the same. profile = profile_type; result = false; - llwarns << "LLVolumeParams::setType changing bad hole type (" << hole_type - << ") to be LL_PCODE_HOLE_SAME" << llendl; + LL_WARNS() << "LLVolumeParams::setType changing bad hole type (" << hole_type + << ") to be LL_PCODE_HOLE_SAME" << LL_ENDL; } if (path_type < LL_PCODE_PATH_MIN || @@ -3519,8 +3519,8 @@ bool LLVolumeParams::setType(U8 profile, U8 path) { // Bad path. Make it linear. result = false; - llwarns << "LLVolumeParams::setType changing bad path (" << path - << ") to be LL_PCODE_PATH_LINE" << llendl; + LL_WARNS() << "LLVolumeParams::setType changing bad path (" << path + << ") to be LL_PCODE_PATH_LINE" << LL_ENDL; path = LL_PCODE_PATH_LINE; } @@ -4112,7 +4112,7 @@ BOOL equalTriangle(const S32 *a, const S32 *b) BOOL LLVolumeParams::importFile(LLFILE *fp) { - //llinfos << "importing volume" << llendl; + //LL_INFOS() << "importing volume" << LL_ENDL; const S32 BUFSIZE = 16384; char buffer[BUFSIZE]; /* Flawfinder: ignore */ // *NOTE: changing the size or type of this buffer will require @@ -4146,7 +4146,7 @@ BOOL LLVolumeParams::importFile(LLFILE *fp) } else { - llwarns << "unknown keyword " << keyword << " in volume import" << llendl; + LL_WARNS() << "unknown keyword " << keyword << " in volume import" << LL_ENDL; } } @@ -4166,7 +4166,7 @@ BOOL LLVolumeParams::exportFile(LLFILE *fp) const BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream) { - //llinfos << "importing volume" << llendl; + //LL_INFOS() << "importing volume" << LL_ENDL; const S32 BUFSIZE = 16384; // *NOTE: changing the size or type of this buffer will require // changing the sscanf below. @@ -4196,7 +4196,7 @@ BOOL LLVolumeParams::importLegacyStream(std::istream& input_stream) } else { - llwarns << "unknown keyword " << keyword << " in volume import" << llendl; + LL_WARNS() << "unknown keyword " << keyword << " in volume import" << LL_ENDL; } } @@ -4408,7 +4408,7 @@ LLFaceID LLVolume::generateFaceMask() } break; default: - llerrs << "Unknown profile!" << llendl; + LL_ERRS() << "Unknown profile!" << LL_ENDL; break; } @@ -4669,7 +4669,7 @@ LLVolumeFace::~LLVolumeFace() void LLVolumeFace::freeData() { - ll_aligned_free(mPositions); + ll_aligned_free<64>(mPositions); mPositions = NULL; //normals and texture coordinates are part of the same buffer as mPositions, do not free them separately @@ -4707,7 +4707,7 @@ BOOL LLVolumeFace::create(LLVolume* volume, BOOL partial_build) } else { - llerrs << "Unknown/uninitialized face type!" << llendl; + LL_ERRS() << "Unknown/uninitialized face type!" << LL_ENDL; } return ret ; @@ -5247,7 +5247,7 @@ void LLVolumeFace::cacheOptimize() //allocate space for new buffer S32 num_verts = mNumVertices; S32 size = ((num_verts*sizeof(LLVector2)) + 0xF) & ~0xF; - LLVector4a* pos = (LLVector4a*) ll_aligned_malloc(sizeof(LLVector4a)*2*num_verts+size, 64); + LLVector4a* pos = (LLVector4a*) ll_aligned_malloc<64>(sizeof(LLVector4a)*2*num_verts+size); LLVector4a* norm = pos + num_verts; LLVector2* tc = (LLVector2*) (norm + num_verts); @@ -5297,7 +5297,7 @@ void LLVolumeFace::cacheOptimize() mIndices[i] = new_idx[mIndices[i]]; } - ll_aligned_free(mPositions); + ll_aligned_free<64>(mPositions); // DO NOT free mNormals and mTexCoords as they are part of mPositions buffer ll_aligned_free_16(mWeights); ll_aligned_free_16(mTangents); @@ -5309,7 +5309,7 @@ void LLVolumeFace::cacheOptimize() mTangents = binorm; //std::string result = llformat("ACMR pre/post: %.3f/%.3f -- %d triangles %d breaks", pre_acmr, post_acmr, mNumIndices/3, breaks); - //llinfos << result << llendl; + //LL_INFOS() << result << LL_ENDL; } @@ -6025,7 +6025,7 @@ void LLVolumeFace::createTangents() void LLVolumeFace::resizeVertices(S32 num_verts) { - ll_aligned_free(mPositions); + ll_aligned_free<64>(mPositions); //DO NOT free mNormals and mTexCoords as they are part of mPositions buffer ll_aligned_free_16(mTangents); @@ -6036,7 +6036,7 @@ void LLVolumeFace::resizeVertices(S32 num_verts) //pad texture coordinate block end to allow for QWORD reads S32 size = ((num_verts*sizeof(LLVector2)) + 0xF) & ~0xF; - mPositions = (LLVector4a*) ll_aligned_malloc(sizeof(LLVector4a)*2*num_verts+size, 64); + mPositions = (LLVector4a*) ll_aligned_malloc<64>(sizeof(LLVector4a)*2*num_verts+size); mNormals = mPositions+num_verts; mTexCoords = (LLVector2*) (mNormals+num_verts); @@ -6076,7 +6076,7 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con LLVector4a* old_buf = mPositions; - mPositions = (LLVector4a*) ll_aligned_malloc(new_size, 64); + mPositions = (LLVector4a*) ll_aligned_malloc<64>(new_size); mNormals = mPositions+new_verts; mTexCoords = (LLVector2*) (mNormals+new_verts); @@ -6092,7 +6092,7 @@ void LLVolumeFace::pushVertex(const LLVector4a& pos, const LLVector4a& norm, con //just clear tangents ll_aligned_free_16(mTangents); mTangents = NULL; - ll_aligned_free(old_buf); + ll_aligned_free<64>(old_buf); mNumAllocatedVertices = new_verts; @@ -6177,12 +6177,12 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat if (new_count > 65536) { - llerrs << "Cannot append face -- 16-bit overflow will occur." << llendl; + LL_ERRS() << "Cannot append face -- 16-bit overflow will occur." << LL_ENDL; } if (face.mNumVertices == 0) { - llerrs << "Cannot append empty face." << llendl; + LL_ERRS() << "Cannot append empty face." << LL_ENDL; } U32 old_vsize = mNumVertices*16; @@ -6193,7 +6193,7 @@ void LLVolumeFace::appendFace(const LLVolumeFace& face, LLMatrix4& mat_in, LLMat //allocate new buffer space LLVector4a* old_buf = mPositions; - mPositions = (LLVector4a*) ll_aligned_malloc(new_size, 64); + mPositions = (LLVector4a*) ll_aligned_malloc<64>(new_size); mNormals = mPositions + new_count; mTexCoords = (LLVector2*) (mNormals+new_count); diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 975227ea58108c35020c189a50a6acc0a95208ac..2f38ae7203386ae5ef6cd9b48cba05a1545296b2 100755 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -41,7 +41,6 @@ class LLVolumeFace; class LLVolume; class LLVolumeTriangle; -#include "lldarray.h" #include "lluuid.h" #include "v4color.h" //#include "vmath.h" diff --git a/indra/llmath/llvolumemgr.cpp b/indra/llmath/llvolumemgr.cpp index 9083273ee547a5c5fe713598a953ac16c15068b6..3b8f08e0c6cc125557849211e76a4118951dafec 100755 --- a/indra/llmath/llvolumemgr.cpp +++ b/indra/llmath/llvolumemgr.cpp @@ -147,7 +147,7 @@ void LLVolumeMgr::unrefVolume(LLVolume *volumep) volume_lod_group_map_t::iterator iter = mVolumeLODGroups.find(params); if( iter == mVolumeLODGroups.end() ) { - llerrs << "Warning! Tried to cleanup unknown volume type! " << *params << llendl; + LL_ERRS() << "Warning! Tried to cleanup unknown volume type! " << *params << LL_ENDL; if (mDataMutex) { mDataMutex->unlock(); @@ -207,7 +207,7 @@ void LLVolumeMgr::dump() { mDataMutex->unlock(); } - llinfos << "Average usage of LODs " << avg << llendl; + LL_INFOS() << "Average usage of LODs " << avg << LL_ENDL; } void LLVolumeMgr::useMutex() @@ -270,18 +270,18 @@ bool LLVolumeLODGroup::cleanupRefs() bool res = true; if (mRefs != 0) { - llwarns << "Volume group has remaining refs:" << getNumRefs() << llendl; + LL_WARNS() << "Volume group has remaining refs:" << getNumRefs() << LL_ENDL; mRefs = 0; for (S32 i = 0; i < NUM_LODS; i++) { if (mLODRefs[i] > 0) { - llwarns << " LOD " << i << " refs = " << mLODRefs[i] << llendl; + LL_WARNS() << " LOD " << i << " refs = " << mLODRefs[i] << LL_ENDL; mLODRefs[i] = 0; mVolumeLODs[i] = NULL; } } - llwarns << *getVolumeParams() << llendl; + LL_WARNS() << *getVolumeParams() << LL_ENDL; res = false; } return res; @@ -320,7 +320,7 @@ BOOL LLVolumeLODGroup::derefLOD(LLVolume *volumep) return TRUE; } } - llerrs << "Deref of non-matching LOD in volume LOD group" << llendl; + LL_ERRS() << "Deref of non-matching LOD in volume LOD group" << LL_ENDL; return FALSE; } @@ -393,7 +393,7 @@ F32 LLVolumeLODGroup::dump() std::string dump_str = llformat("%.3f %d %d %d %d", usage, mAccessCount[0], mAccessCount[1], mAccessCount[2], mAccessCount[3]); - llinfos << dump_str << llendl; + LL_INFOS() << dump_str << LL_ENDL; return usage; } diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index 0728b49c1fd3c345afac128028ad036e22454962..fb232d5f6cf1f60602c3e702b4fc47203bedb981 100755 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -237,7 +237,7 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch) if (!test_min.equals3(min, 0.001f) || !test_max.equals3(max, 0.001f)) { - llerrs << "Bad bounding box data found." << llendl; + LL_ERRS() << "Bad bounding box data found." << LL_ENDL; } test_min.sub(LLVector4a(0.001f)); @@ -251,7 +251,7 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch) if (child->mExtents[0].lessThan(test_min).areAnySet(LLVector4Logical::MASK_XYZ) || child->mExtents[1].greaterThan(test_max).areAnySet(LLVector4Logical::MASK_XYZ)) { - llerrs << "Child protrudes from bounding box." << llendl; + LL_ERRS() << "Child protrudes from bounding box." << LL_ENDL; } } @@ -267,7 +267,7 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch) if (tri->mV[i]->greaterThan(test_max).areAnySet(LLVector4Logical::MASK_XYZ) || tri->mV[i]->lessThan(test_min).areAnySet(LLVector4Logical::MASK_XYZ)) { - llerrs << "Triangle protrudes from node." << llendl; + LL_ERRS() << "Triangle protrudes from node." << LL_ENDL; } } } diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h index 80d6ced36db8333799148a7a9de3ca971a886869..13150028d8253b6dfc15c3e88a282018450e4b89 100755 --- a/indra/llmath/llvolumeoctree.h +++ b/indra/llmath/llvolumeoctree.h @@ -59,7 +59,7 @@ class LLVolumeTriangle : public LLRefCount const LLVolumeTriangle& operator=(const LLVolumeTriangle& rhs) { - llerrs << "Illegal operation!" << llendl; + LL_ERRS() << "Illegal operation!" << LL_ENDL; return *this; } @@ -110,7 +110,7 @@ class LLVolumeOctreeListener : public LLOctreeListener<LLVolumeTriangle> const LLVolumeOctreeListener& operator=(const LLVolumeOctreeListener& rhs) { - llerrs << "Illegal operation!" << llendl; + LL_ERRS() << "Illegal operation!" << LL_ENDL; return *this; } diff --git a/indra/llmath/v4color.cpp b/indra/llmath/v4color.cpp index 81ac62be567ce5f7e7a4c8c811eb1fc171f36838..cd2be7c8fdf7c363782448f715bd96f9d4cb2fe0 100755 --- a/indra/llmath/v4color.cpp +++ b/indra/llmath/v4color.cpp @@ -245,7 +245,7 @@ void LLColor4::setValue(const LLSD& sd) if (out_of_range) { - llwarns << "LLSD color value out of range!" << llendl; + LL_WARNS() << "LLSD color value out of range!" << LL_ENDL; } #else mV[0] = (F32) sd[0].asReal(); @@ -417,7 +417,7 @@ BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color) if (token_iter == tokens.end()) { // This is a malformed vector. - llwarns << "LLColor4::parseColor() malformed color " << buf << llendl; + LL_WARNS() << "LLColor4::parseColor() malformed color " << buf << LL_ENDL; } else { @@ -704,7 +704,7 @@ BOOL LLColor4::parseColor(const std::string& buf, LLColor4* color) } else { - llwarns << "invalid color " << color_name << llendl; + LL_WARNS() << "invalid color " << color_name << LL_ENDL; } } diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h index 8c8c3158087429239b1ad50501da01344f1122b8..0d632f59be3a180851c0339bf4841f94a4c86c35 100755 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -49,10 +49,10 @@ class LLColor4 LLColor4(); // Initializes LLColor4 to (0, 0, 0, 1) LLColor4(F32 r, F32 g, F32 b); // Initializes LLColor4 to (r, g, b, 1) LLColor4(F32 r, F32 g, F32 b, F32 a); // Initializes LLColor4 to (r. g, b, a) - LLColor4(U32 clr); // Initializes LLColor4 to (r=clr>>24, etc)) - LLColor4(const F32 *vec); // Initializes LLColor4 to (vec[0]. vec[1], vec[2], vec[3]) LLColor4(const LLColor3 &vec, F32 a = 1.f); // Initializes LLColor4 to (vec, a) explicit LLColor4(const LLSD& sd); + explicit LLColor4(const F32 *vec); // Initializes LLColor4 to (vec[0]. vec[1], vec[2], 1) + explicit LLColor4(U32 clr); // Initializes LLColor4 to (r=clr>>24, etc)) explicit LLColor4(const LLColor4U& color4u); // "explicit" to avoid automatic conversion explicit LLColor4(const LLVector4& vector4); // "explicit" to avoid automatic conversion diff --git a/indra/llmath/xform.cpp b/indra/llmath/xform.cpp index b75aec6a274038208ba5d4be507d2f9351750bcc..5d8b93d5e8ff3f7f020596b258b7fa271472ba6e 100755 --- a/indra/llmath/xform.cpp +++ b/indra/llmath/xform.cpp @@ -36,10 +36,10 @@ LLXform::~LLXform() { } -// Link optimization - don't inline these llwarns +// Link optimization - don't inline these LL_WARNS() void LLXform::warn(const char* const msg) { - llwarns << msg << llendl; + LL_WARNS() << msg << LL_ENDL; } LLXform* LLXform::getRoot() const diff --git a/indra/llmath/xform.h b/indra/llmath/xform.h index 1b50749b3e07d5646d98d9a427e875c4e9f4c09a..54b0f6d9ec2aba3eae6e9d960659af55daffcd2d 100755 --- a/indra/llmath/xform.h +++ b/indra/llmath/xform.h @@ -103,9 +103,9 @@ class LLXform inline void setRotation(const F32 x, const F32 y, const F32 z, const F32 s); // Above functions must be inline for speed, but also - // need to emit warnings. llwarns causes inline LLError::CallSite + // need to emit warnings. LL_WARNS() causes inline LLError::CallSite // static objects that make more work for the linker. - // Avoid inline llwarns by calling this function. + // Avoid inline LL_WARNS() by calling this function. void warn(const char* const msg); void setChanged(const U32 bits) { mChanged |= bits; } diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index d193e367eb61fe7631d7c5b265eadf623d71e480..ca48e613d27d93dbbc364adfdba79bd5485d02e0 100755 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -27,6 +27,7 @@ set(llmessage_SOURCE_FILES llares.cpp llareslistener.cpp llassetstorage.cpp + llavatarname.cpp llavatarnamecache.cpp llblowfishcipher.cpp llbuffer.cpp @@ -114,6 +115,7 @@ set(llmessage_HEADER_FILES llares.h llareslistener.h llassetstorage.h + llavatarname.h llavatarnamecache.h llblowfishcipher.h llbuffer.h @@ -128,6 +130,7 @@ set(llmessage_HEADER_FILES lldbstrings.h lldispatcher.h lleventflags.h + llextendedstatus.h llfiltersd2xmlrpc.h llfollowcamparams.h llhost.h diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp index 7f74247a137d141450345c2e2da9d70f9e08af51..81e28121fd906e445b2fee380c25128b9265599b 100755 --- a/indra/llmessage/llares.cpp +++ b/indra/llmessage/llares.cpp @@ -55,13 +55,13 @@ LLAres::HostResponder::~HostResponder() void LLAres::HostResponder::hostResult(const hostent *ent) { - llinfos << "LLAres::HostResponder::hostResult not implemented" << llendl; + LL_INFOS() << "LLAres::HostResponder::hostResult not implemented" << LL_ENDL; } void LLAres::HostResponder::hostError(int code) { - llinfos << "LLAres::HostResponder::hostError " << code << ": " - << LLAres::strerror(code) << llendl; + LL_INFOS() << "LLAres::HostResponder::hostError " << code << ": " + << LLAres::strerror(code) << LL_ENDL; } LLAres::NameInfoResponder::~NameInfoResponder() @@ -71,14 +71,14 @@ LLAres::NameInfoResponder::~NameInfoResponder() void LLAres::NameInfoResponder::nameInfoResult(const char *node, const char *service) { - llinfos << "LLAres::NameInfoResponder::nameInfoResult not implemented" - << llendl; + LL_INFOS() << "LLAres::NameInfoResponder::nameInfoResult not implemented" + << LL_ENDL; } void LLAres::NameInfoResponder::nameInfoError(int code) { - llinfos << "LLAres::NameInfoResponder::nameInfoError " << code << ": " - << LLAres::strerror(code) << llendl; + LL_INFOS() << "LLAres::NameInfoResponder::nameInfoError " << code << ": " + << LLAres::strerror(code) << LL_ENDL; } LLAres::QueryResponder::~QueryResponder() @@ -87,14 +87,14 @@ LLAres::QueryResponder::~QueryResponder() void LLAres::QueryResponder::queryResult(const char *buf, size_t len) { - llinfos << "LLAres::QueryResponder::queryResult not implemented" - << llendl; + LL_INFOS() << "LLAres::QueryResponder::queryResult not implemented" + << LL_ENDL; } void LLAres::QueryResponder::queryError(int code) { - llinfos << "LLAres::QueryResponder::queryError " << code << ": " - << LLAres::strerror(code) << llendl; + LL_INFOS() << "LLAres::QueryResponder::queryError " << code << ": " + << LLAres::strerror(code) << LL_ENDL; } LLAres::LLAres() : @@ -104,7 +104,7 @@ LLAres::LLAres() : if (ares_library_init( ARES_LIB_INIT_ALL ) != ARES_SUCCESS || ares_init(&chan_) != ARES_SUCCESS) { - llwarns << "Could not succesfully initialize ares!" << llendl; + LL_WARNS() << "Could not succesfully initialize ares!" << LL_ENDL; return; } @@ -176,7 +176,7 @@ void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp) return; } - //llinfos << "LLAres::rewriteURI (" << uri << ") search: '" << "_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName() << "'" << llendl; + //LL_INFOS() << "LLAres::rewriteURI (" << uri << ") search: '" << "_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName() << "'" << LL_ENDL; search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(), RES_SRV, resp); @@ -251,8 +251,8 @@ int LLQueryResponder::parseRR(const char *buf, size_t len, const char *&pos, r = new LLSrvRecord(rrname, rrttl); break; default: - llinfos << "LLQueryResponder::parseRR got unknown RR type " << rrtype - << llendl; + LL_INFOS() << "LLQueryResponder::parseRR got unknown RR type " << rrtype + << LL_ENDL; return ARES_EBADRESP; } @@ -333,7 +333,7 @@ void LLQueryResponder::queryResult(const char *buf, size_t len) mType = (LLResType) t; break; default: - llinfos << "Cannot grok query type " << t << llendl; + LL_INFOS() << "Cannot grok query type " << t << LL_ENDL; ret = ARES_EBADQUERY; goto bail; } @@ -373,7 +373,7 @@ void LLQueryResponder::queryResult(const char *buf, size_t len) void LLQueryResponder::querySuccess() { - llinfos << "LLQueryResponder::queryResult not implemented" << llendl; + LL_INFOS() << "LLQueryResponder::queryResult not implemented" << LL_ENDL; } void LLAres::SrvResponder::querySuccess() @@ -393,23 +393,23 @@ void LLAres::SrvResponder::queryError(int code) void LLAres::SrvResponder::srvResult(const dns_rrs_t &ents) { - llinfos << "LLAres::SrvResponder::srvResult not implemented" << llendl; + LL_INFOS() << "LLAres::SrvResponder::srvResult not implemented" << LL_ENDL; for (size_t i = 0; i < ents.size(); i++) { const LLSrvRecord *s = (const LLSrvRecord *) ents[i].get(); - llinfos << "[" << i << "] " << s->host() << ":" << s->port() + LL_INFOS() << "[" << i << "] " << s->host() << ":" << s->port() << " priority " << s->priority() << " weight " << s->weight() - << llendl; + << LL_ENDL; } } void LLAres::SrvResponder::srvError(int code) { - llinfos << "LLAres::SrvResponder::srvError " << code << ": " - << LLAres::strerror(code) << llendl; + LL_INFOS() << "LLAres::SrvResponder::srvError " << code << ": " + << LLAres::strerror(code) << LL_ENDL; } static void nameinfo_callback_1_5(void *arg, int status, int timeouts, @@ -820,11 +820,11 @@ void LLAres::UriRewriteResponder::querySuccess() void LLAres::UriRewriteResponder::rewriteResult( const std::vector<std::string> &uris) { - llinfos << "LLAres::UriRewriteResponder::rewriteResult not implemented" - << llendl; + LL_INFOS() << "LLAres::UriRewriteResponder::rewriteResult not implemented" + << LL_ENDL; for (size_t i = 0; i < uris.size(); i++) { - llinfos << "[" << i << "] " << uris[i] << llendl; + LL_INFOS() << "[" << i << "] " << uris[i] << LL_ENDL; } } diff --git a/indra/llmessage/llareslistener.cpp b/indra/llmessage/llareslistener.cpp index 0a4effac19a36920a15872cf49558dead47a1587..3d65906b980ba80d7394f4ef4e6f496c8890e012 100755 --- a/indra/llmessage/llareslistener.cpp +++ b/indra/llmessage/llareslistener.cpp @@ -99,6 +99,6 @@ void LLAresListener::rewriteURI(const LLSD& data) } else { - llinfos << "LLAresListener::rewriteURI requested without Ares present. Ignoring: " << data << llendl; + LL_INFOS() << "LLAresListener::rewriteURI requested without Ares present. Ignoring: " << data << LL_ENDL; } } diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index 9b86daebe5d93441a6541c8f47be17bd3356518f..8ba2535531ec86fb85559b84c8939160ce8c491f 100755 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -50,10 +50,14 @@ #include "lltransfertargetvfile.h" // For debugging #include "llmetrics.h" +#include "lltrace.h" LLAssetStorage *gAssetStorage = NULL; LLMetrics *LLAssetStorage::metric_recipient = NULL; +static LLTrace::CountStatHandle<> sFailedDownloadCount("faileddownloads", "Number of times LLAssetStorage::getAssetData() has failed"); + + const LLUUID CATEGORIZE_LOST_AND_FOUND_ID(std::string("00000000-0000-0000-0000-000000000010")); const U64 TOXIC_ASSET_LIFETIME = (120 * 1000000); // microseconds @@ -149,8 +153,8 @@ void LLAssetInfo::setFromNameValue( const LLNameValue& nv ) setName( buf ); buf.assign( str, pos2, std::string::npos ); setDescription( buf ); - LL_DEBUGS("AssetStorage") << "uuid: " << mUuid << llendl; - LL_DEBUGS("AssetStorage") << "creator: " << mCreatorID << llendl; + LL_DEBUGS("AssetStorage") << "uuid: " << mUuid << LL_ENDL; + LL_DEBUGS("AssetStorage") << "creator: " << mCreatorID << LL_ENDL; } ///---------------------------------------------------------------------------- @@ -190,8 +194,8 @@ LLSD LLAssetRequest::getTerseDetails() const sd["asset_id"] = getUUID(); sd["type_long"] = LLAssetType::lookupHumanReadable(getType()); sd["type"] = LLAssetType::lookup(getType()); - sd["time"] = mTime; - time_t timestamp = (time_t) mTime; + sd["time"] = mTime.value(); + time_t timestamp = (time_t) mTime.value(); std::ostringstream time_string; time_string << ctime(×tamp); sd["time_string"] = time_string.str(); @@ -337,7 +341,7 @@ void LLAssetStorage::checkForTimeouts() void LLAssetStorage::_cleanupRequests(BOOL all, S32 error) { - F64 mt_secs = LLMessageSystem::getMessageTimeSeconds(); + F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds(); request_list_t timed_out; S32 rt; @@ -356,10 +360,10 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error) || ((RT_DOWNLOAD == rt) && LL_ASSET_STORAGE_TIMEOUT < (mt_secs - tmp->mTime))) { - llwarns << "Asset " << getRequestName((ERequestType)rt) << " request " + LL_WARNS() << "Asset " << getRequestName((ERequestType)rt) << " request " << (all ? "aborted" : "timed out") << " for " << tmp->getUUID() << "." - << LLAssetType::lookup(tmp->getType()) << llendl; + << LLAssetType::lookup(tmp->getType()) << LL_ENDL; timed_out.push_front(tmp); iter = requests->erase(curiter); @@ -401,7 +405,7 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse if (user_data) { // The *user_data should not be passed without a callback to clean it up. - llassert(callback != NULL) + llassert(callback != NULL); } BOOL exists = mStaticVFS->getExists(uuid, type); @@ -420,8 +424,8 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse } else { - llwarns << "Asset vfile " << uuid << ":" << type - << " found in static cache with bad size " << file.getSize() << ", ignoring" << llendl; + LL_WARNS() << "Asset vfile " << uuid << ":" << type + << " found in static cache with bad size " << file.getSize() << ", ignoring" << LL_ENDL; } } return false; @@ -434,22 +438,23 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse // IW - uuid is passed by value to avoid side effects, please don't re-add & void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LLGetAssetCallback callback, void *user_data, BOOL is_priority) { - LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl; + LL_DEBUGS("AssetStorage") << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << LL_ENDL; - LL_DEBUGS("AssetStorage") << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << LL_ENDL; if (user_data) { // The *user_data should not be passed without a callback to clean it up. - llassert(callback != NULL) + llassert(callback != NULL); } if (mShutDown) { - LL_DEBUGS("AssetStorage") << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_TRACE cancelled " << uuid << " type " << LLAssetType::lookup(type) << " shutting down" << LL_ENDL; if (callback) { + add(sFailedDownloadCount, 1); callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_FAILED, LL_EXSTAT_NONE); } return; @@ -460,6 +465,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL // Special case early out for NULL uuid and for shutting down if (callback) { + add(sFailedDownloadCount, 1); callback(mVFS, uuid, type, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID); } return; @@ -468,7 +474,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL // Try static VFS first. if (findInStaticVFSAndInvokeCallback(uuid,type,callback,user_data)) { - LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in static VFS" << LL_ENDL; return; } @@ -486,13 +492,13 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED); } - LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << uuid << " found in VFS" << LL_ENDL; } else { if (exists) { - llwarns << "Asset vfile " << uuid << ":" << type << " found with bad size " << file.getSize() << ", removing" << llendl; + LL_WARNS() << "Asset vfile " << uuid << ":" << type << " found with bad size " << file.getSize() << ", removing" << LL_ENDL; file.remove(); } @@ -508,8 +514,8 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL if (callback == tmp->mDownCallback && user_data == tmp->mUserData) { // this is a duplicate from the same subsystem - throw it away - llwarns << "Discarding duplicate request for asset " << uuid - << "." << LLAssetType::lookup(type) << llendl; + LL_WARNS() << "Discarding duplicate request for asset " << uuid + << "." << LLAssetType::lookup(type) << LL_ENDL; return; } @@ -521,7 +527,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL if (duplicate) { LL_DEBUGS("AssetStorage") << "Adding additional non-duplicate request for asset " << uuid - << "." << LLAssetType::lookup(type) << llendl; + << "." << LLAssetType::lookup(type) << LL_ENDL; } // This can be overridden by subclasses @@ -561,7 +567,7 @@ void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType at tpvf.setAsset(uuid, atype); tpvf.setCallback(downloadCompleteCallback, req); - //llinfos << "Starting transfer for " << uuid << llendl; + //LL_INFOS() << "Starting transfer for " << uuid << LL_ENDL; LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET); ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f)); } @@ -569,9 +575,10 @@ void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType at else { // uh-oh, we shouldn't have gotten here - llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl; + LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL; if (callback) { + add(sFailedDownloadCount, 1); callback(mVFS, uuid, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM); } } @@ -584,20 +591,20 @@ void LLAssetStorage::downloadCompleteCallback( LLAssetType::EType file_type, void* user_data, LLExtStat ext_status) { - LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << LL_ENDL; LL_DEBUGS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback() for " << file_id - << "," << LLAssetType::lookup(file_type) << llendl; + << "," << LLAssetType::lookup(file_type) << LL_ENDL; LLAssetRequest* req = (LLAssetRequest*)user_data; if(!req) { - llwarns << "LLAssetStorage::downloadCompleteCallback called without" - "a valid request." << llendl; + LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without" + "a valid request." << LL_ENDL; return; } if (!gAssetStorage) { - llwarns << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << llendl; + LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL; return; } @@ -620,7 +627,7 @@ void LLAssetStorage::downloadCompleteCallback( LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType()); if (vfile.getSize() <= 0) { - llwarns << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << llendl; + LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << LL_ENDL; result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE; vfile.remove(); @@ -649,6 +656,10 @@ void LLAssetStorage::downloadCompleteCallback( LLAssetRequest* tmp = *curiter; if (tmp->mDownCallback) { + if (result != LL_ERR_NOERR) + { + add(sFailedDownloadCount, 1); + } tmp->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), tmp->mUserData, result, ext_status); } delete tmp; @@ -659,7 +670,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype, LLGetAssetCallback callback, void *user_data, BOOL is_priority) { - lldebugs << "LLAssetStorage::getEstateAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << ", estatetype " << etype << llendl; + LL_DEBUGS() << "LLAssetStorage::getEstateAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << ", estatetype " << etype << LL_ENDL; // // Probably will get rid of this early out? @@ -669,6 +680,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen // Special case early out for NULL uuid if (callback) { + add(sFailedDownloadCount, 1); callback(mVFS, asset_id, atype, user_data, LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE, LL_EXSTAT_NULL_UUID); } return; @@ -698,7 +710,7 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen { if (exists) { - llwarns << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << llendl; + LL_WARNS() << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL; file.remove(); } @@ -731,16 +743,17 @@ void LLAssetStorage::getEstateAsset(const LLHost &object_sim, const LLUUID &agen tpvf.setAsset(asset_id, atype); tpvf.setCallback(downloadEstateAssetCompleteCallback, req); - LL_DEBUGS("AssetStorage") << "Starting transfer for " << asset_id << llendl; + LL_DEBUGS("AssetStorage") << "Starting transfer for " << asset_id << LL_ENDL; LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET); ttcp->requestTransfer(spe, tpvf, 100.f + (is_priority ? 1.f : 0.f)); } else { // uh-oh, we shouldn't have gotten here - llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl; + LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL; if (callback) { + add(sFailedDownloadCount, 1); callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM); } } @@ -757,14 +770,14 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback( LLEstateAssetRequest *req = (LLEstateAssetRequest*)user_data; if(!req) { - llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" - " without a valid request." << llendl; + LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called" + " without a valid request." << LL_ENDL; return; } if (!gAssetStorage) { - llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" - " without any asset system, aborting!" << llendl; + LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called" + " without any asset system, aborting!" << LL_ENDL; return; } @@ -776,13 +789,17 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback( LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType()); if (vfile.getSize() <= 0) { - llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl; + LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL; result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE; vfile.remove(); } } + if (result != LL_ERR_NOERR) + { + add(sFailedDownloadCount, 1); + } req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getAType(), req->mUserData, result, ext_status); } @@ -791,7 +808,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age const LLUUID &asset_id, LLAssetType::EType atype, LLGetAssetCallback callback, void *user_data, BOOL is_priority) { - lldebugs << "LLAssetStorage::getInvItemAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << llendl; + LL_DEBUGS() << "LLAssetStorage::getInvItemAsset() - " << asset_id << "," << LLAssetType::lookup(atype) << LL_ENDL; // // Probably will get rid of this early out? @@ -822,7 +839,7 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age size = exists ? file.getSize() : 0; if(exists && size < 1) { - llwarns << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << llendl; + LL_WARNS() << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL; file.remove(); } @@ -873,16 +890,17 @@ void LLAssetStorage::getInvItemAsset(const LLHost &object_sim, const LLUUID &age LL_DEBUGS("AssetStorage") << "Starting transfer for inventory asset " << item_id << " owned by " << owner_id << "," << task_id - << llendl; + << LL_ENDL; LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(source_host, LLTCT_ASSET); ttcp->requestTransfer(spi, tpvf, 100.f + (is_priority ? 1.f : 0.f)); } else { // uh-oh, we shouldn't have gotten here - llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl; + LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL; if (callback) { + add(sFailedDownloadCount, 1); callback(mVFS, asset_id, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM); } } @@ -900,13 +918,13 @@ void LLAssetStorage::downloadInvItemCompleteCallback( LLInvItemRequest *req = (LLInvItemRequest*)user_data; if(!req) { - llwarns << "LLAssetStorage::downloadEstateAssetCompleteCallback called" - " without a valid request." << llendl; + LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called" + " without a valid request." << LL_ENDL; return; } if (!gAssetStorage) { - llwarns << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << llendl; + LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL; return; } @@ -918,13 +936,17 @@ void LLAssetStorage::downloadInvItemCompleteCallback( LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType()); if (vfile.getSize() <= 0) { - llwarns << "downloadCompleteCallback has non-existent or zero-size asset!" << llendl; + LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL; result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE; vfile.remove(); } } + if (result != LL_ERR_NOERR) + { + add(sFailedDownloadCount, 1); + } req->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), req->mUserData, result, ext_status); } @@ -937,7 +959,7 @@ void LLAssetStorage::uploadCompleteCallback(const LLUUID& uuid, void *user_data, { if (!gAssetStorage) { - llwarns << "LLAssetStorage::uploadCompleteCallback has no gAssetStorage!" << llendl; + LL_WARNS() << "LLAssetStorage::uploadCompleteCallback has no gAssetStorage!" << LL_ENDL; return; } LLAssetRequest *req = (LLAssetRequest *)user_data; @@ -945,7 +967,7 @@ void LLAssetStorage::uploadCompleteCallback(const LLUUID& uuid, void *user_data, if (result) { - llwarns << "LLAssetStorage::uploadCompleteCallback " << result << ":" << getErrorString(result) << " trying to upload file to upstream provider" << llendl; + LL_WARNS() << "LLAssetStorage::uploadCompleteCallback " << result << ":" << getErrorString(result) << " trying to upload file to upstream provider" << LL_ENDL; success = FALSE; } @@ -1027,7 +1049,7 @@ LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStorage::E case RT_LOCALUPLOAD: return &mPendingLocalUploads; default: - llwarns << "Unable to find request list for request type '" << rt << "'" << llendl; + LL_WARNS() << "Unable to find request list for request type '" << rt << "'" << LL_ENDL; return NULL; } } @@ -1043,7 +1065,7 @@ const LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStor case RT_LOCALUPLOAD: return &mPendingLocalUploads; default: - llwarns << "Unable to find request list for request type '" << rt << "'" << llendl; + LL_WARNS() << "Unable to find request list for request type '" << rt << "'" << LL_ENDL; return NULL; } } @@ -1060,7 +1082,7 @@ std::string LLAssetStorage::getRequestName(LLAssetStorage::ERequestType rt) case RT_LOCALUPLOAD: return "localupload"; default: - llwarns << "Unable to find request name for request type '" << rt << "'" << llendl; + LL_WARNS() << "Unable to find request name for request type '" << rt << "'" << LL_ENDL; return ""; } } @@ -1213,7 +1235,7 @@ bool LLAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, { LL_DEBUGS("AssetStorage") << "Asset " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) - << " removed from pending queue." << llendl; + << " removed from pending queue." << LL_ENDL; return true; } return false; @@ -1237,6 +1259,7 @@ bool LLAssetStorage::deletePendingRequestImpl(LLAssetStorage::request_list_t* re } if (req->mDownCallback) { + add(sFailedDownloadCount, 1); req->mDownCallback(mVFS, req->getUUID(), req->getType(), req->mUserData, error, LL_EXSTAT_REQUEST_DROPPED); } if (req->mInfoCallback) @@ -1307,7 +1330,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo user_data == ((LLLegacyAssetRequest *)tmp->mUserData)->mUserData) { // this is a duplicate from the same subsystem - throw it away - LL_DEBUGS("AssetStorage") << "Discarding duplicate request for UUID " << uuid << llendl; + LL_DEBUGS("AssetStorage") << "Discarding duplicate request for UUID " << uuid << LL_ENDL; return; } } @@ -1363,6 +1386,10 @@ void LLAssetStorage::legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAss } } + if (status != LL_ERR_NOERR) + { + add(sFailedDownloadCount, 1); + } legacy->mDownCallback(filename.c_str(), uuid, legacy->mUserData, status, ext_status); delete legacy; } @@ -1378,9 +1405,9 @@ void LLAssetStorage::storeAssetData( bool is_priority, bool store_local, bool user_waiting, - F64 timeout) + F64Seconds timeout) { - llwarns << "storeAssetData: wrong version called" << llendl; + LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL; // LLAssetStorage metric: Virtual base call reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 1" ); } @@ -1397,9 +1424,9 @@ void LLAssetStorage::storeAssetData( bool store_local, const LLUUID& requesting_agent_id, bool user_waiting, - F64 timeout) + F64Seconds timeout) { - llwarns << "storeAssetData: wrong version called" << llendl; + LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL; // LLAssetStorage metric: Virtual base call reportMetric( asset_id, asset_type, LLStringUtil::null, requesting_agent_id, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 2" ); } @@ -1415,9 +1442,9 @@ void LLAssetStorage::storeAssetData( bool temp_file, bool is_priority, bool user_waiting, - F64 timeout) + F64Seconds timeout) { - llwarns << "storeAssetData: wrong version called" << llendl; + LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL; // LLAssetStorage metric: Virtual base call reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 3" ); } @@ -1433,9 +1460,9 @@ void LLAssetStorage::storeAssetData( bool temp_file, bool is_priority, bool user_waiting, - F64 timeout) + F64Seconds timeout) { - llwarns << "storeAssetData: wrong version called" << llendl; + LL_WARNS() << "storeAssetData: wrong version called" << LL_ENDL; // LLAssetStorage metric: Virtual base call reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_BAD_FUNCTION, __FILE__, __LINE__, "Illegal call to base: LLAssetStorage::storeAssetData 4" ); } @@ -1490,7 +1517,7 @@ void LLAssetStorage::reportMetric( const LLUUID& asset_id, const LLAssetType::ET { if( !metric_recipient ) { - LL_DEBUGS("AssetStorage") << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << llendl; + LL_DEBUGS("AssetStorage") << "Couldn't store LLAssetStoreage::reportMetric - no metrics_recipient" << LL_ENDL; return; } diff --git a/indra/llmessage/llassetstorage.h b/indra/llmessage/llassetstorage.h index 563ff9e07794c00cb34bd86d60de97b280c719f0..1bb4acea9ea1608c9800e61475c7bc3691210fb1 100755 --- a/indra/llmessage/llassetstorage.h +++ b/indra/llmessage/llassetstorage.h @@ -34,11 +34,11 @@ #include "lltimer.h" #include "llnamevalue.h" #include "llhost.h" -#include "stdenums.h" // for EDragAndDropType #include "lltransfermanager.h" // For LLTSCode enum #include "llassettype.h" #include "llstring.h" #include "llextendedstatus.h" +#include "llxfer.h" // Forward declarations class LLMessageSystem; @@ -49,7 +49,16 @@ class LLSD; // anything that takes longer than this to download will abort. // HTTP Uploads also timeout if they take longer than this. -const F32 LL_ASSET_STORAGE_TIMEOUT = 5 * 60.0f; +const F32Minutes LL_ASSET_STORAGE_TIMEOUT(5); + + +// Specific error codes +const int LL_ERR_ASSET_REQUEST_FAILED = -1; +//const int LL_ERR_ASSET_REQUEST_INVALID = -2; +const int LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE = -3; +const int LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE = -4; +const int LL_ERR_INSUFFICIENT_PERMISSIONS = -5; +const int LL_ERR_PRICE_MISMATCH = -23018; class LLAssetInfo { @@ -94,7 +103,7 @@ class LLAssetRequest void setUUID(const LLUUID& id) { mUUID = id; } void setType(LLAssetType::EType type) { mType = type; } - void setTimeout (F64 timeout) { mTimeout = timeout; } + void setTimeout (F64Seconds timeout) { mTimeout = timeout; } protected: LLUUID mUUID; @@ -110,8 +119,8 @@ class LLAssetRequest BOOL mIsTemp; BOOL mIsLocal; BOOL mIsUserWaiting; // We don't want to try forever if a user is waiting for a result. - F64 mTime; // Message system time - F64 mTimeout; // Amount of time before timing out. + F64Seconds mTime; // Message system time + F64Seconds mTimeout; // Amount of time before timing out. BOOL mIsPriority; BOOL mDataSentInFirstPacket; BOOL mDataIsInVFS; @@ -154,7 +163,7 @@ class LLInvItemRequest void *mUserData; LLHost mHost; BOOL mIsTemp; - F64 mTime; // Message system time + F64Seconds mTime; // Message system time BOOL mIsPriority; BOOL mDataSentInFirstPacket; BOOL mDataIsInVFS; @@ -184,7 +193,7 @@ class LLEstateAssetRequest void *mUserData; LLHost mHost; BOOL mIsTemp; - F64 mTime; // Message system time + F64Seconds mTime; // Message system time BOOL mIsPriority; BOOL mDataSentInFirstPacket; BOOL mDataIsInVFS; @@ -270,7 +279,7 @@ class LLAssetStorage : public LLTempAssetStorage bool is_priority = false, bool store_local = false, bool user_waiting= false, - F64 timeout=LL_ASSET_STORAGE_TIMEOUT); + F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); /* * AssetID version @@ -286,7 +295,7 @@ class LLAssetStorage : public LLTempAssetStorage bool store_local = false, const LLUUID& requesting_agent_id = LLUUID::null, bool user_waiting= false, - F64 timeout=LL_ASSET_STORAGE_TIMEOUT); + F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); virtual void checkForTimeouts(); @@ -394,7 +403,7 @@ class LLAssetStorage : public LLTempAssetStorage bool temp_file = false, bool is_priority = false, bool user_waiting = false, - F64 timeout = LL_ASSET_STORAGE_TIMEOUT); + F64Seconds timeout = LL_ASSET_STORAGE_TIMEOUT); /* * TransactionID version @@ -408,7 +417,7 @@ class LLAssetStorage : public LLTempAssetStorage bool temp_file = false, bool is_priority = false, bool user_waiting = false, - F64 timeout = LL_ASSET_STORAGE_TIMEOUT); + F64Seconds timeout = LL_ASSET_STORAGE_TIMEOUT); static void legacyGetDataCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType, void *user_data, S32 status, LLExtStat ext_status); static void legacyStoreDataCallback(const LLUUID &uuid, void *user_data, S32 status, LLExtStat ext_status); diff --git a/indra/llcommon/llavatarname.cpp b/indra/llmessage/llavatarname.cpp old mode 100755 new mode 100644 similarity index 100% rename from indra/llcommon/llavatarname.cpp rename to indra/llmessage/llavatarname.cpp diff --git a/indra/llcommon/llavatarname.h b/indra/llmessage/llavatarname.h old mode 100755 new mode 100644 similarity index 100% rename from indra/llcommon/llavatarname.h rename to indra/llmessage/llavatarname.h diff --git a/indra/llmessage/llblowfishcipher.cpp b/indra/llmessage/llblowfishcipher.cpp index 88aaf7c52ad0ba7c2a9e28eb07a6acd3a344129f..0b5025a422530ca9d73798d16cd2fa09b4c75030 100755 --- a/indra/llmessage/llblowfishcipher.cpp +++ b/indra/llmessage/llblowfishcipher.cpp @@ -70,10 +70,10 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) int blocksize = EVP_CIPHER_CTX_block_size(&context); int keylen = EVP_CIPHER_CTX_key_length(&context); int iv_length = EVP_CIPHER_CTX_iv_length(&context); - lldebugs << "LLBlowfishCipher blocksize " << blocksize + LL_DEBUGS() << "LLBlowfishCipher blocksize " << blocksize << " keylen " << keylen << " iv_len " << iv_length - << llendl; + << LL_ENDL; int output_len = 0; int temp_len = 0; @@ -83,7 +83,7 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) src, src_len)) { - llwarns << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << llendl; + LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << LL_ENDL; goto ERROR; } @@ -91,7 +91,7 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) // not an exact multiple of the block size. if (!EVP_EncryptFinal_ex(&context, (unsigned char*)(dst + output_len), &temp_len)) { - llwarns << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << llendl; + LL_WARNS() << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << LL_ENDL; goto ERROR; } output_len += temp_len; @@ -107,7 +107,7 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) // virtual U32 LLBlowfishCipher::decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) { - llerrs << "LLBlowfishCipher decrypt unsupported" << llendl; + LL_ERRS() << "LLBlowfishCipher decrypt unsupported" << LL_ENDL; return 0; } diff --git a/indra/llmessage/llbuffer.cpp b/indra/llmessage/llbuffer.cpp index aaa49d2ed64fc9dc0cf51bd3b1106ff86747af40..d07d9980c38bd662190a55dea03b41a6eaa3ed4f 100755 --- a/indra/llmessage/llbuffer.cpp +++ b/indra/llmessage/llbuffer.cpp @@ -32,8 +32,9 @@ #include "llmath.h" #include "llstl.h" #include "llthread.h" +#include <iterator> -#define ASSERT_LLBUFFERARRAY_MUTEX_LOCKED llassert(!mMutexp || mMutexp->isSelfLocked()); +#define ASSERT_LLBUFFERARRAY_MUTEX_LOCKED() llassert(!mMutexp || mMutexp->isSelfLocked()) /** * LLSegment @@ -180,8 +181,8 @@ bool LLHeapBuffer::reclaimSegment(const LLSegment& segment) } else if(mReclaimedBytes > mSize) { - llwarns << "LLHeapBuffer reclaimed more memory than allocated." - << " This is probably programmer error." << llendl; + LL_WARNS() << "LLHeapBuffer reclaimed more memory than allocated." + << " This is probably programmer error." << LL_ENDL; } return true; } @@ -286,7 +287,7 @@ LLChannelDescriptors LLBufferArray::nextChannel() //mMutexp should be locked before calling this. S32 LLBufferArray::capacity() const { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); S32 total = 0; const_buffer_iterator_t iter = mBuffers.begin(); @@ -314,7 +315,7 @@ bool LLBufferArray::append(S32 channel, const U8* src, S32 len) //mMutexp should be locked before calling this. bool LLBufferArray::prepend(S32 channel, const U8* src, S32 len) { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); std::vector<LLSegment> segments; if(copyIntoBuffers(channel, src, len, segments)) @@ -349,7 +350,7 @@ bool LLBufferArray::insertAfter( //mMutexp should be locked before calling this. LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address) { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); segment_iterator_t end = mSegments.end(); segment_iterator_t it = getSegment(address); @@ -381,14 +382,14 @@ LLBufferArray::segment_iterator_t LLBufferArray::splitAfter(U8* address) //mMutexp should be locked before calling this. LLBufferArray::segment_iterator_t LLBufferArray::beginSegment() { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); return mSegments.begin(); } //mMutexp should be locked before calling this. LLBufferArray::segment_iterator_t LLBufferArray::endSegment() { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); return mSegments.end(); } @@ -397,7 +398,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter( U8* address, LLSegment& segment) { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); segment_iterator_t rv = mSegments.begin(); segment_iterator_t end = mSegments.end(); if(!address) @@ -446,7 +447,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::constructSegmentAfter( //mMutexp should be locked before calling this. LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address) { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); segment_iterator_t end = mSegments.end(); if(!address) { @@ -468,7 +469,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::getSegment(U8* address) LLBufferArray::const_segment_iterator_t LLBufferArray::getSegment( U8* address) const { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); const_segment_iterator_t end = mSegments.end(); if(!address) { @@ -623,7 +624,7 @@ U8* LLBufferArray::seek( U8* start, S32 delta) const { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); const_segment_iterator_t it; const_segment_iterator_t end = mSegments.end(); U8* rv = start; @@ -791,7 +792,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::makeSegment( S32 channel, S32 len) { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); // start at the end of the buffers, because it is the most likely // to have free space. LLSegment segment; @@ -829,7 +830,7 @@ LLBufferArray::segment_iterator_t LLBufferArray::makeSegment( //mMutexp should be locked before calling this. bool LLBufferArray::eraseSegment(const segment_iterator_t& erase_iter) { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); // Find out which buffer contains the segment, and if it is found, // ask it to reclaim the memory. @@ -861,7 +862,7 @@ bool LLBufferArray::copyIntoBuffers( S32 len, std::vector<LLSegment>& segments) { - ASSERT_LLBUFFERARRAY_MUTEX_LOCKED + ASSERT_LLBUFFERARRAY_MUTEX_LOCKED(); if(!src || !len) return false; S32 copied = 0; LLSegment segment; diff --git a/indra/llmessage/llbufferstream.cpp b/indra/llmessage/llbufferstream.cpp index a51a48edc3cca4f155bab0c23c0cf453d3260ff9..ff1c9993cc0e1fc8769fdb12f3104fbcfeb15b0c 100755 --- a/indra/llmessage/llbufferstream.cpp +++ b/indra/llmessage/llbufferstream.cpp @@ -53,7 +53,7 @@ LLBufferStreamBuf::~LLBufferStreamBuf() // virtual int LLBufferStreamBuf::underflow() { - //lldebugs << "LLBufferStreamBuf::underflow()" << llendl; + //LL_DEBUGS() << "LLBufferStreamBuf::underflow()" << LL_ENDL; if(!mBuffer) { return EOF; diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 13d779ff83c77b396d96d273ab316b3c6df6ee83..4dd8d0465647513d4790cb17c738191906f176b1 100755 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -343,7 +343,7 @@ bool LLCacheName::importFile(std::istream& istr) ++count; } - llinfos << "LLCacheName loaded " << count << " agent names" << llendl; + LL_INFOS() << "LLCacheName loaded " << count << " agent names" << LL_ENDL; count = 0; LLSD groups = data[GROUPS]; @@ -364,7 +364,7 @@ bool LLCacheName::importFile(std::istream& istr) impl.mReverseCache[entry->mGroupName] = id; ++count; } - llinfos << "LLCacheName loaded " << count << " group names" << llendl; + LL_INFOS() << "LLCacheName loaded " << count << " group names" << LL_ENDL; return true; } @@ -440,7 +440,7 @@ void LLCacheName::localizeCacheName(std::string key, std::string value) if (key!="" && value!= "" ) sCacheName[key]=value; else - llwarns<< " Error localizing cache key " << key << " To "<< value<<llendl; + LL_WARNS()<< " Error localizing cache key " << key << " To "<< value<<LL_ENDL; } BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) @@ -467,7 +467,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) // COUNTER-HACK to combat James' HACK in exportFile()... // this group name was loaded from a name cache that did not // bother to save the group name ==> we must ask for it - lldebugs << "LLCacheName queuing HACK group request: " << id << llendl; + LL_DEBUGS() << "LLCacheName queuing HACK group request: " << id << LL_ENDL; entry = NULL; } @@ -676,8 +676,8 @@ void LLCacheName::processPending() if(!impl.mUpstreamHost.isOk()) { - lldebugs << "LLCacheName::processPending() - bad upstream host." - << llendl; + LL_DEBUGS() << "LLCacheName::processPending() - bad upstream host." + << LL_ENDL; return; } @@ -724,33 +724,33 @@ void LLCacheName::dump() LLCacheNameEntry* entry = iter->second; if (entry->mIsGroup) { - llinfos + LL_INFOS() << iter->first << " = (group) " << entry->mGroupName << " @ " << entry->mCreateTime - << llendl; + << LL_ENDL; } else { - llinfos + LL_INFOS() << iter->first << " = " << buildFullName(entry->mFirstName, entry->mLastName) << " @ " << entry->mCreateTime - << llendl; + << LL_ENDL; } } } void LLCacheName::dumpStats() { - llinfos << "Queue sizes: " + LL_INFOS() << "Queue sizes: " << " Cache=" << impl.mCache.size() << " AskName=" << impl.mAskNameQueue.size() << " AskGroup=" << impl.mAskGroupQueue.size() << " Pending=" << impl.mPendingQueue.size() << " Reply=" << impl.mReplyQueue.size() // << " Observers=" << impl.mSignal.size() - << llendl; + << LL_ENDL; } void LLCacheName::clear() @@ -886,7 +886,7 @@ void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup) // level, hence having an upstream provider. if (!mUpstreamHost.isOk()) { - llwarns << "LLCacheName - got UUID name/group request, but no upstream provider!" << llendl; + LL_WARNS() << "LLCacheName - got UUID name/group request, but no upstream provider!" << LL_ENDL; return; } @@ -903,11 +903,11 @@ void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup) { if (isGroup != entry->mIsGroup) { - llwarns << "LLCacheName - Asked for " + LL_WARNS() << "LLCacheName - Asked for " << (isGroup ? "group" : "user") << " name, " << "but found " << (entry->mIsGroup ? "group" : "user") - << ": " << id << llendl; + << ": " << id << LL_ENDL; } else { diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp index 0c2d4b823d25e87a3530411edfe77b121562a692..5aaada63b152308c971801329318ed60b06d6764 100755 --- a/indra/llmessage/llcircuit.cpp +++ b/indra/llmessage/llcircuit.cpp @@ -60,12 +60,12 @@ const S32 PING_START_BLOCK = 3; // How many pings behind we have to be to consider ourself blocked. const S32 PING_RELEASE_BLOCK = 2; // How many pings behind we have to be to consider ourself unblocked. -const F32 TARGET_PERIOD_LENGTH = 5.f; // seconds -const F32 LL_DUPLICATE_SUPPRESSION_TIMEOUT = 60.f; //seconds - this can be long, as time-based cleanup is +const F32Seconds TARGET_PERIOD_LENGTH(5.f); +const F32Seconds LL_DUPLICATE_SUPPRESSION_TIMEOUT(60.f); //this can be long, as time-based cleanup is // only done when wrapping packetids, now... LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, - const F32 circuit_heartbeat_interval, const F32 circuit_timeout) + const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout) : mHost (host), mWrapID(0), mPacketsOutID(0), @@ -84,7 +84,7 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, mPingsInTransit(0), mLastPingID(0), mPingDelay(INITIAL_PING_VALUE_MSEC), - mPingDelayAveraged((F32)INITIAL_PING_VALUE_MSEC), + mPingDelayAveraged(INITIAL_PING_VALUE_MSEC), mUnackedPacketCount(0), mUnackedPacketBytes(0), mLastPacketInTime(0.0), @@ -110,13 +110,13 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id, { // Need to guarantee that this time is up to date, we may be creating a circuit even though we haven't been // running a message system loop. - F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE); + F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(TRUE); F32 distribution_offset = ll_frand(); mPingTime = mt_sec; mLastPingSendTime = mt_sec + mHeartbeatInterval * distribution_offset; mLastPingReceivedTime = mt_sec; - mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval); + mNextPingSendTime = mLastPingSendTime + 0.95*mHeartbeatInterval + F32Seconds(ll_frand(0.1f*mHeartbeatInterval.value())); mPeriodTime = mt_sec; mLocalEndPointID.generate(); @@ -183,7 +183,7 @@ LLCircuitData::~LLCircuitData() std::ostream_iterator<TPACKETID> append(str, " "); str << "MSG: -> " << mHost << "\tABORTING RELIABLE:\t"; std::copy(doomed.begin(), doomed.end(), append); - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; } } @@ -203,11 +203,11 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num) std::ostringstream str; str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t" << packetp->mPacketID; - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; } if (packetp->mCallback) { - if (packetp->mTimeout < 0.f) // negative timeout will always return timeout even for successful ack, for debugging + if (packetp->mTimeout < F32Seconds(0.f)) // negative timeout will always return timeout even for successful ack, for debugging { packetp->mCallback(packetp->mCallbackData,LL_ERR_TCP_TIMEOUT); } @@ -231,17 +231,17 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num) if (iter != mFinalRetryPackets.end()) { packetp = iter->second; - // llinfos << "Packet " << packet_num << " removed from the pending list" << llendl; + // LL_INFOS() << "Packet " << packet_num << " removed from the pending list" << LL_ENDL; if(gMessageSystem->mVerboseLog) { std::ostringstream str; str << "MSG: <- " << packetp->mHost << "\tRELIABLE ACKED:\t" << packetp->mPacketID; - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; } if (packetp->mCallback) { - if (packetp->mTimeout < 0.f) // negative timeout will always return timeout even for successful ack, for debugging + if (packetp->mTimeout < F32Seconds(0.f)) // negative timeout will always return timeout even for successful ack, for debugging { packetp->mCallback(packetp->mCallbackData,LL_ERR_TCP_TIMEOUT); } @@ -268,7 +268,7 @@ void LLCircuitData::ackReliablePacket(TPACKETID packet_num) -S32 LLCircuitData::resendUnackedPackets(const F64 now) +S32 LLCircuitData::resendUnackedPackets(const F64Seconds now) { S32 resent_packets = 0; LLReliablePacket *packetp; @@ -320,8 +320,8 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) if (mUnackedPacketBytes > 256000 && !(getPacketsOut() % 1024)) { // Warn if we've got a lot of resends waiting. - llwarns << mHost << " has " << mUnackedPacketBytes - << " bytes of reliable messages waiting" << llendl; + LL_WARNS() << mHost << " has " << mUnackedPacketBytes + << " bytes of reliable messages waiting" << LL_ENDL; } // Stop resending. There are less than 512000 unacked packets. break; @@ -341,7 +341,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) std::ostringstream str; str << "MSG: -> " << packetp->mHost << "\tRESENDING RELIABLE:\t" << packetp->mPacketID; - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; } packetp->mBuffer[0] |= LL_RESENT_FLAG; // tag packet id as being a resend @@ -355,7 +355,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) // The new method, retry time based on ping if (packetp->mPingBasedRetry) { - packetp->mExpirationTime = now + llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, (LL_RELIABLE_TIMEOUT_FACTOR * getPingDelayAveraged())); + packetp->mExpirationTime = now + llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, F32Seconds(LL_RELIABLE_TIMEOUT_FACTOR * getPingDelayAveraged())); } else { @@ -390,10 +390,10 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) if (now > packetp->mExpirationTime) { // fail (too many retries) - //llinfos << "Packet " << packetp->mPacketID << " removed from the pending list: exceeded retry limit" << llendl; + //LL_INFOS() << "Packet " << packetp->mPacketID << " removed from the pending list: exceeded retry limit" << LL_ENDL; //if (packetp->mMessageName) //{ - // llinfos << "Packet name " << packetp->mMessageName << llendl; + // LL_INFOS() << "Packet name " << packetp->mMessageName << LL_ENDL; //} gMessageSystem->mFailedResendPackets++; @@ -402,7 +402,7 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) std::ostringstream str; str << "MSG: -> " << packetp->mHost << "\tABORTING RELIABLE:\t" << packetp->mPacketID; - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; } if (packetp->mCallback) @@ -427,10 +427,11 @@ S32 LLCircuitData::resendUnackedPackets(const F64 now) } -LLCircuit::LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : mLastCircuit(NULL), - mHeartbeatInterval(circuit_heartbeat_interval), mHeartbeatTimeout(circuit_timeout) -{ -} +LLCircuit::LLCircuit(const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout) +: mLastCircuit(NULL), + mHeartbeatInterval(circuit_heartbeat_interval), + mHeartbeatTimeout(circuit_timeout) +{} LLCircuit::~LLCircuit() { @@ -445,7 +446,7 @@ LLCircuit::~LLCircuit() LLCircuitData *LLCircuit::addCircuitData(const LLHost &host, TPACKETID in_id) { // This should really validate if one already exists - llinfos << "LLCircuit::addCircuitData for " << host << llendl; + LL_INFOS() << "LLCircuit::addCircuitData for " << host << LL_ENDL; LLCircuitData *tempp = new LLCircuitData(host, in_id, mHeartbeatInterval, mHeartbeatTimeout); mCircuitData.insert(circuit_data_map::value_type(host, tempp)); mPingSet.insert(tempp); @@ -456,7 +457,7 @@ LLCircuitData *LLCircuit::addCircuitData(const LLHost &host, TPACKETID in_id) void LLCircuit::removeCircuitData(const LLHost &host) { - llinfos << "LLCircuit::removeCircuitData for " << host << llendl; + LL_INFOS() << "LLCircuit::removeCircuitData for " << host << LL_ENDL; mLastCircuit = NULL; circuit_data_map::iterator it = mCircuitData.find(host); if(it != mCircuitData.end()) @@ -471,7 +472,7 @@ void LLCircuit::removeCircuitData(const LLHost &host) } else { - llwarns << "Couldn't find entry for next ping in ping set!" << llendl; + LL_WARNS() << "Couldn't find entry for next ping in ping set!" << LL_ENDL; } // Clean up from optimization maps @@ -521,17 +522,17 @@ void LLCircuitData::setAllowTimeout(BOOL allow) // Reset per-period counters if necessary. void LLCircuitData::checkPeriodTime() { - F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(); - F64 period_length = mt_sec - mPeriodTime; + F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(); + F64Seconds period_length = mt_sec - mPeriodTime; if ( period_length > TARGET_PERIOD_LENGTH) { - F32 bps_in = (F32)(mBytesInThisPeriod * 8.f / period_length); + F32 bps_in = F32Bits(mBytesInThisPeriod).value() / period_length.value(); if (bps_in > mPeakBPSIn) { mPeakBPSIn = bps_in; } - F32 bps_out = (F32)(mBytesOutThisPeriod * 8.f / period_length); + F32 bps_out = F32Bits(mBytesOutThisPeriod).value() / period_length.value(); if (bps_out > mPeakBPSOut) { mPeakBPSOut = bps_out; @@ -539,23 +540,23 @@ void LLCircuitData::checkPeriodTime() mBytesInLastPeriod = mBytesInThisPeriod; mBytesOutLastPeriod = mBytesOutThisPeriod; - mBytesInThisPeriod = 0; - mBytesOutThisPeriod = 0; - mLastPeriodLength = (F32)period_length; + mBytesInThisPeriod = S32Bytes(0); + mBytesOutThisPeriod = S32Bytes(0); + mLastPeriodLength = period_length; mPeriodTime = mt_sec; } } -void LLCircuitData::addBytesIn(S32 bytes) +void LLCircuitData::addBytesIn(S32Bytes bytes) { mBytesIn += bytes; mBytesInThisPeriod += bytes; } -void LLCircuitData::addBytesOut(S32 bytes) +void LLCircuitData::addBytesOut(S32Bytes bytes) { mBytesOut += bytes; mBytesOutThisPeriod += bytes; @@ -584,7 +585,7 @@ void LLCircuitData::addReliablePacket(S32 mSocket, U8 *buf_ptr, S32 buf_len, LLR void LLCircuit::resendUnackedPackets(S32& unacked_list_length, S32& unacked_list_size) { - F64 now = LLMessageSystem::getMessageTimeSeconds(); + F64Seconds now = LLMessageSystem::getMessageTimeSeconds(); unacked_list_length = 0; unacked_list_size = 0; @@ -719,14 +720,14 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) { std::ostringstream str; str << "MSG: <- " << mHost << "\tRECOVERING LOST:\t" << id; - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; } - // llinfos << "removing potential lost: " << id << llendl; + // LL_INFOS() << "removing potential lost: " << id << LL_ENDL; mPotentialLostPackets.erase(id); } else if (!receive_resent) // don't freak out over out-of-order reliable resends { - U64 time = LLMessageSystem::getMessageTimeUsecs(); + U64Microseconds time = LLMessageSystem::getMessageTimeUsecs(); TPACKETID index = mPacketsInID; S32 gap_count = 0; if ((index < id) && ((id - index) < 16)) @@ -738,10 +739,10 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) std::ostringstream str; str << "MSG: <- " << mHost << "\tPACKET GAP:\t" << index; - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; } -// llinfos << "adding potential lost: " << index << llendl; +// LL_INFOS() << "adding potential lost: " << index << LL_ENDL; mPotentialLostPackets[index] = time; index++; index = index % LL_MAX_OUT_PACKET_ID; @@ -750,13 +751,13 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) } else { - llinfos << "packet_out_of_order - got packet " << id << " expecting " << index << " from " << mHost << llendl; + LL_INFOS() << "packet_out_of_order - got packet " << id << " expecting " << index << " from " << mHost << LL_ENDL; if(gMessageSystem->mVerboseLog) { std::ostringstream str; str << "MSG: <- " << mHost << "\tPACKET GAP:\t" << id << " expected " << index; - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; } } @@ -765,11 +766,11 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) if (gap_count > 128) { - llwarns << "Packet loss gap filler running amok!" << llendl; + LL_WARNS() << "Packet loss gap filler running amok!" << LL_ENDL; } else if (gap_count > 16) { - llwarns << "Sustaining large amounts of packet loss!" << llendl; + LL_WARNS() << "Sustaining large amounts of packet loss!" << LL_ENDL; } } @@ -780,7 +781,7 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent) void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) { - F64 cur_time = LLMessageSystem::getMessageTimeSeconds(); + F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds(); S32 count = mPingSet.size(); S32 cur = 0; @@ -818,7 +819,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) if (cdp->updateWatchDogTimers(msgsys)) { // Randomize our pings a bit by doing some up to 5% early or late - F64 dt = 0.95f*mHeartbeatInterval + ll_frand(0.1f*mHeartbeatInterval); + F64Seconds dt = 0.95f*mHeartbeatInterval + F32Seconds(ll_frand(0.1f*mHeartbeatInterval.value())); // Remove it, and reinsert it with the new next ping time. // Always remove before changing the sorting key. @@ -846,7 +847,7 @@ void LLCircuit::updateWatchDogTimers(LLMessageSystem *msgsys) BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) { - F64 cur_time = LLMessageSystem::getMessageTimeSeconds(); + F64Seconds cur_time = LLMessageSystem::getMessageTimeSeconds(); mLastPingSendTime = cur_time; if (!checkCircuitTimeout()) @@ -889,8 +890,8 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) wrapped_final = TRUE; } - //llinfos << mHost << " - unacked count " << mUnackedPackets.size() << llendl; - //llinfos << mHost << " - final count " << mFinalRetryPackets.size() << llendl; + //LL_INFOS() << mHost << " - unacked count " << mUnackedPackets.size() << LL_ENDL; + //LL_INFOS() << mHost << " - final count " << mFinalRetryPackets.size() << LL_ENDL; if (wrapped != wrapped_final) { // One of the "unacked" or "final" lists hasn't wrapped. Whichever one @@ -900,12 +901,12 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) // Hasn't wrapped, so the one on the // unacked packet list is older packet_id = iter->first; - //llinfos << mHost << ": nowrapped unacked" << llendl; + //LL_INFOS() << mHost << ": nowrapped unacked" << LL_ENDL; } else { packet_id = iter_final->first; - //llinfos << mHost << ": nowrapped final" << llendl; + //LL_INFOS() << mHost << ": nowrapped final" << LL_ENDL; } } else @@ -917,7 +918,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) // Send the ID of the last packet we sent out. // This will flush all of the destination's // unacked packets, theoretically. - //llinfos << mHost << ": No unacked!" << llendl; + //LL_INFOS() << mHost << ": No unacked!" << LL_ENDL; packet_id = getPacketOutID(); } else @@ -928,7 +929,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) // Unacked list has the lowest so far packet_id = iter->first; had_unacked = TRUE; - //llinfos << mHost << ": Unacked" << llendl; + //LL_INFOS() << mHost << ": Unacked" << LL_ENDL; } if (iter_final != mFinalRetryPackets.end()) @@ -938,13 +939,13 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) { // Both had a packet, use the lowest. packet_id = llmin(packet_id, iter_final->first); - //llinfos << mHost << ": Min of unacked/final" << llendl; + //LL_INFOS() << mHost << ": Min of unacked/final" << LL_ENDL; } else { // Only the final had a packet, use it. packet_id = iter_final->first; - //llinfos << mHost << ": Final!" << llendl; + //LL_INFOS() << mHost << ": Final!" << LL_ENDL; } } } @@ -963,12 +964,12 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) // be considered lost LLCircuitData::packet_time_map::iterator it; - U64 timeout = (U64)(1000000.0*llmin(LL_MAX_LOST_TIMEOUT, getPingDelayAveraged() * LL_LOST_TIMEOUT_FACTOR)); + U64Microseconds timeout = llmin(LL_MAX_LOST_TIMEOUT, F32Seconds(getPingDelayAveraged()) * LL_LOST_TIMEOUT_FACTOR); - U64 mt_usec = LLMessageSystem::getMessageTimeUsecs(); + U64Microseconds mt_usec = LLMessageSystem::getMessageTimeUsecs(); for (it = mPotentialLostPackets.begin(); it != mPotentialLostPackets.end(); ) { - U64 delta_t_usec = mt_usec - (*it).second; + U64Microseconds delta_t_usec = mt_usec - (*it).second; if (delta_t_usec > timeout) { // let's call this one a loss! @@ -979,7 +980,7 @@ BOOL LLCircuitData::updateWatchDogTimers(LLMessageSystem *msgsys) std::ostringstream str; str << "MSG: <- " << mHost << "\tLOST PACKET:\t" << (*it).first; - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; } mPotentialLostPackets.erase(it++); } @@ -999,8 +1000,8 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id) // we want to KEEP all x where oldest_id <= x <= last incoming packet, and delete everything else. - //llinfos << mHost << ": clearing before oldest " << oldest_id << llendl; - //llinfos << "Recent list before: " << mRecentlyReceivedReliablePackets.size() << llendl; + //LL_INFOS() << mHost << ": clearing before oldest " << oldest_id << LL_ENDL; + //LL_INFOS() << "Recent list before: " << mRecentlyReceivedReliablePackets.size() << LL_ENDL; if (oldest_id < mHighestPacketID) { // Clean up everything with a packet ID less than oldest_id. @@ -1014,7 +1015,7 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id) // Do timeout checks on everything with an ID > mHighestPacketID. // This should be empty except for wrapping IDs. Thus, this should be // highly rare. - U64 mt_usec = LLMessageSystem::getMessageTimeUsecs(); + U64Microseconds mt_usec = LLMessageSystem::getMessageTimeUsecs(); packet_time_map::iterator pit; for(pit = mRecentlyReceivedReliablePackets.upper_bound(mHighestPacketID); @@ -1023,14 +1024,14 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id) // Validate that the packet ID seems far enough away if ((pit->first - mHighestPacketID) < 100) { - llwarns << "Probably incorrectly timing out non-wrapped packets!" << llendl; + LL_WARNS() << "Probably incorrectly timing out non-wrapped packets!" << LL_ENDL; } - U64 delta_t_usec = mt_usec - (*pit).second; - F64 delta_t_sec = delta_t_usec * SEC_PER_USEC; + U64Microseconds delta_t_usec = mt_usec - (*pit).second; + F64Seconds delta_t_sec = delta_t_usec; if (delta_t_sec > LL_DUPLICATE_SUPPRESSION_TIMEOUT) { // enough time has elapsed we're not likely to get a duplicate on this one - llinfos << "Clearing " << pit->first << " from recent list" << llendl; + LL_INFOS() << "Clearing " << pit->first << " from recent list" << LL_ENDL; mRecentlyReceivedReliablePackets.erase(pit++); } else @@ -1038,27 +1039,27 @@ void LLCircuitData::clearDuplicateList(TPACKETID oldest_id) ++pit; } } - //llinfos << "Recent list after: " << mRecentlyReceivedReliablePackets.size() << llendl; + //LL_INFOS() << "Recent list after: " << mRecentlyReceivedReliablePackets.size() << LL_ENDL; } BOOL LLCircuitData::checkCircuitTimeout() { - F64 time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime; + F64Seconds time_since_last_ping = LLMessageSystem::getMessageTimeSeconds() - mLastPingReceivedTime; // Nota Bene: This needs to be turned off if you are debugging multiple simulators if (time_since_last_ping > mHeartbeatTimeout) { - llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<llendl; + LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " last ping " << time_since_last_ping << " seconds ago." <<LL_ENDL; setAlive(FALSE); if (mTimeoutCallback) { - llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " calling callback." << llendl; + LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " calling callback." << LL_ENDL; mTimeoutCallback(mHost, mTimeoutUserData); } if (!isAlive()) { // The callback didn't try and resurrect the circuit. We should kill it. - llwarns << "LLCircuitData::checkCircuitTimeout for " << mHost << " still dead, dropping." << llendl; + LL_WARNS() << "LLCircuitData::checkCircuitTimeout for " << mHost << " still dead, dropping." << LL_ENDL; return FALSE; } } @@ -1121,7 +1122,7 @@ void LLCircuit::sendAcks() str << "MSG: -> " << cd->mHost << "\tPACKET ACKS:\t"; std::ostream_iterator<TPACKETID> append(str, " "); std::copy(cd->mAcks.begin(), cd->mAcks.end(), append); - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; } // empty out the acks list @@ -1139,40 +1140,40 @@ std::ostream& operator<<(std::ostream& s, LLCircuitData& circuit) F32 age = circuit.mExistenceTimer.getElapsedTimeF32(); using namespace std; - s << "Circuit " << circuit.mHost << " "; - s << circuit.mRemoteID << " "; - s << (circuit.mbAlive ? "Alive" : "Not Alive") << " "; - s << (circuit.mbAllowTimeout ? "Timeout Allowed" : "Timeout Not Allowed"); - s << endl; - - s << " Packets Lost: " << circuit.mPacketsLost; - s << " Measured Ping: " << circuit.mPingDelay; - s << " Averaged Ping: " << circuit.mPingDelayAveraged; - s << endl; - - s << "Global In/Out " << S32(age) << " sec"; - s << " KBytes: " << circuit.mBytesIn / 1024 << "/" << circuit.mBytesOut / 1024; - s << " Kbps: "; - s << S32(circuit.mBytesIn * 8.f / circuit.mExistenceTimer.getElapsedTimeF32() / 1024.f); - s << "/"; - s << S32(circuit.mBytesOut * 8.f / circuit.mExistenceTimer.getElapsedTimeF32() / 1024.f); - s << " Packets: " << circuit.mPacketsIn << "/" << circuit.mPacketsOut; - s << endl; - - s << "Recent In/Out " << S32(circuit.mLastPeriodLength) << " sec"; - s << " KBytes: "; - s << circuit.mBytesInLastPeriod / 1024; - s << "/"; - s << circuit.mBytesOutLastPeriod / 1024; - s << " Kbps: "; - s << S32(circuit.mBytesInLastPeriod * 8.f / circuit.mLastPeriodLength / 1024.f); - s << "/"; - s << S32(circuit.mBytesOutLastPeriod * 8.f / circuit.mLastPeriodLength / 1024.f); - s << " Peak kbps: "; - s << S32(circuit.mPeakBPSIn / 1024.f); - s << "/"; - s << S32(circuit.mPeakBPSOut / 1024.f); - s << endl; + s << "Circuit " << circuit.mHost << " " + << circuit.mRemoteID << " " + << (circuit.mbAlive ? "Alive" : "Not Alive") << " " + << (circuit.mbAllowTimeout ? "Timeout Allowed" : "Timeout Not Allowed") + << endl; + + s << " Packets Lost: " << circuit.mPacketsLost + << " Measured Ping: " << circuit.mPingDelay + << " Averaged Ping: " << circuit.mPingDelayAveraged + << endl; + + s << "Global In/Out " << S32(age) << " sec" + << " KBytes: " << circuit.mBytesIn.valueInUnits<LLUnits::Kilobytes>() << "/" << circuit.mBytesOut.valueInUnits<LLUnits::Kilobytes>() + << " Kbps: " + << S32(circuit.mBytesIn.valueInUnits<LLUnits::Kilobits>() / circuit.mExistenceTimer.getElapsedTimeF32().value()) + << "/" + << S32(circuit.mBytesOut.valueInUnits<LLUnits::Kilobits>() / circuit.mExistenceTimer.getElapsedTimeF32().value()) + << " Packets: " << circuit.mPacketsIn << "/" << circuit.mPacketsOut + << endl; + + s << "Recent In/Out " << circuit.mLastPeriodLength + << " KBytes: " + << circuit.mBytesInLastPeriod.valueInUnits<LLUnits::Kilobytes>() + << "/" + << circuit.mBytesOutLastPeriod.valueInUnits<LLUnits::Kilobytes>() + << " Kbps: " + << (S32)(circuit.mBytesInLastPeriod.valueInUnits<LLUnits::Kilobits>() / circuit.mLastPeriodLength.value()) + << "/" + << (S32)(circuit.mBytesOutLastPeriod.valueInUnits<LLUnits::Kilobits>() / circuit.mLastPeriodLength.value()) + << " Peak kbps: " + << S32(circuit.mPeakBPSIn / 1024.f) + << "/" + << S32(circuit.mPeakBPSOut / 1024.f) + << endl; return s; } @@ -1188,7 +1189,7 @@ void LLCircuitData::dumpResendCountAndReset() { if (mCurrentResendCount) { - llinfos << "Circuit: " << mHost << " resent " << mCurrentResendCount << " packets" << llendl; + LL_INFOS() << "Circuit: " << mHost << " resent " << mCurrentResendCount << " packets" << LL_ENDL; mCurrentResendCount = 0; } } @@ -1256,11 +1257,11 @@ void LLCircuitData::setPacketInID(TPACKETID id) void LLCircuitData::pingTimerStop(const U8 ping_id) { - F64 mt_secs = LLMessageSystem::getMessageTimeSeconds(); + F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds(); // Nota Bene: no averaging of ping times until we get a feel for how this works - F64 time = mt_secs - mPingTime; - if (time == 0.0) + F64Seconds time = mt_secs - mPingTime; + if (time == F32Seconds(0.0)) { // Ack, we got our ping response on the same frame! Sigh, let's get a real time otherwise // all of our ping calculations will be skewed. @@ -1276,7 +1277,7 @@ void LLCircuitData::pingTimerStop(const U8 ping_id) delta_ping += 256; } - U32 msec = (U32) ((delta_ping*mHeartbeatInterval + time) * 1000.f); + U32Milliseconds msec = delta_ping*mHeartbeatInterval + time; setPingDelay(msec); mPingsInTransit = delta_ping; @@ -1305,13 +1306,13 @@ U32 LLCircuitData::getPacketsIn() const } -S32 LLCircuitData::getBytesIn() const +S32Bytes LLCircuitData::getBytesIn() const { return mBytesIn; } -S32 LLCircuitData::getBytesOut() const +S32Bytes LLCircuitData::getBytesOut() const { return mBytesOut; } @@ -1353,41 +1354,41 @@ BOOL LLCircuitData::getAllowTimeout() const } -U32 LLCircuitData::getPingDelay() const +U32Milliseconds LLCircuitData::getPingDelay() const { return mPingDelay; } -F32 LLCircuitData::getPingInTransitTime() +F32Milliseconds LLCircuitData::getPingInTransitTime() { // This may be inaccurate in the case of a circuit that was "dead" and then revived, // but only until the first round trip ping is sent - djs - F32 time_since_ping_was_sent = 0; + F32Milliseconds time_since_ping_was_sent(0); if (mPingsInTransit) { - time_since_ping_was_sent = (F32)((mPingsInTransit*mHeartbeatInterval - 1) - + (LLMessageSystem::getMessageTimeSeconds() - mPingTime))*1000.f; + time_since_ping_was_sent = ((mPingsInTransit*mHeartbeatInterval - F32Seconds(1)) + + (LLMessageSystem::getMessageTimeSeconds() - mPingTime)); } return time_since_ping_was_sent; } -void LLCircuitData::setPingDelay(U32 ping) +void LLCircuitData::setPingDelay(U32Milliseconds ping) { mPingDelay = ping; - mPingDelayAveraged = llmax((F32)ping, getPingDelayAveraged()); + mPingDelayAveraged = llmax((F32Milliseconds)ping, getPingDelayAveraged()); mPingDelayAveraged = ((1.f - LL_AVERAGED_PING_ALPHA) * mPingDelayAveraged) - + (LL_AVERAGED_PING_ALPHA * (F32) ping); + + (LL_AVERAGED_PING_ALPHA * (F32Milliseconds) ping); mPingDelayAveraged = llclamp(mPingDelayAveraged, LL_AVERAGED_PING_MIN, LL_AVERAGED_PING_MAX); } -F32 LLCircuitData::getPingDelayAveraged() +F32Milliseconds LLCircuitData::getPingDelayAveraged() { return llmin(llmax(getPingInTransitTime(), mPingDelayAveraged), LL_AVERAGED_PING_MAX); } diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h index 430d6358f77673280e3a84cb8773dd165a666ba3..5b109fc2182bb9f897fa2fb1b88c9773af410ec2 100755 --- a/indra/llmessage/llcircuit.h +++ b/indra/llmessage/llcircuit.h @@ -34,7 +34,6 @@ #include "llerror.h" #include "lltimer.h" -#include "timing.h" #include "net.h" #include "llhost.h" #include "llpacketack.h" @@ -45,12 +44,14 @@ // Constants // const F32 LL_AVERAGED_PING_ALPHA = 0.2f; // relaxation constant on ping running average -const F32 LL_AVERAGED_PING_MAX = 2000; // msec -const F32 LL_AVERAGED_PING_MIN = 100; // msec // IW: increased to avoid retransmits when a process is slow +const F32Milliseconds LL_AVERAGED_PING_MAX(2000); +const F32Milliseconds LL_AVERAGED_PING_MIN(100); // increased to avoid retransmits when a process is slow -const U32 INITIAL_PING_VALUE_MSEC = 1000; // initial value for the ping delay, or for ping delay for an unknown circuit +const U32Milliseconds INITIAL_PING_VALUE_MSEC(1000); // initial value for the ping delay, or for ping delay for an unknown circuit const TPACKETID LL_MAX_OUT_PACKET_ID = 0x01000000; +const int LL_ERR_CIRCUIT_GONE = -23017; +const int LL_ERR_TCP_TIMEOUT = -23016; // 0 - flags // [1,4] - packetid @@ -76,10 +77,10 @@ class LLCircuitData { public: LLCircuitData(const LLHost &host, TPACKETID in_id, - const F32 circuit_heartbeat_interval, const F32 circuit_timeout); + const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout); ~LLCircuitData(); - S32 resendUnackedPackets(const F64 now); + S32 resendUnackedPackets(const F64Seconds now); void clearDuplicateList(TPACKETID oldest_id); @@ -105,18 +106,18 @@ class LLCircuitData // mLocalEndPointID should only ever be setup in the LLCircuitData constructor const LLUUID& getLocalEndPointID() const { return mLocalEndPointID; } - U32 getPingDelay() const; + U32Milliseconds getPingDelay() const; S32 getPingsInTransit() const { return mPingsInTransit; } // ACCESSORS BOOL isAlive() const; BOOL isBlocked() const; BOOL getAllowTimeout() const; - F32 getPingDelayAveraged(); - F32 getPingInTransitTime(); + F32Milliseconds getPingDelayAveraged(); + F32Milliseconds getPingInTransitTime(); U32 getPacketsIn() const; - S32 getBytesIn() const; - S32 getBytesOut() const; + S32Bytes getBytesIn() const; + S32Bytes getBytesOut() const; U32 getPacketsOut() const; U32 getPacketsLost() const; TPACKETID getPacketOutID() const; @@ -124,10 +125,10 @@ class LLCircuitData F32 getAgeInSeconds() const; S32 getUnackedPacketCount() const { return mUnackedPacketCount; } S32 getUnackedPacketBytes() const { return mUnackedPacketBytes; } - F64 getNextPingSendTime() const { return mNextPingSendTime; } + F64Seconds getNextPingSendTime() const { return mNextPingSendTime; } U32 getLastPacketGap() const { return mLastPacketGap; } LLHost getHost() const { return mHost; } - F64 getLastPacketInTime() const { return mLastPacketInTime; } + F64Seconds getLastPacketInTime() const { return mLastPacketInTime; } LLThrottleGroup &getThrottleGroup() { return mThrottles; } @@ -163,11 +164,11 @@ class LLCircuitData TPACKETID nextPacketOutID(); void setPacketInID(TPACKETID id); void checkPacketInID(TPACKETID id, BOOL receive_resent); - void setPingDelay(U32 ping); + void setPingDelay(U32Milliseconds ping); BOOL checkCircuitTimeout(); // Return FALSE if the circuit is dead and should be cleaned up - void addBytesIn(S32 bytes); - void addBytesOut(S32 bytes); + void addBytesIn(S32Bytes bytes); + void addBytesOut(S32Bytes bytes); U8 nextPingID() { mLastPingID++; return mLastPingID; } @@ -218,20 +219,20 @@ class LLCircuitData BOOL mBlocked; // Blocked is true if the circuit is hosed, i.e. far behind on pings // Not sure what the difference between this and mLastPingSendTime is - F64 mPingTime; // Time at which a ping was sent. + F64Seconds mPingTime; // Time at which a ping was sent. - F64 mLastPingSendTime; // Time we last sent a ping - F64 mLastPingReceivedTime; // Time we last received a ping - F64 mNextPingSendTime; // Time to try and send the next ping - S32 mPingsInTransit; // Number of pings in transit - U8 mLastPingID; // ID of the last ping that we sent out + F64Seconds mLastPingSendTime; // Time we last sent a ping + F64Seconds mLastPingReceivedTime; // Time we last received a ping + F64Seconds mNextPingSendTime; // Time to try and send the next ping + S32 mPingsInTransit; // Number of pings in transit + U8 mLastPingID; // ID of the last ping that we sent out // Used for determining the resend time for reliable resends. - U32 mPingDelay; // raw ping delay - F32 mPingDelayAveraged; // averaged ping delay (fast attack/slow decay) + U32Milliseconds mPingDelay; // raw ping delay + F32Milliseconds mPingDelayAveraged; // averaged ping delay (fast attack/slow decay) - typedef std::map<TPACKETID, U64> packet_time_map; + typedef std::map<TPACKETID, U64Microseconds> packet_time_map; packet_time_map mPotentialLostPackets; packet_time_map mRecentlyReceivedReliablePackets; @@ -246,7 +247,7 @@ class LLCircuitData S32 mUnackedPacketCount; S32 mUnackedPacketBytes; - F64 mLastPacketInTime; // Time of last packet arrival + F64Seconds mLastPacketInTime; // Time of last packet arrival LLUUID mLocalEndPointID; @@ -258,24 +259,24 @@ class LLCircuitData U32 mPacketsOut; U32 mPacketsIn; S32 mPacketsLost; - S32 mBytesIn; - S32 mBytesOut; - - F32 mLastPeriodLength; // seconds - S32 mBytesInLastPeriod; - S32 mBytesOutLastPeriod; - S32 mBytesInThisPeriod; - S32 mBytesOutThisPeriod; + S32Bytes mBytesIn, + mBytesOut; + + F32Seconds mLastPeriodLength; + S32Bytes mBytesInLastPeriod; + S32Bytes mBytesOutLastPeriod; + S32Bytes mBytesInThisPeriod; + S32Bytes mBytesOutThisPeriod; F32 mPeakBPSIn; // bits per second, max of all period bps F32 mPeakBPSOut; // bits per second, max of all period bps - F64 mPeriodTime; + F64Seconds mPeriodTime; LLTimer mExistenceTimer; // initialized when circuit created, used to track bandwidth numbers S32 mCurrentResendCount; // Number of resent packets since last spam U32 mLastPacketGap; // Gap in sequence number of last packet. - const F32 mHeartbeatInterval; - const F32 mHeartbeatTimeout; + const F32Seconds mHeartbeatInterval; + const F32Seconds mHeartbeatTimeout; }; @@ -285,7 +286,7 @@ class LLCircuit { public: // CREATORS - LLCircuit(const F32 circuit_heartbeat_interval, const F32 circuit_timeout); + LLCircuit(const F32Seconds circuit_heartbeat_interval, const F32Seconds circuit_timeout); ~LLCircuit(); // ACCESSORS @@ -340,7 +341,7 @@ class LLCircuit mutable LLCircuitData* mLastCircuit; private: - const F32 mHeartbeatInterval; - const F32 mHeartbeatTimeout; + const F32Seconds mHeartbeatInterval; + const F32Seconds mHeartbeatTimeout; }; #endif diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 9e68c68858bd4ebf3db255ec33631dcf470c2420..147940c983d313867065a10436fc18e3c8e25e22 100755 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -100,7 +100,7 @@ void check_curl_code(CURLcode code) { // linux appears to throw a curl error once per session for a bad initialization // at a pretty random time (when enabling cookies). - llinfos << "curl error detected: " << curl_easy_strerror(code) << llendl; + LL_INFOS() << "curl error detected: " << curl_easy_strerror(code) << LL_ENDL; } } @@ -110,7 +110,7 @@ void check_curl_multi_code(CURLMcode code) { // linux appears to throw a curl error once per session for a bad initialization // at a pretty random time (when enabling cookies). - llinfos << "curl multi error detected: " << curl_multi_strerror(code) << llendl; + LL_INFOS() << "curl multi error detected: " << curl_multi_strerror(code) << LL_ENDL; } } @@ -155,7 +155,7 @@ void LLCurl::Responder::errorWithContent( // virtual void LLCurl::Responder::error(U32 status, const std::string& reason) { - llinfos << mURL << " [" << status << "]: " << reason << llendl; + LL_INFOS() << mURL << " [" << status << "]: " << reason << LL_ENDL; } // virtual @@ -180,7 +180,7 @@ void LLCurl::Responder::completedRaw( const bool emit_errors = false; if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(content, istr, emit_errors)) { - llinfos << "Failed to deserialize LLSD. " << mURL << " [" << status << "]: " << reason << llendl; + LL_INFOS() << "Failed to deserialize LLSD. " << mURL << " [" << status << "]: " << reason << LL_ENDL; content["reason"] = reason; } @@ -248,7 +248,7 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle) if (!handle) { return ; //handle allocation failed. - //llerrs << "handle cannot be NULL!" << llendl; + //LL_ERRS() << "handle cannot be NULL!" << LL_ENDL; } LLMutexLock lock(sHandleMutexp) ; @@ -270,7 +270,7 @@ void LLCurl::Easy::releaseEasyHandle(CURL* handle) } else { - llerrs << "Invalid handle." << llendl; + LL_ERRS() << "Invalid handle." << LL_ENDL; } } @@ -289,7 +289,7 @@ LLCurl::Easy* LLCurl::Easy::getEasy() if (!easy->mCurlEasyHandle) { // this can happen if we have too many open files (fails in c-ares/ares_init.c) - llwarns << "allocEasyHandle() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << llendl; + LL_WARNS() << "allocEasyHandle() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << LL_ENDL; delete easy; return NULL; } @@ -555,7 +555,7 @@ LLCurl::Multi::Multi(F32 idle_time_out) mCurlMultiHandle = LLCurl::newMultiHandle(); if (!mCurlMultiHandle) { - llwarns << "curl_multi_init() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << llendl; + LL_WARNS() << "curl_multi_init() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << LL_ENDL; mCurlMultiHandle = LLCurl::newMultiHandle(); } @@ -830,8 +830,8 @@ S32 LLCurl::Multi::process() else { response = 499; - //*TODO: change to llwarns - llerrs << "cleaned up curl request completed!" << llendl; + //*TODO: change to LL_WARNS() + LL_ERRS() << "cleaned up curl request completed!" << LL_ENDL; } if (response >= 400) { @@ -876,7 +876,7 @@ bool LLCurl::Multi::addEasy(Easy* easy) check_curl_multi_code(mcode); //if (mcode != CURLM_OK) //{ - // llwarns << "Curl Error: " << curl_multi_strerror(mcode) << llendl; + // LL_WARNS() << "Curl Error: " << curl_multi_strerror(mcode) << LL_ENDL; // return false; //} return true; @@ -993,7 +993,7 @@ void LLCurlThread::addMulti(LLCurl::Multi* multi) if (!addRequest(req)) { - llwarns << "curl request added when the thread is quitted" << llendl; + LL_WARNS() << "curl request added when the thread is quitted" << LL_ENDL; } } @@ -1100,7 +1100,7 @@ bool LLCurlRequest::addEasy(LLCurl::Easy* easy) if (mProcessing) { - llerrs << "Posting to a LLCurlRequest instance from within a responder is not allowed (causes DNS timeouts)." << llendl; + LL_ERRS() << "Posting to a LLCurlRequest instance from within a responder is not allowed (causes DNS timeouts)." << LL_ENDL; } bool res = mActiveMulti->addEasy(easy); return res; @@ -1164,7 +1164,7 @@ bool LLCurlRequest::post(const std::string& url, easy->slist_append("Content-Type: application/llsd+xml"); easy->setHeaders(); - lldebugs << "POSTING: " << bytes << " bytes." << llendl; + LL_DEBUGS() << "POSTING: " << bytes << " bytes." << LL_ENDL; bool res = addEasy(easy); return res; } @@ -1192,7 +1192,7 @@ bool LLCurlRequest::post(const std::string& url, easy->slist_append("Content-Type: application/octet-stream"); easy->setHeaders(); - lldebugs << "POSTING: " << bytes << " bytes." << llendl; + LL_DEBUGS() << "POSTING: " << bytes << " bytes." << LL_ENDL; bool res = addEasy(easy); return res; } @@ -1573,7 +1573,7 @@ void LLCurlEasyRequest::sendRequest(const std::string& url) { llassert_always(!mRequestSent); mRequestSent = true; - lldebugs << url << llendl; + LL_DEBUGS() << url << LL_ENDL; if (isValid() && mEasy) { mEasy->setHeaders(); @@ -1781,7 +1781,7 @@ CURLM* LLCurl::newMultiHandle() if(sTotalHandles + 1 > sMaxHandles) { - llwarns << "no more handles available." << llendl ; + LL_WARNS() << "no more handles available." << LL_ENDL ; return NULL ; //failed } sTotalHandles++; @@ -1789,7 +1789,7 @@ CURLM* LLCurl::newMultiHandle() CURLM* ret = curl_multi_init() ; if(!ret) { - llwarns << "curl_multi_init failed." << llendl ; + LL_WARNS() << "curl_multi_init failed." << LL_ENDL ; } return ret ; @@ -1815,7 +1815,7 @@ CURL* LLCurl::newEasyHandle() if(sTotalHandles + 1 > sMaxHandles) { - llwarns << "no more handles available." << llendl ; + LL_WARNS() << "no more handles available." << LL_ENDL ; return NULL ; //failed } sTotalHandles++; @@ -1823,7 +1823,7 @@ CURL* LLCurl::newEasyHandle() CURL* ret = createStandardCurlHandle(); if(!ret) { - llwarns << "failed to create curl handle." << llendl ; + LL_WARNS() << "failed to create curl handle." << LL_ENDL ; } return ret ; @@ -1863,7 +1863,7 @@ CURL* LLCurl::createStandardCurlHandle() sCurlTemplateStandardHandle = curl_easy_init(); if (sCurlTemplateStandardHandle == NULL) { - llwarns << "curl error calling curl_easy_init()" << llendl; + LL_WARNS() << "curl error calling curl_easy_init()" << LL_ENDL; } else { diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 90b3f2815d605b2b86a6fe0b1dbaa0f61a78984b..fc9761ff9f3a84ea0464a6d691f115a928e91dcd 100755 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -41,7 +41,6 @@ #include "llbuffer.h" #include "lliopipe.h" #include "llsd.h" -#include "llthread.h" #include "llqueuedthread.h" #include "llframetimer.h" #include "llpointer.h" diff --git a/indra/llmessage/lldatapacker.cpp b/indra/llmessage/lldatapacker.cpp index 3385d7c2e2a47c1ab5985e4a51f7e298e547e750..3510f93805daa66c2ad0ac724c16217e7ce1b5dd 100755 --- a/indra/llmessage/lldatapacker.cpp +++ b/indra/llmessage/lldatapacker.cpp @@ -52,13 +52,13 @@ LLDataPacker::LLDataPacker() : mPassFlags(0), mWriteEnabled(FALSE) //virtual void LLDataPacker::reset() { - llerrs << "Using unimplemented datapacker reset!" << llendl; + LL_ERRS() << "Using unimplemented datapacker reset!" << LL_ENDL; } //virtual void LLDataPacker::dumpBufferToLog() { - llerrs << "dumpBufferToLog not implemented for this type!" << llendl; + LL_ERRS() << "dumpBufferToLog not implemented for this type!" << LL_ENDL; } BOOL LLDataPacker::packFixed(const F32 value, const char *name, @@ -108,7 +108,7 @@ BOOL LLDataPacker::packFixed(const F32 value, const char *name, } else { - llerrs << "Using fixed-point packing of " << total_bits << " bits, why?!" << llendl; + LL_ERRS() << "Using fixed-point packing of " << total_bits << " bits, why?!" << LL_ENDL; } return success; } @@ -117,7 +117,7 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, const BOOL is_signed, const U32 int_bits, const U32 frac_bits) { //BOOL success = TRUE; - //llinfos << "unpackFixed:" << name << " int:" << int_bits << " frac:" << frac_bits << llendl; + //LL_INFOS() << "unpackFixed:" << name << " int:" << int_bits << " frac:" << frac_bits << LL_ENDL; BOOL ok = FALSE; S32 unsigned_bits = int_bits + frac_bits; S32 total_bits = unsigned_bits; @@ -158,10 +158,10 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, else { fixed_val = 0; - llerrs << "Bad bit count: " << total_bits << llendl; + LL_ERRS() << "Bad bit count: " << total_bits << LL_ENDL; } - //llinfos << "Fixed_val:" << fixed_val << llendl; + //LL_INFOS() << "Fixed_val:" << fixed_val << LL_ENDL; fixed_val /= (F32)(1 << frac_bits); if (is_signed) @@ -169,7 +169,7 @@ BOOL LLDataPacker::unpackFixed(F32 &value, const char *name, fixed_val -= max_val; } value = fixed_val; - //llinfos << "Value: " << value << llendl; + //LL_INFOS() << "Value: " << value << LL_ENDL; return ok; } @@ -239,7 +239,7 @@ BOOL LLDataPackerBinaryBuffer::unpackBinaryData(U8 *value, S32 &size, const char } else { - llwarns << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << llendl; + LL_WARNS() << "LLDataPackerBinaryBuffer::unpackBinaryData would unpack invalid data, aborting!" << LL_ENDL; success = FALSE; } return success; @@ -550,7 +550,7 @@ const LLDataPackerBinaryBuffer& LLDataPackerBinaryBuffer::operator=(const LLData if (a.getBufferSize() > getBufferSize()) { // We've got problems, ack! - llerrs << "Trying to do an assignment with not enough room in the target." << llendl; + LL_ERRS() << "Trying to do an assignment with not enough room in the target." << LL_ENDL; } memcpy(mBufferp, a.mBufferp, a.getBufferSize()); /*Flawfinder: ignore*/ return *this; @@ -558,7 +558,7 @@ const LLDataPackerBinaryBuffer& LLDataPackerBinaryBuffer::operator=(const LLData void LLDataPackerBinaryBuffer::dumpBufferToLog() { - llwarns << "Binary Buffer Dump, size: " << mBufferSize << llendl; + LL_WARNS() << "Binary Buffer Dump, size: " << mBufferSize << LL_ENDL; char line_buffer[256]; /*Flawfinder: ignore*/ S32 i; S32 cur_line_pos = 0; @@ -571,13 +571,13 @@ void LLDataPackerBinaryBuffer::dumpBufferToLog() if (cur_line_pos >= 16) { cur_line_pos = 0; - llwarns << "Offset:" << std::hex << cur_line*16 << std::dec << " Data:" << line_buffer << llendl; + LL_WARNS() << "Offset:" << std::hex << cur_line*16 << std::dec << " Data:" << line_buffer << LL_ENDL; cur_line++; } } if (cur_line_pos) { - llwarns << "Offset:" << std::hex << cur_line*16 << std::dec << " Data:" << line_buffer << llendl; + LL_WARNS() << "Offset:" << std::hex << cur_line*16 << std::dec << " Data:" << line_buffer << LL_ENDL; } } @@ -608,7 +608,7 @@ BOOL LLDataPackerAsciiBuffer::packString(const std::string& value, const char *n { // *NOTE: I believe we need to mark a failure bit at this point. numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packString: string truncated: " << value << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packString: string truncated: " << value << LL_ENDL; } mCurBufferp += numCopied; return success; @@ -647,7 +647,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packBinaryData: number truncated: " << size << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryData: number truncated: " << size << LL_ENDL; } mCurBufferp += numCopied; @@ -660,7 +660,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packBinaryData: data truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryData: data truncated: " << LL_ENDL; bBufferFull = TRUE; } mCurBufferp += numCopied; @@ -672,7 +672,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryData(const U8 *value, S32 size, const ch if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packBinaryData: newline truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryData: newline truncated: " << LL_ENDL; } mCurBufferp += numCopied; } @@ -734,7 +734,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, con if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packBinaryDataFixed: data truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryDataFixed: data truncated: " << LL_ENDL; bBufferFull = TRUE; } mCurBufferp += numCopied; @@ -746,7 +746,7 @@ BOOL LLDataPackerAsciiBuffer::packBinaryDataFixed(const U8 *value, S32 size, con if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packBinaryDataFixed: newline truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packBinaryDataFixed: newline truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -813,7 +813,7 @@ BOOL LLDataPackerAsciiBuffer::packU8(const U8 value, const char *name) if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packU8: val truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packU8: val truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -860,7 +860,7 @@ BOOL LLDataPackerAsciiBuffer::packU16(const U16 value, const char *name) if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packU16: val truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packU16: val truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -907,7 +907,7 @@ BOOL LLDataPackerAsciiBuffer::packU32(const U32 value, const char *name) if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packU32: val truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packU32: val truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -951,7 +951,7 @@ BOOL LLDataPackerAsciiBuffer::packS32(const S32 value, const char *name) if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packS32: val truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packS32: val truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -995,7 +995,7 @@ BOOL LLDataPackerAsciiBuffer::packF32(const F32 value, const char *name) if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packF32: val truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packF32: val truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -1039,7 +1039,7 @@ BOOL LLDataPackerAsciiBuffer::packColor4(const LLColor4 &value, const char *name if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packColor4: truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packColor4: truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -1082,7 +1082,7 @@ BOOL LLDataPackerAsciiBuffer::packColor4U(const LLColor4U &value, const char *na if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packColor4U: truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packColor4U: truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -1132,7 +1132,7 @@ BOOL LLDataPackerAsciiBuffer::packVector2(const LLVector2 &value, const char *na if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packVector2: truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packVector2: truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -1176,7 +1176,7 @@ BOOL LLDataPackerAsciiBuffer::packVector3(const LLVector3 &value, const char *na if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packVector3: truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packVector3: truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -1219,7 +1219,7 @@ BOOL LLDataPackerAsciiBuffer::packVector4(const LLVector4 &value, const char *na if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packVector4: truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packVector4: truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -1266,7 +1266,7 @@ BOOL LLDataPackerAsciiBuffer::packUUID(const LLUUID &value, const char *name) if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::packUUID: truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::packUUID: truncated: " << LL_ENDL; success = FALSE; } mCurBufferp += numCopied; @@ -1292,7 +1292,7 @@ BOOL LLDataPackerAsciiBuffer::unpackUUID(LLUUID &value, const char *name) void LLDataPackerAsciiBuffer::dump() { - llinfos << "Buffer: " << mBufferp << llendl; + LL_INFOS() << "Buffer: " << mBufferp << LL_ENDL; } void LLDataPackerAsciiBuffer::writeIndentedName(const char *name) @@ -1318,7 +1318,7 @@ void LLDataPackerAsciiBuffer::writeIndentedName(const char *name) if (numCopied < 0 || numCopied > getBufferSize()-getCurrentSize()) { numCopied = getBufferSize()-getCurrentSize(); - llwarns << "LLDataPackerAsciiBuffer::writeIndentedName: truncated: " << llendl; + LL_WARNS() << "LLDataPackerAsciiBuffer::writeIndentedName: truncated: " << LL_ENDL; } mCurBufferp += numCopied; @@ -1347,7 +1347,7 @@ BOOL LLDataPackerAsciiBuffer::getValueStr(const char *name, char *out_value, S32 if (strcmp(keyword, name)) { - llwarns << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << llendl; + LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL; return FALSE; } } @@ -1904,7 +1904,7 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v fpos_t last_pos; if (0 != fgetpos(mFP, &last_pos)) // 0==success for fgetpos { - llwarns << "Data packer failed to fgetpos" << llendl; + LL_WARNS() << "Data packer failed to fgetpos" << LL_ENDL; return FALSE; } @@ -1917,13 +1917,13 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v if (!keyword[0]) { - llwarns << "Data packer could not get the keyword!" << llendl; + LL_WARNS() << "Data packer could not get the keyword!" << LL_ENDL; fsetpos(mFP, &last_pos); return FALSE; } if (strcmp(keyword, name)) { - llwarns << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << llendl; + LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL; fsetpos(mFP, &last_pos); return FALSE; } @@ -1941,12 +1941,12 @@ BOOL LLDataPackerAsciiFile::getValueStr(const char *name, char *out_value, S32 v sscanf(buffer, "%511s %511[^\n]", keyword, value); /* Flawfinder: ignore */ if (!keyword[0]) { - llwarns << "Data packer could not get the keyword!" << llendl; + LL_WARNS() << "Data packer could not get the keyword!" << LL_ENDL; return FALSE; } if (strcmp(keyword, name)) { - llwarns << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << llendl; + LL_WARNS() << "Data packer expecting keyword of type " << name << ", got " << keyword << " instead!" << LL_ENDL; return FALSE; } diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h index b0a638c16eadd7915b643cc0068b62e5a1562c79..5140f56c015c92049648a758f1a1e3a4181ef089 100755 --- a/indra/llmessage/lldatapacker.h +++ b/indra/llmessage/lldatapacker.h @@ -170,6 +170,7 @@ class LLDataPackerBinaryBuffer : public LLDataPacker S32 getBufferSize() const { return mBufferSize; } const U8* getBuffer() const { return mBufferp; } void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != NULL); } + void shift(S32 offset) { reset(); mCurBufferp += offset;} void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = FALSE; } void assignBuffer(U8 *bufferp, S32 size) { @@ -199,8 +200,8 @@ inline BOOL LLDataPackerBinaryBuffer::verifyLength(const S32 data_size, const ch { if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size) { - llwarns << "Buffer overflow in BinaryBuffer length verify, field name " << name << "!" << llendl; - llwarns << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << llendl; + LL_WARNS() << "Buffer overflow in BinaryBuffer length verify, field name " << name << "!" << LL_ENDL; + LL_WARNS() << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << LL_ENDL; return FALSE; } @@ -320,8 +321,8 @@ inline BOOL LLDataPackerAsciiBuffer::verifyLength(const S32 data_size, const cha { if (mWriteEnabled && (mCurBufferp - mBufferp) > mBufferSize - data_size) { - llwarns << "Buffer overflow in AsciiBuffer length verify, field name " << name << "!" << llendl; - llwarns << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << llendl; + LL_WARNS() << "Buffer overflow in AsciiBuffer length verify, field name " << name << "!" << LL_ENDL; + LL_WARNS() << "Current pos: " << (int)(mCurBufferp - mBufferp) << " Buffer size: " << mBufferSize << " Data size: " << data_size << LL_ENDL; return FALSE; } diff --git a/indra/llmessage/lldispatcher.cpp b/indra/llmessage/lldispatcher.cpp index b2dc414a68e8eb42986f58bae961f52764b86499..c40fe0d3891404d0cd1052d56658b50c4012fa0a 100755 --- a/indra/llmessage/lldispatcher.cpp +++ b/indra/llmessage/lldispatcher.cpp @@ -29,6 +29,7 @@ #include "lldispatcher.h" #include <algorithm> +#include <iterator> #include "llstl.h" #include "message.h" @@ -75,7 +76,7 @@ bool LLDispatcher::dispatch( LLDispatchHandler* func = (*it).second; return (*func)(this, name, invoice, strings); } - llwarns << "Unable to find handler for Generic message: " << name << llendl; + LL_WARNS() << "Unable to find handler for Generic message: " << name << LL_ENDL; return false; } diff --git a/indra/llcommon/llextendedstatus.h b/indra/llmessage/llextendedstatus.h similarity index 100% rename from indra/llcommon/llextendedstatus.h rename to indra/llmessage/llextendedstatus.h diff --git a/indra/llmessage/llfiltersd2xmlrpc.cpp b/indra/llmessage/llfiltersd2xmlrpc.cpp index e0ca056a5f698afb11ad860f0be48c2e291cc0a4..d3e195789bf84222a0dc63d5f2ea13233fa53765 100755 --- a/indra/llmessage/llfiltersd2xmlrpc.cpp +++ b/indra/llmessage/llfiltersd2xmlrpc.cpp @@ -80,6 +80,7 @@ #include "llbuffer.h" #include "llbufferstream.h" +#include "llfasttimer.h" #include "llmemorystream.h" #include "llsd.h" #include "llsdserialize.h" @@ -163,12 +164,12 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd) case LLSD::TypeMap: { #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(map) BEGIN" << llendl; + LL_INFOS() << "streamOut(map) BEGIN" << LL_ENDL; #endif ostr << "<struct>"; if(ostr.fail()) { - llinfos << "STREAM FAILURE writing struct" << llendl; + LL_INFOS() << "STREAM FAILURE writing struct" << LL_ENDL; } LLSD::map_const_iterator it = sd.beginMap(); LLSD::map_const_iterator end = sd.endMap(); @@ -179,21 +180,21 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd) streamOut(ostr, (*it).second); if(ostr.fail()) { - llinfos << "STREAM FAILURE writing '" << (*it).first - << "' with sd type " << (*it).second.type() << llendl; + LL_INFOS() << "STREAM FAILURE writing '" << (*it).first + << "' with sd type " << (*it).second.type() << LL_ENDL; } ostr << "</member>"; } ostr << "</struct>"; #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(map) END" << llendl; + LL_INFOS() << "streamOut(map) END" << LL_ENDL; #endif break; } case LLSD::TypeArray: { #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(array) BEGIN" << llendl; + LL_INFOS() << "streamOut(array) BEGIN" << LL_ENDL; #endif ostr << "<array><data>"; LLSD::array_const_iterator it = sd.beginArray(); @@ -203,12 +204,12 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd) streamOut(ostr, *it); if(ostr.fail()) { - llinfos << "STREAM FAILURE writing array element sd type " - << (*it).type() << llendl; + LL_INFOS() << "STREAM FAILURE writing array element sd type " + << (*it).type() << LL_ENDL; } } #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(array) END" << llendl; + LL_INFOS() << "streamOut(array) END" << LL_ENDL; #endif ostr << "</data></array>"; break; @@ -217,31 +218,31 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd) // treat undefined as a bool with a false value. case LLSD::TypeBoolean: #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(bool)" << llendl; + LL_INFOS() << "streamOut(bool)" << LL_ENDL; #endif ostr << "<boolean>" << (sd.asBoolean() ? "1" : "0") << "</boolean>"; break; case LLSD::TypeInteger: #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(int)" << llendl; + LL_INFOS() << "streamOut(int)" << LL_ENDL; #endif ostr << "<i4>" << sd.asInteger() << "</i4>"; break; case LLSD::TypeReal: #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(real)" << llendl; + LL_INFOS() << "streamOut(real)" << LL_ENDL; #endif ostr << "<double>" << sd.asReal() << "</double>"; break; case LLSD::TypeString: #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(string)" << llendl; + LL_INFOS() << "streamOut(string)" << LL_ENDL; #endif ostr << "<string>" << xml_escape_string(sd.asString()) << "</string>"; break; case LLSD::TypeUUID: #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(uuid)" << llendl; + LL_INFOS() << "streamOut(uuid)" << LL_ENDL; #endif // serialize it as a string ostr << "<string>" << sd.asString() << "</string>"; @@ -249,7 +250,7 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd) case LLSD::TypeURI: { #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(uri)" << llendl; + LL_INFOS() << "streamOut(uri)" << LL_ENDL; #endif // serialize it as a string ostr << "<string>" << xml_escape_string(sd.asString()) << "</string>"; @@ -258,7 +259,7 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd) case LLSD::TypeBinary: { #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(binary)" << llendl; + LL_INFOS() << "streamOut(binary)" << LL_ENDL; #endif // this is pretty inefficient, but we'll deal with that // problem when it becomes one. @@ -281,15 +282,15 @@ void LLFilterSD2XMLRPC::streamOut(std::ostream& ostr, const LLSD& sd) } case LLSD::TypeDate: #if LL_SPEW_STREAM_OUT_DEBUGGING - llinfos << "streamOut(date)" << llendl; + LL_INFOS() << "streamOut(date)" << LL_ENDL; #endif // no need to escape this since it will be alpha-numeric. ostr << "<dateTime.iso8601>" << sd.asString() << "</dateTime.iso8601>"; break; default: // unhandled type - llwarns << "Unhandled structured data type: " << sd.type() - << llendl; + LL_WARNS() << "Unhandled structured data type: " << sd.type() + << LL_ENDL; break; } ostr << "</value>"; @@ -308,7 +309,7 @@ LLFilterSD2XMLRPCResponse::~LLFilterSD2XMLRPCResponse() } -static LLFastTimer::DeclareTimer FTM_PROCESS_SD2XMLRPC_RESPONSE("SD2XMLRPC Response"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_SD2XMLRPC_RESPONSE("SD2XMLRPC Response"); // virtual LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl( const LLChannelDescriptors& channels, @@ -317,7 +318,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_SD2XMLRPC_RESPONSE); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_SD2XMLRPC_RESPONSE); PUMP_DEBUG; // This pipe does not work if it does not have everyting. This @@ -360,7 +361,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl( } else { - llwarns << "Unable to determine the type of LLSD response." << llendl; + LL_WARNS() << "Unable to determine the type of LLSD response." << LL_ENDL; } PUMP_DEBUG; return rv; @@ -385,7 +386,7 @@ LLFilterSD2XMLRPCRequest::~LLFilterSD2XMLRPCRequest() { } -static LLFastTimer::DeclareTimer FTM_PROCESS_SD2XMLRPC_REQUEST("S22XMLRPC Request"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_SD2XMLRPC_REQUEST("S22XMLRPC Request"); // virtual LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl( @@ -395,14 +396,14 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_SD2XMLRPC_REQUEST); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_SD2XMLRPC_REQUEST); // This pipe does not work if it does not have everyting. This // could be addressed by making a stream parser for llsd which // handled partial information. PUMP_DEBUG; if(!eos) { - llinfos << "!eos" << llendl; + LL_INFOS() << "!eos" << LL_ENDL; return STATUS_BREAK; } @@ -412,7 +413,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl( LLSDSerialize::fromNotation(sd, stream, buffer->count(channels.in())); if(stream.fail()) { - llinfos << "STREAM FAILURE reading structure data." << llendl; + LL_INFOS() << "STREAM FAILURE reading structure data." << LL_ENDL; } PUMP_DEBUG; @@ -434,7 +435,7 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl( } if(method.empty()) { - llwarns << "SD -> XML Request no method found." << llendl; + LL_WARNS() << "SD -> XML Request no method found." << LL_ENDL; return STATUS_ERROR; } @@ -445,13 +446,13 @@ LLIOPipe::EStatus LLFilterSD2XMLRPCRequest::process_impl( ostream.precision(DEFAULT_PRECISION); if(ostream.fail()) { - llinfos << "STREAM FAILURE setting precision" << llendl; + LL_INFOS() << "STREAM FAILURE setting precision" << LL_ENDL; } ostream << XML_HEADER << XMLRPC_REQUEST_HEADER_1 << xml_escape_string(method) << XMLRPC_REQUEST_HEADER_2; if(ostream.fail()) { - llinfos << "STREAM FAILURE writing method headers" << llendl; + LL_INFOS() << "STREAM FAILURE writing method headers" << LL_ENDL; } switch(param_sd.type()) { @@ -518,7 +519,7 @@ LLIOPipe::EStatus stream_out(std::ostream& ostr, XMLRPC_VALUE value) break; } case xmlrpc_type_boolean: - //lldebugs << "stream_out() bool" << llendl; + //LL_DEBUGS() << "stream_out() bool" << LL_ENDL; ostr << " " << (XMLRPC_GetValueBoolean(value) ? "true" : "false"); break; case xmlrpc_type_datetime: @@ -526,23 +527,23 @@ LLIOPipe::EStatus stream_out(std::ostream& ostr, XMLRPC_VALUE value) break; case xmlrpc_type_double: ostr << " r" << XMLRPC_GetValueDouble(value); - //lldebugs << "stream_out() double" << XMLRPC_GetValueDouble(value) - // << llendl; + //LL_DEBUGS() << "stream_out() double" << XMLRPC_GetValueDouble(value) + // << LL_ENDL; break; case xmlrpc_type_int: ostr << " i" << XMLRPC_GetValueInt(value); - //lldebugs << "stream_out() integer:" << XMLRPC_GetValueInt(value) - // << llendl; + //LL_DEBUGS() << "stream_out() integer:" << XMLRPC_GetValueInt(value) + // << LL_ENDL; break; case xmlrpc_type_string: - //lldebugs << "stream_out() string: " << str << llendl; + //LL_DEBUGS() << "stream_out() string: " << str << LL_ENDL; ostr << " s(" << XMLRPC_GetValueStringLen(value) << ")'" << XMLRPC_GetValueString(value) << "'"; break; case xmlrpc_type_array: // vector case xmlrpc_type_mixed: // vector { - //lldebugs << "stream_out() array" << llendl; + //LL_DEBUGS() << "stream_out() array" << LL_ENDL; ostr << " ["; U32 needs_comma = 0; XMLRPC_VALUE current = XMLRPC_VectorRewind(value); @@ -557,7 +558,7 @@ LLIOPipe::EStatus stream_out(std::ostream& ostr, XMLRPC_VALUE value) } case xmlrpc_type_struct: // still vector { - //lldebugs << "stream_out() struct" << llendl; + //LL_DEBUGS() << "stream_out() struct" << LL_ENDL; ostr << " {"; std::string name; U32 needs_comma = 0; @@ -577,7 +578,7 @@ LLIOPipe::EStatus stream_out(std::ostream& ostr, XMLRPC_VALUE value) case xmlrpc_type_none: default: status = LLIOPipe::STATUS_ERROR; - llwarns << "Found an empty xmlrpc type.." << llendl; + LL_WARNS() << "Found an empty xmlrpc type.." << LL_ENDL; // not much we can do here... break; }; @@ -592,7 +593,7 @@ LLFilterXMLRPCResponse2LLSD::~LLFilterXMLRPCResponse2LLSD() { } -static LLFastTimer::DeclareTimer FTM_PROCESS_XMLRPC2LLSD_RESPONSE("XMLRPC2LLSD Response"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_XMLRPC2LLSD_RESPONSE("XMLRPC2LLSD Response"); LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl( const LLChannelDescriptors& channels, @@ -601,7 +602,7 @@ LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_XMLRPC2LLSD_RESPONSE); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_XMLRPC2LLSD_RESPONSE); PUMP_DEBUG; if(!eos) return STATUS_BREAK; @@ -617,7 +618,7 @@ LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl( buf[bytes] = '\0'; buffer->readAfter(channels.in(), NULL, (U8*)buf, bytes); - //lldebugs << "xmlrpc response: " << buf << llendl; + //LL_DEBUGS() << "xmlrpc response: " << buf << LL_ENDL; PUMP_DEBUG; XMLRPC_REQUEST response = XMLRPC_REQUEST_FromXML( @@ -626,7 +627,7 @@ LLIOPipe::EStatus LLFilterXMLRPCResponse2LLSD::process_impl( NULL); if(!response) { - llwarns << "XML -> SD Response unable to parse xml." << llendl; + LL_WARNS() << "XML -> SD Response unable to parse xml." << LL_ENDL; delete[] buf; return STATUS_ERROR; } @@ -678,7 +679,7 @@ LLFilterXMLRPCRequest2LLSD::~LLFilterXMLRPCRequest2LLSD() { } -static LLFastTimer::DeclareTimer FTM_PROCESS_XMLRPC2LLSD_REQUEST("XMLRPC2LLSD Request"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_XMLRPC2LLSD_REQUEST("XMLRPC2LLSD Request"); LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl( const LLChannelDescriptors& channels, buffer_ptr_t& buffer, @@ -686,7 +687,7 @@ LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_XMLRPC2LLSD_REQUEST); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_XMLRPC2LLSD_REQUEST); PUMP_DEBUG; if(!eos) return STATUS_BREAK; if(!buffer) return STATUS_ERROR; @@ -701,7 +702,7 @@ LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl( buf[bytes] = '\0'; buffer->readAfter(channels.in(), NULL, (U8*)buf, bytes); - //lldebugs << "xmlrpc request: " << buf << llendl; + //LL_DEBUGS() << "xmlrpc request: " << buf << LL_ENDL; // Check the value in the buffer. XMLRPC_REQUEST_FromXML will report a error code 4 if // values that are less than 0x20 are passed to it, except @@ -728,7 +729,7 @@ LLIOPipe::EStatus LLFilterXMLRPCRequest2LLSD::process_impl( NULL); if(!request) { - llwarns << "XML -> SD Request process parse error." << llendl; + LL_WARNS() << "XML -> SD Request process parse error." << LL_ENDL; delete[] buf; return STATUS_ERROR; } diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp index 61a84de8e366f2113c609f877691cb64ce8195e0..63c15f0d5ee7bb911e5008ef705cd62b7cc0f8bd 100755 --- a/indra/llmessage/llhost.cpp +++ b/indra/llmessage/llhost.cpp @@ -84,18 +84,18 @@ std::string LLHost::getHostName() const hostent* he; if (INVALID_HOST_IP_ADDRESS == mIP) { - llwarns << "LLHost::getHostName() : Invalid IP address" << llendl; + LL_WARNS() << "LLHost::getHostName() : Invalid IP address" << LL_ENDL; return std::string(); } he = gethostbyaddr((char *)&mIP, sizeof(mIP), AF_INET); if (!he) { #if LL_WINDOWS - llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " - << WSAGetLastError() << llendl; + LL_WARNS() << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " + << WSAGetLastError() << LL_ENDL; #else - llwarns << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " - << h_errno << llendl; + LL_WARNS() << "LLHost::getHostName() : Couldn't find host name for address " << mIP << ", Error: " + << h_errno << LL_ENDL; #endif return std::string(); } @@ -136,17 +136,17 @@ BOOL LLHost::setHostByName(const std::string& hostname) switch(error_number) { case TRY_AGAIN: // XXX how to handle this case? - llwarns << "LLHost::setAddress(): try again" << llendl; + LL_WARNS() << "LLHost::setAddress(): try again" << LL_ENDL; break; case HOST_NOT_FOUND: case NO_ADDRESS: // NO_DATA - llwarns << "LLHost::setAddress(): host not found" << llendl; + LL_WARNS() << "LLHost::setAddress(): host not found" << LL_ENDL; break; case NO_RECOVERY: - llwarns << "LLHost::setAddress(): unrecoverable error" << llendl; + LL_WARNS() << "LLHost::setAddress(): unrecoverable error" << LL_ENDL; break; default: - llwarns << "LLHost::setAddress(): unknown error - " << error_number << llendl; + LL_WARNS() << "LLHost::setAddress(): unknown error - " << error_number << LL_ENDL; break; } return FALSE; diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp index 7dcf160c9ba9c3ccb8d88a4b84d09cdbbac7d01f..095da6f0f9be7f37da6a59ae7d032f3eb1c1db7c 100755 --- a/indra/llmessage/llhttpassetstorage.cpp +++ b/indra/llmessage/llhttpassetstorage.cpp @@ -36,6 +36,7 @@ #include "llproxy.h" #include "llvfile.h" #include "llvfs.h" +#include "llxfer.h" #ifdef LL_STANDALONE # include <zlib.h> @@ -43,6 +44,8 @@ # include "zlib/zlib.h" #endif +const char* const LOCAL_ASSET_URL_FORMAT = "http://%s:12041/asset"; + const U32 MAX_RUNNING_REQUESTS = 1; const F32 MAX_PROCESSING_TIME = 0.005f; const S32 CURL_XFER_BUFFER_SIZE = 65536; @@ -273,7 +276,7 @@ void LLHTTPAssetRequest::setupCurlHandle() } else { - llerrs << "LLHTTPAssetRequest::setupCurlHandle - No asset storage associated with this request!" << llendl; + LL_ERRS() << "LLHTTPAssetRequest::setupCurlHandle - No asset storage associated with this request!" << LL_ENDL; } } @@ -287,7 +290,7 @@ void LLHTTPAssetRequest::cleanupCurlHandle() } else { - llerrs << "LLHTTPAssetRequest::~LLHTTPAssetRequest - No asset storage associated with this request!" << llendl; + LL_ERRS() << "LLHTTPAssetRequest::~LLHTTPAssetRequest - No asset storage associated with this request!" << LL_ENDL; } mCurlHandle = NULL; } @@ -309,7 +312,7 @@ void LLHTTPAssetRequest::prepareCompressedUpload() if (r != Z_OK) { - llerrs << "LLHTTPAssetRequest::prepareCompressedUpload defalateInit2() failed" << llendl; + LL_ERRS() << "LLHTTPAssetRequest::prepareCompressedUpload defalateInit2() failed" << LL_ENDL; } mZInitialized = true; @@ -324,10 +327,10 @@ void LLHTTPAssetRequest::finishCompressedUpload() { if (mZInitialized) { - llinfos << "LLHTTPAssetRequest::finishCompressedUpload: " + LL_INFOS() << "LLHTTPAssetRequest::finishCompressedUpload: " << "read " << mZStream.total_in << " byte asset file, " << "uploaded " << mZStream.total_out << " byte compressed asset" - << llendl; + << LL_ENDL; deflateEnd(&mZStream); delete[] mZInputBuffer; @@ -365,8 +368,8 @@ size_t LLHTTPAssetRequest::readCompressedData(void* data, size_t size) { if (r < 0) { - llwarns << "LLHTTPAssetRequest::readCompressedData: deflate returned error code " - << (S32) r << llendl; + LL_WARNS() << "LLHTTPAssetRequest::readCompressedData: deflate returned error code " + << (S32) r << LL_ENDL; } break; } @@ -453,7 +456,7 @@ void LLHTTPAssetStorage::storeAssetData( bool store_local, const LLUUID& requesting_agent_id, bool user_waiting, - F64 timeout) + F64Seconds timeout) { if (mVFS->getExists(uuid, type)) // VFS treats nonexistant and zero-length identically { @@ -493,7 +496,7 @@ void LLHTTPAssetStorage::storeAssetData( } else { - llwarns << "AssetStorage: attempt to upload non-existent vfile " << uuid << ":" << LLAssetType::lookup(type) << llendl; + LL_WARNS() << "AssetStorage: attempt to upload non-existent vfile " << uuid << ":" << LLAssetType::lookup(type) << LL_ENDL; if (callback) { // LLAssetStorage metric: Zero size VFS @@ -513,9 +516,9 @@ void LLHTTPAssetStorage::storeAssetData( bool temp_file, bool is_priority, bool user_waiting, - F64 timeout) + F64Seconds timeout) { - llinfos << "LLAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl; + LL_INFOS() << "LLAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL; LLLegacyAssetRequest *legacy = new LLLegacyAssetRequest; @@ -685,15 +688,15 @@ bool LLHTTPAssetStorage::deletePendingRequest(LLAssetStorage::ERequestType rt, } - llinfos << "Asset " << getRequestName(rt) << " request for " + LL_INFOS() << "Asset " << getRequestName(rt) << " request for " << asset_id << "." << LLAssetType::lookup(asset_type) << " removed from curl and placed at the end of the pending queue." - << llendl; + << LL_ENDL; } else { - llwarns << "Unable to find pending " << getRequestName(rt) << " request for " - << asset_id << "." << LLAssetType::lookup(asset_type) << llendl; + LL_WARNS() << "Unable to find pending " << getRequestName(rt) << " request for " + << asset_id << "." << LLAssetType::lookup(asset_type) << LL_ENDL; } } delete req; @@ -800,7 +803,7 @@ void LLHTTPAssetStorage::checkForTimeouts() } else { - llinfos << "Requesting " << new_req->mURLBuffer << llendl; + LL_INFOS() << "Requesting " << new_req->mURLBuffer << LL_ENDL; } } @@ -864,10 +867,10 @@ void LLHTTPAssetStorage::checkForTimeouts() // Get the uncompressed file size. LLVFile file(mVFS,new_req->getUUID(),new_req->getType()); S32 size = file.getSize(); - llinfos << "Requesting PUT " << new_req->mURLBuffer << ", asset size: " << size << " bytes" << llendl; + LL_INFOS() << "Requesting PUT " << new_req->mURLBuffer << ", asset size: " << size << " bytes" << LL_ENDL; if (size == 0) { - llwarns << "Rejecting zero size PUT request!" << llendl; + LL_WARNS() << "Rejecting zero size PUT request!" << LL_ENDL; new_req->cleanupCurlHandle(); deletePendingRequest(RT_UPLOAD, new_req->getType(), new_req->getUUID()); } @@ -913,12 +916,12 @@ void LLHTTPAssetStorage::checkForTimeouts() // Get the uncompressed file size. S32 size = file.getSize(); - llinfos << "TAT: LLHTTPAssetStorage::checkForTimeouts() : pending local!" - << " Requesting PUT " << new_req->mURLBuffer << ", asset size: " << size << " bytes" << llendl; + LL_INFOS() << "TAT: LLHTTPAssetStorage::checkForTimeouts() : pending local!" + << " Requesting PUT " << new_req->mURLBuffer << ", asset size: " << size << " bytes" << LL_ENDL; if (size == 0) { - llwarns << "Rejecting zero size PUT request!" << llendl; + LL_WARNS() << "Rejecting zero size PUT request!" << LL_ENDL; new_req->cleanupCurlHandle(); deletePendingRequest(RT_UPLOAD, new_req->getType(), new_req->getUUID()); } @@ -955,7 +958,7 @@ void LLHTTPAssetStorage::checkForTimeouts() || curl_result == HTTP_PUT_OK || curl_result == HTTP_NO_CONTENT)) { - llinfos << "Success uploading " << req->getUUID() << " to " << req->mURLBuffer << llendl; + LL_INFOS() << "Success uploading " << req->getUUID() << " to " << req->mURLBuffer << LL_ENDL; if (RT_LOCALUPLOAD == req->mRequestType) { addTempAssetData(req->getUUID(), req->mRequestingAgentID, mHostName); @@ -966,8 +969,8 @@ void LLHTTPAssetStorage::checkForTimeouts() curl_result == HTTP_SERVER_BAD_GATEWAY || curl_result == HTTP_SERVER_TEMP_UNAVAILABLE) { - llwarns << "Re-requesting upload for " << req->getUUID() << ". Received upload error to " << req->mURLBuffer << - " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl; + LL_WARNS() << "Re-requesting upload for " << req->getUUID() << ". Received upload error to " << req->mURLBuffer << + " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << LL_ENDL; ////HACK (probably) I am sick of this getting requeued and driving me mad. //if (req->mIsUserWaiting) @@ -977,8 +980,8 @@ void LLHTTPAssetStorage::checkForTimeouts() } else { - llwarns << "Failure uploading " << req->getUUID() << " to " << req->mURLBuffer << - " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl; + LL_WARNS() << "Failure uploading " << req->getUUID() << " to " << req->mURLBuffer << + " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << LL_ENDL; xfer_result = LL_ERR_ASSET_REQUEST_FAILED; } @@ -1000,7 +1003,7 @@ void LLHTTPAssetStorage::checkForTimeouts() { if (req->mVFile && req->mVFile->getSize() > 0) { - llinfos << "Success downloading " << req->mURLBuffer << ", size " << req->mVFile->getSize() << llendl; + LL_INFOS() << "Success downloading " << req->mURLBuffer << ", size " << req->mVFile->getSize() << LL_ENDL; req->mVFile->rename(req->getUUID(), req->getType()); } @@ -1008,15 +1011,15 @@ void LLHTTPAssetStorage::checkForTimeouts() { // *TODO: if this actually indicates a bad asset on the server // (not certain at this point), then delete it - llwarns << "Found " << req->mURLBuffer << " to be zero size" << llendl; + LL_WARNS() << "Found " << req->mURLBuffer << " to be zero size" << LL_ENDL; xfer_result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE; } } else { // KLW - TAT See if an avatar owns this texture, and if so request re-upload. - llwarns << "Failure downloading " << req->mURLBuffer << - " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl; + LL_WARNS() << "Failure downloading " << req->mURLBuffer << + " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << LL_ENDL; xfer_result = (curl_result == HTTP_MISSING) ? LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE : LL_ERR_ASSET_REQUEST_FAILED; @@ -1061,7 +1064,7 @@ void LLHTTPAssetStorage::bumpTimedOutUploads() { bool user_waiting=FALSE; - F64 mt_secs = LLMessageSystem::getMessageTimeSeconds(); + F64Seconds mt_secs = LLMessageSystem::getMessageTimeSeconds(); if (mPendingUploads.size()) { @@ -1088,10 +1091,10 @@ void LLHTTPAssetStorage::bumpTimedOutUploads() if ( req->mTimeout < (mt_secs - req->mTime) ) { - llwarns << "Asset upload request timed out for " + LL_WARNS() << "Asset upload request timed out for " << req->getUUID() << "." << LLAssetType::lookup(req->getType()) - << ", bumping to the back of the line!" << llendl; + << ", bumping to the back of the line!" << LL_ENDL; deletePendingRequest(RT_UPLOAD, req->getType(), req->getUUID()); } @@ -1103,7 +1106,7 @@ size_t LLHTTPAssetStorage::curlDownCallback(void *data, size_t size, size_t nmem { if (!gAssetStorage) { - llwarns << "Missing gAssetStorage, aborting curl download callback!" << llendl; + LL_WARNS() << "Missing gAssetStorage, aborting curl download callback!" << LL_ENDL; return 0; } S32 bytes = (S32)(size * nmemb); @@ -1133,7 +1136,7 @@ size_t LLHTTPAssetStorage::curlUpCallback(void *data, size_t size, size_t nmemb, { if (!gAssetStorage) { - llwarns << "Missing gAssetStorage, aborting curl download callback!" << llendl; + LL_WARNS() << "Missing gAssetStorage, aborting curl download callback!" << LL_ENDL; return 0; } CURL *curl_handle = (CURL *)user_data; @@ -1168,12 +1171,12 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse { // *NOTE: There is no guarantee that the uuid and the asset_type match // - not that it matters. - Doug - lldebugs << "LLHTTPAssetStorage::getURLToFile() - " << url << llendl; + LL_DEBUGS() << "LLHTTPAssetStorage::getURLToFile() - " << url << LL_ENDL; FILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ if (! fp) { - llwarns << "Failed to open " << filename << " for writing" << llendl; + LL_WARNS() << "Failed to open " << filename << " for writing" << LL_ENDL; return LL_ERR_ASSET_REQUEST_FAILED; } @@ -1187,7 +1190,7 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse curl_easy_setopt(req.mCurlHandle, CURLOPT_WRITEDATA, req.mCurlHandle); curl_multi_add_handle(mCurlMultiHandle, req.mCurlHandle); - llinfos << "Requesting as file " << req.mURLBuffer << llendl; + LL_INFOS() << "Requesting as file " << req.mURLBuffer << LL_ENDL; // braindead curl loop int queue_length; @@ -1212,7 +1215,7 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse } else if (timeout.hasExpired()) { - llwarns << "Request for " << url << " has timed out." << llendl; + LL_WARNS() << "Request for " << url << " has timed out." << LL_ENDL; success = false; xfer_result = LL_ERR_ASSET_REQUEST_FAILED; break; @@ -1230,19 +1233,19 @@ S32 LLHTTPAssetStorage::getURLToFile(const LLUUID& uuid, LLAssetType::EType asse if (size > 0) { // everything seems to be in order - llinfos << "Success downloading " << req.mURLBuffer << " to file, size " << size << llendl; + LL_INFOS() << "Success downloading " << req.mURLBuffer << " to file, size " << size << LL_ENDL; } else { - llwarns << "Found " << req.mURLBuffer << " to be zero size" << llendl; + LL_WARNS() << "Found " << req.mURLBuffer << " to be zero size" << LL_ENDL; xfer_result = LL_ERR_ASSET_REQUEST_FAILED; } } else { xfer_result = curl_result == HTTP_MISSING ? LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE : LL_ERR_ASSET_REQUEST_FAILED; - llinfos << "Failure downloading " << req.mURLBuffer << - " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << llendl; + LL_INFOS() << "Failure downloading " << req.mURLBuffer << + " with result " << curl_easy_strerror(curl_msg->data.result) << ", http result " << curl_result << LL_ENDL; } } @@ -1264,7 +1267,7 @@ size_t LLHTTPAssetStorage::curlFileDownCallback(void *data, size_t size, size_t if (! req->mFP) { - llwarns << "Missing mFP, aborting curl file download callback!" << llendl; + LL_WARNS() << "Missing mFP, aborting curl file download callback!" << LL_ENDL; return 0; } @@ -1311,7 +1314,7 @@ void LLHTTPAssetStorage::addRunningRequest(ERequestType rt, LLHTTPAssetRequest* } else { - llerrs << "LLHTTPAssetStorage::addRunningRequest - Request is not an upload OR download, this is bad!" << llendl; + LL_ERRS() << "LLHTTPAssetStorage::addRunningRequest - Request is not an upload OR download, this is bad!" << LL_ENDL; } } @@ -1324,7 +1327,7 @@ void LLHTTPAssetStorage::removeRunningRequest(ERequestType rt, LLHTTPAssetReques } else { - llerrs << "LLHTTPAssetStorage::removeRunningRequest - Destroyed request is not an upload OR download, this is bad!" << llendl; + LL_ERRS() << "LLHTTPAssetStorage::removeRunningRequest - Destroyed request is not an upload OR download, this is bad!" << LL_ENDL; } } @@ -1333,7 +1336,7 @@ void LLHTTPAssetStorage::addTempAssetData(const LLUUID& asset_id, const LLUUID& { if (agent_id.isNull() || asset_id.isNull()) { - llwarns << "TAT: addTempAssetData bad id's asset_id: " << asset_id << " agent_id: " << agent_id << llendl; + LL_WARNS() << "TAT: addTempAssetData bad id's asset_id: " << asset_id << " agent_id: " << agent_id << LL_ENDL; return; } @@ -1434,26 +1437,26 @@ void LLHTTPAssetStorage::dumpTempAssetData(const LLUUID& avatar_id) const if (avatar_id.isNull() || avatar_id == temp_asset_data.mAgentID) { - llinfos << "TAT: dump agent " << temp_asset_data.mAgentID + LL_INFOS() << "TAT: dump agent " << temp_asset_data.mAgentID << " texture " << temp_asset_data.mAssetID << " host " << temp_asset_data.mHostName - << llendl; + << LL_ENDL; count++; } } if (avatar_id.isNull()) { - llinfos << "TAT: dumped " << count << " entries for all avatars" << llendl; + LL_INFOS() << "TAT: dumped " << count << " entries for all avatars" << LL_ENDL; } else { - llinfos << "TAT: dumped " << count << " entries for avatar " << avatar_id << llendl; + LL_INFOS() << "TAT: dumped " << count << " entries for avatar " << avatar_id << LL_ENDL; } } void LLHTTPAssetStorage::clearTempAssetData() { - llinfos << "TAT: Clearing temp asset data map" << llendl; + LL_INFOS() << "TAT: Clearing temp asset data map" << LL_ENDL; mTempAssets.clear(); } diff --git a/indra/llmessage/llhttpassetstorage.h b/indra/llmessage/llhttpassetstorage.h index f743ccf0acf34830ace26ff6b76a9f605859d243..783e95cac627bedf83d2946de83ab1e32dba4fe1 100755 --- a/indra/llmessage/llhttpassetstorage.h +++ b/indra/llmessage/llhttpassetstorage.h @@ -69,7 +69,7 @@ class LLHTTPAssetStorage : public LLAssetStorage bool store_local = false, const LLUUID& requesting_agent_id = LLUUID::null, bool user_waiting=FALSE, - F64 timeout=LL_ASSET_STORAGE_TIMEOUT); + F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); virtual void storeAssetData( const std::string& filename, @@ -80,7 +80,7 @@ class LLHTTPAssetStorage : public LLAssetStorage bool temp_file, bool is_priority, bool user_waiting=FALSE, - F64 timeout=LL_ASSET_STORAGE_TIMEOUT); + F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); virtual LLSD getPendingDetails(ERequestType rt, LLAssetType::EType asset_type, diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 11648717adbd9f77d59e9d7c0e13b62beab1799c..31a499b370c57725c36d502ac7608d7e74436d9e 100755 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -247,8 +247,8 @@ static void request( req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req); - lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " " - << headers << llendl; + LL_DEBUGS() << LLURLRequest::actionAsVerb(method) << " " << url << " " + << headers << LL_ENDL; // Insert custom headers if the caller sent any if (headers.isMap()) @@ -275,7 +275,7 @@ static void request( req->useProxy(false); } header << iter->first << ": " << iter->second.asString() ; - lldebugs << "header = " << header.str() << llendl; + LL_DEBUGS() << "header = " << header.str() << LL_ENDL; req->addHeader(header.str().c_str()); } } @@ -443,7 +443,7 @@ static LLSD blocking_request( const F32 timeout = 5 ) { - lldebugs << "blockingRequest of " << url << llendl; + LL_DEBUGS() << "blockingRequest of " << url << LL_ENDL; char curl_error_buffer[CURL_ERROR_SIZE] = "\0"; CURL* curlp = LLCurl::newEasyHandle(); llassert_always(curlp != NULL) ; @@ -474,7 +474,7 @@ static LLSD blocking_request( { std::ostringstream header; header << iter->first << ": " << iter->second.asString() ; - lldebugs << "header = " << header.str() << llendl; + LL_DEBUGS() << "header = " << header.str() << LL_ENDL; headers_list = curl_slist_append(headers_list, header.str().c_str()); } } @@ -503,12 +503,12 @@ static LLSD blocking_request( } // * Do the action using curl, handle results - lldebugs << "HTTP body: " << body_str << llendl; + LL_DEBUGS() << "HTTP body: " << body_str << LL_ENDL; headers_list = curl_slist_append(headers_list, "Accept: application/llsd+xml"); CURLcode curl_result = curl_easy_setopt(curlp, CURLOPT_HTTPHEADER, headers_list); if ( curl_result != CURLE_OK ) { - llinfos << "Curl is hosed - can't add headers" << llendl; + LL_INFOS() << "Curl is hosed - can't add headers" << LL_ENDL; } LLSD response = LLSD::emptyMap(); @@ -520,19 +520,19 @@ static LLSD blocking_request( if ( http_status != 404 && (http_status != 200 || curl_success != 0) ) { // We expect 404s, don't spam for them. - llwarns << "CURL REQ URL: " << url << llendl; - llwarns << "CURL REQ METHOD TYPE: " << method << llendl; - llwarns << "CURL REQ HEADERS: " << headers.asString() << llendl; - llwarns << "CURL REQ BODY: " << body_str << llendl; - llwarns << "CURL HTTP_STATUS: " << http_status << llendl; - llwarns << "CURL ERROR: " << curl_error_buffer << llendl; - llwarns << "CURL ERROR BODY: " << http_buffer.asString() << llendl; + LL_WARNS() << "CURL REQ URL: " << url << LL_ENDL; + LL_WARNS() << "CURL REQ METHOD TYPE: " << method << LL_ENDL; + LL_WARNS() << "CURL REQ HEADERS: " << headers.asString() << LL_ENDL; + LL_WARNS() << "CURL REQ BODY: " << body_str << LL_ENDL; + LL_WARNS() << "CURL HTTP_STATUS: " << http_status << LL_ENDL; + LL_WARNS() << "CURL ERROR: " << curl_error_buffer << LL_ENDL; + LL_WARNS() << "CURL ERROR BODY: " << http_buffer.asString() << LL_ENDL; response["body"] = http_buffer.asString(); } else { response["body"] = http_buffer.asLLSD(); - lldebugs << "CURL response: " << http_buffer.asString() << llendl; + LL_DEBUGS() << "CURL response: " << http_buffer.asString() << LL_ENDL; } if(headers_list) diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp index f6ccb5bddab1f4d3dcd653f58e7c7f1f8eda0361..f1f4a95005a8cbd9c7b30f94a7ac57b204898204 100755 --- a/indra/llmessage/llhttpnode.cpp +++ b/indra/llmessage/llhttpnode.cpp @@ -172,7 +172,7 @@ LLSD LLHTTPNode::simpleDel(const LLSD&) const // virtual void LLHTTPNode::options(ResponsePtr response, const LLSD& context) const { - //llinfos << "options context: " << context << llendl; + //LL_INFOS() << "options context: " << context << LL_ENDL; // default implementation constructs an url to the documentation. std::string host( @@ -238,10 +238,10 @@ const LLHTTPNode* LLHTTPNode::traverse( LLHTTPNode* child = node->getChild(*iter, context); if(!child) { - lldebugs << "LLHTTPNode::traverse: Couldn't find '" << *iter << "'" << llendl; + LL_DEBUGS() << "LLHTTPNode::traverse: Couldn't find '" << *iter << "'" << LL_ENDL; break; } - lldebugs << "LLHTTPNode::traverse: Found '" << *iter << "'" << llendl; + LL_DEBUGS() << "LLHTTPNode::traverse: Found '" << *iter << "'" << LL_ENDL; node = child; } @@ -275,8 +275,8 @@ void LLHTTPNode::addNode(const std::string& path, LLHTTPNode* nodeToAdd) if (iter == end) { - llwarns << "LLHTTPNode::addNode: already a node that handles " - << path << llendl; + LL_WARNS() << "LLHTTPNode::addNode: already a node that handles " + << path << LL_ENDL; return; } diff --git a/indra/llmessage/llhttpsender.cpp b/indra/llmessage/llhttpsender.cpp index d0bd343db6ddbb2f0b4c44061bf7863263335359..5363088d794cc80062d6eca530373ad78d11b6b9 100755 --- a/indra/llmessage/llhttpsender.cpp +++ b/indra/llmessage/llhttpsender.cpp @@ -54,14 +54,14 @@ void LLHTTPSender::send(const LLHost& host, const std::string& name, // Default implementation inserts sender, message and sends HTTP POST std::ostringstream stream; stream << "http://" << host << "/trusted-message/" << name; - llinfos << "LLHTTPSender::send: POST to " << stream.str() << llendl; + LL_INFOS() << "LLHTTPSender::send: POST to " << stream.str() << LL_ENDL; LLHTTPClient::post(stream.str(), body, response); } //static void LLHTTPSender::setSender(const LLHost& host, LLHTTPSender* sender) { - llinfos << "LLHTTPSender::setSender " << host << llendl; + LL_INFOS() << "LLHTTPSender::setSender " << host << LL_ENDL; senderMap[host] = sender; } diff --git a/indra/llmessage/llinstantmessage.cpp b/indra/llmessage/llinstantmessage.cpp index b0275c161b913be2c17d6fa1a130b4e607dde327..b7f3e6e4f7622d416cd6a7932772a06b7b733843 100755 --- a/indra/llmessage/llinstantmessage.cpp +++ b/indra/llmessage/llinstantmessage.cpp @@ -111,7 +111,7 @@ LLIMInfo::~LLIMInfo() void LLIMInfo::packInstantMessage(LLMessageSystem* msg) const { - lldebugs << "LLIMInfo::packInstantMessage()" << llendl; + LL_DEBUGS() << "LLIMInfo::packInstantMessage()" << LL_ENDL; msg->newMessageFast(_PREHASH_ImprovedInstantMessage); packMessageBlock(msg); } @@ -161,7 +161,7 @@ void pack_instant_message( const U8* binary_bucket, S32 binary_bucket_size) { - lldebugs << "pack_instant_message()" << llendl; + LL_DEBUGS() << "pack_instant_message()" << LL_ENDL; msg->newMessageFast(_PREHASH_ImprovedInstantMessage); pack_instant_message_block( msg, @@ -228,7 +228,7 @@ void pack_instant_message_block( if (num_written < 0 || num_written >= MTUBYTES) { num_written = MTUBYTES - 1; - llwarns << "pack_instant_message_block: message truncated: " << message << llendl; + LL_WARNS() << "pack_instant_message_block: message truncated: " << message << LL_ENDL; } bytes_left -= num_written; diff --git a/indra/llmessage/lliobuffer.cpp b/indra/llmessage/lliobuffer.cpp index ed00e230ac583bfb93409be88245d3e5caaa8a22..bbd7b8777d78133fe637e8533dd1228f9d16e197 100755 --- a/indra/llmessage/lliobuffer.cpp +++ b/indra/llmessage/lliobuffer.cpp @@ -109,6 +109,6 @@ LLIOPipe::EStatus LLIOBuffer::process_impl( LLPumpIO* pump) { // no-op (I think) - llwarns << "You are using an LLIOBuffer which is deprecated." << llendl; + LL_WARNS() << "You are using an LLIOBuffer which is deprecated." << LL_ENDL; return STATUS_OK; } diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index 1236fc8b71c917c30a37bfdd7d9f3274241172d7..23813c6edb56968d749608f5be4aa60cedef0072 100755 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -33,6 +33,7 @@ #include "llapr.h" #include "llbuffer.h" #include "llbufferstream.h" +#include "llfasttimer.h" #include "llhttpnode.h" #include "lliopipe.h" #include "lliosocket.h" @@ -138,11 +139,11 @@ class LLHTTPPipe : public LLIOPipe LLSD mHeaders; }; -static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_PIPE("HTTP Pipe"); -static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_GET("HTTP Get"); -static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_PUT("HTTP Put"); -static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_POST("HTTP Post"); -static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_DELETE("HTTP Delete"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_PIPE("HTTP Pipe"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_GET("HTTP Get"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_PUT("HTTP Put"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_POST("HTTP Post"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_DELETE("HTTP Delete"); LLIOPipe::EStatus LLHTTPPipe::process_impl( const LLChannelDescriptors& channels, @@ -151,9 +152,9 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_HTTP_PIPE); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_PIPE); PUMP_DEBUG; - lldebugs << "LLSDHTTPServer::process_impl" << llendl; + LL_DEBUGS() << "LLSDHTTPServer::process_impl" << LL_ENDL; // Once we have all the data, We need to read the sd on // the the in channel, and respond on the out channel @@ -180,12 +181,12 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( std::string verb = context[CONTEXT_REQUEST][CONTEXT_VERB]; if(verb == HTTP_VERB_GET) { - LLFastTimer _(FTM_PROCESS_HTTP_GET); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_GET); mNode.get(LLHTTPNode::ResponsePtr(mResponse), context); } else if(verb == HTTP_VERB_PUT) { - LLFastTimer _(FTM_PROCESS_HTTP_PUT); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_PUT); LLSD input; if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD) { @@ -201,7 +202,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( } else if(verb == HTTP_VERB_POST) { - LLFastTimer _(FTM_PROCESS_HTTP_POST); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_POST); LLSD input; if (mNode.getContentType() == LLHTTPNode::CONTENT_TYPE_LLSD) { @@ -217,7 +218,7 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( } else if(verb == HTTP_VERB_DELETE) { - LLFastTimer _(FTM_PROCESS_HTTP_DELETE); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_DELETE); mNode.del(LLHTTPNode::ResponsePtr(mResponse), context); } else if(verb == HTTP_VERB_OPTIONS) @@ -244,15 +245,15 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( // Log all HTTP transactions. // TODO: Add a way to log these to their own file instead of indra.log // It is just too spammy to be in indra.log. - lldebugs << verb << " " << context[CONTEXT_REQUEST]["path"].asString() + LL_DEBUGS() << verb << " " << context[CONTEXT_REQUEST]["path"].asString() << " " << mStatusCode << " " << mStatusMessage << " " << delta - << "s" << llendl; + << "s" << LL_ENDL; // Log Internal Server Errors //if(mStatusCode == 500) //{ - // llwarns << "LLHTTPPipe::process_impl:500:Internal Server Error" - // << llendl; + // LL_WARNS() << "LLHTTPPipe::process_impl:500:Internal Server Error" + // << LL_ENDL; //} } @@ -301,8 +302,8 @@ LLIOPipe::EStatus LLHTTPPipe::process_impl( return STATUS_DONE; } default: - llwarns << "LLHTTPPipe::process_impl: unexpected state " - << mState << llendl; + LL_WARNS() << "LLHTTPPipe::process_impl: unexpected state " + << mState << LL_ENDL; return STATUS_BREAK; } @@ -331,7 +332,7 @@ void LLHTTPPipe::Response::result(const LLSD& r) { if(! mPipe) { - llwarns << "LLHTTPPipe::Response::result: NULL pipe" << llendl; + LL_WARNS() << "LLHTTPPipe::Response::result: NULL pipe" << LL_ENDL; return; } @@ -347,7 +348,7 @@ void LLHTTPPipe::Response::extendedResult(S32 code, const std::string& body, con { if(! mPipe) { - llwarns << "LLHTTPPipe::Response::status: NULL pipe" << llendl; + LL_WARNS() << "LLHTTPPipe::Response::status: NULL pipe" << LL_ENDL; return; } @@ -363,7 +364,7 @@ void LLHTTPPipe::Response::status(S32 code, const std::string& message) { if(! mPipe) { - llwarns << "LLHTTPPipe::Response::status: NULL pipe" << llendl; + LL_WARNS() << "LLHTTPPipe::Response::status: NULL pipe" << LL_ENDL; return; } @@ -434,7 +435,7 @@ class LLHTTPResponseHeader : public LLIOPipe * LLHTTPResponseHeader */ -static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_HEADER("HTTP Header"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_HEADER("HTTP Header"); // virtual LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( @@ -444,7 +445,7 @@ LLIOPipe::EStatus LLHTTPResponseHeader::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_HTTP_HEADER); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_HEADER); PUMP_DEBUG; if(eos) { @@ -594,7 +595,7 @@ LLHTTPResponder::LLHTTPResponder(const LLHTTPNode& tree, const LLSD& ctx) : // virtual LLHTTPResponder::~LLHTTPResponder() { - //lldebugs << "destroying LLHTTPResponder" << llendl; + //LL_DEBUGS() << "destroying LLHTTPResponder" << LL_ENDL; } bool LLHTTPResponder::readHeaderLine( @@ -611,7 +612,7 @@ bool LLHTTPResponder::readHeaderLine( { if(len) { - lldebugs << "readLine failed - too long maybe?" << llendl; + LL_DEBUGS() << "readLine failed - too long maybe?" << LL_ENDL; markBad(channels, buffer); } return false; @@ -634,7 +635,7 @@ void LLHTTPResponder::markBad( << "</body>\n</html>\n"; } -static LLFastTimer::DeclareTimer FTM_PROCESS_HTTP_RESPONDER("HTTP Responder"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_HTTP_RESPONDER("HTTP Responder"); // virtual LLIOPipe::EStatus LLHTTPResponder::process_impl( @@ -644,7 +645,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_HTTP_RESPONDER); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_HTTP_RESPONDER); PUMP_DEBUG; LLIOPipe::EStatus status = STATUS_OK; @@ -667,8 +668,8 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( { memcpy(buf, (*seg_iter).data(), (*seg_iter).size()); /*Flawfinder: ignore*/ buf[(*seg_iter).size()] = '\0'; - llinfos << (*seg_iter).getChannel() << ": " << buf - << llendl; + LL_INFOS() << (*seg_iter).getChannel() << ": " << buf + << LL_ENDL; ++seg_iter; } } @@ -694,10 +695,10 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( header >> mAbsPathAndQuery; header >> mVersion; - lldebugs << "http request: " + LL_DEBUGS() << "http request: " << mVerb << " " << mAbsPathAndQuery - << " " << mVersion << llendl; + << " " << mVersion << LL_ENDL; std::string::size_type delimiter = mAbsPathAndQuery.find('?'); @@ -727,7 +728,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( { read_next_line = false; parse_all = false; - lldebugs << "unknown http verb: " << mVerb << llendl; + LL_DEBUGS() << "unknown http verb: " << mVerb << LL_ENDL; markBad(channels, buffer); } } @@ -762,7 +763,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( if(NULL == pos_colon) { keep_parsing = false; - lldebugs << "bad header: " << buf << llendl; + LL_DEBUGS() << "bad header: " << buf << LL_ENDL; markBad(channels, buffer); break; } @@ -773,7 +774,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( LLStringUtil::toLower(name); if("content-length" == name) { - lldebugs << "Content-Length: " << value << llendl; + LL_DEBUGS() << "Content-Length: " << value << LL_ENDL; mContentLength = atoi(value.c_str()); } else @@ -810,8 +811,8 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( const LLHTTPNode* node = mRootNode.traverse(mPath, context); if(node) { - //llinfos << "LLHTTPResponder::process_impl found node for " - // << mAbsPathAndQuery << llendl; + //LL_INFOS() << "LLHTTPResponder::process_impl found node for " + // << mAbsPathAndQuery << LL_ENDL; // Copy everything after mLast read to the out. LLBufferArray::segment_iterator_t seg_iter; @@ -831,8 +832,8 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( { memcpy(buf, (*seg_iter).data(), (*seg_iter).size()); /*Flawfinder: ignore*/ buf[(*seg_iter).size()] = '\0'; - llinfos << (*seg_iter).getChannel() << ": " << buf - << llendl; + LL_INFOS() << (*seg_iter).getChannel() << ": " << buf + << LL_ENDL; ++seg_iter; } #endif @@ -858,7 +859,7 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( = node->getProtocolHandler(); if (protocolHandler) { - lldebugs << "HTTP context: " << context << llendl; + LL_DEBUGS() << "HTTP context: " << context << LL_ENDL; protocolHandler->build(chain, context); } else @@ -917,8 +918,8 @@ LLIOPipe::EStatus LLHTTPResponder::process_impl( } else { - llwarns << "LLHTTPResponder::process_impl didn't find a node for " - << mAbsPathAndQuery << llendl; + LL_WARNS() << "LLHTTPResponder::process_impl didn't find a node for " + << mAbsPathAndQuery << LL_ENDL; LLBufferStream str(channels, buffer.get()); mState = STATE_SHORT_CIRCUIT; str << HTTP_VERSION_STR << " 404 Not Found\r\n\r\n<html>\n" @@ -971,7 +972,7 @@ LLHTTPNode& LLIOHTTPServer::create( port); if(!socket) { - llerrs << "Unable to initialize socket" << llendl; + LL_ERRS() << "Unable to initialize socket" << LL_ENDL; } LLHTTPResponseFactory* factory = new LLHTTPResponseFactory; diff --git a/indra/llmessage/lliopipe.cpp b/indra/llmessage/lliopipe.cpp index 8f827f7a30756d61329902a7cc496e673b00aef3..4676a9a8f01e98b15b3330aa6efadfc17632834c 100755 --- a/indra/llmessage/lliopipe.cpp +++ b/indra/llmessage/lliopipe.cpp @@ -72,7 +72,7 @@ LLIOPipe::LLIOPipe() : LLIOPipe::~LLIOPipe() { - //lldebugs << "destroying LLIOPipe" << llendl; + //LL_DEBUGS() << "destroying LLIOPipe" << LL_ENDL; } //virtual diff --git a/indra/llmessage/lliopipe.h b/indra/llmessage/lliopipe.h index cbd17b5a3d9ba02be6430d051eecaaba6f8f571d..9a0a427efd0b9654f2ed66c7daea9acc0264bfd9 100755 --- a/indra/llmessage/lliopipe.h +++ b/indra/llmessage/lliopipe.h @@ -31,6 +31,7 @@ #include <boost/intrusive_ptr.hpp> #include <boost/shared_ptr.hpp> +#include "llwin32headerslean.h" #include "apr_poll.h" #include "llsd.h" diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index 2043bae5e7c0b6c8d42d0d5e9f7d75826577e6be..4b8d1b44f62db2e97fa30281a8210723124a4d63 100755 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -32,6 +32,7 @@ #include "llapr.h" #include "llbuffer.h" +#include "llfasttimer.h" #include "llhost.h" #include "llpumpio.h" @@ -73,7 +74,7 @@ void ll_debug_socket(const char* msg, apr_socket_t* apr_sock) #if LL_DEBUG_SOCKET_FILE_DESCRIPTORS if(!apr_sock) { - lldebugs << "Socket -- " << (msg?msg:"") << ": no socket." << llendl; + LL_DEBUGS() << "Socket -- " << (msg?msg:"") << ": no socket." << LL_ENDL; return; } // *TODO: Why doesn't this work? @@ -81,13 +82,13 @@ void ll_debug_socket(const char* msg, apr_socket_t* apr_sock) int os_sock; if(APR_SUCCESS == apr_os_sock_get(&os_sock, apr_sock)) { - lldebugs << "Socket -- " << (msg?msg:"") << " on fd " << os_sock - << " at " << apr_sock << llendl; + LL_DEBUGS() << "Socket -- " << (msg?msg:"") << " on fd " << os_sock + << " at " << apr_sock << LL_ENDL; } else { - lldebugs << "Socket -- " << (msg?msg:"") << " no fd " - << " at " << apr_sock << llendl; + LL_DEBUGS() << "Socket -- " << (msg?msg:"") << " no fd " + << " at " << apr_sock << LL_ENDL; } #endif } @@ -165,13 +166,13 @@ LLSocket::ptr_t LLSocket::create(apr_pool_t* pool, EType type, U16 port) rv.reset(); return rv; } - lldebugs << "Bound " << ((DATAGRAM_UDP == type) ? "udp" : "tcp") - << " socket to port: " << sa->port << llendl; + LL_DEBUGS() << "Bound " << ((DATAGRAM_UDP == type) ? "udp" : "tcp") + << " socket to port: " << sa->port << LL_ENDL; if(STREAM_TCP == type) { // If it's a stream based socket, we need to tell the OS // to keep a queue of incoming connections for ACCEPT. - lldebugs << "Setting listen state for socket." << llendl; + LL_DEBUGS() << "Setting listen state for socket." << LL_ENDL; status = apr_socket_listen( socket, LL_DEFAULT_LISTEN_BACKLOG); @@ -290,10 +291,10 @@ LLIOSocketReader::LLIOSocketReader(LLSocket::ptr_t socket) : LLIOSocketReader::~LLIOSocketReader() { - //lldebugs << "Destroying LLIOSocketReader" << llendl; + //LL_DEBUGS() << "Destroying LLIOSocketReader" << LL_ENDL; } -static LLFastTimer::DeclareTimer FTM_PROCESS_SOCKET_READER("Socket Reader"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_SOCKET_READER("Socket Reader"); // virtual LLIOPipe::EStatus LLIOSocketReader::process_impl( @@ -303,7 +304,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_SOCKET_READER); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_SOCKET_READER); PUMP_DEBUG; if(!mSource) return STATUS_PRECONDITION_NOT_MET; if(!mInitialized) @@ -315,8 +316,8 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl( if(pump) { PUMP_DEBUG; - lldebugs << "Initializing poll descriptor for LLIOSocketReader." - << llendl; + LL_DEBUGS() << "Initializing poll descriptor for LLIOSocketReader." + << LL_ENDL; apr_pollfd_t poll_fd; poll_fd.p = NULL; poll_fd.desc_type = APR_POLL_SOCKET; @@ -343,7 +344,7 @@ LLIOPipe::EStatus LLIOSocketReader::process_impl( status = apr_socket_recv(mSource->getSocket(), read_buf, &len); buffer->append(channels.out(), (U8*)read_buf, len); } while((APR_SUCCESS == status) && (READ_BUFFER_SIZE == len)); - lldebugs << "socket read status: " << status << llendl; + LL_DEBUGS() << "socket read status: " << status << LL_ENDL; LLIOPipe::EStatus rv = STATUS_OK; PUMP_DEBUG; @@ -390,10 +391,10 @@ LLIOSocketWriter::LLIOSocketWriter(LLSocket::ptr_t socket) : LLIOSocketWriter::~LLIOSocketWriter() { - //lldebugs << "Destroying LLIOSocketWriter" << llendl; + //LL_DEBUGS() << "Destroying LLIOSocketWriter" << LL_ENDL; } -static LLFastTimer::DeclareTimer FTM_PROCESS_SOCKET_WRITER("Socket Writer"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_SOCKET_WRITER("Socket Writer"); // virtual LLIOPipe::EStatus LLIOSocketWriter::process_impl( const LLChannelDescriptors& channels, @@ -402,7 +403,7 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_SOCKET_WRITER); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_SOCKET_WRITER); PUMP_DEBUG; if(!mDestination) return STATUS_PRECONDITION_NOT_MET; if(!mInitialized) @@ -414,8 +415,8 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl( if(pump) { PUMP_DEBUG; - lldebugs << "Initializing poll descriptor for LLIOSocketWriter." - << llendl; + LL_DEBUGS() << "Initializing poll descriptor for LLIOSocketWriter." + << LL_ENDL; apr_pollfd_t poll_fd; poll_fd.p = NULL; poll_fd.desc_type = APR_POLL_SOCKET; @@ -541,7 +542,7 @@ LLIOServerSocket::LLIOServerSocket( LLIOServerSocket::~LLIOServerSocket() { - //lldebugs << "Destroying LLIOServerSocket" << llendl; + //LL_DEBUGS() << "Destroying LLIOServerSocket" << LL_ENDL; } void LLIOServerSocket::setResponseTimeout(F32 timeout_secs) @@ -549,7 +550,7 @@ void LLIOServerSocket::setResponseTimeout(F32 timeout_secs) mResponseTimeout = timeout_secs; } -static LLFastTimer::DeclareTimer FTM_PROCESS_SERVER_SOCKET("Server Socket"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_SERVER_SOCKET("Server Socket"); // virtual LLIOPipe::EStatus LLIOServerSocket::process_impl( const LLChannelDescriptors& channels, @@ -558,11 +559,11 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_SERVER_SOCKET); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_SERVER_SOCKET); PUMP_DEBUG; if(!pump) { - llwarns << "Need a pump for server socket." << llendl; + LL_WARNS() << "Need a pump for server socket." << LL_ENDL; return STATUS_ERROR; } if(!mInitialized) @@ -571,8 +572,8 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl( // This segment sets up the pump so that we do not call // process again until we have an incoming read, aka connect() // from a remote host. - lldebugs << "Initializing poll descriptor for LLIOServerSocket." - << llendl; + LL_DEBUGS() << "Initializing poll descriptor for LLIOServerSocket." + << LL_ENDL; apr_pollfd_t poll_fd; poll_fd.p = NULL; poll_fd.desc_type = APR_POLL_SOCKET; @@ -587,7 +588,7 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl( // we are initialized, and told to process, so we must have a // socket waiting for a connection. - lldebugs << "accepting socket" << llendl; + LL_DEBUGS() << "accepting socket" << LL_ENDL; PUMP_DEBUG; apr_pool_t* new_pool = NULL; @@ -632,12 +633,12 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl( } else { - llwarns << "Unable to build reactor to socket." << llendl; + LL_WARNS() << "Unable to build reactor to socket." << LL_ENDL; } } else { - llwarns << "Unable to create linden socket." << llendl; + LL_WARNS() << "Unable to create linden socket." << LL_ENDL; } PUMP_DEBUG; @@ -677,7 +678,7 @@ LLIODataSocket::LLIODataSocket( if(ll_apr_warn_status(status)) return; if(sa->port) { - lldebugs << "Bound datagram socket to port: " << sa->port << llendl; + LL_DEBUGS() << "Bound datagram socket to port: " << sa->port << LL_ENDL; mPort = sa->port; } else diff --git a/indra/llmessage/lliosocket.h b/indra/llmessage/lliosocket.h index be0f7dfcc655e1e47ac2ccdf8f967037ac4458a8..ec998552d02f7e71540b9afa4f7788ac61296cb3 100755 --- a/indra/llmessage/lliosocket.h +++ b/indra/llmessage/lliosocket.h @@ -38,6 +38,7 @@ */ #include "lliopipe.h" +#include "llwin32headerslean.h" #include "apr_pools.h" #include "apr_network_io.h" #include "llchainio.h" diff --git a/indra/llmessage/llioutil.cpp b/indra/llmessage/llioutil.cpp index 8c50fd50693a1e62ab70d57c8649465d2ebecd21..b8443c0600d8cb23dddef45c1f1f57bd6950f468 100755 --- a/indra/llmessage/llioutil.cpp +++ b/indra/llmessage/llioutil.cpp @@ -28,6 +28,7 @@ #include "linden_common.h" #include "llioutil.h" +#include "llfasttimer.h" /** * LLIOFlush @@ -44,7 +45,7 @@ LLIOPipe::EStatus LLIOFlush::process_impl( } -static LLFastTimer::DeclareTimer FTM_PROCESS_SLEEP("IO Sleep"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_SLEEP("IO Sleep"); /** * @class LLIOSleep */ @@ -55,7 +56,7 @@ LLIOPipe::EStatus LLIOSleep::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_SLEEP); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_SLEEP); if(mSeconds > 0.0) { if(pump) pump->sleepChain(mSeconds); @@ -65,7 +66,7 @@ LLIOPipe::EStatus LLIOSleep::process_impl( return STATUS_DONE; } -static LLFastTimer::DeclareTimer FTM_PROCESS_ADD_CHAIN("Add Chain"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_ADD_CHAIN("Add Chain"); /** * @class LLIOAddChain */ @@ -76,7 +77,7 @@ LLIOPipe::EStatus LLIOAddChain::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_ADD_CHAIN); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_ADD_CHAIN); pump->addChain(mChain, mTimeout); return STATUS_DONE; } diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index 08b31e9c7a29b45cdc61fde26fd5a79a25fba74d..134154aa6ce900d52e73dee372052801a060c55b 100755 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -29,12 +29,7 @@ #include "llmail.h" // APR on Windows needs full windows headers -#ifdef LL_WINDOWS -# undef WIN32_LEAN_AND_MEAN -# include <winsock2.h> -# include <windows.h> -#endif - +#include "llwin32headers.h" #include <string> #include <sstream> @@ -199,16 +194,16 @@ std::string LLMail::buildSMTPTransaction( { if(!from_address || !to_address) { - llinfos << "send_mail build_smtp_transaction reject: missing to and/or" - << " from address." << llendl; + LL_INFOS() << "send_mail build_smtp_transaction reject: missing to and/or" + << " from address." << LL_ENDL; return std::string(); } if(!valid_subject_chars(subject)) { - llinfos << "send_mail build_smtp_transaction reject: bad subject header: " + LL_INFOS() << "send_mail build_smtp_transaction reject: bad subject header: " << "to=<" << to_address << ">, from=<" << from_address << ">" - << llendl; + << LL_ENDL; return std::string(); } std::ostringstream from_fmt; @@ -265,8 +260,8 @@ bool LLMail::send( { if(!from_address || !to_address) { - llinfos << "send_mail reject: missing to and/or from address." - << llendl; + LL_INFOS() << "send_mail reject: missing to and/or from address." + << LL_ENDL; return false; } @@ -303,26 +298,26 @@ bool LLMail::send( if(!gMailEnabled) { - llinfos << "send_mail reject: mail system is disabled: to=<" + LL_INFOS() << "send_mail reject: mail system is disabled: to=<" << to_address << ">, from=<" << from_address - << ">" << llendl; + << ">" << LL_ENDL; // Any future interface to SMTP should return this as an // error. --mark return true; } if(!gSockAddr) { - llwarns << "send_mail reject: mail system not initialized: to=<" + LL_WARNS() << "send_mail reject: mail system not initialized: to=<" << to_address << ">, from=<" << from_address - << ">" << llendl; + << ">" << LL_ENDL; return false; } if(!connect_smtp()) { - llwarns << "send_mail reject: SMTP connect failure: to=<" + LL_WARNS() << "send_mail reject: SMTP connect failure: to=<" << to_address << ">, from=<" << from_address - << ">" << llendl; + << ">" << LL_ENDL; return false; } @@ -338,27 +333,27 @@ bool LLMail::send( disconnect_smtp(); if(ll_apr_warn_status(status)) { - llwarns << "send_mail socket failure: unable to write " + LL_WARNS() << "send_mail socket failure: unable to write " << "to=<" << to_address << ">, from=<" << from_address << ">" << ", bytes=" << original_size - << ", sent=" << send_size << llendl; + << ", sent=" << send_size << LL_ENDL; return false; } if(send_size >= LL_MAX_KNOWN_GOOD_MAIL_SIZE) { - llwarns << "send_mail message has been shown to fail in testing " + LL_WARNS() << "send_mail message has been shown to fail in testing " << "when sending messages larger than " << LL_MAX_KNOWN_GOOD_MAIL_SIZE - << " bytes. The next log about success is potentially a lie." << llendl; + << " bytes. The next log about success is potentially a lie." << LL_ENDL; } - lldebugs << "send_mail success: " + LL_DEBUGS() << "send_mail success: " << "to=<" << to_address << ">, from=<" << from_address << ">" << ", bytes=" << original_size - << ", sent=" << send_size << llendl; + << ", sent=" << send_size << LL_ENDL; #if LL_LOG_ENTIRE_MAIL_MESSAGE_ON_SEND - llinfos << rfc2822_msg.str() << llendl; + LL_INFOS() << rfc2822_msg.str() << LL_ENDL; #endif return true; } diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp index 539efc65f8304914298da43d9a3dfc58d95cf41c..f8b2c8f5a6456048a8478bb7e7fc9503667bb9f1 100755 --- a/indra/llmessage/llmessageconfig.cpp +++ b/indra/llmessage/llmessageconfig.cpp @@ -145,9 +145,9 @@ void LLMessageConfigFile::loadMessages(const LLSD& data) std::ostringstream out; LLSDXMLFormatter *formatter = new LLSDXMLFormatter; formatter->format(mMessages, out); - llinfos << "loading ... " << out.str() + LL_INFOS() << "loading ... " << out.str() << " LLMessageConfigFile::loadMessages loaded " - << mMessages.size() << " messages" << llendl; + << mMessages.size() << " messages" << LL_ENDL; #endif } @@ -182,7 +182,7 @@ void LLMessageConfigFile::loadMessageBans(const LLSD& data) bool LLMessageConfigFile::isCapBanned(const std::string& cap_name) const { - lldebugs << "mCapBans is " << LLSDNotationStreamer(mCapBans) << llendl; + LL_DEBUGS() << "mCapBans is " << LLSDNotationStreamer(mCapBans) << LL_ENDL; return mCapBans[cap_name]; } @@ -268,7 +268,7 @@ bool LLMessageConfig::isValidMessage(const std::string& msg_name) { if (sServerName.empty()) { - llerrs << "LLMessageConfig::initClass() not called" << llendl; + LL_ERRS() << "LLMessageConfig::initClass() not called" << LL_ENDL; } LLMessageConfigFile& file = LLMessageConfigFile::instance(); return file.mMessages.has(msg_name); @@ -294,8 +294,8 @@ LLSD LLMessageConfig::getConfigForMessage(const std::string& msg_name) { if (sServerName.empty()) { - llerrs << "LLMessageConfig::isMessageTrusted(name) before" - << " LLMessageConfig::initClass()" << llendl; + LL_ERRS() << "LLMessageConfig::isMessageTrusted(name) before" + << " LLMessageConfig::initClass()" << LL_ENDL; } LLMessageConfigFile& file = LLMessageConfigFile::instance(); // LLSD for the CamelCase message name diff --git a/indra/llmessage/llmessagetemplate.cpp b/indra/llmessage/llmessagetemplate.cpp index d64123ad628e976f2ac971bdafc7273762a93056..c4c7e667034b24003bf0ea57000d16724bb0daae 100755 --- a/indra/llmessage/llmessagetemplate.cpp +++ b/indra/llmessage/llmessagetemplate.cpp @@ -39,8 +39,8 @@ void LLMsgVarData::addData(const void *data, S32 size, EMsgVariableType type, S3 { if (mType != type) { - llwarns << "Type mismatch in LLMsgVarData::addData for " << mName - << llendl; + LL_WARNS() << "Type mismatch in LLMsgVarData::addData for " << mName + << LL_ENDL; } } if(size) @@ -181,12 +181,12 @@ void LLMessageTemplate::banUdp() }; if (mDeprecation != MD_DEPRECATED) { - llinfos << "Setting " << mName << " to UDPBlackListed was " << deprecation[mDeprecation] << llendl; + LL_INFOS() << "Setting " << mName << " to UDPBlackListed was " << deprecation[mDeprecation] << LL_ENDL; mDeprecation = MD_UDPBLACKLISTED; } else { - llinfos << mName << " is already more deprecated than UDPBlackListed" << llendl; + LL_INFOS() << mName << " is already more deprecated than UDPBlackListed" << LL_ENDL; } } diff --git a/indra/llmessage/llmessagetemplate.h b/indra/llmessage/llmessagetemplate.h index 005a49cedf22f8c924c267670e652f7ed446726d..a44e16fc3ae6ee41b2e30841747b9acd79caa3d5 100755 --- a/indra/llmessage/llmessagetemplate.h +++ b/indra/llmessage/llmessagetemplate.h @@ -27,9 +27,9 @@ #ifndef LL_LLMESSAGETEMPLATE_H #define LL_LLMESSAGETEMPLATE_H -#include "lldarray.h" #include "message.h" // TODO: babbage: Remove... #include "llstl.h" +#include "llindexedvector.h" class LLMsgVarData { @@ -102,7 +102,7 @@ class LLMsgBlkData } S32 mBlockNumber; - typedef LLDynamicArrayIndexed<LLMsgVarData, const char *, 8> msg_var_data_map_t; + typedef LLIndexedVector<LLMsgVarData, const char *, 8> msg_var_data_map_t; msg_var_data_map_t mMemberVarData; char *mName; S32 mTotalSize; @@ -194,7 +194,7 @@ class LLMessageBlock LLMessageVariable** varp = &mMemberVariables[name]; if (*varp != NULL) { - llerrs << name << " has already been used as a variable name!" << llendl; + LL_ERRS() << name << " has already been used as a variable name!" << LL_ENDL; } *varp = new LLMessageVariable(name, type, size); if (((*varp)->getType() != MVT_VARIABLE) @@ -226,7 +226,7 @@ class LLMessageBlock friend std::ostream& operator<<(std::ostream& s, LLMessageBlock &msg); - typedef LLDynamicArrayIndexed<LLMessageVariable*, const char *, 8> message_variable_map_t; + typedef LLIndexedVector<LLMessageVariable*, const char *, 8> message_variable_map_t; message_variable_map_t mMemberVariables; char *mName; EMsgBlockType mType; @@ -302,8 +302,8 @@ class LLMessageTemplate LLMessageBlock** member_blockp = &mMemberBlocks[blockp->mName]; if (*member_blockp != NULL) { - llerrs << "Block " << blockp->mName - << "has already been used as a block name!" << llendl; + LL_ERRS() << "Block " << blockp->mName + << "has already been used as a block name!" << LL_ENDL; } *member_blockp = blockp; if ( (mTotalSize != -1) @@ -392,7 +392,7 @@ class LLMessageTemplate } public: - typedef LLDynamicArrayIndexed<LLMessageBlock*, char*, 8> message_block_map_t; + typedef LLIndexedVector<LLMessageBlock*, char*, 8> message_block_map_t; message_block_map_t mMemberBlocks; char *mName; EMsgFrequency mFrequency; diff --git a/indra/llmessage/llmessagetemplateparser.cpp b/indra/llmessage/llmessagetemplateparser.cpp index b0f19df47c01ca3b024e0e1ff7fedd3792726aa7..1f7c09dbe551a35b9da4ff73fc7b4330024c457d 100755 --- a/indra/llmessage/llmessagetemplateparser.cpp +++ b/indra/llmessage/llmessagetemplateparser.cpp @@ -165,13 +165,13 @@ BOOL b_check_token(const char *token, const char *regexp) if (current_checker == -1) { - llerrs << "Invalid regular expression value!" << llendl; + LL_ERRS() << "Invalid regular expression value!" << LL_ENDL; return FALSE; } if (current_checker == 9999) { - llerrs << "Regular expression can't start with *!" << llendl; + LL_ERRS() << "Regular expression can't start with *!" << LL_ENDL; return FALSE; } @@ -179,7 +179,7 @@ BOOL b_check_token(const char *token, const char *regexp) { if (current_checker == -1) { - llerrs << "Input exceeds regular expression!\nDid you forget a *?" << llendl; + LL_ERRS() << "Input exceeds regular expression!\nDid you forget a *?" << LL_ENDL; return FALSE; } @@ -204,7 +204,7 @@ BOOL b_variable_ok(const char *token) { if (!b_check_token(token, "fv*")) { - llwarns << "Token '" << token << "' isn't a variable!" << llendl; + LL_WARNS() << "Token '" << token << "' isn't a variable!" << LL_ENDL; return FALSE; } return TRUE; @@ -215,7 +215,7 @@ BOOL b_integer_ok(const char *token) { if (!b_check_token(token, "sd*")) { - llwarns << "Token isn't an integer!" << llendl; + LL_WARNS() << "Token isn't an integer!" << LL_ENDL; return FALSE; } return TRUE; @@ -226,7 +226,7 @@ BOOL b_positive_integer_ok(const char *token) { if (!b_check_token(token, "d*")) { - llwarns << "Token isn't an integer!" << llendl; + LL_WARNS() << "Token isn't an integer!" << LL_ENDL; return FALSE; } return TRUE; @@ -359,13 +359,13 @@ void LLTemplateTokenizer::error(std::string message) const { if(atEOF()) { - llerrs << "Unexpected end of file: " << message << llendl; + LL_ERRS() << "Unexpected end of file: " << message << LL_ENDL; } else { - llerrs << "Problem parsing message template at line " + LL_ERRS() << "Problem parsing message template at line " << line() << ", with token '" << get() << "' : " - << message << llendl; + << message << LL_ENDL; } } @@ -383,12 +383,12 @@ LLTemplateParser::LLTemplateParser(LLTemplateTokenizer & tokens): std::string vers_string = tokens.next(); mVersion = (F32)atof(vers_string.c_str()); - llinfos << "### Message template version " << mVersion << " ###" << llendl; + LL_INFOS() << "### Message template version " << mVersion << " ###" << LL_ENDL; } else { - llerrs << "Version must be first in the message template, found " - << tokens.next() << llendl; + LL_ERRS() << "Version must be first in the message template, found " + << tokens.next() << LL_ENDL; } while(LLMessageTemplate * templatep = parseMessage(tokens)) @@ -405,8 +405,8 @@ LLTemplateParser::LLTemplateParser(LLTemplateTokenizer & tokens): if(!tokens.wantEOF()) { - llerrs << "Expected end of template or a message, instead found: " - << tokens.next() << " at " << tokens.line() << llendl; + LL_ERRS() << "Expected end of template or a message, instead found: " + << tokens.next() << " at " << tokens.line() << LL_ENDL; } } @@ -441,7 +441,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) // is name a legit C variable name if (!b_variable_ok(template_name.c_str())) { - llerrs << "Not legit variable name: " << template_name << " at " << tokens.line() << llendl; + LL_ERRS() << "Not legit variable name: " << template_name << " at " << tokens.line() << LL_ENDL; } // ok, now get Frequency ("High", "Medium", or "Low") @@ -461,7 +461,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) } else { - llerrs << "Expected frequency, got " << freq_string << " at " << tokens.line() << llendl; + LL_ERRS() << "Expected frequency, got " << freq_string << " at " << tokens.line() << LL_ENDL; } // TODO more explicit checking here pls @@ -477,7 +477,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) message_number = (255 << 24) | (255 << 16) | message_number; break; default: - llerrs << "Unknown frequency enum: " << frequency << llendl; + LL_ERRS() << "Unknown frequency enum: " << frequency << LL_ENDL; } templatep = new LLMessageTemplate( @@ -497,7 +497,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) } else { - llerrs << "Bad trust " << trust << " at " << tokens.line() << llendl; + LL_ERRS() << "Bad trust " << trust << " at " << tokens.line() << LL_ENDL; } // get encoding @@ -512,7 +512,7 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) } else { - llerrs << "Bad encoding " << encoding << " at " << tokens.line() << llendl; + LL_ERRS() << "Bad encoding " << encoding << " at " << tokens.line() << LL_ENDL; } // get deprecation @@ -544,8 +544,8 @@ LLMessageTemplate * LLTemplateParser::parseMessage(LLTemplateTokenizer & tokens) if(!tokens.want("}")) { - llerrs << "Expecting closing } for message " << template_name - << " at " << tokens.line() << llendl; + LL_ERRS() << "Expecting closing } for message " << template_name + << " at " << tokens.line() << LL_ENDL; } return templatep; } @@ -566,8 +566,8 @@ LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens) // is name a legit C variable name if (!b_variable_ok(block_name.c_str())) { - llerrs << "not a legal block name: " << block_name - << " at " << tokens.line() << llendl; + LL_ERRS() << "not a legal block name: " << block_name + << " at " << tokens.line() << LL_ENDL; } // now, block type ("Single", "Multiple", or "Variable") @@ -586,8 +586,8 @@ LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens) // is it a legal integer if (!b_positive_integer_ok(repeats.c_str())) { - llerrs << "not a legal integer for block multiple count: " - << repeats << " at " << tokens.line() << llendl; + LL_ERRS() << "not a legal integer for block multiple count: " + << repeats << " at " << tokens.line() << LL_ENDL; } // ok, we can create a block @@ -602,8 +602,8 @@ LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens) } else { - llerrs << "bad block type: " << block_type - << " at " << tokens.line() << llendl; + LL_ERRS() << "bad block type: " << block_type + << " at " << tokens.line() << LL_ENDL; } @@ -617,8 +617,8 @@ LLMessageBlock * LLTemplateParser::parseBlock(LLTemplateTokenizer & tokens) if(!tokens.want("}")) { - llerrs << "Expecting closing } for block " << block_name - << " at " << tokens.line() << llendl; + LL_ERRS() << "Expecting closing } for block " << block_name + << " at " << tokens.line() << LL_ENDL; } return blockp; @@ -637,8 +637,8 @@ LLMessageVariable * LLTemplateParser::parseVariable(LLTemplateTokenizer & tokens if (!b_variable_ok(var_name.c_str())) { - llerrs << "Not a legit variable name: " << var_name - << " at " << tokens.line() << llendl; + LL_ERRS() << "Not a legit variable name: " << var_name + << " at " << tokens.line() << LL_ENDL; } std::string var_type = tokens.next(); @@ -721,8 +721,8 @@ LLMessageVariable * LLTemplateParser::parseVariable(LLTemplateTokenizer & tokens if (!b_positive_integer_ok(variable_size.c_str())) { - llerrs << "not a legal integer variable size: " << variable_size - << " at " << tokens.line() << llendl; + LL_ERRS() << "not a legal integer variable size: " << variable_size + << " at " << tokens.line() << LL_ENDL; } EMsgVariableType type_enum; @@ -737,8 +737,8 @@ LLMessageVariable * LLTemplateParser::parseVariable(LLTemplateTokenizer & tokens else { type_enum = MVT_FIXED; // removes a warning - llerrs << "bad variable type: " << var_type - << " at " << tokens.line() << llendl; + LL_ERRS() << "bad variable type: " << var_type + << " at " << tokens.line() << LL_ENDL; } varp = new LLMessageVariable( @@ -748,14 +748,14 @@ LLMessageVariable * LLTemplateParser::parseVariable(LLTemplateTokenizer & tokens } else { - llerrs << "bad variable type:" << var_type - << " at " << tokens.line() << llendl; + LL_ERRS() << "bad variable type:" << var_type + << " at " << tokens.line() << LL_ENDL; } if(!tokens.want("}")) { - llerrs << "Expecting closing } for variable " << var_name - << " at " << tokens.line() << llendl; + LL_ERRS() << "Expecting closing } for variable " << var_name + << " at " << tokens.line() << LL_ENDL; } return varp; } diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp index d7994030296a05fdf9066b33aa043e7def812893..c51883ee3d80f767efb7d26cc4e99b4556565895 100755 --- a/indra/llmessage/llnamevalue.cpp +++ b/indra/llmessage/llnamevalue.cpp @@ -33,7 +33,7 @@ #include "u64.h" #include "llstring.h" -#include "string_table.h" +#include "llstringtable.h" // Anonymous enumeration to provide constants in this file. // *NOTE: These values may be used in sscanf statements below as their @@ -209,7 +209,7 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con } else { - llwarns << "Unknown name value type string " << mStringType << " for " << mName << llendl; + LL_WARNS() << "Unknown name value type string " << mStringType << " for " << mName << LL_ENDL; mType = NVT_NULL; } @@ -261,8 +261,8 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con } else { - llwarns << "LLNameValue::init() - unknown sendto field " - << nvsendto << " for NV " << mName << llendl; + LL_WARNS() << "LLNameValue::init() - unknown sendto field " + << nvsendto << " for NV " << mName << LL_ENDL; mSendto = NVS_NULL; mStringSendto = mNVNameTable->addString("S"); } @@ -332,7 +332,7 @@ LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass else { mType = NVT_NULL; - llinfos << "Unknown name-value type " << mStringType << llendl; + LL_INFOS() << "Unknown name-value type " << mStringType << LL_ENDL; } // Nota Bene: Whatever global structure manages this should have these in the name table already! @@ -580,7 +580,7 @@ char *LLNameValue::getString() } else { - llerrs << mName << " not a string!" << llendl; + LL_ERRS() << mName << " not a string!" << LL_ENDL; return NULL; } } @@ -593,7 +593,7 @@ const char *LLNameValue::getAsset() const } else { - llerrs << mName << " not an asset!" << llendl; + LL_ERRS() << mName << " not an asset!" << LL_ENDL; return NULL; } } @@ -606,7 +606,7 @@ F32 *LLNameValue::getF32() } else { - llerrs << mName << " not a F32!" << llendl; + LL_ERRS() << mName << " not a F32!" << LL_ENDL; return NULL; } } @@ -619,7 +619,7 @@ S32 *LLNameValue::getS32() } else { - llerrs << mName << " not a S32!" << llendl; + LL_ERRS() << mName << " not a S32!" << LL_ENDL; return NULL; } } @@ -632,7 +632,7 @@ U32 *LLNameValue::getU32() } else { - llerrs << mName << " not a U32!" << llendl; + LL_ERRS() << mName << " not a U32!" << LL_ENDL; return NULL; } } @@ -645,7 +645,7 @@ U64 *LLNameValue::getU64() } else { - llerrs << mName << " not a U64!" << llendl; + LL_ERRS() << mName << " not a U64!" << LL_ENDL; return NULL; } } @@ -658,7 +658,7 @@ void LLNameValue::getVec3(LLVector3 &vec) } else { - llerrs << mName << " not a Vec3!" << llendl; + LL_ERRS() << mName << " not a Vec3!" << LL_ENDL; } } @@ -670,7 +670,7 @@ LLVector3 *LLNameValue::getVec3() } else { - llerrs << mName << " not a Vec3!" << llendl; + LL_ERRS() << mName << " not a Vec3!" << LL_ENDL; return NULL; } } @@ -726,7 +726,7 @@ LLNameValue &LLNameValue::operator=(const LLNameValue &a) *mNameValueReference.u64 = *a.mNameValueReference.u64; break; default: - llerrs << "Unknown Name value type " << (U32)a.mType << llendl; + LL_ERRS() << "Unknown Name value type " << (U32)a.mType << LL_ENDL; break; } @@ -865,7 +865,7 @@ void LLNameValue::setU32(const U32 a) *mNameValueReference.f32 = (F32)a; break; default: - llerrs << "NameValue: Trying to set U32 into a " << mStringType << ", unknown conversion" << llendl; + LL_ERRS() << "NameValue: Trying to set U32 into a " << mStringType << ", unknown conversion" << LL_ENDL; break; } return; @@ -883,7 +883,7 @@ void LLNameValue::setVec3(const LLVector3 &a) *mNameValueReference.vec3 = a; break; default: - llerrs << "NameValue: Trying to set LLVector3 into a " << mStringType << ", unknown conversion" << llendl; + LL_ERRS() << "NameValue: Trying to set LLVector3 into a " << mStringType << ", unknown conversion" << LL_ENDL; break; } return; @@ -895,7 +895,7 @@ std::string LLNameValue::printNameValue() const std::string buffer; buffer = llformat("%s %s %s %s ", mName, mStringType, mStringClass, mStringSendto); buffer += printData(); -// llinfos << "Name Value Length: " << buffer.size() + 1 << llendl; +// LL_INFOS() << "Name Value Length: " << buffer.size() + 1 << LL_ENDL; return buffer; } @@ -928,7 +928,7 @@ std::string LLNameValue::printData() const buffer = llformat( "%f, %f, %f", mNameValueReference.vec3->mV[VX], mNameValueReference.vec3->mV[VY], mNameValueReference.vec3->mV[VZ]); break; default: - llerrs << "Trying to print unknown NameValue type " << mStringType << llendl; + LL_ERRS() << "Trying to print unknown NameValue type " << mStringType << LL_ENDL; break; } return buffer; @@ -962,7 +962,7 @@ std::ostream& operator<<(std::ostream& s, const LLNameValue &a) s << *(a.mNameValueReference.vec3); break; default: - llerrs << "Trying to print unknown NameValue type " << a.mStringType << llendl; + LL_ERRS() << "Trying to print unknown NameValue type " << a.mStringType << LL_ENDL; break; } return s; diff --git a/indra/llmessage/llnamevalue.h b/indra/llmessage/llnamevalue.h index 273de475f8736a0274701b909cac3601bb1aad92..f8b556b5fee21f9ff33cc0eecd38591c0986987a 100755 --- a/indra/llmessage/llnamevalue.h +++ b/indra/llmessage/llnamevalue.h @@ -41,7 +41,7 @@ // SitObject STRING // SitPosition VEC3 -#include "string_table.h" +#include "llstringtable.h" #include "llmath.h" #include "v3math.h" #include "lldbstrings.h" diff --git a/indra/llmessage/llpacketack.cpp b/indra/llmessage/llpacketack.cpp index f08d3404ea33ccadd44e42b7bfd28a172807ebb7..c3c022c2973144d464cd339bad2239c59815c668 100755 --- a/indra/llmessage/llpacketack.cpp +++ b/indra/llmessage/llpacketack.cpp @@ -50,7 +50,7 @@ LLReliablePacket::LLReliablePacket( mHost = params->mHost; mRetries = params->mRetries; mPingBasedRetry = params->mPingBasedRetry; - mTimeout = params->mTimeout; + mTimeout = F32Seconds(params->mTimeout); mCallback = params->mCallback; mCallbackData = params->mCallbackData; mMessageName = params->mMessageName; @@ -59,13 +59,13 @@ LLReliablePacket::LLReliablePacket( { mRetries = 0; mPingBasedRetry = TRUE; - mTimeout = 0.f; + mTimeout = F32Seconds(0.f); mCallback = NULL; mCallbackData = NULL; mMessageName = NULL; } - mExpirationTime = (F64)((S64)totalTime())/1000000.0 + mTimeout; + mExpirationTime = (F64Seconds)totalTime() + mTimeout; mPacketID = ntohl(*((U32*)(&buf_ptr[PHL_PACKET_ID]))); mSocket = socket; diff --git a/indra/llmessage/llpacketack.h b/indra/llmessage/llpacketack.h index 2ef3c48e444a9c61dcfd78369628e88ccbd97ff1..f0ed923f19385274015d981d754daddec855ff99 100755 --- a/indra/llmessage/llpacketack.h +++ b/indra/llmessage/llpacketack.h @@ -28,6 +28,7 @@ #define LL_LLPACKETACK_H #include "llhost.h" +#include "llunits.h" class LLReliablePacketParams { @@ -35,7 +36,7 @@ class LLReliablePacketParams LLHost mHost; S32 mRetries; BOOL mPingBasedRetry; - F32 mTimeout; + F32Seconds mTimeout; void (*mCallback)(void **,S32); void** mCallbackData; char* mMessageName; @@ -53,7 +54,7 @@ class LLReliablePacketParams mHost.invalidate(); mRetries = 0; mPingBasedRetry = TRUE; - mTimeout = 0.f; + mTimeout = F32Seconds(0.f); mCallback = NULL; mCallbackData = NULL; mMessageName = NULL; @@ -63,7 +64,7 @@ class LLReliablePacketParams const LLHost& host, S32 retries, BOOL ping_based_retry, - F32 timeout, + F32Seconds timeout, void (*callback)(void**,S32), void** callback_data, char* name) { @@ -98,7 +99,7 @@ class LLReliablePacket LLHost mHost; S32 mRetries; BOOL mPingBasedRetry; - F32 mTimeout; + F32Seconds mTimeout; void (*mCallback)(void**,S32); void** mCallbackData; char* mMessageName; @@ -108,7 +109,7 @@ class LLReliablePacket TPACKETID mPacketID; - F64 mExpirationTime; + F64Seconds mExpirationTime; }; #endif diff --git a/indra/llmessage/llpacketbuffer.cpp b/indra/llmessage/llpacketbuffer.cpp index e69631eb3b6ce50519f9bf39b5b60eee8cf6c071..ccf991b1a7351b7b5c8d375f4259e93ab382738b 100755 --- a/indra/llmessage/llpacketbuffer.cpp +++ b/indra/llmessage/llpacketbuffer.cpp @@ -29,7 +29,7 @@ #include "llpacketbuffer.h" #include "net.h" -#include "timing.h" +#include "lltimer.h" #include "llhost.h" /////////////////////////////////////////////////////////// @@ -41,7 +41,7 @@ LLPacketBuffer::LLPacketBuffer(const LLHost &host, const char *datap, const S32 if (size > NET_BUFFER_SIZE) { - llerrs << "Sending packet > " << NET_BUFFER_SIZE << " of size " << size << llendl; + LL_ERRS() << "Sending packet > " << NET_BUFFER_SIZE << " of size " << size << LL_ENDL; } else { diff --git a/indra/llmessage/llpacketring.cpp b/indra/llmessage/llpacketring.cpp index fc6e9c519302d9da1790c21d77daf6cf8f99f2e6..687212ea1069fa79ef99d2756b324d53c29ba3b4 100755 --- a/indra/llmessage/llpacketring.cpp +++ b/indra/llmessage/llpacketring.cpp @@ -41,7 +41,6 @@ #include "llproxy.h" #include "llrand.h" #include "message.h" -#include "timing.h" #include "u64.h" /////////////////////////////////////////////////////////// @@ -196,7 +195,7 @@ S32 LLPacketRing::receivePacket (S32 socket, char *datap) if (mInBufferLength + packetp->getSize() > mMaxBufferLength) { // Toss it. - llwarns << "Throwing away packet, overflowing buffer" << llendl; + LL_WARNS() << "Throwing away packet, overflowing buffer" << LL_ENDL; delete packetp; packetp = NULL; } @@ -324,7 +323,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL { // Nuke this packet, we overflowed the buffer. // Toss it. - llwarns << "Throwing away outbound packet, overflowing buffer" << llendl; + LL_WARNS() << "Throwing away outbound packet, overflowing buffer" << LL_ENDL; } else { @@ -332,7 +331,7 @@ BOOL LLPacketRing::sendPacket(int h_socket, char * send_buffer, S32 buf_size, LL if ((mOutBufferLength > 4192) && queue_timer.getElapsedTimeF32() > 1.f) { // Add it to the queue - llinfos << "Outbound packet queue " << mOutBufferLength << " bytes" << llendl; + LL_INFOS() << "Outbound packet queue " << mOutBufferLength << " bytes" << LL_ENDL; queue_timer.reset(); } packetp = new LLPacketBuffer(host, send_buffer, buf_size); diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp index 9988fcd9c0f6abac1d2776c04a3db8721a6b21ce..9b8d19cc3e2e0c0f1f8af2b985bae1686a85415a 100755 --- a/indra/llmessage/llproxy.cpp +++ b/indra/llmessage/llproxy.cpp @@ -57,13 +57,15 @@ LLProxy::LLProxy(): mAuthMethodSelected(METHOD_NOAUTH), mSocksUsername(), mSocksPassword() -{ -} +{} LLProxy::~LLProxy() { - stopSOCKSProxy(); - disableHTTPProxy(); + if (ll_apr_is_initialized()) + { + stopSOCKSProxy(); + disableHTTPProxy(); + } } /** diff --git a/indra/llmessage/llpumpio.cpp b/indra/llmessage/llpumpio.cpp index 0623e99f0aad069598e0c0e1439df0f81981e8ab..506ccc98a4b315ab0baab35b394d8f524779a779 100755 --- a/indra/llmessage/llpumpio.cpp +++ b/indra/llmessage/llpumpio.cpp @@ -34,6 +34,7 @@ #include "apr_poll.h" #include "llapr.h" +#include "llfasttimer.h" #include "llstl.h" // These should not be enabled in production, but they can be @@ -81,7 +82,7 @@ void ll_debug_poll_fd(const char* msg, const apr_pollfd_t* poll) #if LL_DEBUG_POLL_FILE_DESCRIPTORS if(!poll) { - lldebugs << "Poll -- " << (msg?msg:"") << ": no pollfd." << llendl; + LL_DEBUGS() << "Poll -- " << (msg?msg:"") << ": no pollfd." << LL_ENDL; return; } if(poll->desc.s) @@ -89,13 +90,13 @@ void ll_debug_poll_fd(const char* msg, const apr_pollfd_t* poll) apr_os_sock_t os_sock; if(APR_SUCCESS == apr_os_sock_get(&os_sock, poll->desc.s)) { - lldebugs << "Poll -- " << (msg?msg:"") << " on fd " << os_sock - << " at " << poll->desc.s << llendl; + LL_DEBUGS() << "Poll -- " << (msg?msg:"") << " on fd " << os_sock + << " at " << poll->desc.s << LL_ENDL; } else { - lldebugs << "Poll -- " << (msg?msg:"") << " no fd " - << " at " << poll->desc.s << llendl; + LL_DEBUGS() << "Poll -- " << (msg?msg:"") << " no fd " + << " at " << poll->desc.s << LL_ENDL; } } else if(poll->desc.f) @@ -103,18 +104,18 @@ void ll_debug_poll_fd(const char* msg, const apr_pollfd_t* poll) apr_os_file_t os_file; if(APR_SUCCESS == apr_os_file_get(&os_file, poll->desc.f)) { - lldebugs << "Poll -- " << (msg?msg:"") << " on fd " << os_file - << " at " << poll->desc.f << llendl; + LL_DEBUGS() << "Poll -- " << (msg?msg:"") << " on fd " << os_file + << " at " << poll->desc.f << LL_ENDL; } else { - lldebugs << "Poll -- " << (msg?msg:"") << " no fd " - << " at " << poll->desc.f << llendl; + LL_DEBUGS() << "Poll -- " << (msg?msg:"") << " no fd " + << " at " << poll->desc.f << LL_ENDL; } } else { - lldebugs << "Poll -- " << (msg?msg:"") << ": no descriptor." << llendl; + LL_DEBUGS() << "Poll -- " << (msg?msg:"") << ": no descriptor." << LL_ENDL; } #endif } @@ -203,10 +204,10 @@ bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request info.mData->setThreaded(has_curl_request); LLLinkInfo link; #if LL_DEBUG_PIPE_TYPE_IN_PUMP - lldebugs << "LLPumpIO::addChain() " << chain[0] << " '" - << typeid(*(chain[0])).name() << "'" << llendl; + LL_DEBUGS() << "LLPumpIO::addChain() " << chain[0] << " '" + << typeid(*(chain[0])).name() << "'" << LL_ENDL; #else - lldebugs << "LLPumpIO::addChain() " << chain[0] <<llendl; + LL_DEBUGS() << "LLPumpIO::addChain() " << chain[0] <<LL_ENDL; #endif chain_t::const_iterator it = chain.begin(); chain_t::const_iterator end = chain.end(); @@ -237,10 +238,10 @@ bool LLPumpIO::addChain( LLScopedLock lock(mChainsMutex); #endif #if LL_DEBUG_PIPE_TYPE_IN_PUMP - lldebugs << "LLPumpIO::addChain() " << links[0].mPipe << " '" - << typeid(*(links[0].mPipe)).name() << "'" << llendl; + LL_DEBUGS() << "LLPumpIO::addChain() " << links[0].mPipe << " '" + << typeid(*(links[0].mPipe)).name() << "'" << LL_ENDL; #else - lldebugs << "LLPumpIO::addChain() " << links[0].mPipe << llendl; + LL_DEBUGS() << "LLPumpIO::addChain() " << links[0].mPipe << LL_ENDL; #endif LLChainInfo info; info.setTimeoutSeconds(timeout); @@ -306,12 +307,12 @@ bool LLPumpIO::setConditional(LLIOPipe* pipe, const apr_pollfd_t* poll) if(!pipe) return false; ll_debug_poll_fd("Set conditional", poll); - lldebugs << "Setting conditionals (" << (poll ? events_2_string(poll->reqevents) :"null") + LL_DEBUGS() << "Setting conditionals (" << (poll ? events_2_string(poll->reqevents) :"null") << ") " #if LL_DEBUG_PIPE_TYPE_IN_PUMP << "on pipe " << typeid(*pipe).name() #endif - << " at " << pipe << llendl; + << " at " << pipe << LL_ENDL; // remove any matching poll file descriptors for this pipe. LLIOPipe::ptr_t pipe_ptr(pipe); @@ -430,8 +431,8 @@ void LLPumpIO::pump() pump(DEFAULT_POLL_TIMEOUT); } -static LLFastTimer::DeclareTimer FTM_PUMP_IO("Pump IO"); -static LLFastTimer::DeclareTimer FTM_PUMP_POLL("Pump Poll"); +static LLTrace::BlockTimerStatHandle FTM_PUMP_IO("Pump IO"); +static LLTrace::BlockTimerStatHandle FTM_PUMP_POLL("Pump Poll"); LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t& run_chain) { @@ -445,8 +446,8 @@ LLPumpIO::current_chain_t LLPumpIO::removeRunningChain(LLPumpIO::current_chain_t //timeout is in microseconds void LLPumpIO::pump(const S32& poll_timeout) { - LLFastTimer t1(FTM_PUMP_IO); - //llinfos << "LLPumpIO::pump()" << llendl; + LL_RECORD_BLOCK_TIME(FTM_PUMP_IO); + //LL_INFOS() << "LLPumpIO::pump()" << LL_ENDL; // Run any pending runners. mRunner.run(); @@ -474,7 +475,7 @@ void LLPumpIO::pump(const S32& poll_timeout) if(!mPendingChains.empty()) { PUMP_DEBUG; - //lldebugs << "Pushing " << mPendingChains.size() << "." << llendl; + //LL_DEBUGS() << "Pushing " << mPendingChains.size() << "." << LL_ENDL; std::copy( mPendingChains.begin(), mPendingChains.end(), @@ -522,11 +523,11 @@ void LLPumpIO::pump(const S32& poll_timeout) if(mPollset) { PUMP_DEBUG; - //llinfos << "polling" << llendl; + //LL_INFOS() << "polling" << LL_ENDL; S32 count = 0; S32 client_id = 0; { - LLFastTimer _(FTM_PUMP_POLL); + LL_RECORD_BLOCK_TIME(FTM_PUMP_POLL); apr_pollset_poll(mPollset, poll_timeout, &count, &poll_fd); } PUMP_DEBUG; @@ -544,7 +545,7 @@ void LLPumpIO::pump(const S32& poll_timeout) signal_client_t::iterator not_signalled = signalled_client.end(); // Process everything as appropriate - //lldebugs << "Running chain count: " << mRunningChains.size() << llendl; + //LL_DEBUGS() << "Running chain count: " << mRunningChains.size() << LL_ENDL; running_chains_t::iterator run_chain = mRunningChains.begin(); bool process_this_chain = false; while( run_chain != mRunningChains.end() ) @@ -564,9 +565,9 @@ void LLPumpIO::pump(const S32& poll_timeout) && (*run_chain).mTimer.hasExpired()) { PUMP_DEBUG; - llinfos << "Error handler forgot to reset timeout. " + LL_INFOS() << "Error handler forgot to reset timeout. " << "Resetting to " << DEFAULT_CHAIN_EXPIRY_SECS - << " seconds." << llendl; + << " seconds." << LL_ENDL; (*run_chain).setTimeoutSeconds(DEFAULT_CHAIN_EXPIRY_SECS); } } @@ -576,15 +577,15 @@ void LLPumpIO::pump(const S32& poll_timeout) // it timed out and no one handled it, so we need to // retire the chain #if LL_DEBUG_PIPE_TYPE_IN_PUMP - lldebugs << "Removing chain " + LL_DEBUGS() << "Removing chain " << (*run_chain).mChainLinks[0].mPipe << " '" << typeid(*((*run_chain).mChainLinks[0].mPipe)).name() - << "' because it timed out." << llendl; + << "' because it timed out." << LL_ENDL; #else -// lldebugs << "Removing chain " +// LL_DEBUGS() << "Removing chain " // << (*run_chain).mChainLinks[0].mPipe -// << " because we reached the end." << llendl; +// << " because we reached the end." << LL_ENDL; #endif run_chain = removeRunningChain(run_chain); continue; @@ -609,12 +610,12 @@ void LLPumpIO::pump(const S32& poll_timeout) { // if there are no conditionals, just process this chain. process_this_chain = true; - //lldebugs << "no conditionals - processing" << llendl; + //LL_DEBUGS() << "no conditionals - processing" << LL_ENDL; } else { PUMP_DEBUG; - //lldebugs << "checking conditionals" << llendl; + //LL_DEBUGS() << "checking conditionals" << LL_ENDL; // Check if this run chain was signalled. If any file // descriptor is ready for something, then go ahead and // process this chian. @@ -654,7 +655,7 @@ void LLPumpIO::pump(const S32& poll_timeout) error_status = LLIOPipe::STATUS_ERROR; if(handleChainError(*run_chain, error_status)) break; ll_debug_poll_fd("Removing pipe", poll); - llwarns << "Removing pipe " + LL_WARNS() << "Removing pipe " << (*run_chain).mChainLinks[0].mPipe << " '" #if LL_DEBUG_PIPE_TYPE_IN_PUMP @@ -663,7 +664,7 @@ void LLPumpIO::pump(const S32& poll_timeout) #endif << "' because: " << events_2_string(poll->rtnevents) - << llendl; + << LL_ENDL; (*run_chain).mHead = (*run_chain).mChainLinks.end(); break; } @@ -691,13 +692,13 @@ void LLPumpIO::pump(const S32& poll_timeout) if((*run_chain).mHead == (*run_chain).mChainLinks.end()) { #if LL_DEBUG_PIPE_TYPE_IN_PUMP - lldebugs << "Removing chain " << (*run_chain).mChainLinks[0].mPipe + LL_DEBUGS() << "Removing chain " << (*run_chain).mChainLinks[0].mPipe << " '" << typeid(*((*run_chain).mChainLinks[0].mPipe)).name() - << "' because we reached the end." << llendl; + << "' because we reached the end." << LL_ENDL; #else -// lldebugs << "Removing chain " << (*run_chain).mChainLinks[0].mPipe -// << " because we reached the end." << llendl; +// LL_DEBUGS() << "Removing chain " << (*run_chain).mChainLinks[0].mPipe +// << " because we reached the end." << LL_ENDL; #endif PUMP_DEBUG; @@ -773,11 +774,11 @@ bool LLPumpIO::respond( return true; } -static LLFastTimer::DeclareTimer FTM_PUMP_CALLBACK_CHAIN("Chain"); +static LLTrace::BlockTimerStatHandle FTM_PUMP_CALLBACK_CHAIN("Chain"); void LLPumpIO::callback() { - //llinfos << "LLPumpIO::callback()" << llendl; + //LL_INFOS() << "LLPumpIO::callback()" << LL_ENDL; if(true) { #if LL_THREADS_APR @@ -795,7 +796,7 @@ void LLPumpIO::callback() callbacks_t::iterator end = mCallbacks.end(); for(; it != end; ++it) { - LLFastTimer t(FTM_PUMP_CALLBACK_CHAIN); + LL_RECORD_BLOCK_TIME(FTM_PUMP_CALLBACK_CHAIN); // it's always the first and last time for respone chains (*it).mHead = (*it).mChainLinks.begin(); (*it).mInit = true; @@ -846,7 +847,7 @@ void LLPumpIO::cleanup() mCallbackMutex = NULL; if(mPollset) { -// lldebugs << "cleaning up pollset" << llendl; +// LL_DEBUGS() << "cleaning up pollset" << LL_ENDL; apr_pollset_destroy(mPollset); mPollset = NULL; } @@ -860,10 +861,10 @@ void LLPumpIO::cleanup() void LLPumpIO::rebuildPollset() { -// lldebugs << "LLPumpIO::rebuildPollset()" << llendl; +// LL_DEBUGS() << "LLPumpIO::rebuildPollset()" << LL_ENDL; if(mPollset) { - //lldebugs << "destroying pollset" << llendl; + //LL_DEBUGS() << "destroying pollset" << LL_ENDL; apr_pollset_destroy(mPollset); mPollset = NULL; } @@ -874,7 +875,7 @@ void LLPumpIO::rebuildPollset() { size += (*run_it).mDescriptors.size(); } - //lldebugs << "found " << size << " descriptors." << llendl; + //LL_DEBUGS() << "found " << size << " descriptors." << LL_ENDL; if(size) { // Recycle the memory pool @@ -921,10 +922,10 @@ void LLPumpIO::processChain(LLChainInfo& chain) { #if LL_DEBUG_PROCESS_LINK #if LL_DEBUG_PIPE_TYPE_IN_PUMP - llinfos << "Processing " << typeid(*((*it).mPipe)).name() << "." - << llendl; + LL_INFOS() << "Processing " << typeid(*((*it).mPipe)).name() << "." + << LL_ENDL; #else - llinfos << "Processing link " << (*it).mPipe << "." << llendl; + LL_INFOS() << "Processing link " << (*it).mPipe << "." << LL_ENDL; #endif #endif #if LL_DEBUG_SPEW_BUFFER_CHANNEL_IN @@ -941,15 +942,15 @@ void LLPumpIO::processChain(LLChainInfo& chain) (U8*)buf, bytes); buf[bytes] = '\0'; - llinfos << "CHANNEL IN(" << (*it).mChannels.in() << "): " - << buf << llendl; + LL_INFOS() << "CHANNEL IN(" << (*it).mChannels.in() << "): " + << buf << LL_ENDL; delete[] buf; buf = NULL; } else { - llinfos << "CHANNEL IN(" << (*it).mChannels.in()<< "): (null)" - << llendl; + LL_INFOS() << "CHANNEL IN(" << (*it).mChannels.in()<< "): (null)" + << LL_ENDL; } } #endif @@ -974,15 +975,15 @@ void LLPumpIO::processChain(LLChainInfo& chain) (U8*)buf, bytes); buf[bytes] = '\0'; - llinfos << "CHANNEL OUT(" << (*it).mChannels.out()<< "): " - << buf << llendl; + LL_INFOS() << "CHANNEL OUT(" << (*it).mChannels.out()<< "): " + << buf << LL_ENDL; delete[] buf; buf = NULL; } else { - llinfos << "CHANNEL OUT(" << (*it).mChannels.out()<< "): (null)" - << llendl; + LL_INFOS() << "CHANNEL OUT(" << (*it).mChannels.out()<< "): (null)" + << LL_ENDL; } } #endif @@ -992,11 +993,11 @@ void LLPumpIO::processChain(LLChainInfo& chain) // below. if(LLIOPipe::isSuccess(status)) { - llinfos << "Pipe returned: '" + LL_INFOS() << "Pipe returned: '" #if LL_DEBUG_PIPE_TYPE_IN_PUMP << typeid(*((*it).mPipe)).name() << "':'" #endif - << LLIOPipe::lookupStatusString(status) << "'" << llendl; + << LLIOPipe::lookupStatusString(status) << "'" << LL_ENDL; } #endif @@ -1036,12 +1037,12 @@ void LLPumpIO::processChain(LLChainInfo& chain) PUMP_DEBUG; if(LLIOPipe::isError(status)) { - llinfos << "Pump generated pipe err: '" + LL_INFOS() << "Pump generated pipe err: '" #if LL_DEBUG_PIPE_TYPE_IN_PUMP << typeid(*((*it).mPipe)).name() << "':'" #endif << LLIOPipe::lookupStatusString(status) - << "'" << llendl; + << "'" << LL_ENDL; #if LL_DEBUG_SPEW_BUFFER_CHANNEL_IN_ON_ERROR if(chain.mData) { @@ -1058,18 +1059,18 @@ void LLPumpIO::processChain(LLChainInfo& chain) (U8*)buf, bytes); buf[bytes] = '\0'; - llinfos << "Input After Error: " << buf << llendl; + LL_INFOS() << "Input After Error: " << buf << LL_ENDL; delete[] buf; buf = NULL; } else { - llinfos << "Input After Error: (null)" << llendl; + LL_INFOS() << "Input After Error: (null)" << LL_ENDL; } } else { - llinfos << "Input After Error: (null)" << llendl; + LL_INFOS() << "Input After Error: (null)" << LL_ENDL; } #endif keep_going = false; @@ -1081,8 +1082,8 @@ void LLPumpIO::processChain(LLChainInfo& chain) } else { - llinfos << "Unhandled status code: " << status << ":" - << LLIOPipe::lookupStatusString(status) << llendl; + LL_INFOS() << "Unhandled status code: " << status << ":" + << LLIOPipe::lookupStatusString(status) << LL_ENDL; } break; } @@ -1129,8 +1130,8 @@ bool LLPumpIO::handleChainError( do { #if LL_DEBUG_PIPE_TYPE_IN_PUMP - lldebugs << "Passing error to " << typeid(*((*rit).mPipe)).name() - << "." << llendl; + LL_DEBUGS() << "Passing error to " << typeid(*((*rit).mPipe)).name() + << "." << LL_ENDL; #endif error = (*rit).mPipe->handleError(error, this); switch(error) @@ -1144,8 +1145,8 @@ bool LLPumpIO::handleChainError( case LLIOPipe::STATUS_BREAK: case LLIOPipe::STATUS_NEED_PROCESS: #if LL_DEBUG_PIPE_TYPE_IN_PUMP - lldebugs << "Pipe " << typeid(*((*rit).mPipe)).name() - << " returned code to stop error handler." << llendl; + LL_DEBUGS() << "Pipe " << typeid(*((*rit).mPipe)).name() + << " returned code to stop error handler." << LL_ENDL; #endif keep_going = false; break; @@ -1155,8 +1156,8 @@ bool LLPumpIO::handleChainError( default: if(LLIOPipe::isSuccess(error)) { - llinfos << "Unhandled status code: " << error << ":" - << LLIOPipe::lookupStatusString(error) << llendl; + LL_INFOS() << "Unhandled status code: " << error << ":" + << LLIOPipe::lookupStatusString(error) << LL_ENDL; error = LLIOPipe::STATUS_ERROR; keep_going = false; } diff --git a/indra/llmessage/llregionhandle.h b/indra/llmessage/llregionhandle.h index c77794e4b80dad1e4b1675593b2ca14ac9fc40c6..e3ddd46acd93bb646865cb4b5f50aa3e63d7cce1 100755 --- a/indra/llmessage/llregionhandle.h +++ b/indra/llmessage/llregionhandle.h @@ -68,7 +68,7 @@ inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handl U32 x_int, y_int; if (x_pos < 0.f) { -// llwarns << "to_region_handle:Clamping negative x position " << x_pos << " to zero!" << llendl; +// LL_WARNS() << "to_region_handle:Clamping negative x position " << x_pos << " to zero!" << LL_ENDL; return FALSE; } else @@ -77,7 +77,7 @@ inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handl } if (y_pos < 0.f) { -// llwarns << "to_region_handle:Clamping negative y position " << y_pos << " to zero!" << llendl; +// LL_WARNS() << "to_region_handle:Clamping negative y position " << y_pos << " to zero!" << LL_ENDL; return FALSE; } else diff --git a/indra/llmessage/llregionpresenceverifier.cpp b/indra/llmessage/llregionpresenceverifier.cpp index 932cbf375e3ec2a5e45d664a79f0810a642cc8bb..e6ed37028a5c027a06f013175f4c578a58d231ed 100755 --- a/indra/llmessage/llregionpresenceverifier.cpp +++ b/indra/llmessage/llregionpresenceverifier.cpp @@ -74,7 +74,7 @@ void LLRegionPresenceVerifier::RegionResponder::result(const LLSD& content) LLHost destination(host, port); LLUUID id = content["region_id"]; - lldebugs << "Verifying " << destination.getString() << " is region " << id << llendl; + LL_DEBUGS() << "Verifying " << destination.getString() << " is region " << id << LL_ENDL; std::stringstream uri; uri << "http://" << destination.getString() << "/state/basic/"; @@ -110,8 +110,8 @@ void LLRegionPresenceVerifier::VerifiedDestinationResponder::result(const LLSD& LLUUID actual_region_id = content["region_id"]; LLUUID expected_region_id = mContent["region_id"]; - lldebugs << "Actual region: " << content << llendl; - lldebugs << "Expected region: " << mContent << llendl; + LL_DEBUGS() << "Actual region: " << content << LL_ENDL; + LL_DEBUGS() << "Expected region: " << mContent << LL_ENDL; if (mSharedData->checkValidity(content) && (actual_region_id == expected_region_id)) @@ -124,7 +124,7 @@ void LLRegionPresenceVerifier::VerifiedDestinationResponder::result(const LLSD& } else { - llwarns << "Simulator verification failed. Region: " << mUri << llendl; + LL_WARNS() << "Simulator verification failed. Region: " << mUri << LL_ENDL; mSharedData->onRegionVerificationFailed(); } } @@ -133,8 +133,8 @@ void LLRegionPresenceVerifier::VerifiedDestinationResponder::retry() { LLSD headers; headers["Cache-Control"] = "no-cache, max-age=0"; - llinfos << "Requesting region information, get uncached for region " - << mUri << llendl; + LL_INFOS() << "Requesting region information, get uncached for region " + << mUri << LL_ENDL; --mRetryCount; mSharedData->getHttpClient().get(mUri, new RegionResponder(mUri, mSharedData, mRetryCount), headers); } @@ -147,7 +147,7 @@ void LLRegionPresenceVerifier::VerifiedDestinationResponder::error(U32 status, c } else { - llwarns << "Failed to contact simulator for verification. Region: " << mUri << llendl; + LL_WARNS() << "Failed to contact simulator for verification. Region: " << mUri << LL_ENDL; mSharedData->onRegionVerificationFailed(); } } diff --git a/indra/llmessage/llsdappservices.cpp b/indra/llmessage/llsdappservices.cpp index 8bab91b0c0c5009de96be465e744d8d5e91cd2b8..4103ece33aaf320654a65bda64f139f37368a16f 100755 --- a/indra/llmessage/llsdappservices.cpp +++ b/indra/llmessage/llsdappservices.cpp @@ -119,8 +119,8 @@ class LLHTTPConfigRuntimeSingleService : public LLHTTPNode virtual bool validate(const std::string& name, LLSD& context) const { - //llinfos << "validate: " << name << ", " - // << LLSDOStreamer<LLSDNotationFormatter>(context) << llendl; + //LL_INFOS() << "validate: " << name << ", " + // << LLSDOStreamer<LLSDNotationFormatter>(context) << LL_ENDL; if((std::string("PUT") == context["request"]["verb"].asString()) && !name.empty()) { return true; @@ -257,8 +257,8 @@ class LLHTTPLiveConfigSingleService : public LLHTTPNode virtual bool validate(const std::string& name, LLSD& context) const { - llinfos << "LLHTTPLiveConfigSingleService::validate(" << name - << ")" << llendl; + LL_INFOS() << "LLHTTPLiveConfigSingleService::validate(" << name + << ")" << LL_ENDL; LLSD option = LLApp::instance()->getOption(name); if(option.isDefined()) return true; else return false; diff --git a/indra/llmessage/llsdmessage.cpp b/indra/llmessage/llsdmessage.cpp index 1c93c12d990a35ca97e9ae2d4b97db73f0c0ba4d..1d0904e3f18055e3cc1e29386ba11ae7ae8525c2 100755 --- a/indra/llmessage/llsdmessage.cpp +++ b/indra/llmessage/llsdmessage.cpp @@ -128,7 +128,7 @@ void LLSDMessage::EventResponder::errorWithContent(U32 status, const std::string } else // default error handling { - // convention seems to be to use llinfos, but that seems a bit casual? + // convention seems to be to use LL_INFOS(), but that seems a bit casual? LL_WARNS("LLSDMessage::EventResponder") << "'" << mMessage << "' to '" << mTarget << "' failed with code " << status << ": " << reason << '\n' diff --git a/indra/llmessage/llsdmessagebuilder.cpp b/indra/llmessage/llsdmessagebuilder.cpp index 615221e0ad086c54288c030fc24144f8836ebca5..49456c71ed3cc020755a95d41a3c72b8bce14cf1 100755 --- a/indra/llmessage/llsdmessagebuilder.cpp +++ b/indra/llmessage/llsdmessagebuilder.cpp @@ -91,7 +91,7 @@ void LLSDMessageBuilder::nextBlock(const char* blockname) } else { - llerrs << "existing block not array" << llendl; + LL_ERRS() << "existing block not array" << LL_ENDL; } } @@ -380,7 +380,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) break; default: - llwarns << "Unknown type in conversion of message to LLSD" << llendl; + LL_WARNS() << "Unknown type in conversion of message to LLSD" << LL_ENDL; break; } } @@ -391,7 +391,7 @@ void LLSDMessageBuilder::copyFromMessageData(const LLMsgData& data) void LLSDMessageBuilder::copyFromLLSD(const LLSD& msg) { mCurrentMessage = msg; - lldebugs << LLSDNotationStreamer(mCurrentMessage) << llendl; + LL_DEBUGS() << LLSDNotationStreamer(mCurrentMessage) << LL_ENDL; } const LLSD& LLSDMessageBuilder::getMessage() const diff --git a/indra/llmessage/llsdmessagereader.cpp b/indra/llmessage/llsdmessagereader.cpp index a6fccd2a5660c21209289681467c6d84aa3d558b..b729ebafa98648d5a3ad0827c6b5fb4ba3e8d0ae 100755 --- a/indra/llmessage/llsdmessagereader.cpp +++ b/indra/llmessage/llsdmessagereader.cpp @@ -53,16 +53,16 @@ LLSDMessageReader::~LLSDMessageReader() LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum) { - // babbage: log error to llerrs if variable not found to mimic + // babbage: log error to LL_ERRS() if variable not found to mimic // LLTemplateMessageReader::getData behaviour if(NULL == block) { - llerrs << "NULL block name" << llendl; + LL_ERRS() << "NULL block name" << LL_ENDL; return LLSD(); } if(NULL == var) { - llerrs << "NULL var name" << llendl; + LL_ERRS() << "NULL var name" << LL_ENDL; return LLSD(); } if(! input[block].isArray()) @@ -70,7 +70,7 @@ LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum // NOTE: babbage: need to return default for missing blocks to allow // backwards/forwards compatibility - handlers must cope with default // values. - llwarns << "block " << block << " not found" << llendl; + LL_WARNS() << "block " << block << " not found" << LL_ENDL; return LLSD(); } @@ -80,7 +80,7 @@ LLSD getLLSD(const LLSD& input, const char* block, const char* var, S32 blocknum // NOTE: babbage: need to return default for missing vars to allow // backwards/forwards compatibility - handlers must cope with default // values. - llwarns << "var " << var << " not found" << llendl; + LL_WARNS() << "var " << var << " not found" << LL_ENDL; } return result; } @@ -238,7 +238,7 @@ void LLSDMessageReader::getString(const char *block, const char *var, { if(buffer_size <= 0) { - llwarns << "buffer_size <= 0" << llendl; + LL_WARNS() << "buffer_size <= 0" << LL_ENDL; return; } std::string data = getLLSD(mMessage, block, var, blocknum); diff --git a/indra/llmessage/llsdrpcclient.cpp b/indra/llmessage/llsdrpcclient.cpp index fcda0e81a3d59de6eddc8e509cbe5296fff51516..eb773ceb3afa64b9d9dc7fe092d16027818d8776 100755 --- a/indra/llmessage/llsdrpcclient.cpp +++ b/indra/llmessage/llsdrpcclient.cpp @@ -30,6 +30,7 @@ #include "llsdrpcclient.h" #include "llbufferstream.h" +#include "llfasttimer.h" #include "llfiltersd2xmlrpc.h" #include "llpumpio.h" #include "llsd.h" @@ -78,7 +79,7 @@ bool LLSDRPCResponse::extractResponse(const LLSD& sd) return rv; } -static LLFastTimer::DeclareTimer FTM_SDRPC_RESPONSE("SDRPC Response"); +static LLTrace::BlockTimerStatHandle FTM_SDRPC_RESPONSE("SDRPC Response"); // virtual LLIOPipe::EStatus LLSDRPCResponse::process_impl( @@ -88,7 +89,7 @@ LLIOPipe::EStatus LLSDRPCResponse::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_SDRPC_RESPONSE); + LL_RECORD_BLOCK_TIME(FTM_SDRPC_RESPONSE); PUMP_DEBUG; if(mIsError) { @@ -128,8 +129,8 @@ bool LLSDRPCClient::call( LLSDRPCResponse* response, EPassBackQueue queue) { - //llinfos << "RPC: " << uri << "." << method << "(" << *parameter << ")" - // << llendl; + //LL_INFOS() << "RPC: " << uri << "." << method << "(" << *parameter << ")" + // << LL_ENDL; if(method.empty() || !response) { return false; @@ -154,8 +155,8 @@ bool LLSDRPCClient::call( LLSDRPCResponse* response, EPassBackQueue queue) { - //llinfos << "RPC: " << uri << "." << method << "(" << parameter << ")" - // << llendl; + //LL_INFOS() << "RPC: " << uri << "." << method << "(" << parameter << ")" + // << LL_ENDL; if(method.empty() || parameter.empty() || !response) { return false; @@ -172,7 +173,7 @@ bool LLSDRPCClient::call( return true; } -static LLFastTimer::DeclareTimer FTM_PROCESS_SDRPC_CLIENT("SDRPC Client"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_SDRPC_CLIENT("SDRPC Client"); // virtual LLIOPipe::EStatus LLSDRPCClient::process_impl( @@ -182,7 +183,7 @@ LLIOPipe::EStatus LLSDRPCClient::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_SDRPC_CLIENT); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_SDRPC_CLIENT); PUMP_DEBUG; if((STATE_NONE == mState) || (!pump)) { @@ -195,7 +196,7 @@ LLIOPipe::EStatus LLSDRPCClient::process_impl( case STATE_READY: { PUMP_DEBUG; -// lldebugs << "LLSDRPCClient::process_impl STATE_READY" << llendl; +// LL_DEBUGS() << "LLSDRPCClient::process_impl STATE_READY" << LL_ENDL; buffer->append( channels.out(), (U8*)mRequest.c_str(), @@ -208,8 +209,8 @@ LLIOPipe::EStatus LLSDRPCClient::process_impl( { PUMP_DEBUG; // The input channel has the sd response in it. - //lldebugs << "LLSDRPCClient::process_impl STATE_WAITING_FOR_RESPONSE" - // << llendl; + //LL_DEBUGS() << "LLSDRPCClient::process_impl STATE_WAITING_FOR_RESPONSE" + // << LL_ENDL; LLBufferStream resp(channels, buffer.get()); LLSD sd; LLSDSerialize::fromNotation(sd, resp, buffer->count(channels.in())); @@ -236,7 +237,7 @@ LLIOPipe::EStatus LLSDRPCClient::process_impl( case STATE_DONE: default: PUMP_DEBUG; - llinfos << "invalid state to process" << llendl; + LL_INFOS() << "invalid state to process" << LL_ENDL; rv = STATUS_ERROR; break; } diff --git a/indra/llmessage/llsdrpcclient.h b/indra/llmessage/llsdrpcclient.h index 0cecf4f68891cde2273abb9ddb5d22f440182cfe..8eb7a08620ac849cf04a431484f016213bcd5cf4 100755 --- a/indra/llmessage/llsdrpcclient.h +++ b/indra/llmessage/llsdrpcclient.h @@ -239,11 +239,11 @@ class LLSDRPCClientFactory : public LLChainIOFactory LLSDRPCClientFactory(const std::string& fixed_url) : mURL(fixed_url) {} virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const { - lldebugs << "LLSDRPCClientFactory::build" << llendl; + LL_DEBUGS() << "LLSDRPCClientFactory::build" << LL_ENDL; LLURLRequest* http(new LLURLRequest(LLURLRequest::HTTP_POST)); if(!http->isValid()) { - llwarns << "Creating LLURLRequest failed." << llendl ; + LL_WARNS() << "Creating LLURLRequest failed." << LL_ENDL ; delete http; return false; } @@ -289,12 +289,12 @@ class LLXMLSDRPCClientFactory : public LLChainIOFactory LLXMLSDRPCClientFactory(const std::string& fixed_url) : mURL(fixed_url) {} virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const { - lldebugs << "LLXMLSDRPCClientFactory::build" << llendl; + LL_DEBUGS() << "LLXMLSDRPCClientFactory::build" << LL_ENDL; LLURLRequest* http(new LLURLRequest(LLURLRequest::HTTP_POST)); if(!http->isValid()) { - llwarns << "Creating LLURLRequest failed." << llendl ; + LL_WARNS() << "Creating LLURLRequest failed." << LL_ENDL ; delete http; return false ; } diff --git a/indra/llmessage/llsdrpcserver.cpp b/indra/llmessage/llsdrpcserver.cpp index f26ee52f7187112a5c5eaa72951e11eb554ea82d..c3ed19889e83e5084f10296b1f9560a689b790e8 100755 --- a/indra/llmessage/llsdrpcserver.cpp +++ b/indra/llmessage/llsdrpcserver.cpp @@ -31,6 +31,7 @@ #include "llbuffer.h" #include "llbufferstream.h" +#include "llfasttimer.h" #include "llpumpio.h" #include "llsdserialize.h" #include "llstl.h" @@ -94,7 +95,7 @@ void LLSDRPCServer::clearLock() } } -static LLFastTimer::DeclareTimer FTM_PROCESS_SDRPC_SERVER("SDRPC Server"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_SDRPC_SERVER("SDRPC Server"); // virtual LLIOPipe::EStatus LLSDRPCServer::process_impl( @@ -104,9 +105,9 @@ LLIOPipe::EStatus LLSDRPCServer::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_SDRPC_SERVER); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_SDRPC_SERVER); PUMP_DEBUG; -// lldebugs << "LLSDRPCServer::process_impl" << llendl; +// LL_DEBUGS() << "LLSDRPCServer::process_impl" << LL_ENDL; // Once we have all the data, We need to read the sd on // the the in channel, and respond on the out channel if(!eos) return STATUS_BREAK; @@ -131,10 +132,10 @@ LLIOPipe::EStatus LLSDRPCServer::process_impl( return STATUS_DONE; case STATE_DONE: -// lldebugs << "STATE_DONE" << llendl; +// LL_DEBUGS() << "STATE_DONE" << LL_ENDL; break; case STATE_CALLBACK: -// lldebugs << "STATE_CALLBACK" << llendl; +// LL_DEBUGS() << "STATE_CALLBACK" << LL_ENDL; PUMP_DEBUG; method_name = mRequest[LLSDRPC_METHOD_SD_NAME].asString(); if(!method_name.empty() && mRequest.has(LLSDRPC_PARAMETER_SD_NAME)) @@ -168,7 +169,7 @@ LLIOPipe::EStatus LLSDRPCServer::process_impl( mState = STATE_DONE; break; case STATE_NONE: -// lldebugs << "STATE_NONE" << llendl; +// LL_DEBUGS() << "STATE_NONE" << LL_ENDL; default: { // First time we got here - process the SD request, and call @@ -316,7 +317,7 @@ void LLSDRPCServer::buildFault( { LLBufferStream ostr(channels, data); ostr << FAULT_PART_1 << code << FAULT_PART_2 << msg << FAULT_PART_3; - llinfos << "LLSDRPCServer::buildFault: " << code << ", " << msg << llendl; + LL_INFOS() << "LLSDRPCServer::buildFault: " << code << ", " << msg << LL_ENDL; } // static @@ -333,6 +334,6 @@ void LLSDRPCServer::buildResponse( std::ostringstream debug_ostr; debug_ostr << "LLSDRPCServer::buildResponse: "; LLSDSerialize::toNotation(response, debug_ostr); - llinfos << debug_ostr.str() << llendl; + LL_INFOS() << debug_ostr.str() << LL_ENDL; #endif } diff --git a/indra/llmessage/llsdrpcserver.h b/indra/llmessage/llsdrpcserver.h index 9e56e4ea46517cd848389fb11f4ff6efc1c24556..415bd31c26e11f0412cc5565a11c6731c6c84a9a 100755 --- a/indra/llmessage/llsdrpcserver.h +++ b/indra/llmessage/llsdrpcserver.h @@ -323,7 +323,7 @@ class LLSDRPCServerFactory : public LLChainIOFactory public: virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const { - lldebugs << "LLXMLSDRPCServerFactory::build" << llendl; + LL_DEBUGS() << "LLXMLSDRPCServerFactory::build" << LL_ENDL; chain.push_back(LLIOPipe::ptr_t(new Server)); return true; } @@ -341,7 +341,7 @@ class LLXMLRPCServerFactory : public LLChainIOFactory public: virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const { - lldebugs << "LLXMLSDRPCServerFactory::build" << llendl; + LL_DEBUGS() << "LLXMLSDRPCServerFactory::build" << LL_ENDL; chain.push_back(LLIOPipe::ptr_t(new LLFilterXMLRPCRequest2LLSD)); chain.push_back(LLIOPipe::ptr_t(new Server)); chain.push_back(LLIOPipe::ptr_t(new LLFilterSD2XMLRPCResponse)); diff --git a/indra/llmessage/llservice.cpp b/indra/llmessage/llservice.cpp index dbec92c2217f768b5f98713007be99779d991bbb..ddcc13d9695692038c2190c0367bcb12353e8220 100755 --- a/indra/llmessage/llservice.cpp +++ b/indra/llmessage/llservice.cpp @@ -41,7 +41,7 @@ LLService::~LLService() // static bool LLService::registerCreator(const std::string& name, creator_t fn) { - llinfos << "LLService::registerCreator(" << name << ")" << llendl; + LL_INFOS() << "LLService::registerCreator(" << name << ")" << LL_ENDL; if(name.empty()) { return false; @@ -64,7 +64,7 @@ LLIOPipe* LLService::activate( { if(name.empty()) { - llinfos << "LLService::activate - no service specified." << llendl; + LL_INFOS() << "LLService::activate - no service specified." << LL_ENDL; return NULL; } creators_t::iterator it = sCreatorFunctors.find(name); @@ -79,15 +79,15 @@ LLIOPipe* LLService::activate( { // empty out the chain, because failed service creation // should just discard this stuff. - llwarns << "LLService::activate - unable to build chain: " << name - << llendl; + LL_WARNS() << "LLService::activate - unable to build chain: " << name + << LL_ENDL; chain.clear(); } } else { - llwarns << "LLService::activate - unable find factory: " << name - << llendl; + LL_WARNS() << "LLService::activate - unable find factory: " << name + << LL_ENDL; } return rv; } diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp index b9aef3d0ba1527b6a2f495d7ed756b218fa0d101..392e7f1091e913ade8cd55c209c273071d15fbf2 100755 --- a/indra/llmessage/llservicebuilder.cpp +++ b/indra/llmessage/llservicebuilder.cpp @@ -50,11 +50,11 @@ void LLServiceBuilder::loadServiceDefinitionsFromFile( std::string service_name = (*array_itr)["name"].asString(); createServiceDefinition(service_name, service_llsd); } - llinfos << "loaded config file: " << service_filename << llendl; + LL_INFOS() << "loaded config file: " << service_filename << LL_ENDL; } else { - llwarns << "unable to find config file: " << service_filename << llendl; + LL_WARNS() << "unable to find config file: " << service_filename << LL_ENDL; } } @@ -119,7 +119,7 @@ std::string LLServiceBuilder::buildServiceURI(const std::string& service_name) c } else { - llwarns << "Cannot find service " << service_name << llendl; + LL_WARNS() << "Cannot find service " << service_name << LL_ENDL; } return service_url.str(); } @@ -204,9 +204,9 @@ std::string russ_format(const std::string& format_str, const LLSD& context) } else { - llwarns << "Unknown key: " << key << " in option map: " + LL_WARNS() << "Unknown key: " << key << " in option map: " << LLSDOStreamer<LLSDNotationFormatter>(context) - << llendl; + << LL_ENDL; keep_looping = false; } break; @@ -220,8 +220,8 @@ std::string russ_format(const std::string& format_str, const LLSD& context) } break; default: - llinfos << "Unknown directive: " << *(deepest_node + 1) - << llendl; + LL_INFOS() << "Unknown directive: " << *(deepest_node + 1) + << LL_ENDL; keep_looping = false; break; } @@ -229,8 +229,8 @@ std::string russ_format(const std::string& format_str, const LLSD& context) } if (service_url.find('{') != std::string::npos) { - llwarns << "Constructed a likely bogus service URL: " << service_url - << llendl; + LL_WARNS() << "Constructed a likely bogus service URL: " << service_url + << LL_ENDL; } return service_url; } diff --git a/indra/llmessage/lltemplatemessagebuilder.cpp b/indra/llmessage/lltemplatemessagebuilder.cpp index 9e8eb484606c215d8f0fe689db2f1de66dc95da2..8d7c4c028268a85ff185a4aff5a771c52bb7c746 100755 --- a/indra/llmessage/lltemplatemessagebuilder.cpp +++ b/indra/llmessage/lltemplatemessagebuilder.cpp @@ -81,7 +81,7 @@ void LLTemplateMessageBuilder::newMessage(const char *name) if (msg_template->getDeprecation() != MD_NOTDEPRECATED) { - llwarns << "Sending deprecated message " << namep << llendl; + LL_WARNS() << "Sending deprecated message " << namep << LL_ENDL; } LLMessageTemplate::message_block_map_t::const_iterator iter; @@ -96,7 +96,7 @@ void LLTemplateMessageBuilder::newMessage(const char *name) } else { - llerrs << "newMessage - Message " << name << " not registered" << llendl; + LL_ERRS() << "newMessage - Message " << name << " not registered" << LL_ENDL; } } @@ -125,7 +125,7 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname) if (!mCurrentSMessageTemplate) { - llerrs << "newMessage not called prior to setBlock" << llendl; + LL_ERRS() << "newMessage not called prior to setBlock" << LL_ENDL; return; } @@ -133,8 +133,8 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname) const LLMessageBlock* template_data = mCurrentSMessageTemplate->getBlock(bnamep); if (!template_data) { - llerrs << "LLTemplateMessageBuilder::nextBlock " << bnamep - << " not a block in " << mCurrentSMessageTemplate->mName << llendl; + LL_ERRS() << "LLTemplateMessageBuilder::nextBlock " << bnamep + << " not a block in " << mCurrentSMessageTemplate->mName << LL_ENDL; return; } @@ -164,8 +164,8 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname) // if the block is type MBT_SINGLE this is bad! if (template_data->mType == MBT_SINGLE) { - llerrs << "LLTemplateMessageBuilder::nextBlock called multiple times" - << " for " << bnamep << " but is type MBT_SINGLE" << llendl; + LL_ERRS() << "LLTemplateMessageBuilder::nextBlock called multiple times" + << " for " << bnamep << " but is type MBT_SINGLE" << LL_ENDL; return; } @@ -175,10 +175,10 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname) if ( (template_data->mType == MBT_MULTIPLE) &&(mCurrentSDataBlock->mBlockNumber == template_data->mNumber)) { - llerrs << "LLTemplateMessageBuilder::nextBlock called " + LL_ERRS() << "LLTemplateMessageBuilder::nextBlock called " << mCurrentSDataBlock->mBlockNumber << " times for " << bnamep << " exceeding " << template_data->mNumber - << " specified in type MBT_MULTIPLE." << llendl; + << " specified in type MBT_MULTIPLE." << LL_ENDL; return; } @@ -191,8 +191,8 @@ void LLTemplateMessageBuilder::nextBlock(const char* blockname) if (block_data->mBlockNumber > MAX_BLOCKS) { - llerrs << "Trying to pack too many blocks into MBT_VARIABLE type " - << "(limited to " << MAX_BLOCKS << ")" << llendl; + LL_ERRS() << "Trying to pack too many blocks into MBT_VARIABLE type " + << "(limited to " << MAX_BLOCKS << ")" << LL_ENDL; } // create new name @@ -263,11 +263,11 @@ BOOL LLTemplateMessageBuilder::removeLastBlock() if (num_blocks <= 1) { // we just blew away the last one, so return FALSE - llwarns << "not blowing away the only block of message " + LL_WARNS() << "not blowing away the only block of message " << mCurrentSMessageName << ". Block: " << block_name << ". Number: " << num_blocks - << llendl; + << LL_ENDL; return FALSE; } else @@ -290,14 +290,14 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM // do we have a current message? if (!mCurrentSMessageTemplate) { - llerrs << "newMessage not called prior to addData" << llendl; + LL_ERRS() << "newMessage not called prior to addData" << LL_ENDL; return; } // do we have a current block? if (!mCurrentSDataBlock) { - llerrs << "setBlock not called prior to addData" << llendl; + LL_ERRS() << "setBlock not called prior to addData" << LL_ENDL; return; } @@ -305,7 +305,7 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM const LLMessageVariable* var_data = mCurrentSMessageTemplate->getBlock(mCurrentSBlockName)->getVariable(vnamep); if (!var_data || !var_data->getName()) { - llerrs << vnamep << " not a variable in block " << mCurrentSBlockName << " of " << mCurrentSMessageTemplate->mName << llendl; + LL_ERRS() << vnamep << " not a variable in block " << mCurrentSBlockName << " of " << mCurrentSMessageTemplate->mName << LL_ENDL; return; } @@ -316,9 +316,9 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM if ((var_data->getSize() == 1) && (size > 255)) { - llwarns << "Field " << varname << " is a Variable 1 but program " + LL_WARNS() << "Field " << varname << " is a Variable 1 but program " << "attempted to stuff more than 255 bytes in " - << "(" << size << "). Clamping size and truncating data." << llendl; + << "(" << size << "). Clamping size and truncating data." << LL_ENDL; size = 255; char *truncate = (char *)data; truncate[254] = 0; // array size is 255 but the last element index is 254 @@ -332,8 +332,8 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM { if (size != var_data->getSize()) { - llerrs << varname << " is type MVT_FIXED but request size " << size << " doesn't match template size " - << var_data->getSize() << llendl; + LL_ERRS() << varname << " is type MVT_FIXED but request size " << size << " doesn't match template size " + << var_data->getSize() << LL_ENDL; return; } // alright, smash it in @@ -350,14 +350,14 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM // do we have a current message? if (!mCurrentSMessageTemplate) { - llerrs << "newMessage not called prior to addData" << llendl; + LL_ERRS() << "newMessage not called prior to addData" << LL_ENDL; return; } // do we have a current block? if (!mCurrentSDataBlock) { - llerrs << "setBlock not called prior to addData" << llendl; + LL_ERRS() << "setBlock not called prior to addData" << LL_ENDL; return; } @@ -365,7 +365,7 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM const LLMessageVariable* var_data = mCurrentSMessageTemplate->getBlock(mCurrentSBlockName)->getVariable(vnamep); if (!var_data->getName()) { - llerrs << vnamep << " not a variable in block " << mCurrentSBlockName << " of " << mCurrentSMessageTemplate->mName << llendl; + LL_ERRS() << vnamep << " not a variable in block " << mCurrentSBlockName << " of " << mCurrentSMessageTemplate->mName << LL_ENDL; return; } @@ -373,7 +373,7 @@ void LLTemplateMessageBuilder::addData(const char *varname, const void *data, EM if (var_data->getType() == MVT_VARIABLE) { // nope - llerrs << vnamep << " is type MVT_VARIABLE. Call using addData(name, data, size)" << llendl; + LL_ERRS() << vnamep << " is type MVT_VARIABLE. Call using addData(name, data, size)" << LL_ENDL; return; } else @@ -643,8 +643,8 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat // Just reporting error is likely not enough. Need // to check how to abort or error out gracefully // from this function. XXXTBD - llerrs << "buildBlock failed. Message excedding " - << "sendBuffersize." << llendl; + LL_ERRS() << "buildBlock failed. Message excedding " + << "sendBuffersize." << LL_ENDL; } } else if (template_data->mType == MBT_MULTIPLE) @@ -652,10 +652,10 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat if (block_count != template_data->mNumber) { // nope! need to fill it in all the way! - llerrs << "Block " << mbci->mName + LL_ERRS() << "Block " << mbci->mName << " is type MBT_MULTIPLE but only has data for " << block_count << " out of its " - << template_data->mNumber << " blocks" << llendl; + << template_data->mNumber << " blocks" << LL_ENDL; } } @@ -669,10 +669,10 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat if (mvci.getSize() == -1) { // oops, this variable wasn't ever set! - llerrs << "The variable " << mvci.getName() << " in block " + LL_ERRS() << "The variable " << mvci.getName() << " in block " << mbci->mName << " of message " << template_data->mName - << " wasn't set prior to buildMessage call" << llendl; + << " wasn't set prior to buildMessage call" << LL_ENDL; } else { @@ -699,7 +699,7 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat htonmemcpy(&buffer[result], &size, MVT_S32, 4); break; default: - llerrs << "Attempting to build variable field with unknown size of " << size << llendl; + LL_ERRS() << "Attempting to build variable field with unknown size of " << size << LL_ENDL; break; } result += mvci.getDataSize(); @@ -721,11 +721,11 @@ static S32 buildBlock(U8* buffer, S32 buffer_size, const LLMessageBlock* templat // Just reporting error is likely not // enough. Need to check how to abort or error // out gracefully from this function. XXXTBD - llerrs << "buildBlock failed. " + LL_ERRS() << "buildBlock failed. " << "Attempted to pack " << (result + mvci.getSize()) << " bytes into a buffer with size " - << buffer_size << "." << llendl; + << buffer_size << "." << LL_ENDL; } } } @@ -760,7 +760,7 @@ U32 LLTemplateMessageBuilder::buildMessage( // do we have a current message? if (!mCurrentSMessageTemplate) { - llerrs << "newMessage not called prior to buildMessage" << llendl; + LL_ERRS() << "newMessage not called prior to buildMessage" << LL_ENDL; return 0; } @@ -809,7 +809,7 @@ U32 LLTemplateMessageBuilder::buildMessage( } else { - llerrs << "unexpected message frequency in buildMessage" << llendl; + LL_ERRS() << "unexpected message frequency in buildMessage" << LL_ENDL; return 0; } diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index 94bc7cb0458455df8b961444c2270de56a8bf597..406afadd2f87532e7f110b2de8c36187ee349713 100755 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -68,13 +68,13 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname // is there a message ready to go? if (mReceiveSize == -1) { - llerrs << "No message waiting for decode 2!" << llendl; + LL_ERRS() << "No message waiting for decode 2!" << LL_ENDL; return; } if (!mCurrentRMessageData) { - llerrs << "Invalid mCurrentMessageData in getData!" << llendl; + LL_ERRS() << "Invalid mCurrentMessageData in getData!" << LL_ENDL; return; } @@ -85,8 +85,8 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname if (iter == mCurrentRMessageData->mMemberBlocks.end()) { - llerrs << "Block " << blockname << " #" << blocknum - << " not in message " << mCurrentRMessageData->mName << llendl; + LL_ERRS() << "Block " << blockname << " #" << blocknum + << " not in message " << mCurrentRMessageData->mName << LL_ENDL; return; } @@ -95,8 +95,8 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname if (var_data_map.find(vnamep) == var_data_map.end()) { - llerrs << "Variable "<< vnamep << " not in message " - << mCurrentRMessageData->mName<< " block " << bnamep << llendl; + LL_ERRS() << "Variable "<< vnamep << " not in message " + << mCurrentRMessageData->mName<< " block " << bnamep << LL_ENDL; return; } @@ -104,11 +104,11 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname if (size && size != vardata.getSize()) { - llerrs << "Msg " << mCurrentRMessageData->mName + LL_ERRS() << "Msg " << mCurrentRMessageData->mName << " variable " << vnamep << " is size " << vardata.getSize() << " but copying into buffer of size " << size - << llendl; + << LL_ENDL; return; } @@ -138,11 +138,11 @@ void LLTemplateMessageReader::getData(const char *blockname, const char *varname } else { - llwarns << "Msg " << mCurrentRMessageData->mName + LL_WARNS() << "Msg " << mCurrentRMessageData->mName << " variable " << vnamep << " is size " << vardata.getSize() << " but truncated to max size of " << max_size - << llendl; + << LL_ENDL; memcpy(datap, vardata.getData(), max_size); } @@ -153,13 +153,13 @@ S32 LLTemplateMessageReader::getNumberOfBlocks(const char *blockname) // is there a message ready to go? if (mReceiveSize == -1) { - llerrs << "No message waiting for decode 3!" << llendl; + LL_ERRS() << "No message waiting for decode 3!" << LL_ENDL; return -1; } if (!mCurrentRMessageData) { - llerrs << "Invalid mCurrentRMessageData in getData!" << llendl; + LL_ERRS() << "Invalid mCurrentRMessageData in getData!" << LL_ENDL; return -1; } @@ -180,13 +180,13 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname) // is there a message ready to go? if (mReceiveSize == -1) { // This is a serious error - crash - llerrs << "No message waiting for decode 4!" << llendl; + LL_ERRS() << "No message waiting for decode 4!" << LL_ENDL; return LL_MESSAGE_ERROR; } if (!mCurrentRMessageData) { // This is a serious error - crash - llerrs << "Invalid mCurrentRMessageData in getData!" << llendl; + LL_ERRS() << "Invalid mCurrentRMessageData in getData!" << LL_ENDL; return LL_MESSAGE_ERROR; } @@ -196,8 +196,8 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname) if (iter == mCurrentRMessageData->mMemberBlocks.end()) { // don't crash - llinfos << "Block " << bnamep << " not in message " - << mCurrentRMessageData->mName << llendl; + LL_INFOS() << "Block " << bnamep << " not in message " + << mCurrentRMessageData->mName << LL_ENDL; return LL_BLOCK_NOT_IN_MESSAGE; } @@ -208,15 +208,15 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, const char *varname) if (!vardata.getName()) { // don't crash - llinfos << "Variable " << varname << " not in message " - << mCurrentRMessageData->mName << " block " << bnamep << llendl; + LL_INFOS() << "Variable " << varname << " not in message " + << mCurrentRMessageData->mName << " block " << bnamep << LL_ENDL; return LL_VARIABLE_NOT_IN_BLOCK; } if (mCurrentRMessageTemplate->mMemberBlocks[bnamep]->mType != MBT_SINGLE) { // This is a serious error - crash - llerrs << "Block " << bnamep << " isn't type MBT_SINGLE," - " use getSize with blocknum argument!" << llendl; + LL_ERRS() << "Block " << bnamep << " isn't type MBT_SINGLE," + " use getSize with blocknum argument!" << LL_ENDL; return LL_MESSAGE_ERROR; } @@ -228,13 +228,13 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const // is there a message ready to go? if (mReceiveSize == -1) { // This is a serious error - crash - llerrs << "No message waiting for decode 5!" << llendl; + LL_ERRS() << "No message waiting for decode 5!" << LL_ENDL; return LL_MESSAGE_ERROR; } if (!mCurrentRMessageData) { // This is a serious error - crash - llerrs << "Invalid mCurrentRMessageData in getData!" << llendl; + LL_ERRS() << "Invalid mCurrentRMessageData in getData!" << LL_ENDL; return LL_MESSAGE_ERROR; } @@ -245,8 +245,8 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const if (iter == mCurrentRMessageData->mMemberBlocks.end()) { // don't crash - llinfos << "Block " << bnamep << " not in message " - << mCurrentRMessageData->mName << llendl; + LL_INFOS() << "Block " << bnamep << " not in message " + << mCurrentRMessageData->mName << LL_ENDL; return LL_BLOCK_NOT_IN_MESSAGE; } @@ -255,8 +255,8 @@ S32 LLTemplateMessageReader::getSize(const char *blockname, S32 blocknum, const if (!vardata.getName()) { // don't crash - llinfos << "Variable " << vnamep << " not in message " - << mCurrentRMessageData->mName << " block " << bnamep << llendl; + LL_INFOS() << "Variable " << vnamep << " not in message " + << mCurrentRMessageData->mName << " block " << bnamep << LL_ENDL; return LL_VARIABLE_NOT_IN_BLOCK; } @@ -328,8 +328,8 @@ void LLTemplateMessageReader::getF32(const char *block, const char *var, if( !llfinite( d ) ) { - llwarns << "non-finite in getF32Fast " << block << " " << var - << llendl; + LL_WARNS() << "non-finite in getF32Fast " << block << " " << var + << LL_ENDL; d = 0; } } @@ -341,8 +341,8 @@ void LLTemplateMessageReader::getF64(const char *block, const char *var, if( !llfinite( d ) ) { - llwarns << "non-finite in getF64Fast " << block << " " << var - << llendl; + LL_WARNS() << "non-finite in getF64Fast " << block << " " << var + << LL_ENDL; d = 0; } } @@ -354,8 +354,8 @@ void LLTemplateMessageReader::getVector3(const char *block, const char *var, if( !v.isFinite() ) { - llwarns << "non-finite in getVector3Fast " << block << " " - << var << llendl; + LL_WARNS() << "non-finite in getVector3Fast " << block << " " + << var << LL_ENDL; v.zeroVec(); } } @@ -367,8 +367,8 @@ void LLTemplateMessageReader::getVector4(const char *block, const char *var, if( !v.isFinite() ) { - llwarns << "non-finite in getVector4Fast " << block << " " - << var << llendl; + LL_WARNS() << "non-finite in getVector4Fast " << block << " " + << var << LL_ENDL; v.zeroVec(); } } @@ -380,8 +380,8 @@ void LLTemplateMessageReader::getVector3d(const char *block, const char *var, if( !v.isFinite() ) { - llwarns << "non-finite in getVector3dFast " << block << " " - << var << llendl; + LL_WARNS() << "non-finite in getVector3dFast " << block << " " + << var << LL_ENDL; v.zeroVec(); } @@ -398,8 +398,8 @@ void LLTemplateMessageReader::getQuat(const char *block, const char *var, } else { - llwarns << "non-finite in getQuatFast " << block << " " << var - << llendl; + LL_WARNS() << "non-finite in getQuatFast " << block << " " << var + << LL_ENDL; q.loadIdentity(); } } @@ -452,7 +452,7 @@ BOOL LLTemplateMessageReader::decodeTemplate( // is there a message ready to go? if (buffer_size <= 0) { - llwarns << "No message waiting for decode!" << llendl; + LL_WARNS() << "No message waiting for decode!" << LL_ENDL; return(FALSE); } @@ -487,8 +487,8 @@ BOOL LLTemplateMessageReader::decodeTemplate( } else // bogus packet received (too short) { - llwarns << "Packet with unusable length received (too short): " - << buffer_size << llendl; + LL_WARNS() << "Packet with unusable length received (too short): " + << buffer_size << LL_ENDL; return(FALSE); } @@ -499,8 +499,8 @@ BOOL LLTemplateMessageReader::decodeTemplate( } else { - llwarns << "Message #" << std::hex << num << std::dec - << " received but not registered!" << llendl; + LL_WARNS() << "Message #" << std::hex << num << std::dec + << " received but not registered!" << LL_ENDL; gMessageSystem->callExceptionFunc(MX_UNREGISTERED_MESSAGE); return(FALSE); } @@ -511,23 +511,23 @@ BOOL LLTemplateMessageReader::decodeTemplate( void LLTemplateMessageReader::logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted ) { // we've run off the end of the packet! - llwarns << "Ran off end of packet " << mCurrentRMessageTemplate->mName + LL_WARNS() << "Ran off end of packet " << mCurrentRMessageTemplate->mName // << " with id " << mCurrentRecvPacketID << " from " << host << " trying to read " << wanted << " bytes at position " << where << " going past packet end at " << mReceiveSize - << llendl; + << LL_ENDL; if(gMessageSystem->mVerboseLog) { - llinfos << "MSG: -> " << host << "\tREAD PAST END:\t" + LL_INFOS() << "MSG: -> " << host << "\tREAD PAST END:\t" // << mCurrentRecvPacketID << " " - << getMessageName() << llendl; + << getMessageName() << LL_ENDL; } gMessageSystem->callExceptionFunc(MX_RAN_OFF_END_OF_PACKET); } -static LLFastTimer::DeclareTimer FTM_PROCESS_MESSAGES("Process Messages"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_MESSAGES("Process Messages"); // decode a given message BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender ) @@ -588,7 +588,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender } else { - llerrs << "Unknown block type" << llendl; + LL_ERRS() << "Unknown block type" << LL_ENDL; return FALSE; } @@ -655,7 +655,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender htonmemcpy(&tsize, &buffer[decode_pos], MVT_U32, 4); break; default: - llerrs << "Attempting to read variable field with unknown size of " << data_size << llendl; + LL_ERRS() << "Attempting to read variable field with unknown size of " << data_size << LL_ENDL; break; } } @@ -694,7 +694,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender if (mCurrentRMessageData->mMemberBlocks.empty() && !mCurrentRMessageTemplate->mMemberBlocks.empty()) { - lldebugs << "Empty message '" << mCurrentRMessageTemplate->mName << "' (no blocks)" << llendl; + LL_DEBUGS() << "Empty message '" << mCurrentRMessageTemplate->mName << "' (no blocks)" << LL_ENDL; return FALSE; } @@ -707,10 +707,10 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender } { - LLFastTimer t(FTM_PROCESS_MESSAGES); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_MESSAGES); if( !mCurrentRMessageTemplate->callHandlerFunc(gMessageSystem) ) { - llwarns << "Message from " << sender << " with no handler function received: " << mCurrentRMessageTemplate->mName << llendl; + LL_WARNS() << "Message from " << sender << " with no handler function received: " << mCurrentRMessageTemplate->mName << LL_ENDL; } } @@ -740,9 +740,9 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender if(decode_time > LLMessageReader::getTimeDecodesSpamThreshold()) { - lldebugs << "--------- Message " << mCurrentRMessageTemplate->mName << " decode took " << decode_time << " seconds. (" << + LL_DEBUGS() << "--------- Message " << mCurrentRMessageTemplate->mName << " decode took " << decode_time << " seconds. (" << mCurrentRMessageTemplate->mMaxDecodeTimePerMsg << " max, " << - (mCurrentRMessageTemplate->mTotalDecodeTime / mCurrentRMessageTemplate->mTotalDecoded) << " avg)" << llendl; + (mCurrentRMessageTemplate->mTotalDecodeTime / mCurrentRMessageTemplate->mTotalDecoded) << " avg)" << LL_ENDL; } } } @@ -760,9 +760,9 @@ BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, if(valid) { mCurrentRMessageTemplate->mReceiveCount++; - //lldebugs << "MessageRecvd:" + //LL_DEBUGS() << "MessageRecvd:" // << mCurrentRMessageTemplate->mName - // << " from " << sender << llendl; + // << " from " << sender << LL_ENDL; } if (valid && isBanned(trusted)) @@ -772,15 +772,15 @@ BOOL LLTemplateMessageReader::validateMessage(const U8* buffer, << getMessageName() << " from " << ((trusted) ? "trusted " : "untrusted ") - << sender << llendl; + << sender << LL_ENDL; valid = FALSE; } if(valid && isUdpBanned()) { - llwarns << "Received UDP black listed message " + LL_WARNS() << "Received UDP black listed message " << getMessageName() - << " from " << sender << llendl; + << " from " << sender << LL_ENDL; valid = FALSE; } return valid; diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp index 64ebd51fec8e341ccce1089b642a132907dc8f6c..e484bd258dee385370299a5ed6b9ff68f98e9ec1 100755 --- a/indra/llmessage/llthrottle.cpp +++ b/indra/llmessage/llthrottle.cpp @@ -53,8 +53,8 @@ F32 LLThrottle::getAvailable() { // use a temporary bits_available // since we don't want to change mBitsAvailable every time - F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime); - return mAvailable + (mRate * elapsed_time); + F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime; + return mAvailable + (mRate * elapsed_time.value()); } BOOL LLThrottle::checkOverflow(const F32 amount) @@ -65,8 +65,8 @@ BOOL LLThrottle::checkOverflow(const F32 amount) // use a temporary bits_available // since we don't want to change mBitsAvailable every time - F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime); - F32 amount_available = mAvailable + (mRate * elapsed_time); + F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime; + F32 amount_available = mAvailable + (mRate * elapsed_time.value()); if ((amount_available >= lookahead_amount) || (amount_available > amount)) { @@ -80,17 +80,17 @@ BOOL LLThrottle::checkOverflow(const F32 amount) BOOL LLThrottle::throttleOverflow(const F32 amount) { - F32 elapsed_time; + F32Seconds elapsed_time; F32 lookahead_amount; BOOL retval = TRUE; lookahead_amount = mRate * mLookaheadSecs; - F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(); - elapsed_time = (F32)(mt_sec - mLastSendTime); + F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(); + elapsed_time = mt_sec - mLastSendTime; mLastSendTime = mt_sec; - mAvailable += mRate * elapsed_time; + mAvailable += mRate * elapsed_time.value(); if (mAvailable >= lookahead_amount) { @@ -222,7 +222,7 @@ void LLThrottleGroup::unpackThrottle(LLDataPacker &dp) // into NOT resetting the system. void LLThrottleGroup::resetDynamicAdjust() { - F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(); + F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(); S32 i; for (i = 0; i < TC_EOF; i++) { @@ -269,8 +269,8 @@ S32 LLThrottleGroup::getAvailable(S32 throttle_cat) // use a temporary bits_available // since we don't want to change mBitsAvailable every time - F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat]); - F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time); + F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat]; + F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time.value()); if (bits_available >= lookahead_bits) { @@ -294,8 +294,8 @@ BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits) // use a temporary bits_available // since we don't want to change mBitsAvailable every time - F32 elapsed_time = (F32)(LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat]); - F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time); + F32Seconds elapsed_time = LLMessageSystem::getMessageTimeSeconds() - mLastSendTime[throttle_cat]; + F32 bits_available = mBitsAvailable[throttle_cat] + (category_bps * elapsed_time.value()); if (bits_available >= lookahead_bits) { @@ -315,7 +315,7 @@ BOOL LLThrottleGroup::checkOverflow(S32 throttle_cat, F32 bits) BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) { - F32 elapsed_time; + F32Seconds elapsed_time; F32 category_bps; F32 lookahead_bits; BOOL retval = TRUE; @@ -323,10 +323,10 @@ BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) category_bps = mCurrentBPS[throttle_cat]; lookahead_bits = category_bps * THROTTLE_LOOKAHEAD_TIME; - F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(); - elapsed_time = (F32)(mt_sec - mLastSendTime[throttle_cat]); + F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(); + elapsed_time = mt_sec - mLastSendTime[throttle_cat]; mLastSendTime[throttle_cat] = mt_sec; - mBitsAvailable[throttle_cat] += category_bps * elapsed_time; + mBitsAvailable[throttle_cat] += category_bps * elapsed_time.value(); if (mBitsAvailable[throttle_cat] >= lookahead_bits) { @@ -356,7 +356,7 @@ BOOL LLThrottleGroup::throttleOverflow(S32 throttle_cat, F32 bits) BOOL LLThrottleGroup::dynamicAdjust() { - const F32 DYNAMIC_ADJUST_TIME = 1.0f; // seconds + const F32Seconds DYNAMIC_ADJUST_TIME(1.0f); const F32 CURRENT_PERIOD_WEIGHT = .25f; // how much weight to give to last period while determining BPS utilization const F32 BUSY_PERCENT = 0.75f; // if use more than this fraction of BPS, you are busy const F32 IDLE_PERCENT = 0.70f; // if use less than this fraction, you are "idle" @@ -365,7 +365,7 @@ BOOL LLThrottleGroup::dynamicAdjust() S32 i; - F64 mt_sec = LLMessageSystem::getMessageTimeSeconds(); + F64Seconds mt_sec = LLMessageSystem::getMessageTimeSeconds(); // Only dynamically adjust every few seconds if ((mt_sec - mDynamicAdjustTime) < DYNAMIC_ADJUST_TIME) @@ -405,7 +405,7 @@ BOOL LLThrottleGroup::dynamicAdjust() for (i = 0; i < TC_EOF; i++) { // Is this a busy channel? - if (mBitsSentHistory[i] >= BUSY_PERCENT * DYNAMIC_ADJUST_TIME * mCurrentBPS[i]) + if (mBitsSentHistory[i] >= BUSY_PERCENT * DYNAMIC_ADJUST_TIME.value() * mCurrentBPS[i]) { // this channel is busy channels_busy = TRUE; @@ -418,7 +418,7 @@ BOOL LLThrottleGroup::dynamicAdjust() } // Is this an idle channel? - if ((mBitsSentHistory[i] < IDLE_PERCENT * DYNAMIC_ADJUST_TIME * mCurrentBPS[i]) && + if ((mBitsSentHistory[i] < IDLE_PERCENT * DYNAMIC_ADJUST_TIME.value() * mCurrentBPS[i]) && (mBitsAvailable[i] > 0)) { channel_idle[i] = TRUE; @@ -440,8 +440,8 @@ BOOL LLThrottleGroup::dynamicAdjust() //if (total) //{ - // llinfos << i << ": B" << channel_busy[i] << " I" << channel_idle[i] << " N" << channel_over_nominal[i]; - // llcont << " Nom: " << mNominalBPS[i] << " Cur: " << mCurrentBPS[i] << " BS: " << mBitsSentHistory[i] << llendl; + // LL_INFOS() << i << ": B" << channel_busy[i] << " I" << channel_idle[i] << " N" << channel_over_nominal[i]; + // LL_CONT << " Nom: " << mNominalBPS[i] << " Cur: " << mCurrentBPS[i] << " BS: " << mBitsSentHistory[i] << LL_ENDL; //} } @@ -462,7 +462,7 @@ BOOL LLThrottleGroup::dynamicAdjust() // Therefore it's a candidate to give up some bandwidth. // Figure out how much bandwidth it has been using, and how // much is available to steal. - used_bps = mBitsSentHistory[i] / DYNAMIC_ADJUST_TIME; + used_bps = mBitsSentHistory[i] / DYNAMIC_ADJUST_TIME.value(); // CRO make sure to keep a minimum amount of throttle available // CRO NB: channels set to < MINIMUM_BPS will never give up bps, @@ -482,7 +482,7 @@ BOOL LLThrottleGroup::dynamicAdjust() avail_bps = mCurrentBPS[i] - used_bps; } - //llinfos << i << " avail " << avail_bps << llendl; + //LL_INFOS() << i << " avail " << avail_bps << LL_ENDL; // Historically, a channel could have used more than its current share, // even if it's idle right now. @@ -499,7 +499,7 @@ BOOL LLThrottleGroup::dynamicAdjust() } } - //llinfos << "Pool BPS: " << pool_bps << llendl; + //LL_INFOS() << "Pool BPS: " << pool_bps << LL_ENDL; // Now redistribute the bandwidth to busy channels. F32 unused_bps = 0.f; @@ -508,7 +508,7 @@ BOOL LLThrottleGroup::dynamicAdjust() if (channel_busy[i]) { F32 add_amount = pool_bps * (mNominalBPS[i] / busy_nominal_sum); - //llinfos << "Busy " << i << " gets " << pool_bps << llendl; + //LL_INFOS() << "Busy " << i << " gets " << pool_bps << LL_ENDL; mCurrentBPS[i] += add_amount; // CRO: make sure this doesn't get too huge diff --git a/indra/llmessage/llthrottle.h b/indra/llmessage/llthrottle.h index ed0aeb46027d8b89e0e7eac071474a4fdf6c99a1..e43e54f61b2521bdd7136c40c6adf86242681fff 100755 --- a/indra/llmessage/llthrottle.h +++ b/indra/llmessage/llthrottle.h @@ -50,7 +50,7 @@ class LLThrottle F32 mLookaheadSecs; // Seconds to look ahead, maximum F32 mRate; // BPS available, dynamically adjusted F32 mAvailable; // Bits available to send right now on each channel - F64 mLastSendTime; // Time since last send on this channel + F64Seconds mLastSendTime; // Time since last send on this channel }; typedef enum e_throttle_categories @@ -93,8 +93,8 @@ class LLThrottleGroup F32 mBitsSentThisPeriod[TC_EOF]; // Sent in this dynamic allocation period F32 mBitsSentHistory[TC_EOF]; // Sent before this dynamic allocation period, adjusted to one period length - F64 mLastSendTime[TC_EOF]; // Time since last send on this channel - F64 mDynamicAdjustTime; // Only dynamic adjust every 2 seconds or so. + F64Seconds mLastSendTime[TC_EOF]; // Time since last send on this channel + F64Seconds mDynamicAdjustTime; // Only dynamic adjust every 2 seconds or so. }; diff --git a/indra/llmessage/lltransfermanager.cpp b/indra/llmessage/lltransfermanager.cpp index 38b743fb75ba81ef47b87dc56536b14f1848ec49..d6db20d7a33b5ee90871231069aa6ded38b968a5 100755 --- a/indra/llmessage/lltransfermanager.cpp +++ b/indra/llmessage/lltransfermanager.cpp @@ -64,7 +64,7 @@ LLTransferManager::~LLTransferManager() { if (mValid) { - llwarns << "LLTransferManager::~LLTransferManager - Should have been cleaned up by message system shutdown process" << llendl; + LL_WARNS() << "LLTransferManager::~LLTransferManager - Should have been cleaned up by message system shutdown process" << LL_ENDL; cleanup(); } } @@ -74,7 +74,7 @@ void LLTransferManager::init() { if (mValid) { - llerrs << "Double initializing LLTransferManager!" << llendl; + LL_ERRS() << "Double initializing LLTransferManager!" << LL_ENDL; } mValid = TRUE; @@ -122,7 +122,7 @@ void LLTransferManager::cleanupConnection(const LLHost &host) { // This can happen legitimately if we've never done a transfer, and we're // cleaning up a circuit. - //llwarns << "Cleaning up nonexistent transfer connection to " << host << llendl; + //LL_WARNS() << "Cleaning up nonexistent transfer connection to " << host << LL_ENDL; return; } LLTransferConnection *connp = iter->second; @@ -203,7 +203,7 @@ LLTransferSource *LLTransferManager::findTransferSource(const LLUUID &transfer_i //static void LLTransferManager::processTransferRequest(LLMessageSystem *msgp, void **) { - //llinfos << "LLTransferManager::processTransferRequest" << llendl; + //LL_INFOS() << "LLTransferManager::processTransferRequest" << LL_ENDL; LLUUID transfer_id; LLTransferSourceType source_type; @@ -219,33 +219,33 @@ void LLTransferManager::processTransferRequest(LLMessageSystem *msgp, void **) if (!tscp) { - llwarns << "Source channel not found" << llendl; + LL_WARNS() << "Source channel not found" << LL_ENDL; return; } if (tscp->findTransferSource(transfer_id)) { - llwarns << "Duplicate request for transfer " << transfer_id << ", aborting!" << llendl; + LL_WARNS() << "Duplicate request for transfer " << transfer_id << ", aborting!" << LL_ENDL; return; } S32 size = msgp->getSize("TransferInfo", "Params"); if(size > MAX_PARAMS_SIZE) { - llwarns << "LLTransferManager::processTransferRequest params too big." - << llendl; + LL_WARNS() << "LLTransferManager::processTransferRequest params too big." + << LL_ENDL; return; } - //llinfos << transfer_id << ":" << source_type << ":" << channel_type << ":" << priority << llendl; + //LL_INFOS() << transfer_id << ":" << source_type << ":" << channel_type << ":" << priority << LL_ENDL; LLTransferSource* tsp = LLTransferSource::createSource( source_type, transfer_id, priority); if(!tsp) { - llwarns << "LLTransferManager::processTransferRequest couldn't create" - << " transfer source!" << llendl; + LL_WARNS() << "LLTransferManager::processTransferRequest couldn't create" + << " transfer source!" << LL_ENDL; return; } U8 tmp[MAX_PARAMS_SIZE]; @@ -258,8 +258,8 @@ void LLTransferManager::processTransferRequest(LLMessageSystem *msgp, void **) // This should only happen if the data is corrupt or // incorrectly packed. // *NOTE: We may want to call abortTransfer(). - llwarns << "LLTransferManager::processTransferRequest: bad parameters." - << llendl; + LL_WARNS() << "LLTransferManager::processTransferRequest: bad parameters." + << LL_ENDL; delete tsp; return; } @@ -272,7 +272,7 @@ void LLTransferManager::processTransferRequest(LLMessageSystem *msgp, void **) //static void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) { - //llinfos << "LLTransferManager::processTransferInfo" << llendl; + //LL_INFOS() << "LLTransferManager::processTransferInfo" << LL_ENDL; LLUUID transfer_id; LLTransferTargetType target_type; @@ -286,11 +286,11 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) msgp->getS32("TransferInfo", "Status", (S32 &)status); msgp->getS32("TransferInfo", "Size", size); - //llinfos << transfer_id << ":" << target_type<< ":" << channel_type << llendl; + //LL_INFOS() << transfer_id << ":" << target_type<< ":" << channel_type << LL_ENDL; LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(msgp->getSender(), channel_type); if (!ttcp) { - llwarns << "Target channel not found" << llendl; + LL_WARNS() << "Target channel not found" << LL_ENDL; // Should send a message to abort the transfer. return; } @@ -298,7 +298,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) LLTransferTarget *ttp = ttcp->findTransferTarget(transfer_id); if (!ttp) { - llwarns << "TransferInfo for unknown transfer! Not able to handle this yet!" << llendl; + LL_WARNS() << "TransferInfo for unknown transfer! Not able to handle this yet!" << LL_ENDL; // This could happen if we're doing a push transfer, although to avoid confusion, // maybe it should be a different message. return; @@ -306,7 +306,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) if (status != LLTS_OK) { - llwarns << transfer_id << ": Non-ok status, cleaning up" << llendl; + LL_WARNS() << transfer_id << ": Non-ok status, cleaning up" << LL_ENDL; ttp->completionCallback(status); // Clean up the transfer. ttcp->deleteTransfer(ttp); @@ -317,8 +317,8 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) S32 params_size = msgp->getSize("TransferInfo", "Params"); if(params_size > MAX_PARAMS_SIZE) { - llwarns << "LLTransferManager::processTransferInfo params too big." - << llendl; + LL_WARNS() << "LLTransferManager::processTransferInfo params too big." + << LL_ENDL; return; } else if(params_size > 0) @@ -330,15 +330,15 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) { // This should only happen if the data is corrupt or // incorrectly packed. - llwarns << "LLTransferManager::processTransferRequest: bad params." - << llendl; + LL_WARNS() << "LLTransferManager::processTransferRequest: bad params." + << LL_ENDL; ttp->abortTransfer(); ttcp->deleteTransfer(ttp); return; } } - //llinfos << "Receiving " << transfer_id << ", size " << size << " bytes" << llendl; + //LL_INFOS() << "Receiving " << transfer_id << ", size " << size << " bytes" << LL_ENDL; ttp->setSize(size); ttp->setGotInfo(TRUE); @@ -358,7 +358,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) { // Perhaps this stuff should be inside a method in LLTransferPacket? // I'm too lazy to do it now, though. -// llinfos << "Playing back delayed packet " << packet_id << llendl; +// LL_INFOS() << "Playing back delayed packet " << packet_id << LL_ENDL; LLTransferPacket *packetp = ttp->mDelayedPacketMap[packet_id]; // This is somewhat inefficient, but avoids us having to duplicate @@ -392,11 +392,11 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) { if (status != LLTS_DONE) { - llwarns << "LLTransferManager::processTransferInfo Error in playback!" << llendl; + LL_WARNS() << "LLTransferManager::processTransferInfo Error in playback!" << LL_ENDL; } else { - llinfos << "LLTransferManager::processTransferInfo replay FINISHED for " << transfer_id << llendl; + LL_INFOS() << "LLTransferManager::processTransferInfo replay FINISHED for " << transfer_id << LL_ENDL; } // This transfer is done, either via error or not. ttp->completionCallback(status); @@ -410,7 +410,7 @@ void LLTransferManager::processTransferInfo(LLMessageSystem *msgp, void **) //static void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) { - //llinfos << "LLTransferManager::processTransferPacket" << llendl; + //LL_INFOS() << "LLTransferManager::processTransferPacket" << LL_ENDL; LLUUID transfer_id; LLTransferChannelType channel_type; @@ -423,20 +423,20 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) msgp->getS32("TransferData", "Status", (S32 &)status); // Find the transfer associated with this packet. - //llinfos << transfer_id << ":" << channel_type << llendl; + //LL_INFOS() << transfer_id << ":" << channel_type << LL_ENDL; LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(msgp->getSender(), channel_type); if (!ttcp) { - llwarns << "Target channel not found" << llendl; + LL_WARNS() << "Target channel not found" << LL_ENDL; return; } LLTransferTarget *ttp = ttcp->findTransferTarget(transfer_id); if (!ttp) { - llwarns << "Didn't find matching transfer for " << transfer_id + LL_WARNS() << "Didn't find matching transfer for " << transfer_id << " processing packet " << packet_id - << " from " << msgp->getSender() << llendl; + << " from " << msgp->getSender() << LL_ENDL; return; } @@ -455,7 +455,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) if ((size < 0) || (size > MAX_PACKET_DATA_SIZE)) { - llwarns << "Invalid transfer packet size " << size << llendl; + LL_WARNS() << "Invalid transfer packet size " << size << LL_ENDL; return; } @@ -472,8 +472,8 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) if(!ttp->addDelayedPacket(packet_id, status, tmp_data, size)) { // Whoops - failed to add a delayed packet for some reason. - llwarns << "Too many delayed packets processing transfer " - << transfer_id << " from " << msgp->getSender() << llendl; + LL_WARNS() << "Too many delayed packets processing transfer " + << transfer_id << " from " << msgp->getSender() << LL_ENDL; ttp->abortTransfer(); ttcp->deleteTransfer(ttp); return; @@ -483,15 +483,15 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) const S32 LL_TRANSFER_WARN_GAP = 10; if(!ttp->gotInfo()) { - llwarns << "Got data packet before information in transfer " + LL_WARNS() << "Got data packet before information in transfer " << transfer_id << " from " << msgp->getSender() - << ", got " << packet_id << llendl; + << ", got " << packet_id << LL_ENDL; } else if((packet_id - ttp->getNextPacketID()) > LL_TRANSFER_WARN_GAP) { - llwarns << "Out of order packet in transfer " << transfer_id + LL_WARNS() << "Out of order packet in transfer " << transfer_id << " from " << msgp->getSender() << ", got " << packet_id - << " expecting " << ttp->getNextPacketID() << llendl; + << " expecting " << ttp->getNextPacketID() << LL_ENDL; } #endif return; @@ -516,11 +516,11 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) { if (status != LLTS_DONE) { - llwarns << "LLTransferManager::processTransferPacket Error in transfer!" << llendl; + LL_WARNS() << "LLTransferManager::processTransferPacket Error in transfer!" << LL_ENDL; } else { -// llinfos << "LLTransferManager::processTransferPacket done for " << transfer_id << llendl; +// LL_INFOS() << "LLTransferManager::processTransferPacket done for " << transfer_id << LL_ENDL; } // This transfer is done, either via error or not. ttp->completionCallback(status); @@ -534,7 +534,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) { // Perhaps this stuff should be inside a method in LLTransferPacket? // I'm too lazy to do it now, though. -// llinfos << "Playing back delayed packet " << packet_id << llendl; +// LL_INFOS() << "Playing back delayed packet " << packet_id << LL_ENDL; LLTransferPacket *packetp = ttp->mDelayedPacketMap[packet_id]; // This is somewhat inefficient, but avoids us having to duplicate @@ -564,7 +564,7 @@ void LLTransferManager::processTransferPacket(LLMessageSystem *msgp, void **) //static void LLTransferManager::processTransferAbort(LLMessageSystem *msgp, void **) { - //llinfos << "LLTransferManager::processTransferPacket" << llendl; + //LL_INFOS() << "LLTransferManager::processTransferPacket" << LL_ENDL; LLUUID transfer_id; LLTransferChannelType channel_type; @@ -598,7 +598,7 @@ void LLTransferManager::processTransferAbort(LLMessageSystem *msgp, void **) } } - llwarns << "Couldn't find transfer " << transfer_id << " to abort!" << llendl; + LL_WARNS() << "Couldn't find transfer " << transfer_id << " to abort!" << LL_ENDL; } @@ -612,14 +612,14 @@ void LLTransferManager::reliablePacketCallback(void **user_data, S32 result) LLTransferSource *tsp = gTransferManager.findTransferSource(*transfer_idp); if (tsp) { - llwarns << "Aborting reliable transfer " << *transfer_idp << " due to failed reliable resends!" << llendl; + LL_WARNS() << "Aborting reliable transfer " << *transfer_idp << " due to failed reliable resends!" << LL_ENDL; LLTransferSourceChannel *tscp = tsp->mChannelp; tsp->abortTransfer(); tscp->deleteTransfer(tsp); } else { - llwarns << "Aborting reliable transfer " << *transfer_idp << " but can't find the LLTransferSource object" << llendl; + LL_WARNS() << "Aborting reliable transfer " << *transfer_idp << " but can't find the LLTransferSource object" << LL_ENDL; } } delete transfer_idp; @@ -763,7 +763,7 @@ void LLTransferSourceChannel::updateTransfers() // We DON'T want to send any packets if they're blocked, they'll just end up // piling up on the other end. - //llwarns << "Blocking transfers due to blocked circuit for " << getHost() << llendl; + //LL_WARNS() << "Blocking transfers due to blocked circuit for " << getHost() << LL_ENDL; return; } @@ -781,7 +781,7 @@ void LLTransferSourceChannel::updateTransfers() BOOL done = FALSE; for (iter = mTransferSources.mMap.begin(); (iter != mTransferSources.mMap.end()) && !done;) { - //llinfos << "LLTransferSourceChannel::updateTransfers()" << llendl; + //LL_INFOS() << "LLTransferSourceChannel::updateTransfers()" << LL_ENDL; // Do stuff. next = iter; next++; @@ -820,7 +820,7 @@ void LLTransferSourceChannel::updateTransfers() gMessageSystem->addS32("Status", status); gMessageSystem->addBinaryData("Data", datap, data_size); sent_bytes = gMessageSystem->getCurrentSendTotal(); - gMessageSystem->sendReliable(getHost(), LL_DEFAULT_RELIABLE_RETRIES, TRUE, 0.f, + gMessageSystem->sendReliable(getHost(), LL_DEFAULT_RELIABLE_RETRIES, TRUE, F32Seconds(0.f), LLTransferManager::reliablePacketCallback, (void**)cb_uuid); // Do bookkeeping for the throttle @@ -853,11 +853,11 @@ void LLTransferSourceChannel::updateTransfers() // We're OK, don't need to do anything. Keep sending data. break; case LLTS_ERROR: - llwarns << "Error in transfer dataCallback!" << llendl; + LL_WARNS() << "Error in transfer dataCallback!" << LL_ENDL; // fall through case LLTS_DONE: // We need to clean up this transfer source. - //llinfos << "LLTransferSourceChannel::updateTransfers() " << tsp->getID() << " done" << llendl; + //LL_INFOS() << "LLTransferSourceChannel::updateTransfers() " << tsp->getID() << " done" << LL_ENDL; tsp->completionCallback(status); delete tsp; @@ -865,7 +865,7 @@ void LLTransferSourceChannel::updateTransfers() iter = next; break; default: - llerrs << "Unknown transfer error code!" << llendl; + LL_ERRS() << "Unknown transfer error code!" << LL_ENDL; } // At this point, we should do priority adjustment (since some transfers like @@ -912,10 +912,10 @@ void LLTransferSourceChannel::deleteTransfer(LLTransferSource *tsp) } } - llwarns << "Unable to find transfer source id " + LL_WARNS() << "Unable to find transfer source id " << tsp->getID() << " to delete!" - << llendl; + << LL_ENDL; } } @@ -956,7 +956,7 @@ void LLTransferTargetChannel::requestTransfer( source_params.getType()); if (!ttp) { - llwarns << "LLTransferManager::requestTransfer aborting due to target creation failure!" << llendl; + LL_WARNS() << "LLTransferManager::requestTransfer aborting due to target creation failure!" << LL_ENDL; return; } @@ -1032,10 +1032,10 @@ void LLTransferTargetChannel::deleteTransfer(LLTransferTarget *ttp) } } - llwarns << "Unable to find transfer target id " + LL_WARNS() << "Unable to find transfer target id " << ttp->getID() << " to delete!" - << llendl; + << LL_ENDL; } } @@ -1097,7 +1097,7 @@ void LLTransferSource::sendTransferStatus(LLTSCode status) void LLTransferSource::abortTransfer() { // Send a message down, call the completion callback - llinfos << "LLTransferSource::Aborting transfer " << getID() << " to " << mChannelp->getHost() << llendl; + LL_INFOS() << "LLTransferSource::Aborting transfer " << getID() << " to " << mChannelp->getHost() << LL_ENDL; gMessageSystem->newMessage("TransferAbort"); gMessageSystem->nextBlock("TransferInfo"); gMessageSystem->addUUID("TransferID", getID()); @@ -1115,7 +1115,7 @@ void LLTransferSource::registerSourceType(const LLTransferSourceType stype, LLTr { // Disallow changing what class handles a source type // Unclear when you would want to do this, and whether it would work. - llerrs << "Reregistering source type " << stype << llendl; + LL_ERRS() << "Reregistering source type " << stype << LL_ENDL; } else { @@ -1143,7 +1143,7 @@ LLTransferSource *LLTransferSource::createSource(const LLTransferSourceType styp if (!sSourceCreateMap.count(stype)) { // Use the callback to create the source type if it's not there. - llwarns << "Unknown transfer source type: " << stype << llendl; + LL_WARNS() << "Unknown transfer source type: " << stype << LL_ENDL; return NULL; } return (sSourceCreateMap[stype])(id, priority); @@ -1230,7 +1230,7 @@ LLTransferTarget::~LLTransferTarget() void LLTransferTarget::abortTransfer() { // Send a message up, call the completion callback - llinfos << "LLTransferTarget::Aborting transfer " << getID() << " from " << mChannelp->getHost() << llendl; + LL_INFOS() << "LLTransferTarget::Aborting transfer " << getID() << " from " << mChannelp->getHost() << LL_ENDL; gMessageSystem->newMessage("TransferAbort"); gMessageSystem->nextBlock("TransferInfo"); gMessageSystem->addUUID("TransferID", getID()); @@ -1262,7 +1262,7 @@ bool LLTransferTarget::addDelayedPacket( #ifdef _DEBUG if (mDelayedPacketMap.find(packet_id) != mDelayedPacketMap.end()) { - llerrs << "Packet ALREADY in delayed packet map!" << llendl; + LL_ERRS() << "Packet ALREADY in delayed packet map!" << LL_ENDL; } #endif @@ -1283,7 +1283,7 @@ LLTransferTarget* LLTransferTarget::createTarget( case LLTTT_VFILE: return new LLTransferTargetVFile(id, source_type); default: - llwarns << "Unknown transfer target type: " << type << llendl; + LL_WARNS() << "Unknown transfer target type: " << type << LL_ENDL; return NULL; } } @@ -1318,7 +1318,7 @@ void LLTransferSourceParamsInvItem::setAsset(const LLUUID &asset_id, const LLAss void LLTransferSourceParamsInvItem::packParams(LLDataPacker &dp) const { - lldebugs << "LLTransferSourceParamsInvItem::packParams()" << llendl; + LL_DEBUGS() << "LLTransferSourceParamsInvItem::packParams()" << LL_ENDL; dp.packUUID(mAgentID, "AgentID"); dp.packUUID(mSessionID, "SessionID"); dp.packUUID(mOwnerID, "OwnerID"); diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp index 8537773a3f70ab739beaa66083751bb6a784066a..80ed3340c622d970f11f7d3797ffcedf46da305e 100755 --- a/indra/llmessage/lltransfersourceasset.cpp +++ b/indra/llmessage/lltransfersourceasset.cpp @@ -66,18 +66,18 @@ void LLTransferSourceAsset::initTransfer() } else { - llwarns << "Attempted to request blocked asset " + LL_WARNS() << "Attempted to request blocked asset " << mParams.getAssetID() << ":" << LLAssetType::lookupHumanReadable(mParams.getAssetType()) - << llendl; + << LL_ENDL; sendTransferStatus(LLTS_ERROR); } } else { - llwarns << "Attempted to request asset " << mParams.getAssetID() + LL_WARNS() << "Attempted to request asset " << mParams.getAssetID() << ":" << LLAssetType::lookupHumanReadable(mParams.getAssetType()) - << " without an asset system!" << llendl; + << " without an asset system!" << LL_ENDL; sendTransferStatus(LLTS_ERROR); } } @@ -93,7 +93,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, S32 &returned_bytes, BOOL &delete_returned) { - //llinfos << "LLTransferSourceAsset::dataCallback" << llendl; + //LL_INFOS() << "LLTransferSourceAsset::dataCallback" << LL_ENDL; if (!mGotResponse) { return LLTS_SKIP; @@ -109,14 +109,14 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id, if (packet_id != mLastPacketID + 1) { - llerrs << "Can't handle out of order file transfer yet!" << llendl; + LL_ERRS() << "Can't handle out of order file transfer yet!" << LL_ENDL; } // grab a buffer from the right place in the file if (!vf.seek(mCurPos, 0)) { - llwarns << "LLTransferSourceAsset Can't seek to " << mCurPos << " length " << vf.getSize() << llendl; - llwarns << "While sending " << mParams.getAssetID() << llendl; + LL_WARNS() << "LLTransferSourceAsset Can't seek to " << mCurPos << " length " << vf.getSize() << LL_ENDL; + LL_WARNS() << "While sending " << mParams.getAssetID() << LL_ENDL; return LLTS_ERROR; } @@ -160,13 +160,13 @@ void LLTransferSourceAsset::completionCallback(const LLTSCode status) void LLTransferSourceAsset::packParams(LLDataPacker& dp) const { - //llinfos << "LLTransferSourceAsset::packParams" << llendl; + //LL_INFOS() << "LLTransferSourceAsset::packParams" << LL_ENDL; mParams.packParams(dp); } BOOL LLTransferSourceAsset::unpackParams(LLDataPacker &dp) { - //llinfos << "LLTransferSourceAsset::unpackParams" << llendl; + //LL_INFOS() << "LLTransferSourceAsset::unpackParams" << LL_ENDL; return mParams.unpackParams(dp); } @@ -183,13 +183,13 @@ void LLTransferSourceAsset::responderCallback(LLVFS *vfs, const LLUUID& uuid, LL if (!tsap) { - llinfos << "Aborting transfer " << transfer_id << " callback, transfer source went away" << llendl; + LL_INFOS() << "Aborting transfer " << transfer_id << " callback, transfer source went away" << LL_ENDL; return; } if (result) { - llinfos << "AssetStorage: Error " << gAssetStorage->getErrorString(result) << " downloading uuid " << uuid << llendl; + LL_INFOS() << "AssetStorage: Error " << gAssetStorage->getErrorString(result) << " downloading uuid " << uuid << LL_ENDL; } LLTSCode status; diff --git a/indra/llmessage/lltransfersourcefile.cpp b/indra/llmessage/lltransfersourcefile.cpp index 43c9448fba60270d523d399be3bd56b7b7c40c09..1f284a158dd3d1031a5665e67f9311e7228886d8 100755 --- a/indra/llmessage/lltransfersourcefile.cpp +++ b/indra/llmessage/lltransfersourcefile.cpp @@ -43,7 +43,7 @@ LLTransferSourceFile::~LLTransferSourceFile() { if (mFP) { - llerrs << "Destructor called without the completion callback being called!" << llendl; + LL_ERRS() << "Destructor called without the completion callback being called!" << LL_ENDL; } } @@ -56,7 +56,7 @@ void LLTransferSourceFile::initTransfer() || (filename == "..") || (filename.find(delimiter[0]) != std::string::npos)) { - llwarns << "Attempting to transfer file " << filename << " with path delimiter, aborting!" << llendl; + LL_WARNS() << "Attempting to transfer file " << filename << " with path delimiter, aborting!" << LL_ENDL; sendTransferStatus(LLTS_ERROR); return; @@ -88,17 +88,17 @@ LLTSCode LLTransferSourceFile::dataCallback(const S32 packet_id, S32 &returned_bytes, BOOL &delete_returned) { - //llinfos << "LLTransferSourceFile::dataCallback" << llendl; + //LL_INFOS() << "LLTransferSourceFile::dataCallback" << LL_ENDL; if (!mFP) { - llerrs << "Data callback without file set!" << llendl; + LL_ERRS() << "Data callback without file set!" << LL_ENDL; return LLTS_ERROR; } if (packet_id != mLastPacketID + 1) { - llerrs << "Can't handle out of order file transfer yet!" << llendl; + LL_ERRS() << "Can't handle out of order file transfer yet!" << LL_ENDL; } // Grab up until the max number of bytes from the file. @@ -137,13 +137,13 @@ void LLTransferSourceFile::completionCallback(const LLTSCode status) void LLTransferSourceFile::packParams(LLDataPacker& dp) const { - //llinfos << "LLTransferSourceFile::packParams" << llendl; + //LL_INFOS() << "LLTransferSourceFile::packParams" << LL_ENDL; mParams.packParams(dp); } BOOL LLTransferSourceFile::unpackParams(LLDataPacker &dp) { - //llinfos << "LLTransferSourceFile::unpackParams" << llendl; + //LL_INFOS() << "LLTransferSourceFile::unpackParams" << LL_ENDL; return mParams.unpackParams(dp); } @@ -169,6 +169,6 @@ BOOL LLTransferSourceParamsFile::unpackParams(LLDataPacker &dp) dp.unpackU8(delete_flag, "Delete"); mDeleteOnCompletion = delete_flag; - llinfos << "Unpacked filename: " << mFilename << llendl; + LL_INFOS() << "Unpacked filename: " << mFilename << LL_ENDL; return TRUE; } diff --git a/indra/llmessage/lltransfertargetfile.cpp b/indra/llmessage/lltransfertargetfile.cpp index 560fc8b6e4cab934387b055184a3bba114ec40c5..ca0318a2d64bbbbae535ab1db28afafec7a1e40b 100755 --- a/indra/llmessage/lltransfertargetfile.cpp +++ b/indra/llmessage/lltransfertargetfile.cpp @@ -44,7 +44,7 @@ LLTransferTargetFile::~LLTransferTargetFile() { if (mFP) { - llerrs << "LLTransferTargetFile::~LLTransferTargetFile - Should have been cleaned up in completion callback" << llendl; + LL_ERRS() << "LLTransferTargetFile::~LLTransferTargetFile - Should have been cleaned up in completion callback" << LL_ENDL; fclose(mFP); mFP = NULL; } @@ -61,7 +61,7 @@ void LLTransferTargetFile::applyParams(const LLTransferTargetParams ¶ms) { if (params.getType() != mType) { - llwarns << "Target parameter type doesn't match!" << llendl; + LL_WARNS() << "Target parameter type doesn't match!" << LL_ENDL; return; } @@ -70,8 +70,8 @@ void LLTransferTargetFile::applyParams(const LLTransferTargetParams ¶ms) LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, const S32 in_size) { - //llinfos << "LLTransferTargetFile::dataCallback" << llendl; - //llinfos << "Packet: " << packet_id << llendl; + //LL_INFOS() << "LLTransferTargetFile::dataCallback" << LL_ENDL; + //LL_INFOS() << "Packet: " << packet_id << LL_ENDL; if (!mFP) { @@ -79,7 +79,7 @@ LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, c if (!mFP) { - llwarns << "Failure opening " << mParams.mFilename << " for write by LLTransferTargetFile" << llendl; + LL_WARNS() << "Failure opening " << mParams.mFilename << " for write by LLTransferTargetFile" << LL_ENDL; return LLTS_ERROR; } } @@ -91,7 +91,7 @@ LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, c S32 count = (S32)fwrite(in_datap, 1, in_size, mFP); if (count != in_size) { - llwarns << "Failure in LLTransferTargetFile::dataCallback!" << llendl; + LL_WARNS() << "Failure in LLTransferTargetFile::dataCallback!" << LL_ENDL; return LLTS_ERROR; } return LLTS_OK; @@ -99,7 +99,7 @@ LLTSCode LLTransferTargetFile::dataCallback(const S32 packet_id, U8 *in_datap, c void LLTransferTargetFile::completionCallback(const LLTSCode status) { - llinfos << "LLTransferTargetFile::completionCallback" << llendl; + LL_INFOS() << "LLTransferTargetFile::completionCallback" << LL_ENDL; if (mFP) { fclose(mFP); @@ -113,7 +113,7 @@ void LLTransferTargetFile::completionCallback(const LLTSCode status) case LLTS_ABORT: case LLTS_ERROR: // We're aborting this transfer, we don't want to keep this file. - llwarns << "Aborting file transfer for " << mParams.mFilename << llendl; + LL_WARNS() << "Aborting file transfer for " << mParams.mFilename << LL_ENDL; if (mFP) { // Only need to remove file if we successfully opened it. diff --git a/indra/llmessage/lltransfertargetvfile.cpp b/indra/llmessage/lltransfertargetvfile.cpp index c78d9288b6a8ac730e11f84e38d7034caeafaa47..3c234b9726c1dc458592381152ab44ae65ccb84f 100755 --- a/indra/llmessage/lltransfertargetvfile.cpp +++ b/indra/llmessage/lltransfertargetvfile.cpp @@ -115,7 +115,7 @@ void LLTransferTargetVFile::applyParams(const LLTransferTargetParams ¶ms) { if (params.getType() != mType) { - llwarns << "Target parameter type doesn't match!" << llendl; + LL_WARNS() << "Target parameter type doesn't match!" << LL_ENDL; return; } @@ -125,8 +125,8 @@ void LLTransferTargetVFile::applyParams(const LLTransferTargetParams ¶ms) LLTSCode LLTransferTargetVFile::dataCallback(const S32 packet_id, U8 *in_datap, const S32 in_size) { - //llinfos << "LLTransferTargetFile::dataCallback" << llendl; - //llinfos << "Packet: " << packet_id << llendl; + //LL_INFOS() << "LLTransferTargetFile::dataCallback" << LL_ENDL; + //LL_INFOS() << "Packet: " << packet_id << LL_ENDL; LLVFile vf(gAssetStorage->mVFS, mTempID, mParams.getAssetType(), LLVFile::APPEND); if (mNeedsCreate) @@ -142,7 +142,7 @@ LLTSCode LLTransferTargetVFile::dataCallback(const S32 packet_id, U8 *in_datap, if (!vf.write(in_datap, in_size)) { - llwarns << "Failure in LLTransferTargetVFile::dataCallback!" << llendl; + LL_WARNS() << "Failure in LLTransferTargetVFile::dataCallback!" << LL_ENDL; return LLTS_ERROR; } return LLTS_OK; @@ -151,11 +151,11 @@ LLTSCode LLTransferTargetVFile::dataCallback(const S32 packet_id, U8 *in_datap, void LLTransferTargetVFile::completionCallback(const LLTSCode status) { - //llinfos << "LLTransferTargetVFile::completionCallback" << llendl; + //LL_INFOS() << "LLTransferTargetVFile::completionCallback" << LL_ENDL; if (!gAssetStorage) { - llwarns << "Aborting vfile transfer after asset storage shut down!" << llendl; + LL_WARNS() << "Aborting vfile transfer after asset storage shut down!" << LL_ENDL; return; } @@ -169,14 +169,14 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status) LLVFile file(gAssetStorage->mVFS, mTempID, mParams.getAssetType(), LLVFile::WRITE); if (!file.rename(mParams.getAssetID(), mParams.getAssetType())) { - llerrs << "LLTransferTargetVFile: rename failed" << llendl; + LL_ERRS() << "LLTransferTargetVFile: rename failed" << LL_ENDL; } } err_code = LL_ERR_NOERR; - lldebugs << "LLTransferTargetVFile::completionCallback for " + LL_DEBUGS() << "LLTransferTargetVFile::completionCallback for " << mParams.getAssetID() << "," << LLAssetType::lookup(mParams.getAssetType()) - << " with temp id " << mTempID << llendl; + << " with temp id " << mTempID << LL_ENDL; break; case LLTS_ERROR: case LLTS_ABORT: @@ -184,7 +184,7 @@ void LLTransferTargetVFile::completionCallback(const LLTSCode status) default: { // We're aborting this transfer, we don't want to keep this file. - llwarns << "Aborting vfile transfer for " << mParams.getAssetID() << llendl; + LL_WARNS() << "Aborting vfile transfer for " << mParams.getAssetID() << LL_ENDL; LLVFile vf(gAssetStorage->mVFS, mTempID, mParams.getAssetType(), LLVFile::APPEND); vf.remove(); } diff --git a/indra/llmessage/lltrustedmessageservice.cpp b/indra/llmessage/lltrustedmessageservice.cpp index fea7fc72c4903a5ff693f18f43ae7c0e84c848c6..151d02a156e4f0aa6ac3d0be7a80ee5f4e43aad7 100755 --- a/indra/llmessage/lltrustedmessageservice.cpp +++ b/indra/llmessage/lltrustedmessageservice.cpp @@ -63,7 +63,7 @@ void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response, { LL_WARNS("Messaging") << "trusted message POST to /trusted-message/" << name << " from unknown or untrusted sender " - << sender << llendl; + << sender << LL_ENDL; response->status(403, "Unknown or untrusted sender"); } else @@ -71,13 +71,13 @@ void LLTrustedMessageService::post(LLHTTPNode::ResponsePtr response, gMessageSystem->receivedMessageFromTrustedSender(); if (input.has("binary-template-data")) { - llinfos << "Dispatching template: " << input << llendl; + LL_INFOS() << "Dispatching template: " << input << LL_ENDL; // try and send this message using udp dispatch LLMessageSystem::dispatchTemplate(name, message_data, response); } else { - llinfos << "Dispatching without template: " << input << llendl; + LL_INFOS() << "Dispatching without template: " << input << LL_ENDL; LLMessageSystem::dispatch(name, message_data, response); } } diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index 683065357d5791ffdb3e2b7d81b5103291d33143..8e4ee85c1753cd1f2932e9ba2604af7d5e14ce46 100755 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -33,6 +33,7 @@ #include <openssl/x509_vfy.h> #include <openssl/ssl.h> #include "llcurl.h" +#include "llfasttimer.h" #include "llioutil.h" #include "llproxy.h" #include "llpumpio.h" @@ -179,7 +180,7 @@ void LLURLRequest::setURL(const std::string& url) mDetail->mURL = url; if (url.empty()) { - llwarns << "empty URL specified" << llendl; + LL_WARNS() << "empty URL specified" << LL_ENDL; } } @@ -232,7 +233,7 @@ void LLURLRequest::useProxy(bool use_proxy) } - lldebugs << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << (env_proxy ? env_proxy : "(null)") << llendl; + LL_DEBUGS() << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << (env_proxy ? env_proxy : "(null)") << LL_ENDL; if (env_proxy && use_proxy) { @@ -284,9 +285,11 @@ LLIOPipe::EStatus LLURLRequest::handleError( return status; } -static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST("URL Request"); -static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST_GET_RESULT("Get Result"); -static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_URL_REQUEST("URL Request"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_URL_REQUEST_GET_RESULT("Get Result"); +static LLTrace::BlockTimerStatHandle FTM_URL_PERFORM("Perform"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_URL_PUMP_RESPOND("Pump Respond"); +static LLTrace::BlockTimerStatHandle FTM_URL_ADJUST_TIMEOUT("Adjust Timeout"); // virtual LLIOPipe::EStatus LLURLRequest::process_impl( @@ -296,9 +299,9 @@ LLIOPipe::EStatus LLURLRequest::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_URL_REQUEST); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_URL_REQUEST); PUMP_DEBUG; - //llinfos << "LLURLRequest::process_impl()" << llendl; + //LL_INFOS() << "LLURLRequest::process_impl()" << LL_ENDL; if (!buffer) return STATUS_ERROR; // we're still waiting or prcessing, check how many @@ -306,8 +309,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl( const S32 MIN_ACCUMULATION = 100000; if(pump && (mDetail->mByteAccumulator > MIN_ACCUMULATION)) { - static LLFastTimer::DeclareTimer FTM_URL_ADJUST_TIMEOUT("Adjust Timeout"); - LLFastTimer t(FTM_URL_ADJUST_TIMEOUT); + LL_RECORD_BLOCK_TIME(FTM_URL_ADJUST_TIMEOUT); // This is a pretty sloppy calculation, but this // tries to make the gross assumption that if data // is coming in at 56kb/s, then this transfer will @@ -317,11 +319,11 @@ LLIOPipe::EStatus LLURLRequest::process_impl( const F32 TIMEOUT_ADJUSTMENT = 2.0f; mDetail->mByteAccumulator = 0; pump->adjustTimeoutSeconds(TIMEOUT_ADJUSTMENT); - lldebugs << "LLURLRequest adjustTimeoutSeconds for request: " << mDetail->mURL << llendl; - if (mState == STATE_INITIALIZED) - { - llinfos << "LLURLRequest adjustTimeoutSeconds called during upload" << llendl; - } + LL_DEBUGS() << "LLURLRequest adjustTimeoutSeconds for request: " << mDetail->mURL << LL_ENDL; + if (mState == STATE_INITIALIZED) + { + LL_INFOS() << "LLURLRequest adjustTimeoutSeconds called during upload" << LL_ENDL; + } } switch(mState) @@ -356,7 +358,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl( PUMP_DEBUG; LLIOPipe::EStatus status = STATUS_BREAK; { - LLFastTimer t(FTM_URL_PERFORM); + LL_RECORD_BLOCK_TIME(FTM_URL_PERFORM); if(!mDetail->mCurlRequest->wait()) { return status ; @@ -370,7 +372,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl( bool newmsg = false; { - LLFastTimer t(FTM_PROCESS_URL_REQUEST_GET_RESULT); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_URL_REQUEST_GET_RESULT); newmsg = mDetail->mCurlRequest->getResult(&result); } @@ -384,7 +386,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl( mState = STATE_HAVE_RESPONSE; context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes; context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes; - lldebugs << this << "Setting context to " << context << llendl; + LL_DEBUGS() << this << "Setting context to " << context << LL_ENDL; switch(result) { case CURLE_OK: @@ -405,9 +407,8 @@ LLIOPipe::EStatus LLURLRequest::process_impl( link.mChannels = LLBufferArray::makeChannelConsumer( channels); chain.push_back(link); - static LLFastTimer::DeclareTimer FTM_PROCESS_URL_PUMP_RESPOND("Pump Respond"); { - LLFastTimer t(FTM_PROCESS_URL_PUMP_RESPOND); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_URL_PUMP_RESPOND); pump->respond(chain, buffer, context); } mCompletionCallback = NULL; @@ -419,12 +420,12 @@ LLIOPipe::EStatus LLURLRequest::process_impl( keep_looping = false; break; default: // CURLE_URL_MALFORMAT - llwarns << "URLRequest Error: " << result + LL_WARNS() << "URLRequest Error: " << result << ", " << LLCurl::strerror(result) << ", " << (mDetail->mURL.empty() ? "<EMPTY URL>" : mDetail->mURL) - << llendl; + << LL_ENDL; status = STATUS_ERROR; keep_looping = false; break; @@ -439,14 +440,14 @@ LLIOPipe::EStatus LLURLRequest::process_impl( eos = true; context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes; context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes; - lldebugs << this << "Setting context to " << context << llendl; + LL_DEBUGS() << this << "Setting context to " << context << LL_ENDL; return STATUS_DONE; default: PUMP_DEBUG; context[CONTEXT_REQUEST][CONTEXT_TRANSFERED_BYTES] = mRequestTransferedBytes; context[CONTEXT_RESPONSE][CONTEXT_TRANSFERED_BYTES] = mResponseTransferedBytes; - lldebugs << this << "Setting context to " << context << llendl; + LL_DEBUGS() << this << "Setting context to " << context << LL_ENDL; return STATUS_ERROR; } } @@ -468,10 +469,10 @@ void LLURLRequest::initialize() mResponseTransferedBytes = 0; } -static LLFastTimer::DeclareTimer FTM_URL_REQUEST_CONFIGURE("URL Configure"); +static LLTrace::BlockTimerStatHandle FTM_URL_REQUEST_CONFIGURE("URL Configure"); bool LLURLRequest::configure() { - LLFastTimer t(FTM_URL_REQUEST_CONFIGURE); + LL_RECORD_BLOCK_TIME(FTM_URL_REQUEST_CONFIGURE); bool rv = false; S32 bytes = mDetail->mResponseBuffer->countAfter( @@ -541,7 +542,7 @@ bool LLURLRequest::configure() break; default: - llwarns << "Unhandled URLRequest action: " << mAction << llendl; + LL_WARNS() << "Unhandled URLRequest action: " << mAction << LL_ENDL; break; } if(rv) @@ -669,14 +670,14 @@ static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user) LLStringUtil::trim(header); if (!header.empty()) { - llwarns << "Unable to parse header: " << header << llendl; + LL_WARNS() << "Unable to parse header: " << header << LL_ENDL; } } return header_len; } -static LLFastTimer::DeclareTimer FTM_PROCESS_URL_EXTRACTOR("URL Extractor"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_URL_EXTRACTOR("URL Extractor"); /** * LLContextURLExtractor */ @@ -688,7 +689,7 @@ LLIOPipe::EStatus LLContextURLExtractor::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_URL_EXTRACTOR); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_URL_EXTRACTOR); PUMP_DEBUG; // The destination host is in the context. if(context.isUndefined() || !mRequest) @@ -747,15 +748,15 @@ void LLURLRequestComplete::complete(const LLChannelDescriptors& channels, void LLURLRequestComplete::response(const LLChannelDescriptors& channels, const buffer_ptr_t& buffer) { - llwarns << "LLURLRequestComplete::response default implementation called" - << llendl; + LL_WARNS() << "LLURLRequestComplete::response default implementation called" + << LL_ENDL; } //virtual void LLURLRequestComplete::noResponse() { - llwarns << "LLURLRequestComplete::noResponse default implementation called" - << llendl; + LL_WARNS() << "LLURLRequestComplete::noResponse default implementation called" + << LL_ENDL; } void LLURLRequestComplete::responseStatus(LLIOPipe::EStatus status) @@ -763,7 +764,7 @@ void LLURLRequestComplete::responseStatus(LLIOPipe::EStatus status) mRequestStatus = status; } -static LLFastTimer::DeclareTimer FTM_PROCESS_URL_COMPLETE("URL Complete"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_URL_COMPLETE("URL Complete"); // virtual LLIOPipe::EStatus LLURLRequestComplete::process_impl( const LLChannelDescriptors& channels, @@ -772,7 +773,7 @@ LLIOPipe::EStatus LLURLRequestComplete::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_PROCESS_URL_COMPLETE); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_URL_COMPLETE); PUMP_DEBUG; complete(channels, buffer); return STATUS_OK; diff --git a/indra/llmessage/lluseroperation.cpp b/indra/llmessage/lluseroperation.cpp index a4a68d0c812cf2410ebb943e573709395faca115..c506af19ce85ef8b04ce7bc797142340677a8a4b 100755 --- a/indra/llmessage/lluseroperation.cpp +++ b/indra/llmessage/lluseroperation.cpp @@ -100,7 +100,7 @@ LLUserOperationMgr::~LLUserOperationMgr() { if (mUserOperationList.size() > 0) { - llwarns << "Exiting with user operations pending." << llendl; + LL_WARNS() << "Exiting with user operations pending." << LL_ENDL; } } @@ -109,7 +109,7 @@ void LLUserOperationMgr::addOperation(LLUserOperation* op) { if(!op) { - llwarns << "Tried to add null op" << llendl; + LL_WARNS() << "Tried to add null op" << LL_ENDL; return; } LLUUID id = op->getTransactionID(); @@ -160,7 +160,7 @@ void LLUserOperationMgr::deleteExpiredOperations() op = (*it).second; if(op && op->isExpired()) { - lldebugs << "expiring: " << (*it).first << llendl; + LL_DEBUGS() << "expiring: " << (*it).first << LL_ENDL; op->expire(); mUserOperationList.erase(it++); delete op; diff --git a/indra/llmessage/llxfer.cpp b/indra/llmessage/llxfer.cpp index f8c55d52ad082d2af1b83dadc205eeff8c2c4bd1..4aba5cae72eb9eb197066550f154a96ac2a79501 100755 --- a/indra/llmessage/llxfer.cpp +++ b/indra/llmessage/llxfer.cpp @@ -99,7 +99,7 @@ void LLXfer::cleanup () S32 LLXfer::startSend (U64 xfer_id, const LLHost &remote_host) { - llwarns << "undifferentiated LLXfer::startSend for " << getFileName() << llendl; + LL_WARNS() << "undifferentiated LLXfer::startSend for " << getFileName() << LL_ENDL; return (-1); } @@ -115,8 +115,8 @@ void LLXfer::setXferSize (S32 xfer_size) S32 LLXfer::startDownload() { - llwarns << "undifferentiated LLXfer::startDownload for " << getFileName() - << llendl; + LL_WARNS() << "undifferentiated LLXfer::startDownload for " << getFileName() + << LL_ENDL; return (-1); } @@ -140,7 +140,7 @@ S32 LLXfer::receiveData (char *datap, S32 data_size) } else { - llerrs << "NULL data passed in receiveData" << llendl; + LL_ERRS() << "NULL data passed in receiveData" << LL_ENDL; } } @@ -163,7 +163,7 @@ S32 LLXfer::flush() S32 LLXfer::suck(S32 start_position) { - llwarns << "Attempted to send a packet outside the buffer bounds in LLXfer::suck()" << llendl; + LL_WARNS() << "Attempted to send a packet outside the buffer bounds in LLXfer::suck()" << LL_ENDL; return (-1); } @@ -196,7 +196,7 @@ void LLXfer::sendPacket(S32 packet_num) if (fdata_size < 0) { - llwarns << "negative data size in xfer send, aborting" << llendl; + LL_WARNS() << "negative data size in xfer send, aborting" << LL_ENDL; abort(LL_ERR_EOF); return; } @@ -289,13 +289,13 @@ S32 LLXfer::processEOF() if (LL_ERR_NOERR == mCallbackResult) { - llinfos << "xfer from " << mRemoteHost << " complete: " << getFileName() - << llendl; + LL_INFOS() << "xfer from " << mRemoteHost << " complete: " << getFileName() + << LL_ENDL; } else { - llinfos << "xfer from " << mRemoteHost << " failed, code " - << mCallbackResult << ": " << getFileName() << llendl; + LL_INFOS() << "xfer from " << mRemoteHost << " failed, code " + << mCallbackResult << ": " << getFileName() << LL_ENDL; } if (mCallback) @@ -323,8 +323,8 @@ void LLXfer::abort (S32 result_code) { mCallbackResult = result_code; - llinfos << "Aborting xfer from " << mRemoteHost << " named " << getFileName() - << " - error: " << result_code << llendl; + LL_INFOS() << "Aborting xfer from " << mRemoteHost << " named " << getFileName() + << " - error: " << result_code << LL_ENDL; gMessageSystem->newMessageFast(_PREHASH_AbortXfer); gMessageSystem->nextBlockFast(_PREHASH_XferID); diff --git a/indra/llmessage/llxfer.h b/indra/llmessage/llxfer.h index f9348eb11f100cd9e11ade66cdb27625dd8858b0..edf5eeb82d0b4ddee1fe30aa393ebc69a68bb7a1 100755 --- a/indra/llmessage/llxfer.h +++ b/indra/llmessage/llxfer.h @@ -32,6 +32,10 @@ #include "llextendedstatus.h" const S32 LL_XFER_LARGE_PAYLOAD = 7680; +const S32 LL_ERR_FILE_EMPTY = -44; +const int LL_ERR_FILE_NOT_FOUND = -43; +const int LL_ERR_CANNOT_OPEN_FILE = -42; +const int LL_ERR_EOF = -39; typedef enum ELLXferStatus { e_LL_XFER_UNINITIALIZED, diff --git a/indra/llmessage/llxfer_file.cpp b/indra/llmessage/llxfer_file.cpp index 9e02af2c3ebc06aec2f6c7d8a56d3ba91c9f561c..257a13f277062fec84bbe70fbb98f6d80b09ffd7 100755 --- a/indra/llmessage/llxfer_file.cpp +++ b/indra/llmessage/llxfer_file.cpp @@ -102,12 +102,12 @@ void LLXfer_File::cleanup () if (mDeleteLocalOnCompletion) { - lldebugs << "Removing file: " << mLocalFilename << llendl; + LL_DEBUGS() << "Removing file: " << mLocalFilename << LL_ENDL; LLFile::remove(mLocalFilename); } else { - lldebugs << "Keeping local file: " << mLocalFilename << llendl; + LL_DEBUGS() << "Keeping local file: " << mLocalFilename << LL_ENDL; } LLXfer::cleanup(); @@ -139,7 +139,7 @@ S32 LLXfer_File::initializeRequest(U64 xfer_id, mCallbackDataHandle = user_data; mCallbackResult = LL_ERR_NOERR; - llinfos << "Requesting xfer from " << remote_host << " for file: " << mLocalFilename << llendl; + LL_INFOS() << "Requesting xfer from " << remote_host << " for file: " << mLocalFilename << LL_ENDL; if (mBuffer) { @@ -182,7 +182,7 @@ S32 LLXfer_File::startDownload() } else { - llwarns << "Couldn't create file to be received!" << llendl; + LL_WARNS() << "Couldn't create file to be received!" << LL_ENDL; retval = -1; } @@ -223,7 +223,7 @@ S32 LLXfer_File::startSend (U64 xfer_id, const LLHost &remote_host) } else { - llinfos << "Warning: " << mLocalFilename << " not found." << llendl; + LL_INFOS() << "Warning: " << mLocalFilename << " not found." << LL_ENDL; return (LL_ERR_FILE_NOT_FOUND); } @@ -279,7 +279,7 @@ S32 LLXfer_File::flush() { if (mFp) { - llerrs << "Overwriting open file pointer!" << llendl; + LL_ERRS() << "Overwriting open file pointer!" << LL_ENDL; } mFp = LLFile::fopen(mTempFilename,"a+b"); /* Flawfinder : ignore */ @@ -287,10 +287,10 @@ S32 LLXfer_File::flush() { if (fwrite(mBuffer,1,mBufferLength,mFp) != mBufferLength) { - llwarns << "Short write" << llendl; + LL_WARNS() << "Short write" << LL_ENDL; } -// llinfos << "******* wrote " << mBufferLength << " bytes of file xfer" << llendl; +// LL_INFOS() << "******* wrote " << mBufferLength << " bytes of file xfer" << LL_ENDL; fclose(mFp); mFp = NULL; @@ -298,7 +298,7 @@ S32 LLXfer_File::flush() } else { - llwarns << "LLXfer_File::flush() unable to open " << mTempFilename << " for writing!" << llendl; + LL_WARNS() << "LLXfer_File::flush() unable to open " << mTempFilename << " for writing!" << LL_ENDL; retval = LL_ERR_CANNOT_OPEN_FILE; } } @@ -329,37 +329,37 @@ S32 LLXfer_File::processEOF() { #if !LL_WINDOWS S32 error_number = errno; - llinfos << "Rename failure (" << error_number << ") - " - << mTempFilename << " to " << mLocalFilename << llendl; + LL_INFOS() << "Rename failure (" << error_number << ") - " + << mTempFilename << " to " << mLocalFilename << LL_ENDL; if(EXDEV == error_number) { if(copy_file(mTempFilename, mLocalFilename) == 0) { - llinfos << "Rename across mounts; copying+unlinking the file instead." << llendl; + LL_INFOS() << "Rename across mounts; copying+unlinking the file instead." << LL_ENDL; unlink(mTempFilename.c_str()); } else { - llwarns << "Copy failure - " << mTempFilename << " to " - << mLocalFilename << llendl; + LL_WARNS() << "Copy failure - " << mTempFilename << " to " + << mLocalFilename << LL_ENDL; } } else { //LLFILE* fp = LLFile::fopen(mTempFilename, "r"); - //llwarns << "File " << mTempFilename << " does " - // << (!fp ? "not" : "" ) << " exit." << llendl; + //LL_WARNS() << "File " << mTempFilename << " does " + // << (!fp ? "not" : "" ) << " exit." << LL_ENDL; //if(fp) fclose(fp); //fp = LLFile::fopen(mLocalFilename, "r"); - //llwarns << "File " << mLocalFilename << " does " - // << (!fp ? "not" : "" ) << " exit." << llendl; + //LL_WARNS() << "File " << mLocalFilename << " does " + // << (!fp ? "not" : "" ) << " exit." << LL_ENDL; //if(fp) fclose(fp); - llwarns << "Rename fatally failed, can only handle EXDEV (" - << EXDEV << ")" << llendl; + LL_WARNS() << "Rename fatally failed, can only handle EXDEV (" + << EXDEV << ")" << LL_ENDL; } #else - llwarns << "Rename failure - " << mTempFilename << " to " - << mLocalFilename << llendl; + LL_WARNS() << "Rename failure - " << mTempFilename << " to " + << mLocalFilename << LL_ENDL; #endif } } diff --git a/indra/llmessage/llxfer_mem.cpp b/indra/llmessage/llxfer_mem.cpp index 4c7e83c33dd9ecfc5f1cf068e953e4dfe7b43448..3bea08f2e54ed9178646ad475527ac9fa6b7d67f 100755 --- a/indra/llmessage/llxfer_mem.cpp +++ b/indra/llmessage/llxfer_mem.cpp @@ -130,7 +130,7 @@ S32 LLXfer_Mem::processEOF() mStatus = e_LL_XFER_COMPLETE; - llinfos << "xfer complete: " << getFileName() << llendl; + LL_INFOS() << "xfer complete: " << getFileName() << LL_ENDL; if (mCallback) { @@ -164,7 +164,7 @@ S32 LLXfer_Mem::initializeRequest(U64 xfer_id, mRemotePath = remote_path; mDeleteRemoteOnCompletion = delete_remote_on_completion; - llinfos << "Requesting file: " << remote_filename << llendl; + LL_INFOS() << "Requesting file: " << remote_filename << LL_ENDL; delete [] mBuffer; mBuffer = NULL; diff --git a/indra/llmessage/llxfer_vfile.cpp b/indra/llmessage/llxfer_vfile.cpp index 751a69518c096646a6e04fcb192a93ef4ad93143..4a378d1d348babaaf3cf4d37207a013ea1ff9be4 100755 --- a/indra/llmessage/llxfer_vfile.cpp +++ b/indra/llmessage/llxfer_vfile.cpp @@ -118,7 +118,7 @@ S32 LLXfer_VFile::initializeRequest(U64 xfer_id, mName = llformat("VFile %s:%s", id_string.c_str(), LLAssetType::lookup(mType)); - llinfos << "Requesting " << mName << llendl; + LL_INFOS() << "Requesting " << mName << LL_ENDL; if (mBuffer) { @@ -236,8 +236,8 @@ S32 LLXfer_VFile::suck(S32 start_position) // grab a buffer from the right place in the file if (! mVFile->seek(start_position, 0)) { - llwarns << "VFile Xfer Can't seek to position " << start_position << ", file length " << mVFile->getSize() << llendl; - llwarns << "While sending file " << mLocalID << llendl; + LL_WARNS() << "VFile Xfer Can't seek to position " << start_position << ", file length " << mVFile->getSize() << LL_ENDL; + LL_WARNS() << "While sending file " << mLocalID << LL_ENDL; return -1; } @@ -291,7 +291,7 @@ S32 LLXfer_VFile::processEOF() LLVFile file(mVFS, mTempID, mType, LLVFile::WRITE); if (! file.rename(mLocalID, mType)) { - llinfos << "copy from temp file failed: unable to rename to " << mLocalID << llendl; + LL_INFOS() << "copy from temp file failed: unable to rename to " << mLocalID << LL_ENDL; } } diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp index 00b9d81611b6d1dba65bbe6706d9b34b1207c47a..b518dd1b72ebb41dda59152056b91b5f6425d137 100755 --- a/indra/llmessage/llxfermanager.cpp +++ b/indra/llmessage/llxfermanager.cpp @@ -196,13 +196,13 @@ void LLXferManager::printHostStatus() LLHostStatus *host_statusp = NULL; if (!mOutgoingHosts.empty()) { - llinfos << "Outgoing Xfers:" << llendl; + LL_INFOS() << "Outgoing Xfers:" << LL_ENDL; for (status_list_t::iterator iter = mOutgoingHosts.begin(); iter != mOutgoingHosts.end(); ++iter) { host_statusp = *iter; - llinfos << " " << host_statusp->mHost << " active: " << host_statusp->mNumActive << " pending: " << host_statusp->mNumPending << llendl; + LL_INFOS() << " " << host_statusp->mHost << " active: " << host_statusp->mNumActive << " pending: " << host_statusp->mNumPending << LL_ENDL; } } } @@ -392,7 +392,7 @@ U64 LLXferManager::registerXfer(const void *datap, const S32 length) } else { - llerrs << "Xfer allocation error" << llendl; + LL_ERRS() << "Xfer allocation error" << LL_ENDL; xfer_id = 0; } @@ -455,7 +455,7 @@ void LLXferManager::requestFile(const std::string& local_filename, } else { - llerrs << "Xfer allocation error" << llendl; + LL_ERRS() << "Xfer allocation error" << LL_ENDL; } } @@ -483,7 +483,7 @@ void LLXferManager::requestFile(const std::string& remote_filename, } else { - llerrs << "Xfer allocation error" << llendl; + LL_ERRS() << "Xfer allocation error" << LL_ENDL; } } @@ -528,7 +528,7 @@ void LLXferManager::requestVFile(const LLUUID& local_id, } else { - llerrs << "Xfer allocation error" << llendl; + LL_ERRS() << "Xfer allocation error" << LL_ENDL; } } @@ -570,7 +570,7 @@ void LLXferManager::requestXfer( } else { - llerrs << "Xfer allcoation error" << llendl; + LL_ERRS() << "Xfer allcoation error" << LL_ENDL; } } @@ -589,7 +589,7 @@ void LLXferManager::requestXfer(U64 xfer_id, const LLHost &remote_host, BOOL del } else { - llerrs << "Xfer allcoation error" << llendl; + LL_ERRS() << "Xfer allcoation error" << LL_ENDL; } } */ @@ -616,9 +616,9 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user if (!xferp) { char U64_BUF[MAX_STRING]; /* Flawfinder : ignore */ - llwarns << "received xfer data from " << mesgsys->getSender() + LL_WARNS() << "received xfer data from " << mesgsys->getSender() << " for non-existent xfer id: " - << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << llendl; + << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << LL_ENDL; return; } @@ -629,11 +629,11 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user // confirm it if it was a resend of the last one, since the confirmation might have gotten dropped if (decodePacketNum(packetnum) == (xferp->mPacketNum - 1)) { - llinfos << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet " << packetnum << llendl; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender()); + LL_INFOS() << "Reconfirming xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet " << packetnum << LL_ENDL; sendConfirmPacket(mesgsys, id, decodePacketNum(packetnum), mesgsys->getSender()); } else { - llinfos << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << llendl; + LL_INFOS() << "Ignoring xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " recv'd packet " << packetnum << "; expecting " << xferp->mPacketNum << LL_ENDL; } return; } @@ -677,7 +677,7 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user ack_info.mID = id; ack_info.mPacketNum = decodePacketNum(packetnum); ack_info.mRemoteHost = mesgsys->getSender(); - mXferAckQueue.push(ack_info); + mXferAckQueue.push_back(ack_info); } if (isLastPacket(packetnum)) @@ -802,8 +802,8 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user mesgsys->getU64Fast(_PREHASH_XferID, _PREHASH_ID, id); char U64_BUF[MAX_STRING]; /* Flawfinder : ignore */ - llinfos << "xfer request id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) - << " to " << mesgsys->getSender() << llendl; + LL_INFOS() << "xfer request id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) + << " to " << mesgsys->getSender() << LL_ENDL; mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, local_filename); @@ -823,16 +823,16 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user { if(NULL == LLAssetType::lookup(type)) { - llwarns << "Invalid type for xfer request: " << uuid << ":" - << type_s16 << " to " << mesgsys->getSender() << llendl; + LL_WARNS() << "Invalid type for xfer request: " << uuid << ":" + << type_s16 << " to " << mesgsys->getSender() << LL_ENDL; return; } - llinfos << "starting vfile transfer: " << uuid << "," << LLAssetType::lookup(type) << " to " << mesgsys->getSender() << llendl; + LL_INFOS() << "starting vfile transfer: " << uuid << "," << LLAssetType::lookup(type) << " to " << mesgsys->getSender() << LL_ENDL; if (! mVFS) { - llwarns << "Attempt to send VFile w/o available VFS" << llendl; + LL_WARNS() << "Attempt to send VFile w/o available VFS" << LL_ENDL; return; } @@ -845,7 +845,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user } else { - llerrs << "Xfer allcoation error" << llendl; + LL_ERRS() << "Xfer allcoation error" << LL_ENDL; } } else if (!local_filename.empty()) @@ -868,7 +868,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user case LL_PATH_NONE: if(!validateFileForTransfer(local_filename)) { - llwarns << "SECURITY: Unapproved filename '" << local_filename << llendl; + LL_WARNS() << "SECURITY: Unapproved filename '" << local_filename << LL_ENDL; return; } break; @@ -876,13 +876,13 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user case LL_PATH_CACHE: if(!verify_cache_filename(local_filename)) { - llwarns << "SECURITY: Illegal cache filename '" << local_filename << llendl; + LL_WARNS() << "SECURITY: Illegal cache filename '" << local_filename << LL_ENDL; return; } break; default: - llwarns << "SECURITY: Restricted file dir enum: " << (U32)local_path << llendl; + LL_WARNS() << "SECURITY: Restricted file dir enum: " << (U32)local_path << LL_ENDL; return; } @@ -897,7 +897,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user { expanded_filename = local_filename; } - llinfos << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << llendl; + LL_INFOS() << "starting file transfer: " << expanded_filename << " to " << mesgsys->getSender() << LL_ENDL; BOOL delete_local_on_completion = FALSE; mesgsys->getBOOL("XferID", "DeleteOnCompletion", delete_local_on_completion); @@ -913,15 +913,15 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user } else { - llerrs << "Xfer allcoation error" << llendl; + LL_ERRS() << "Xfer allcoation error" << LL_ENDL; } } else { char U64_BUF[MAX_STRING]; /* Flawfinder : ignore */ - llinfos << "starting memory transfer: " + LL_INFOS() << "starting memory transfer: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << " to " - << mesgsys->getSender() << llendl; + << mesgsys->getSender() << LL_ENDL; xferp = findXfer(id, mSendList); @@ -931,7 +931,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user } else { - llinfos << "Warning: " << U64_BUF << " not found." << llendl; + LL_INFOS() << "Warning: " << U64_BUF << " not found." << LL_ENDL; result = LL_ERR_FILE_NOT_FOUND; } } @@ -945,7 +945,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user } else // can happen with a memory transfer not found { - llinfos << "Aborting xfer to " << mesgsys->getSender() << " with error: " << result << llendl; + LL_INFOS() << "Aborting xfer to " << mesgsys->getSender() << " with error: " << result << LL_ENDL; mesgsys->newMessageFast(_PREHASH_AbortXfer); mesgsys->nextBlockFast(_PREHASH_XferID); @@ -959,18 +959,18 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user { xferp->sendNextPacket(); changeNumActiveXfers(xferp->mRemoteHost,1); -// llinfos << "***STARTING XFER IMMEDIATELY***" << llendl; +// LL_INFOS() << "***STARTING XFER IMMEDIATELY***" << LL_ENDL; } else { if(xferp) { - llinfos << " queueing xfer request, " << numPendingXfers(xferp->mRemoteHost) << " ahead of this one" << llendl; + LL_INFOS() << " queueing xfer request, " << numPendingXfers(xferp->mRemoteHost) << " ahead of this one" << LL_ENDL; } else { - llwarns << "LLXferManager::processFileRequest() - no xfer found!" - << llendl; + LL_WARNS() << "LLXferManager::processFileRequest() - no xfer found!" + << LL_ENDL; } } } @@ -1016,7 +1016,7 @@ void LLXferManager::retransmitUnackedPackets () // if the circuit dies, abort if (! gMessageSystem->mCircuitInfo.isCircuitAlive( xferp->mRemoteHost )) { - llinfos << "Xfer found in progress on dead circuit, aborting" << llendl; + LL_INFOS() << "Xfer found in progress on dead circuit, aborting" << LL_ENDL; xferp->mCallbackResult = LL_ERR_CIRCUIT_GONE; xferp->processEOF(); delp = xferp; @@ -1038,7 +1038,7 @@ void LLXferManager::retransmitUnackedPackets () { if (xferp->mRetries > LL_PACKET_RETRY_LIMIT) { - llinfos << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet retransmit limit exceeded, xfer dropped" << llendl; + LL_INFOS() << "dropping xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet retransmit limit exceeded, xfer dropped" << LL_ENDL; xferp->abort(LL_ERR_TCP_TIMEOUT); delp = xferp; xferp = xferp->mNext; @@ -1046,14 +1046,14 @@ void LLXferManager::retransmitUnackedPackets () } else { - llinfos << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << llendl; + LL_INFOS() << "resending xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << " packet unconfirmed after: "<< et << " sec, packet " << xferp->mPacketNum << LL_ENDL; xferp->resendLastPacket(); xferp = xferp->mNext; } } else if ((xferp->mStatus == e_LL_XFER_REGISTERED) && ( (et = xferp->ACKTimer.getElapsedTimeF32()) > LL_XFER_REGISTRATION_TIMEOUT)) { - llinfos << "registered xfer never requested, xfer dropped" << llendl; + LL_INFOS() << "registered xfer never requested, xfer dropped" << LL_ENDL; xferp->abort(LL_ERR_TCP_TIMEOUT); delp = xferp; xferp = xferp->mNext; @@ -1061,17 +1061,17 @@ void LLXferManager::retransmitUnackedPackets () } else if (xferp->mStatus == e_LL_XFER_ABORTED) { - llwarns << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << llendl; + LL_WARNS() << "Removing aborted xfer " << xferp->mRemoteHost << ":" << xferp->getFileName() << LL_ENDL; delp = xferp; xferp = xferp->mNext; removeXfer(delp,&mSendList); } else if (xferp->mStatus == e_LL_XFER_PENDING) { -// llinfos << "*** numActiveXfers = " << numActiveXfers(xferp->mRemoteHost) << " mMaxOutgoingXfersPerCircuit = " << mMaxOutgoingXfersPerCircuit << llendl; +// LL_INFOS() << "*** numActiveXfers = " << numActiveXfers(xferp->mRemoteHost) << " mMaxOutgoingXfersPerCircuit = " << mMaxOutgoingXfersPerCircuit << LL_ENDL; if (numActiveXfers(xferp->mRemoteHost) < mMaxOutgoingXfersPerCircuit) { -// llinfos << "bumping pending xfer to active" << llendl; +// LL_INFOS() << "bumping pending xfer to active" << LL_ENDL; xferp->sendNextPacket(); changeNumActiveXfers(xferp->mRemoteHost,1); } @@ -1088,16 +1088,16 @@ void LLXferManager::retransmitUnackedPackets () // so we don't blow through bandwidth. // - while (mXferAckQueue.getLength()) + while (mXferAckQueue.size()) { if (mAckThrottle.checkOverflow(1000.0f*8.0f)) { break; } - //llinfos << "Confirm packet queue length:" << mXferAckQueue.getLength() << llendl; - LLXferAckInfo ack_info; - mXferAckQueue.pop(ack_info); - //llinfos << "Sending confirm packet" << llendl; + //LL_INFOS() << "Confirm packet queue length:" << mXferAckQueue.size() << LL_ENDL; + LLXferAckInfo ack_info = mXferAckQueue.front(); + mXferAckQueue.pop_front(); + //LL_INFOS() << "Sending confirm packet" << LL_ENDL; sendConfirmPacket(gMessageSystem, ack_info.mID, ack_info.mPacketNum, ack_info.mRemoteHost); mAckThrottle.throttleOverflow(1000.f*8.f); // Assume 1000 bytes/packet } @@ -1156,9 +1156,9 @@ void LLXferManager::startPendingDownloads() S32 start_count = mMaxIncomingXfers - download_count; - lldebugs << "LLXferManager::startPendingDownloads() - XFER_IN_PROGRESS: " + LL_DEBUGS() << "LLXferManager::startPendingDownloads() - XFER_IN_PROGRESS: " << download_count << " XFER_PENDING: " << pending_count - << " startring " << llmin(start_count, pending_count) << llendl; + << " startring " << llmin(start_count, pending_count) << LL_ENDL; if((start_count > 0) && (pending_count > 0)) { diff --git a/indra/llmessage/llxfermanager.h b/indra/llmessage/llxfermanager.h index b84bccb5b79c14f51ae50530eaa8f3fdc8bb29a6..b3d110e7a145bf897fa67725765c7fda0ff6c723 100755 --- a/indra/llmessage/llxfermanager.h +++ b/indra/llmessage/llxfermanager.h @@ -41,7 +41,7 @@ class LLVFS; #include "message.h" #include "llassetstorage.h" #include "lldir.h" -#include "lllinkedqueue.h" +#include <deque> #include "llthrottle.h" class LLHostStatus @@ -80,7 +80,7 @@ class LLXferManager S32 mMaxIncomingXfers; BOOL mUseAckThrottling; // Use ack throttling to cap file xfer bandwidth - LLLinkedQueue<LLXferAckInfo> mXferAckQueue; + std::deque<LLXferAckInfo> mXferAckQueue; LLThrottle mAckThrottle; public: diff --git a/indra/llmessage/machine.cpp b/indra/llmessage/machine.cpp index 8d2f512037c89bcbe0f0ffd2d4f792bad2cd8a19..1e9c9c3c9a8cd05b73ff7ed89fb6160e9654b44b 100755 --- a/indra/llmessage/machine.cpp +++ b/indra/llmessage/machine.cpp @@ -33,7 +33,7 @@ void LLMachine::setMachinePort(S32 port) { if (port < 0) { - llinfos << "Can't assign a negative number to LLMachine::mPort" << llendl; + LL_INFOS() << "Can't assign a negative number to LLMachine::mPort" << LL_ENDL; mHost.setPort(0); } else @@ -46,7 +46,7 @@ void LLMachine::setControlPort( S32 port ) { if (port < 0) { - llinfos << "Can't assign a negative number to LLMachine::mControlPort" << llendl; + LL_INFOS() << "Can't assign a negative number to LLMachine::mControlPort" << LL_ENDL; mControlPort = 0; } else diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index c3642ccbe85ae1f904364148df7dd7bf090f1cab..4e4dcc1d815ffd284d576c60e0ff97cc66104858 100755 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -47,10 +47,8 @@ // linden library headers #include "indra_constants.h" -#include "lldarray.h" #include "lldir.h" #include "llerror.h" -#include "llerrorlegacy.h" #include "llfasttimer.h" #include "llhttpclient.h" #include "llhttpnodeadapter.h" @@ -73,7 +71,6 @@ #include "lltransfermanager.h" #include "lluuid.h" #include "llxfermanager.h" -#include "timing.h" #include "llquaternion.h" #include "u64.h" #include "v3dmath.h" @@ -83,7 +80,7 @@ // Constants //const char* MESSAGE_LOG_FILENAME = "message.log"; -static const F32 CIRCUIT_DUMP_TIMEOUT = 30.f; +static const F32Seconds CIRCUIT_DUMP_TIMEOUT(30.f); static const S32 TRUST_TIME_WINDOW = 3; // *NOTE: This needs to be moved into a seperate file so that it never gets @@ -120,7 +117,7 @@ namespace { LL_WARNS("Messaging") << "error status " << status << " for message " << mMessageName - << " reason " << reason << llendl; + << " reason " << reason << LL_ENDL; } // TODO: Map status in to useful error code. if(NULL != mCallback) mCallback(mCallbackData, LL_ERR_TCP_TIMEOUT); @@ -155,7 +152,7 @@ void LLMessageHandlerBridge::post(LLHTTPNode::ResponsePtr response, std::string name = context["request"]["wildcard"]["message-name"]; char* namePtr = LLMessageStringTable::getInstance()->getString(name.c_str()); - lldebugs << "Setting mLastSender " << input["sender"].asString() << llendl; + LL_DEBUGS() << "Setting mLastSender " << input["sender"].asString() << LL_ENDL; gMessageSystem->mLastSender = LLHost(input["sender"].asString()); gMessageSystem->mPacketsIn += 1; gMessageSystem->mLLSDMessageReader->setMessage(namePtr, input["body"]); @@ -241,7 +238,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, S32 version_patch, bool failure_is_fatal, const F32 circuit_heartbeat_interval, const F32 circuit_timeout) : - mCircuitInfo(circuit_heartbeat_interval, circuit_timeout), + mCircuitInfo(F32Seconds(circuit_heartbeat_interval), F32Seconds(circuit_timeout)), mLastMessageFromTrustedMessageService(false) { init(); @@ -262,7 +259,7 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, mSendPacketFailureCount = 0; - mCircuitPrintFreq = 60.f; // seconds + mCircuitPrintFreq = F32Seconds(60.f); loadTemplateFile(filename, failure_is_fatal); @@ -284,14 +281,14 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, mbError = TRUE; mErrorCode = error; } -// LL_DEBUGS("Messaging") << << "*** port: " << mPort << llendl; +// LL_DEBUGS("Messaging") << << "*** port: " << mPort << LL_ENDL; // // Create the data structure that we can poll on // if (!gAPRPoolp) { - LL_ERRS("Messaging") << "No APR pool before message system initialization!" << llendl; + LL_ERRS("Messaging") << "No APR pool before message system initialization!" << LL_ENDL; ll_init_apr(); } apr_socket_t *aprSocketp = NULL; @@ -306,20 +303,20 @@ LLMessageSystem::LLMessageSystem(const std::string& filename, U32 port, mPollInfop->mPollFD.desc.s = aprSocketp; mPollInfop->mPollFD.client_data = NULL; - F64 mt_sec = getMessageTimeSeconds(); + F64Seconds mt_sec = getMessageTimeSeconds(); mResendDumpTime = mt_sec; mMessageCountTime = mt_sec; mCircuitPrintTime = mt_sec; - mCurrentMessageTimeSeconds = mt_sec; + mCurrentMessageTime = F64Seconds(mt_sec); // Constants for dumping output based on message processing time/count mNumMessageCounts = 0; mMaxMessageCounts = 200; // >= 0 means dump warnings - mMaxMessageTime = 1.f; + mMaxMessageTime = F32Seconds(1.f); mTrueReceiveSize = 0; - mReceiveTime = 0.f; + mReceiveTime = F32Seconds(0.f); } @@ -329,7 +326,7 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure { if(filename.empty()) { - LL_ERRS("Messaging") << "No template filename specified" << llendl; + LL_ERRS("Messaging") << "No template filename specified" << LL_ENDL; mbError = TRUE; return; } @@ -338,9 +335,9 @@ void LLMessageSystem::loadTemplateFile(const std::string& filename, bool failure if(!_read_file_into_string(template_body, filename)) { if (failure_is_fatal) { - LL_ERRS("Messaging") << "Failed to open template: " << filename << llendl; + LL_ERRS("Messaging") << "Failed to open template: " << filename << LL_ENDL; } else { - LL_WARNS("Messaging") << "Failed to open template: " << filename << llendl; + LL_WARNS("Messaging") << "Failed to open template: " << filename << LL_ENDL; } mbError = TRUE; return; @@ -534,7 +531,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) { // This is the first message being handled after a resetReceiveCounts, // we must be starting the message processing loop. Reset the timers. - mCurrentMessageTimeSeconds = totalTime() * SEC_PER_USEC; + mCurrentMessageTime = totalTime(); mMessageCountTime = getMessageTimeSeconds(); } @@ -566,7 +563,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) // Ones that are non-zero but below the minimum packet size are worrisome. if (receive_size > 0) { - LL_WARNS("Messaging") << "Invalid (too short) packet discarded " << receive_size << llendl; + LL_WARNS("Messaging") << "Invalid (too short) packet discarded " << receive_size << LL_ENDL; callExceptionFunc(MX_PACKET_TOO_SHORT); } // no data in packet receive buffer @@ -592,7 +589,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) // the next one LL_WARNS("Messaging") << "Malformed packet received. Packet size " << receive_size << " with invalid no. of acks " << acks - << llendl; + << LL_ENDL; valid_packet = FALSE; continue; } @@ -620,7 +617,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) memcpy(&mem_id, &mTrueReceiveBuffer[true_rcv_size], /* Flawfinder: ignore*/ sizeof(TPACKETID)); packet_id = ntohl(mem_id); - //LL_INFOS("Messaging") << "got ack: " << packet_id << llendl; + //LL_INFOS("Messaging") << "got ack: " << packet_id << LL_ENDL; cdp->ackReliablePacket(packet_id); } if (!cdp->getUnackedPacketCount()) @@ -652,14 +649,14 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) // LL_WARNS("Messaging") << "DISCARDED PACKET HOST MISMATCH! HOST: " // << host << " CIRCUIT: " // << mCircuitInfo.mCurrentCircuit->mHost - // << llendl; + // << LL_ENDL; //} // *************************************** //mCircuitInfo.mCurrentCircuit->mAcks.put(mCurrentRecvPacketID); cdp->collectRAck(mCurrentRecvPacketID); } - LL_DEBUGS("Messaging") << "Discarding duplicate resend from " << host << llendl; + LL_DEBUGS("Messaging") << "Discarding duplicate resend from " << host << LL_ENDL; if(mVerboseLog) { std::ostringstream str; @@ -671,7 +668,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) << " resent " << ((acks > 0) ? "acks" : "") << " DISCARD DUPLICATE"; - LL_INFOS("Messaging") << str.str() << llendl; + LL_INFOS("Messaging") << str.str() << LL_ENDL; } mPacketsIn++; valid_packet = FALSE; @@ -750,7 +747,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) { if (mbProtected && (!cdp)) { - LL_WARNS("Messaging") << "Invalid Packet from invalid circuit " << host << llendl; + LL_WARNS("Messaging") << "Invalid Packet from invalid circuit " << host << LL_ENDL; mOffCircuitPackets++; } else @@ -761,7 +758,7 @@ BOOL LLMessageSystem::checkMessages( S64 frame_count ) } } while (!valid_packet && receive_size > 0); - F64 mt_sec = getMessageTimeSeconds(); + F64Seconds mt_sec = getMessageTimeSeconds(); // Check to see if we need to print debug info if ((mt_sec - mCircuitPrintTime) > mCircuitPrintFreq) { @@ -792,7 +789,7 @@ S32 LLMessageSystem::getReceiveBytes() const void LLMessageSystem::processAcks() { - F64 mt_sec = getMessageTimeSeconds(); + F64Seconds mt_sec = getMessageTimeSeconds(); { gTransferManager.updateTransfers(); @@ -820,7 +817,7 @@ void LLMessageSystem::processAcks() if (!mDenyTrustedCircuitSet.empty()) { - LL_INFOS("Messaging") << "Sending queued DenyTrustedCircuit messages." << llendl; + LL_INFOS("Messaging") << "Sending queued DenyTrustedCircuit messages." << LL_ENDL; for (host_set_t::iterator hostit = mDenyTrustedCircuitSet.begin(); hostit != mDenyTrustedCircuitSet.end(); ++hostit) { reallySendDenyTrustedCircuit(*hostit); @@ -836,10 +833,10 @@ void LLMessageSystem::processAcks() } } - if (mMaxMessageTime >= 0.f) + if (mMaxMessageTime >= F32Seconds(0.f)) { // This is one of the only places where we're required to get REAL message system time. - mReceiveTime = (F32)(getMessageTimeSeconds(TRUE) - mMessageCountTime); + mReceiveTime = getMessageTimeSeconds(TRUE) - mMessageCountTime; if (mReceiveTime > mMaxMessageTime) { dump = TRUE; @@ -894,7 +891,7 @@ LLSD LLMessageSystem::getBuiltMessageLLSD() const else { // TODO: implement as below? - llerrs << "Message not built as LLSD." << llendl; + LL_ERRS() << "Message not built as LLSD." << LL_ENDL; } return result; } @@ -1013,13 +1010,13 @@ S32 LLMessageSystem::sendReliable(const LLHost &host) S32 LLMessageSystem::sendSemiReliable(const LLHost &host, void (*callback)(void **,S32), void ** callback_data) { - F32 timeout; + F32Seconds timeout; LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (cdp) { timeout = llmax(LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS, - LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged()); + F32Seconds(LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged())); } else { @@ -1035,7 +1032,7 @@ S32 LLMessageSystem::sendSemiReliable(const LLHost &host, void (*callback)(void S32 LLMessageSystem::sendReliable( const LLHost &host, S32 retries, BOOL ping_based_timeout, - F32 timeout, + F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data) { @@ -1044,11 +1041,11 @@ S32 LLMessageSystem::sendReliable( const LLHost &host, LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (cdp) { - timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, LL_RELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged()); + timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, F32Seconds(LL_RELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged())); } else { - timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, LL_RELIABLE_TIMEOUT_FACTOR * LL_AVERAGED_PING_MAX); + timeout = llmax(LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS, F32Seconds(LL_RELIABLE_TIMEOUT_FACTOR * LL_AVERAGED_PING_MAX)); } } @@ -1080,7 +1077,7 @@ void LLMessageSystem::forwardReliable(const U32 circuit_code) S32 LLMessageSystem::forwardReliable( const LLHost &host, S32 retries, BOOL ping_based_timeout, - F32 timeout, + F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data) { @@ -1090,13 +1087,13 @@ S32 LLMessageSystem::forwardReliable( const LLHost &host, S32 LLMessageSystem::flushSemiReliable(const LLHost &host, void (*callback)(void **,S32), void ** callback_data) { - F32 timeout; + F32Seconds timeout; LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (cdp) { timeout = llmax(LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS, - LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged()); + F32Seconds(LL_SEMIRELIABLE_TIMEOUT_FACTOR * cdp->getPingDelayAveraged())); } else { @@ -1147,7 +1144,7 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n // explicitly sent as reliable, so they don't have a callback // LL_WARNS("Messaging") << "LLMessageSystem::sendMessage: Sending unreliable " // << mMessageBuilder->getMessageName() << " message via HTTP" -// << llendl; +// << LL_ENDL; return new LLFnPtrResponder( NULL, NULL, @@ -1156,7 +1153,7 @@ LLHTTPClient::ResponderPtr LLMessageSystem::createResponder(const std::string& n } // This can be called from signal handlers, -// so should should not use llinfos. +// so should should not use LL_INFOS(). S32 LLMessageSystem::sendMessage(const LLHost &host) { if (! mMessageBuilder->isBuilt()) @@ -1183,11 +1180,11 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) if(mVerboseLog) { LL_INFOS_ONCE("Messaging") << "MSG: -> " << host << "\tUNKNOWN CIRCUIT:\t" - << mMessageBuilder->getMessageName() << llendl; + << mMessageBuilder->getMessageName() << LL_ENDL; } LL_WARNS_ONCE("Messaging") << "sendMessage - Trying to send " << mMessageBuilder->getMessageName() << " on unknown circuit " - << host << llendl; + << host << LL_ENDL; return 0; } else @@ -1206,11 +1203,11 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) if(mVerboseLog) { LL_INFOS("Messaging") << "MSG: -> " << host << "\tDEAD CIRCUIT\t\t" - << mMessageBuilder->getMessageName() << llendl; + << mMessageBuilder->getMessageName() << LL_ENDL; } LL_WARNS("Messaging") << "sendMessage - Trying to send message " << mMessageBuilder->getMessageName() << " to dead circuit " - << host << llendl; + << host << LL_ENDL; return 0; } } @@ -1255,7 +1252,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) LL_WARNS("Messaging") << "sendMessage - Trying to send " << ((buffer_length > 4000) ? "EXTRA " : "") << "BIG message " << mMessageBuilder->getMessageName() << " - " - << buffer_length << llendl; + << buffer_length << LL_ENDL; } } if (mSendReliable) @@ -1317,7 +1314,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) // append_acout_count is incorrect or that // MAX_BUFFER_SIZE has fallen below MTU which is bad // and probably programmer error. - LL_ERRS("Messaging") << "Buffer packing failed due to size.." << llendl; + LL_ERRS("Messaging") << "Buffer packing failed due to size.." << LL_ENDL; } } @@ -1340,7 +1337,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) else { // mCircuitInfo already points to the correct circuit data - cdp->addBytesOut( buffer_length ); + cdp->addBytesOut( (S32Bytes)buffer_length ); } if(mVerboseLog) @@ -1358,7 +1355,7 @@ S32 LLMessageSystem::sendMessage(const LLHost &host) std::ostream_iterator<TPACKETID> append(str, " "); std::copy(acks.begin(), acks.end(), append); } - LL_INFOS("Messaging") << str.str() << llendl; + LL_INFOS("Messaging") << str.str() << LL_ENDL; } @@ -1382,7 +1379,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re << nullToEmpty(mMessageReader->getMessageName()) << (recv_reliable ? " reliable" : "") << " REJECTED"; - LL_INFOS("Messaging") << str.str() << llendl; + LL_INFOS("Messaging") << str.str() << LL_ENDL; } // nope! // cout << "Rejecting unexpected message " << mCurrentMessageTemplate->mName << " from " << hex << ip << " , " << dec << port << endl; @@ -1390,7 +1387,7 @@ void LLMessageSystem::logMsgFromInvalidCircuit( const LLHost& host, BOOL recv_re // Keep track of rejected messages as well if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM) { - LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl; + LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << LL_ENDL; } else { @@ -1409,7 +1406,7 @@ S32 LLMessageSystem::sendMessage( { if (!(host.isOk())) { - LL_WARNS("Messaging") << "trying to send message to invalid host" << llendl; + LL_WARNS("Messaging") << "trying to send message to invalid host" << LL_ENDL; return 0; } @@ -1427,14 +1424,14 @@ void LLMessageSystem::logTrustedMsgFromUntrustedCircuit( const LLHost& host ) LL_WARNS("Messaging") << "Received trusted message on untrusted circuit. " << "Will reply with deny. " << "Message: " << nullToEmpty(mMessageReader->getMessageName()) - << " Host: " << host << llendl; + << " Host: " << host << LL_ENDL; } if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM) { LL_WARNS("Messaging") << "got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" - << llendl; + << LL_ENDL; } else { @@ -1452,7 +1449,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r { if (mNumMessageCounts >= MAX_MESSAGE_COUNT_NUM) { - LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << llendl; + LL_WARNS("Messaging") << "Got more than " << MAX_MESSAGE_COUNT_NUM << " packets without clearing counts" << LL_ENDL; } else { @@ -1467,7 +1464,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r { // update circuit packet ID tracking (missing/out of order packets) cdp->checkPacketInID( mCurrentRecvPacketID, recv_resent ); - cdp->addBytesIn( mTrueReceiveSize ); + cdp->addBytesIn( (S32Bytes)mTrueReceiveSize ); } if(mVerboseLog) @@ -1481,7 +1478,7 @@ void LLMessageSystem::logValidMsg(LLCircuitData *cdp, const LLHost& host, BOOL r << (recv_reliable ? " reliable" : "") << (recv_resent ? " resent" : "") << (recv_acks ? " acks" : ""); - LL_INFOS("Messaging") << str.str() << llendl; + LL_INFOS("Messaging") << str.str() << LL_ENDL; } } @@ -1491,54 +1488,54 @@ void LLMessageSystem::sanityCheck() // if (!mCurrentRMessageData) // { -// LL_ERRS("Messaging") << "mCurrentRMessageData is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentRMessageData is NULL" << LL_ENDL; // } // if (!mCurrentRMessageTemplate) // { -// LL_ERRS("Messaging") << "mCurrentRMessageTemplate is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentRMessageTemplate is NULL" << LL_ENDL; // } // if (!mCurrentRTemplateBlock) // { -// LL_ERRS("Messaging") << "mCurrentRTemplateBlock is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentRTemplateBlock is NULL" << LL_ENDL; // } // if (!mCurrentRDataBlock) // { -// LL_ERRS("Messaging") << "mCurrentRDataBlock is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentRDataBlock is NULL" << LL_ENDL; // } // if (!mCurrentSMessageData) // { -// LL_ERRS("Messaging") << "mCurrentSMessageData is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentSMessageData is NULL" << LL_ENDL; // } // if (!mCurrentSMessageTemplate) // { -// LL_ERRS("Messaging") << "mCurrentSMessageTemplate is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentSMessageTemplate is NULL" << LL_ENDL; // } // if (!mCurrentSTemplateBlock) // { -// LL_ERRS("Messaging") << "mCurrentSTemplateBlock is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentSTemplateBlock is NULL" << LL_ENDL; // } // if (!mCurrentSDataBlock) // { -// LL_ERRS("Messaging") << "mCurrentSDataBlock is NULL" << llendl; +// LL_ERRS("Messaging") << "mCurrentSDataBlock is NULL" << LL_ENDL; // } } void LLMessageSystem::showCircuitInfo() { - LL_INFOS("Messaging") << mCircuitInfo << llendl; + LL_INFOS("Messaging") << mCircuitInfo << LL_ENDL; } void LLMessageSystem::dumpCircuitInfo() { - lldebugst(LLERR_CIRCUIT_INFO) << mCircuitInfo << llendl; + LL_DEBUGS("Messaging") << mCircuitInfo << LL_ENDL; } /* virtual */ @@ -1582,7 +1579,7 @@ void LLMessageSystem::enableCircuit(const LLHost &host, BOOL trusted) void LLMessageSystem::disableCircuit(const LLHost &host) { - LL_INFOS("Messaging") << "LLMessageSystem::disableCircuit for " << host << llendl; + LL_INFOS("Messaging") << "LLMessageSystem::disableCircuit for " << host << LL_ENDL; U32 code = gMessageSystem->findCircuitCode( host ); // Don't need to do this, as we're removing the circuit info anyway - djs 01/28/03 @@ -1595,7 +1592,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host) code_session_map_t::iterator it = mCircuitCodes.find(code); if(it != mCircuitCodes.end()) { - LL_INFOS("Messaging") << "Circuit " << code << " removed from list" << llendl; + LL_INFOS("Messaging") << "Circuit " << code << " removed from list" << LL_ENDL; //mCircuitCodes.removeData(code); mCircuitCodes.erase(it); } @@ -1611,7 +1608,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host) U32 old_port = (U32)(ip_port & (U64)0xFFFFFFFF); U32 old_ip = (U32)(ip_port >> 32); - LL_INFOS("Messaging") << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << llendl; + LL_INFOS("Messaging") << "Host " << LLHost(old_ip, old_port) << " circuit " << code << " removed from lookup table" << LL_ENDL; gMessageSystem->mIPPortToCircuitCode.erase(ip_port); } mCircuitInfo.removeCircuitData(host); @@ -1621,7 +1618,7 @@ void LLMessageSystem::disableCircuit(const LLHost &host) // Sigh, since we can open circuits which don't have circuit // codes, it's possible for this to happen... - LL_WARNS("Messaging") << "Couldn't find circuit code for " << host << llendl; + LL_WARNS("Messaging") << "Couldn't find circuit code for " << host << LL_ENDL; } } @@ -1652,7 +1649,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit) if (!host.isOk()) { - LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << llendl; + LL_DEBUGS("Messaging") << "checkCircuitBlocked: Unknown circuit " << circuit << LL_ENDL; return TRUE; } @@ -1663,7 +1660,7 @@ BOOL LLMessageSystem::checkCircuitBlocked(const U32 circuit) } else { - LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << llendl; + LL_INFOS("Messaging") << "checkCircuitBlocked(circuit): Unknown host - " << host << LL_ENDL; return FALSE; } } @@ -1674,7 +1671,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit) if (!host.isOk()) { - LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << llendl; + LL_DEBUGS("Messaging") << "checkCircuitAlive: Unknown circuit " << circuit << LL_ENDL; return FALSE; } @@ -1685,7 +1682,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const U32 circuit) } else { - LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << llendl; + LL_INFOS("Messaging") << "checkCircuitAlive(circuit): Unknown host - " << host << LL_ENDL; return FALSE; } } @@ -1699,7 +1696,7 @@ BOOL LLMessageSystem::checkCircuitAlive(const LLHost &host) } else { - LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << llendl; + LL_DEBUGS("Messaging") << "checkCircuitAlive(host): Unknown host - " << host << LL_ENDL; return FALSE; } } @@ -1734,7 +1731,7 @@ LLHost LLMessageSystem::findHost(const U32 circuit_code) void LLMessageSystem::setMaxMessageTime(const F32 seconds) { - mMaxMessageTime = seconds; + mMaxMessageTime = F32Seconds(seconds); } void LLMessageSystem::setMaxMessageCounts(const S32 num) @@ -1851,18 +1848,18 @@ void LLMessageSystem::processAssignCircuitCode(LLMessageSystem* msg, void**) { LL_WARNS("Messaging") << "AssignCircuitCode, bad session id. Expecting " << msg->getMySessionID() << " but got " << session_id - << llendl; + << LL_ENDL; return; } U32 code; msg->getU32Fast(_PREHASH_CircuitCode, _PREHASH_Code, code); if (!code) { - LL_ERRS("Messaging") << "Assigning circuit code of zero!" << llendl; + LL_ERRS("Messaging") << "Assigning circuit code of zero!" << LL_ENDL; } msg->mOurCircuitCode = code; - LL_INFOS("Messaging") << "Circuit code " << code << " assigned." << llendl; + LL_INFOS("Messaging") << "Circuit code " << code << " assigned." << LL_ENDL; } */ @@ -1886,20 +1883,20 @@ bool LLMessageSystem::addCircuitCode(U32 code, const LLUUID& session_id) { if(!code) { - LL_WARNS("Messaging") << "addCircuitCode: zero circuit code" << llendl; + LL_WARNS("Messaging") << "addCircuitCode: zero circuit code" << LL_ENDL; return false; } code_session_map_t::iterator it = mCircuitCodes.find(code); if(it == mCircuitCodes.end()) { - LL_INFOS("Messaging") << "New circuit code " << code << " added" << llendl; + LL_INFOS("Messaging") << "New circuit code " << code << " added" << LL_ENDL; //msg->mCircuitCodes[circuit_code] = circuit_code; mCircuitCodes.insert(code_session_map_t::value_type(code, session_id)); } else { - LL_INFOS("Messaging") << "Duplicate circuit code " << code << " added" << llendl; + LL_INFOS("Messaging") << "Duplicate circuit code " << code << " added" << LL_ENDL; } return true; } @@ -1933,7 +1930,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, // Whoah, abort! We don't know anything about this circuit code. LL_WARNS("Messaging") << "UseCircuitCode for " << circuit_code_in << " received without AddCircuitCode message - aborting" - << llendl; + << LL_ENDL; return; } @@ -1945,7 +1942,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, { LL_WARNS("Messaging") << "UseCircuitCode unmatched session id. Got " << session_id << " but expected " << (*it).second - << llendl; + << LL_ENDL; return; } @@ -1958,7 +1955,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, if ((ip_port_old == ip_port_in) && (circuit_code_old == circuit_code_in)) { // Current information is the same as incoming info, ignore - LL_INFOS("Messaging") << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << llendl; + LL_INFOS("Messaging") << "Got duplicate UseCircuitCode for circuit " << circuit_code_in << " to " << msg->getSender() << LL_ENDL; return; } @@ -1968,27 +1965,27 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, msg->mIPPortToCircuitCode.erase(ip_port_old); U32 old_port = (U32)(ip_port_old & (U64)0xFFFFFFFF); U32 old_ip = (U32)(ip_port_old >> 32); - LL_INFOS("Messaging") << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << llendl; + LL_INFOS("Messaging") << "Removing derelict lookup entry for circuit " << circuit_code_old << " to " << LLHost(old_ip, old_port) << LL_ENDL; } if (circuit_code_old) { LLHost cur_host(ip, port); - LL_WARNS("Messaging") << "Disabling existing circuit for " << cur_host << llendl; + LL_WARNS("Messaging") << "Disabling existing circuit for " << cur_host << LL_ENDL; msg->disableCircuit(cur_host); if (circuit_code_old == circuit_code_in) { - LL_WARNS("Messaging") << "Asymmetrical circuit to ip/port lookup!" << llendl; - LL_WARNS("Messaging") << "Multiple circuit codes for " << cur_host << " probably!" << llendl; - LL_WARNS("Messaging") << "Permanently disabling circuit" << llendl; + LL_WARNS("Messaging") << "Asymmetrical circuit to ip/port lookup!" << LL_ENDL; + LL_WARNS("Messaging") << "Multiple circuit codes for " << cur_host << " probably!" << LL_ENDL; + LL_WARNS("Messaging") << "Permanently disabling circuit" << LL_ENDL; return; } else { LL_WARNS("Messaging") << "Circuit code changed for " << msg->getSender() << " from " << circuit_code_old << " to " - << circuit_code_in << llendl; + << circuit_code_in << LL_ENDL; } } @@ -2030,7 +2027,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, LL_INFOS("Messaging") << "Circuit code " << circuit_code_in << " from " << msg->getSender() << " for agent " << id << " in session " - << session_id << llendl; + << session_id << LL_ENDL; const LLUseCircuitCodeResponder* responder = (const LLUseCircuitCodeResponder*) user; @@ -2041,7 +2038,7 @@ void LLMessageSystem::processUseCircuitCode(LLMessageSystem* msg, } else { - LL_WARNS("Messaging") << "Got zero circuit code in use_circuit_code" << llendl; + LL_WARNS("Messaging") << "Got zero circuit code in use_circuit_code" << LL_ENDL; } } @@ -2063,7 +2060,7 @@ void LLMessageSystem::processError(LLMessageSystem* msg, void**) LL_WARNS("Messaging") << "Message error from " << msg->getSender() << " - " << error_code << " " << error_token << " " << error_id << " \"" - << error_system << "\" \"" << error_message << "\"" << llendl; + << error_system << "\" \"" << error_message << "\"" << LL_ENDL; } @@ -2099,7 +2096,7 @@ void LLMessageSystem::dispatch( gMessageSystem->mMessageTemplates.end()) && !LLMessageConfig::isValidMessage(msg_name)) { - LL_WARNS("Messaging") << "Ignoring unknown message " << msg_name << llendl; + LL_WARNS("Messaging") << "Ignoring unknown message " << msg_name << LL_ENDL; responsep->notFound("Invalid message name"); return; } @@ -2110,12 +2107,12 @@ void LLMessageSystem::dispatch( if (!handler) { LL_WARNS("Messaging") << "LLMessageService::dispatch > no handler for " - << path << llendl; + << path << LL_ENDL; return; } // enable this for output of message names - //LL_INFOS("Messaging") << "< \"" << msg_name << "\"" << llendl; - //lldebugs << "data: " << LLSDNotationStreamer(message) << llendl; + //LL_INFOS("Messaging") << "< \"" << msg_name << "\"" << LL_ENDL; + //LL_DEBUGS() << "data: " << LLSDNotationStreamer(message) << LL_ENDL; handler->post(responsep, context, message); } @@ -2233,7 +2230,7 @@ S32 LLMessageSystem::sendError( else { LL_WARNS("Messaging") << "Data and message were too large -- data removed." - << llendl; + << LL_ENDL; addBinaryData("Data", NULL, 0); } return sendReliable(host); @@ -2253,7 +2250,7 @@ void process_packet_ack(LLMessageSystem *msgsystem, void** /*user_data*/) for (S32 i = 0; i < ack_count; i++) { msgsystem->getU32Fast(_PREHASH_Packets, _PREHASH_ID, packet_id, i); -// LL_DEBUGS("Messaging") << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << llendl; +// LL_DEBUGS("Messaging") << "ack recvd' from " << host << " for packet " << (TPACKETID)packet_id << LL_ENDL; cdp->ackReliablePacket(packet_id); } if (!cdp->getUnackedPacketCount()) @@ -2274,12 +2271,12 @@ void process_log_messages(LLMessageSystem* msg, void**) if (log_message) { - LL_INFOS("Messaging") << "Starting logging via message" << llendl; + LL_INFOS("Messaging") << "Starting logging via message" << LL_ENDL; msg->startLogging(); } else { - LL_INFOS("Messaging") << "Stopping logging via message" << llendl; + LL_INFOS("Messaging") << "Stopping logging via message" << LL_ENDL; msg->stopLogging(); } }*/ @@ -2299,7 +2296,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) if (!cdp) { LL_WARNS("Messaging") << "Attempt to create trusted circuit without circuit data: " - << msg->getSender() << llendl; + << msg->getSender() << LL_ENDL; return; } @@ -2318,13 +2315,13 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) if( msg->getBlockUntrustedInterface() ) { LL_WARNS("Messaging") << "Ignoring CreateTrustedCircuit on public interface from host: " - << msg->getSender() << llendl; + << msg->getSender() << LL_ENDL; return; } else { LL_WARNS("Messaging") << "Processing CreateTrustedCircuit on public interface from host: " - << msg->getSender() << llendl; + << msg->getSender() << LL_ENDL; } } @@ -2340,7 +2337,7 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) if(msg->isMatchingDigestForWindowAndUUIDs(their_digest, TRUST_TIME_WINDOW, local_id, remote_id)) { cdp->setTrusted(TRUE); - LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << llendl; + LL_INFOS("Messaging") << "Trusted digest from " << msg->getSender() << LL_ENDL; return; } else if (cdp->getTrusted()) @@ -2350,13 +2347,13 @@ void process_create_trusted_circuit(LLMessageSystem *msg, void **) // the message system is being slow. Don't bother sending the deny, as it may continually // ping-pong back and forth on a very hosed circuit. LL_WARNS("Messaging") << "Ignoring bad digest from known trusted circuit: " << their_digest - << " host: " << msg->getSender() << llendl; + << " host: " << msg->getSender() << LL_ENDL; return; } else { LL_WARNS("Messaging") << "Bad digest from known circuit: " << their_digest - << " host: " << msg->getSender() << llendl; + << " host: " << msg->getSender() << LL_ENDL; msg->sendDenyTrustedCircuit(msg->getSender()); return; } @@ -2392,13 +2389,13 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **) if( msg->getBlockUntrustedInterface() ) { LL_WARNS("Messaging") << "Ignoring DenyTrustedCircuit on public interface from host: " - << msg->getSender() << llendl; + << msg->getSender() << LL_ENDL; return; } else { LL_WARNS("Messaging") << "Processing DenyTrustedCircuit on public interface from host: " - << msg->getSender() << llendl; + << msg->getSender() << LL_ENDL; } } @@ -2411,7 +2408,7 @@ void process_deny_trusted_circuit(LLMessageSystem *msg, void **) // *TODO: probably should keep a count of number of resends // per circuit, and stop resending after a while. LL_INFOS("Messaging") << "Got DenyTrustedCircuit. Sending CreateTrustedCircuit to " - << msg->getSender() << llendl; + << msg->getSender() << LL_ENDL; msg->sendCreateTrustedCircuit(msg->getSender(), local_id, remote_id); } @@ -2527,11 +2524,11 @@ bool start_messaging_system( if (gMessageSystem->mMessageFileVersionNumber != gPrehashVersionNumber) { LL_INFOS("AppInit") << "Message template version does not match prehash version number" << LL_ENDL; - LL_INFOS("AppInit") << "Run simulator with -prehash command line option to rebuild prehash data" << llendl; + LL_INFOS("AppInit") << "Run simulator with -prehash command line option to rebuild prehash data" << LL_ENDL; } else { - LL_DEBUGS("AppInit") << "Message template version matches prehash version number" << llendl; + LL_DEBUGS("AppInit") << "Message template version matches prehash version number" << LL_ENDL; } } @@ -2577,7 +2574,7 @@ void LLMessageSystem::startLogging() str << "\t<-\tincoming message" <<std::endl; str << "\t->\toutgoing message" << std::endl; str << " <> host size zero id name"; - LL_INFOS("Messaging") << str.str() << llendl; + LL_INFOS("Messaging") << str.str() << LL_ENDL; } void LLMessageSystem::stopLogging() @@ -2585,7 +2582,7 @@ void LLMessageSystem::stopLogging() if(mVerboseLog) { mVerboseLog = FALSE; - LL_INFOS("Messaging") << "END MESSAGE LOG" << llendl; + LL_INFOS("Messaging") << "END MESSAGE LOG" << LL_ENDL; } } @@ -2693,7 +2690,7 @@ void end_messaging_system(bool print_summary) { std::ostringstream str; gMessageSystem->summarizeLogs(str); - LL_INFOS("Messaging") << str.str().c_str() << llendl; + LL_INFOS("Messaging") << str.str().c_str() << LL_ENDL; } delete gMessageSystem; @@ -2746,7 +2743,7 @@ void LLMessageSystem::dumpReceiveCounts() if(mNumMessageCounts > 0) { - LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << llendl; + LL_DEBUGS("Messaging") << "Dump: " << mNumMessageCounts << " messages processed in " << mReceiveTime << " seconds" << LL_ENDL; for (message_template_name_map_t::const_iterator iter = mMessageTemplates.begin(), end = mMessageTemplates.end(); iter != end; iter++) @@ -2755,7 +2752,7 @@ void LLMessageSystem::dumpReceiveCounts() if (mt->mReceiveCount > 0) { LL_INFOS("Messaging") << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes - << " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << llendl; + << " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime.value()) << "%" << LL_ENDL; } } } @@ -2872,7 +2869,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size) if ((*data_size ) < LL_MINIMUM_VALID_PACKET_SIZE) { LL_WARNS("Messaging") << "zeroCodeExpand() called with data_size of " << *data_size - << llendl; + << LL_ENDL; } mTotalBytesIn += *data_size; @@ -2911,7 +2908,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size) { if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-1])) { - LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 1" << llendl; + LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 1" << LL_ENDL; callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE); outptr = mEncodedRecvBuffer; break; @@ -2923,7 +2920,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size) *outptr++ = *inptr++; if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-256])) { - LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 2" << llendl; + LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 2" << LL_ENDL; callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE); outptr = mEncodedRecvBuffer; count = -1; @@ -2942,7 +2939,7 @@ S32 LLMessageSystem::zeroCodeExpand(U8** data, S32* data_size) { if (outptr > (&mEncodedRecvBuffer[MAX_BUFFER_SIZE-(*inptr)])) { - LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 3" << llendl; + LL_WARNS("Messaging") << "attempt to write past reasonable encoded buffer size 3" << LL_ENDL; callExceptionFunc(MX_WROTE_PAST_BUFFER_SIZE); outptr = mEncodedRecvBuffer; } @@ -2966,7 +2963,7 @@ void LLMessageSystem::addTemplate(LLMessageTemplate *templatep) if (mMessageTemplates.count(templatep->mName) > 0) { LL_ERRS("Messaging") << templatep->mName << " already used as a template name!" - << llendl; + << LL_ENDL; } mMessageTemplates[templatep->mName] = templatep; mMessageNumbers[templatep->mMessageNumber] = templatep; @@ -2982,7 +2979,7 @@ void LLMessageSystem::setHandlerFuncFast(const char *name, void (*handler_func)( } else { - LL_ERRS("Messaging") << name << " is not a known message name!" << llendl; + LL_ERRS("Messaging") << name << " is not a known message name!" << LL_ENDL; } } @@ -2995,7 +2992,7 @@ bool LLMessageSystem::callHandler(const char *name, if(iter == mMessageTemplates.end()) { LL_WARNS("Messaging") << "LLMessageSystem::callHandler: unknown message " - << name << llendl; + << name << LL_ENDL; return false; } @@ -3006,7 +3003,7 @@ bool LLMessageSystem::callHandler(const char *name, << name << " from " << (trustedSource ? "trusted " : "untrusted ") - << "source" << llendl; + << "source" << LL_ENDL; return false; } @@ -3042,7 +3039,7 @@ BOOL LLMessageSystem::callExceptionFunc(EMessageException exception) if (!ex_cb) { - LL_WARNS("Messaging") << "LLMessageSystem::callExceptionFunc: bad message exception callback." << llendl; + LL_WARNS("Messaging") << "LLMessageSystem::callExceptionFunc: bad message exception callback." << LL_ENDL; return FALSE; } @@ -3153,7 +3150,7 @@ bool LLMessageSystem::generateDigestForWindowAndUUIDs(char* digest, const S32 wi std::string shared_secret = get_shared_secret(); if(shared_secret.empty()) { - LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << llendl; + LL_ERRS("Messaging") << "Trying to generate complex digest on a machine without a shared secret!" << LL_ENDL; } U32 now = (U32)time(NULL); @@ -3172,7 +3169,7 @@ bool LLMessageSystem::isMatchingDigestForWindowAndUUIDs(const char* digest, cons std::string shared_secret = get_shared_secret(); if(shared_secret.empty()) { - LL_ERRS("Messaging") << "Trying to compare complex digests on a machine without a shared secret!" << llendl; + LL_ERRS("Messaging") << "Trying to compare complex digests on a machine without a shared secret!" << LL_ENDL; } char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ @@ -3219,7 +3216,7 @@ bool LLMessageSystem::generateDigestForWindow(char* digest, const S32 window) co std::string shared_secret = get_shared_secret(); if(shared_secret.empty()) { - LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << llendl; + LL_ERRS("Messaging") << "Trying to generate simple digest on a machine without a shared secret!" << LL_ENDL; } U32 now = (U32)time(NULL); @@ -3238,7 +3235,7 @@ bool LLMessageSystem::isMatchingDigestForWindow(const char* digest, S32 const wi std::string shared_secret = get_shared_secret(); if(shared_secret.empty()) { - LL_ERRS("Messaging") << "Trying to compare simple digests on a machine without a shared secret!" << llendl; + LL_ERRS("Messaging") << "Trying to compare simple digests on a machine without a shared secret!" << LL_ENDL; } char our_digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ @@ -3272,12 +3269,12 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID char digest[MD5HEX_STR_SIZE]; /* Flawfinder: ignore */ if (id1.isNull()) { - LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << llendl; + LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the local end point ID" << LL_ENDL; return; } if (id2.isNull()) { - LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << llendl; + LL_WARNS("Messaging") << "Can't send CreateTrustedCircuit to " << host << " because we don't have the remote end point ID" << LL_ENDL; return; } generateDigestForWindowAndUUIDs(digest, TRUST_TIME_WINDOW, id1, id2); @@ -3285,7 +3282,7 @@ void LLMessageSystem::sendCreateTrustedCircuit(const LLHost &host, const LLUUID nextBlockFast(_PREHASH_DataBlock); addUUIDFast(_PREHASH_EndPointID, id1); addBinaryDataFast(_PREHASH_Digest, digest, MD5HEX_STR_BYTES); - LL_INFOS("Messaging") << "xmitting digest: " << digest << " Host: " << host << llendl; + LL_INFOS("Messaging") << "xmitting digest: " << digest << " Host: " << host << LL_ENDL; sendMessage(host); } @@ -3299,10 +3296,10 @@ void LLMessageSystem::reallySendDenyTrustedCircuit(const LLHost &host) LLCircuitData *cdp = mCircuitInfo.findCircuit(host); if (!cdp) { - LL_WARNS("Messaging") << "Not sending DenyTrustedCircuit to host without a circuit." << llendl; + LL_WARNS("Messaging") << "Not sending DenyTrustedCircuit to host without a circuit." << LL_ENDL; return; } - LL_INFOS("Messaging") << "Sending DenyTrustedCircuit to " << host << llendl; + LL_INFOS("Messaging") << "Sending DenyTrustedCircuit to " << host << LL_ENDL; newMessageFast(_PREHASH_DenyTrustedCircuit); nextBlockFast(_PREHASH_DataBlock); addUUIDFast(_PREHASH_EndPointID, cdp->getLocalEndPointID()); @@ -3323,7 +3320,7 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_ std::string shared_secret = get_shared_secret(); if(shared_secret.empty()) { - LL_ERRS("Messaging") << "Trying to establish bidirectional trust on a machine without a shared secret!" << llendl; + LL_ERRS("Messaging") << "Trying to establish bidirectional trust on a machine without a shared secret!" << LL_ENDL; } LLTimer timeout; @@ -3375,8 +3372,8 @@ void LLMessageSystem::establishBidirectionalTrust(const LLHost &host, S64 frame_ void LLMessageSystem::dumpPacketToLog() { - LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << llendl; - LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << llendl; + LL_WARNS("Messaging") << "Packet Dump from:" << mPacketRing.getLastSender() << LL_ENDL; + LL_WARNS("Messaging") << "Packet Size:" << mTrueReceiveSize << LL_ENDL; char line_buffer[256]; /* Flawfinder: ignore */ S32 i; S32 cur_line_pos = 0; @@ -3391,27 +3388,27 @@ void LLMessageSystem::dumpPacketToLog() if (cur_line_pos >= 16) { cur_line_pos = 0; - LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl; + LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << LL_ENDL; cur_line++; } } if (cur_line_pos) { - LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << llendl; + LL_WARNS("Messaging") << "PD:" << cur_line << "PD:" << line_buffer << LL_ENDL; } } //static -U64 LLMessageSystem::getMessageTimeUsecs(const BOOL update) +U64Microseconds LLMessageSystem::getMessageTimeUsecs(const BOOL update) { if (gMessageSystem) { if (update) { - gMessageSystem->mCurrentMessageTimeSeconds = totalTime()*SEC_PER_USEC; + gMessageSystem->mCurrentMessageTime = totalTime(); } - return (U64)(gMessageSystem->mCurrentMessageTimeSeconds * USEC_PER_SEC); + return gMessageSystem->mCurrentMessageTime; } else { @@ -3420,19 +3417,19 @@ U64 LLMessageSystem::getMessageTimeUsecs(const BOOL update) } //static -F64 LLMessageSystem::getMessageTimeSeconds(const BOOL update) +F64Seconds LLMessageSystem::getMessageTimeSeconds(const BOOL update) { if (gMessageSystem) { if (update) { - gMessageSystem->mCurrentMessageTimeSeconds = totalTime()*SEC_PER_USEC; + gMessageSystem->mCurrentMessageTime = totalTime(); } - return gMessageSystem->mCurrentMessageTimeSeconds; + return gMessageSystem->mCurrentMessageTime; } else { - return totalTime()*SEC_PER_USEC; + return F64Seconds(totalTime()); } } @@ -3941,7 +3938,7 @@ void LLMessageSystem::getStringFast(const char *block, const char *var, { if(buffer_size <= 0) { - LL_WARNS("Messaging") << "buffer_size <= 0" << llendl; + LL_WARNS("Messaging") << "buffer_size <= 0" << LL_ENDL; } mMessageReader->getString(block, var, buffer_size, s, blocknum); } @@ -4050,7 +4047,7 @@ void LLMessageSystem::banUdpMessage(const std::string& name) } else { - llwarns << "Attempted to ban an unknown message: " << name << "." << llendl; + LL_WARNS() << "Attempted to ban an unknown message: " << name << "." << LL_ENDL; } } const LLHost& LLMessageSystem::getSender() const diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 1589ea29c178c494e716604d18bb5d282d3d5add..da06b64506ff1cdddf02d1848a072dadbe9102e2 100755 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -45,14 +45,14 @@ #include "llerror.h" #include "net.h" -#include "string_table.h" +#include "llstringtable.h" #include "llcircuit.h" #include "lltimer.h" #include "llpacketring.h" #include "llhost.h" -#include "llhttpclient.h" +#include "llcurl.h" #include "llhttpnode.h" -#include "llpacketack.h" +//#include "llpacketack.h" #include "llsingleton.h" #include "message_prehash.h" #include "llstl.h" @@ -142,23 +142,18 @@ enum EPacketHeaderLayout const S32 LL_DEFAULT_RELIABLE_RETRIES = 3; -const F32 LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS = 1.f; -const F32 LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS = 1.f; -const F32 LL_PING_BASED_TIMEOUT_DUMMY = 0.0f; - -// *NOTE: Maybe these factors shouldn't include the msec to sec conversion -// implicitly. -// However, all units should be MKS. -const F32 LL_SEMIRELIABLE_TIMEOUT_FACTOR = 5.f / 1000.f; // factor * averaged ping -const F32 LL_RELIABLE_TIMEOUT_FACTOR = 5.f / 1000.f; // factor * averaged ping -const F32 LL_FILE_XFER_TIMEOUT_FACTOR = 5.f / 1000.f; // factor * averaged ping -const F32 LL_LOST_TIMEOUT_FACTOR = 16.f / 1000.f; // factor * averaged ping for marking packets "Lost" -const F32 LL_MAX_LOST_TIMEOUT = 5.f; // Maximum amount of time before considering something "lost" +const F32Seconds LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS(1.f); +const F32Seconds LL_MINIMUM_SEMIRELIABLE_TIMEOUT_SECONDS(1.f); +const F32Seconds LL_PING_BASED_TIMEOUT_DUMMY(0.0f); + +const F32 LL_SEMIRELIABLE_TIMEOUT_FACTOR = 5.f; // averaged ping +const F32 LL_RELIABLE_TIMEOUT_FACTOR = 5.f; // averaged ping +const F32 LL_LOST_TIMEOUT_FACTOR = 16.f; // averaged ping for marking packets "Lost" +const F32Seconds LL_MAX_LOST_TIMEOUT(5.f); // Maximum amount of time before considering something "lost" const S32 MAX_MESSAGE_COUNT_NUM = 1024; // Forward declarations -class LLCircuit; class LLVector3; class LLVector4; class LLVector3d; @@ -214,19 +209,19 @@ class LLMessageSystem : public LLMessageSenderInterface public: LLPacketRing mPacketRing; - LLReliablePacketParams mReliablePacketParams; + LLReliablePacketParams mReliablePacketParams; // Set this flag to TRUE when you want *very* verbose logs. - BOOL mVerboseLog; + BOOL mVerboseLog; - F32 mMessageFileVersionNumber; + F32 mMessageFileVersionNumber; typedef std::map<const char *, LLMessageTemplate*> message_template_name_map_t; typedef std::map<U32, LLMessageTemplate*> message_template_number_map_t; private: message_template_name_map_t mMessageTemplates; - message_template_number_map_t mMessageNumbers; + message_template_number_map_t mMessageNumbers; public: S32 mSystemVersionMajor; @@ -235,7 +230,7 @@ class LLMessageSystem : public LLMessageSenderInterface S32 mSystemVersionServer; U32 mVersionFlags; - BOOL mbProtected; + BOOL mbProtected; U32 mNumberHighFreqMessages; U32 mNumberMediumFreqMessages; @@ -255,11 +250,11 @@ class LLMessageSystem : public LLMessageSenderInterface U32 mReliablePacketsIn; // total reliable packets in U32 mReliablePacketsOut; // total reliable packets out - U32 mDroppedPackets; // total dropped packets in - U32 mResentPackets; // total resent packets out - U32 mFailedResendPackets; // total resend failure packets out - U32 mOffCircuitPackets; // total # of off-circuit packets rejected - U32 mInvalidOnCircuitPackets; // total # of on-circuit but invalid packets rejected + U32 mDroppedPackets; // total dropped packets in + U32 mResentPackets; // total resent packets out + U32 mFailedResendPackets; // total resend failure packets out + U32 mOffCircuitPackets; // total # of off-circuit packets rejected + U32 mInvalidOnCircuitPackets; // total # of on-circuit but invalid packets rejected S64 mUncompressedBytesIn; // total uncompressed size of compressed packets in S64 mUncompressedBytesOut; // total uncompressed size of compressed packets out @@ -268,14 +263,14 @@ class LLMessageSystem : public LLMessageSenderInterface S64 mTotalBytesIn; // total size of all uncompressed packets in S64 mTotalBytesOut; // total size of all uncompressed packets out - BOOL mSendReliable; // does the outgoing message require a pos ack? + BOOL mSendReliable; // does the outgoing message require a pos ack? - LLCircuit mCircuitInfo; - F64 mCircuitPrintTime; // used to print circuit debug info every couple minutes - F32 mCircuitPrintFreq; // seconds + LLCircuit mCircuitInfo; + F64Seconds mCircuitPrintTime; // used to print circuit debug info every couple minutes + F32Seconds mCircuitPrintFreq; - std::map<U64, U32> mIPPortToCircuitCode; - std::map<U32, U64> mCircuitCodeToIPPort; + std::map<U64, U32> mIPPortToCircuitCode; + std::map<U32, U64> mCircuitCodeToIPPort; U32 mOurCircuitCode; S32 mSendPacketFailureCount; S32 mUnackedListDepth; @@ -470,7 +465,7 @@ class LLMessageSystem : public LLMessageSenderInterface S32 sendReliable( const LLHost &host, S32 retries, BOOL ping_based_retries, - F32 timeout, + F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data); @@ -490,11 +485,11 @@ class LLMessageSystem : public LLMessageSenderInterface const LLHost &host, S32 retries, BOOL ping_based_timeout, - F32 timeout, + F32Seconds timeout, void (*callback)(void **,S32), void ** callback_data); - LLHTTPClient::ResponderPtr createResponder(const std::string& name); + LLCurl::ResponderPtr createResponder(const std::string& name); S32 sendMessage(const LLHost &host); S32 sendMessage(const U32 circuit); private: @@ -657,8 +652,8 @@ class LLMessageSystem : public LLMessageSenderInterface S32 getSize(const char *blockname, S32 blocknum, const char *varname) const; void resetReceiveCounts(); // resets receive counts for all message types to 0 - void dumpReceiveCounts(); // dumps receive count for each message type to llinfos - void dumpCircuitInfo(); // Circuit information to llinfos + void dumpReceiveCounts(); // dumps receive count for each message type to LL_INFOS() + void dumpCircuitInfo(); // Circuit information to LL_INFOS() BOOL isClear() const; // returns mbSClear; S32 flush(const LLHost &host); @@ -684,8 +679,8 @@ class LLMessageSystem : public LLMessageSenderInterface void setMaxMessageTime(const F32 seconds); // Max time to process messages before warning and dumping (neg to disable) void setMaxMessageCounts(const S32 num); // Max number of messages before dumping (neg to disable) - static U64 getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds - static F64 getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds + static U64Microseconds getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds + static F64Seconds getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds static void setTimeDecodes(BOOL b); static void setTimeDecodesSpamThreshold(F32 seconds); @@ -784,16 +779,16 @@ class LLMessageSystem : public LLMessageSenderInterface BOOL mbError; S32 mErrorCode; - F64 mResendDumpTime; // The last time we dumped resends + F64Seconds mResendDumpTime; // The last time we dumped resends LLMessageCountInfo mMessageCountList[MAX_MESSAGE_COUNT_NUM]; S32 mNumMessageCounts; - F32 mReceiveTime; - F32 mMaxMessageTime; // Max number of seconds for processing messages + F32Seconds mReceiveTime; + F32Seconds mMaxMessageTime; // Max number of seconds for processing messages S32 mMaxMessageCounts; // Max number of messages to process before dumping. - F64 mMessageCountTime; + F64Seconds mMessageCountTime; - F64 mCurrentMessageTimeSeconds; // The current "message system time" (updated the first call to checkMessages after a resetReceiveCount + F64Seconds mCurrentMessageTime; // The current "message system time" (updated the first call to checkMessages after a resetReceiveCount // message system exceptions typedef std::pair<msg_exception_callback, void*> exception_t; @@ -888,7 +883,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, case MVT_S16: if (n != 2) { - llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl; + LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL; } #ifdef LL_BIG_ENDIAN *(s + 1) = *(ct); @@ -903,7 +898,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, case MVT_F32: if (n != 4) { - llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl; + LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL; } #ifdef LL_BIG_ENDIAN *(s + 3) = *(ct); @@ -920,7 +915,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, case MVT_F64: if (n != 8) { - llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl; + LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL; } #ifdef LL_BIG_ENDIAN *(s + 7) = *(ct); @@ -940,7 +935,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, case MVT_LLQuaternion: // We only send x, y, z and infer w (we set x, y, z to ensure that w >= 0) if (n != 12) { - llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl; + LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL; } #ifdef LL_BIG_ENDIAN htonmemcpy(s + 8, ct + 8, MVT_F32, 4); @@ -953,7 +948,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, case MVT_LLVector3d: if (n != 24) { - llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl; + LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL; } #ifdef LL_BIG_ENDIAN htonmemcpy(s + 16, ct + 16, MVT_F64, 8); @@ -966,7 +961,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, case MVT_LLVector4: if (n != 16) { - llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl; + LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL; } #ifdef LL_BIG_ENDIAN htonmemcpy(s + 12, ct + 12, MVT_F32, 4); @@ -980,7 +975,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, case MVT_U16Vec3: if (n != 6) { - llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl; + LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL; } #ifdef LL_BIG_ENDIAN htonmemcpy(s + 4, ct + 4, MVT_U16, 2); @@ -993,7 +988,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, case MVT_U16Quat: if (n != 8) { - llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl; + LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL; } #ifdef LL_BIG_ENDIAN htonmemcpy(s + 6, ct + 6, MVT_U16, 2); @@ -1007,7 +1002,7 @@ static inline void *htonmemcpy(void *vs, const void *vct, EMsgVariableType type, case MVT_S16Array: if (n % 2) { - llerrs << "Size argument passed to htonmemcpy doesn't match swizzle type size" << llendl; + LL_ERRS() << "Size argument passed to htonmemcpy doesn't match swizzle type size" << LL_ENDL; } #ifdef LL_BIG_ENDIAN length = n % 2; diff --git a/indra/llmessage/message_string_table.cpp b/indra/llmessage/message_string_table.cpp index dd063fcb832b4b78a49cb6752c605e0e17455b6b..e4f5fb3a38d68dfc7067a2e93691a616c642cd55 100755 --- a/indra/llmessage/message_string_table.cpp +++ b/indra/llmessage/message_string_table.cpp @@ -80,10 +80,10 @@ char* LLMessageStringTable::getString(const char *str) if (mUsed >= MESSAGE_NUMBER_OF_HASH_BUCKETS - 1) { U32 i; - llinfos << "Dumping string table before crashing on HashTable full!" << llendl; + LL_INFOS() << "Dumping string table before crashing on HashTable full!" << LL_ENDL; for (i = 0; i < MESSAGE_NUMBER_OF_HASH_BUCKETS; i++) { - llinfos << "Entry #" << i << ": " << mString[i] << llendl; + LL_INFOS() << "Entry #" << i << ": " << mString[i] << LL_ENDL; } } return mString[hash_value]; diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp index 85aef5da003c2bfb3e40c4f567b73a3c2665fbf7..523bcbb60d156736296f323428a1b7a240b8437e 100755 --- a/indra/llmessage/net.cpp +++ b/indra/llmessage/net.cpp @@ -26,15 +26,13 @@ #include "linden_common.h" -#include "net.h" +//#include "net.h" // system library includes #include <stdexcept> #if LL_WINDOWS - #define WIN32_LEAN_AND_MEAN - #include <winsock2.h> - #include <windows.h> +#include "llwin32headerslean.h" #else #include <sys/types.h> #include <sys/socket.h> @@ -175,7 +173,7 @@ U32 ip_string_to_u32(const char* ip_string) if (ip == INADDR_NONE && strncmp(ip_string, BROADCAST_ADDRESS_STRING, MAXADDRSTR) != 0) { - llwarns << "ip_string_to_u32() failed, Error: Invalid IP string '" << ip_string << "'" << llendl; + LL_WARNS() << "ip_string_to_u32() failed, Error: Invalid IP string '" << ip_string << "'" << LL_ENDL; return INVALID_HOST_IP_ADDRESS; } return ip; @@ -334,7 +332,7 @@ S32 receive_packet(int hSocket, char * receiveBuffer) return 0; if (WSAECONNRESET == WSAGetLastError()) return 0; - llinfos << "receivePacket() failed, Error: " << WSAGetLastError() << llendl; + LL_INFOS() << "receivePacket() failed, Error: " << WSAGetLastError() << LL_ENDL; } return nRet; @@ -368,8 +366,8 @@ BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, i { return TRUE; } - llinfos << "sendto() failed to " << u32_to_ip_string(recipient) << ":" << nPort - << ", Error " << last_error << llendl; + LL_INFOS() << "sendto() failed to " << u32_to_ip_string(recipient) << ":" << nPort + << ", Error " << last_error << LL_ENDL; } } } while ( (nRet == SOCKET_ERROR) @@ -397,7 +395,7 @@ S32 start_net(S32& socket_out, int& nPort) hSocket = socket(AF_INET, SOCK_DGRAM, 0); if (hSocket < 0) { - llwarns << "socket() failed" << llendl; + LL_WARNS() << "socket() failed" << LL_ENDL; return 1; } @@ -408,21 +406,21 @@ S32 start_net(S32& socket_out, int& nPort) stLclAddr.sin_family = AF_INET; stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); stLclAddr.sin_port = htons(0); - llinfos << "attempting to connect on OS assigned port" << llendl; + LL_INFOS() << "attempting to connect on OS assigned port" << LL_ENDL; nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr)); if (nRet < 0) { - llwarns << "Failed to bind on an OS assigned port error: " - << nRet << llendl; + LL_WARNS() << "Failed to bind on an OS assigned port error: " + << nRet << LL_ENDL; } else { sockaddr_in socket_info; socklen_t len = sizeof(sockaddr_in); int err = getsockname(hSocket, (sockaddr*)&socket_info, &len); - llinfos << "Get socket returned: " << err << " length " << len << llendl; + LL_INFOS() << "Get socket returned: " << err << " length " << len << LL_ENDL; nPort = ntohs(socket_info.sin_port); - llinfos << "Assigned port: " << nPort << llendl; + LL_INFOS() << "Assigned port: " << nPort << LL_ENDL; } } @@ -433,7 +431,7 @@ S32 start_net(S32& socket_out, int& nPort) stLclAddr.sin_addr.s_addr = htonl(INADDR_ANY); stLclAddr.sin_port = htons(nPort); U32 attempt_port = nPort; - llinfos << "attempting to connect on port " << attempt_port << llendl; + LL_INFOS() << "attempting to connect on port " << attempt_port << LL_ENDL; nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr)); if (nRet < 0) @@ -447,7 +445,7 @@ S32 start_net(S32& socket_out, int& nPort) attempt_port++) { stLclAddr.sin_port = htons(attempt_port); - llinfos << "trying port " << attempt_port << llendl; + LL_INFOS() << "trying port " << attempt_port << LL_ENDL; nRet = bind(hSocket, (struct sockaddr*) &stLclAddr, sizeof(stLclAddr)); if (!((nRet < 0) && (errno == EADDRINUSE))) { @@ -456,7 +454,7 @@ S32 start_net(S32& socket_out, int& nPort) } if (nRet < 0) { - llwarns << "startNet() : Couldn't find available network port." << llendl; + LL_WARNS() << "startNet() : Couldn't find available network port." << LL_ENDL; // Fail gracefully in release. return 3; } @@ -464,12 +462,12 @@ S32 start_net(S32& socket_out, int& nPort) // Some other socket error else { - llwarns << llformat ("bind() port: %d failed, Err: %s\n", nPort, strerror(errno)) << llendl; + LL_WARNS() << llformat ("bind() port: %d failed, Err: %s\n", nPort, strerror(errno)) << LL_ENDL; // Fail gracefully in release. return 4; } } - llinfos << "connected on port " << attempt_port << llendl; + LL_INFOS() << "connected on port " << attempt_port << LL_ENDL; nPort = attempt_port; } // Set socket to be non-blocking @@ -478,18 +476,18 @@ S32 start_net(S32& socket_out, int& nPort) nRet = setsockopt(hSocket, SOL_SOCKET, SO_RCVBUF, (char *)&rec_size, buff_size); if (nRet) { - llinfos << "Can't set receive size!" << llendl; + LL_INFOS() << "Can't set receive size!" << LL_ENDL; } nRet = setsockopt(hSocket, SOL_SOCKET, SO_SNDBUF, (char *)&snd_size, buff_size); if (nRet) { - llinfos << "Can't set send size!" << llendl; + LL_INFOS() << "Can't set send size!" << LL_ENDL; } getsockopt(hSocket, SOL_SOCKET, SO_RCVBUF, (char *)&rec_size, &buff_size); getsockopt(hSocket, SOL_SOCKET, SO_SNDBUF, (char *)&snd_size, &buff_size); - llinfos << "startNet - receive buffer size : " << rec_size << llendl; - llinfos << "startNet - send buffer size : " << snd_size << llendl; + LL_INFOS() << "startNet - receive buffer size : " << rec_size << LL_ENDL; + LL_INFOS() << "startNet - send buffer size : " << snd_size << LL_ENDL; #if LL_LINUX // Turn on recipient address tracking @@ -497,11 +495,11 @@ S32 start_net(S32& socket_out, int& nPort) int use_pktinfo = 1; if( setsockopt( hSocket, SOL_IP, IP_PKTINFO, &use_pktinfo, sizeof(use_pktinfo) ) == -1 ) { - llwarns << "No IP_PKTINFO available" << llendl; + LL_WARNS() << "No IP_PKTINFO available" << LL_ENDL; } else { - llinfos << "IP_PKKTINFO enabled" << llendl; + LL_INFOS() << "IP_PKKTINFO enabled" << LL_ENDL; } } #endif @@ -595,7 +593,7 @@ int receive_packet(int hSocket, char * receiveBuffer) } // Uncomment for testing if/when implementing for Mac or Windows: - // llinfos << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << llendl; + // LL_INFOS() << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << LL_ENDL; return nRet; } @@ -629,22 +627,22 @@ BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, if (errno == EAGAIN) { // say nothing, just repeat send - llinfos << "sendto() reported buffer full, resending (attempt " << send_attempts << ")" << llendl; - llinfos << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << llendl; + LL_INFOS() << "sendto() reported buffer full, resending (attempt " << send_attempts << ")" << LL_ENDL; + LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; resend = TRUE; } else if (errno == ECONNREFUSED) { // response to ICMP connection refused message on earlier send - llinfos << "sendto() reported connection refused, resending (attempt " << send_attempts << ")" << llendl; - llinfos << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << llendl; + LL_INFOS() << "sendto() reported connection refused, resending (attempt " << send_attempts << ")" << LL_ENDL; + LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; resend = TRUE; } else { // some other error - llinfos << "sendto() failed: " << errno << ", " << strerror(errno) << llendl; - llinfos << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << llendl; + LL_INFOS() << "sendto() failed: " << errno << ", " << strerror(errno) << LL_ENDL; + LL_INFOS() << inet_ntoa(stDstAddr.sin_addr) << ":" << nPort << LL_ENDL; resend = FALSE; } } @@ -653,7 +651,7 @@ BOOL send_packet(int hSocket, const char * sendBuffer, int size, U32 recipient, if (send_attempts >= 3) { - llinfos << "sendPacket() bailed out of send!" << llendl; + LL_INFOS() << "sendPacket() bailed out of send!" << LL_ENDL; return FALSE; } diff --git a/indra/llmessage/net.h b/indra/llmessage/net.h index 0f2437479df8bdd861091fd913a49705de931eef..beb67bae4ea0d6af8020d7dfc4048990e38b631b 100755 --- a/indra/llmessage/net.h +++ b/indra/llmessage/net.h @@ -67,5 +67,8 @@ const S32 ETHERNET_MTU_BYTES = 1500; const S32 MTUBITS = MTUBYTES*8; const S32 MTUU32S = MTUBITS/32; +// For automatic port discovery when running multiple viewers on one host +const U32 PORT_DISCOVERY_RANGE_MIN = 13000; +const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50; #endif diff --git a/indra/llmessage/partsyspacket.cpp b/indra/llmessage/partsyspacket.cpp index ad2161425854f12c2b0d4d953855c32b60796108..d87de38aa52672d019c381a1fe77f9778f83f129 100755 --- a/indra/llmessage/partsyspacket.cpp +++ b/indra/llmessage/partsyspacket.cpp @@ -28,7 +28,7 @@ #include "linden_common.h" #include "partsyspacket.h" -#include "imageids.h" +#include "indra_constants.h" // this function is global void gSetInitDataDefaults(LLPartInitData *setMe) @@ -1272,7 +1272,7 @@ BOOL LLPartSysCompressedPacket::fromUnsignedBytes(U8 *in, U32 bytesUsed) } else { - llerrs << "NULL input data or number of bytes exceed mData size" << llendl; + LL_ERRS() << "NULL input data or number of bytes exceed mData size" << LL_ENDL; return FALSE; } } diff --git a/indra/llmessage/patch_code.cpp b/indra/llmessage/patch_code.cpp index e5d7f1944837e1e214c30135677d805401cd00e3..32f8d80782bc68c78ca81079d852df389551daf6 100755 --- a/indra/llmessage/patch_code.cpp +++ b/indra/llmessage/patch_code.cpp @@ -31,7 +31,7 @@ #include "v3math.h" #include "patch_dct.h" #include "patch_code.h" -#include "bitpack.h" +#include "llbitpack.h" U32 gPatchSize, gWordBits; @@ -88,7 +88,7 @@ void code_patch_header(LLBitPack &bitpack, LLPatchHeader *ph, S32 *patch) if ( (wbits > 17) ||(wbits < 2)) { - llerrs << "Bits needed per word in code_patch_header out of legal range. Adjust compression quatization." << llendl; + LL_ERRS() << "Bits needed per word in code_patch_header out of legal range. Adjust compression quatization." << LL_ENDL; } ph->quant_wbits |= (wbits - 2); @@ -135,7 +135,7 @@ void code_patch(LLBitPack &bitpack, S32 *patch, S32 postquant) if ( (postquant > patch_size*patch_size) ||(postquant < 0)) { - llerrs << "Bad postquant in code_patch!" << llendl; + LL_ERRS() << "Bad postquant in code_patch!" << LL_ENDL; } if (postquant) diff --git a/indra/llmessage/tests/llareslistener_test.cpp b/indra/llmessage/tests/llareslistener_test.cpp index 60c91e12cfc931e7ac609ede0f5891203b9fc9f7..c04696c86b721f5734214fc9ad369c3a9b44847c 100755 --- a/indra/llmessage/tests/llareslistener_test.cpp +++ b/indra/llmessage/tests/llareslistener_test.cpp @@ -135,7 +135,7 @@ namespace tut void object::test<2>() { set_test_name("bad op"); - WrapLL_ERRS capture; + WrapLLErrs capture; LLSD request; request["op"] = "foo"; std::string threw; @@ -143,7 +143,7 @@ namespace tut { LLEventPumps::instance().obtain("LLAres").post(request); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { threw = e.what(); } @@ -154,7 +154,7 @@ namespace tut void object::test<3>() { set_test_name("bad rewriteURI request"); - WrapLL_ERRS capture; + WrapLLErrs capture; LLSD request; request["op"] = "rewriteURI"; std::string threw; @@ -162,7 +162,7 @@ namespace tut { LLEventPumps::instance().obtain("LLAres").post(request); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { threw = e.what(); } @@ -175,7 +175,7 @@ namespace tut void object::test<4>() { set_test_name("bad rewriteURI request"); - WrapLL_ERRS capture; + WrapLLErrs capture; LLSD request; request["op"] = "rewriteURI"; request["reply"] = "nonexistent"; @@ -184,7 +184,7 @@ namespace tut { LLEventPumps::instance().obtain("LLAres").post(request); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { threw = e.what(); } @@ -197,7 +197,7 @@ namespace tut void object::test<5>() { set_test_name("bad rewriteURI request"); - WrapLL_ERRS capture; + WrapLLErrs capture; LLSD request; request["op"] = "rewriteURI"; request["uri"] = "foo.bar.com"; @@ -206,7 +206,7 @@ namespace tut { LLEventPumps::instance().obtain("LLAres").post(request); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { threw = e.what(); } diff --git a/indra/llmessage/tests/llmime_test.cpp b/indra/llmessage/tests/llmime_test.cpp index aed5c4589cba1d567635351c7ed0ff77008924df..ea48561ae9c1eb754b65c325d9ed59c38a9481d8 100755 --- a/indra/llmessage/tests/llmime_test.cpp +++ b/indra/llmessage/tests/llmime_test.cpp @@ -83,8 +83,8 @@ namespace tut headers["Content-Length"] = MULTI_CONTENT_LENGTH; headers["Content-Type"] = MULTI_CONTENT_TYPE; LLMimeIndex mime(headers, MULTI_CONTENT_OFFSET); - llinfos << "headers: " << LLSDOStreamer<LLSDNotationFormatter>(headers) - << llendl; + LL_INFOS() << "headers: " << LLSDOStreamer<LLSDNotationFormatter>(headers) + << LL_ENDL; const S32 META_CONTENT_LENGTH = 700; diff --git a/indra/llplugin/llplugincookiestore.cpp b/indra/llplugin/llplugincookiestore.cpp index 9f4d65e7231a33f678dfcbfbdab86a3ce732cfbb..f64b26422201e162d0fe286e339e4d0c0377f87b 100755 --- a/indra/llplugin/llplugincookiestore.cpp +++ b/indra/llplugin/llplugincookiestore.cpp @@ -405,7 +405,7 @@ void LLPluginCookieStore::writeChangedCookies(std::ostream& s, bool clear_change { if(mHasChangedCookies) { - lldebugs << "returning changed cookies: " << llendl; + LL_DEBUGS() << "returning changed cookies: " << LL_ENDL; cookie_map_t::iterator iter; for(iter = mCookies.begin(); iter != mCookies.end(); ) { @@ -417,7 +417,7 @@ void LLPluginCookieStore::writeChangedCookies(std::ostream& s, bool clear_change { s << iter->second->getCookie() << "\n"; - lldebugs << " " << iter->second->getCookie() << llendl; + LL_DEBUGS() << " " << iter->second->getCookie() << LL_ENDL; // If requested, clear the changed mark if(clear_changed) diff --git a/indra/llplugin/llpluginmessagepipe.cpp b/indra/llplugin/llpluginmessagepipe.cpp index 091e93ea4be474abbb8e0962f41754bc7f1f94c8..7e2bf90ad15360bb3b115a7463b083275521a48e 100755 --- a/indra/llplugin/llpluginmessagepipe.cpp +++ b/indra/llplugin/llpluginmessagepipe.cpp @@ -215,7 +215,7 @@ bool LLPluginMessagePipe::pumpOutput() else if(APR_STATUS_IS_EOF(status)) { // This is what we normally expect when a plugin exits. - llinfos << "Got EOF from plugin socket. " << llendl; + LL_INFOS() << "Got EOF from plugin socket. " << LL_ENDL; if(mOwner) { diff --git a/indra/llplugin/llpluginprocesschild.h b/indra/llplugin/llpluginprocesschild.h index a9d6794e4037393701250a04cb36185d3d3ca46a..531422e792f7f840d24f718f57c5a04b08c56b01 100755 --- a/indra/llplugin/llpluginprocesschild.h +++ b/indra/llplugin/llpluginprocesschild.h @@ -29,6 +29,7 @@ #ifndef LL_LLPLUGINPROCESSCHILD_H #define LL_LLPLUGINPROCESSCHILD_H +#include <queue> #include "llpluginmessage.h" #include "llpluginmessagepipe.h" #include "llplugininstance.h" diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index a4da7674d593f2f44965b6d92798f114a6fab984..ea0d2b81f1b3de6c17e710855bb446372a7af22d 100755 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -185,7 +185,7 @@ bool LLPluginProcessParent::accept() if(status == APR_SUCCESS) { -// llinfos << "SUCCESS" << llendl; +// LL_INFOS() << "SUCCESS" << LL_ENDL; // Success. Create a message pipe on the new socket // we MUST create a new pool for the LLSocket, since it will take ownership of it and delete it in its destructor! @@ -199,14 +199,14 @@ bool LLPluginProcessParent::accept() } else if(APR_STATUS_IS_EAGAIN(status)) { -// llinfos << "EAGAIN" << llendl; +// LL_INFOS() << "EAGAIN" << LL_ENDL; // No incoming connections. This is not an error. status = APR_SUCCESS; } else { -// llinfos << "Error:" << llendl; +// LL_INFOS() << "Error:" << LL_ENDL; ll_apr_warn_status(status); // Some other error. diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index 990fc5cbae3226503ca1f9278dbc291716511315..24be7eb148d4de936030eb3e4cc5413de58d1b77 100755 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -29,6 +29,8 @@ #ifndef LL_LLPLUGINPROCESSPARENT_H #define LL_LLPLUGINPROCESSPARENT_H +#include <queue> + #include "llapr.h" #include "llprocess.h" #include "llpluginmessage.h" diff --git a/indra/llplugin/tests/llplugincookiestore_test.cpp b/indra/llplugin/tests/llplugincookiestore_test.cpp index aefa1ca1444b8b10985b17deaaa051cbf9c0d22c..c2cb236cbabebcf0845f35def9a4b5e13caa80fb 100755 --- a/indra/llplugin/tests/llplugincookiestore_test.cpp +++ b/indra/llplugin/tests/llplugincookiestore_test.cpp @@ -27,6 +27,7 @@ */ #include "linden_common.h" +#include <list> #include "../test/lltut.h" #include "../llplugincookiestore.h" diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt index 0dd13916bf5e8eb532776597a3e524b82b0e464d..d1475cf7342a2fb86751c6254c4c7952f4acad2b 100755 --- a/indra/llprimitive/CMakeLists.txt +++ b/indra/llprimitive/CMakeLists.txt @@ -35,7 +35,6 @@ set(llprimitive_SOURCE_FILES lltextureentry.cpp lltreeparams.cpp llvolumemessage.cpp - llvolumexml.cpp material_codes.cpp ) @@ -43,6 +42,7 @@ set(llprimitive_HEADER_FILES CMakeLists.txt legacy_object_types.h + lllslconstants.h llmaterial.h llmaterialid.h llmaterialtable.h @@ -55,7 +55,6 @@ set(llprimitive_HEADER_FILES lltreeparams.h lltree_common.h llvolumemessage.h - llvolumexml.h material_codes.h object_flags.h ) diff --git a/indra/llcommon/lllslconstants.h b/indra/llprimitive/lllslconstants.h old mode 100755 new mode 100644 similarity index 100% rename from indra/llcommon/lllslconstants.h rename to indra/llprimitive/lllslconstants.h diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp index cf4c645cfdf509d36951bad4a62e28dc3fd40e61..7f3c8da434c6d6570188b54c97a2081cfa4bfebe 100644 --- a/indra/llprimitive/llmaterial.cpp +++ b/indra/llprimitive/llmaterial.cpp @@ -69,7 +69,7 @@ template<typename T> T getMaterialField(const LLSD& data, const std::string& fie { return (T)data[field]; } - llerrs << "Missing or mistyped field '" << field << "' in material definition" << llendl; + LL_ERRS() << "Missing or mistyped field '" << field << "' in material definition" << LL_ENDL; return (T)LLSD(); } @@ -80,7 +80,7 @@ template<> LLUUID getMaterialField(const LLSD& data, const std::string& field, c { return data[field].asUUID(); } - llerrs << "Missing or mistyped field '" << field << "' in material definition" << llendl; + LL_ERRS() << "Missing or mistyped field '" << field << "' in material definition" << LL_ENDL; return LLUUID::null; } diff --git a/indra/llprimitive/llmaterialid.h b/indra/llprimitive/llmaterialid.h index 0a952040859625b2846e846001ea4be699a44093..b4c82d3b7b7fc0c21d0a8f9d1f265539c7852877 100644 --- a/indra/llprimitive/llmaterialid.h +++ b/indra/llprimitive/llmaterialid.h @@ -30,6 +30,7 @@ #define MATERIAL_ID_SIZE 16 #include <string> +#include "llsd.h" class LLMaterialID { diff --git a/indra/llprimitive/llmaterialtable.cpp b/indra/llprimitive/llmaterialtable.cpp index b4539ebee9f8d909094013d7032813ca5c37b7a8..37c718b4c63fd7edca32387aa946ec41b172db34 100755 --- a/indra/llprimitive/llmaterialtable.cpp +++ b/indra/llprimitive/llmaterialtable.cpp @@ -27,10 +27,10 @@ #include "linden_common.h" #include "llmaterialtable.h" +#include "indra_constants.h" #include "llstl.h" #include "material_codes.h" #include "sound_ids.h" -#include "imageids.h" LLMaterialTable LLMaterialTable::basic(1); @@ -547,14 +547,14 @@ LLUUID LLMaterialTable::getCollisionSoundUUID(U8 mcode, U8 mcode2) mcode &= LL_MCODE_MASK; mcode2 &= LL_MCODE_MASK; - //llinfos << "code 1: " << ((U32) mcode) << " code 2:" << ((U32) mcode2) << llendl; + //LL_INFOS() << "code 1: " << ((U32) mcode) << " code 2:" << ((U32) mcode2) << LL_ENDL; if (mCollisionSoundMatrix && (mcode < LL_MCODE_END) && (mcode2 < LL_MCODE_END)) { return(mCollisionSoundMatrix[mcode * LL_MCODE_END + mcode2]); } else { - //llinfos << "Null Sound" << llendl; + //LL_INFOS() << "Null Sound" << LL_ENDL; return(SND_NULL); } } diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp index f82004395b46accd8f4835ae68ab8d764ee2d6c4..b0456e3ccf45b6032306e55fbf530538582bea10 100755 --- a/indra/llprimitive/llmodel.cpp +++ b/indra/llprimitive/llmodel.cpp @@ -166,7 +166,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa if ( !get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source) || !pos_source ) { - llwarns << "Could not find dom sources for basic geo data; invalid model." << llendl; + LL_WARNS() << "Could not find dom sources for basic geo data; invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } @@ -210,7 +210,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa if (((i + pos_offset) > index_count) || ((idx[i+pos_offset]*3+2) > vertex_count)) { - llwarns << "Out of range index data; invalid model." << llendl; + LL_WARNS() << "Out of range index data; invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } @@ -220,7 +220,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa if (!cv.getPosition().isFinite3()) { - llwarns << "Nan positional data, invalid model." << llendl; + LL_WARNS() << "Nan positional data, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } } @@ -233,7 +233,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa if (((i + tc_offset) > index_count) || ((idx[i+tc_offset]*2+1) > tc_count)) { - llwarns << "Out of range TC indices." << llendl; + LL_WARNS() << "Out of range TC indices." << LL_ENDL; return LLModel::BAD_ELEMENT; } @@ -242,7 +242,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa if (!cv.mTexCoord.isFinite()) { - llwarns << "Found NaN while loading tex coords from DAE-Model, invalid model." << llendl; + LL_WARNS() << "Found NaN while loading tex coords from DAE-Model, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } } @@ -254,7 +254,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa if (((i + norm_offset) > index_count) || ((idx[i+norm_offset]*3+2) > norm_count)) { - llwarns << "Found out of range norm indices, invalid model." << llendl; + LL_WARNS() << "Found out of range norm indices, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } @@ -264,7 +264,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa if (!cv.getNormal().isFinite3()) { - llwarns << "Found NaN while loading normals from DAE-Model, invalid model." << llendl; + LL_WARNS() << "Found NaN while loading normals from DAE-Model, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } } @@ -293,7 +293,7 @@ LLModel::EModelStatus load_face_from_dom_triangles(std::vector<LLVolumeFace>& fa verts.push_back(cv); if (verts.size() >= 65535) { - //llerrs << "Attempted to write model exceeding 16-bit index buffer limitation." << llendl; + //LL_ERRS() << "Attempted to write model exceeding 16-bit index buffer limitation." << LL_ENDL; return LLModel::VERTEX_NUMBER_OVERFLOW ; } U16 index = (U16) (verts.size()-1); @@ -393,7 +393,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac if (!get_dom_sources(inputs, pos_offset, tc_offset, norm_offset, idx_stride, pos_source, tc_source, norm_source)) { - llwarns << "Could not get DOM sources for basic geo data, invalid model." << llendl; + LL_WARNS() << "Could not get DOM sources for basic geo data, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } @@ -447,7 +447,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac if (((cur_idx + pos_offset) > index_count) || ((idx[cur_idx+pos_offset]*3+2) > vertex_count)) { - llwarns << "Out of range position indices, invalid model." << llendl; + LL_WARNS() << "Out of range position indices, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } @@ -457,7 +457,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac if (!cv.getPosition().isFinite3()) { - llwarns << "Found NaN while loading positions from DAE-Model, invalid model." << llendl; + LL_WARNS() << "Found NaN while loading positions from DAE-Model, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } @@ -470,7 +470,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac if (((cur_idx + tc_offset) > index_count) || ((idx[cur_idx+tc_offset]*2+1) > tc_count)) { - llwarns << "Out of range TC indices, invalid model." << llendl; + LL_WARNS() << "Out of range TC indices, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } @@ -479,7 +479,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac if (!cv.mTexCoord.isFinite()) { - llwarns << "Found NaN while loading tex coords from DAE-Model, invalid model." << llendl; + LL_WARNS() << "Found NaN while loading tex coords from DAE-Model, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } } @@ -491,7 +491,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac if (((cur_idx + norm_offset) > index_count) || ((idx[cur_idx+norm_offset]*3+2) > norm_count)) { - llwarns << "Out of range norm indices, invalid model." << llendl; + LL_WARNS() << "Out of range norm indices, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } @@ -501,7 +501,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac if (!cv.getNormal().isFinite3()) { - llwarns << "Found NaN while loading normals from DAE-Model, invalid model." << llendl; + LL_WARNS() << "Found NaN while loading normals from DAE-Model, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } } @@ -549,7 +549,7 @@ LLModel::EModelStatus load_face_from_dom_polylist(std::vector<LLVolumeFace>& fac verts.push_back(cv); if (verts.size() >= 65535) { - //llerrs << "Attempted to write model exceeding 16-bit index buffer limitation." << llendl; + //LL_ERRS() << "Attempted to write model exceeding 16-bit index buffer limitation." << LL_ENDL; return LLModel::VERTEX_NUMBER_OVERFLOW ; } U16 index = (U16) (verts.size()-1); @@ -670,7 +670,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac domVertices* vertices = (domVertices*) elem.cast(); if (!vertices) { - llwarns << "Could not find vertex source, invalid model." << llendl; + LL_WARNS() << "Could not find vertex source, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } domInputLocal_Array& v_inp = vertices->getInput_array(); @@ -684,7 +684,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac domSource* src = (domSource*) elem.cast(); if (!src) { - llwarns << "Could not find DOM source, invalid model." << llendl; + LL_WARNS() << "Could not find DOM source, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } v = &(src->getFloat_array()->getValue()); @@ -700,7 +700,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac domSource* src = (domSource*) elem.cast(); if (!src) { - llwarns << "Could not find DOM source, invalid model." << llendl; + LL_WARNS() << "Could not find DOM source, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } n = &(src->getFloat_array()->getValue()); @@ -713,7 +713,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac domSource* src = (domSource*) elem.cast(); if (!src) { - llwarns << "Could not find DOM source, invalid model." << llendl; + LL_WARNS() << "Could not find DOM source, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } t = &(src->getFloat_array()->getValue()); @@ -751,7 +751,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac if (!vert.getPosition().isFinite3()) { - llwarns << "Found NaN while loading position data from DAE-Model, invalid model." << llendl; + LL_WARNS() << "Found NaN while loading position data from DAE-Model, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } } @@ -769,7 +769,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac if (!vert.getNormal().isFinite3()) { - llwarns << "Found NaN while loading normals from DAE-Model, invalid model." << llendl; + LL_WARNS() << "Found NaN while loading normals from DAE-Model, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } } @@ -788,7 +788,7 @@ LLModel::EModelStatus load_face_from_dom_polygons(std::vector<LLVolumeFace>& fac if (!vert.mTexCoord.isFinite()) { - llwarns << "Found NaN while loading tex coords from DAE-Model, invalid model." << llendl; + LL_WARNS() << "Found NaN while loading tex coords from DAE-Model, invalid model." << LL_ENDL; return LLModel::BAD_ELEMENT; } } @@ -887,12 +887,12 @@ std::string LLModel::getStatusString(U32 status) { if(status_strings[status] == std::string()) { - llerrs << "No valid status string for this status: " << (U32)status << llendl ; + LL_ERRS() << "No valid status string for this status: " << (U32)status << LL_ENDL ; } return status_strings[status] ; } - llerrs << "Invalid model status: " << (U32)status << llendl ; + LL_ERRS() << "Invalid model status: " << (U32)status << LL_ENDL ; return std::string() ; } @@ -968,7 +968,7 @@ BOOL LLModel::createVolumeFacesFromDomMesh(domMesh* mesh) } else { - llwarns << "no mesh found" << llendl; + LL_WARNS() << "no mesh found" << LL_ENDL; } return FALSE; @@ -1264,14 +1264,14 @@ void LLModel::addFace(const LLVolumeFace& face) { if (face.mNumVertices == 0) { - llerrs << "Cannot add empty face." << llendl; + LL_ERRS() << "Cannot add empty face." << LL_ENDL; } mVolumeFaces.push_back(face); if (mVolumeFaces.size() > MAX_MODEL_FACES) { - llerrs << "Model prims cannot have more than " << MAX_MODEL_FACES << " faces!" << llendl; + LL_ERRS() << "Model prims cannot have more than " << MAX_MODEL_FACES << " faces!" << LL_ENDL; } } @@ -1293,7 +1293,7 @@ void LLModel::generateNormals(F32 angle_cutoff) if (vol_face.mNumIndices > 65535) { - llwarns << "Too many vertices for normal generation to work." << llendl; + LL_WARNS() << "Too many vertices for normal generation to work." << LL_ENDL; continue; } @@ -1893,7 +1893,7 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos) { if ((iter->first - pos).magVec() > 0.1f) { - llerrs << "Couldn't find weight list." << llendl; + LL_ERRS() << "Couldn't find weight list." << LL_ENDL; } return iter->second; @@ -1998,7 +1998,7 @@ bool LLModel::loadModel(std::istream& is) { if (!LLSDSerialize::fromBinary(header, is, 1024*1024*1024)) { - llwarns << "Mesh header parse error. Not a valid mesh asset!" << llendl; + LL_WARNS() << "Mesh header parse error. Not a valid mesh asset!" << LL_ENDL; return false; } } @@ -2028,7 +2028,7 @@ bool LLModel::loadModel(std::istream& is) if (header[nm[lod]]["offset"].asInteger() == -1 || header[nm[lod]]["size"].asInteger() == 0 ) { //cannot load requested LOD - llwarns << "LoD data is invalid!" << llendl; + LL_WARNS() << "LoD data is invalid!" << LL_ENDL; return false; } @@ -2091,7 +2091,7 @@ bool LLModel::loadModel(std::istream& is) } else { - llwarns << "unpackVolumeFaces failed!" << llendl; + LL_WARNS() << "unpackVolumeFaces failed!" << LL_ENDL; } return false; @@ -2109,7 +2109,7 @@ bool LLModel::isMaterialListSubset( LLModel* ref ) for (U32 dst = 0; dst < refCnt; ++dst) { - //llinfos<<mMaterialList[src]<<" "<<ref->mMaterialList[dst]<<llendl; + //LL_INFOS()<<mMaterialList[src]<<" "<<ref->mMaterialList[dst]<<LL_ENDL; foundRef = mMaterialList[src] == ref->mMaterialList[dst]; if ( foundRef ) @@ -2154,7 +2154,7 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn bool isASubset = isMaterialListSubset( ref ); if ( !isASubset ) { - llinfos<<"Material of model is not a subset of reference."<<llendl; + LL_INFOS()<<"Material of model is not a subset of reference."<<LL_ENDL; return false; } @@ -2605,7 +2605,7 @@ LLSD LLModel::Decomposition::asLLSD() const if (vert_idx > p.size()) { - llerrs << "Index out of bounds" << llendl; + LL_ERRS() << "Index out of bounds" << LL_ENDL; } } } @@ -2625,7 +2625,7 @@ void LLModel::Decomposition::merge(const LLModel::Decomposition* rhs) if (mMeshID != rhs->mMeshID) { - llerrs << "Attempted to merge with decomposition of some other mesh." << llendl; + LL_ERRS() << "Attempted to merge with decomposition of some other mesh." << LL_ENDL; } if (mBaseHull.empty()) diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 2fa77177f58e704f4c7e3eece97e42e90a432041..a505ea04a743f3e844a3782a08a881b29f32ff9a 100755 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -38,7 +38,6 @@ #include "lldatapacker.h" #include "llsdutil_math.h" #include "llprimtexturelist.h" -#include "imageids.h" #include "llmaterialid.h" /** @@ -127,7 +126,7 @@ void LLPrimitive::setVolumeManager( LLVolumeMgr* volume_manager ) { if ( !volume_manager || sVolumeManager ) { - llerrs << "LLPrimitive::sVolumeManager attempting to be set to NULL or it already has been set." << llendl; + LL_ERRS() << "LLPrimitive::sVolumeManager attempting to be set to NULL or it already has been set." << LL_ENDL; } sVolumeManager = volume_manager; } @@ -198,7 +197,7 @@ LLPrimitive *LLPrimitive::createPrimitive(LLPCode p_code) } else { - llerrs << "primitive allocation failed" << llendl; + LL_ERRS() << "primitive allocation failed" << LL_ENDL; } return retval; @@ -484,7 +483,7 @@ LLPCode LLPrimitive::legacyToPCode(const U8 legacy) pcode = LL_PCODE_TREE_NEW; break; default: - llwarns << "Unknown legacy code " << legacy << " [" << (S32)legacy << "]!" << llendl; + LL_WARNS() << "Unknown legacy code " << legacy << " [" << (S32)legacy << "]!" << LL_ENDL; } return pcode; @@ -579,7 +578,7 @@ U8 LLPrimitive::pCodeToLegacy(const LLPCode pcode) legacy = TREE_NEW; break; default: - llwarns << "Unknown pcode " << (S32)pcode << ":" << pcode << "!" << llendl; + LL_WARNS() << "Unknown pcode " << (S32)pcode << ":" << pcode << "!" << LL_ENDL; return 0; } return legacy; @@ -587,7 +586,7 @@ U8 LLPrimitive::pCodeToLegacy(const LLPCode pcode) // static -// Don't crash or llerrs here! This function is used for debug strings. +// Don't crash or LL_ERRS() here! This function is used for debug strings. std::string LLPrimitive::pCodeToString(const LLPCode pcode) { std::string pcode_string; @@ -666,7 +665,7 @@ std::string LLPrimitive::pCodeToString(const LLPCode pcode) } else { - llwarns << "Unknown base mask for pcode: " << base_code << llendl; + LL_WARNS() << "Unknown base mask for pcode: " << base_code << LL_ENDL; } U8 mask_code = pcode & (~LL_PCODE_BASE_MASK); @@ -702,7 +701,7 @@ void LLPrimitive::copyTEs(const LLPrimitive *primitivep) U32 i; if (primitivep->getExpectedNumTEs() != getExpectedNumTEs()) { - llwarns << "Primitives don't have same expected number of TE's" << llendl; + LL_WARNS() << "Primitives don't have same expected number of TE's" << LL_ENDL; } U32 num_tes = llmin(primitivep->getExpectedNumTEs(), getExpectedNumTEs()); if (mTextureList.size() < getExpectedNumTEs()) @@ -804,7 +803,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai { S32 te_index = face_index_from_id(cur_mask, old_faces); old_tes.copyTexture(face_bit, *(getTE(te_index))); - //llinfos << face_bit << ":" << te_index << ":" << old_tes[face_bit].getID() << llendl; + //LL_INFOS() << face_bit << ":" << te_index << ":" << old_tes[face_bit].getID() << LL_ENDL; } } @@ -824,7 +823,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai if (mVolumep->getNumFaces() == 0 && new_face_mask != 0) { - llwarns << "Object with 0 faces found...INCORRECT!" << llendl; + LL_WARNS() << "Object with 0 faces found...INCORRECT!" << LL_ENDL; setNumTEs(mVolumep->getNumFaces()); return TRUE; } @@ -882,7 +881,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai } if (i == 4) { - llwarns << "No path end or outer face in volume!" << llendl; + LL_WARNS() << "No path end or outer face in volume!" << LL_ENDL; } continue; } @@ -918,7 +917,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai } if (i == 4) { - llwarns << "No path end or outer face in volume!" << llendl; + LL_WARNS() << "No path end or outer face in volume!" << LL_ENDL; } continue; } @@ -944,8 +943,8 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai } if (-1 == min_outer_bit) { - llinfos << (LLVolume *)mVolumep << llendl; - llwarns << "Bad! No outer faces, impossible!" << llendl; + LL_INFOS() << (LLVolume *)mVolumep << LL_ENDL; + LL_WARNS() << "Bad! No outer faces, impossible!" << LL_ENDL; } face_mapping[face_bit] = min_outer_bit; } @@ -964,7 +963,7 @@ BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detai { if (-1 == face_mapping[face_bit]) { - llwarns << "No mapping from old face to new face!" << llendl; + LL_WARNS() << "No mapping from old face to new face!" << LL_ENDL; } S32 te_num = face_index_from_id(cur_mask, mVolumep->getProfile().mFaces); @@ -1422,7 +1421,7 @@ S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp) if (!dp.unpackBinaryData(packed_buffer, size, "TextureEntry")) { retval = TEM_INVALID; - llwarns << "Bad texture entry block! Abort!" << llendl; + LL_WARNS() << "Bad texture entry block! Abort!" << LL_ENDL; return retval; } diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 47a21beaaf8fbb0574e86192e84ac7dc8def6599..cdb3f273c21e8cdb45475eafb11539101f7e1631 100755 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -540,7 +540,7 @@ void LLPrimitive::setPosition(const F32 x, const F32 y, const F32 z) } else { - llerrs << "Non Finite in LLPrimitive::setPosition(x,y,z) for " << pCodeToString(mPrimitiveCode) << llendl; + LL_ERRS() << "Non Finite in LLPrimitive::setPosition(x,y,z) for " << pCodeToString(mPrimitiveCode) << LL_ENDL; } } @@ -553,7 +553,7 @@ void LLPrimitive::setPosition(const LLVector3& pos) } else { - llerrs << "Non Finite in LLPrimitive::setPosition(LLVector3) for " << pCodeToString(mPrimitiveCode) << llendl; + LL_ERRS() << "Non Finite in LLPrimitive::setPosition(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL; } } @@ -565,7 +565,7 @@ void LLPrimitive::setAngularVelocity(const LLVector3& avel) } else { - llerror("Non Finite in LLPrimitive::setAngularVelocity", 0); + LL_ERRS() << "Non Finite in LLPrimitive::setAngularVelocity" << LL_ENDL; } } @@ -577,7 +577,7 @@ void LLPrimitive::setAngularVelocity(const F32 x, const F32 y, const F32 z) } else { - llerror("Non Finite in LLPrimitive::setAngularVelocity", 0); + LL_ERRS() << "Non Finite in LLPrimitive::setAngularVelocity" << LL_ENDL; } } @@ -589,7 +589,7 @@ void LLPrimitive::setVelocity(const LLVector3& vel) } else { - llerrs << "Non Finite in LLPrimitive::setVelocity(LLVector3) for " << pCodeToString(mPrimitiveCode) << llendl; + LL_ERRS() << "Non Finite in LLPrimitive::setVelocity(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL; } } @@ -601,7 +601,7 @@ void LLPrimitive::setVelocity(const F32 x, const F32 y, const F32 z) } else { - llerrs << "Non Finite in LLPrimitive::setVelocity(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << llendl; + LL_ERRS() << "Non Finite in LLPrimitive::setVelocity(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << LL_ENDL; } } @@ -613,7 +613,7 @@ void LLPrimitive::setVelocityX(const F32 x) } else { - llerror("Non Finite in LLPrimitive::setVelocityX", 0); + LL_ERRS() << "Non Finite in LLPrimitive::setVelocityX" << LL_ENDL; } } @@ -625,7 +625,7 @@ void LLPrimitive::setVelocityY(const F32 y) } else { - llerror("Non Finite in LLPrimitive::setVelocityY", 0); + LL_ERRS() << "Non Finite in LLPrimitive::setVelocityY" << LL_ENDL; } } @@ -637,7 +637,7 @@ void LLPrimitive::setVelocityZ(const F32 z) } else { - llerror("Non Finite in LLPrimitive::setVelocityZ", 0); + LL_ERRS() << "Non Finite in LLPrimitive::setVelocityZ" << LL_ENDL; } } @@ -649,7 +649,7 @@ void LLPrimitive::addVelocity(const LLVector3& vel) } else { - llerror("Non Finite in LLPrimitive::addVelocity", 0); + LL_ERRS() << "Non Finite in LLPrimitive::addVelocity" << LL_ENDL; } } @@ -661,7 +661,7 @@ void LLPrimitive::setAcceleration(const LLVector3& accel) } else { - llerrs << "Non Finite in LLPrimitive::setAcceleration(LLVector3) for " << pCodeToString(mPrimitiveCode) << llendl; + LL_ERRS() << "Non Finite in LLPrimitive::setAcceleration(LLVector3) for " << pCodeToString(mPrimitiveCode) << LL_ENDL; } } @@ -673,7 +673,7 @@ void LLPrimitive::setAcceleration(const F32 x, const F32 y, const F32 z) } else { - llerrs << "Non Finite in LLPrimitive::setAcceleration(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << llendl; + LL_ERRS() << "Non Finite in LLPrimitive::setAcceleration(F32,F32,F32) for " << pCodeToString(mPrimitiveCode) << LL_ENDL; } } #endif // CHECK_FOR_FINITE diff --git a/indra/llprimitive/llprimlinkinfo.h b/indra/llprimitive/llprimlinkinfo.h index 82c50cfe2f6fee6b94e3c2fec456bbc351527f8d..bee25975f13fd3c7a7cfb75a8a1681eda0cb3c20 100755 --- a/indra/llprimitive/llprimlinkinfo.h +++ b/indra/llprimitive/llprimlinkinfo.h @@ -274,28 +274,28 @@ S32 LLPrimLinkInfo< DATA_TYPE >::merge(LLPrimLinkInfo& other_info) // other_info.computeBoundingSphere(); // if ( other_radius != other_info.mBoundingSphere.getRadius() ) // { -// llinfos << "Other bounding sphere changed!!" << llendl; +// LL_INFOS() << "Other bounding sphere changed!!" << LL_ENDL; // } // F32 this_radius = mBoundingSphere.getRadius(); // computeBoundingSphere(); // if ( this_radius != mBoundingSphere.getRadius() ) // { -// llinfos << "This bounding sphere changed!!" << llendl; +// LL_INFOS() << "This bounding sphere changed!!" << LL_ENDL; // } F32 max_span = get_max_linkable_span(mBoundingSphere, other_info.mBoundingSphere); // F32 center_dist = (mBoundingSphere.getCenter() - other_info.mBoundingSphere.getCenter()).length(); - // llinfos << "objects are " << center_dist << "m apart" << llendl; + // LL_INFOS() << "objects are " << center_dist << "m apart" << LL_ENDL; F32 span = get_span(mBoundingSphere, other_info.mBoundingSphere); F32 span_limit = max_span + (2.f * other_info.mBoundingSphere.getRadius()); if (span > span_limit) { // there is no way any piece of other_info could link with this one - // llinfos << "span too large: " << span << " vs. " << span_limit << llendl; + // LL_INFOS() << "span too large: " << span << " vs. " << span_limit << LL_ENDL; return 0; } diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp index 537e7a6695536ed9bf0d1aa4fed2c0580210523a..dfae9699ecaf0ec5cb121c8d44e06f151f603651 100755 --- a/indra/llprimitive/llprimtexturelist.cpp +++ b/indra/llprimitive/llprimtexturelist.cpp @@ -130,7 +130,7 @@ S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te) if (S32(index) >= mEntryList.size()) { S32 current_size = mEntryList.size(); - llwarns << "ignore copy of index = " << S32(index) << " into texture entry list of size = " << current_size << llendl; + LL_WARNS() << "ignore copy of index = " << S32(index) << " into texture entry list of size = " << current_size << LL_ENDL; return TEM_CHANGE_NONE; } diff --git a/indra/llprimitive/lltextureanim.cpp b/indra/llprimitive/lltextureanim.cpp index 185a3f69c02584c8f3c59c5dd14c25097ffb7f9c..031a315d62273bf3c08fccc586b9e8a6d7ef4ca0 100755 --- a/indra/llprimitive/lltextureanim.cpp +++ b/indra/llprimitive/lltextureanim.cpp @@ -125,7 +125,7 @@ void LLTextureAnim::unpackTAMessage(LLMessageSystem *mesgsys, const S32 block_nu { if (size) { - llwarns << "Bad size " << size << " for TA block, ignoring." << llendl; + LL_WARNS() << "Bad size " << size << " for TA block, ignoring." << LL_ENDL; } mMode = 0; return; @@ -160,7 +160,7 @@ void LLTextureAnim::unpackTAMessage(LLDataPacker &dp) { if (size) { - llwarns << "Bad size " << size << " for TA block, ignoring." << llendl; + LL_WARNS() << "Bad size " << size << " for TA block, ignoring." << LL_ENDL; } mMode = 0; return; diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index 0db75a0e823208828841d84d3cfedc9f3fce74a9..284dfc15f46e4961b862c1703c79c60cfa7120ab 100755 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -271,8 +271,8 @@ bool LLTextureEntry::fromLLSD(const LLSD& sd) w = TEXTURE_MEDIA_DATA_KEY; if (hasMedia() != sd.has(w)) { - llwarns << "LLTextureEntry::fromLLSD: media_flags (" << hasMedia() << - ") does not match presence of media_data (" << sd.has(w) << "). Fixing." << llendl; + LL_WARNS() << "LLTextureEntry::fromLLSD: media_flags (" << hasMedia() << + ") does not match presence of media_data (" << sd.has(w) << "). Fixing." << LL_ENDL; } updateMediaData(sd[w]); diff --git a/indra/llprimitive/lltreeparams.cpp b/indra/llprimitive/lltreeparams.cpp index 842d848217b2042e64de46575c5cf9ea56f3b254..19a6db20ae56bd9421b6aef09676dccf44723e20 100755 --- a/indra/llprimitive/lltreeparams.cpp +++ b/indra/llprimitive/lltreeparams.cpp @@ -40,7 +40,7 @@ LLTreeParams::LLTreeParams() { -// llinfos << "TREE PARAMS INITIALIZED" << llendl; +// LL_INFOS() << "TREE PARAMS INITIALIZED" << LL_ENDL; // init to basic something or other... mShape = SR_TEND_FLAME; mLevels = 1; diff --git a/indra/llprimitive/llvolumemessage.cpp b/indra/llprimitive/llvolumemessage.cpp index 58b23bebd2562a26ccddee9bdaff6b66e339dc9c..a2c26661468f9c0a29d0de6ccd7181ff03bd46ff 100755 --- a/indra/llprimitive/llvolumemessage.cpp +++ b/indra/llprimitive/llvolumemessage.cpp @@ -109,8 +109,8 @@ bool LLVolumeMessage::unpackProfileParams( temp_f32 = temp_u16 * CUT_QUANTA; if (temp_f32 > 1.f) { - llwarns << "Profile begin out of range: " << temp_f32 - << ". Clamping to 0.0." << llendl; + LL_WARNS() << "Profile begin out of range: " << temp_f32 + << ". Clamping to 0.0." << LL_ENDL; temp_f32 = 0.f; ok = false; } @@ -120,8 +120,8 @@ bool LLVolumeMessage::unpackProfileParams( temp_f32 = temp_u16 * CUT_QUANTA; if (temp_f32 > 1.f) { - llwarns << "Profile end out of range: " << 1.f - temp_f32 - << ". Clamping to 1.0." << llendl; + LL_WARNS() << "Profile end out of range: " << 1.f - temp_f32 + << ". Clamping to 1.0." << LL_ENDL; temp_f32 = 1.f; ok = false; } @@ -131,19 +131,19 @@ bool LLVolumeMessage::unpackProfileParams( temp_f32 = temp_u16 * HOLLOW_QUANTA; if (temp_f32 > 1.f) { - llwarns << "Profile hollow out of range: " << temp_f32 - << ". Clamping to 0.0." << llendl; + LL_WARNS() << "Profile hollow out of range: " << temp_f32 + << ". Clamping to 0.0." << LL_ENDL; temp_f32 = 0.f; ok = false; } params->setHollow(temp_f32); /* - llinfos << "Unpacking Profile Block " << block_num << llendl; - llinfos << "Curve: " << (U32)getCurve() << llendl; - llinfos << "Begin: " << getBegin() << llendl; - llinfos << "End: " << getEnd() << llendl; - llinfos << "Hollow: " << getHollow() << llendl; + LL_INFOS() << "Unpacking Profile Block " << block_num << LL_ENDL; + LL_INFOS() << "Curve: " << (U32)getCurve() << LL_ENDL; + LL_INFOS() << "Begin: " << getBegin() << LL_ENDL; + LL_INFOS() << "End: " << getEnd() << LL_ENDL; + LL_INFOS() << "Hollow: " << getHollow() << LL_ENDL; */ return ok; @@ -165,8 +165,8 @@ bool LLVolumeMessage::unpackProfileParams( temp_f32 = temp_u16 * CUT_QUANTA; if (temp_f32 > 1.f) { - llwarns << "Profile begin out of range: " << temp_f32 << llendl; - llwarns << "Clamping to 0.0" << llendl; + LL_WARNS() << "Profile begin out of range: " << temp_f32 << LL_ENDL; + LL_WARNS() << "Clamping to 0.0" << LL_ENDL; temp_f32 = 0.f; ok = false; } @@ -176,8 +176,8 @@ bool LLVolumeMessage::unpackProfileParams( temp_f32 = temp_u16 * CUT_QUANTA; if (temp_f32 > 1.f) { - llwarns << "Profile end out of range: " << 1.f - temp_f32 << llendl; - llwarns << "Clamping to 1.0" << llendl; + LL_WARNS() << "Profile end out of range: " << 1.f - temp_f32 << LL_ENDL; + LL_WARNS() << "Clamping to 1.0" << LL_ENDL; temp_f32 = 1.f; ok = false; } @@ -187,8 +187,8 @@ bool LLVolumeMessage::unpackProfileParams( temp_f32 = temp_u16 * HOLLOW_QUANTA; if (temp_f32 > 1.f) { - llwarns << "Profile hollow out of range: " << temp_f32 << llendl; - llwarns << "Clamping to 0.0" << llendl; + LL_WARNS() << "Profile hollow out of range: " << temp_f32 << LL_ENDL; + LL_WARNS() << "Clamping to 0.0" << LL_ENDL; temp_f32 = 0.f; ok = false; } @@ -379,12 +379,12 @@ bool LLVolumeMessage::unpackPathParams( params->setSkew((F32)(skew * SCALE_QUANTA)); /* - llinfos << "Unpacking Path Block " << block_num << llendl; - llinfos << "Curve: " << (U32)params->getCurve() << llendl; - llinfos << "Begin: " << params->getBegin() << llendl; - llinfos << "End: " << params->getEnd() << llendl; - llinfos << "Scale: " << params->getScale() << llendl; - llinfos << "Twist: " << params->getTwist() << llendl; + LL_INFOS() << "Unpacking Path Block " << block_num << LL_ENDL; + LL_INFOS() << "Curve: " << (U32)params->getCurve() << LL_ENDL; + LL_INFOS() << "Begin: " << params->getBegin() << LL_ENDL; + LL_INFOS() << "End: " << params->getEnd() << LL_ENDL; + LL_INFOS() << "Scale: " << params->getScale() << LL_ENDL; + LL_INFOS() << "Twist: " << params->getTwist() << LL_ENDL; */ return true; @@ -480,16 +480,16 @@ bool LLVolumeMessage::constrainVolumeParams(LLVolumeParams& params) bad |= params.setSkew(params.getPathParams().getSkew()) ? 0 : 0x800; if(bad) { - llwarns << "LLVolumeMessage::constrainVolumeParams() - " + LL_WARNS() << "LLVolumeMessage::constrainVolumeParams() - " << "forced to constrain incoming volume params: " - << llformat("0x%04x",bad) << llendl; + << llformat("0x%04x",bad) << LL_ENDL; } return bad ? false : true; } bool LLVolumeMessage::packVolumeParams(const LLVolumeParams* params, LLMessageSystem *mesgsys) { - // llinfos << "pack volume" << llendl; + // LL_INFOS() << "pack volume" << LL_ENDL; if (params) { packPathParams(¶ms->getPathParams(), mesgsys); @@ -505,7 +505,7 @@ bool LLVolumeMessage::packVolumeParams(const LLVolumeParams* params, LLMessageSy bool LLVolumeMessage::packVolumeParams(const LLVolumeParams* params, LLDataPacker &dp) { - // llinfos << "pack volume" << llendl; + // LL_INFOS() << "pack volume" << LL_ENDL; if (params) { packPathParams(¶ms->getPathParams(), dp); diff --git a/indra/llprimitive/llvolumexml.cpp b/indra/llprimitive/llvolumexml.cpp deleted file mode 100755 index bf2297a0299075c7fe6bd09dab4c3c4af5b0e255..0000000000000000000000000000000000000000 --- a/indra/llprimitive/llvolumexml.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file llvolumexml.cpp - * @brief LLVolumeXml base class - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "llvolumexml.h" - -//============================================================================ - -// LLVolumeXml is just a wrapper class; all members are static - -//============================================================================ - -LLPointer<LLXMLNode> LLVolumeXml::exportProfileParams(const LLProfileParams* params) -{ - LLPointer<LLXMLNode> ret = new LLXMLNode("profile", FALSE); - - ret->createChild("curve_type", TRUE)->setByteValue(1, ¶ms->getCurveType()); - ret->createChild("interval", FALSE)->setFloatValue(2, ¶ms->getBegin()); - ret->createChild("hollow", FALSE)->setFloatValue(1, ¶ms->getHollow()); - - return ret; -} - - -LLPointer<LLXMLNode> LLVolumeXml::exportPathParams(const LLPathParams* params) -{ - LLPointer<LLXMLNode> ret = new LLXMLNode("path", FALSE); - ret->createChild("curve_type", TRUE)->setByteValue(1, ¶ms->getCurveType()); - ret->createChild("interval", FALSE)->setFloatValue(2, ¶ms->getBegin()); - ret->createChild("scale", FALSE)->setFloatValue(2, params->getScale().mV); - ret->createChild("shear", FALSE)->setFloatValue(2, params->getShear().mV); - ret->createChild("twist_interval", FALSE)->setFloatValue(2, ¶ms->getTwistBegin()); - ret->createChild("radius_offset", FALSE)->setFloatValue(1, ¶ms->getRadiusOffset()); - ret->createChild("taper", FALSE)->setFloatValue(2, params->getTaper().mV); - ret->createChild("revolutions", FALSE)->setFloatValue(1, ¶ms->getRevolutions()); - ret->createChild("skew", FALSE)->setFloatValue(1, ¶ms->getSkew()); - - return ret; -} - - -LLPointer<LLXMLNode> LLVolumeXml::exportVolumeParams(const LLVolumeParams* params) -{ - LLPointer<LLXMLNode> ret = new LLXMLNode("shape", FALSE); - - LLPointer<LLXMLNode> node ; - node = exportPathParams(¶ms->getPathParams()) ; - node->setParent(ret); - node = exportProfileParams(¶ms->getProfileParams()) ; - node->setParent(ret); - - return ret; -} - diff --git a/indra/llprimitive/llvolumexml.h b/indra/llprimitive/llvolumexml.h deleted file mode 100755 index 9d4d989475da6fa48c034f7b178bc3266d7383d4..0000000000000000000000000000000000000000 --- a/indra/llprimitive/llvolumexml.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file llvolumexml.h - * @brief LLVolumeXml base class - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLVOLUMEXML_H -#define LL_LLVOLUMEXML_H - -#include "llvolume.h" -#include "llxmlnode.h" - -// wrapper class for some volume/message functions -class LLVolumeXml -{ -public: - static LLPointer<LLXMLNode> exportProfileParams(const LLProfileParams* params); - - static LLPointer<LLXMLNode> exportPathParams(const LLPathParams* params); - - static LLPointer<LLXMLNode> exportVolumeParams(const LLVolumeParams* params); -}; - -#endif // LL_LLVOLUMEXML_H - diff --git a/indra/llprimitive/tests/llmediaentry_test.cpp b/indra/llprimitive/tests/llmediaentry_test.cpp index 16e5f894e24c2e0543b7aaa4c08664b76a17cffd..b072ce3964c382ba43cdb2a5d9dc66f769afb5cc 100755 --- a/indra/llprimitive/tests/llmediaentry_test.cpp +++ b/indra/llprimitive/tests/llmediaentry_test.cpp @@ -39,7 +39,7 @@ #include "llsdserialize.h" #include "../llmediaentry.h" -#include "lllslconstants.h" +#include "indra_constants.h" #define DEFAULT_MEDIA_ENTRY "<llsd>\n\ <map>\n\ diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index 45a3b18179a8aff6b2646aaf02e5aea96bf05add..af4e3fdda02f57d7cff070ef4bac33a1a1544f90 100755 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -100,7 +100,7 @@ void LLCubeMap::initGL() } else { - llwarns << "Using cube map without extension!" << llendl; + LL_WARNS() << "Using cube map without extension!" << LL_ENDL; } } diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp index c985f6b959120b57d24525fa48dccf4de0269aaa..f128636ab29b33b142dd1bf6d880c780da67c801 100755 --- a/indra/llrender/llfontbitmapcache.cpp +++ b/indra/llrender/llfontbitmapcache.cpp @@ -29,7 +29,8 @@ #include "llgl.h" #include "llfontbitmapcache.h" -LLFontBitmapCache::LLFontBitmapCache(): +LLFontBitmapCache::LLFontBitmapCache() +: LLTrace::MemTrackable<LLFontBitmapCache>("LLFontBitmapCache"), mNumComponents(0), mBitmapWidth(0), mBitmapHeight(0), @@ -81,6 +82,7 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32 &pos_x, S32 &pos_y, S32& bitm { // We're out of space in the current image, or no image // has been allocated yet. Make a new one. + mImageRawVec.push_back(new LLImageRaw); mBitmapNum = mImageRawVec.size()-1; LLImageRaw *image_raw = getImageRaw(mBitmapNum); @@ -122,6 +124,9 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32 &pos_x, S32 &pos_y, S32& bitm image_gl->createGLTexture(0, image_raw); gGL.getTexUnit(0)->bind(image_gl); image_gl->setFilteringOption(LLTexUnit::TFO_POINT); // was setMipFilterNearest(TRUE, TRUE); + + claimMem(image_raw); + claimMem(image_gl); } else { @@ -151,7 +156,20 @@ void LLFontBitmapCache::destroyGL() void LLFontBitmapCache::reset() { + for (std::vector<LLPointer<LLImageRaw> >::iterator it = mImageRawVec.begin(), end_it = mImageRawVec.end(); + it != end_it; + ++it) + { + disclaimMem(**it); + } mImageRawVec.clear(); + + for (std::vector<LLPointer<LLImageGL> >::iterator it = mImageGLVec.begin(), end_it = mImageGLVec.end(); + it != end_it; + ++it) + { + disclaimMem(**it); + } mImageGLVec.clear(); mBitmapWidth = 0; diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index c93b0c7320bba0470c37d74c74392591704eedd2..75df3a94a796fab48d4f7c63c3f03c95beef44c5 100755 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -28,10 +28,11 @@ #define LL_LLFONTBITMAPCACHE_H #include <vector> +#include "lltrace.h" // Maintain a collection of bitmaps containing rendered glyphs. // Generalizes the single-bitmap logic from LLFontFreetype and LLFontGL. -class LLFontBitmapCache: public LLRefCount +class LLFontBitmapCache : public LLTrace::MemTrackable<LLFontBitmapCache> { public: LLFontBitmapCache(); diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 84c782e958137a2f6d35f84d0de4fee3dd6939a1..25b1c533c1f93ff38ef5123c935a3affc7eb591b 100755 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -75,7 +75,7 @@ LLFontManager::LLFontManager() if (error) { // Clean up freetype libs. - llerrs << "Freetype initialization failure!" << llendl; + LL_ERRS() << "Freetype initialization failure!" << LL_ENDL; FT_Done_FreeType(gFTLibrary); } } @@ -101,7 +101,8 @@ LLFontGlyphInfo::LLFontGlyphInfo(U32 index) } LLFontFreetype::LLFontFreetype() -: mFontBitmapCachep(new LLFontBitmapCache), +: LLTrace::MemTrackable<LLFontFreetype>("LLFontFreetype"), + mFontBitmapCachep(new LLFontBitmapCache), mValid(FALSE), mAscender(0.f), mDescender(0.f), @@ -127,7 +128,7 @@ LLFontFreetype::~LLFontFreetype() std::for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer()); mCharGlyphInfoMap.clear(); - // mFontBitmapCachep will be cleaned up by LLPointer destructor. + delete mFontBitmapCachep; // mFallbackFonts cleaned up by LLPointer destructor } @@ -187,10 +188,12 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v S32 max_char_height = llround(0.5f + (y_max - y_min)); mFontBitmapCachep->init(components, max_char_width, max_char_height); + claimMem(mFontBitmapCachep); + if (!mFTFace->charmap) { - //llinfos << " no unicode encoding, set whatever encoding there is..." << llendl; + //LL_INFOS() << " no unicode encoding, set whatever encoding there is..." << LL_ENDL; FT_Set_Charmap(mFTFace, mFTFace->charmaps[0]); } @@ -201,6 +204,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v } mName = filename; + claimMem(mName); mPointSize = point_size; mStyle = LLFontGL::NORMAL; @@ -322,7 +326,7 @@ LLFontGlyphInfo* LLFontFreetype::addGlyph(llwchar wch) const return FALSE; llassert(!mIsFallback); - //lldebugs << "Adding new glyph for " << wch << " to font" << llendl; + //LL_DEBUGS() << "Adding new glyph for " << wch << " to font" << LL_ENDL; FT_UInt glyph_index; @@ -330,7 +334,7 @@ LLFontGlyphInfo* LLFontFreetype::addGlyph(llwchar wch) const glyph_index = FT_Get_Char_Index(mFTFace, wch); if (glyph_index == 0) { - //llinfos << "Trying to add glyph from fallback font!" << llendl; + //LL_INFOS() << "Trying to add glyph from fallback font!" << LL_ENDL; font_vector_t::const_iterator iter; for(iter = mFallbackFonts.begin(); iter != mFallbackFonts.end(); iter++) { @@ -477,6 +481,7 @@ void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const } else { + claimMem(gi); mCharGlyphInfoMap[wch] = gi; } } @@ -502,7 +507,7 @@ void LLFontFreetype::reset(F32 vert_dpi, F32 horz_dpi) // This is the head of the list - need to rebuild ourself and all fallbacks. if (mFallbackFonts.empty()) { - llwarns << "LLFontGL::reset(), no fallback fonts present" << llendl; + LL_WARNS() << "LLFontGL::reset(), no fallback fonts present" << LL_ENDL; } else { @@ -518,8 +523,15 @@ void LLFontFreetype::reset(F32 vert_dpi, F32 horz_dpi) void LLFontFreetype::resetBitmapCache() { - for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer()); + for (char_glyph_info_map_t::iterator it = mCharGlyphInfoMap.begin(), end_it = mCharGlyphInfoMap.end(); + it != end_it; + ++it) + { + disclaimMem(it->second); + delete it->second; + } mCharGlyphInfoMap.clear(); + disclaimMem(mFontBitmapCachep); mFontBitmapCachep->reset(); // Adding default glyph is skipped for fallback fonts here as well as in loadFace(). @@ -541,7 +553,7 @@ const std::string &LLFontFreetype::getName() const return mName; } -const LLPointer<LLFontBitmapCache> LLFontFreetype::getFontBitmapCache() const +const LLFontBitmapCache* LLFontFreetype::getFontBitmapCache() const { return mFontBitmapCachep; } diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h index f1b23f22d50d36a092dc08a5bfc36c07b89c8b70..2963fbd43d827ffba0dd20e3f77f022c34802c10 100755 --- a/indra/llrender/llfontfreetype.h +++ b/indra/llrender/llfontfreetype.h @@ -74,7 +74,7 @@ struct LLFontGlyphInfo extern LLFontManager *gFontManagerp; -class LLFontFreetype : public LLRefCount +class LLFontFreetype : public LLRefCount, public LLTrace::MemTrackable<LLFontFreetype> { public: LLFontFreetype(); @@ -134,7 +134,7 @@ class LLFontFreetype : public LLRefCount const std::string& getName() const; - const LLPointer<LLFontBitmapCache> getFontBitmapCache() const; + const LLFontBitmapCache* getFontBitmapCache() const; void setStyle(U8 style); U8 getStyle() const; @@ -167,7 +167,7 @@ class LLFontFreetype : public LLRefCount typedef boost::unordered_map<llwchar, LLFontGlyphInfo*> char_glyph_info_map_t; mutable char_glyph_info_map_t mCharGlyphInfoMap; // Information about glyph location in bitmap - mutable LLPointer<LLFontBitmapCache> mFontBitmapCachep; + mutable LLFontBitmapCache* mFontBitmapCachep; mutable S32 mRenderGlyphCount; mutable S32 mAddGlyphCount; diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index c4f36cabd049bf615a59b929723e66ab21280010..1d181b476afe1c18a8dc7f31f74a1c1e047e962a 100755 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -29,6 +29,7 @@ #include "llfontgl.h" // Linden library includes +#include "llfasttimer.h" #include "llfontfreetype.h" #include "llfontbitmapcache.h" #include "llfontregistry.h" @@ -97,7 +98,7 @@ BOOL LLFontGL::loadFace(const std::string& filename, F32 point_size, F32 vert_dp return mFontFreetype->loadFace(filename, point_size, vert_dpi, horz_dpi, components, is_fallback); } -static LLFastTimer::DeclareTimer FTM_RENDER_FONTS("Fonts"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_FONTS("Fonts"); S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const @@ -128,7 +129,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_ellipses) const { - LLFastTimer _(FTM_RENDER_FONTS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_FONTS); if(!sDisplayFont) //do not display texts { @@ -275,7 +276,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons } if (!fgi) { - llerrs << "Missing Glyph Info" << llendl; + LL_ERRS() << "Missing Glyph Info" << LL_ENDL; break; } // Per-glyph bitmap texture. @@ -1069,7 +1070,7 @@ std::string LLFontGL::getFontPathSystem() system_root = getenv("SystemRoot"); /* Flawfinder: ignore */ if (!system_root) { - llwarns << "SystemRoot not found, attempting to load fonts from default path." << llendl; + LL_WARNS() << "SystemRoot not found, attempting to load fonts from default path." << LL_ENDL; } #endif @@ -1114,12 +1115,12 @@ std::string LLFontGL::getFontPathLocal() LLFontGL::LLFontGL(const LLFontGL &source) { - llerrs << "Not implemented!" << llendl; + LL_ERRS() << "Not implemented!" << LL_ENDL; } LLFontGL &LLFontGL::operator=(const LLFontGL &source) { - llerrs << "Not implemented" << llendl; + LL_ERRS() << "Not implemented" << LL_ENDL; return *this; } diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index f5ca8d5b04c82b7848b5bac7c828dad7bf2523b4..d0036874153f5bcd38a26fe011ecf6994ef978a4 100755 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -34,13 +34,15 @@ #include "llcontrol.h" #include "lldir.h" #include "llwindow.h" +#include "llxmlnode.h" extern LLControlGroup gSavedSettings; using std::string; using std::map; -bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc); +bool font_desc_init_from_xml(LLXMLNodePtr node, LLFontDescriptor& desc); +bool init_from_xml(LLFontRegistry* registry, LLXMLNodePtr node); LLFontDescriptor::LLFontDescriptor(): mStyle(0) @@ -198,7 +200,7 @@ bool LLFontRegistry::parseFontInfo(const std::string& xml_filename) if ( root.isNull() || ! root->hasName( "fonts" ) ) { - llwarns << "Bad font info file: " << *path_it << llendl; + LL_WARNS() << "Bad font info file: " << *path_it << LL_ENDL; continue; } @@ -207,7 +209,7 @@ bool LLFontRegistry::parseFontInfo(const std::string& xml_filename) if (root->hasName("fonts")) { // Expect a collection of children consisting of "font" or "font_size" entries - bool init_succ = initFromXML(root); + bool init_succ = init_from_xml(this, root); success = success || init_succ; } } @@ -230,7 +232,7 @@ std::string currentOsName() #endif } -bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc) +bool font_desc_init_from_xml(LLXMLNodePtr node, LLFontDescriptor& desc) { if (node->hasName("font")) { @@ -263,14 +265,14 @@ bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc) { if (child_name == currentOsName()) { - fontDescInitFromXML(child, desc); + font_desc_init_from_xml(child, desc); } } } return true; } -bool LLFontRegistry::initFromXML(LLXMLNodePtr node) +bool init_from_xml(LLFontRegistry* registry, LLXMLNodePtr node) { LLXMLNodePtr child; @@ -281,17 +283,17 @@ bool LLFontRegistry::initFromXML(LLXMLNodePtr node) if (child->hasName("font")) { LLFontDescriptor desc; - bool font_succ = fontDescInitFromXML(child, desc); + bool font_succ = font_desc_init_from_xml(child, desc); LLFontDescriptor norm_desc = desc.normalize(); if (font_succ) { // if this is the first time we've seen this font name, // create a new template map entry for it. - const LLFontDescriptor *match_desc = getMatchingFontDesc(desc); + const LLFontDescriptor *match_desc = registry->getMatchingFontDesc(desc); if (match_desc == NULL) { // Create a new entry (with no corresponding font). - mFontMap[norm_desc] = NULL; + registry->mFontMap[norm_desc] = NULL; } // otherwise, find the existing entry and combine data. else @@ -306,8 +308,8 @@ bool LLFontRegistry::initFromXML(LLXMLNodePtr node) desc.getFileNames().end()); LLFontDescriptor new_desc = *match_desc; new_desc.getFileNames() = match_file_names; - mFontMap.erase(*match_desc); - mFontMap[new_desc] = NULL; + registry->mFontMap.erase(*match_desc); + registry->mFontMap[new_desc] = NULL; } } } @@ -318,7 +320,7 @@ bool LLFontRegistry::initFromXML(LLXMLNodePtr node) if (child->getAttributeString("name",size_name) && child->getAttributeF32("size",size_value)) { - mFontSizes[size_name] = size_value; + registry->mFontSizes[size_name] = size_value; } } @@ -351,10 +353,10 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) bool found_size = nameToSize(norm_desc.getSize(),point_size); if (!found_size) { - llwarns << "createFont unrecognized size " << norm_desc.getSize() << llendl; + LL_WARNS() << "createFont unrecognized size " << norm_desc.getSize() << LL_ENDL; return NULL; } - llinfos << "createFont " << norm_desc.getName() << " size " << norm_desc.getSize() << " style " << ((S32) norm_desc.getStyle()) << llendl; + LL_INFOS() << "createFont " << norm_desc.getName() << " size " << norm_desc.getSize() << " style " << ((S32) norm_desc.getStyle()) << LL_ENDL; F32 fallback_scale = 1.0; // Find corresponding font template (based on same descriptor with no size specified) @@ -363,8 +365,8 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) const LLFontDescriptor *match_desc = getClosestFontTemplate(template_desc); if (!match_desc) { - llwarns << "createFont failed, no template found for " - << norm_desc.getName() << " style [" << ((S32)norm_desc.getStyle()) << "]" << llendl; + LL_WARNS() << "createFont failed, no template found for " + << norm_desc.getName() << " style [" << ((S32)norm_desc.getStyle()) << "]" << LL_ENDL; return NULL; } @@ -377,7 +379,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) // This may not be the best solution, but it at least prevents a crash. if (it != mFontMap.end() && it->second != NULL) { - llinfos << "-- matching font exists: " << nearest_exact_desc.getName() << " size " << nearest_exact_desc.getSize() << " style " << ((S32) nearest_exact_desc.getStyle()) << llendl; + LL_INFOS() << "-- matching font exists: " << nearest_exact_desc.getName() << " size " << nearest_exact_desc.getSize() << " style " << ((S32) nearest_exact_desc.getStyle()) << LL_ENDL; // copying underlying Freetype font, and storing in LLFontGL with requested font descriptor LLFontGL *font = new LLFontGL; @@ -410,7 +412,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) // Load fonts based on names. if (file_names.empty()) { - llwarns << "createFont failed, no file names specified" << llendl; + LL_WARNS() << "createFont failed, no file names specified" << LL_ENDL; return NULL; } @@ -478,7 +480,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) } else { - llwarns << "createFont failed in some way" << llendl; + LL_WARNS() << "createFont failed in some way" << LL_ENDL; } mFontMap[desc] = result; @@ -531,9 +533,9 @@ LLFontGL *LLFontRegistry::getFont(const LLFontDescriptor& desc) LLFontGL *fontp = createFont(desc); if (!fontp) { - llwarns << "getFont failed, name " << desc.getName() + LL_WARNS() << "getFont failed, name " << desc.getName() <<" style=[" << ((S32) desc.getStyle()) << "]" - << " size=[" << desc.getSize() << "]" << llendl; + << " size=[" << desc.getSize() << "]" << LL_ENDL; } return fontp; } @@ -636,28 +638,28 @@ const LLFontDescriptor *LLFontRegistry::getClosestFontTemplate(const LLFontDescr void LLFontRegistry::dump() { - llinfos << "LLFontRegistry dump: " << llendl; + LL_INFOS() << "LLFontRegistry dump: " << LL_ENDL; for (font_size_map_t::iterator size_it = mFontSizes.begin(); size_it != mFontSizes.end(); ++size_it) { - llinfos << "Size: " << size_it->first << " => " << size_it->second << llendl; + LL_INFOS() << "Size: " << size_it->first << " => " << size_it->second << LL_ENDL; } for (font_reg_map_t::iterator font_it = mFontMap.begin(); font_it != mFontMap.end(); ++font_it) { const LLFontDescriptor& desc = font_it->first; - llinfos << "Font: name=" << desc.getName() + LL_INFOS() << "Font: name=" << desc.getName() << " style=[" << ((S32)desc.getStyle()) << "]" << " size=[" << desc.getSize() << "]" << " fileNames=" - << llendl; + << LL_ENDL; for (string_vec_t::const_iterator file_it=desc.getFileNames().begin(); file_it != desc.getFileNames().end(); ++file_it) { - llinfos << " file: " << *file_it <<llendl; + LL_INFOS() << " file: " << *file_it <<LL_ENDL; } } } diff --git a/indra/llrender/llfontregistry.h b/indra/llrender/llfontregistry.h index 059248fbbdb333f51dc3392e7a2fde1c3c0cb9ad..177eb6c8a5db548907bd3f2c94d0fa9808e644ff 100755 --- a/indra/llrender/llfontregistry.h +++ b/indra/llrender/llfontregistry.h @@ -28,7 +28,7 @@ #ifndef LL_LLFONTREGISTRY_H #define LL_LLFONTREGISTRY_H -#include "llxmlnode.h" +#include "llpointer.h" class LLFontGL; @@ -65,6 +65,7 @@ class LLFontDescriptor class LLFontRegistry { public: + friend bool init_from_xml(LLFontRegistry*, LLPointer<class LLXMLNode>); // create_gl_textures - set to false for test apps with no OpenGL window, // such as llui_libtest LLFontRegistry(bool create_gl_textures); @@ -72,7 +73,6 @@ class LLFontRegistry // Load standard font info from XML file(s). bool parseFontInfo(const std::string& xml_filename); - bool initFromXML(LLXMLNodePtr node); // Clear cached glyphs for all fonts. void reset(); @@ -94,6 +94,7 @@ class LLFontRegistry const string_vec_t& getUltimateFallbackList() const; private: + LLFontRegistry(const LLFontRegistry& other); // no-copy LLFontGL *createFont(const LLFontDescriptor& desc); typedef std::map<LLFontDescriptor,LLFontGL*> font_reg_map_t; typedef std::map<std::string,F32> font_size_map_t; diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index acfb3c085afce5d70c2d44558966ea0949c8ecc3..44e6b97b315830c3ee5ef820d5581be15efca02a 100755 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -85,20 +85,20 @@ void APIENTRY gl_debug_callback(GLenum source, { if (severity == GL_DEBUG_SEVERITY_HIGH_ARB) { - llwarns << "----- GL ERROR --------" << llendl; + LL_WARNS() << "----- GL ERROR --------" << LL_ENDL; } else { - llwarns << "----- GL WARNING -------" << llendl; + LL_WARNS() << "----- GL WARNING -------" << LL_ENDL; } - llwarns << "Type: " << std::hex << type << llendl; - llwarns << "ID: " << std::hex << id << llendl; - llwarns << "Severity: " << std::hex << severity << llendl; - llwarns << "Message: " << message << llendl; - llwarns << "-----------------------" << llendl; + LL_WARNS() << "Type: " << std::hex << type << LL_ENDL; + LL_WARNS() << "ID: " << std::hex << id << LL_ENDL; + LL_WARNS() << "Severity: " << std::hex << severity << LL_ENDL; + LL_WARNS() << "Message: " << message << LL_ENDL; + LL_WARNS() << "-----------------------" << LL_ENDL; if (severity == GL_DEBUG_SEVERITY_HIGH_ARB) { - llerrs << "Halting on GL Error" << llendl; + LL_ERRS() << "Halting on GL Error" << LL_ENDL; } } } @@ -546,7 +546,7 @@ bool LLGLManager::initGL() { std::string ext((const char*) glGetStringi(GL_EXTENSIONS, i)); str << ext << " "; - LL_DEBUGS("GLExtensions") << ext << llendl; + LL_DEBUGS("GLExtensions") << ext << LL_ENDL; } { @@ -1015,7 +1015,7 @@ void LLGLManager::initExtensions() #endif #if LL_LINUX || LL_SOLARIS - llinfos << "initExtensions() checking shell variables to adjust features..." << llendl; + LL_INFOS() << "initExtensions() checking shell variables to adjust features..." << LL_ENDL; // Our extension support for the Linux Client is very young with some // potential driver gotchas, so offer a semi-secret way to turn it off. if (getenv("LL_GL_NOEXT")) @@ -1209,7 +1209,7 @@ void LLGLManager::initExtensions() } if (mHasFramebufferObject) { - llinfos << "initExtensions() FramebufferObject-related procs..." << llendl; + LL_INFOS() << "initExtensions() FramebufferObject-related procs..." << LL_ENDL; glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) GLH_EXT_GET_PROC_ADDRESS("glIsRenderbuffer"); glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) GLH_EXT_GET_PROC_ADDRESS("glBindRenderbuffer"); glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteRenderbuffers"); @@ -1278,7 +1278,7 @@ void LLGLManager::initExtensions() if (mHasOcclusionQuery) { - llinfos << "initExtensions() OcclusionQuery-related procs..." << llendl; + LL_INFOS() << "initExtensions() OcclusionQuery-related procs..." << LL_ENDL; glGenQueriesARB = (PFNGLGENQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenQueriesARB"); glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteQueriesARB"); glIsQueryARB = (PFNGLISQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsQueryARB"); @@ -1290,14 +1290,14 @@ void LLGLManager::initExtensions() } if (mHasTimerQuery) { - llinfos << "initExtensions() TimerQuery-related procs..." << llendl; + LL_INFOS() << "initExtensions() TimerQuery-related procs..." << LL_ENDL; glQueryCounter = (PFNGLQUERYCOUNTERPROC) GLH_EXT_GET_PROC_ADDRESS("glQueryCounter"); glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC) GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjecti64v"); glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC) GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjectui64v"); } if (mHasPointParameters) { - llinfos << "initExtensions() PointParameters-related procs..." << llendl; + LL_INFOS() << "initExtensions() PointParameters-related procs..." << LL_ENDL; glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfARB"); glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvARB"); } @@ -1345,7 +1345,7 @@ void LLGLManager::initExtensions() } if (mHasVertexShader) { - llinfos << "initExtensions() VertexShader-related procs..." << llendl; + LL_INFOS() << "initExtensions() VertexShader-related procs..." << LL_ENDL; glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB"); glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB"); glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveAttribARB"); @@ -1446,13 +1446,13 @@ void log_glerror() GLubyte const * gl_error_msg = gluErrorString(error); if (NULL != gl_error_msg) { - llwarns << "GL Error: " << error << " GL Error String: " << gl_error_msg << llendl ; + LL_WARNS() << "GL Error: " << error << " GL Error String: " << gl_error_msg << LL_ENDL ; } else { // gluErrorString returns NULL for some extensions' error codes. // you'll probably have to grep for the number in glext.h. - llwarns << "GL Error: UNKNOWN 0x" << std::hex << error << std::dec << llendl; + LL_WARNS() << "GL Error: UNKNOWN 0x" << std::hex << error << std::dec << LL_ENDL; } error = glGetError(); } @@ -1500,7 +1500,7 @@ void do_assert_glerror() } else { - llerrs << "One or more unhandled GL errors." << llendl; + LL_ERRS() << "One or more unhandled GL errors." << LL_ENDL; } } } @@ -1509,7 +1509,7 @@ void assert_glerror() { /* if (!gGLActive) { - //llwarns << "GL used while not active!" << llendl; + //LL_WARNS() << "GL used while not active!" << LL_ENDL; if (gDebugSession) { @@ -1798,7 +1798,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) if (tex != 0) { error = TRUE; - LL_WARNS("RenderState") << "Texture channel " << i << " still has texture " << tex << " bound." << llendl; + LL_WARNS("RenderState") << "Texture channel " << i << " still has texture " << tex << " bound." << LL_ENDL; if (gDebugSession) { @@ -1842,7 +1842,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask) if (active_texture != GL_TEXTURE0_ARB) { - llwarns << "Client active texture corrupted: " << active_texture << llendl; + LL_WARNS() << "Client active texture corrupted: " << active_texture << LL_ENDL; if (gDebugSession) { gFailLog << "Client active texture corrupted: " << active_texture << std::endl; @@ -1853,7 +1853,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask) /*glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture); if (active_texture != GL_TEXTURE0_ARB) { - llwarns << "Active texture corrupted: " << active_texture << llendl; + LL_WARNS() << "Active texture corrupted: " << active_texture << LL_ENDL; if (gDebugSession) { gFailLog << "Active texture corrupted: " << active_texture << std::endl; @@ -2350,11 +2350,11 @@ void LLGLNamePool::release(GLuint name) } else { - llerrs << "Attempted to release a pooled name that is not in use!" << llendl; + LL_ERRS() << "Attempted to release a pooled name that is not in use!" << LL_ENDL; } } } - llerrs << "Attempted to release a non pooled name!" << llendl; + LL_ERRS() << "Attempted to release a non pooled name!" << LL_ENDL; #else releaseName(name); #endif diff --git a/indra/llrender/llgldbg.cpp b/indra/llrender/llgldbg.cpp index 4b68194db3ba498cec09e28c3d978eda168771ae..0f1d4ae7422d3718245ed5e98af479193d9ef26f 100755 --- a/indra/llrender/llgldbg.cpp +++ b/indra/llrender/llgldbg.cpp @@ -112,112 +112,112 @@ void llgl_dump() F32 fv[16]; GLboolean b; - llinfos << "==========================" << llendl; - llinfos << "OpenGL State" << llendl; - llinfos << "==========================" << llendl; + LL_INFOS() << "==========================" << LL_ENDL; + LL_INFOS() << "OpenGL State" << LL_ENDL; + LL_INFOS() << "==========================" << LL_ENDL; - llinfos << "-----------------------------------" << llendl; - llinfos << "Current Values" << llendl; - llinfos << "-----------------------------------" << llendl; + LL_INFOS() << "-----------------------------------" << LL_ENDL; + LL_INFOS() << "Current Values" << LL_ENDL; + LL_INFOS() << "-----------------------------------" << LL_ENDL; glGetFloatv(GL_CURRENT_COLOR, fv); - llinfos << "GL_CURRENT_COLOR : " << fv4(fv) << llendl; + LL_INFOS() << "GL_CURRENT_COLOR : " << fv4(fv) << LL_ENDL; glGetFloatv(GL_CURRENT_NORMAL, fv); - llinfos << "GL_CURRENT_NORMAL : " << fv3(fv) << llendl; + LL_INFOS() << "GL_CURRENT_NORMAL : " << fv3(fv) << LL_ENDL; - llinfos << "-----------------------------------" << llendl; - llinfos << "Lighting" << llendl; - llinfos << "-----------------------------------" << llendl; + LL_INFOS() << "-----------------------------------" << LL_ENDL; + LL_INFOS() << "Lighting" << LL_ENDL; + LL_INFOS() << "-----------------------------------" << LL_ENDL; - llinfos << "GL_LIGHTING : " << boolstr(glIsEnabled(GL_LIGHTING)) << llendl; + LL_INFOS() << "GL_LIGHTING : " << boolstr(glIsEnabled(GL_LIGHTING)) << LL_ENDL; - llinfos << "GL_COLOR_MATERIAL : " << boolstr(glIsEnabled(GL_COLOR_MATERIAL)) << llendl; + LL_INFOS() << "GL_COLOR_MATERIAL : " << boolstr(glIsEnabled(GL_COLOR_MATERIAL)) << LL_ENDL; glGetIntegerv(GL_COLOR_MATERIAL_PARAMETER, (GLint*)&i); - llinfos << "GL_COLOR_MATERIAL_PARAMETER: " << cmstr(i) << llendl; + LL_INFOS() << "GL_COLOR_MATERIAL_PARAMETER: " << cmstr(i) << LL_ENDL; glGetIntegerv(GL_COLOR_MATERIAL_FACE, (GLint*)&i); - llinfos << "GL_COLOR_MATERIAL_FACE : " << facestr(i) << llendl; + LL_INFOS() << "GL_COLOR_MATERIAL_FACE : " << facestr(i) << LL_ENDL; fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; glGetMaterialfv(GL_FRONT, GL_AMBIENT, fv); - llinfos << "GL_AMBIENT material : " << fv4(fv) << llendl; + LL_INFOS() << "GL_AMBIENT material : " << fv4(fv) << LL_ENDL; fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; glGetMaterialfv(GL_FRONT, GL_DIFFUSE, fv); - llinfos << "GL_DIFFUSE material : " << fv4(fv) << llendl; + LL_INFOS() << "GL_DIFFUSE material : " << fv4(fv) << LL_ENDL; fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; glGetMaterialfv(GL_FRONT, GL_SPECULAR, fv); - llinfos << "GL_SPECULAR material : " << fv4(fv) << llendl; + LL_INFOS() << "GL_SPECULAR material : " << fv4(fv) << LL_ENDL; fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; glGetMaterialfv(GL_FRONT, GL_EMISSION, fv); - llinfos << "GL_EMISSION material : " << fv4(fv) << llendl; + LL_INFOS() << "GL_EMISSION material : " << fv4(fv) << LL_ENDL; fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; glGetMaterialfv(GL_FRONT, GL_SHININESS, fv); - llinfos << "GL_SHININESS material : " << fv1(fv) << llendl; + LL_INFOS() << "GL_SHININESS material : " << fv1(fv) << LL_ENDL; fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; glGetFloatv(GL_LIGHT_MODEL_AMBIENT, fv); - llinfos << "GL_LIGHT_MODEL_AMBIENT : " << fv4(fv) << llendl; + LL_INFOS() << "GL_LIGHT_MODEL_AMBIENT : " << fv4(fv) << LL_ENDL; glGetBooleanv(GL_LIGHT_MODEL_LOCAL_VIEWER, &b); - llinfos << "GL_LIGHT_MODEL_LOCAL_VIEWER: " << boolstr(b) << llendl; + LL_INFOS() << "GL_LIGHT_MODEL_LOCAL_VIEWER: " << boolstr(b) << LL_ENDL; glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE, &b); - llinfos << "GL_LIGHT_MODEL_TWO_SIDE : " << boolstr(b) << llendl; + LL_INFOS() << "GL_LIGHT_MODEL_TWO_SIDE : " << boolstr(b) << LL_ENDL; for (int l=0; l<8; l++) { b = glIsEnabled(GL_LIGHT0+l); - llinfos << "GL_LIGHT" << l << " : " << boolstr(b) << llendl; + LL_INFOS() << "GL_LIGHT" << l << " : " << boolstr(b) << LL_ENDL; if (!b) continue; glGetLightfv(GL_LIGHT0+l, GL_AMBIENT, fv); - llinfos << " GL_AMBIENT light : " << fv4(fv) << llendl; + LL_INFOS() << " GL_AMBIENT light : " << fv4(fv) << LL_ENDL; glGetLightfv(GL_LIGHT0+l, GL_DIFFUSE, fv); - llinfos << " GL_DIFFUSE light : " << fv4(fv) << llendl; + LL_INFOS() << " GL_DIFFUSE light : " << fv4(fv) << LL_ENDL; glGetLightfv(GL_LIGHT0+l, GL_SPECULAR, fv); - llinfos << " GL_SPECULAR light : " << fv4(fv) << llendl; + LL_INFOS() << " GL_SPECULAR light : " << fv4(fv) << LL_ENDL; glGetLightfv(GL_LIGHT0+l, GL_POSITION, fv); - llinfos << " GL_POSITION light : " << fv4(fv) << llendl; + LL_INFOS() << " GL_POSITION light : " << fv4(fv) << LL_ENDL; glGetLightfv(GL_LIGHT0+l, GL_CONSTANT_ATTENUATION, fv); - llinfos << " GL_CONSTANT_ATTENUATION : " << fv1(fv) << llendl; + LL_INFOS() << " GL_CONSTANT_ATTENUATION : " << fv1(fv) << LL_ENDL; glGetLightfv(GL_LIGHT0+l, GL_QUADRATIC_ATTENUATION, fv); - llinfos << " GL_QUADRATIC_ATTENUATION : " << fv1(fv) << llendl; + LL_INFOS() << " GL_QUADRATIC_ATTENUATION : " << fv1(fv) << LL_ENDL; glGetLightfv(GL_LIGHT0+l, GL_SPOT_DIRECTION, fv); - llinfos << " GL_SPOT_DIRECTION : " << fv4(fv) << llendl; + LL_INFOS() << " GL_SPOT_DIRECTION : " << fv4(fv) << LL_ENDL; glGetLightfv(GL_LIGHT0+l, GL_SPOT_EXPONENT, fv); - llinfos << " GL_SPOT_EXPONENT : " << fv1(fv) << llendl; + LL_INFOS() << " GL_SPOT_EXPONENT : " << fv1(fv) << LL_ENDL; glGetLightfv(GL_LIGHT0+l, GL_SPOT_CUTOFF, fv); - llinfos << " GL_SPOT_CUTOFF : " << fv1(fv) << llendl; + LL_INFOS() << " GL_SPOT_CUTOFF : " << fv1(fv) << LL_ENDL; } - llinfos << "-----------------------------------" << llendl; - llinfos << "Pixel Operations" << llendl; - llinfos << "-----------------------------------" << llendl; + LL_INFOS() << "-----------------------------------" << LL_ENDL; + LL_INFOS() << "Pixel Operations" << LL_ENDL; + LL_INFOS() << "-----------------------------------" << LL_ENDL; - llinfos << "GL_ALPHA_TEST : " << boolstr(glIsEnabled(GL_ALPHA_TEST)) << llendl; - llinfos << "GL_DEPTH_TEST : " << boolstr(glIsEnabled(GL_DEPTH_TEST)) << llendl; + LL_INFOS() << "GL_ALPHA_TEST : " << boolstr(glIsEnabled(GL_ALPHA_TEST)) << LL_ENDL; + LL_INFOS() << "GL_DEPTH_TEST : " << boolstr(glIsEnabled(GL_DEPTH_TEST)) << LL_ENDL; glGetBooleanv(GL_DEPTH_WRITEMASK, &b); - llinfos << "GL_DEPTH_WRITEMASK : " << boolstr(b) << llendl; + LL_INFOS() << "GL_DEPTH_WRITEMASK : " << boolstr(b) << LL_ENDL; - llinfos << "GL_BLEND : " << boolstr(glIsEnabled(GL_BLEND)) << llendl; - llinfos << "GL_DITHER : " << boolstr(glIsEnabled(GL_DITHER)) << llendl; + LL_INFOS() << "GL_BLEND : " << boolstr(glIsEnabled(GL_BLEND)) << LL_ENDL; + LL_INFOS() << "GL_DITHER : " << boolstr(glIsEnabled(GL_DITHER)) << LL_ENDL; } // End diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 5a80a8faa46ac6ccde3ff97f6c61ba25c92b62ba..a95872e883edc17ea44672dcb5b919cb2ddf458f 100755 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -551,9 +551,7 @@ extern PFNGLBINDBUFFERBASEPROC glBindBufferBase; // LL_WINDOWS // windows gl headers depend on things like APIENTRY, so include windows. -#define WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> +#include "llwin32headerslean.h" //---------------------------------------------------------------------------- #include <GL/gl.h> diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 1c50a51d024e56290ca42afda685f5b90848d3cd..9fae63385df9d3c9bc28829627d6156b46066f6a 100755 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -137,10 +137,10 @@ void LLGLSLShader::finishProfile() (*iter)->dumpStats(); } - llinfos << "-----------------------------------" << llendl; - llinfos << "Total rendering time: " << llformat("%.4f ms", sTotalTimeElapsed/1000000.f) << llendl; - llinfos << "Total samples drawn: " << llformat("%.4f million", sTotalSamplesDrawn/1000000.f) << llendl; - llinfos << "Total triangles drawn: " << llformat("%.3f million", sTotalTrianglesDrawn/1000000.f) << llendl; + LL_INFOS() << "-----------------------------------" << LL_ENDL; + LL_INFOS() << "Total rendering time: " << llformat("%.4f ms", sTotalTimeElapsed/1000000.f) << LL_ENDL; + LL_INFOS() << "Total samples drawn: " << llformat("%.4f million", sTotalSamplesDrawn/1000000.f) << LL_ENDL; + LL_INFOS() << "Total triangles drawn: " << llformat("%.3f million", sTotalTrianglesDrawn/1000000.f) << LL_ENDL; } void LLGLSLShader::clearStats() @@ -158,11 +158,11 @@ void LLGLSLShader::dumpStats() { if (mDrawCalls > 0) { - llinfos << "=============================================" << llendl; - llinfos << mName << llendl; + LL_INFOS() << "=============================================" << LL_ENDL; + LL_INFOS() << mName << LL_ENDL; for (U32 i = 0; i < mShaderFiles.size(); ++i) { - llinfos << mShaderFiles[i].first << llendl; + LL_INFOS() << mShaderFiles[i].first << LL_ENDL; } for (U32 i = 0; i < mTexture.size(); ++i) { @@ -171,10 +171,10 @@ void LLGLSLShader::dumpStats() if (idx >= 0) { GLint uniform_idx = getUniformLocation(i); - llinfos << mUniformNameMap[uniform_idx] << " - " << std::hex << mTextureMagFilter[i] << "/" << mTextureMinFilter[i] << std::dec << llendl; + LL_INFOS() << mUniformNameMap[uniform_idx] << " - " << std::hex << mTextureMagFilter[i] << "/" << mTextureMinFilter[i] << std::dec << LL_ENDL; } } - llinfos << "=============================================" << llendl; + LL_INFOS() << "=============================================" << LL_ENDL; F32 ms = mTimeElapsed/1000000.f; F32 seconds = ms/1000.f; @@ -190,10 +190,10 @@ void LLGLSLShader::dumpStats() F32 pct_calls = (F32) mDrawCalls/(F32)sTotalDrawCalls*100.f; U32 avg_batch = mTrianglesDrawn/mDrawCalls; - llinfos << "Triangles Drawn: " << mTrianglesDrawn << " " << llformat("(%.2f pct of total, %.3f million/sec)", pct_tris, tris_sec ) << llendl; - llinfos << "Draw Calls: " << mDrawCalls << " " << llformat("(%.2f pct of total, avg %d tris/call)", pct_calls, avg_batch) << llendl; - llinfos << "SamplesDrawn: " << mSamplesDrawn << " " << llformat("(%.2f pct of total, %.3f billion/sec)", pct_samples, samples_sec) << llendl; - llinfos << "Time Elapsed: " << mTimeElapsed << " " << llformat("(%.2f pct of total, %.5f ms)\n", (F32) ((F64)mTimeElapsed/(F64)sTotalTimeElapsed)*100.f, ms) << llendl; + LL_INFOS() << "Triangles Drawn: " << mTrianglesDrawn << " " << llformat("(%.2f pct of total, %.3f million/sec)", pct_tris, tris_sec ) << LL_ENDL; + LL_INFOS() << "Draw Calls: " << mDrawCalls << " " << llformat("(%.2f pct of total, avg %d tris/call)", pct_calls, avg_batch) << LL_ENDL; + LL_INFOS() << "SamplesDrawn: " << mSamplesDrawn << " " << llformat("(%.2f pct of total, %.3f billion/sec)", pct_samples, samples_sec) << LL_ENDL; + LL_INFOS() << "Time Elapsed: " << mTimeElapsed << " " << llformat("(%.2f pct of total, %.5f ms)\n", (F32) ((F64)mTimeElapsed/(F64)sTotalTimeElapsed)*100.f, ms) << LL_ENDL; } } @@ -711,7 +711,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms) unbind(); - LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << llendl; + LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL; return res; } @@ -864,7 +864,7 @@ S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode) } else { - llerrs << "Texture channel " << index << " texture type corrupted." << llendl; + LL_ERRS() << "Texture channel " << index << " texture type corrupted." << LL_ENDL; } } gGL.getTexUnit(index)->disable(); @@ -1164,7 +1164,7 @@ GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform) stop_glerror(); if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.String().c_str())) { - llerrs << "Uniform does not match." << llendl; + LL_ERRS() << "Uniform does not match." << LL_ENDL; } stop_glerror(); } diff --git a/indra/llrender/llgltexture.cpp b/indra/llrender/llgltexture.cpp index d06ed5e57bf4229bf1e6e4d4bf8a2e7d66915336..56e263c5f1beaa2ba3688b93a6bd6febfc63e87d 100644 --- a/indra/llrender/llgltexture.cpp +++ b/indra/llrender/llgltexture.cpp @@ -294,7 +294,7 @@ LLTexUnit::eTextureAddressMode LLGLTexture::getAddressMode(void) const return mGLTexturep->getAddressMode() ; } -S32 LLGLTexture::getTextureMemory() const +S32Bytes LLGLTexture::getTextureMemory() const { llassert(mGLTexturep.notNull()) ; diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index e69b322d6059aa5a047f7e6b59184f6215c5327c..45592ee077250ee959433fcdfc77dbc0cd90d750 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -101,7 +101,7 @@ class LLGLTexture : public LLTexture LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps) ; LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) ; - virtual void dump(); // debug info to llinfos + virtual void dump(); // debug info to LL_INFOS() virtual const LLUUID& getID() const = 0; @@ -138,7 +138,7 @@ class LLGLTexture : public LLTexture S32 getDiscardLevel() const; S8 getComponents() const; BOOL getBoundRecently() const; - S32 getTextureMemory() const ; + S32Bytes getTextureMemory() const ; LLGLenum getPrimaryFormat() const; BOOL getIsAlphaMask() const ; LLTexUnit::eTextureType getTarget(void) const ; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index ab875141c57dc2469744344242ab797daecc2405..ddf38c674567b9d78f6a2ca1891d8b7245afc7eb 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -32,6 +32,7 @@ #include "llimagegl.h" #include "llerror.h" +#include "llfasttimer.h" #include "llimage.h" #include "llmath.h" @@ -50,9 +51,9 @@ U32 wpo2(U32 i); U32 LLImageGL::sUniqueCount = 0; U32 LLImageGL::sBindCount = 0; -S32 LLImageGL::sGlobalTextureMemoryInBytes = 0; -S32 LLImageGL::sBoundTextureMemoryInBytes = 0; -S32 LLImageGL::sCurBoundTextureMemory = 0; +S32Bytes LLImageGL::sGlobalTextureMemory(0); +S32Bytes LLImageGL::sBoundTextureMemory(0); +S32Bytes LLImageGL::sCurBoundTextureMemory(0); S32 LLImageGL::sCount = 0; BOOL LLImageGL::sGlobalUseAnisotropic = FALSE; @@ -114,7 +115,7 @@ void LLImageGL::checkTexSize(bool forced) const BOOL error = FALSE; if (texname != mTexName) { - llinfos << "Bound: " << texname << " Should bind: " << mTexName << " Default: " << LLImageGL::sDefaultGLTexture->getTexName() << llendl; + LL_INFOS() << "Bound: " << texname << " Should bind: " << mTexName << " Default: " << LLImageGL::sDefaultGLTexture->getTexName() << LL_ENDL; error = TRUE; if (gDebugSession) @@ -123,7 +124,7 @@ void LLImageGL::checkTexSize(bool forced) const } else { - llerrs << "Invalid texture bound!" << llendl; + LL_ERRS() << "Invalid texture bound!" << LL_ENDL; } } stop_glerror() ; @@ -147,8 +148,8 @@ void LLImageGL::checkTexSize(bool forced) const } else { - llerrs << "wrong texture size and discard level: width: " << - mWidth << " Height: " << mHeight << " Current Level: " << (S32)mCurrentDiscardLevel << llendl ; + LL_ERRS() << "wrong texture size and discard level: width: " << + mWidth << " Height: " << mHeight << " Current Level: " << (S32)mCurrentDiscardLevel << LL_ENDL ; } } @@ -197,7 +198,7 @@ S32 LLImageGL::dataFormatBits(S32 dataformat) case GL_RGBA: return 32; case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac default: - llerrs << "LLImageGL::Unknown format: " << dataformat << llendl; + LL_ERRS() << "LLImageGL::Unknown format: " << dataformat << LL_ENDL; return 0; } } @@ -232,28 +233,28 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat) case GL_RGBA: return 4; case GL_BGRA: return 4; // Used for QuickTime media textures on the Mac default: - llerrs << "LLImageGL::Unknown format: " << dataformat << llendl; + LL_ERRS() << "LLImageGL::Unknown format: " << dataformat << LL_ENDL; return 0; } } //---------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_STATS("Image Stats"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_STATS("Image Stats"); // static void LLImageGL::updateStats(F32 current_time) { - LLFastTimer t(FTM_IMAGE_UPDATE_STATS); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_STATS); sLastFrameTime = current_time; - sBoundTextureMemoryInBytes = sCurBoundTextureMemory; - sCurBoundTextureMemory = 0; + sBoundTextureMemory = sCurBoundTextureMemory; + sCurBoundTextureMemory = S32Bytes(0); } //static -S32 LLImageGL::updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category) +S32 LLImageGL::updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) { LLImageGL::sCurBoundTextureMemory += mem ; - return LLImageGL::sCurBoundTextureMemory; + return LLImageGL::sCurBoundTextureMemory.value(); } //---------------------------------------------------------------------------- @@ -276,8 +277,10 @@ void LLImageGL::destroyGL(BOOL save_state) if (save_state && glimage->isGLTextureCreated() && glimage->mComponents) { glimage->mSaveData = new LLImageRaw; + glimage->claimMem(glimage->mSaveData); if(!glimage->readBackRaw(glimage->mCurrentDiscardLevel, glimage->mSaveData, false)) //necessary, keep it. { + glimage->disclaimMem(glimage->mSaveData); glimage->mSaveData = NULL ; } } @@ -298,7 +301,7 @@ void LLImageGL::restoreGL() LLImageGL* glimage = *iter; if(glimage->getTexName()) { - llerrs << "tex name is not 0." << llendl ; + LL_ERRS() << "tex name is not 0." << LL_ENDL ; } if (glimage->mSaveData.notNull()) { @@ -351,7 +354,8 @@ BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, B //---------------------------------------------------------------------------- LLImageGL::LLImageGL(BOOL usemipmaps) - : mSaveData(0) +: LLTrace::MemTrackable<LLImageGL>("LLImageGL"), + mSaveData(0) { init(usemipmaps); setSize(0, 0, 0); @@ -360,7 +364,8 @@ LLImageGL::LLImageGL(BOOL usemipmaps) } LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) - : mSaveData(0) +: LLTrace::MemTrackable<LLImageGL>("LLImageGL"), + mSaveData(0) { llassert( components <= 4 ); init(usemipmaps); @@ -370,7 +375,8 @@ LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) } LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps) - : mSaveData(0) +: LLTrace::MemTrackable<LLImageGL>("LLImageGL"), + mSaveData(0) { init(usemipmaps); setSize(0, 0, 0); @@ -384,6 +390,7 @@ LLImageGL::~LLImageGL() { LLImageGL::cleanup(); sImageList.erase(this); + disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8); delete [] mPickMask; mPickMask = NULL; sCount--; @@ -395,7 +402,7 @@ void LLImageGL::init(BOOL usemipmaps) // so that it is obvious by visual inspection if we forgot to // init a field. - mTextureMemory = 0; + mTextureMemory = (S32Bytes)0; mLastBindTime = 0.f; mPickMask = NULL; @@ -487,16 +494,17 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents, S32 discard_leve // Check if dimensions are a power of two! if (!checkSize(width,height)) { - llerrs << llformat("Texture has non power of two dimension: %dx%d",width,height) << llendl; + LL_ERRS() << llformat("Texture has non power of two dimension: %dx%d",width,height) << LL_ENDL; } if (mTexName) { -// llwarns << "Setting Size of LLImageGL with existing mTexName = " << mTexName << llendl; +// LL_WARNS() << "Setting Size of LLImageGL with existing mTexName = " << mTexName << LL_ENDL; destroyGLTexture(); } // pickmask validity depends on old image size, delete it + disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8); delete [] mPickMask; mPickMask = NULL; mPickMaskWidth = mPickMaskHeight = 0; @@ -531,7 +539,7 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents, S32 discard_leve // virtual void LLImageGL::dump() { - llinfos << "mMaxDiscardLevel " << S32(mMaxDiscardLevel) + LL_INFOS() << "mMaxDiscardLevel " << S32(mMaxDiscardLevel) << " mLastBindTime " << mLastBindTime << " mTarget " << S32(mTarget) << " mBindTarget " << S32(mBindTarget) @@ -546,12 +554,12 @@ void LLImageGL::dump() #if DEBUG_MISS << " mMissed " << mMissed #endif - << llendl; + << LL_ENDL; - llinfos << " mTextureMemory " << mTextureMemory + LL_INFOS() << " mTextureMemory " << mTextureMemory << " mTexNames " << mTexName << " mIsResident " << S32(mIsResident) - << llendl; + << LL_ENDL; } //---------------------------------------------------------------------------- @@ -560,7 +568,7 @@ void LLImageGL::forceUpdateBindStats(void) const mLastBindTime = sLastFrameTime; } -BOOL LLImageGL::updateBindStats(S32 tex_mem) const +BOOL LLImageGL::updateBindStats(S32Bytes tex_mem) const { if (mTexName != 0) { @@ -613,10 +621,10 @@ void LLImageGL::setImage(const LLImageRaw* imageraw) setImage(rawdata, FALSE); } -static LLFastTimer::DeclareTimer FTM_SET_IMAGE("setImage"); +static LLTrace::BlockTimerStatHandle FTM_SET_IMAGE("setImage"); void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) { - LLFastTimer t(FTM_SET_IMAGE); + LL_RECORD_BLOCK_TIME(FTM_SET_IMAGE); bool is_compressed = false; if (mFormatPrimary >= GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && mFormatPrimary <= GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) { @@ -668,7 +676,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) } else { -// LLFastTimer t2(FTM_TEMP4); +// LL_RECORD_BLOCK_TIME(FTM_TEMP4); if(mFormatSwapBytes) { @@ -700,7 +708,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) { stop_glerror(); { -// LLFastTimer t2(FTM_TEMP4); +// LL_RECORD_BLOCK_TIME(FTM_TEMP4); if(mFormatSwapBytes) { @@ -797,7 +805,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) llassert(w > 0 && h > 0 && cur_mip_data); (void)cur_mip_data; { -// LLFastTimer t1(FTM_TEMP4); +// LL_RECORD_BLOCK_TIME(FTM_TEMP4); if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); @@ -838,7 +846,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) } else { - llerrs << "Compressed Image has mipmaps but data does not (can not auto generate compressed mips)" << llendl; + LL_ERRS() << "Compressed Image has mipmaps but data does not (can not auto generate compressed mips)" << LL_ENDL; } } else @@ -887,7 +895,7 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) if (gGLManager.mIsDisabled) { - llwarns << "Trying to create a texture while GL is disabled!" << llendl; + LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; return FALSE; } llassert(gGLManager.mInited); @@ -933,7 +941,7 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) mFormatType = GL_UNSIGNED_BYTE; break; default: - llerrs << "Bad number of components for texture: " << (U32)getComponents() << llendl; + LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL; } } @@ -977,13 +985,13 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 if (mTexName == 0) { // *TODO: Re-enable warning? Ran into thread locking issues? DK 2011-02-18 - //llwarns << "Setting subimage on image without GL texture" << llendl; + //LL_WARNS() << "Setting subimage on image without GL texture" << LL_ENDL; return FALSE; } if (datap == NULL) { // *TODO: Re-enable warning? Ran into thread locking issues? DK 2011-02-18 - //llwarns << "Setting subimage on image with NULL datap" << llendl; + //LL_WARNS() << "Setting subimage on image with NULL datap" << LL_ENDL; return FALSE; } @@ -997,7 +1005,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 if (mUseMipMaps) { dump(); - llerrs << "setSubImage called with mipmapped image (not supported)" << llendl; + LL_ERRS() << "setSubImage called with mipmapped image (not supported)" << LL_ENDL; } llassert_always(mCurrentDiscardLevel == 0); llassert_always(x_pos >= 0 && y_pos >= 0); @@ -1006,28 +1014,28 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 (y_pos + height) > getHeight()) { dump(); - llerrs << "Subimage not wholly in target image!" + LL_ERRS() << "Subimage not wholly in target image!" << " x_pos " << x_pos << " y_pos " << y_pos << " width " << width << " height " << height << " getWidth() " << getWidth() << " getHeight() " << getHeight() - << llendl; + << LL_ENDL; } if ((x_pos + width) > data_width || (y_pos + height) > data_height) { dump(); - llerrs << "Subimage not wholly in source image!" + LL_ERRS() << "Subimage not wholly in source image!" << " x_pos " << x_pos << " y_pos " << y_pos << " width " << width << " height " << height << " source_width " << data_width << " source_height " << data_height - << llendl; + << LL_ENDL; } @@ -1043,7 +1051,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 datap += (y_pos * data_width + x_pos) * getComponents(); // Update the GL texture BOOL res = gGL.getTexUnit(0)->bindManual(mBindTarget, mTexName); - if (!res) llerrs << "LLImageGL::setSubImage(): bindTexture failed" << llendl; + if (!res) LL_ERRS() << "LLImageGL::setSubImage(): bindTexture failed" << LL_ENDL; stop_glerror(); glTexSubImage2D(mTarget, 0, x_pos, y_pos, @@ -1086,10 +1094,10 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_ } // static -static LLFastTimer::DeclareTimer FTM_GENERATE_TEXTURES("generate textures"); +static LLTrace::BlockTimerStatHandle FTM_GENERATE_TEXTURES("generate textures"); void LLImageGL::generateTextures(S32 numTextures, U32 *textures) { - LLFastTimer t(FTM_GENERATE_TEXTURES); + LL_RECORD_BLOCK_TIME(FTM_GENERATE_TEXTURES); glGenTextures(numTextures, textures); } @@ -1103,10 +1111,10 @@ void LLImageGL::deleteTextures(S32 numTextures, U32 *textures) } // static -static LLFastTimer::DeclareTimer FTM_SET_MANUAL_IMAGE("setManualImage"); +static LLTrace::BlockTimerStatHandle FTM_SET_MANUAL_IMAGE("setManualImage"); void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels, bool allow_compression) { - LLFastTimer t(FTM_SET_MANUAL_IMAGE); + LL_RECORD_BLOCK_TIME(FTM_SET_MANUAL_IMAGE); bool use_scratch = false; U32* scratch = NULL; if (LLRender::sGLCoreProfile) @@ -1193,7 +1201,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt intformat = GL_COMPRESSED_ALPHA; break; default: - llwarns << "Could not compress format: " << std::hex << intformat << llendl; + LL_WARNS() << "Could not compress format: " << std::hex << intformat << LL_ENDL; break; } } @@ -1210,13 +1218,13 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt //create an empty GL texture: just create a texture name //the texture is assiciate with some image by calling glTexImage outside LLImageGL -static LLFastTimer::DeclareTimer FTM_CREATE_GL_TEXTURE1("createGLTexture()"); +static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE1("createGLTexture()"); BOOL LLImageGL::createGLTexture() { - LLFastTimer t(FTM_CREATE_GL_TEXTURE1); + LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE1); if (gGLManager.mIsDisabled) { - llwarns << "Trying to create a texture while GL is disabled!" << llendl; + LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; return FALSE; } @@ -1235,19 +1243,19 @@ BOOL LLImageGL::createGLTexture() stop_glerror(); if (!mTexName) { - llerrs << "LLImageGL::createGLTexture failed to make an empty texture" << llendl; + LL_ERRS() << "LLImageGL::createGLTexture failed to make an empty texture" << LL_ENDL; } return TRUE ; } -static LLFastTimer::DeclareTimer FTM_CREATE_GL_TEXTURE2("createGLTexture(raw)"); +static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE2("createGLTexture(raw)"); BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/, BOOL to_create, S32 category) { - LLFastTimer t(FTM_CREATE_GL_TEXTURE2); + LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE2); if (gGLManager.mIsDisabled) { - llwarns << "Trying to create a texture while GL is disabled!" << llendl; + LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; return FALSE; } @@ -1297,7 +1305,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S mFormatType = GL_UNSIGNED_BYTE; break; default: - llerrs << "Bad number of components for texture: " << (U32)getComponents() << llendl; + LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL; } calcAlphaChannelOffsetAndStride() ; @@ -1316,10 +1324,10 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S return createGLTexture(discard_level, rawdata, FALSE, usename); } -static LLFastTimer::DeclareTimer FTM_CREATE_GL_TEXTURE3("createGLTexture3(data)"); +static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE3("createGLTexture3(data)"); BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename) { - LLFastTimer t(FTM_CREATE_GL_TEXTURE3); + LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE3); llassert(data_in); stop_glerror(); @@ -1359,7 +1367,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ } if (!mTexName) { - llerrs << "LLImageGL::createGLTexture failed to make texture" << llendl; + LL_ERRS() << "LLImageGL::createGLTexture failed to make texture" << LL_ENDL; } if (mUseMipMaps) @@ -1389,15 +1397,17 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ if (old_name != 0) { - sGlobalTextureMemoryInBytes -= mTextureMemory; + sGlobalTextureMemory -= mTextureMemory; LLImageGL::deleteTextures(1, &old_name); stop_glerror(); } - mTextureMemory = getMipBytes(discard_level); - sGlobalTextureMemoryInBytes += mTextureMemory; + disclaimMem(mTextureMemory); + mTextureMemory = (S32Bytes)getMipBytes(discard_level); + claimMem(mTextureMemory); + sGlobalTextureMemory += mTextureMemory; mTexelsInGLTexture = getWidth() * getHeight() ; // mark this as bound at this point, so we don't throw it out immediately @@ -1408,7 +1418,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) const { llassert_always(sAllowReadBackRaw) ; - //llerrs << "should not call this function!" << llendl ; + //LL_ERRS() << "should not call this function!" << LL_ENDL ; if (discard_level < 0) { @@ -1446,15 +1456,15 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre } if(width < glwidth) { - llwarns << "texture size is smaller than it should be." << llendl ; - llwarns << "width: " << width << " glwidth: " << glwidth << " mWidth: " << mWidth << - " mCurrentDiscardLevel: " << (S32)mCurrentDiscardLevel << " discard_level: " << (S32)discard_level << llendl ; + LL_WARNS() << "texture size is smaller than it should be." << LL_ENDL ; + LL_WARNS() << "width: " << width << " glwidth: " << glwidth << " mWidth: " << mWidth << + " mCurrentDiscardLevel: " << (S32)mCurrentDiscardLevel << " discard_level: " << (S32)discard_level << LL_ENDL ; return FALSE ; } if (width <= 0 || width > 2048 || height <= 0 || height > 2048 || ncomponents < 1 || ncomponents > 4) { - llerrs << llformat("LLImageGL::readBackRaw: bogus params: %d x %d x %d",width,height,ncomponents) << llendl; + LL_ERRS() << llformat("LLImageGL::readBackRaw: bogus params: %d x %d x %d",width,height,ncomponents) << LL_ENDL; } LLGLint is_compressed = 0; @@ -1467,7 +1477,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre GLenum error ; while((error = glGetError()) != GL_NO_ERROR) { - llwarns << "GL Error happens before reading back texture. Error code: " << error << llendl ; + LL_WARNS() << "GL Error happens before reading back texture. Error code: " << error << LL_ENDL ; } //----------------------------------------------------------------------------------------------- @@ -1477,8 +1487,8 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, (GLint*)&glbytes); if(!imageraw->allocateDataSize(width, height, ncomponents, glbytes)) { - llwarns << "Memory allocation failed for reading back texture. Size is: " << glbytes << llendl ; - llwarns << "width: " << width << "height: " << height << "components: " << ncomponents << llendl ; + LL_WARNS() << "Memory allocation failed for reading back texture. Size is: " << glbytes << LL_ENDL ; + LL_WARNS() << "width: " << width << "height: " << height << "components: " << ncomponents << LL_ENDL ; return FALSE ; } @@ -1489,8 +1499,8 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre { if(!imageraw->allocateDataSize(width, height, ncomponents)) { - llwarns << "Memory allocation failed for reading back texture." << llendl ; - llwarns << "width: " << width << "height: " << height << "components: " << ncomponents << llendl ; + LL_WARNS() << "Memory allocation failed for reading back texture." << LL_ENDL ; + LL_WARNS() << "width: " << width << "height: " << height << "components: " << ncomponents << LL_ENDL ; return FALSE ; } @@ -1501,12 +1511,12 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre //----------------------------------------------------------------------------------------------- if((error = glGetError()) != GL_NO_ERROR) { - llwarns << "GL Error happens after reading back texture. Error code: " << error << llendl ; + LL_WARNS() << "GL Error happens after reading back texture. Error code: " << error << LL_ENDL ; imageraw->deleteData() ; while((error = glGetError()) != GL_NO_ERROR) { - llwarns << "GL Error happens after reading back texture. Error code: " << error << llendl ; + LL_WARNS() << "GL Error happens after reading back texture. Error code: " << error << LL_ENDL ; } return FALSE ; @@ -1530,10 +1540,11 @@ void LLImageGL::destroyGLTexture() { if (mTexName != 0) { - if(mTextureMemory) + if(mTextureMemory != S32Bytes(0)) { - sGlobalTextureMemoryInBytes -= mTextureMemory; - mTextureMemory = 0; + sGlobalTextureMemory -= mTextureMemory; + disclaimMem(mTextureMemory); + mTextureMemory = (S32Bytes)0; } LLImageGL::deleteTextures(1, &mTexName); @@ -1766,7 +1777,7 @@ void LLImageGL::calcAlphaChannelOffsetAndStride() mAlphaOffset < 0 || //unsupported type (mFormatPrimary == GL_BGRA_EXT && mFormatType != GL_UNSIGNED_BYTE)) //unknown situation { - llwarns << "Cannot analyze alpha for image with format type " << std::hex << mFormatType << std::dec << llendl; + LL_WARNS() << "Cannot analyze alpha for image with format type " << std::hex << mFormatType << std::dec << LL_ENDL; mNeedsAlphaAndPickMask = FALSE ; mIsMask = FALSE; @@ -1882,6 +1893,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) return ; } + disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8); delete [] mPickMask; mPickMask = NULL; mPickMaskWidth = mPickMaskHeight = 0; @@ -1899,6 +1911,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) U32 size = pick_width * pick_height; size = (size + 7) / 8; // pixelcount-to-bits mPickMask = new U8[size]; + claimMem(size); mPickMaskWidth = pick_width - 1; mPickMaskHeight = pick_height - 1; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 0c62dd0d3326f677a91343fda0f5d187ca6a9081..6ca814af6fc6732bcbe174cdfc1d634d84bcb2b5 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -34,6 +34,7 @@ #include "llpointer.h" #include "llrefcount.h" #include "v2math.h" +#include "llunits.h" #include "llrender.h" class LLTextureAtlas ; @@ -41,7 +42,7 @@ class LLTextureAtlas ; #define MEGA_BYTES_TO_BYTES(x) ((x) << 20) //============================================================================ -class LLImageGL : public LLRefCount +class LLImageGL : public LLRefCount, public LLTrace::MemTrackable<LLImageGL> { friend class LLTexUnit; public: @@ -55,7 +56,7 @@ class LLImageGL : public LLRefCount static S32 dataFormatBytes(S32 dataformat, S32 width, S32 height); static S32 dataFormatComponents(S32 dataformat); - BOOL updateBindStats(S32 tex_mem) const ; + BOOL updateBindStats(S32Bytes tex_mem) const ; F32 getTimePassedSinceLastBound(); void forceUpdateBindStats(void) const; @@ -68,7 +69,7 @@ class LLImageGL : public LLRefCount static void dirtyTexOptions(); // Sometimes called externally for textures not using LLImageGL (should go away...) - static S32 updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category) ; + static S32 updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) ; static bool checkSize(S32 width, S32 height); @@ -91,7 +92,7 @@ class LLImageGL : public LLRefCount void calcAlphaChannelOffsetAndStride(); public: - virtual void dump(); // debugging info to llinfos + virtual void dump(); // debugging info to LL_INFOS() void setSize(S32 width, S32 height, S32 ncomponents, S32 discard_level = -1); void setComponents(S32 ncomponents) { mComponents = (S8)ncomponents ;} @@ -181,7 +182,7 @@ class LLImageGL : public LLRefCount public: // Various GL/Rendering options - S32 mTextureMemory; + S32Bytes mTextureMemory; mutable F32 mLastBindTime; // last time this was bound, by discard level private: @@ -238,9 +239,9 @@ class LLImageGL : public LLRefCount static F32 sLastFrameTime; // Global memory statistics - static S32 sGlobalTextureMemoryInBytes; // Tracks main memory texmem - static S32 sBoundTextureMemoryInBytes; // Tracks bound texmem for last completed frame - static S32 sCurBoundTextureMemory; // Tracks bound texmem for current frame + static S32Bytes sGlobalTextureMemory; // Tracks main memory texmem + static S32Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame + static S32Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame static U32 sBindCount; // Tracks number of texture binds for current frame static U32 sUniqueCount; // Tracks number of unique texture binds for current frame static BOOL sGlobalUseAnisotropic; diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index 4c36185b08abe7a23670407a444c7104ed65a05f..a95bb7027b2ff387b8ef12d5ee8300a1e46c57be 100755 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -73,7 +73,7 @@ LLPostProcess::LLPostProcess(void) : /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); - LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; + LL_DEBUGS("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; llifstream effectsXML(pathName); @@ -160,7 +160,7 @@ void LLPostProcess::saveEffect(std::string const & effectName) mAllEffects[effectName] = tweaks; std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); - //llinfos << "Saving PostProcess Effects settings to " << pathName << llendl; + //LL_INFOS() << "Saving PostProcess Effects settings to " << pathName << LL_ENDL; llofstream effectsXML(pathName); diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index b481cf7095e15c821d2018a1403902f11d120356..388d3a4f1acca5e87c8d7ecd0321b66a2ea073b1 100755 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -266,7 +266,7 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) } else { - llwarns << "NULL LLTexUnit::bind texture" << llendl; + LL_WARNS() << "NULL LLTexUnit::bind texture" << LL_ENDL; return false; } } @@ -285,7 +285,7 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) if(!texture) { - llwarns << "NULL LLTexUnit::bind texture" << llendl; + LL_WARNS() << "NULL LLTexUnit::bind texture" << LL_ENDL; return false; } @@ -335,7 +335,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) if (cubeMap == NULL) { - llwarns << "NULL LLTexUnit::bind cubemap" << llendl; + LL_WARNS() << "NULL LLTexUnit::bind cubemap" << LL_ENDL; return false; } @@ -359,7 +359,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) } else { - llwarns << "Using cube map without extension!" << llendl; + LL_WARNS() << "Using cube map without extension!" << LL_ENDL; return false; } } @@ -377,7 +377,7 @@ bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) { if (renderTarget->hasStencil()) { - llerrs << "Cannot bind a render buffer for sampling. Allocate render target without a stencil buffer if sampling of depth buffer is required." << llendl; + LL_ERRS() << "Cannot bind a render buffer for sampling. Allocate render target without a stencil buffer if sampling of depth buffer is required." << LL_ENDL; } bindManual(renderTarget->getUsage(), renderTarget->getDepth()); @@ -503,7 +503,7 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio { glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gGL.mMaxAnisotropy); - llinfos << "gGL.mMaxAnisotropy: " << gGL.mMaxAnisotropy << llendl ; + LL_INFOS() << "gGL.mMaxAnisotropy: " << gGL.mMaxAnisotropy << LL_ENDL ; gGL.mMaxAnisotropy = llmax(1.f, gGL.mMaxAnisotropy) ; } glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, gGL.mMaxAnisotropy); @@ -557,7 +557,7 @@ void LLTexUnit::setTextureBlendType(eTextureBlendType type) glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); break; default: - llerrs << "Unknown Texture Blend Type: " << type << llendl; + LL_ERRS() << "Unknown Texture Blend Type: " << type << LL_ENDL; break; } setColorScale(scale_amount); @@ -597,7 +597,7 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src) return GL_CONSTANT_ARB; default: - llwarns << "Unknown eTextureBlendSrc: " << src << ". Using Vertex Color instead." << llendl; + LL_WARNS() << "Unknown eTextureBlendSrc: " << src << ". Using Vertex Color instead." << LL_ENDL; return GL_PRIMARY_COLOR_ARB; } } @@ -635,7 +635,7 @@ GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha) return GL_ONE_MINUS_SRC_ALPHA; default: - llwarns << "Unknown eTextureBlendSrc: " << src << ". Using Source Color or Alpha instead." << llendl; + LL_WARNS() << "Unknown eTextureBlendSrc: " << src << ". Using Source Color or Alpha instead." << LL_ENDL; return (isAlpha) ? GL_SRC_ALPHA: GL_SRC_COLOR; } } @@ -776,7 +776,7 @@ void LLTexUnit::setTextureCombiner(eTextureBlendOp op, eTextureBlendSrc src1, eT break; default: - llwarns << "Unknown eTextureBlendOp: " << op << ". Setting op to replace." << llendl; + LL_WARNS() << "Unknown eTextureBlendOp: " << op << ". Setting op to replace." << LL_ENDL; // Slightly special syntax (no second sources), just set all and return. glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_REPLACE); glTexEnvi(GL_TEXTURE_ENV, src0_enum, source1); @@ -824,7 +824,7 @@ void LLTexUnit::debugTextureUnit(void) if ((GL_TEXTURE0_ARB + mIndex) != activeTexture) { U32 set_unit = (activeTexture - GL_TEXTURE0_ARB); - llwarns << "Incorrect Texture Unit! Expected: " << set_unit << " Actual: " << mIndex << llendl; + LL_WARNS() << "Incorrect Texture Unit! Expected: " << set_unit << " Actual: " << mIndex << LL_ENDL; } } @@ -1403,7 +1403,7 @@ void LLRender::pushMatrix() } else { - llwarns << "Matrix stack overflow." << llendl; + LL_WARNS() << "Matrix stack overflow." << LL_ENDL; } } } @@ -1419,7 +1419,7 @@ void LLRender::popMatrix() } else { - llwarns << "Matrix stack underflow." << llendl; + LL_WARNS() << "Matrix stack underflow." << LL_ENDL; } } } @@ -1492,7 +1492,7 @@ void LLRender::translateUI(F32 x, F32 y, F32 z) { if (mUIOffset.empty()) { - llerrs << "Need to push a UI translation frame before offsetting" << llendl; + LL_ERRS() << "Need to push a UI translation frame before offsetting" << LL_ENDL; } mUIOffset.back().mV[0] += x; @@ -1504,7 +1504,7 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z) { if (mUIScale.empty()) { - llerrs << "Need to push a UI transformation frame before scaling." << llendl; + LL_ERRS() << "Need to push a UI transformation frame before scaling." << LL_ENDL; } mUIScale.back().scaleVec(LLVector3(x,y,z)); @@ -1535,7 +1535,7 @@ void LLRender::popUIMatrix() { if (mUIOffset.empty()) { - llerrs << "UI offset stack blown." << llendl; + LL_ERRS() << "UI offset stack blown." << LL_ENDL; } mUIOffset.pop_back(); mUIScale.pop_back(); @@ -1564,7 +1564,7 @@ void LLRender::loadUIIdentity() { if (mUIOffset.empty()) { - llerrs << "Need to push UI translation frame before clearing offset." << llendl; + LL_ERRS() << "Need to push UI translation frame before clearing offset." << LL_ENDL; } mUIOffset.back().setVec(0,0,0); mUIScale.back().setVec(1,1,1); @@ -1622,7 +1622,7 @@ void LLRender::setSceneBlendType(eBlendType type) blendFunc(BF_ONE, BF_ZERO); break; default: - llerrs << "Unknown Scene Blend Type: " << type << llendl; + LL_ERRS() << "Unknown Scene Blend Type: " << type << LL_ENDL; break; } } @@ -1663,7 +1663,7 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value) if (cur_func != sGLCompareFunc[func]) { - llerrs << "Alpha test function corrupted!" << llendl; + LL_ERRS() << "Alpha test function corrupted!" << LL_ENDL; } F32 ref = 0.f; @@ -1671,7 +1671,7 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value) if (ref != value) { - llerrs << "Alpha test value corrupted!" << llendl; + LL_ERRS() << "Alpha test value corrupted!" << LL_ENDL; } } } @@ -1701,7 +1701,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor, llassert(alpha_dfactor < BF_UNDEF); if (!gGLManager.mHasBlendFuncSeparate) { - LL_WARNS_ONCE("render") << "no glBlendFuncSeparateEXT(), using color-only blend func" << llendl; + LL_WARNS_ONCE("render") << "no glBlendFuncSeparateEXT(), using color-only blend func" << LL_ENDL; blendFunc(color_sfactor, color_dfactor); return; } @@ -1726,7 +1726,7 @@ LLTexUnit* LLRender::getTexUnit(U32 index) } else { - lldebugs << "Non-existing texture unit layer requested: " << index << llendl; + LL_DEBUGS() << "Non-existing texture unit layer requested: " << index << LL_ENDL; return mDummyTexUnit; } } @@ -1762,7 +1762,7 @@ bool LLRender::verifyTexUnitActive(U32 unitToVerify) } else { - llwarns << "TexUnit currently active: " << mCurrTextureUnitIndex << " (expecting " << unitToVerify << ")" << llendl; + LL_WARNS() << "TexUnit currently active: " << mCurrTextureUnitIndex << " (expecting " << unitToVerify << ")" << LL_ENDL; return false; } } @@ -1793,7 +1793,7 @@ void LLRender::begin(const GLuint& mode) } else if (mCount != 0) { - llerrs << "gGL.begin() called redundantly." << llendl; + LL_ERRS() << "gGL.begin() called redundantly." << LL_ENDL; } mMode = mode; @@ -1805,7 +1805,7 @@ void LLRender::end() if (mCount == 0) { return; - //IMM_ERRS << "GL begin and end called with no vertices specified." << llendl; + //IMM_ERRS << "GL begin and end called with no vertices specified." << LL_ENDL; } if ((mMode != LLRender::QUADS && @@ -1824,22 +1824,22 @@ void LLRender::flush() #if 0 if (!glIsEnabled(GL_VERTEX_ARRAY)) { - llerrs << "foo 1" << llendl; + LL_ERRS() << "foo 1" << LL_ENDL; } if (!glIsEnabled(GL_COLOR_ARRAY)) { - llerrs << "foo 2" << llendl; + LL_ERRS() << "foo 2" << LL_ENDL; } if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY)) { - llerrs << "foo 3" << llendl; + LL_ERRS() << "foo 3" << LL_ENDL; } if (glIsEnabled(GL_NORMAL_ARRAY)) { - llerrs << "foo 7" << llendl; + LL_ERRS() << "foo 7" << LL_ENDL; } GLvoid* pointer; @@ -1847,19 +1847,19 @@ void LLRender::flush() glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].v)) { - llerrs << "foo 4" << llendl; + LL_ERRS() << "foo 4" << LL_ENDL; } glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].c)) { - llerrs << "foo 5" << llendl; + LL_ERRS() << "foo 5" << LL_ENDL; } glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].uv)) { - llerrs << "foo 6" << llendl; + LL_ERRS() << "foo 6" << LL_ENDL; } #endif @@ -1877,7 +1877,7 @@ void LLRender::flush() if (mCount%4 != 0) { count -= (mCount % 4); - llwarns << "Incomplete quad requested." << llendl; + LL_WARNS() << "Incomplete quad requested." << LL_ENDL; } } @@ -1886,7 +1886,7 @@ void LLRender::flush() if (mCount%3 != 0) { count -= (mCount % 3); - llwarns << "Incomplete triangle requested." << llendl; + LL_WARNS() << "Incomplete triangle requested." << LL_ENDL; } } @@ -1895,7 +1895,7 @@ void LLRender::flush() if (mCount%2 != 0) { count -= (mCount % 2); - llwarns << "Incomplete line requested." << llendl; + LL_WARNS() << "Incomplete line requested." << LL_ENDL; } } @@ -1945,7 +1945,7 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) if (mCount > 4094) { - // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + // LL_WARNS() << "GL immediate mode overflow. Some geometry not drawn." << LL_ENDL; return; } @@ -1988,7 +1988,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count) { if (mCount + vert_count > 4094) { - // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + // LL_WARNS() << "GL immediate mode overflow. Some geometry not drawn." << LL_ENDL; return; } @@ -2045,7 +2045,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 v { if (mCount + vert_count > 4094) { - // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + // LL_WARNS() << "GL immediate mode overflow. Some geometry not drawn." << LL_ENDL; return; } @@ -2103,7 +2103,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLCol { if (mCount + vert_count > 4094) { - // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + // LL_WARNS() << "GL immediate mode overflow. Some geometry not drawn." << LL_ENDL; return; } diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index d3cfbaf03a7bb05046ac2265e36fdf45384c5732..df5d79a43632db28e307ece2cbe03b25c79f2246 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -35,6 +35,7 @@ #include "llrect.h" #include "llgl.h" #include "lltexture.h" +#include "llfasttimer.h" // Project includes #include "llrender2dutils.h" @@ -347,27 +348,32 @@ void gl_draw_image( S32 x, S32 y, LLTexture* image, const LLColor4& color, const { if (NULL == image) { - llwarns << "image == NULL; aborting function" << llendl; + LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; return; } gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), 0.f, image, color, uv_rect ); } +void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color, const LLRectf& uv_rect) +{ + gl_draw_scaled_rotated_image(x, y, width, height, 0.f, NULL, color, uv_rect, target); +} + void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) { if (NULL == image) { - llwarns << "image == NULL; aborting function" << llendl; + LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; return; } gl_draw_scaled_rotated_image( x, y, width, height, 0.f, image, color, uv_rect ); } -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect) +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect, bool scale_inner) { if (NULL == image) { - llwarns << "image == NULL; aborting function" << llendl; + LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; return; } @@ -376,250 +382,273 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border F32 border_height_fraction = (F32)border_height / (F32)image->getHeight(0); LLRectf scale_rect(border_width_fraction, 1.f - border_height_fraction, 1.f - border_width_fraction, border_height_fraction); - gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect); + gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect, scale_inner); } -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect) +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect, bool scale_inner) { stop_glerror(); if (NULL == image) { - llwarns << "image == NULL; aborting function" << llendl; + LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; return; } - // add in offset of current image to current UI translation - const LLVector3 ui_scale = gGL.getUIScale(); - const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); - - F32 uv_width = uv_outer_rect.getWidth(); - F32 uv_height = uv_outer_rect.getHeight(); - - // shrink scaling region to be proportional to clipped image region - LLRectf uv_center_rect( - uv_outer_rect.mLeft + (center_rect.mLeft * uv_width), - uv_outer_rect.mBottom + (center_rect.mTop * uv_height), - uv_outer_rect.mLeft + (center_rect.mRight * uv_width), - uv_outer_rect.mBottom + (center_rect.mBottom * uv_height)); - - F32 image_width = image->getWidth(0); - F32 image_height = image->getHeight(0); + if (solid_color) + { + if (LLGLSLShader::sNoFixedFunction) + { + gSolidColorProgram.bind(); + } + else + { + gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); + gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA); + } + } - S32 image_natural_width = llround(image_width * uv_width); - S32 image_natural_height = llround(image_height * uv_height); + if (center_rect.mLeft == 0.f + && center_rect.mRight == 1.f + && center_rect.mBottom == 0.f + && center_rect.mTop == 1.f) + { + gl_draw_scaled_image(x, y, width, height, image, color, uv_outer_rect); + } + else + { + // add in offset of current image to current UI translation + const LLVector3 ui_scale = gGL.getUIScale(); + const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); - LLRectf draw_center_rect( uv_center_rect.mLeft * image_width, - uv_center_rect.mTop * image_height, - uv_center_rect.mRight * image_width, - uv_center_rect.mBottom * image_height); + F32 uv_width = uv_outer_rect.getWidth(); + F32 uv_height = uv_outer_rect.getHeight(); - { // scale fixed region of image to drawn region - draw_center_rect.mRight += width - image_natural_width; - draw_center_rect.mTop += height - image_natural_height; + // shrink scaling region to be proportional to clipped image region + LLRectf uv_center_rect( uv_outer_rect.mLeft + (center_rect.mLeft * uv_width), + uv_outer_rect.mBottom + (center_rect.mTop * uv_height), + uv_outer_rect.mLeft + (center_rect.mRight * uv_width), + uv_outer_rect.mBottom + (center_rect.mBottom * uv_height)); - F32 border_shrink_width = llmax(0.f, draw_center_rect.mLeft - draw_center_rect.mRight); - F32 border_shrink_height = llmax(0.f, draw_center_rect.mBottom - draw_center_rect.mTop); + F32 image_width = image->getWidth(0); + F32 image_height = image->getHeight(0); - F32 shrink_width_ratio = center_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - center_rect.getWidth())); - F32 shrink_height_ratio = center_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - center_rect.getHeight())); + S32 image_natural_width = llround(image_width * uv_width); + S32 image_natural_height = llround(image_height * uv_height); - F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); + LLRectf draw_center_rect( uv_center_rect.mLeft * image_width, + uv_center_rect.mTop * image_height, + uv_center_rect.mRight * image_width, + uv_center_rect.mBottom * image_height); + + if (scale_inner) + { + // scale center region of image to drawn region + draw_center_rect.mRight += width - image_natural_width; + draw_center_rect.mTop += height - image_natural_height; - draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * shrink_scale * ui_scale.mV[VX]); - draw_center_rect.mTop = llround(ui_translation.mV[VY] + lerp((F32)height, (F32)draw_center_rect.mTop, shrink_scale) * ui_scale.mV[VY]); - draw_center_rect.mRight = llround(ui_translation.mV[VX] + lerp((F32)width, (F32)draw_center_rect.mRight, shrink_scale) * ui_scale.mV[VX]); - draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * shrink_scale * ui_scale.mV[VY]); - } + const F32 border_shrink_width = llmax(0.f, draw_center_rect.mLeft - draw_center_rect.mRight); + const F32 border_shrink_height = llmax(0.f, draw_center_rect.mBottom - draw_center_rect.mTop); - LLRectf draw_outer_rect(ui_translation.mV[VX], - ui_translation.mV[VY] + height * ui_scale.mV[VY], - ui_translation.mV[VX] + width * ui_scale.mV[VX], - ui_translation.mV[VY]); + const F32 shrink_width_ratio = center_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - center_rect.getWidth())); + const F32 shrink_height_ratio = center_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - center_rect.getHeight())); - LLGLSUIDefault gls_ui; - - if (solid_color) - { - if (LLGLSLShader::sNoFixedFunction) - { - gSolidColorProgram.bind(); + const F32 border_shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); + draw_center_rect.mLeft *= border_shrink_scale; + draw_center_rect.mTop = lerp((F32)height, (F32)draw_center_rect.mTop, border_shrink_scale); + draw_center_rect.mRight = lerp((F32)width, (F32)draw_center_rect.mRight, border_shrink_scale); + draw_center_rect.mBottom *= border_shrink_scale; } else { - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); - gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA); + // keep center region of image at fixed scale, but in same relative position + F32 scale_factor = llmin((F32)width / draw_center_rect.getWidth(), (F32)height / draw_center_rect.getHeight(), 1.f); + F32 scaled_width = draw_center_rect.getWidth() * scale_factor; + F32 scaled_height = draw_center_rect.getHeight() * scale_factor; + draw_center_rect.setCenterAndSize(uv_center_rect.getCenterX() * width, uv_center_rect.getCenterY() * height, scaled_width, scaled_height); } - } - gGL.getTexUnit(0)->bind(image, true); + draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * ui_scale.mV[VX]); + draw_center_rect.mTop = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mTop * ui_scale.mV[VY]); + draw_center_rect.mRight = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mRight * ui_scale.mV[VX]); + draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * ui_scale.mV[VY]); - gGL.color4fv(color.mV); + LLRectf draw_outer_rect(ui_translation.mV[VX], + ui_translation.mV[VY] + height * ui_scale.mV[VY], + ui_translation.mV[VX] + width * ui_scale.mV[VX], + ui_translation.mV[VY]); + + LLGLSUIDefault gls_ui; + + gGL.getTexUnit(0)->bind(image, true); + + gGL.color4fv(color.mV); - const S32 NUM_VERTICES = 9 * 4; // 9 quads - LLVector2 uv[NUM_VERTICES]; - LLVector3 pos[NUM_VERTICES]; + const S32 NUM_VERTICES = 9 * 4; // 9 quads + LLVector2 uv[NUM_VERTICES]; + LLVector3 pos[NUM_VERTICES]; - S32 index = 0; + S32 index = 0; - gGL.begin(LLRender::QUADS); - { - // draw bottom left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; + gGL.begin(LLRender::QUADS); + { + // draw bottom left + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - // draw bottom middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; + // draw bottom middle + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - // draw bottom right - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; + // draw bottom right + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - // draw left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + // draw left + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - // draw middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + // draw middle + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - // draw right - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + // draw right + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - // draw top left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + // draw top left + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f); + index++; - // draw top middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + // draw top middle + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); + index++; - // draw top right - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + // draw top right + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); + index++; - gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); + gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); + } + gGL.end(); } - gGL.end(); if (solid_color) { @@ -639,18 +668,24 @@ void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LL gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), degrees, image, color, uv_rect ); } -void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) +void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect, LLRenderTarget* target) { - if (NULL == image) + if (!image && !target) { - llwarns << "image == NULL; aborting function" << llendl; + LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; return; } LLGLSUIDefault gls_ui; - - gGL.getTexUnit(0)->bind(image, true); + if(image != NULL) + { + gGL.getTexUnit(0)->bind(image, true); + } + else + { + gGL.getTexUnit(0)->bind(target); + } gGL.color4fv(color.mV); @@ -695,18 +730,25 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre { gGL.pushUIMatrix(); gGL.translateUI((F32)x, (F32)y, 0.f); - + F32 offset_x = F32(width/2); F32 offset_y = F32(height/2); gGL.translateUI(offset_x, offset_y, 0.f); LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); - - gGL.getTexUnit(0)->bind(image, true); + + if(image != NULL) + { + gGL.getTexUnit(0)->bind(image, true); + } + else + { + gGL.getTexUnit(0)->bind(target); + } gGL.color4fv(color.mV); - + gGL.begin(LLRender::QUADS); { LLVector3 v; @@ -732,7 +774,6 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre } } - void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase ) { phase = fmod(phase, 1.f); @@ -1044,6 +1085,8 @@ void gl_rect_2d_simple( S32 width, S32 height ) gGL.end(); } +static LLTrace::BlockTimerStatHandle FTM_RENDER_SEGMENTED_RECT ("Render segmented rectangle"); + void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, @@ -1053,6 +1096,8 @@ void gl_segmented_rect_2d_tex(const S32 left, const S32 border_size, const U32 edges) { + LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT); + S32 width = llabs(right - left); S32 height = llabs(top - bottom); @@ -1202,18 +1247,19 @@ void gl_segmented_rect_2d_tex(const S32 left, gGL.popUIMatrix(); } -//FIXME: rewrite to use scissor? -void gl_segmented_rect_2d_fragment_tex(const S32 left, - const S32 top, - const S32 right, - const S32 bottom, - const S32 texture_width, - const S32 texture_height, - const S32 border_size, - const F32 start_fragment, - const F32 end_fragment, - const U32 edges) +void gl_segmented_rect_2d_fragment_tex(const LLRect& rect, + const S32 texture_width, + const S32 texture_height, + const S32 border_size, + const F32 start_fragment, + const F32 end_fragment, + const U32 edges) { + LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT); + const S32 left = rect.mLeft; + const S32 right = rect.mRight; + const S32 top = rect.mTop; + const S32 bottom = rect.mBottom; S32 width = llabs(right - left); S32 height = llabs(top - bottom); @@ -1251,9 +1297,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, { if (start_fragment < middle_start) { - u_min = (start_fragment / middle_start) * border_uv_scale.mV[VX]; + u_min = (start_fragment / middle_start) * border_uv_scale.mV[VX]; u_max = llmin(end_fragment / middle_start, 1.f) * border_uv_scale.mV[VX]; - x_min = (start_fragment / middle_start) * border_width_left; + x_min = (start_fragment / middle_start) * border_width_left; x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left; // draw bottom left @@ -1281,7 +1327,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); gGL.vertex2fv((x_min + height_vec - border_height_top).mV); - + // draw top left gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]); gGL.vertex2fv((x_min + height_vec - border_height_top).mV); @@ -1343,10 +1389,10 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, if (end_fragment > middle_end) { - u_min = (1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_uv_scale.mV[VX]; - u_max = (1.f - ((end_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]; - x_min = width_vec - ((1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_width_right); - x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right); + u_min = 1.f - ((1.f - llmax(0.f, (start_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]); + u_max = 1.f - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]); + x_min = width_vec - ((1.f - llmax(0.f, (start_fragment - middle_end) / middle_start)) * border_width_right); + x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right); // draw bottom right gGL.texCoord2f(u_min, 0.f); @@ -1396,6 +1442,8 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, const LLVector3& width_vec, const LLVector3& height_vec) { + LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT); + gGL.begin(LLRender::QUADS); { // draw bottom left diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index 4884422c58057df9baad42e9e01ecaef598df9c9..cce3b4ed511154d3887ce44259836c1a42135289 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -71,11 +71,12 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4& void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color); void gl_draw_image(S32 x, S32 y, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); +void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); +void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), LLRenderTarget* target = NULL); +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f ); @@ -105,7 +106,7 @@ typedef enum e_rounded_edge void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const U32 edges = ROUNDED_RECT_ALL); -void gl_segmented_rect_2d_fragment_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL); +void gl_segmented_rect_2d_fragment_tex(const LLRect& rect, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL); void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, const LLVector3& width_vec, const LLVector3& height_vec); inline void gl_rect_2d( const LLRect& rect, BOOL filled ) diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index fe8110904d68bf91c9544570bcc2249e257908d7..955ea450c1dceb7ff6772e30ee898df69155a002 100755 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -43,7 +43,7 @@ void check_framebuffer_status() case GL_FRAMEBUFFER_COMPLETE: break; default: - llwarns << "check_framebuffer_status failed -- " << std::hex << status << llendl; + LL_WARNS() << "check_framebuffer_status failed -- " << std::hex << status << LL_ENDL; ll_fail("check_framebuffer_status failed"); break; } @@ -139,7 +139,7 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo { if (!allocateDepth()) { - llwarns << "Failed to allocate depth buffer for render target." << llendl; + LL_WARNS() << "Failed to allocate depth buffer for render target." << LL_ENDL; return false; } } @@ -181,13 +181,13 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) if( offset >= 4 ) { - llwarns << "Too many color attachments" << llendl; + LL_WARNS() << "Too many color attachments" << LL_ENDL; llassert( offset < 4 ); return false; } if( offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers) ) { - llwarns << "FBO not used or no drawbuffers available; mFBO=" << (U32)mFBO << " gGLManager.mHasDrawBuffers=" << (U32)gGLManager.mHasDrawBuffers << llendl; + LL_WARNS() << "FBO not used or no drawbuffers available; mFBO=" << (U32)mFBO << " gGLManager.mHasDrawBuffers=" << (U32)gGLManager.mHasDrawBuffers << LL_ENDL; llassert( mFBO != 0 ); llassert( gGLManager.mHasDrawBuffers ); return false; @@ -205,7 +205,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false); if (glGetError() != GL_NO_ERROR) { - llwarns << "Could not allocate color buffer for render target." << llendl; + LL_WARNS() << "Could not allocate color buffer for render target." << LL_ENDL; return false; } } @@ -294,7 +294,7 @@ bool LLRenderTarget::allocateDepth() if (glGetError() != GL_NO_ERROR) { - llwarns << "Unable to allocate depth buffer for render target." << llendl; + LL_WARNS() << "Unable to allocate depth buffer for render target." << LL_ENDL; return false; } @@ -305,17 +305,17 @@ void LLRenderTarget::shareDepthBuffer(LLRenderTarget& target) { if (!mFBO || !target.mFBO) { - llerrs << "Cannot share depth buffer between non FBO render targets." << llendl; + LL_ERRS() << "Cannot share depth buffer between non FBO render targets." << LL_ENDL; } if (target.mDepth) { - llerrs << "Attempting to override existing depth buffer. Detach existing buffer first." << llendl; + LL_ERRS() << "Attempting to override existing depth buffer. Detach existing buffer first." << LL_ENDL; } if (target.mUseDepth) { - llerrs << "Attempting to override existing shared depth buffer. Detach existing buffer first." << llendl; + LL_ERRS() << "Attempting to override existing shared depth buffer. Detach existing buffer first." << LL_ENDL; } if (mDepth) @@ -486,7 +486,7 @@ U32 LLRenderTarget::getTexture(U32 attachment) const { if (attachment > mTex.size()-1) { - llerrs << "Invalid attachment index." << llendl; + LL_ERRS() << "Invalid attachment index." << LL_ENDL; } if (mTex.empty()) { @@ -560,7 +560,7 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, gGL.flush(); if (!source.mFBO || !mFBO) { - llwarns << "Cannot copy framebuffer contents for non FBO render targets." << llendl; + LL_WARNS() << "Cannot copy framebuffer contents for non FBO render targets." << LL_ENDL; return; } @@ -603,7 +603,7 @@ void LLRenderTarget::copyContentsToFramebuffer(LLRenderTarget& source, S32 srcX0 { if (!source.mFBO) { - llwarns << "Cannot copy framebuffer contents for non FBO render targets." << llendl; + LL_WARNS() << "Cannot copy framebuffer contents for non FBO render targets." << LL_ENDL; return; } diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 6e04fc82dfd1f396db0c59b44ee51a0d93df853e..95a2c8b589084a3c5cbdb993621b0ce5a8b6ddbc 100755 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -600,7 +600,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade { //should NEVER get here -- if major version is 1 and minor version is less than 10, // viewer should never attempt to use shaders, continuing will result in undefined behavior - llerrs << "Unsupported GLSL Version." << llendl; + LL_ERRS() << "Unsupported GLSL Version." << LL_ENDL; } if (minor_version <= 19) @@ -767,7 +767,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade else { //should never get here. Indexed texture rendering requires GLSL 1.30 or later // (for passing integers between vertex and fragment shaders) - llerrs << "Indexed texture rendering requires GLSL 1.30 or later." << llendl; + LL_ERRS() << "Indexed texture rendering requires GLSL 1.30 or later." << LL_ENDL; } } else @@ -840,13 +840,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (i % 128 == 0) { //dump every 128 lines - LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl; + LL_WARNS("ShaderLoading") << "\n" << ostr.str() << LL_ENDL; ostr = std::stringstream(); } } - LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl; + LL_WARNS("ShaderLoading") << "\n" << ostr.str() << LL_ENDL; #else std::string str; @@ -855,7 +855,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (i % 128 == 0) { - LL_WARNS("ShaderLoading") << str << llendl; + LL_WARNS("ShaderLoading") << str << LL_ENDL; str = ""; } } @@ -1205,7 +1205,7 @@ void LLShaderMgr::initAttribsAndUniforms() { if (dupe_check.find(mReservedUniforms[i]) != dupe_check.end()) { - llerrs << "Duplicate reserved uniform name found: " << mReservedUniforms[i] << llendl; + LL_ERRS() << "Duplicate reserved uniform name found: " << mReservedUniforms[i] << LL_ENDL; } dupe_check.insert(mReservedUniforms[i]); } diff --git a/indra/llrender/lltexture.h b/indra/llrender/lltexture.h index 093bac20d14c9457f06af0075b205b00850d28c0..9fca8b8cd3a1544e2b05c9fd8c8a2282e082c1d6 100755 --- a/indra/llrender/lltexture.h +++ b/indra/llrender/lltexture.h @@ -33,6 +33,8 @@ #define LL_TEXTURE_H #include "llrefcount.h" +#include "lltrace.h" + class LLImageGL ; class LLTexUnit ; class LLFontGL ; @@ -40,7 +42,7 @@ class LLFontGL ; // //this is an abstract class as the parent for the class LLGLTexture // -class LLTexture : public virtual LLRefCount +class LLTexture : public virtual LLRefCount, public LLTrace::MemTrackable<LLTexture> { friend class LLTexUnit ; friend class LLFontGL ; @@ -49,7 +51,9 @@ class LLTexture : public virtual LLRefCount virtual ~LLTexture(); public: - LLTexture(){} + LLTexture() + : LLTrace::MemTrackable<LLTexture>("LLTexture") + {} // //interfaces to access LLGLTexture @@ -57,10 +61,12 @@ class LLTexture : public virtual LLRefCount virtual S8 getType() const = 0 ; virtual void setKnownDrawSize(S32 width, S32 height) = 0 ; virtual bool bindDefaultImage(const S32 stage = 0) = 0 ; + virtual bool bindDebugImage(const S32 stage = 0) = 0; virtual void forceImmediateUpdate() = 0 ; virtual void setActive() = 0 ; virtual S32 getWidth(S32 discard_level = -1) const = 0 ; virtual S32 getHeight(S32 discard_level = -1) const = 0 ; + virtual bool isActiveFetching() = 0; private: //note: do not make this function public. diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp index b954b66350c9a4c771f1de2a07b587c5e5cb9e73..6f1fae92cd5fbdf20f77b2ea50749c863abd7d23 100644 --- a/indra/llrender/lluiimage.cpp +++ b/indra/llrender/lluiimage.cpp @@ -38,11 +38,9 @@ LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image) mImage(image), mScaleRegion(0.f, 1.f, 1.f, 0.f), mClipRegion(0.f, 1.f, 1.f, 0.f), - mUniformScaling(TRUE), - mNoClip(TRUE), - mImageLoaded(NULL) -{ -} + mImageLoaded(NULL), + mScaleStyle(SCALE_INNER) +{} LLUIImage::~LLUIImage() { @@ -52,44 +50,35 @@ LLUIImage::~LLUIImage() void LLUIImage::setClipRegion(const LLRectf& region) { mClipRegion = region; - mNoClip = mClipRegion.mLeft == 0.f - && mClipRegion.mRight == 1.f - && mClipRegion.mBottom == 0.f - && mClipRegion.mTop == 1.f; } void LLUIImage::setScaleRegion(const LLRectf& region) { mScaleRegion = region; - mUniformScaling = mScaleRegion.mLeft == 0.f - && mScaleRegion.mRight == 1.f - && mScaleRegion.mBottom == 0.f - && mScaleRegion.mTop == 1.f; +} + +void LLUIImage::setScaleStyle(LLUIImage::EScaleStyle style) +{ + mScaleStyle = style; } //TODO: move drawing implementation inside class void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) const { - gl_draw_scaled_image(x, y, getWidth(), getHeight(), mImage, color, mClipRegion); + draw(x, y, getWidth(), getHeight(), color); } void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const { - if (mUniformScaling) - { - gl_draw_scaled_image(x, y, width, height, mImage, color, mClipRegion); - } - else - { - gl_draw_scaled_image_with_border( - x, y, - width, height, - mImage, - color, - FALSE, - mClipRegion, - mScaleRegion); - } + gl_draw_scaled_image_with_border( + x, y, + width, height, + mImage, + color, + FALSE, + mClipRegion, + mScaleRegion, + mScaleStyle == SCALE_INNER); } void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const @@ -101,7 +90,8 @@ void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& c color, TRUE, mClipRegion, - mScaleRegion); + mScaleRegion, + mScaleStyle == SCALE_INNER); } void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const diff --git a/indra/llrender/lluiimage.h b/indra/llrender/lluiimage.h index 7817ba1c7b644323dc475de799ee2a61b4acb1cf..6f47385eb0fc34b515c7147872d4cbebb2a63bf6 100644 --- a/indra/llrender/lluiimage.h +++ b/indra/llrender/lluiimage.h @@ -42,6 +42,12 @@ extern const LLColor4 UI_VERTEX_COLOR; class LLUIImage : public LLRefCount { public: + enum EScaleStyle + { + SCALE_INNER, + SCALE_OUTER + }; + typedef boost::signals2::signal<void (void)> image_loaded_signal_t; LLUIImage(const std::string& name, LLPointer<LLTexture> image); @@ -49,6 +55,7 @@ class LLUIImage : public LLRefCount void setClipRegion(const LLRectf& region); void setScaleRegion(const LLRectf& region); + void setScaleStyle(EScaleStyle style); LLPointer<LLTexture> getImage() { return mImage; } const LLPointer<LLTexture>& getImage() const { return mImage; } @@ -83,12 +90,11 @@ class LLUIImage : public LLRefCount protected: image_loaded_signal_t* mImageLoaded; - std::string mName; - LLRectf mScaleRegion; - LLRectf mClipRegion; - LLPointer<LLTexture> mImage; - BOOL mUniformScaling; - BOOL mNoClip; + std::string mName; + LLRectf mScaleRegion; + LLRectf mClipRegion; + LLPointer<LLTexture> mImage; + EScaleStyle mScaleStyle; }; namespace LLInitParam diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index e6f20cd40ea18892247b816ee53107502dcc098f..d06564df36b35848697b50790591f8bafa04b6bc 100755 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -26,7 +26,7 @@ #include "linden_common.h" -#include <boost/static_assert.hpp> +#include "llfasttimer.h" #include "llsys.h" #include "llvertexbuffer.h" // #include "llrender.h" @@ -190,7 +190,7 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) glBufferDataARB(mType, size, 0, mUsage); if (mUsage != GL_DYNAMIC_COPY_ARB) { //data will be provided by application - ret = (U8*) ll_aligned_malloc(size, 64); + ret = (U8*) ll_aligned_malloc<64>(size); } } else @@ -244,7 +244,7 @@ void LLVBOPool::release(U32 name, volatile U8* buffer, U32 size) llassert(vbo_block_size(size) == size); deleteBuffer(name); - ll_aligned_free((U8*) buffer); + ll_aligned_free_fallback((U8*) buffer); if (mType == GL_ARRAY_BUFFER_ARB) { @@ -298,7 +298,7 @@ void LLVBOPool::cleanup() if (r.mClientData) { - ll_aligned_free((void*) r.mClientData); + ll_aligned_free<64>((void*) r.mClientData); } l.pop_front(); @@ -484,7 +484,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) } else { - llerrs << "Bad client state! " << array[i] << " disabled." << llendl; + LL_ERRS() << "Bad client state! " << array[i] << " disabled." << LL_ENDL; } } } @@ -503,7 +503,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) } else { - llerrs << "Bad client state! " << array[i] << " enabled." << llendl; + LL_ERRS() << "Bad client state! " << array[i] << " enabled." << LL_ENDL; } } } @@ -557,10 +557,10 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) } //static -static LLFastTimer::DeclareTimer FTM_VB_DRAW_ARRAYS("drawArrays"); +static LLTrace::BlockTimerStatHandle FTM_VB_DRAW_ARRAYS("drawArrays"); void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm) { - LLFastTimer t(FTM_VB_DRAW_ARRAYS); + LL_RECORD_BLOCK_TIME(FTM_VB_DRAW_ARRAYS); llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); gGL.syncMatrices(); @@ -571,13 +571,13 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, con if( count == 0 ) { - llwarns << "Called drawArrays with 0 vertices" << llendl; + LL_WARNS() << "Called drawArrays with 0 vertices" << LL_ENDL; return; } if( norm.size() < pos.size() ) { - llwarns << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << llendl; + LL_WARNS() << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << LL_ENDL; return; } @@ -654,7 +654,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of if (start >= (U32) mNumVerts || end >= (U32) mNumVerts) { - llerrs << "Bad vertex buffer draw range: [" << start << ", " << end << "] vs " << mNumVerts << llendl; + LL_ERRS() << "Bad vertex buffer draw range: [" << start << ", " << end << "] vs " << mNumVerts << LL_ENDL; } llassert(mNumIndices >= 0); @@ -662,7 +662,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of if (indices_offset >= (U32) mNumIndices || indices_offset + count > (U32) mNumIndices) { - llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl; + LL_ERRS() << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << LL_ENDL; } if (gDebugGL && !useVBOs()) @@ -672,7 +672,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of { if (idx[i] < start || idx[i] > end) { - llerrs << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << llendl; + LL_ERRS() << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << LL_ENDL; } } @@ -690,7 +690,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of S32 idx = (S32) (v[i][3]+0.25f); if (idx < 0 || idx >= shader->mFeatures.mIndexedTextureChannels) { - llerrs << "Bad texture index found in vertex data stream." << llendl; + LL_ERRS() << "Bad texture index found in vertex data stream." << LL_ENDL; } } } @@ -710,19 +710,19 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi { if (mGLArray != sGLRenderArray) { - llerrs << "Wrong vertex array bound." << llendl; + LL_ERRS() << "Wrong vertex array bound." << LL_ENDL; } } else { if (mGLIndices != sGLRenderIndices) { - llerrs << "Wrong index buffer bound." << llendl; + LL_ERRS() << "Wrong index buffer bound." << LL_ENDL; } if (mGLBuffer != sGLRenderBuffer) { - llerrs << "Wrong vertex buffer bound." << llendl; + LL_ERRS() << "Wrong vertex buffer bound." << LL_ENDL; } } @@ -733,13 +733,13 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi if (elem != mGLIndices) { - llerrs << "Wrong index buffer bound!" << llendl; + LL_ERRS() << "Wrong index buffer bound!" << LL_ENDL; } } if (mode >= LLRender::NUM_MODES) { - llerrs << "Invalid draw mode: " << mode << llendl; + LL_ERRS() << "Invalid draw mode: " << mode << LL_ENDL; return; } @@ -767,32 +767,32 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const if (indices_offset >= (U32) mNumIndices || indices_offset + count > (U32) mNumIndices) { - llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl; + LL_ERRS() << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << LL_ENDL; } if (mGLArray) { if (mGLArray != sGLRenderArray) { - llerrs << "Wrong vertex array bound." << llendl; + LL_ERRS() << "Wrong vertex array bound." << LL_ENDL; } } else { if (mGLIndices != sGLRenderIndices) { - llerrs << "Wrong index buffer bound." << llendl; + LL_ERRS() << "Wrong index buffer bound." << LL_ENDL; } if (mGLBuffer != sGLRenderBuffer) { - llerrs << "Wrong vertex buffer bound." << llendl; + LL_ERRS() << "Wrong vertex buffer bound." << LL_ENDL; } } if (mode >= LLRender::NUM_MODES) { - llerrs << "Invalid draw mode: " << mode << llendl; + LL_ERRS() << "Invalid draw mode: " << mode << LL_ENDL; return; } @@ -805,7 +805,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const placeFence(); } -static LLFastTimer::DeclareTimer FTM_GL_DRAW_ARRAYS("GL draw arrays"); +static LLTrace::BlockTimerStatHandle FTM_GL_DRAW_ARRAYS("GL draw arrays"); void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); @@ -816,37 +816,37 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const if (first >= (U32) mNumVerts || first + count > (U32) mNumVerts) { - llerrs << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << llendl; + LL_ERRS() << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << LL_ENDL; } if (mGLArray) { if (mGLArray != sGLRenderArray) { - llerrs << "Wrong vertex array bound." << llendl; + LL_ERRS() << "Wrong vertex array bound." << LL_ENDL; } } else { if (mGLBuffer != sGLRenderBuffer || useVBOs() != sVBOActive) { - llerrs << "Wrong vertex buffer bound." << llendl; + LL_ERRS() << "Wrong vertex buffer bound." << LL_ENDL; } } if (mode >= LLRender::NUM_MODES) { - llerrs << "Invalid draw mode: " << mode << llendl; + LL_ERRS() << "Invalid draw mode: " << mode << LL_ENDL; return; } { - LLFastTimer t2(FTM_GL_DRAW_ARRAYS); - stop_glerror(); + LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS); + stop_glerror(); LLGLSLShader::startProfile(); - glDrawArrays(sGLMode[mode], first, count); + glDrawArrays(sGLMode[mode], first, count); LLGLSLShader::stopProfile(count, mode); - } + } stop_glerror(); placeFence(); @@ -956,7 +956,8 @@ S32 LLVertexBuffer::determineUsage(S32 usage) return ret_usage; } -LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) : +LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) +: LLTrace::MemTrackable<LLVertexBuffer>("LLVertexBuffer"), LLRefCount(), mNumVerts(0), @@ -1093,7 +1094,9 @@ void LLVertexBuffer::waitFence() const void LLVertexBuffer::genBuffer(U32 size) { + disclaimMem(mSize); mSize = vbo_block_size(size); + claimMem(mSize); if (mUsage == GL_STREAM_DRAW_ARB) { @@ -1187,7 +1190,9 @@ void LLVertexBuffer::createGLBuffer(U32 size) static int gl_buffer_idx = 0; mGLBuffer = ++gl_buffer_idx; mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); + disclaimMem(mSize); mSize = size; + claimMem(mSize); } } @@ -1271,7 +1276,7 @@ void LLVertexBuffer::updateNumVerts(S32 nverts) if (nverts > 65536) { - llwarns << "Vertex buffer overflow!" << llendl; + LL_WARNS() << "Vertex buffer overflow!" << LL_ENDL; nverts = 65536; } @@ -1310,7 +1315,7 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create) if (nverts < 0 || nindices < 0 || nverts > 65536) { - llerrs << "Bad vertex buffer allocation: " << nverts << " : " << nindices << llendl; + LL_ERRS() << "Bad vertex buffer allocation: " << nverts << " : " << nindices << LL_ENDL; } updateNumVerts(nverts); @@ -1331,7 +1336,7 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create) } } -static LLFastTimer::DeclareTimer FTM_SETUP_VERTEX_ARRAY("Setup VAO"); +static LLTrace::BlockTimerStatHandle FTM_SETUP_VERTEX_ARRAY("Setup VAO"); void LLVertexBuffer::setupVertexArray() { @@ -1340,7 +1345,7 @@ void LLVertexBuffer::setupVertexArray() return; } - LLFastTimer t(FTM_SETUP_VERTEX_ARRAY); + LL_RECORD_BLOCK_TIME(FTM_SETUP_VERTEX_ARRAY); #if GL_ARB_vertex_array_object glBindVertexArray(mGLArray); #endif @@ -1495,8 +1500,8 @@ bool expand_region(LLVertexBuffer::MappedRegion& region, S32 index, S32 count) return true; } -static LLFastTimer::DeclareTimer FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range"); -static LLFastTimer::DeclareTimer FTM_VBO_MAP_BUFFER("VBO Map"); +static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range"); +static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_BUFFER("VBO Map"); // Map for data access volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range) @@ -1504,11 +1509,11 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo bindGLBuffer(true); if (mFinal) { - llerrs << "LLVertexBuffer::mapVeretxBuffer() called on a finalized buffer." << llendl; + LL_ERRS() << "LLVertexBuffer::mapVeretxBuffer() called on a finalized buffer." << LL_ENDL; } if (!useVBOs() && !mMappedData && !mMappedIndexData) { - llerrs << "LLVertexBuffer::mapVertexBuffer() called on unallocated buffer." << llendl; + LL_ERRS() << "LLVertexBuffer::mapVertexBuffer() called on unallocated buffer." << LL_ENDL; } if (useVBOs()) @@ -1545,7 +1550,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo if (mVertexLocked && map_range) { - llerrs << "Attempted to map a specific range of a buffer that was already mapped." << llendl; + LL_ERRS() << "Attempted to map a specific range of a buffer that was already mapped." << LL_ENDL; } if (!mVertexLocked) @@ -1567,7 +1572,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo if (map_range) { #ifdef GL_ARB_map_buffer_range - LLFastTimer t(FTM_VBO_MAP_BUFFER_RANGE); + LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_BUFFER_RANGE); S32 offset = mOffsets[type] + sTypeSize[type]*index; S32 length = (sTypeSize[type]*count+0xF) & ~0xF; src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, offset, length, @@ -1587,11 +1592,11 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo if (size < mSize) { - llerrs << "Invalid buffer size." << llendl; + LL_ERRS() << "Invalid buffer size." << LL_ENDL; } } - LLFastTimer t(FTM_VBO_MAP_BUFFER); + LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_BUFFER); src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, 0, mSize, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); @@ -1638,25 +1643,25 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo { //-------------------- //print out more debug info before crash - llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl; + LL_INFOS() << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << LL_ENDL; GLint size; glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); - llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl; + LL_INFOS() << "GL_ARRAY_BUFFER_ARB size is " << size << LL_ENDL; //-------------------- GLint buff; glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); if ((GLuint)buff != mGLBuffer) { - llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; + LL_ERRS() << "Invalid GL vertex buffer bound: " << buff << LL_ENDL; } - llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl; + LL_ERRS() << "glMapBuffer returned NULL (no vertex data)" << LL_ENDL; } else { - llerrs << "memory allocation for vertex data failed." << llendl; + LL_ERRS() << "memory allocation for vertex data failed." << LL_ENDL; } } } @@ -1677,19 +1682,19 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo } -static LLFastTimer::DeclareTimer FTM_VBO_MAP_INDEX_RANGE("IBO Map Range"); -static LLFastTimer::DeclareTimer FTM_VBO_MAP_INDEX("IBO Map"); +static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_INDEX_RANGE("IBO Map Range"); +static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_INDEX("IBO Map"); volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { bindGLIndices(true); if (mFinal) { - llerrs << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << llendl; + LL_ERRS() << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << LL_ENDL; } if (!useVBOs() && !mMappedData && !mMappedIndexData) { - llerrs << "LLVertexBuffer::mapIndexBuffer() called on unallocated buffer." << llendl; + LL_ERRS() << "LLVertexBuffer::mapIndexBuffer() called on unallocated buffer." << LL_ENDL; } if (useVBOs()) @@ -1723,7 +1728,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range if (mIndexLocked && map_range) { - llerrs << "Attempted to map a specific range of a buffer that was already mapped." << llendl; + LL_ERRS() << "Attempted to map a specific range of a buffer that was already mapped." << LL_ENDL; } if (!mIndexLocked) @@ -1739,7 +1744,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range if (elem != mGLIndices) { - llerrs << "Wrong index buffer bound!" << llendl; + LL_ERRS() << "Wrong index buffer bound!" << LL_ENDL; } } @@ -1756,7 +1761,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range if (map_range) { #ifdef GL_ARB_map_buffer_range - LLFastTimer t(FTM_VBO_MAP_INDEX_RANGE); + LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX_RANGE); S32 offset = sizeof(U16)*index; S32 length = sizeof(U16)*count; src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, @@ -1768,7 +1773,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range else { #ifdef GL_ARB_map_buffer_range - LLFastTimer t(FTM_VBO_MAP_INDEX); + LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX); src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(U16)*mNumIndices, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); @@ -1792,7 +1797,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range } else { - LLFastTimer t(FTM_VBO_MAP_INDEX); + LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX); map_range = false; src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } @@ -1817,14 +1822,14 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); if ((GLuint)buff != mGLIndices) { - llerrs << "Invalid GL index buffer bound: " << buff << llendl; + LL_ERRS() << "Invalid GL index buffer bound: " << buff << LL_ENDL; } - llerrs << "glMapBuffer returned NULL (no index data)" << llendl; + LL_ERRS() << "glMapBuffer returned NULL (no index data)" << LL_ENDL; } else { - llerrs << "memory allocation for Index data failed. " << llendl; + LL_ERRS() << "memory allocation for Index data failed. " << LL_ENDL; } } } @@ -1843,12 +1848,12 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range } } -static LLFastTimer::DeclareTimer FTM_VBO_UNMAP("VBO Unmap"); -static LLFastTimer::DeclareTimer FTM_VBO_FLUSH_RANGE("Flush VBO Range"); +static LLTrace::BlockTimerStatHandle FTM_VBO_UNMAP("VBO Unmap"); +static LLTrace::BlockTimerStatHandle FTM_VBO_FLUSH_RANGE("Flush VBO Range"); -static LLFastTimer::DeclareTimer FTM_IBO_UNMAP("IBO Unmap"); -static LLFastTimer::DeclareTimer FTM_IBO_FLUSH_RANGE("Flush IBO Range"); +static LLTrace::BlockTimerStatHandle FTM_IBO_UNMAP("IBO Unmap"); +static LLTrace::BlockTimerStatHandle FTM_IBO_FLUSH_RANGE("Flush IBO Range"); void LLVertexBuffer::unmapBuffer() { @@ -1861,7 +1866,7 @@ void LLVertexBuffer::unmapBuffer() if (mMappedData && mVertexLocked) { - LLFastTimer t(FTM_VBO_UNMAP); + LL_RECORD_BLOCK_TIME(FTM_VBO_UNMAP); bindGLBuffer(true); updated_all = mIndexLocked; //both vertex and index buffers done updating @@ -1902,7 +1907,7 @@ void LLVertexBuffer::unmapBuffer() S32 length = sTypeSize[region.mType]*region.mCount; if (gGLManager.mHasMapBufferRange) { - LLFastTimer t(FTM_VBO_FLUSH_RANGE); + LL_RECORD_BLOCK_TIME(FTM_VBO_FLUSH_RANGE); #ifdef GL_ARB_map_buffer_range glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length); #endif @@ -1932,7 +1937,7 @@ void LLVertexBuffer::unmapBuffer() if (mMappedIndexData && mIndexLocked) { - LLFastTimer t(FTM_IBO_UNMAP); + LL_RECORD_BLOCK_TIME(FTM_IBO_UNMAP); bindGLIndices(); if(!mMappable) { @@ -1969,7 +1974,7 @@ void LLVertexBuffer::unmapBuffer() S32 length = sizeof(U16)*region.mCount; if (gGLManager.mHasMapBufferRange) { - LLFastTimer t(FTM_IBO_FLUSH_RANGE); + LL_RECORD_BLOCK_TIME(FTM_IBO_FLUSH_RANGE); #ifdef GL_ARB_map_buffer_range glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length); #endif @@ -2020,7 +2025,7 @@ template <class T,S32 type> struct VertexBufferStrider if (ptr == NULL) { - llwarns << "mapIndexBuffer failed!" << llendl; + LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL; return false; } @@ -2036,7 +2041,7 @@ template <class T,S32 type> struct VertexBufferStrider if (ptr == NULL) { - llwarns << "mapVertexBuffer failed!" << llendl; + LL_WARNS() << "mapVertexBuffer failed!" << LL_ENDL; return false; } @@ -2046,7 +2051,7 @@ template <class T,S32 type> struct VertexBufferStrider } else { - llerrs << "VertexBufferStrider could not find valid vertex data." << llendl; + LL_ERRS() << "VertexBufferStrider could not find valid vertex data." << LL_ENDL; } return false; } @@ -2113,13 +2118,13 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4>& strider, S32 in //---------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_BIND_GL_ARRAY("Bind Array"); +static LLTrace::BlockTimerStatHandle FTM_BIND_GL_ARRAY("Bind Array"); bool LLVertexBuffer::bindGLArray() { if (mGLArray && sGLRenderArray != mGLArray) { { - LLFastTimer t(FTM_BIND_GL_ARRAY); + LL_RECORD_BLOCK_TIME(FTM_BIND_GL_ARRAY); #if GL_ARB_vertex_array_object glBindVertexArray(mGLArray); #endif @@ -2136,7 +2141,7 @@ bool LLVertexBuffer::bindGLArray() return false; } -static LLFastTimer::DeclareTimer FTM_BIND_GL_BUFFER("Bind Buffer"); +static LLTrace::BlockTimerStatHandle FTM_BIND_GL_BUFFER("Bind Buffer"); bool LLVertexBuffer::bindGLBuffer(bool force_bind) { @@ -2146,7 +2151,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind) if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive)))) { - //LLFastTimer t(FTM_BIND_GL_BUFFER); <-- this timer is showing up as a hotspot (irony) + //LL_RECORD_BLOCK_TIME(FTM_BIND_GL_BUFFER); glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer); sGLRenderBuffer = mGLBuffer; @@ -2161,7 +2166,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind) return ret; } -static LLFastTimer::DeclareTimer FTM_BIND_GL_INDICES("Bind Indices"); +static LLTrace::BlockTimerStatHandle FTM_BIND_GL_INDICES("Bind Indices"); bool LLVertexBuffer::bindGLIndices(bool force_bind) { @@ -2170,10 +2175,10 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind) bool ret = false; if (useVBOs() && (force_bind || (mGLIndices && (mGLIndices != sGLRenderIndices || !sIBOActive)))) { - LLFastTimer t(FTM_BIND_GL_INDICES); + LL_RECORD_BLOCK_TIME(FTM_BIND_GL_INDICES); /*if (sMapped) { - llerrs << "VBO bound while another VBO mapped!" << llendl; + LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL; }*/ glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices); sGLRenderIndices = mGLIndices; @@ -2225,7 +2230,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) U32 required = 1 << i; if ((data_mask & required) == 0) { - llwarns << "Missing attribute: " << LLShaderMgr::instance()->mReservedAttribs[i] << llendl; + LL_WARNS() << "Missing attribute: " << LLShaderMgr::instance()->mReservedAttribs[i] << LL_ENDL; } required_mask |= required; @@ -2243,29 +2248,29 @@ void LLVertexBuffer::setBuffer(U32 data_mask) U32 unsatisfied_flag = unsatisfied_mask & (1 << i); switch (unsatisfied_flag) { - case MAP_VERTEX: llinfos << "Missing vert pos" << llendl; break; - case MAP_NORMAL: llinfos << "Missing normals" << llendl; break; - case MAP_TEXCOORD0: llinfos << "Missing TC 0" << llendl; break; - case MAP_TEXCOORD1: llinfos << "Missing TC 1" << llendl; break; - case MAP_TEXCOORD2: llinfos << "Missing TC 2" << llendl; break; - case MAP_TEXCOORD3: llinfos << "Missing TC 3" << llendl; break; - case MAP_COLOR: llinfos << "Missing vert color" << llendl; break; - case MAP_EMISSIVE: llinfos << "Missing emissive" << llendl; break; - case MAP_TANGENT: llinfos << "Missing tangent" << llendl; break; - case MAP_WEIGHT: llinfos << "Missing weight" << llendl; break; - case MAP_WEIGHT4: llinfos << "Missing weightx4" << llendl; break; - case MAP_CLOTHWEIGHT: llinfos << "Missing clothweight" << llendl; break; - case MAP_TEXTURE_INDEX: llinfos << "Missing tex index" << llendl; break; - default: llinfos << "Missing who effin knows: " << unsatisfied_flag << llendl; + case MAP_VERTEX: LL_INFOS() << "Missing vert pos" << LL_ENDL; break; + case MAP_NORMAL: LL_INFOS() << "Missing normals" << LL_ENDL; break; + case MAP_TEXCOORD0: LL_INFOS() << "Missing TC 0" << LL_ENDL; break; + case MAP_TEXCOORD1: LL_INFOS() << "Missing TC 1" << LL_ENDL; break; + case MAP_TEXCOORD2: LL_INFOS() << "Missing TC 2" << LL_ENDL; break; + case MAP_TEXCOORD3: LL_INFOS() << "Missing TC 3" << LL_ENDL; break; + case MAP_COLOR: LL_INFOS() << "Missing vert color" << LL_ENDL; break; + case MAP_EMISSIVE: LL_INFOS() << "Missing emissive" << LL_ENDL; break; + case MAP_TANGENT: LL_INFOS() << "Missing tangent" << LL_ENDL; break; + case MAP_WEIGHT: LL_INFOS() << "Missing weight" << LL_ENDL; break; + case MAP_WEIGHT4: LL_INFOS() << "Missing weightx4" << LL_ENDL; break; + case MAP_CLOTHWEIGHT: LL_INFOS() << "Missing clothweight" << LL_ENDL; break; + case MAP_TEXTURE_INDEX: LL_INFOS() << "Missing tex index" << LL_ENDL; break; + default: LL_INFOS() << "Missing who effin knows: " << unsatisfied_flag << LL_ENDL; } } if (unsatisfied_mask & (1 << TYPE_INDEX)) { - llinfos << "Missing indices" << llendl; + LL_INFOS() << "Missing indices" << LL_ENDL; } - llerrs << "Shader consumption mismatches data provision." << llendl; + LL_ERRS() << "Shader consumption mismatches data provision." << LL_ENDL; } } } @@ -2297,7 +2302,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) } else { - llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; + LL_ERRS() << "Invalid GL vertex buffer bound: " << buff << LL_ENDL; } } @@ -2312,7 +2317,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) } else { - llerrs << "Invalid GL index buffer bound: " << buff << llendl; + LL_ERRS() << "Invalid GL index buffer bound: " << buff << LL_ENDL; } } } @@ -2388,10 +2393,10 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) U32 mask = 1 << i; if (mask & data_mask && !(mask & mTypeMask)) { //bit set in data_mask, but not set in mTypeMask - llwarns << "Missing required component " << vb_type_name[i] << llendl; + LL_WARNS() << "Missing required component " << vb_type_name[i] << LL_ENDL; } } - llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl; + LL_ERRS() << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << LL_ENDL; } if (LLGLSLShader::sNoFixedFunction) diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 619a0cec467bd9e766be579c48ff776effdf0c7b..c05fd0159547b1305dea40119d2bcd7c7ae482b4 100755 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -34,6 +34,7 @@ #include "v4coloru.h" #include "llstrider.h" #include "llrender.h" +#include "lltrace.h" #include <set> #include <vector> #include <list> @@ -94,7 +95,7 @@ class LLVBOPool //============================================================================ // base class class LLPrivateMemoryPool; -class LLVertexBuffer : public LLRefCount +class LLVertexBuffer : public LLRefCount, public LLTrace::MemTrackable<LLVertexBuffer> { public: class MappedRegion @@ -109,14 +110,15 @@ class LLVertexBuffer : public LLRefCount }; LLVertexBuffer(const LLVertexBuffer& rhs) - : mUsage(rhs.mUsage) + : LLTrace::MemTrackable<LLVertexBuffer>("LLVertexBuffer"), + mUsage(rhs.mUsage) { *this = rhs; } const LLVertexBuffer& operator=(const LLVertexBuffer& rhs) { - llerrs << "Illegal operation!" << llendl; + LL_ERRS() << "Illegal operation!" << LL_ENDL; return *this; } diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 589ceac5016ebccd554dcd8e70e6ba99515f66cf..52738aeb6fbb5b27ab90206727151e5e70e560dc 100755 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -61,7 +61,6 @@ set(llui_SOURCE_FILES llfolderview.cpp llfolderviewitem.cpp llfolderviewmodel.cpp - llfunctorregistry.cpp lliconctrl.cpp llkeywords.cpp lllayoutstack.cpp @@ -145,6 +144,7 @@ set(llui_HEADER_FILES llbutton.h llcallbackmap.h llchatentry.h + llchat.h llcheckboxctrl.h llclipboard.h llcombobox.h @@ -286,7 +286,9 @@ if(LL_TESTS) include(LLAddBuildTest) SET(llui_TEST_SOURCE_FILES llurlmatch.cpp - llurlentry.cpp ) LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}") + # INTEGRATION TESTS + set(test_libs llui llmessage llcommon ${LLCOMMON_LIBRARIES} ${WINDOWS_LIBRARIES}) + LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "${test_libs}") endif(LL_TESTS) diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index d636161bafe65513bfaf0388b706d66b3ecee5fd..b787794b957038e4ed12fcb195763bd775831b29 100755 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -69,7 +69,7 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params) mSingleExpansion = params.single_expansion; if(mFitParent && !mSingleExpansion) { - llinfos << "fit_parent works best when combined with single_expansion" << llendl; + LL_INFOS() << "fit_parent works best when combined with single_expansion" << LL_ENDL; } } @@ -845,7 +845,7 @@ void LLAccordionCtrl::sort() { if (!mTabComparator) { - llwarns << "No comparator specified for sorting accordion tabs." << llendl; + LL_WARNS() << "No comparator specified for sorting accordion tabs." << LL_ENDL; return; } diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 43462bd2447687df1eb83b407eaa8fc12f63009f..53720a604433fba5153f564be800494cc06f3814 100755 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -444,9 +444,9 @@ void LLAccordionCtrlTab::changeOpenClose(bool is_open) } } -void LLAccordionCtrlTab::handleVisibilityChange(BOOL new_visibility) +void LLAccordionCtrlTab::onVisibilityChange(BOOL new_visibility) { - LLUICtrl::handleVisibilityChange(new_visibility); + LLUICtrl::onVisibilityChange(new_visibility); notifyParent(LLSD().with("child_visibility_change", new_visibility)); } diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index dddaa581e64a95d86be3f271825ff073983e109b..7a78700e0f21aa89df82e70f076df6e5c57e7893 100755 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -158,7 +158,7 @@ class LLAccordionCtrlTab : public LLUICtrl /** * Raises notifyParent event with "child_visibility_change" = new_visibility */ - void handleVisibilityChange(BOOL new_visibility); + void onVisibilityChange(BOOL new_visibility); // Changes expand/collapse state and triggers expand/collapse callbacks virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 8ede4e3468ba9ece7517e7148f089ab3c8e0abbc..30cb18812b695686f85ea6ac77a7b4f4ca4a8b7f 100755 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -105,7 +105,7 @@ LLBadge::LLBadge(const LLBadge::Params& p) { if (mImage.isNull()) { - llwarns << "Badge: " << getName() << " with no image!" << llendl; + LL_WARNS() << "Badge: " << getName() << " with no image!" << LL_ENDL; } if (p.location_offset_hcenter.isProvided()) @@ -335,7 +335,7 @@ void LLBadge::draw() } else { - lldebugs << "No image for badge " << getName() << " on owner " << owner_view->getName() << llendl; + LL_DEBUGS() << "No image for badge " << getName() << " on owner " << owner_view->getName() << LL_ENDL; renderBadgeBackground(badge_center_x, badge_center_y, badge_width, badge_height, diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 3cfe5ac57f4c3c7970133450234b6bafe1375810..093d91d44deecb7e9d42f83c4570540365d67fd2 100755 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -253,7 +253,7 @@ LLButton::LLButton(const LLButton::Params& p) if (mImageUnselected.isNull()) { - llwarns << "Button: " << getName() << " with no image!" << llendl; + LL_WARNS() << "Button: " << getName() << " with no image!" << LL_ENDL; } if (p.click_callback.isProvided()) @@ -595,7 +595,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) // We only handle the click if the click both started and ended within us getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << LL_ENDL; } return TRUE; } @@ -782,12 +782,12 @@ void LLButton::draw() if (use_glow_effect) { mCurGlowStrength = lerp(mCurGlowStrength, - mFlashing ? (mFlashingTimer->isCurrentlyHighlighted() || !mFlashingTimer->isFlashingInProgress() || mNeedsHighlight? 1.0 : 0.0) : mHoverGlowStrength, - LLCriticalDamp::getInterpolant(0.05f)); + mFlashing ? (mFlashingTimer->isCurrentlyHighlighted() || !mFlashingTimer->isFlashingInProgress() || mNeedsHighlight? 1.f : 0.f) : mHoverGlowStrength, + LLSmoothInterpolation::getInterpolant(0.05f)); } else { - mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f)); + mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f)); } // Draw button image, if available. @@ -820,7 +820,7 @@ void LLButton::draw() else { // no image - lldebugs << "No image for button " << getName() << llendl; + LL_DEBUGS() << "No image for button " << getName() << LL_ENDL; // draw it in pink so we can find it gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4::pink1 % alpha, FALSE); } @@ -1044,7 +1044,7 @@ void LLButton::setImageUnselected(LLPointer<LLUIImage> image) mImageUnselected = image; if (mImageUnselected.isNull()) { - llwarns << "Setting default button image for: " << getName() << " to NULL" << llendl; + LL_WARNS() << "Setting default button image for: " << getName() << " to NULL" << LL_ENDL; } } diff --git a/indra/llcommon/llchat.h b/indra/llui/llchat.h similarity index 100% rename from indra/llcommon/llchat.h rename to indra/llui/llchat.h diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index 14173fdbb0a6f9fdbb228896fd113b411875f50a..1d18cb2bb039173911f85608e27903314d7d0a01 100755 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -88,6 +88,7 @@ bool LLClipboard::pasteFromClipboard(std::vector<LLUUID>& inv_objects) const { bool res = false; S32 count = mObjects.size(); + inv_objects.reserve(inv_objects.size() + count); if (count > 0) { res = true; diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index fd2e7610df4bda53d4809748478a2479fa2b84a8..58d80e26876419977f48b4f216dbb780a5a76609 100755 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -31,7 +31,6 @@ #include "llstring.h" #include "lluuid.h" -#include "stdenums.h" #include "llsingleton.h" #include "llassettype.h" #include "llinventory.h" diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 625fb8e87024c7cfc5f2a8d646737dabe181be76..74ef8dd0c37919b890bf0366693a3071dba5efc2 100755 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -137,7 +137,7 @@ void LLCommandManager::addCommand(LLCommand * command) mCommandIndices[command_id.uuid()] = mCommands.size(); mCommands.push_back(command); - lldebugs << "Successfully added command: " << command->name() << llendl; + LL_DEBUGS() << "Successfully added command: " << command->name() << LL_ENDL; } //static @@ -153,13 +153,13 @@ bool LLCommandManager::load() if (!parser.readXUI(commands_file, commandsParams)) { - llerrs << "Unable to load xml file: " << commands_file << llendl; + LL_ERRS() << "Unable to load xml file: " << commands_file << LL_ENDL; return false; } if (!commandsParams.validateBlock()) { - llerrs << "Invalid commands file: " << commands_file << llendl; + LL_ERRS() << "Invalid commands file: " << commands_file << LL_ENDL; return false; } diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp index e08ccb0b78c36e1b376d04c87f0a86b6c6444b62..727fbe850e29825898471ab56a65e96093b86d3b 100755 --- a/indra/llui/llcontainerview.cpp +++ b/indra/llui/llcontainerview.cpp @@ -49,7 +49,6 @@ LLContainerView::LLContainerView(const LLContainerView::Params& p) mLabel(p.label), mDisplayChildren(p.display_children) { - mCollapsible = TRUE; mScrollContainer = NULL; } @@ -75,6 +74,11 @@ bool LLContainerView::addChild(LLView* child, S32 tab_group) return res; } +BOOL LLContainerView::handleDoubleClick(S32 x, S32 y, MASK mask) +{ + return handleMouseDown(x, y, mask); +} + BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -84,7 +88,7 @@ BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask) } if (!handled) { - if( mCollapsible && mShowLabel && (y >= getRect().getHeight() - 10) ) + if( mShowLabel && (y >= getRect().getHeight() - 10) ) { setDisplayChildren(!mDisplayChildren); reshape(getRect().getWidth(), getRect().getHeight(), FALSE); @@ -163,7 +167,7 @@ void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent) //LLView *childp; // These will be used for the children - left = 4; + left = 10; top = getRect().getHeight() - 4; right = width - 2; bottom = top; @@ -184,7 +188,7 @@ void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent) LLView *childp = *child_iter; if (!childp->getVisible()) { - llwarns << "Incorrect visibility!" << llendl; + LL_WARNS() << "Incorrect visibility!" << LL_ENDL; } LLRect child_rect = childp->getRequiredRect(); child_height += child_rect.getHeight(); diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index e81600fd6c1a564387b7ac2526d99126dbbbd4b9..ac92b19977512043dc5e15ea2e0877f654742ea1 100755 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -66,6 +66,7 @@ class LLContainerView : public LLView /*virtual*/ BOOL postBuild(); /*virtual*/ bool addChild(LLView* view, S32 tab_group = 0); + /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -87,8 +88,5 @@ class LLContainerView : public LLView protected: BOOL mDisplayChildren; std::string mLabel; -public: - BOOL mCollapsible; - }; #endif // LL_CONTAINERVIEW_ diff --git a/indra/llui/llctrlselectioninterface.h b/indra/llui/llctrlselectioninterface.h index 2cdcbd88fee61ebe638c8ce09792e898ed5e2a20..a7b089c8f92571f166644ad8b9fdf0151d13e16b 100755 --- a/indra/llui/llctrlselectioninterface.h +++ b/indra/llui/llctrlselectioninterface.h @@ -28,8 +28,8 @@ #define LLCTRLSELECTIONINTERFACE_H #include "stdtypes.h" -#include "stdenums.h" #include "llstring.h" +#include "llui.h" class LLSD; class LLUUID; diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 304d21d0df8cc284205c378eb622331cf0c255fe..7c6559eddb4cd97775a42d1b9c0b181ffa3e2740 100755 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -366,13 +366,13 @@ BOOL LLDragHandle::handleHover(S32 x, S32 y, MASK mask) mDragLastScreenY += delta_y; getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" <<llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" <<LL_ENDL; handled = TRUE; } else { getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; handled = TRUE; } diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp index e49628acd59c8a5c424990d742f1c58417d6262f..6d9c429b083b0775a3a3bc8d0d8f01fb8f734a6b 100755 --- a/indra/llui/llflashtimer.cpp +++ b/indra/llui/llflashtimer.cpp @@ -23,29 +23,27 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ -#include "../newview/llviewerprecompiledheaders.h" - #include "llflashtimer.h" -#include "../newview/llviewercontrol.h" #include "lleventtimer.h" +#include "llui.h" LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period) - : LLEventTimer(period) - , mCallback(cb) - , mCurrentTickCount(0) - , mIsFlashingInProgress(false) - , mIsCurrentlyHighlighted(false) - , mUnset(false) +: LLEventTimer(period), + mCallback(cb), + mCurrentTickCount(0), + mIsFlashingInProgress(false), + mIsCurrentlyHighlighted(false), + mUnset(false) { mEventTimer.stop(); // By default use settings from settings.xml to be able change them via Debug settings. See EXT-5973. // Due to Timer is implemented as derived class from EventTimer it is impossible to change period // in runtime. So, both settings are made as required restart. - mFlashCount = 2 * ((count > 0) ? count : gSavedSettings.getS32("FlashCount")); + mFlashCount = 2 * ((count > 0) ? count : LLUI::sSettingGroups["config"]->getS32("FlashCount")); if (mPeriod <= 0) { - mPeriod = gSavedSettings.getF32("FlashPeriod"); + mPeriod = LLUI::sSettingGroups["config"]->getF32("FlashPeriod"); } } diff --git a/indra/llui/llflashtimer.h b/indra/llui/llflashtimer.h index c60f99a8eac40650cb01bff70d3709d51d3dfba1..db8d49f0096be7397292c25e7a593573bc7adc48 100755 --- a/indra/llui/llflashtimer.h +++ b/indra/llui/llflashtimer.h @@ -28,6 +28,7 @@ #define LL_FLASHTIMER_H #include "lleventtimer.h" +#include "boost/function.hpp" class LLFlashTimer : public LLEventTimer { diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 97a52fada4a01c4162d3238478580b14452799ec..299f5e42d4b35d7f49d83b5f5d4cc50c8a67c881 100755 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -347,7 +347,7 @@ void LLFlatListView::sort() { if (!mItemComparator) { - llwarns << "No comparator specified for sorting FlatListView items." << llendl; + LL_WARNS() << "No comparator specified for sorting FlatListView items." << LL_ENDL; return; } @@ -520,7 +520,7 @@ void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask) if (!item_pair->first) { - llwarning("Attempt to selet an item pair containing null panel item", 0); + LL_WARNS() << "Attempt to selet an item pair containing null panel item" << LL_ENDL; return; } diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index c462b2aa52c2d58867f9ed8863d470d326703859..62c923f6f01669c53d894418641230f77a217ac5 100755 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -133,7 +133,7 @@ bool LLFloater::KeyCompare::compare(const LLSD& a, const LLSD& b) { if (a.type() != b.type()) { - //llerrs << "Mismatched LLSD types: (" << a << ") mismatches (" << b << ")" << llendl; + //LL_ERRS() << "Mismatched LLSD types: (" << a << ") mismatches (" << b << ")" << LL_ENDL; return false; } else if (a.isUndefined()) @@ -586,7 +586,7 @@ LLControlGroup* LLFloater::getControlGroup() void LLFloater::setVisible( BOOL visible ) { - LLPanel::setVisible(visible); // calls handleVisibilityChange() + LLPanel::setVisible(visible); // calls onVisibilityChange() if( visible && mFirstLook ) { mFirstLook = FALSE; @@ -629,24 +629,24 @@ void LLFloater::setIsSingleInstance(BOOL is_single_instance) // virtual -void LLFloater::handleVisibilityChange ( BOOL new_visibility ) +void LLFloater::onVisibilityChange ( BOOL new_visibility ) { if (new_visibility) { if (getHost()) getHost()->setFloaterFlashing(this, FALSE); } - LLPanel::handleVisibilityChange ( new_visibility ); + LLPanel::onVisibilityChange ( new_visibility ); } void LLFloater::openFloater(const LLSD& key) { - llinfos << "Opening floater " << getName() << " full path: " << getPathname() << llendl; + LL_INFOS() << "Opening floater " << getName() << " full path: " << getPathname() << LL_ENDL; LLViewerEventRecorder::instance().logVisibilityChange( getPathname(), getName(), true,"floater"); // Last param is event subtype or empty string mKey = key; // in case we need to open ourselves again - + if (getSoundFlags() != SILENT // don't play open sound for hosted (tabbed) windows && !getHost() @@ -697,7 +697,7 @@ void LLFloater::openFloater(const LLSD& key) void LLFloater::closeFloater(bool app_quitting) { - llinfos << "Closing floater " << getName() << llendl; + LL_INFOS() << "Closing floater " << getName() << LL_ENDL; LLViewerEventRecorder::instance().logVisibilityChange( getPathname(), getName(), false,"floater"); // Last param is event subtype or empty string if (app_quitting) { @@ -795,7 +795,7 @@ void LLFloater::closeFloater(bool app_quitting) } else { - setVisible(FALSE); // hide before destroying (so handleVisibilityChange() gets called) + setVisible(FALSE); // hide before destroying (so onVisibilityChange() gets called) if (!mReuseInstance) { destroy(); @@ -1094,7 +1094,7 @@ BOOL LLFloater::canSnapTo(const LLView* other_view) { if (NULL == other_view) { - llwarns << "other_view is NULL" << llendl; + LL_WARNS() << "other_view is NULL" << LL_ENDL; return FALSE; } @@ -1153,11 +1153,11 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user) { setDocked( false, false); } - storeRectControl(); - mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; - LLRect screen_rect = calcScreenRect(); - mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); - } + storeRectControl(); + mPositioning = LLFloaterEnums::POSITIONING_RELATIVE; + LLRect screen_rect = calcScreenRect(); + mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert(); + } // gather all snapped dependents for(handle_set_iter_t dependent_it = mDependents.begin(); @@ -1553,7 +1553,7 @@ BOOL LLFloater::handleScrollWheel(S32 x, S32 y, S32 clicks) // virtual BOOL LLFloater::handleMouseUp(S32 x, S32 y, MASK mask) { - lldebugs << "LLFloater::handleMouseUp calling LLPanel (really LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << llendl; + LL_DEBUGS() << "LLFloater::handleMouseUp calling LLPanel (really LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL; BOOL handled = LLPanel::handleMouseUp(x,y,mask); // Not implemented in LLPanel so this actually calls LLView if (handled) { LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); @@ -2955,13 +2955,6 @@ void LLFloaterView::syncFloaterTabOrder() } } } - - // sync draw order to tab order - for ( child_list_const_reverse_iter_t child_it = getChildList()->rbegin(); child_it != getChildList()->rend(); ++child_it) - { - LLFloater* floaterp = (LLFloater*)*child_it; - moveChildToFrontOfTabGroup(floaterp); - } } LLFloater* LLFloaterView::getParentFloater(LLView* viewp) const @@ -3045,7 +3038,7 @@ void LLFloaterView::setToolbarRect(LLToolBarEnums::EToolBarLocation tb, const LL mToolbarRightRect = toolbar_rect; break; default: - llwarns << "setToolbarRect() passed odd toolbar number " << (S32) tb << llendl; + LL_WARNS() << "setToolbarRect() passed odd toolbar number " << (S32) tb << LL_ENDL; break; } } @@ -3183,8 +3176,8 @@ boost::signals2::connection LLFloater::setCloseCallback( const commit_signal_t:: return mCloseSignal.connect(cb); } -LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build"); -static LLFastTimer::DeclareTimer FTM_EXTERNAL_FLOATER_LOAD("Load Extern Floater Reference"); +LLTrace::BlockTimerStatHandle POST_BUILD("Floater Post Build"); +static LLTrace::BlockTimerStatHandle FTM_EXTERNAL_FLOATER_LOAD("Load Extern Floater Reference"); bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node) { @@ -3208,16 +3201,16 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str parser.readXUI(node, output_params, LLUICtrlFactory::getInstance()->getCurFileName()); setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); - parser.writeXUI(output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); return TRUE; } LLUICtrlFactory::instance().pushFileName(xml_filename); - LLFastTimer _(FTM_EXTERNAL_FLOATER_LOAD); + LL_RECORD_BLOCK_TIME(FTM_EXTERNAL_FLOATER_LOAD); if (!LLUICtrlFactory::getLayeredXMLNode(xml_filename, referenced_xml)) { - llwarns << "Couldn't parse panel from: " << xml_filename << llendl; + LL_WARNS() << "Couldn't parse panel from: " << xml_filename << LL_ENDL; return FALSE; } @@ -3238,9 +3231,8 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str { Params output_params(params); setupParamsForExport(output_params, parent); - Params default_params(LLUICtrlFactory::getDefaultParams<LLFloater>()); output_node->setName(node->getName()->mString); - parser.writeXUI(output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); } // Default floater position to top-left corner of screen @@ -3292,14 +3284,14 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str BOOL result; { - LLFastTimer ft(POST_BUILD); + LL_RECORD_BLOCK_TIME(POST_BUILD); result = postBuild(); } if (!result) { - llerrs << "Failed to construct floater " << getName() << llendl; + LL_ERRS() << "Failed to construct floater " << getName() << LL_ENDL; } applyRectControl(); // If we have a saved rect control, apply it @@ -3340,29 +3332,29 @@ bool LLFloater::isVisible(const LLFloater* floater) return floater && floater->getVisible(); } -static LLFastTimer::DeclareTimer FTM_BUILD_FLOATERS("Build Floaters"); +static LLTrace::BlockTimerStatHandle FTM_BUILD_FLOATERS("Build Floaters"); bool LLFloater::buildFromFile(const std::string& filename) { - LLFastTimer timer(FTM_BUILD_FLOATERS); + LL_RECORD_BLOCK_TIME(FTM_BUILD_FLOATERS); LLXMLNodePtr root; if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) { - llwarns << "Couldn't find (or parse) floater from: " << filename << llendl; + LL_WARNS() << "Couldn't find (or parse) floater from: " << filename << LL_ENDL; return false; } // root must be called floater if( !(root->hasName("floater") || root->hasName("multi_floater")) ) { - llwarns << "Root node should be named floater in: " << filename << llendl; + LL_WARNS() << "Root node should be named floater in: " << filename << LL_ENDL; return false; } bool res = true; - lldebugs << "Building floater " << filename << llendl; + LL_DEBUGS() << "Building floater " << filename << LL_ENDL; LLUICtrlFactory::instance().pushFileName(filename); { if (!getFactoryMap().empty()) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 12eb3cdbfafb444b625d0aed57c6cbd70d3a0377..199db85747949007842f60f9ecad54a194ca00f7 100755 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -308,7 +308,7 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater> virtual BOOL canClose() { return TRUE; } /*virtual*/ void setVisible(BOOL visible); // do not override - /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); // do not override + /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); // do not override void setFrontmost(BOOL take_focus = TRUE); virtual void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD()); diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp index b1b75776a7b43bc56a4dca5d419103b6faced0cb..9ef290abc024cd6629c876d12bad94ad768611b2 100755 --- a/indra/llui/llfloaterreg.cpp +++ b/indra/llui/llfloaterreg.cpp @@ -151,13 +151,13 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) res = build_func(key); if (!res) { - llwarns << "Failed to build floater type: '" << name << "'." << llendl; + LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL; return NULL; } bool success = res->buildFromFile(xui_file); if (!success) { - llwarns << "Failed to build floater type: '" << name << "'." << llendl; + LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL; return NULL; } @@ -179,7 +179,7 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key) } if (!res) { - llwarns << "Floater type: '" << name << "' not registered." << llendl; + LL_WARNS() << "Floater type: '" << name << "' not registered." << LL_ENDL; } } return res; @@ -475,7 +475,7 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD& if (!instance) { - lldebugs << "Unable to get instance of floater '" << name << "'" << llendl; + LL_DEBUGS() << "Unable to get instance of floater '" << name << "'" << LL_ENDL; return; } diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h index a1e1f8a98835ffa6bd8fd257a8a5799268b5e6ce..e3b17dcb4fc7507e8846984b61027732275bb0f4 100755 --- a/indra/llui/llfloaterreg.h +++ b/indra/llui/llfloaterreg.h @@ -30,6 +30,7 @@ #include "llrect.h" #include "llsd.h" +#include <list> #include <boost/function.hpp> //******************************************************* diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index f03c8d444b1d8ac66b7b06e275a1ee3ac2b9008f..547f0bd3989699ec84529952104082b82508da0b 100755 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -358,11 +358,11 @@ void LLFocusMgr::setMouseCapture( LLMouseHandler* new_captor ) { if (new_captor) { - llinfos << "New mouse captor: " << new_captor->getName() << llendl; + LL_INFOS() << "New mouse captor: " << new_captor->getName() << LL_ENDL; } else { - llinfos << "New mouse captor: NULL" << llendl; + LL_INFOS() << "New mouse captor: NULL" << LL_ENDL; } } diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 8788d1ef45fa96cd4a34724286bb5ed0ffb72492..b92e29834892085a836652bb11b926e720f31528 100755 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -173,6 +173,7 @@ LLFolderView::LLFolderView(const Params& p) mShowItemLinkOverlays(p.show_item_link_overlays), mViewModel(p.view_model) { + claimMem(mViewModel); LLPanel* panel = p.parent_panel; mParentPanel = panel->getHandle(); mViewModel->setFolderView(this); @@ -256,8 +257,6 @@ LLFolderView::~LLFolderView( void ) mRenamer = NULL; mStatusTextBox = NULL; - mAutoOpenItems.removeAllNodes(); - if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die(); mAutoOpenItems.removeAllNodes(); @@ -321,12 +320,11 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height ) return llround(mTargetHeight); } -static LLFastTimer::DeclareTimer FTM_FILTER("Filter Folder View"); +static LLTrace::BlockTimerStatHandle FTM_FILTER("Filter Folder View"); void LLFolderView::filter( LLFolderViewFilter& filter ) { - // Entry point of inventory filtering (CHUI-849) - LLFastTimer t2(FTM_FILTER); + LL_RECORD_BLOCK_TIME(FTM_FILTER); filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100)); // Note: we filter the model, not the view @@ -486,10 +484,10 @@ BOOL LLFolderView::changeSelection(LLFolderViewItem* selection, BOOL selected) return rv; } -static LLFastTimer::DeclareTimer FTM_SANITIZE_SELECTION("Sanitize Selection"); +static LLTrace::BlockTimerStatHandle FTM_SANITIZE_SELECTION("Sanitize Selection"); void LLFolderView::sanitizeSelection() { - LLFastTimer _(FTM_SANITIZE_SELECTION); + LL_RECORD_BLOCK_TIME(FTM_SANITIZE_SELECTION); // store off current item in case it is automatically deselected // and we want to preserve context LLFolderViewItem* original_selected_item = getCurSelectedItem(); @@ -742,7 +740,7 @@ void LLFolderView::removeSelectedItems() } else { - llinfos << "Cannot delete " << item->getName() << llendl; + LL_INFOS() << "Cannot delete " << item->getName() << LL_ENDL; return; } } @@ -768,20 +766,21 @@ void LLFolderView::removeSelectedItems() } else if (count > 1) { - LLDynamicArray<LLFolderViewModelItem*> listeners; + std::vector<LLFolderViewModelItem*> listeners; LLFolderViewModelItem* listener; setSelection(item_to_select, item_to_select ? item_to_select->isOpen() : false, mParentPanel.get()->hasFocus()); + listeners.reserve(count); for(S32 i = 0; i < count; ++i) { listener = items[i]->getViewModelItem(); - if(listener && (listeners.find(listener) == LLDynamicArray<LLFolderViewModelItem*>::FAIL)) + if(listener && (std::find(listeners.begin(), listeners.end(), listener) == listeners.end())) { - listeners.put(listener); + listeners.push_back(listener); } } - listener = static_cast<LLFolderViewModelItem*>(listeners.get(0)); + listener = static_cast<LLFolderViewModelItem*>(listeners.at(0)); if(listener) { listener->removeBatch(listeners); @@ -1288,7 +1287,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char) if (uni_char > 0x7f) { - llwarns << "LLFolderView::handleUnicodeCharHere - Don't handle non-ascii yet, aborting" << llendl; + LL_WARNS() << "LLFolderView::handleUnicodeCharHere - Don't handle non-ascii yet, aborting" << LL_ENDL; return FALSE; } @@ -1584,7 +1583,7 @@ BOOL LLFolderView::getShowSelectionContext() return FALSE; } -void LLFolderView::setShowSingleSelection(BOOL show) +void LLFolderView::setShowSingleSelection(bool show) { if (show != mShowSingleSelection) { @@ -1593,15 +1592,15 @@ void LLFolderView::setShowSingleSelection(BOOL show) } } -static LLFastTimer::DeclareTimer FTM_AUTO_SELECT("Open and Select"); -static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory"); +static LLTrace::BlockTimerStatHandle FTM_AUTO_SELECT("Open and Select"); +static LLTrace::BlockTimerStatHandle FTM_INVENTORY("Inventory"); // Main idle routine void LLFolderView::update() { // If this is associated with the user's inventory, don't do anything // until that inventory is loaded up. - LLFastTimer t2(FTM_INVENTORY); + LL_RECORD_BLOCK_TIME(FTM_INVENTORY); // If there's no model, the view is in suspended state (being deleted) and shouldn't be updated if (getFolderViewModel() == NULL) @@ -1629,7 +1628,7 @@ void LLFolderView::update() // automatically show matching items, and select first one if we had a selection if (mNeedsAutoSelect) { - LLFastTimer t3(FTM_AUTO_SELECT); + LL_RECORD_BLOCK_TIME(FTM_AUTO_SELECT); // select new item only if a filtered item not currently selected LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? NULL : mSelectedItems.back(); if (!mAutoSelectOverride && (!selected_itemp || !selected_itemp->getViewModelItem()->potentiallyVisible())) @@ -1762,14 +1761,14 @@ void LLFolderView::update() void LLFolderView::dumpSelectionInformation() { - llinfos << "LLFolderView::dumpSelectionInformation()" << llendl; - llinfos << "****************************************" << llendl; + LL_INFOS() << "LLFolderView::dumpSelectionInformation()" << LL_NEWLINE + << "****************************************" << LL_ENDL; selected_items_t::iterator item_it; for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it) { - llinfos << " " << (*item_it)->getName() << llendl; + LL_INFOS() << " " << (*item_it)->getName() << LL_ENDL; } - llinfos << "****************************************" << llendl; + LL_INFOS() << "****************************************" << LL_ENDL; } void LLFolderView::updateRenamerPosition() diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 8729bce752a71ebd5f14be4b8e3182c18940cd7d..08e0a6220a7fcf30f84fccd32c61bfb958e46737 100755 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -39,7 +39,6 @@ #include "lluictrl.h" #include "v4color.h" -#include "stdenums.h" #include "lldepthstack.h" #include "lleditmenuhandler.h" #include "llfontgl.h" @@ -209,9 +208,9 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler LLRect getVisibleRect(); BOOL search(LLFolderViewItem* first_item, const std::string &search_string, BOOL backward); - void setShowSelectionContext(BOOL show) { mShowSelectionContext = show; } + void setShowSelectionContext(bool show) { mShowSelectionContext = show; } BOOL getShowSelectionContext(); - void setShowSingleSelection(BOOL show); + void setShowSingleSelection(bool show); BOOL getShowSingleSelection() { return mShowSingleSelection; } F32 getSelectionFadeElapsedTime() { return mMultiSelectionFadeTimer.getElapsedTimeF32(); } bool getUseEllipses() { return mUseEllipses; } @@ -264,31 +263,32 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler LLHandle<LLView> mPopupMenuHandle; selected_items_t mSelectedItems; - BOOL mKeyboardSelection; - BOOL mAllowMultiSelect; - BOOL mShowEmptyMessage; - BOOL mShowFolderHierarchy; + bool mKeyboardSelection, + mAllowMultiSelect, + mShowEmptyMessage, + mShowFolderHierarchy, + mNeedsScroll, + mPinningSelectedItem, + mNeedsAutoSelect, + mAutoSelectOverride, + mNeedsAutoRename, + mUseLabelSuffix, + mDragAndDropThisFrame, + mShowItemLinkOverlays, + mShowSelectionContext, + mShowSingleSelection; // Renaming variables and methods LLFolderViewItem* mRenameItem; // The item currently being renamed LLLineEditor* mRenamer; - BOOL mNeedsScroll; - BOOL mPinningSelectedItem; LLRect mScrollConstraintRect; - BOOL mNeedsAutoSelect; - BOOL mAutoSelectOverride; - BOOL mNeedsAutoRename; - bool mUseLabelSuffix; - bool mShowItemLinkOverlays; LLDepthStack<LLFolderViewFolder> mAutoOpenItems; LLFolderViewFolder* mAutoOpenCandidate; LLFrameTimer mAutoOpenTimer; LLFrameTimer mSearchTimer; std::string mSearchString; - BOOL mShowSelectionContext; - BOOL mShowSingleSelection; LLFrameTimer mMultiSelectionFadeTimer; S32 mArrangeGeneration; @@ -296,7 +296,6 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler signal_t mReshapeSignal; S32 mSignalSelectCallback; S32 mMinWidth; - BOOL mDragAndDropThisFrame; LLHandle<LLPanel> mParentPanel; diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index aa2343226cbd29c3b2132792304c53c17ab77c65..83254c2840737f6555eda17528efba3dfa404a65 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -495,7 +495,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask ) // No handler needed for focus lost since this class has no // state that depends on it. gFocusMgr.setMouseCapture( this ); - + if (!mIsSelected) { if(mask & MASK_CONTROL) @@ -642,7 +642,7 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, } if (handled) { - lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFolderViewItem" << llendl; + LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFolderViewItem" << LL_ENDL; } return handled; @@ -712,7 +712,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, 0.f, bg_color.mV[VALPHA]); } gl_rect_2d(FOCUS_LEFT, - focus_top, + focus_top, getRect().getWidth() - 2, focus_bottom, bg_color, hasKeyboardFocus); @@ -866,7 +866,7 @@ void LLFolderViewItem::draw() LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE ); } - + //--------------------------------------------------------------------------------// // Highlight string match // @@ -888,7 +888,7 @@ const LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) c { return getRoot()->getFolderViewModel(); } - + LLFolderViewModelInterface* LLFolderViewItem::getFolderViewModel( void ) { return getRoot()->getFolderViewModel(); @@ -925,11 +925,11 @@ void LLFolderViewFolder::updateLabelRotation() } else if (isOpen()) { - mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLCriticalDamp::getInterpolant(0.04f)); + mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLSmoothInterpolation::getInterpolant(0.04f)); } else { - mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLCriticalDamp::getInterpolant(0.025f)); + mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLSmoothInterpolation::getInterpolant(0.025f)); } } @@ -952,7 +952,7 @@ void LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder) : 0; } -static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange"); +static LLTrace::BlockTimerStatHandle FTM_ARRANGE("Arrange"); // Make everything right and in the right place ready for drawing (CHUI-849) // * Sort everything correctly if necessary @@ -967,7 +967,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) // Note that we sort from the root (CHUI-849) getRoot()->getFolderViewModel()->sort(this); - LLFastTimer t2(FTM_ARRANGE); + LL_RECORD_BLOCK_TIME(FTM_ARRANGE); // evaluate mHasVisibleChildren mHasVisibleChildren = false; @@ -1073,7 +1073,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height ) // animate current height towards target height if (llabs(mCurHeight - mTargetHeight) > 1.f) { - mCurHeight = lerp(mCurHeight, mTargetHeight, LLCriticalDamp::getInterpolant(isOpen() ? FOLDER_OPEN_TIME_CONSTANT : FOLDER_CLOSE_TIME_CONSTANT)); + mCurHeight = lerp(mCurHeight, mTargetHeight, LLSmoothInterpolation::getInterpolant(isOpen() ? FOLDER_OPEN_TIME_CONSTANT : FOLDER_CLOSE_TIME_CONSTANT)); requestArrange(); @@ -1594,7 +1594,7 @@ void LLFolderViewFolder::addItem(LLFolderViewItem* item) item->setVisible(FALSE); addChild(item); - + // When the model is already hooked into a hierarchy (i.e. has a parent), do not reparent it // Note: this happens when models are created before views or shared between views if (!item->getViewModelItem()->hasParent()) @@ -1767,7 +1767,7 @@ BOOL LLFolderViewFolder::handleDragAndDrop(S32 x, S32 y, MASK mask, { handleDragAndDropToThisFolder(mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFolderViewFolder" << llendl; + LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFolderViewFolder" << LL_ENDL; } return TRUE; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index a909d13f97fc7b6c90e72f54003fbc53d458a06b..8d98363c5fd59c1e520abe6d0ae2b4906126a11e 100755 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -108,9 +108,13 @@ class LLFolderViewFilter virtual S32 getFirstRequiredGeneration() const = 0; }; -class LLFolderViewModelInterface +class LLFolderViewModelInterface : public LLTrace::MemTrackable<LLFolderViewModelInterface> { public: + LLFolderViewModelInterface() + : LLTrace::MemTrackable<LLFolderViewModelInterface>("LLFolderViewModelInterface") + {} + virtual ~LLFolderViewModelInterface() {} virtual void requestSortAll() = 0; @@ -128,10 +132,13 @@ class LLFolderViewModelInterface // This is an abstract base class that users of the folderview classes // would use to bridge the folder view with the underlying data -class LLFolderViewModelItem : public LLRefCount +class LLFolderViewModelItem : public LLRefCount, public LLTrace::MemTrackable<LLFolderViewModelItem> { public: - LLFolderViewModelItem() { } + LLFolderViewModelItem() + : LLTrace::MemTrackable<LLFolderViewModelItem>("LLFolderViewModelItem") + {} + virtual ~LLFolderViewModelItem() { } virtual void update() {} //called when drawing @@ -336,18 +343,18 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; } virtual bool hasParent() { return mParent != NULL; } - S32 mSortVersion; - bool mPassedFilter; - bool mPassedFolderFilter; - std::string::size_type mStringMatchOffsetFilter; - std::string::size_type mStringFilterSize; + S32 mSortVersion; + bool mPassedFilter; + bool mPassedFolderFilter; + std::string::size_type mStringMatchOffsetFilter; + std::string::size_type mStringFilterSize; - S32 mLastFilterGeneration; - S32 mLastFolderFilterGeneration; - S32 mMostFilteredDescendantGeneration; + S32 mLastFilterGeneration, + mLastFolderFilterGeneration, + mMostFilteredDescendantGeneration; - child_list_t mChildren; - LLFolderViewModelItem* mParent; + child_list_t mChildren; + LLFolderViewModelItem* mParent; LLFolderViewModelInterface& mRootViewModel; void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} diff --git a/indra/llui/llfunctorregistry.h b/indra/llui/llfunctorregistry.h index beac21244192a1dcd9637237693db331eeb381c0..f5364f48636d12c81e7e9fe46e6052a5fcc2ffa5 100755 --- a/indra/llui/llfunctorregistry.h +++ b/indra/llui/llfunctorregistry.h @@ -75,7 +75,7 @@ class LLFunctorRegistry : public LLSingleton<LLFunctorRegistry<FUNCTOR_TYPE> > } else { - llerrs << "attempt to store duplicate name '" << name << "' in LLFunctorRegistry. NOT ADDED." << llendl; + LL_ERRS() << "attempt to store duplicate name '" << name << "' in LLFunctorRegistry. NOT ADDED." << LL_ENDL; retval = false; } @@ -86,7 +86,7 @@ class LLFunctorRegistry : public LLSingleton<LLFunctorRegistry<FUNCTOR_TYPE> > { if (mMap.count(name) == 0) { - llwarns << "trying to remove '" << name << "' from LLFunctorRegistry but it's not there." << llendl; + LL_WARNS() << "trying to remove '" << name << "' from LLFunctorRegistry but it's not there." << LL_ENDL; return false; } mMap.erase(name); @@ -101,7 +101,7 @@ class LLFunctorRegistry : public LLSingleton<LLFunctorRegistry<FUNCTOR_TYPE> > } else { - lldebugs << "tried to find '" << name << "' in LLFunctorRegistry, but it wasn't there." << llendl; + LL_DEBUGS() << "tried to find '" << name << "' in LLFunctorRegistry, but it wasn't there." << LL_ENDL; return mMap[LOGFUNCTOR]; } } @@ -113,7 +113,7 @@ class LLFunctorRegistry : public LLSingleton<LLFunctorRegistry<FUNCTOR_TYPE> > static void log_functor(const LLSD& notification, const LLSD& payload) { - lldebugs << "log_functor called with payload: " << payload << llendl; + LL_DEBUGS() << "log_functor called with payload: " << payload << LL_ENDL; } static void do_nothing(const LLSD& notification, const LLSD& payload) diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 30b79b4d20d068867355d4a6a5421aa005d45d51..58b66f60caa8a4858688af2c71acc807af1dc7e6 100755 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -42,7 +42,9 @@ LLIconCtrl::Params::Params() : image("image_name"), color("color"), use_draw_context_alpha("use_draw_context_alpha", true), - scale_image("scale_image") + scale_image("scale_image"), + min_width("min_width", 0), + min_height("min_height", 0) {} LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p) @@ -51,8 +53,8 @@ LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p) mImagep(p.image), mUseDrawContextAlpha(p.use_draw_context_alpha), mPriority(0), - mDrawWidth(0), - mDrawHeight(0) + mMinWidth(p.min_width), + mMinHeight(p.min_height) { if (mImagep.notNull()) { @@ -97,7 +99,13 @@ void LLIconCtrl::setValue(const LLSD& value ) mImagep = LLUI::getUIImage(tvalue.asString(), mPriority); } - setIconImageDrawSize(); + if(mImagep.notNull() + && mImagep->getImage().notNull() + && mMinWidth + && mMinHeight) + { + mImagep->getImage()->setKnownDrawSize(llmax(mMinWidth, mImagep->getWidth()), llmax(mMinHeight, mImagep->getHeight())); + } } std::string LLIconCtrl::getImageName() const @@ -108,14 +116,4 @@ std::string LLIconCtrl::getImageName() const return std::string(); } -void LLIconCtrl::setIconImageDrawSize() -{ - if(mImagep.notNull() && mDrawWidth && mDrawHeight) - { - if(mImagep->getImage().notNull()) - { - mImagep->getImage()->setKnownDrawSize(mDrawWidth, mDrawHeight) ; - } - } -} diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index efa0925a4a9364b493d44ab096ae723f100962a1..8b1092df46fa581dc8ac47ee5628e1632177e6ca 100755 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -31,7 +31,6 @@ #include "v4color.h" #include "lluictrl.h" #include "lluiimage.h" -#include "stdenums.h" class LLTextBox; class LLUICtrlFactory; @@ -50,7 +49,10 @@ class LLIconCtrl Optional<LLUIImage*> image; Optional<LLUIColor> color; Optional<bool> use_draw_context_alpha; + Optional<S32> min_width, + min_height; Ignored scale_image; + Params(); }; protected: @@ -72,15 +74,12 @@ class LLIconCtrl void setImage(LLPointer<LLUIImage> image) { mImagep = image; } const LLPointer<LLUIImage> getImage() { return mImagep; } -private: - void setIconImageDrawSize() ; - protected: S32 mPriority; //the output size of the icon image if set. - S32 mDrawWidth ; - S32 mDrawHeight ; + S32 mMinWidth, + mMinHeight; // If set to true (default), use the draw context transparency. // If false, will use transparency returned by getCurrentTransparency(). See STORM-698. diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 39153977bf12168049b4e0ed5cb40c265ae6773e..fcd7b274e855678edabf2523d2a8d01bf6953bc8 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -97,7 +97,7 @@ BOOL LLKeywords::loadFromFile( const std::string& filename ) file.open(filename); /* Flawfinder: ignore */ if( file.fail() ) { - llinfos << "LLKeywords::loadFromFile() Unable to open file: " << filename << llendl; + LL_INFOS() << "LLKeywords::loadFromFile() Unable to open file: " << filename << LL_ENDL; return mLoaded; } @@ -105,7 +105,7 @@ BOOL LLKeywords::loadFromFile( const std::string& filename ) file >> buffer; if( strcmp( buffer, "llkeywords" ) ) { - llinfos << filename << " does not appear to be a keyword file" << llendl; + LL_INFOS() << filename << " does not appear to be a keyword file" << LL_ENDL; return mLoaded; } @@ -115,7 +115,7 @@ BOOL LLKeywords::loadFromFile( const std::string& filename ) file >> version_num; if( strcmp(buffer, "version") || version_num != (U32)KEYWORD_FILE_CURRENT_VERSION ) { - llinfos << filename << " does not appear to be a version " << KEYWORD_FILE_CURRENT_VERSION << " keyword file" << llendl; + LL_INFOS() << filename << " does not appear to be a version " << KEYWORD_FILE_CURRENT_VERSION << " keyword file" << LL_ENDL; return mLoaded; } @@ -345,18 +345,18 @@ LLColor3 LLKeywords::readColor( const std::string& s ) S32 values_read = sscanf(s.c_str(), "%f, %f, %f]", &r, &g, &b ); if( values_read != 3 ) { - llinfos << " poorly formed color in keyword file" << llendl; + LL_INFOS() << " poorly formed color in keyword file" << LL_ENDL; } return LLColor3( r, g, b ); } -LLFastTimer::DeclareTimer FTM_SYNTAX_COLORING("Syntax Coloring"); +LLTrace::BlockTimerStatHandle FTM_SYNTAX_COLORING("Syntax Coloring"); // Walk through a string, applying the rules specified by the keyword token list and // create a list of color segments. void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLWString& wtext, const LLColor4 &defaultColor, LLTextEditor& editor) { - LLFastTimer ft(FTM_SYNTAX_COLORING); + LL_RECORD_BLOCK_TIME(FTM_SYNTAX_COLORING); seg_list->clear(); if( wtext.empty() ) @@ -555,7 +555,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW S32 seg_start = cur - base; S32 seg_end = seg_start + seg_len; - // llinfos << "Seg: [" << word.c_str() << "]" << llendl; + // LL_INFOS() << "Seg: [" << word.c_str() << "]" << LL_ENDL; insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, defaultColor, editor); } @@ -622,10 +622,10 @@ void LLKeywords::insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSe #ifdef _DEBUG void LLKeywords::dump() { - llinfos << "LLKeywords" << llendl; + LL_INFOS() << "LLKeywords" << LL_ENDL; - llinfos << "LLKeywords::sWordTokenMap" << llendl; + LL_INFOS() << "LLKeywords::sWordTokenMap" << LL_ENDL; word_token_map_t::iterator word_token_iter = mWordTokenMap.begin(); while( word_token_iter != mWordTokenMap.end() ) { @@ -634,7 +634,7 @@ void LLKeywords::dump() ++word_token_iter; } - llinfos << "LLKeywords::sLineTokenList" << llendl; + LL_INFOS() << "LLKeywords::sLineTokenList" << LL_ENDL; for (token_list_t::iterator iter = mLineTokenList.begin(); iter != mLineTokenList.end(); ++iter) { @@ -643,7 +643,7 @@ void LLKeywords::dump() } - llinfos << "LLKeywords::sDelimiterTokenList" << llendl; + LL_INFOS() << "LLKeywords::sDelimiterTokenList" << LL_ENDL; for (token_list_t::iterator iter = mDelimiterTokenList.begin(); iter != mDelimiterTokenList.end(); ++iter) { @@ -654,12 +654,12 @@ void LLKeywords::dump() void LLKeywordToken::dump() { - llinfos << "[" << + LL_INFOS() << "[" << mColor.mV[VX] << ", " << mColor.mV[VY] << ", " << mColor.mV[VZ] << "] [" << wstring_to_utf8str(mToken) << "]" << - llendl; + LL_ENDL; } #endif // DEBUG diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index c89c0203b4accb5d5e49a4d9ee9dbe8a88379854..c59286fc6001306d71fb871d2993bed11465c2ba 100755 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -33,6 +33,7 @@ #include "lllocalcliprect.h" #include "llpanel.h" #include "llcriticaldamp.h" +#include "lliconctrl.h" #include "boost/foreach.hpp" static const F32 MIN_FRACTIONAL_SIZE = 0.00001f; @@ -41,12 +42,6 @@ static const F32 MAX_FRACTIONAL_SIZE = 1.f; static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack"); static LLLayoutStack::LayoutStackRegistry::Register<LLLayoutPanel> register_layout_panel("layout_panel"); -void LLLayoutStack::OrientationNames::declareValues() -{ - declare("horizontal", HORIZONTAL); - declare("vertical", VERTICAL); -} - // // LLLayoutPanel // @@ -140,7 +135,7 @@ S32 LLLayoutPanel::getVisibleDim() const + (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt)))); } -void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientation ) +void LLLayoutPanel::setOrientation( LLView::EOrientation orientation ) { mOrientation = orientation; S32 layout_dim = llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL) @@ -274,25 +269,9 @@ void LLLayoutStack::draw() // only force drawing invisible children if visible amount is non-zero drawChild(panelp, 0, 0, !clip_rect.isEmpty()); } - } - - const LLView::child_list_t * child_listp = getChildList(); - BOOST_FOREACH(LLView * childp, * child_listp) - { - LLResizeBar * resize_barp = dynamic_cast<LLResizeBar*>(childp); - if (resize_barp && resize_barp->isShowDragHandle() && resize_barp->getVisible() && resize_barp->getRect().isValid()) + if (panelp->getResizeBar()->getVisible()) { - LLRect screen_rect = resize_barp->calcScreenRect(); - if (LLUI::getRootView()->getLocalRect().overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect)) - { - LLUI::pushMatrix(); - { - const LLRect& rb_rect(resize_barp->getRect()); - LLUI::translate(rb_rect.mLeft, rb_rect.mBottom); - resize_barp->draw(); - } - LLUI::popMatrix(); - } + drawChild(panelp->getResizeBar()); } } } @@ -355,11 +334,36 @@ void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed) mNeedsLayout = true; } -static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_LAYOUT("Update LayoutStacks"); + +class LLImagePanel : public LLPanel +{ +public: + struct Params : public LLInitParam::Block<Params, LLPanel::Params> + { + Optional<bool> horizontal; + Params() : horizontal("horizontal", false) {} + }; + LLImagePanel(const Params& p) : LLPanel(p), mHorizontal(p.horizontal) {} + virtual ~LLImagePanel() {} + + void draw() + { + const LLRect& parent_rect = getParent()->getRect(); + const LLRect& rect = getRect(); + LLRect clip_rect( -rect.mLeft, parent_rect.getHeight() - rect.mBottom - 2 + , parent_rect.getWidth() - rect.mLeft - (mHorizontal ? 2 : 0), -rect.mBottom); + LLLocalClipRect clip(clip_rect); + LLPanel::draw(); + } + +private: + bool mHorizontal; +}; void LLLayoutStack::updateLayout() { - LLFastTimer ft(FTM_UPDATE_LAYOUT); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_LAYOUT); if (!mNeedsLayout) return; @@ -441,8 +445,6 @@ void LLLayoutStack::updateLayout() } LLRect resize_bar_rect(panel_rect); - LLResizeBar * resize_barp = panelp->getResizeBar(); - bool show_drag_handle = resize_barp->isShowDragHandle(); F32 panel_spacing = (F32)mPanelSpacing * panelp->getVisibleAmount(); F32 panel_visible_dim = panelp->getVisibleDim(); S32 panel_spacing_round = (S32)(llround(panel_spacing)); @@ -451,7 +453,7 @@ void LLLayoutStack::updateLayout() { cur_pos += panel_visible_dim + panel_spacing; - if (show_drag_handle && panel_spacing_round > mDragHandleThickness) + if (mShowDragHandle && panel_spacing_round > mDragHandleThickness) { resize_bar_rect.mLeft = panel_rect.mRight + mDragHandleShift; resize_bar_rect.mRight = resize_bar_rect.mLeft + mDragHandleThickness; @@ -462,7 +464,7 @@ void LLLayoutStack::updateLayout() resize_bar_rect.mRight = panel_rect.mRight + panel_spacing_round + mResizeBarOverlap; } - if (show_drag_handle) + if (mShowDragHandle) { resize_bar_rect.mBottom += mDragHandleSecondIndent; resize_bar_rect.mTop -= mDragHandleFirstIndent; @@ -473,7 +475,7 @@ void LLLayoutStack::updateLayout() { cur_pos -= panel_visible_dim + panel_spacing; - if (show_drag_handle && panel_spacing_round > mDragHandleThickness) + if (mShowDragHandle && panel_spacing_round > mDragHandleThickness) { resize_bar_rect.mTop = panel_rect.mBottom - mDragHandleShift; resize_bar_rect.mBottom = resize_bar_rect.mTop - mDragHandleThickness; @@ -484,7 +486,7 @@ void LLLayoutStack::updateLayout() resize_bar_rect.mBottom = panel_rect.mBottom - panel_spacing_round - mResizeBarOverlap; } - if (show_drag_handle) + if (mShowDragHandle) { resize_bar_rect.mLeft += mDragHandleFirstIndent; resize_bar_rect.mRight -= mDragHandleSecondIndent; @@ -547,9 +549,69 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) resize_params.min_size(lp->getRelevantMinDim()); resize_params.side((mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM); resize_params.snapping_enabled(false); - resize_params.show_drag_handle(mShowDragHandle); LLResizeBar* resize_bar = LLUICtrlFactory::create<LLResizeBar>(resize_params); lp->mResizeBar = resize_bar; + + if (mShowDragHandle) + { + LLPanel::Params resize_bar_bg_panel_p; + resize_bar_bg_panel_p.name = "resize_handle_bg_panel"; + resize_bar_bg_panel_p.rect = lp->mResizeBar->getLocalRect(); + resize_bar_bg_panel_p.follows.flags = FOLLOWS_ALL; + resize_bar_bg_panel_p.tab_stop = false; + resize_bar_bg_panel_p.background_visible = true; + resize_bar_bg_panel_p.bg_alpha_color = LLUIColorTable::instance().getColor("ResizebarBody"); + resize_bar_bg_panel_p.has_border = true; + resize_bar_bg_panel_p.border.border_thickness = 1; + resize_bar_bg_panel_p.border.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight"); + resize_bar_bg_panel_p.border.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark"); + + LLPanel* resize_bar_bg_panel = LLUICtrlFactory::create<LLPanel>(resize_bar_bg_panel_p); + + LLIconCtrl::Params icon_p; + icon_p.name = "resize_handle_image"; + icon_p.rect = lp->mResizeBar->getLocalRect(); + icon_p.follows.flags = FOLLOWS_ALL; + icon_p.image = LLUI::getUIImage(mOrientation == HORIZONTAL ? "Vertical Drag Handle" : "Horizontal Drag Handle"); + resize_bar_bg_panel->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_p)); + + lp->mResizeBar->addChild(resize_bar_bg_panel); + } + + /*if (mShowDragHandle) + { + LLViewBorder::Params border_params; + border_params.border_thickness = 1; + border_params.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight"); + border_params.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark"); + + addBorder(border_params); + setBorderVisible(TRUE); + + LLImagePanel::Params image_panel; + mDragHandleImage = LLUI::getUIImage(LLResizeBar::RIGHT == mSide ? "Vertical Drag Handle" : "Horizontal Drag Handle"); + image_panel.bg_alpha_image = mDragHandleImage; + image_panel.background_visible = true; + image_panel.horizontal = (LLResizeBar::BOTTOM == mSide); + mImagePanel = LLUICtrlFactory::create<LLImagePanel>(image_panel); + setImagePanel(mImagePanel); + }*/ + + //if (mShowDragHandle) + //{ + // setBackgroundVisible(TRUE); + // setTransparentColor(LLUIColorTable::instance().getColor("ResizebarBody")); + //} + + /*if (mShowDragHandle) + { + S32 image_width = mDragHandleImage->getTextureWidth(); + S32 image_height = mDragHandleImage->getTextureHeight(); + const LLRect& panel_rect = getRect(); + S32 image_left = (panel_rect.getWidth() - image_width) / 2 - 1; + S32 image_bottom = (panel_rect.getHeight() - image_height) / 2; + mImagePanel->setRect(LLRect(image_left, image_bottom + image_height, image_left + image_width, image_bottom)); + }*/ LLView::addChild(resize_bar, 0); } } @@ -655,7 +717,7 @@ bool LLLayoutStack::animatePanels() { if (!mAnimatedThisFrame) { - panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant)); + panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLSmoothInterpolation::getInterpolant(mOpenTimeConstant)); if (panelp->mVisibleAmt > 0.99f) { panelp->mVisibleAmt = 1.f; @@ -680,7 +742,7 @@ bool LLLayoutStack::animatePanels() { if (!mAnimatedThisFrame) { - panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); + panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant)); if (panelp->mVisibleAmt < 0.001f) { panelp->mVisibleAmt = 0.f; @@ -707,7 +769,7 @@ bool LLLayoutStack::animatePanels() { if (!mAnimatedThisFrame) { - panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); + panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant)); } if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f) diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index add43fa741e54040edf7d9ce81d9f3061c43d6a3..a245ebe1b9cce788732535aa26a5c8e8ba9aaee3 100755 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -39,24 +39,12 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack> { public: - typedef enum e_layout_orientation - { - HORIZONTAL, - VERTICAL - } ELayoutOrientation; - - struct OrientationNames - : public LLInitParam::TypeValuesHelper<ELayoutOrientation, OrientationNames> - { - static void declareValues(); - }; - struct LayoutStackRegistry : public LLChildRegistry<LayoutStackRegistry> {}; struct Params : public LLInitParam::Block<Params, LLView::Params> { - Mandatory<ELayoutOrientation, OrientationNames> orientation; + Mandatory<EOrientation> orientation; Optional<S32> border_size; Optional<bool> animate, clip; @@ -79,7 +67,7 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack> /*virtual*/ void draw(); /*virtual*/ void removeChild(LLView*); /*virtual*/ BOOL postBuild(); - /*virtual*/ bool addChild(LLView* child, S32 tab_groupdatefractuiona = 0); + /*virtual*/ bool addChild(LLView* child, S32 tab_group = 0); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); @@ -111,7 +99,7 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack> bool animatePanels(); void createResizeBar(LLLayoutPanel* panel); - const ELayoutOrientation mOrientation; + const EOrientation mOrientation; typedef std::vector<LLLayoutPanel*> e_panel_list_t; e_panel_list_t mPanels; @@ -194,7 +182,7 @@ friend class LLUICtrlFactory; bool isCollapsed() const { return mCollapsed;} - void setOrientation(LLLayoutStack::ELayoutOrientation orientation); + void setOrientation(LLView::EOrientation orientation); void storeOriginalDim(); void setIgnoreReshape(bool ignore) { mIgnoreReshape = ignore; } @@ -213,7 +201,7 @@ friend class LLUICtrlFactory; F32 mFractionalSize; S32 mTargetDim; bool mIgnoreReshape; - LLLayoutStack::ELayoutOrientation mOrientation; + LLView::EOrientation mOrientation; class LLResizeBar* mResizeBar; }; diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 5478e85e13a01842bb4f359d95e2167d398491b5..d410a2de3394ed7daa909b9fd544890e4ffe6ce1 100755 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -785,7 +785,7 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLLineEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) { - // llinfos << "MiddleMouseDown" << llendl; + // LL_INFOS() << "MiddleMouseDown" << LL_ENDL; setFocus( TRUE ); if( canPastePrimary() ) { @@ -855,14 +855,14 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) mKeystrokeTimer.reset(); getWindow()->setCursor(UI_CURSOR_IBEAM); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; handled = TRUE; } if( !handled ) { getWindow()->setCursor(UI_CURSOR_IBEAM); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; handled = TRUE; } @@ -1347,7 +1347,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) case KEY_BACKSPACE: if (!mReadOnly) { - //llinfos << "Handling backspace" << llendl; + //LL_INFOS() << "Handling backspace" << LL_ENDL; if( hasSelection() ) { deleteSelection(); @@ -2379,7 +2379,7 @@ void LLLineEditor::resetPreedit() { if (hasPreeditString()) { - llwarns << "Preedit and selection!" << llendl; + LL_WARNS() << "Preedit and selection!" << LL_ENDL; deselect(); } else @@ -2543,7 +2543,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length) setCursor(position); if (hasPreeditString()) { - llwarns << "markAsPreedit invoked when hasPreeditString is true." << llendl; + LL_WARNS() << "markAsPreedit invoked when hasPreeditString is true." << LL_ENDL; } mPreeditWString.assign( LLWString( mText.getWString(), position, length ) ); if (length > 0) diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index 746ade464892e5b5444c0287f56765c2140e43be..0609cd8b423c28a2492e9d0dda44ac976f275063 100755 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -96,7 +96,7 @@ void LLMenuButton::setMenu(const std::string& menu_filename, EMenuPosition posit LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance()); if (!menu) { - llwarns << "Error loading menu_button menu" << llendl; + LL_WARNS() << "Error loading menu_button menu" << LL_ENDL; return; } diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 6a57158eaa59270c6fedb0ed4c78f7760787797f..7383a8c3076f77ce21c25771b75eb644b1cfe821 100755 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -280,7 +280,7 @@ BOOL LLMenuItemGL::addToAcceleratorList(std::list <LLKeyBinding*> *listp) // warning.append("\n "); // warning.append(mLabel); - // llwarns << warning << llendl; + // LL_WARNS() << warning << LL_ENDL; // LLAlertDialog::modalAlert(warning); return FALSE; } @@ -549,13 +549,13 @@ BOOL LLMenuItemGL::setLabelArg( const std::string& key, const LLStringExplicit& return TRUE; } -void LLMenuItemGL::handleVisibilityChange(BOOL new_visibility) +void LLMenuItemGL::onVisibilityChange(BOOL new_visibility) { if (getMenu()) { getMenu()->needsArrange(); } - LLView::handleVisibilityChange(new_visibility); + LLView::onVisibilityChange(new_visibility); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1154,13 +1154,13 @@ void LLMenuItemBranchGL::updateBranchParent(LLView* parentp) } } -void LLMenuItemBranchGL::handleVisibilityChange( BOOL new_visibility ) +void LLMenuItemBranchGL::onVisibilityChange( BOOL new_visibility ) { if (new_visibility == FALSE && getBranch() && !getBranch()->getTornOff()) { getBranch()->setVisible(FALSE); } - LLMenuItemGL::handleVisibilityChange(new_visibility); + LLMenuItemGL::onVisibilityChange(new_visibility); } BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask ) @@ -1822,7 +1822,7 @@ bool LLMenuGL::addContextChild(LLView* view, S32 tab_group) { return appendMenu(menup); } - + return false; } @@ -2003,7 +2003,7 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction) break; } default: - llwarns << "Unknown scrolling direction: " << direction << llendl; + LL_WARNS() << "Unknown scrolling direction: " << direction << LL_ENDL; } mNeedsArrange = TRUE; @@ -2603,8 +2603,8 @@ BOOL LLMenuGL::appendMenu( LLMenuGL* menu ) { if( menu == this ) { - llerrs << "** Attempt to attach menu to itself. This is certainly " - << "a logic error." << llendl; + LL_ERRS() << "** Attempt to attach menu to itself. This is certainly " + << "a logic error." << LL_ENDL; } BOOL success = TRUE; @@ -2632,7 +2632,7 @@ BOOL LLMenuGL::appendContextSubMenu(LLMenuGL *menu) { if (menu == this) { - llerrs << "Can't attach a context menu to itself" << llendl; + LL_ERRS() << "Can't attach a context menu to itself" << LL_ENDL; } LLContextMenuBranch *item; @@ -3163,7 +3163,7 @@ LLMenuGL* LLMenuGL::findChildMenuByName(const std::string& name, BOOL recurse) c return menup; } } - llwarns << "Child Menu " << name << " not found in menu " << getName() << llendl; + LL_WARNS() << "Child Menu " << name << " not found in menu " << getName() << LL_ENDL; return NULL; } @@ -3474,8 +3474,8 @@ BOOL LLMenuBarGL::appendMenu( LLMenuGL* menu ) { if( menu == this ) { - llerrs << "** Attempt to attach menu to itself. This is certainly " - << "a logic error." << llendl; + LL_ERRS() << "** Attempt to attach menu to itself. This is certainly " + << "a logic error." << LL_ENDL; } BOOL success = TRUE; @@ -3804,7 +3804,7 @@ void LLTearOffMenu::draw() if (getRect().getHeight() != mTargetHeight) { // animate towards target height - reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f)))); + reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLSmoothInterpolation::getInterpolant(0.05f)))); } LLFloater::draw(); } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 51df5df1f8231b3dc327b2fadbcfc56056cd5759..feafaab199951d674bce1cc92b79c93a47ddbda1 100755 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -82,7 +82,7 @@ class LLMenuItemGL : public LLUICtrl friend class LLUICtrlFactory; public: // LLView overrides - /*virtual*/ void handleVisibilityChange(BOOL new_visibility); + /*virtual*/ void onVisibilityChange(BOOL new_visibility); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); @@ -637,7 +637,7 @@ class LLMenuItemBranchGL : public LLMenuItemGL virtual void updateBranchParent( LLView* parentp ); // LLView Functionality - virtual void handleVisibilityChange( BOOL curVisibilityIn ); + virtual void onVisibilityChange( BOOL curVisibilityIn ); virtual void draw(); diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index 4d6e189b92bc0d2b1535faf45d8eabe8e4646122..33e66add1829c382f7cb85927d3cb6b736c91381 100755 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -65,7 +65,7 @@ LLModalDialog::~LLModalDialog() std::list<LLModalDialog*>::iterator iter = std::find(sModalStack.begin(), sModalStack.end(), this); if (iter != sModalStack.end()) { - llerrs << "Attempt to delete dialog while still in sModalStack!" << llendl; + LL_ERRS() << "Attempt to delete dialog while still in sModalStack!" << LL_ENDL; } } @@ -126,7 +126,7 @@ void LLModalDialog::stopModal() } else { - llwarns << "LLModalDialog::stopModal not in list!" << llendl; + LL_WARNS() << "LLModalDialog::stopModal not in list!" << LL_ENDL; } } if (!sModalStack.empty()) @@ -195,7 +195,7 @@ BOOL LLModalDialog::handleHover(S32 x, S32 y, MASK mask) if( childrenHandleHover(x, y, mask) == NULL ) { getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << LL_ENDL; } LLView* popup_menu = LLMenuGL::sMenuContainer->getVisibleMenu(); @@ -331,7 +331,7 @@ void LLModalDialog::shutdownModals() // app, we shouldn't have to care WHAT's open. Put differently, if a modal // dialog is so crucial that we can't let the user terminate until s/he // addresses it, we should reject a termination request. The current state - // of affairs is that we accept it, but then produce an llerrs popup that + // of affairs is that we accept it, but then produce an LL_ERRS() popup that // simply makes our software look unreliable. sModalStack.clear(); } diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp index 179b251cdbc5929b0788e9b427c5f16418bf459a..d1a597511eff4dd85d91b559f82763f5b9d9fb1f 100755 --- a/indra/llui/llmultifloater.cpp +++ b/indra/llui/llmultifloater.cpp @@ -67,14 +67,13 @@ void LLMultiFloater::buildTabContainer() } } -void LLMultiFloater::onOpen(const LLSD& key) +void LLMultiFloater::onClose(bool app_quitting) { -// if (mTabContainer->getTabCount() <= 0) -// { -// // for now, don't allow multifloaters -// // without any child floaters -// closeFloater(); -// } + if(isMinimized()) + { + setMinimized(FALSE); + } + LLFloater::onClose(app_quitting); } void LLMultiFloater::draw() @@ -159,7 +158,7 @@ void LLMultiFloater::addFloater(LLFloater* floaterp, BOOL select_added_floater, if (!mTabContainer) { - llerrs << "Tab Container used without having been initialized." << llendl; + LL_ERRS() << "Tab Container used without having been initialized." << LL_ENDL; return; } diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h index d9922126503e2773c573661298a4558ddea5293c..c106a6252746f6756a5a845283f839f1b0993f69 100755 --- a/indra/llui/llmultifloater.h +++ b/indra/llui/llmultifloater.h @@ -44,7 +44,7 @@ class LLMultiFloater : public LLFloater void buildTabContainer(); virtual BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onClose(bool app_quitting); virtual void draw(); virtual void setVisible(BOOL visible); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); @@ -100,6 +100,3 @@ class LLMultiFloater : public LLFloater }; #endif // LL_MULTI_FLOATER_H - - - diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 70bcfb5b4f92053621f45dbdb48902a0444c954f..0aa3e170754edb943ec628f3b73d7b873f87d87d 100755 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -301,7 +301,7 @@ bool LLMultiSlider::findUnusedValue(F32& initVal) // stop if it's filled if(initVal == mInitialValue && !firstTry) { - llwarns << "Whoa! Too many multi slider elements to add one to" << llendl; + LL_WARNS() << "Whoa! Too many multi slider elements to add one to" << LL_ENDL; return false; } @@ -356,12 +356,12 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) onCommit(); getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; } else { getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; } return TRUE; } diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 91e5b6b9de905e127dacee4c87826370d3310cca..c460a08afc7341bff99eb0619466e475a3ea117c 100755 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -450,7 +450,7 @@ void LLMultiSliderCtrl::setPrecision(S32 precision) { if (precision < 0 || precision > 10) { - llerrs << "LLMultiSliderCtrl::setPrecision - precision out of range" << llendl; + LL_ERRS() << "LLMultiSliderCtrl::setPrecision - precision out of range" << LL_ENDL; return; } diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 5c288c3f03e618a1597c630dd005475c522262ad..025cd81d921a76b957e0ede4c3614793cd0bcae1 100755 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -246,7 +246,7 @@ LLNotificationForm::LLNotificationForm(const LLSD& sd) } else { - llwarns << "Invalid form data " << sd << llendl; + LL_WARNS() << "Invalid form data " << sd << LL_ENDL; mFormData = LLSD::emptyArray(); } } @@ -438,11 +438,11 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par mUniqueContext.push_back(context.value); } - lldebugs << "notification \"" << mName << "\": tag count is " << p.tags.size() << llendl; + LL_DEBUGS() << "notification \"" << mName << "\": tag count is " << p.tags.size() << LL_ENDL; BOOST_FOREACH(const LLNotificationTemplate::Tag& tag, p.tags) { - lldebugs << " tag \"" << std::string(tag.value) << "\"" << llendl; + LL_DEBUGS() << " tag \"" << std::string(tag.value) << "\"" << LL_ENDL; mTags.push_back(tag.value); } @@ -516,7 +516,7 @@ LLNotification::LLNotification(const LLSDParamAdapter<Params>& p) : LLSD LLNotification::asLLSD(bool excludeTemplateElements) -{ +{ LLParamSDParser parser; Params p; @@ -544,12 +544,12 @@ LLSD LLNotification::asLLSD(bool excludeTemplateElements) mForm->getElements(dynamicElements, templateForm->getNumElements()); p.form_elements = dynamicElements; } - + if(mResponder) { p.functor.responder_sd = mResponder->asLLSD(); } - + if(!mResponseFunctorName.empty()) { p.functor.name = mResponseFunctorName; @@ -1208,6 +1208,9 @@ LLNotifications::LLNotifications() { mListener.reset(new LLNotificationsListener(*this)); LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Notification.Show", boost::bind(&LLNotifications::addFromCallback, this, _2)); + + // touch the instance tracker for notification channels, so that it will still be around in our destructor + LLInstanceTracker<LLNotificationChannel, std::string>::instanceCount(); } void LLNotifications::clear() @@ -1407,7 +1410,7 @@ void LLNotifications::forceResponse(const LLNotification::Params& params, S32 op if (selected_item.isUndefined()) { - llwarns << "Invalid option" << option << " for notification " << (std::string)params.name << llendl; + LL_WARNS() << "Invalid option" << option << " for notification " << (std::string)params.name << LL_ENDL; return; } response[selected_item["name"].asString()] = true; @@ -1441,12 +1444,12 @@ void replaceSubstitutionStrings(LLXMLNodePtr node, StringMap& replacements) if (found != replacements.end()) { replacement = found->second; - lldebugs << "replaceSubstitutionStrings: value: \"" << value << "\" repl: \"" << replacement << "\"." << llendl; + LL_DEBUGS() << "replaceSubstitutionStrings: value: \"" << value << "\" repl: \"" << replacement << "\"." << LL_ENDL; it->second->setValue(replacement); } else { - llwarns << "replaceSubstitutionStrings FAILURE: could not find replacement \"" << value << "\"." << llendl; + LL_WARNS() << "replaceSubstitutionStrings FAILURE: could not find replacement \"" << value << "\"." << LL_ENDL; } } } @@ -1485,7 +1488,7 @@ void addPathIfExists(const std::string& new_path, std::vector<std::string>& path bool LLNotifications::loadTemplates() { - llinfos << "Reading notifications template" << llendl; + LL_INFOS() << "Reading notifications template" << LL_ENDL; // Passing findSkinnedFilenames(constraint=LLDir::ALL_SKINS) makes it // output all relevant pathnames instead of just the ones from the most // specific skin. @@ -1498,7 +1501,7 @@ bool LLNotifications::loadTemplates() if (!success || root.isNull() || !root->hasName( "notifications" )) { - llerrs << "Problem reading XML from UI Notifications file: " << base_filename << llendl; + LL_ERRS() << "Problem reading XML from UI Notifications file: " << base_filename << LL_ENDL; return false; } @@ -1508,7 +1511,7 @@ bool LLNotifications::loadTemplates() if(!params.validateBlock()) { - llerrs << "Problem reading XUI from UI Notifications file: " << base_filename << llendl; + LL_ERRS() << "Problem reading XUI from UI Notifications file: " << base_filename << LL_ENDL; return false; } @@ -1556,7 +1559,7 @@ bool LLNotifications::loadTemplates() mTemplates[notification.name] = LLNotificationTemplatePtr(new LLNotificationTemplate(notification)); } - llinfos << "...done" << llendl; + LL_INFOS() << "...done" << LL_ENDL; return true; } @@ -1574,7 +1577,7 @@ bool LLNotifications::loadVisibilityRules() if(!params.validateBlock()) { - llerrs << "Problem reading UI Notification Visibility Rules file: " << full_filename << llendl; + LL_ERRS() << "Problem reading UI Notification Visibility Rules file: " << full_filename << LL_ENDL; return false; } @@ -1639,7 +1642,7 @@ void LLNotifications::add(const LLNotificationPtr pNotif) LLNotificationSet::iterator it=mItems.find(pNotif); if (it != mItems.end()) { - llerrs << "Notification added a second time to the master notification channel." << llendl; + LL_ERRS() << "Notification added a second time to the master notification channel." << LL_ENDL; } updateItem(LLSD().with("sigtype", "add").with("id", pNotif->id()), pNotif); @@ -1697,7 +1700,7 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid) LLNotificationSet::iterator it=mItems.find(target); if (it == mItems.end()) { - LL_DEBUGS("Notifications") << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << llendl; + LL_DEBUGS("Notifications") << "Tried to dereference uuid '" << uuid << "' as a notification key but didn't find it." << LL_ENDL; return LLNotificationPtr((LLNotification*)NULL); } else @@ -1748,13 +1751,13 @@ bool LLNotifications::isVisibleByRules(LLNotificationPtr n) for(it = mVisibilityRules.begin(); it != mVisibilityRules.end(); it++) { // An empty type/tag/name string will match any notification, so only do the comparison when the string is non-empty in the rule. - lldebugs + LL_DEBUGS() << "notification \"" << n->getName() << "\" " << "testing against " << ((*it)->mVisible?"show":"hide") << " rule, " << "name = \"" << (*it)->mName << "\" " << "tag = \"" << (*it)->mTag << "\" " << "type = \"" << (*it)->mType << "\" " - << llendl; + << LL_ENDL; if(!(*it)->mType.empty()) { @@ -1793,7 +1796,7 @@ bool LLNotifications::isVisibleByRules(LLNotificationPtr n) if((*it)->mResponse.empty()) { // Response property is empty. Cancel this notification. - lldebugs << "cancelling notification " << n->getName() << llendl; + LL_DEBUGS() << "cancelling notification " << n->getName() << LL_ENDL; cancel(n); } @@ -1804,7 +1807,7 @@ bool LLNotifications::isVisibleByRules(LLNotificationPtr n) // TODO: verify that the response template has an item with the correct name response[(*it)->mResponse] = true; - lldebugs << "responding to notification " << n->getName() << " with response = " << response << llendl; + LL_DEBUGS() << "responding to notification " << n->getName() << " with response = " << response << LL_ENDL; n->respond(response); } @@ -1816,7 +1819,7 @@ bool LLNotifications::isVisibleByRules(LLNotificationPtr n) break; } - lldebugs << "allowing notification " << n->getName() << llendl; + LL_DEBUGS() << "allowing notification " << n->getName() << LL_ENDL; return true; } @@ -1877,7 +1880,7 @@ void LLPostponedNotification::onAvatarNameCache(const LLUUID& agent_id, // from PE merge - we should figure out if this is the right thing to do if (name.empty()) { - llwarns << "Empty name received for Id: " << agent_id << llendl; + LL_WARNS() << "Empty name received for Id: " << agent_id << LL_ENDL; name = SYSTEM_FROM; } diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 6ac4a988060a653b668cbcd0ef7c4a121b211698..b0e8553a49c605e5104c55bb78952ea62a5c70e4 100755 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -92,6 +92,7 @@ #include "llevents.h" #include "llfunctorregistry.h" #include "llinitparam.h" +#include "llinstancetracker.h" #include "llmortician.h" #include "llnotificationptr.h" #include "llpointer.h" @@ -848,7 +849,7 @@ class LLNotificationChannel : Iterator begin(); Iterator end(); size_t size(); - + std::string summarize(); private: @@ -1067,15 +1068,13 @@ class LLPersistentNotificationChannel : public LLNotificationChannel public: LLPersistentNotificationChannel() : LLNotificationChannel("Persistent", "Visible", ¬ificationFilter) - { - } + {} typedef std::vector<LLNotificationPtr> history_list_t; history_list_t::iterator beginHistory() { sortHistory(); return mHistory.begin(); } history_list_t::iterator endHistory() { return mHistory.end(); } private: - struct sortByTime { S32 operator ()(const LLNotificationPtr& a, const LLNotificationPtr& b) @@ -1089,7 +1088,6 @@ class LLPersistentNotificationChannel : public LLNotificationChannel std::sort(mHistory.begin(), mHistory.end(), sortByTime()); } - // The channel gets all persistent notifications except those that have been canceled static bool notificationFilter(LLNotificationPtr pNotification) { diff --git a/indra/llui/llnotificationsutil.h b/indra/llui/llnotificationsutil.h index 4093324d0c38ab23301f370a3dfd1735f76a7eab..9f29087b4a8f6c9980be2c4d26270b2b135858c2 100755 --- a/indra/llui/llnotificationsutil.h +++ b/indra/llui/llnotificationsutil.h @@ -30,6 +30,7 @@ // to avoid including the heavyweight llnotifications.h #include "llnotificationptr.h" +#include "lluuid.h" #include <boost/function.hpp> diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index 18a82190b53b16471e9dd32e1cbd7ab69c5b9c4c..0315ddbea8f3b807cb90821f271eacae10eeb3a0 100755 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -28,32 +28,9 @@ #ifndef LL_LLNOTIFICATION_TEMPLATE_H #define LL_LLNOTIFICATION_TEMPLATE_H -//#include <string> -//#include <list> -//#include <vector> -//#include <map> -//#include <set> -//#include <iomanip> -//#include <sstream> -// -//#include <boost/utility.hpp> -//#include <boost/shared_ptr.hpp> -//#include <boost/enable_shared_from_this.hpp> -//#include <boost/type_traits.hpp> -// -//// we want to minimize external dependencies, but this one is important -//#include "llsd.h" -// -//// and we need this to manage the notification callbacks -//#include "llevents.h" -//#include "llfunctorregistry.h" -//#include "llpointer.h" #include "llinitparam.h" -//#include "llnotificationptr.h" -//#include "llcachename.h" #include "llnotifications.h" - typedef boost::shared_ptr<LLNotificationForm> LLNotificationFormPtr; // This is the class of object read from the XML file (notifications.xml, diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 67472ad1666f1a31e1e85752213176816ea07ff5..ee905741617a9b7c95138b2971a97916e223664a 100755 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -38,10 +38,8 @@ #include "lldir.h" #include "lltimer.h" -#include "llaccordionctrltab.h" #include "llbutton.h" #include "llmenugl.h" -//#include "llstatusbar.h" #include "llui.h" #include "llkeyboard.h" #include "lllineeditor.h" @@ -50,7 +48,6 @@ #include "lluictrl.h" #include "lluictrlfactory.h" #include "llviewborder.h" -#include "lltabcontainer.h" static LLDefaultChildRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML); LLPanel::factory_stack_t LLPanel::sFactoryStack; @@ -166,8 +163,8 @@ void LLPanel::removeBorder() // virtual void LLPanel::clearCtrls() { - LLView::ctrl_list_t ctrls = getCtrlList(); - for (LLView::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it) + LLPanel::ctrl_list_t ctrls = getCtrlList(); + for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it) { LLUICtrl* ctrl = *ctrl_it; ctrl->setFocus( FALSE ); @@ -178,14 +175,29 @@ void LLPanel::clearCtrls() void LLPanel::setCtrlsEnabled( BOOL b ) { - LLView::ctrl_list_t ctrls = getCtrlList(); - for (LLView::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it) + LLPanel::ctrl_list_t ctrls = getCtrlList(); + for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it) { LLUICtrl* ctrl = *ctrl_it; ctrl->setEnabled( b ); } } +LLPanel::ctrl_list_t LLPanel::getCtrlList() const +{ + ctrl_list_t controls; + for(child_list_t::const_iterator it = getChildList()->begin(), end_it = getChildList()->end(); it != end_it; ++it) + { + LLView* viewp = *it; + if(viewp->isCtrl()) + { + controls.push_back(static_cast<LLUICtrl*>(viewp)); + } + } + return controls; +} + + void LLPanel::draw() { F32 alpha = getDrawContext().mAlpha; @@ -342,9 +354,9 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) return handled; } -void LLPanel::handleVisibilityChange ( BOOL new_visibility ) +void LLPanel::onVisibilityChange ( BOOL new_visibility ) { - LLUICtrl::handleVisibilityChange ( new_visibility ); + LLUICtrl::onVisibilityChange ( new_visibility ); if (mVisibleSignal) (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD } @@ -372,7 +384,7 @@ void LLPanel::setBorderVisible(BOOL b) } } -LLFastTimer::DeclareTimer FTM_PANEL_CONSTRUCTION("Panel Construction"); +LLTrace::BlockTimerStatHandle FTM_PANEL_CONSTRUCTION("Panel Construction"); LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_node) { @@ -384,14 +396,14 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_ LLPanel* panelp = NULL; - { LLFastTimer _(FTM_PANEL_CONSTRUCTION); + { LL_RECORD_BLOCK_TIME(FTM_PANEL_CONSTRUCTION); if(!class_attr.empty()) { panelp = LLRegisterPanelClass::instance().createPanelClass(class_attr); if (!panelp) { - llwarns << "Panel class \"" << class_attr << "\" not registered." << llendl; + LL_WARNS() << "Panel class \"" << class_attr << "\" not registered." << LL_ENDL; } } @@ -488,15 +500,15 @@ void LLPanel::initFromParams(const LLPanel::Params& p) setAcceptsBadge(p.accepts_badge); } -static LLFastTimer::DeclareTimer FTM_PANEL_SETUP("Panel Setup"); -static LLFastTimer::DeclareTimer FTM_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference"); -static LLFastTimer::DeclareTimer FTM_PANEL_POSTBUILD("Panel PostBuild"); +static LLTrace::BlockTimerStatHandle FTM_PANEL_SETUP("Panel Setup"); +static LLTrace::BlockTimerStatHandle FTM_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference"); +static LLTrace::BlockTimerStatHandle FTM_PANEL_POSTBUILD("Panel PostBuild"); BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params) { Params params(default_params); { - LLFastTimer timer(FTM_PANEL_SETUP); + LL_RECORD_BLOCK_TIME(FTM_PANEL_SETUP); LLXMLNodePtr referenced_xml; std::string xml_filename = mXMLFilename; @@ -520,16 +532,16 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu Params output_params(params); setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); - parser.writeXUI(output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); return TRUE; } LLUICtrlFactory::instance().pushFileName(xml_filename); - LLFastTimer timer(FTM_EXTERNAL_PANEL_LOAD); + LL_RECORD_BLOCK_TIME(FTM_EXTERNAL_PANEL_LOAD); if (!LLUICtrlFactory::getLayeredXMLNode(xml_filename, referenced_xml)) { - llwarns << "Couldn't parse panel from: " << xml_filename << llendl; + LL_WARNS() << "Couldn't parse panel from: " << xml_filename << LL_ENDL; return FALSE; } @@ -551,13 +563,13 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu Params output_params(params); setupParamsForExport(output_params, parent); output_node->setName(node->getName()->mString); - parser.writeXUI(output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params); } params.from_xui = true; applyXUILayout(params, parent); { - LLFastTimer timer(FTM_PANEL_CONSTRUCTION); + LL_RECORD_BLOCK_TIME(FTM_PANEL_CONSTRUCTION); initFromParams(params); } @@ -574,7 +586,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu } { - LLFastTimer timer(FTM_PANEL_POSTBUILD); + LL_RECORD_BLOCK_TIME(FTM_PANEL_POSTBUILD); postBuild(); } } @@ -599,11 +611,11 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate if(LLUI::sSettingGroups["config"]->getBOOL("QAMode")) { - llerrs << err_str << llendl; + LL_ERRS() << err_str << LL_ENDL; } else { - llwarns << err_str << llendl; + LL_WARNS() << err_str << LL_ENDL; } return LLStringUtil::null; } @@ -618,11 +630,11 @@ std::string LLPanel::getString(const std::string& name) const std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate if(LLUI::sSettingGroups["config"]->getBOOL("QAMode")) { - llerrs << err_str << llendl; + LL_ERRS() << err_str << LL_ENDL; } else { - llwarns << err_str << llendl; + LL_WARNS() << err_str << LL_ENDL; } return LLStringUtil::null; } @@ -637,16 +649,6 @@ void LLPanel::childSetVisible(const std::string& id, bool visible) } } -bool LLPanel::childIsVisible(const std::string& id) const -{ - LLView* child = findChild<LLView>(id); - if (child) - { - return (bool)child->getVisible(); - } - return false; -} - void LLPanel::childSetEnabled(const std::string& id, bool enabled) { LLView* child = findChild<LLView>(id); @@ -656,55 +658,6 @@ void LLPanel::childSetEnabled(const std::string& id, bool enabled) } } -void LLPanel::childSetTentative(const std::string& id, bool tentative) -{ - LLUICtrl* child = findChild<LLUICtrl>(id); - if (child) - { - child->setTentative(tentative); - } -} - -bool LLPanel::childIsEnabled(const std::string& id) const -{ - LLView* child = findChild<LLView>(id); - if (child) - { - return (bool)child->getEnabled(); - } - return false; -} - - -void LLPanel::childSetToolTip(const std::string& id, const std::string& msg) -{ - LLView* child = findChild<LLView>(id); - if (child) - { - child->setToolTip(msg); - } -} - -void LLPanel::childSetRect(const std::string& id, const LLRect& rect) -{ - LLView* child = findChild<LLView>(id); - if (child) - { - child->setRect(rect); - } -} - -bool LLPanel::childGetRect(const std::string& id, LLRect& rect) const -{ - LLView* child = findChild<LLView>(id); - if (child) - { - rect = child->getRect(); - return true; - } - return false; -} - void LLPanel::childSetFocus(const std::string& id, BOOL focus) { LLUICtrl* child = findChild<LLUICtrl>(id); @@ -740,15 +693,6 @@ void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void } } -void LLPanel::childSetValidate(const std::string& id, boost::function<bool (const LLSD& data)> cb) -{ - LLUICtrl* child = findChild<LLUICtrl>(id); - if (child) - { - child->setValidateBeforeCommit(cb); - } -} - void LLPanel::childSetColor(const std::string& id, const LLColor4& color) { LLUICtrl* child = findChild<LLUICtrl>(id); @@ -828,95 +772,6 @@ BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, co return FALSE; } -BOOL LLPanel::childSetToolTipArg(const std::string& id, const std::string& key, const LLStringExplicit& text) -{ - LLView* child = findChild<LLView>(id); - if (child) - { - return child->setToolTipArg(key, text); - } - return FALSE; -} - -void LLPanel::childShowTab(const std::string& id, const std::string& tabname, bool visible) -{ - LLTabContainer* child = findChild<LLTabContainer>(id); - if (child) - { - child->selectTabByName(tabname); - } -} - -LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const -{ - LLTabContainer* child = findChild<LLTabContainer>(id); - if (child) - { - return child->getCurrentPanel(); - } - return NULL; -} - -LLPanel* LLPanel::childGetVisibleTabWithHelp() -{ - LLView *child; - - bfs_tree_iterator_t it = beginTreeBFS(); - // skip ourselves - ++it; - for (; it != endTreeBFS(); ++it) - { - child = *it; - LLPanel *curTabPanel = NULL; - - // do we have a tab container? - LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child); - if (tab && tab->getVisible()) - { - curTabPanel = tab->getCurrentPanel(); - } - - // do we have an accordion tab? - LLAccordionCtrlTab* accordion = dynamic_cast<LLAccordionCtrlTab *>(child); - if (accordion && accordion->getDisplayChildren()) - { - curTabPanel = dynamic_cast<LLPanel *>(accordion->getAccordionView()); - } - - // if we found a valid tab, does it have a help topic? - if (curTabPanel && !curTabPanel->getHelpTopic().empty()) - { - return curTabPanel; - } - } - - // couldn't find any active tabs with a help topic string - return NULL; -} - - -LLPanel *LLPanel::childGetVisiblePanelWithHelp() -{ - LLView *child; - - bfs_tree_iterator_t it = beginTreeBFS(); - // skip ourselves - ++it; - for (; it != endTreeBFS(); ++it) - { - child = *it; - // do we have a panel with a help topic? - LLPanel *panel = dynamic_cast<LLPanel *>(child); - if (panel && panel->isInVisibleChain() && !panel->getHelpTopic().empty()) - { - return panel; - } - } - - // couldn't find any active panels with a help topic string - return NULL; -} - void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function) { LLButton* button = findChild<LLButton>(id); @@ -935,24 +790,6 @@ void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)> } } -void LLPanel::childSetActionTextbox(const std::string& id, boost::function<void(void*)> function, void* value) -{ - LLTextBox* textbox = findChild<LLTextBox>(id); - if (textbox) - { - textbox->setClickedCallback(boost::bind(function, value)); - } -} - -void LLPanel::childSetControlName(const std::string& id, const std::string& control_name) -{ - LLUICtrl* view = findChild<LLUICtrl>(id); - if (view) - { - view->setControlName(control_name, NULL); - } -} - boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::slot_type& cb ) { if (!mVisibleSignal) @@ -963,31 +800,31 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t:: return mVisibleSignal->connect(cb); } -static LLFastTimer::DeclareTimer FTM_BUILD_PANELS("Build Panels"); +static LLTrace::BlockTimerStatHandle FTM_BUILD_PANELS("Build Panels"); //----------------------------------------------------------------------------- // buildPanel() //----------------------------------------------------------------------------- BOOL LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params) { - LLFastTimer timer(FTM_BUILD_PANELS); + LL_RECORD_BLOCK_TIME(FTM_BUILD_PANELS); BOOL didPost = FALSE; LLXMLNodePtr root; if (!LLUICtrlFactory::getLayeredXMLNode(filename, root)) { - llwarns << "Couldn't parse panel from: " << filename << llendl; + LL_WARNS() << "Couldn't parse panel from: " << filename << LL_ENDL; return didPost; } // root must be called panel if( !root->hasName("panel" ) ) { - llwarns << "Root node should be named panel in : " << filename << llendl; + LL_WARNS() << "Root node should be named panel in : " << filename << LL_ENDL; return didPost; } - lldebugs << "Building panel " << filename << llendl; + LL_DEBUGS() << "Building panel " << filename << LL_ENDL; LLUICtrlFactory::instance().pushFileName(filename); { diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 17b9b91ba795b9a50a768d2fd2850305af33aa69..c2185f24ded66e8c4b303eb0931bb86866980393 100755 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -105,6 +105,8 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder LLPanel(const LLPanel::Params& params = getDefaultParams()); public: + typedef std::vector<class LLUICtrl *> ctrl_list_t; + BOOL buildFromFile(const std::string &filename, const LLPanel::Params& default_params = getDefaultParams()); static LLPanel* createFactoryPanel(const std::string& name); @@ -115,7 +117,7 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder /*virtual*/ BOOL isPanel() const; /*virtual*/ void draw(); /*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ); - /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); + /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); // From LLFocusableElement /*virtual*/ void setFocus( BOOL b ); @@ -154,6 +156,7 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder std::string getHelpTopic() const { return mHelpTopic; } void setCtrlsEnabled(BOOL b); + ctrl_list_t getCtrlList() const; LLHandle<LLPanel> getHandle() const { return getDerivedHandle<LLPanel>(); } @@ -174,19 +177,10 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder // LLView void childSetVisible(const std::string& name, bool visible); - void childShow(const std::string& name) { childSetVisible(name, true); } - void childHide(const std::string& name) { childSetVisible(name, false); } - bool childIsVisible(const std::string& id) const; - void childSetTentative(const std::string& name, bool tentative); void childSetEnabled(const std::string& name, bool enabled); void childEnable(const std::string& name) { childSetEnabled(name, true); } void childDisable(const std::string& name) { childSetEnabled(name, false); }; - bool childIsEnabled(const std::string& id) const; - - void childSetToolTip(const std::string& id, const std::string& msg); - void childSetRect(const std::string& id, const LLRect &rect); - bool childGetRect(const std::string& id, LLRect& rect) const; // LLUICtrl void childSetFocus(const std::string& id, BOOL focus = TRUE); @@ -197,9 +191,6 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder // which takes a generic slot. Or use mCommitCallbackRegistrar.add() with // a named callback and reference it in XML. void childSetCommitCallback(const std::string& id, boost::function<void (LLUICtrl*,void*)> cb, void* data); - - void childSetValidate(const std::string& id, boost::function<bool (const LLSD& data)> cb ); - void childSetColor(const std::string& id, const LLColor4& color); LLCtrlSelectionInterface* childGetSelectionInterface(const std::string& id) const; @@ -214,34 +205,11 @@ class LLPanel : public LLUICtrl, public LLBadgeHolder // Not implemented for all types, defaults to noop, returns FALSE if not applicaple BOOL childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text); BOOL childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text); - BOOL childSetToolTipArg(const std::string& id, const std::string& key, const LLStringExplicit& text); - // LLTabContainer - void childShowTab(const std::string& id, const std::string& tabname, bool visible = true); - LLPanel *childGetVisibleTab(const std::string& id) const; - - // Find a child with a nonempty Help topic - LLPanel *childGetVisibleTabWithHelp(); - LLPanel *childGetVisiblePanelWithHelp(); - - // LLTextBox/LLTextEditor/LLLineEditor - void childSetText(const std::string& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); } - - // *NOTE: Does not return text from <string> tags, use getString() - std::string childGetText(const std::string& id) const { return childGetValue(id).asString(); } - - // LLLineEditor - void childSetPrevalidate(const std::string& id, bool (*func)(const LLWString &) ); - // LLButton void childSetAction(const std::string& id, boost::function<void(void*)> function, void* value); void childSetAction(const std::string& id, const commit_signal_t::slot_type& function); - // LLTextBox - void childSetActionTextbox(const std::string& id, boost::function<void(void*)> function, void* value = NULL); - - void childSetControlName(const std::string& id, const std::string& control_name); - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL); //call onOpen to let panel know when it's about to be shown or activated diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 95a7d0938244cd6e43c640543c8acbe16b8c6369..b53bb16d97d07f5059b83aed0f1b82687beb45c6 100755 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -289,7 +289,7 @@ BOOL LLRadioGroup::handleMouseDown(S32 x, S32 y, MASK mask) void LLRadioGroup::onClickButton(LLUICtrl* ctrl) { - // llinfos << "LLRadioGroup::onClickButton" << llendl; + // LL_INFOS() << "LLRadioGroup::onClickButton" << LL_ENDL; LLRadioCtrl* clicked_radio = dynamic_cast<LLRadioCtrl*>(ctrl); if (!clicked_radio) return; @@ -319,7 +319,7 @@ void LLRadioGroup::onClickButton(LLUICtrl* ctrl) index++; } - llwarns << "LLRadioGroup::onClickButton - clicked button that isn't a child" << llendl; + LL_WARNS() << "LLRadioGroup::onClickButton - clicked button that isn't a child" << LL_ENDL; } void LLRadioGroup::setValue( const LLSD& value ) diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index e67b22c977674c51d8ba8c379e3f3410b9edc56f..115c4e23bead9f918917efb439a2800ad08b9282 100755 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp @@ -35,46 +35,18 @@ #include "llfocusmgr.h" #include "llwindow.h" -class LLImagePanel : public LLPanel -{ -public: - struct Params : public LLInitParam::Block<Params, LLPanel::Params> - { - Optional<bool> horizontal; - Params() : horizontal("horizontal", false) {} - }; - LLImagePanel(const Params& p) : LLPanel(p), mHorizontal(p.horizontal) {} - virtual ~LLImagePanel() {} - - void draw() - { - const LLRect& parent_rect = getParent()->getRect(); - const LLRect& rect = getRect(); - LLRect clip_rect( -rect.mLeft, parent_rect.getHeight() - rect.mBottom - 2 - , parent_rect.getWidth() - rect.mLeft - (mHorizontal ? 2 : 0), -rect.mBottom); - LLLocalClipRect clip(clip_rect); - LLPanel::draw(); - } - -private: - bool mHorizontal; -}; - -static LLDefaultChildRegistry::Register<LLImagePanel> t1("resize_bar_image_panel"); - LLResizeBar::Params::Params() : max_size("max_size", S32_MAX), snapping_enabled("snapping_enabled", true), resizing_view("resizing_view"), side("side"), - allow_double_click_snapping("allow_double_click_snapping", true), - show_drag_handle("show_drag_handle", false) + allow_double_click_snapping("allow_double_click_snapping", true) { name = "resize_bar"; } LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) -: LLPanel(p), +: LLView(p), mDragLastScreenX( 0 ), mDragLastScreenY( 0 ), mLastMouseScreenX( 0 ), @@ -86,7 +58,6 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) mAllowDoubleClickSnapping(p.allow_double_click_snapping), mResizingView(p.resizing_view), mResizeListener(NULL), - mShowDragHandle(p.show_drag_handle), mImagePanel(NULL) { setFollowsNone(); @@ -116,36 +87,6 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) default: break; } - - if (mShowDragHandle) - { - LLViewBorder::Params border_params; - border_params.border_thickness = 1; - border_params.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight"); - border_params.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark"); - - addBorder(border_params); - setBorderVisible(TRUE); - - LLImagePanel::Params image_panel; - mDragHandleImage = LLUI::getUIImage(LLResizeBar::RIGHT == mSide ? "Vertical Drag Handle" : "Horizontal Drag Handle"); - image_panel.bg_alpha_image = mDragHandleImage; - image_panel.background_visible = true; - image_panel.horizontal = (LLResizeBar::BOTTOM == mSide); - mImagePanel = LLUICtrlFactory::create<LLImagePanel>(image_panel); - setImagePanel(mImagePanel); - } -} - -BOOL LLResizeBar::postBuild() -{ - if (mShowDragHandle) - { - setBackgroundVisible(TRUE); - setTransparentColor(LLUIColorTable::instance().getColor("ResizebarBody")); - } - - return LLPanel::postBuild(); } BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask) @@ -433,18 +374,3 @@ LLPanel * LLResizeBar::getImagePanel() const { return getChildCount() > 0 ? (LLPanel *)getChildList()->back() : NULL; } - -void LLResizeBar::draw() -{ - if (mShowDragHandle) - { - S32 image_width = mDragHandleImage->getTextureWidth(); - S32 image_height = mDragHandleImage->getTextureHeight(); - const LLRect& panel_rect = getRect(); - S32 image_left = (panel_rect.getWidth() - image_width) / 2 - 1; - S32 image_bottom = (panel_rect.getHeight() - image_height) / 2; - mImagePanel->setRect(LLRect(image_left, image_bottom + image_height, image_left + image_width, image_bottom)); - } - - LLPanel::draw(); -} diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h index bcf8ea0b40ea88c1b6ef76f333904a0134d2174a..20a2406484a7ce780d0864ceb6a4620ddce23ea2 100755 --- a/indra/llui/llresizebar.h +++ b/indra/llui/llresizebar.h @@ -27,14 +27,14 @@ #ifndef LL_RESIZEBAR_H #define LL_RESIZEBAR_H -#include "llpanel.h" +#include "llview.h" -class LLResizeBar : public LLPanel +class LLResizeBar : public LLView { public: enum Side { LEFT, TOP, RIGHT, BOTTOM }; - struct Params : public LLInitParam::Block<Params, LLPanel::Params> + struct Params : public LLInitParam::Block<Params, LLView::Params> { Mandatory<LLView*> resizing_view; Mandatory<Side> side; @@ -43,7 +43,6 @@ class LLResizeBar : public LLPanel Optional<S32> max_size; Optional<bool> snapping_enabled; Optional<bool> allow_double_click_snapping; - Optional<bool> show_drag_handle; Params(); }; @@ -52,10 +51,8 @@ class LLResizeBar : public LLPanel LLResizeBar(const LLResizeBar::Params& p); friend class LLUICtrlFactory; - /*virtual*/ BOOL postBuild(); public: - virtual void draw(); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -66,7 +63,6 @@ class LLResizeBar : public LLPanel void setAllowDoubleClickSnapping(BOOL allow) { mAllowDoubleClickSnapping = allow; } bool canResize() { return getEnabled() && mMaxSize > mMinSize; } void setResizeListener(boost::function<void(void*)> listener) {mResizeListener = listener;} - BOOL isShowDragHandle() const { return mShowDragHandle; } void setImagePanel(LLPanel * panelp); LLPanel * getImagePanel() const; @@ -79,9 +75,8 @@ class LLResizeBar : public LLPanel S32 mMinSize; S32 mMaxSize; const Side mSide; - BOOL mSnappingEnabled; - BOOL mAllowDoubleClickSnapping; - BOOL mShowDragHandle; + bool mSnappingEnabled, + mAllowDoubleClickSnapping; LLView* mResizingView; boost::function<void(void*)> mResizeListener; LLPointer<LLUIImage> mDragHandleImage; diff --git a/indra/llui/llresmgr.cpp b/indra/llui/llresmgr.cpp index 820e7cb26af36021a92d63c11645700fab644a1c..6e924c1f19f91125ba382bc06cf54d6dfd0dbc0f 100755 --- a/indra/llui/llresmgr.cpp +++ b/indra/llui/llresmgr.cpp @@ -45,33 +45,6 @@ LLResMgr::LLResMgr() void LLResMgr::setLocale( LLLOCALE_ID locale_id ) { mLocale = locale_id; - - //RN: for now, use normal 'C' locale for everything but specific UI input/output routines -// switch( locale_id ) -// { -// case LLLOCALE_USA: -//#if LL_WINDOWS -// // Windows doesn't use ISO country codes. -// llinfos << "Setting locale to " << setlocale( LC_ALL, "english-usa" ) << llendl; -//#else -// // posix version should work everywhere else. -// llinfos << "Setting locale to " << setlocale( LC_ALL, "en_US" ) << llendl; -//#endif -// break; -// case LLLOCALE_UK: -//#if LL_WINDOWS -// // Windows doesn't use ISO country codes. -// llinfos << "Setting locale to " << setlocale( LC_ALL, "english-uk" ) << llendl; -//#else -// // posix version should work everywhere else. -// llinfos << "Setting locale to " << setlocale( LC_ALL, "en_GB" ) << llendl; -//#endif -// break; -// default: -// llassert(0); -// setLocale(LLLOCALE_USA); -// break; -// } } char LLResMgr::getDecimalPoint() const @@ -342,7 +315,7 @@ LLLocale::LLLocale(const std::string& locale_string) } //else //{ - // llinfos << "Set locale to " << new_locale_string << llendl; + // LL_INFOS() << "Set locale to " << new_locale_string << LL_ENDL; //} } diff --git a/indra/llui/llrngwriter.cpp b/indra/llui/llrngwriter.cpp index 5e6840d7df83e96cf92b2e2841eec1c805d5eb98..cd9fe3610ef361fb53ae2359b2d79b30e7a5b037 100755 --- a/indra/llui/llrngwriter.cpp +++ b/indra/llui/llrngwriter.cpp @@ -29,6 +29,7 @@ #include "llrngwriter.h" #include "lluicolor.h" #include "lluictrlfactory.h" +#include "boost/bind.hpp" static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index 13887cbe735793e81261c57f2aef2ae4169eb15a..76134144a0538f73ed8b384167dff0cc52532f21 100755 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -381,7 +381,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) } getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; handled = TRUE; } else @@ -393,7 +393,7 @@ BOOL LLScrollbar::handleHover(S32 x, S32 y, MASK mask) if( !handled ) { getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; handled = TRUE; } @@ -493,11 +493,11 @@ void LLScrollbar::draw() BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); if (hovered) { - mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f)); + mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLSmoothInterpolation::getInterpolant(0.05f)); } else { - mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f)); + mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f)); } // Draw background and thumb. diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h index 21fd2d631ed340921063e7c312e9bcad6cba122d..e2bf52c14bce6463fef574a699f73b324a2a81e2 100755 --- a/indra/llui/llscrollbar.h +++ b/indra/llui/llscrollbar.h @@ -40,13 +40,11 @@ class LLScrollbar { public: - enum ORIENTATION { HORIZONTAL, VERTICAL }; - typedef boost::function<void (S32, LLScrollbar*)> callback_t; struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { - Mandatory<ORIENTATION> orientation; + Mandatory<EOrientation> orientation; Mandatory<S32> doc_size; Mandatory<S32> doc_pos; Mandatory<S32> page_size; @@ -124,7 +122,7 @@ class LLScrollbar void onLineUpBtnPressed(const LLSD& data); void onLineDownBtnPressed(const LLSD& data); - + S32 getThickness() const { return mThickness; } void setThickness(S32 thickness); @@ -134,7 +132,7 @@ class LLScrollbar callback_t mChangeCallback; - const ORIENTATION mOrientation; + const EOrientation mOrientation; S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize. S32 mDocPos; // Position within the doc that the scrollbar is modeling, in "lines" (user size) S32 mPageSize; // Maximum number of lines that can be seen at one time. diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index 238eae21c25f6366e63dc24f0e8a1c39015f670d..8c506d76bba5bfea41f8d7b13509e5f21d0c7537 100755 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -144,7 +144,7 @@ LLScrollContainer::~LLScrollContainer( void ) { // mScrolledView and mScrollbar are child views, so the LLView // destructor takes care of memory deallocation. - for( S32 i = 0; i < SCROLLBAR_COUNT; i++ ) + for( S32 i = 0; i < ORIENTATION_COUNT; i++ ) { mScrollbar[i] = NULL; } @@ -155,7 +155,6 @@ LLScrollContainer::~LLScrollContainer( void ) // virtual void LLScrollContainer::scrollHorizontal( S32 new_pos ) { - //llinfos << "LLScrollContainer::scrollHorizontal()" << llendl; if( mScrolledView ) { LLRect doc_rect = mScrolledView->getRect(); @@ -167,7 +166,6 @@ void LLScrollContainer::scrollHorizontal( S32 new_pos ) // virtual void LLScrollContainer::scrollVertical( S32 new_pos ) { - // llinfos << "LLScrollContainer::scrollVertical() " << new_pos << llendl; if( mScrolledView ) { LLRect doc_rect = mScrolledView->getRect(); @@ -215,7 +213,7 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) { return TRUE; } - for( S32 i = 0; i < SCROLLBAR_COUNT; i++ ) + for( S32 i = 0; i < ORIENTATION_COUNT; i++ ) { if( mScrollbar[i]->handleKeyHere(key, mask) ) { @@ -645,7 +643,7 @@ void LLScrollContainer::scrollToShowRect(const LLRect& rect, const LLRect& const { if (!mScrolledView) { - llwarns << "LLScrollContainer::scrollToShowRect with no view!" << llendl; + LL_WARNS() << "LLScrollContainer::scrollToShowRect with no view!" << LL_ENDL; return; } diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index 4eb43539b8d097413681be3d5b0832050b7d00b6..f64cf43a8ed48ce2c8863979535bdf4e3e5fd4b8 100755 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -31,7 +31,6 @@ #ifndef LL_V4COLOR_H #include "v4color.h" #endif -#include "stdenums.h" #include "llcoord.h" #include "llscrollbar.h" @@ -56,7 +55,6 @@ class LLScrollContainer : public LLUICtrl public: // Note: vertical comes before horizontal because vertical // scrollbars have priority for mouse and keyboard events. - enum SCROLL_ORIENTATION { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT }; struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> { @@ -130,7 +128,7 @@ class LLScrollContainer : public LLUICtrl void updateScroll(); void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const; - LLScrollbar* mScrollbar[SCROLLBAR_COUNT]; + LLScrollbar* mScrollbar[ORIENTATION_COUNT]; S32 mSize; BOOL mIsOpaque; LLUIColor mBackgroundColor; diff --git a/indra/llui/llscrollingpanellist.cpp b/indra/llui/llscrollingpanellist.cpp index 9b65c2b79d9dc3376d2823fb9587ec1e3c139f39..b6f2eb8ba2ff48e243a6274c0666b65b6adce299 100755 --- a/indra/llui/llscrollingpanellist.cpp +++ b/indra/llui/llscrollingpanellist.cpp @@ -111,7 +111,7 @@ void LLScrollingPanelList::removePanel( U32 panel_index ) { if ( mPanelList.empty() || panel_index >= mPanelList.size() ) { - llwarns << "Panel index " << panel_index << " is out of range!" << llendl; + LL_WARNS() << "Panel index " << panel_index << " is out of range!" << LL_ENDL; return; } else diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index d4bbea0f8eccc02d8c7370acba80ec37c512c852..3708071e11aba72501e8d36045e3dc73427ae3f7 100755 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1449,7 +1449,7 @@ void LLScrollListCtrl::drawItems() LLColor4 highlight_color = LLColor4::white; static LLUICachedControl<F32> type_ahead_timeout ("TypeAheadTimeout", 0); - highlight_color.mV[VALPHA] = clamp_rescale(mSearchTimer.getElapsedTimeF32(), type_ahead_timeout * 0.7f, type_ahead_timeout, 0.4f, 0.f); + highlight_color.mV[VALPHA] = clamp_rescale(mSearchTimer.getElapsedTimeF32(), type_ahead_timeout * 0.7f, type_ahead_timeout(), 0.4f, 0.f); S32 first_line = mScrollLines; S32 last_line = llmin((S32)mItemList.size() - 1, mScrollLines + getLinesPerPage()); @@ -1470,8 +1470,6 @@ void LLScrollListCtrl::drawItems() mLineHeight ); item->setRect(item_rect); - //llinfos << item_rect.getWidth() << llendl; - max_columns = llmax(max_columns, item->getNumColumns()); LLColor4 fg_color; @@ -2844,10 +2842,10 @@ LLScrollListColumn* LLScrollListCtrl::getColumn(const std::string& name) return NULL; } -LLFastTimer::DeclareTimer FTM_ADD_SCROLLLIST_ELEMENT("Add Scroll List Item"); +LLTrace::BlockTimerStatHandle FTM_ADD_SCROLLLIST_ELEMENT("Add Scroll List Item"); LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& element, EAddPosition pos, void* userdata) { - LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT); + LL_RECORD_BLOCK_TIME(FTM_ADD_SCROLLLIST_ELEMENT); LLScrollListItem::Params item_params; LLParamSDParser parser; parser.readSD(element, item_params); @@ -2857,14 +2855,14 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& element, EAddPosition LLScrollListItem* LLScrollListCtrl::addRow(const LLScrollListItem::Params& item_p, EAddPosition pos) { - LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT); + LL_RECORD_BLOCK_TIME(FTM_ADD_SCROLLLIST_ELEMENT); LLScrollListItem *new_item = new LLScrollListItem(item_p); return addRow(new_item, item_p, pos); } LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLScrollListItem::Params& item_p, EAddPosition pos) { - LLFastTimer _(FTM_ADD_SCROLLLIST_ELEMENT); + LL_RECORD_BLOCK_TIME(FTM_ADD_SCROLLLIST_ELEMENT); if (!item_p.validateBlock() || !new_item) return NULL; new_item->setNumColumns(mColumns.size()); diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index c61e281a31ec61d21b38aa352e6f2b46ca4cee97..6325a79cd5ed36a4d03266b64d959d6d3fe6f947 100755 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -34,7 +34,6 @@ #include "lluictrl.h" #include "llctrlselectioninterface.h" -//#include "lldarray.h" #include "llfontgl.h" #include "llui.h" #include "llstring.h" // LLWString diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp index cc7f42e49accfd84159e388fc3696a82340cdacd..df22c88afb428ec6c21348825a24ee19adff81df 100755 --- a/indra/llui/llscrolllistitem.cpp +++ b/indra/llui/llscrolllistitem.cpp @@ -83,7 +83,7 @@ void LLScrollListItem::setColumn( S32 column, LLScrollListCell *cell ) } else { - llerrs << "LLScrollListItem::setColumn: bad column: " << column << llendl; + LL_ERRS() << "LLScrollListItem::setColumn: bad column: " << column << LL_ENDL; } } diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index db72234f94d95ff7f4f5d491168acfa8c228362a..ebbb951ee634b73d4adc526a7c65657a19aa105a 100755 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -188,12 +188,12 @@ BOOL LLSlider::handleHover(S32 x, S32 y, MASK mask) setValueAndCommit(t * (mMaxValue - mMinValue) + mMinValue ); } getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; } else { getWindow()->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; } return TRUE; } diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index 700c17ea3e9c06ab34636eb732e5c3b7373de51a..3b492d81823a34aacca689ac424c0b9314130847 100755 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h @@ -34,8 +34,6 @@ class LLSlider : public LLF32UICtrl { public: - enum ORIENTATION { HORIZONTAL, VERTICAL }; - struct Params : public LLInitParam::Block<Params, LLF32UICtrl::Params> { Optional<std::string> orientation; @@ -98,7 +96,7 @@ class LLSlider : public LLF32UICtrl LLPointer<LLUIImage> mTrackHighlightHorizontalImage; LLPointer<LLUIImage> mTrackHighlightVerticalImage; - const ORIENTATION mOrientation; + const EOrientation mOrientation; LLRect mThumbRect; LLUIColor mTrackColor; diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 583ed1ed2e91143f0813084189beb16eccdd9735..62c5ecb8f125a15d5d3776aae0dcecdcbf0ebfd7 100755 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -403,7 +403,7 @@ void LLSliderCtrl::setPrecision(S32 precision) { if (precision < 0 || precision > 10) { - llerrs << "LLSliderCtrl::setPrecision - precision out of range" << llendl; + LL_ERRS() << "LLSliderCtrl::setPrecision - precision out of range" << LL_ENDL; return; } diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 8a728df2e7226d4b3e604f1cf3108abd3ebee9fe..ebdbdf59c004ebd6fe91afc017ef4dd1e97c4040 100755 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -384,7 +384,7 @@ void LLSpinCtrl::setPrecision(S32 precision) { if (precision < 0 || precision > 10) { - llerrs << "LLSpinCtrl::setPrecision - precision out of range" << llendl; + LL_ERRS() << "LLSpinCtrl::setPrecision - precision out of range" << LL_ENDL; return; } @@ -400,7 +400,7 @@ void LLSpinCtrl::setLabel(const LLStringExplicit& label) } else { - llwarns << "Attempting to set label on LLSpinCtrl constructed without one " << getName() << llendl; + LL_WARNS() << "Attempting to set label on LLSpinCtrl constructed without one " << getName() << LL_ENDL; } updateLabelColor(); } diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index 04cce7878e4611170a8164aeecef09afce4f5791..1bd2bc06f4b1d24841bcb14c7711bdea86572a1b 100755 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -34,234 +34,560 @@ #include "llgl.h" #include "llfontgl.h" -#include "llstat.h" #include "lluictrlfactory.h" +#include "lltracerecording.h" +#include "llcriticaldamp.h" +#include "lltooltip.h" +#include "lllocalcliprect.h" +#include <iostream> + +// rate at which to update display of value that is rapidly changing +const F32 MEAN_VALUE_UPDATE_TIME = 1.f / 4.f; +// time between value changes that qualifies as a "rapid change" +const F32Seconds RAPID_CHANGE_THRESHOLD(0.2f); +// maximum number of rapid changes in RAPID_CHANGE_WINDOW before switching over to displaying the mean +// instead of latest value +const S32 MAX_RAPID_CHANGES_PER_SEC = 10; +// period of time over which to measure rapid changes +const F32Seconds RAPID_CHANGE_WINDOW(1.f); + +F32 calc_tick_value(F32 min, F32 max) +{ + F32 range = max - min; + const S32 DIVISORS[] = {6, 8, 10, 4, 5}; + // try storing + S32 best_decimal_digit_count = S32_MAX; + S32 best_divisor = 10; + for (U32 divisor_idx = 0; divisor_idx < LL_ARRAY_SIZE(DIVISORS); divisor_idx++) + { + S32 divisor = DIVISORS[divisor_idx]; + F32 possible_tick_value = range / divisor; + S32 num_whole_digits = llceil(logf(llabs(min + possible_tick_value)) * OO_LN10); + for (S32 digit_count = -(num_whole_digits - 1); digit_count < 6; digit_count++) + { + F32 test_tick_value = min + (possible_tick_value * pow(10.0, digit_count)); -/////////////////////////////////////////////////////////////////////////////////// + if (is_approx_equal((F32)(S32)test_tick_value, test_tick_value)) + { + if (digit_count < best_decimal_digit_count) + { + best_decimal_digit_count = digit_count; + best_divisor = divisor; + } + break; + } + } + } -LLStatBar::LLStatBar(const Params& p) - : LLView(p), - mLabel(p.label), - mUnitLabel(p.unit_label), - mMinBar(p.bar_min), - mMaxBar(p.bar_max), - mStatp(LLStat::getStat(p.stat)), - mTickSpacing(p.tick_spacing), - mLabelSpacing(p.label_spacing), - mPrecision(p.precision), - mUpdatesPerSec(p.update_rate), - mPerSec(p.show_per_sec), - mDisplayBar(p.show_bar), - mDisplayHistory(p.show_history), - mDisplayMean(p.show_mean) -{ + return is_approx_equal(range, 0.f) ? 0.f : range / best_divisor; } -BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) +void calc_auto_scale_range(F32& min, F32& max, F32& tick) { - if (mDisplayBar) + min = llmin(0.f, min, max); + max = llmax(0.f, min, max); + + const F32 RANGES[] = {0.f, 1.f, 1.5f, 2.f, 3.f, 5.f, 10.f}; + const F32 TICKS[] = {0.f, 0.25f, 0.5f, 1.f, 1.f, 1.f, 2.f }; + + const S32 num_digits_max = is_approx_equal(llabs(max), 0.f) + ? S32_MIN + 1 + : llceil(logf(llabs(max)) * OO_LN10); + const S32 num_digits_min = is_approx_equal(llabs(min), 0.f) + ? S32_MIN + 1 + : llceil(logf(llabs(min)) * OO_LN10); + + const S32 num_digits = llmax(num_digits_max, num_digits_min); + const F32 power_of_10 = pow(10.0, num_digits - 1); + const F32 starting_max = power_of_10 * ((max < 0.f) ? -1 : 1); + const F32 starting_min = power_of_10 * ((min < 0.f) ? -1 : 1); + + F32 cur_max = starting_max; + F32 cur_min = starting_min; + F32 out_max = max; + F32 out_min = min; + + F32 cur_tick_min = 0.f; + F32 cur_tick_max = 0.f; + + for (S32 range_idx = 0; range_idx < LL_ARRAY_SIZE(RANGES); range_idx++) { - if (mDisplayHistory) + cur_max = starting_max * RANGES[range_idx]; + cur_min = starting_min * RANGES[range_idx]; + + if (min > 0.f && cur_min <= min) { - mDisplayBar = FALSE; - mDisplayHistory = FALSE; + out_min = cur_min; + cur_tick_min = TICKS[range_idx]; } - else + if (max < 0.f && cur_max >= max) { - mDisplayHistory = TRUE; + out_max = cur_max; + cur_tick_max = TICKS[range_idx]; } } - else + + cur_max = starting_max; + cur_min = starting_min; + for (S32 range_idx = LL_ARRAY_SIZE(RANGES) - 1; range_idx >= 0; range_idx--) { - mDisplayBar = TRUE; + cur_max = starting_max * RANGES[range_idx]; + cur_min = starting_min * RANGES[range_idx]; + + if (min < 0.f && cur_min <= min) + { + out_min = cur_min; + cur_tick_min = TICKS[range_idx]; + } + if (max > 0.f && cur_max >= max) + { + out_max = cur_max; + cur_tick_max = TICKS[range_idx]; + } } - LLView* parent = getParent(); - parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), FALSE); + tick = power_of_10 * llmax(cur_tick_min, cur_tick_max); + min = out_min; + max = out_max; +} - return FALSE; +LLStatBar::Params::Params() +: label("label"), + unit_label("unit_label"), + bar_min("bar_min", 0.f), + bar_max("bar_max", 0.f), + tick_spacing("tick_spacing", 0.f), + decimal_digits("decimal_digits", 3), + show_bar("show_bar", false), + show_history("show_history", false), + scale_range("scale_range", true), + num_frames("num_frames", 200), + num_frames_short("num_frames_short", 20), + max_height("max_height", 100), + stat("stat"), + orientation("orientation", VERTICAL) +{ + changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT); } -void LLStatBar::draw() +/////////////////////////////////////////////////////////////////////////////////// + +LLStatBar::LLStatBar(const Params& p) +: LLView(p), + mLabel(p.label), + mUnitLabel(p.unit_label), + mTargetMinBar(llmin(p.bar_min, p.bar_max)), + mTargetMaxBar(llmax(p.bar_max, p.bar_min)), + mCurMaxBar(p.bar_max), + mCurMinBar(0), + mDecimalDigits(p.decimal_digits), + mNumHistoryFrames(p.num_frames), + mNumShortHistoryFrames(p.num_frames_short), + mMaxHeight(p.max_height), + mDisplayBar(p.show_bar), + mDisplayHistory(p.show_history), + mOrientation(p.orientation), + mAutoScaleMax(!p.bar_max.isProvided()), + mAutoScaleMin(!p.bar_min.isProvided()), + mTickSpacing(p.tick_spacing), + mLastDisplayValue(0.f), + mStatType(STAT_NONE) { - if (!mStatp) - { -// llinfos << "No stats for statistics bar!" << llendl; - return; - } + mFloatingTargetMinBar = mTargetMinBar; + mFloatingTargetMaxBar = mTargetMaxBar; - // Get the values. - F32 current, min, max, mean; - if (mPerSec) + mStat.valid = NULL; + // tick value will be automatically calculated later + if (!p.tick_spacing.isProvided() && p.bar_min.isProvided() && p.bar_max.isProvided()) { - current = mStatp->getCurrentPerSec(); - min = mStatp->getMinPerSec(); - max = mStatp->getMaxPerSec(); - mean = mStatp->getMeanPerSec(); + mTickSpacing = calc_tick_value(mTargetMinBar, mTargetMaxBar); } - else + + setStat(p.stat); +} + +BOOL LLStatBar::handleHover(S32 x, S32 y, MASK mask) +{ + switch(mStatType) { - current = mStatp->getCurrent(); - min = mStatp->getMin(); - max = mStatp->getMax(); - mean = mStatp->getMean(); + case STAT_COUNT: + LLToolTipMgr::instance().show(LLToolTip::Params().message(mStat.countStatp->getDescription()).sticky_rect(calcScreenRect())); + break; + case STAT_EVENT: + LLToolTipMgr::instance().show(LLToolTip::Params().message(mStat.eventStatp->getDescription()).sticky_rect(calcScreenRect())); + break; + case STAT_SAMPLE: + LLToolTipMgr::instance().show(LLToolTip::Params().message(mStat.sampleStatp->getDescription()).sticky_rect(calcScreenRect())); + break; + case STAT_MEM: + LLToolTipMgr::instance().show(LLToolTip::Params().message(mStat.memStatp->getDescription()).sticky_rect(calcScreenRect())); + break; + default: + break; } + return TRUE; +} - - if ((mUpdatesPerSec == 0.f) || (mUpdateTimer.getElapsedTimeF32() > 1.f/mUpdatesPerSec) || (mValue == 0.f)) +BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask) +{ + BOOL handled = LLView::handleMouseDown(x, y, mask); + if (!handled) { - if (mDisplayMean) + if (mDisplayBar) { - mValue = mean; + if (mDisplayHistory || mOrientation == HORIZONTAL) + { + mDisplayBar = FALSE; + mDisplayHistory = FALSE; + } + else + { + mDisplayHistory = TRUE; + } } else { - mValue = current; + mDisplayBar = TRUE; + if (mOrientation == HORIZONTAL) + { + mDisplayHistory = TRUE; + } } - mUpdateTimer.reset(); + LLView* parent = getParent(); + parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), FALSE); } + return TRUE; +} - S32 width = getRect().getWidth() - 40; - S32 max_width = width; - S32 bar_top = getRect().getHeight() - 15; // 16 pixels from top. - S32 bar_height = bar_top - 20; - S32 tick_height = 4; - S32 tick_width = 1; - S32 left, top, right, bottom; +template<typename T> +S32 calc_num_rapid_changes(LLTrace::PeriodicRecording& periodic_recording, const T& stat, const F32Seconds time_period) +{ + F32Seconds elapsed_time, + time_since_value_changed; + S32 num_rapid_changes = 0; + const F32Seconds RAPID_CHANGE_THRESHOLD = F32Seconds(0.3f); + F64 last_value = periodic_recording.getPrevRecording(1).getLastValue(stat); - F32 value_scale = max_width/(mMaxBar - mMinBar); + for (S32 i = 2; i < periodic_recording.getNumRecordedPeriods(); i++) + { + LLTrace::Recording& recording = periodic_recording.getPrevRecording(i); + F64 cur_value = recording.getLastValue(stat); - LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f), - LLFontGL::LEFT, LLFontGL::TOP); + if (last_value != cur_value) + { + if (time_since_value_changed < RAPID_CHANGE_THRESHOLD) num_rapid_changes++; + time_since_value_changed = (F32Seconds)0; + } + last_value = cur_value; + + elapsed_time += recording.getDuration(); + if (elapsed_time > time_period) break; + } - std::string value_format; - std::string value_str; - if (!mUnitLabel.empty()) + return num_rapid_changes; +} + +void LLStatBar::draw() +{ + LLLocalClipRect _(getLocalRect()); + + LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording(); + LLTrace::Recording& last_frame_recording = frame_recording.getLastRecording(); + + std::string unit_label; + F32 current = 0, + min = 0, + max = 0, + mean = 0, + display_value = 0; + S32 num_frames = mDisplayHistory + ? mNumHistoryFrames + : mNumShortHistoryFrames; + S32 num_rapid_changes = 0; + S32 decimal_digits = mDecimalDigits; + + switch(mStatType) { - value_format = llformat( "%%.%df%%s", mPrecision); - value_str = llformat( value_format.c_str(), mValue, mUnitLabel.c_str()); + case STAT_COUNT: + { + const LLTrace::StatType<LLTrace::CountAccumulator>& count_stat = *mStat.countStatp; + + unit_label = std::string(count_stat.getUnitLabel()) + "/s"; + current = last_frame_recording.getPerSec(count_stat); + min = frame_recording.getPeriodMinPerSec(count_stat, num_frames); + max = frame_recording.getPeriodMaxPerSec(count_stat, num_frames); + mean = frame_recording.getPeriodMeanPerSec(count_stat, num_frames); + display_value = mean; + } + break; + case STAT_EVENT: + { + const LLTrace::StatType<LLTrace::EventAccumulator>& event_stat = *mStat.eventStatp; + + unit_label = mUnitLabel.empty() ? event_stat.getUnitLabel() : mUnitLabel; + current = last_frame_recording.getLastValue(event_stat); + min = frame_recording.getPeriodMin(event_stat, num_frames); + max = frame_recording.getPeriodMax(event_stat, num_frames); + mean = frame_recording.getPeriodMean(event_stat, num_frames); + display_value = mean; + } + break; + case STAT_SAMPLE: + { + const LLTrace::StatType<LLTrace::SampleAccumulator>& sample_stat = *mStat.sampleStatp; + + unit_label = mUnitLabel.empty() ? sample_stat.getUnitLabel() : mUnitLabel; + current = last_frame_recording.getLastValue(sample_stat); + min = frame_recording.getPeriodMin(sample_stat, num_frames); + max = frame_recording.getPeriodMax(sample_stat, num_frames); + mean = frame_recording.getPeriodMean(sample_stat, num_frames); + num_rapid_changes = calc_num_rapid_changes(frame_recording, sample_stat, RAPID_CHANGE_WINDOW); + + if (num_rapid_changes / RAPID_CHANGE_WINDOW.value() > MAX_RAPID_CHANGES_PER_SEC) + { + display_value = mean; + } + else + { + display_value = current; + // always display current value, don't rate limit + mLastDisplayValue = current; + if (is_approx_equal((F32)(S32)display_value, display_value)) + { + decimal_digits = 0; + } + } + } + break; + case STAT_MEM: + { + const LLTrace::StatType<LLTrace::MemAccumulator>& mem_stat = *mStat.memStatp; + + unit_label = mUnitLabel.empty() ? mem_stat.getUnitLabel() : mUnitLabel; + current = last_frame_recording.getLastValue(mem_stat).value(); + min = frame_recording.getPeriodMin(mem_stat, num_frames).value(); + max = frame_recording.getPeriodMax(mem_stat, num_frames).value(); + mean = frame_recording.getPeriodMean(mem_stat, num_frames).value(); + display_value = current; + } + break; + default: + break; } - else + + LLRect bar_rect; + if (mOrientation == HORIZONTAL) { - value_format = llformat( "%%.%df", mPrecision); - value_str = llformat( value_format.c_str(), mValue); + bar_rect.mTop = llmax(5, getRect().getHeight() - 15); + bar_rect.mLeft = 0; + bar_rect.mRight = getRect().getWidth() - 40; + bar_rect.mBottom = llmin(bar_rect.mTop - 5, 0); + } + else // VERTICAL + { + bar_rect.mTop = llmax(5, getRect().getHeight() - 15); + bar_rect.mLeft = 0; + bar_rect.mRight = getRect().getWidth(); + bar_rect.mBottom = llmin(bar_rect.mTop - 5, 20); } - // Draw the value. - LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, width, getRect().getHeight(), - LLColor4(1.f, 1.f, 1.f, 0.5f), - LLFontGL::RIGHT, LLFontGL::TOP); + mCurMaxBar = LLSmoothInterpolation::lerp(mCurMaxBar, mTargetMaxBar, 0.05f); + mCurMinBar = LLSmoothInterpolation::lerp(mCurMinBar, mTargetMinBar, 0.05f); - value_format = llformat( "%%.%df", mPrecision); - if (mDisplayBar) + // rate limited updates + if (mLastDisplayValueTimer.getElapsedTimeF32() < MEAN_VALUE_UPDATE_TIME) { - std::string tick_label; + display_value = mLastDisplayValue; + } + else + { + mLastDisplayValueTimer.reset(); + } + drawLabelAndValue(display_value, unit_label, bar_rect, decimal_digits); + mLastDisplayValue = display_value; + if (mDisplayBar && mStat.valid) + { // Draw the tick marks. - F32 tick_value; - top = bar_top; - bottom = bar_top - bar_height - tick_height/2; - LLGLSUIDefault gls_ui; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - for (tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mTickSpacing) + F32 value_scale; + if (mCurMaxBar == mCurMinBar) { - left = llfloor((tick_value - mMinBar)*value_scale); - right = left + tick_width; - gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.1f)); + value_scale = 0.f; } - - // Draw the tick labels (and big ticks). - bottom = bar_top - bar_height - tick_height; - for (tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mLabelSpacing) + else { - left = llfloor((tick_value - mMinBar)*value_scale); - right = left + tick_width; - gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.25f)); - - tick_label = llformat( value_format.c_str(), tick_value); - // draw labels for the tick marks - LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, left - 1, bar_top - bar_height - tick_height, - LLColor4(1.f, 1.f, 1.f, 0.5f), - LLFontGL::LEFT, LLFontGL::TOP); + value_scale = (mOrientation == HORIZONTAL) + ? (bar_rect.getHeight())/(mCurMaxBar - mCurMinBar) + : (bar_rect.getWidth())/(mCurMaxBar - mCurMinBar); } - // Now, draw the bars - top = bar_top; - bottom = bar_top - bar_height; + drawTicks(min, max, value_scale, bar_rect); // draw background bar. - left = 0; - right = width; - gl_rect_2d(left, top, right, bottom, LLColor4(0.f, 0.f, 0.f, 0.25f)); + gl_rect_2d(bar_rect.mLeft, bar_rect.mTop, bar_rect.mRight, bar_rect.mBottom, LLColor4(0.f, 0.f, 0.f, 0.25f)); - if (mStatp->getNumValues() == 0) + // draw values + if (!llisnan(display_value) && frame_recording.getNumRecordedPeriods() != 0) { - // No data, don't draw anything... - return; - } - // draw min and max - left = (S32) ((min - mMinBar) * value_scale); + // draw min and max + S32 begin = (S32) ((min - mCurMinBar) * value_scale); - if (left < 0) - { - left = 0; - llwarns << "Min:" << min << llendl; - } + if (begin < 0) + { + begin = 0; + } - right = (S32) ((max - mMinBar) * value_scale); - gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 0.f, 0.f, 0.25f)); + S32 end = (S32) ((max - mCurMinBar) * value_scale); + if (mOrientation == HORIZONTAL) + { + gl_rect_2d(bar_rect.mLeft, end, bar_rect.mRight, begin, LLColor4(1.f, 0.f, 0.f, 0.25f)); + } + else // VERTICAL + { + gl_rect_2d(begin, bar_rect.mTop, end, bar_rect.mBottom, LLColor4(1.f, 0.f, 0.f, 0.25f)); + } - S32 num_values = mStatp->getNumValues() - 1; - if (mDisplayHistory) - { - S32 i; - for (i = 0; i < num_values; i++) + F32 span = (mOrientation == HORIZONTAL) + ? (bar_rect.getWidth()) + : (bar_rect.getHeight()); + + if (mDisplayHistory && mStat.valid) { - if (i == mStatp->getNextBin()) + const S32 num_values = frame_recording.getNumRecordedPeriods() - 1; + F32 min_value = 0.f, + max_value = 0.f; + + gGL.color4f(1.f, 0.f, 0.f, 1.f); + gGL.begin( LLRender::QUADS ); + const S32 max_frame = llmin(num_frames, num_values); + U32 num_samples = 0; + for (S32 i = 1; i <= max_frame; i++) { - continue; + F32 offset = ((F32)i / (F32)num_frames) * span; + LLTrace::Recording& recording = frame_recording.getPrevRecording(i); + + switch(mStatType) + { + case STAT_COUNT: + min_value = recording.getPerSec(*mStat.countStatp); + max_value = min_value; + num_samples = recording.getSampleCount(*mStat.countStatp); + break; + case STAT_EVENT: + min_value = recording.getMin(*mStat.eventStatp); + max_value = recording.getMax(*mStat.eventStatp); + num_samples = recording.getSampleCount(*mStat.eventStatp); + break; + case STAT_SAMPLE: + min_value = recording.getMin(*mStat.sampleStatp); + max_value = recording.getMax(*mStat.sampleStatp); + num_samples = recording.getSampleCount(*mStat.sampleStatp); + break; + case STAT_MEM: + min_value = recording.getMin(*mStat.memStatp).value(); + max_value = recording.getMax(*mStat.memStatp).value(); + num_samples = 1; + break; + default: + break; + } + + if (!num_samples) continue; + + F32 min = (min_value - mCurMinBar) * value_scale; + F32 max = llmax(min + 1, (max_value - mCurMinBar) * value_scale); + if (mOrientation == HORIZONTAL) + { + gGL.vertex2f((F32)bar_rect.mRight - offset, max); + gGL.vertex2f((F32)bar_rect.mRight - offset, min); + gGL.vertex2f((F32)bar_rect.mRight - offset - 1, min); + gGL.vertex2f((F32)bar_rect.mRight - offset - 1, max); + } + else + { + gGL.vertex2f(min, (F32)bar_rect.mBottom + offset + 1); + gGL.vertex2f(min, (F32)bar_rect.mBottom + offset); + gGL.vertex2f(max, (F32)bar_rect.mBottom + offset); + gGL.vertex2f(max, (F32)bar_rect.mBottom + offset + 1 ); + } } - if (mPerSec) + gGL.end(); + } + else + { + S32 begin = (S32) ((current - mCurMinBar) * value_scale) - 1; + S32 end = (S32) ((current - mCurMinBar) * value_scale) + 1; + // draw current + if (mOrientation == HORIZONTAL) { - left = (S32)((mStatp->getPrevPerSec(i) - mMinBar) * value_scale); - right = (S32)((mStatp->getPrevPerSec(i) - mMinBar) * value_scale) + 1; - gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f)); + gl_rect_2d(bar_rect.mLeft, end, bar_rect.mRight, begin, LLColor4(1.f, 0.f, 0.f, 1.f)); } else { - left = (S32)((mStatp->getPrev(i) - mMinBar) * value_scale); - right = (S32)((mStatp->getPrev(i) - mMinBar) * value_scale) + 1; - gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f)); + gl_rect_2d(begin, bar_rect.mTop, end, bar_rect.mBottom, LLColor4(1.f, 0.f, 0.f, 1.f)); } } - } - else - { - // draw current - left = (S32) ((current - mMinBar) * value_scale) - 1; - right = (S32) ((current - mMinBar) * value_scale) + 1; - gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 0.f, 0.f, 1.f)); - } - // draw mean bar - top = bar_top + 2; - bottom = bar_top - bar_height - 2; - left = (S32) ((mean - mMinBar) * value_scale) - 1; - right = (S32) ((mean - mMinBar) * value_scale) + 1; - gl_rect_2d(left, top, right, bottom, LLColor4(0.f, 1.f, 0.f, 1.f)); + // draw mean bar + { + const S32 begin = (S32) ((mean - mCurMinBar) * value_scale) - 1; + const S32 end = (S32) ((mean - mCurMinBar) * value_scale) + 1; + if (mOrientation == HORIZONTAL) + { + gl_rect_2d(bar_rect.mLeft - 2, begin, bar_rect.mRight + 2, end, LLColor4(0.f, 1.f, 0.f, 1.f)); + } + else + { + gl_rect_2d(begin, bar_rect.mTop + 2, end, bar_rect.mBottom - 2, LLColor4(0.f, 1.f, 0.f, 1.f)); + } + } + } } LLView::draw(); } -void LLStatBar::setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing) +void LLStatBar::setStat(const std::string& stat_name) +{ + using namespace LLTrace; + const StatType<CountAccumulator>* count_stat; + const StatType<EventAccumulator>* event_stat; + const StatType<SampleAccumulator>* sample_stat; + const StatType<MemAccumulator>* mem_stat; + + if ((count_stat = StatType<CountAccumulator>::getInstance(stat_name))) + { + mStat.countStatp = count_stat; + mStatType = STAT_COUNT; + } + else if ((event_stat = StatType<EventAccumulator>::getInstance(stat_name))) + { + mStat.eventStatp = event_stat; + mStatType = STAT_EVENT; + } + else if ((sample_stat = StatType<SampleAccumulator>::getInstance(stat_name))) + { + mStat.sampleStatp = sample_stat; + mStatType = STAT_SAMPLE; + } + else if ((mem_stat = StatType<MemAccumulator>::getInstance(stat_name))) + { + mStat.memStatp = mem_stat; + mStatType = STAT_MEM; + } +} + + +void LLStatBar::setRange(F32 bar_min, F32 bar_max) { - mMinBar = bar_min; - mMaxBar = bar_max; - mTickSpacing = tick_spacing; - mLabelSpacing = label_spacing; + mTargetMinBar = llmin(bar_min, bar_max); + mTargetMaxBar = llmax(bar_min, bar_max); + mFloatingTargetMinBar = mTargetMinBar; + mFloatingTargetMaxBar = mTargetMaxBar; + mTickSpacing = calc_tick_value(mTargetMinBar, mTargetMaxBar); } LLRect LLStatBar::getRequiredRect() @@ -272,7 +598,7 @@ LLRect LLStatBar::getRequiredRect() { if (mDisplayHistory) { - rect.mTop = 35 + mStatp->getNumBins(); + rect.mTop = mMaxHeight; } else { @@ -285,3 +611,122 @@ LLRect LLStatBar::getRequiredRect() } return rect; } + +void LLStatBar::drawLabelAndValue( F32 value, std::string &label, LLRect &bar_rect, S32 decimal_digits ) +{ + LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f), + LLFontGL::LEFT, LLFontGL::TOP); + + std::string value_str = !llisnan(value) + ? llformat("%10.*f %s", decimal_digits, value, label.c_str()) + : "n/a"; + + // Draw the current value. + if (mOrientation == HORIZONTAL) + { + LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_rect.mRight, getRect().getHeight(), + LLColor4(1.f, 1.f, 1.f, 0.5f), + LLFontGL::RIGHT, LLFontGL::TOP); + } + else + { + LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_rect.mRight, getRect().getHeight(), + LLColor4(1.f, 1.f, 1.f, 0.5f), + LLFontGL::RIGHT, LLFontGL::TOP); + } +} + +void LLStatBar::drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect ) +{ + if (mAutoScaleMax || mAutoScaleMin) + { + F32 u = LLSmoothInterpolation::getInterpolant(10.f); + mFloatingTargetMinBar = llmin(min, lerp(mFloatingTargetMinBar, min, u)); + mFloatingTargetMaxBar = llmax(max, lerp(mFloatingTargetMaxBar, max, u)); + F32 range_min = mAutoScaleMin ? mFloatingTargetMinBar : mTargetMinBar; + F32 range_max = mAutoScaleMax ? mFloatingTargetMaxBar : mTargetMaxBar; + F32 tick_value = 0.f; + calc_auto_scale_range(range_min, range_max, tick_value); + if (mAutoScaleMin) { mTargetMinBar = range_min; } + if (mAutoScaleMax) { mTargetMaxBar = range_max; } + if (mAutoScaleMin && mAutoScaleMax) + { + mTickSpacing = tick_value; + } + else + { + mTickSpacing = calc_tick_value(mTargetMinBar, mTargetMaxBar); + } + } + + // start counting from actual min, not current, animating min, so that ticks don't float between numbers + // ensure ticks always hit 0 + S32 last_tick = S32_MIN; + S32 last_label = S32_MIN; + if (mTickSpacing > 0.f && value_scale > 0.f) + { + const S32 MIN_TICK_SPACING = mOrientation == HORIZONTAL ? 20 : 30; + const S32 MIN_LABEL_SPACING = mOrientation == HORIZONTAL ? 30 : 60; + const S32 TICK_LENGTH = 4; + const S32 TICK_WIDTH = 1; + + F32 start = mCurMinBar < 0.f + ? llceil(-mCurMinBar / mTickSpacing) * -mTickSpacing + : 0.f; + for (F32 tick_value = start; ;tick_value += mTickSpacing) + { + // clamp to S32_MAX / 2 to avoid floating point to integer overflow resulting in S32_MIN + const S32 tick_begin = llfloor(llmin((F32)(S32_MAX / 2), (tick_value - mCurMinBar)*value_scale)); + const S32 tick_end = tick_begin + TICK_WIDTH; + if (tick_begin < last_tick + MIN_TICK_SPACING) + { + continue; + } + last_tick = tick_begin; + + S32 decimal_digits = mDecimalDigits; + if (is_approx_equal((F32)(S32)tick_value, tick_value)) + { + decimal_digits = 0; + } + std::string tick_label = llformat("%.*f", decimal_digits, tick_value); + S32 tick_label_width = LLFontGL::getFontMonospace()->getWidth(tick_label); + if (mOrientation == HORIZONTAL) + { + if (tick_begin > last_label + MIN_LABEL_SPACING) + { + gl_rect_2d(bar_rect.mLeft, tick_end, bar_rect.mRight - TICK_LENGTH, tick_begin, LLColor4(1.f, 1.f, 1.f, 0.25f)); + LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, bar_rect.mRight, tick_begin, + LLColor4(1.f, 1.f, 1.f, 0.5f), + LLFontGL::LEFT, LLFontGL::VCENTER); + last_label = tick_begin; + } + else + { + gl_rect_2d(bar_rect.mLeft, tick_end, bar_rect.mRight - TICK_LENGTH/2, tick_begin, LLColor4(1.f, 1.f, 1.f, 0.1f)); + } + } + else + { + if (tick_begin > last_label + MIN_LABEL_SPACING) + { + gl_rect_2d(tick_begin, bar_rect.mTop, tick_end, bar_rect.mBottom - TICK_LENGTH, LLColor4(1.f, 1.f, 1.f, 0.25f)); + S32 label_pos = tick_begin - llround((F32)tick_label_width * ((F32)tick_begin / (F32)bar_rect.getWidth())); + LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, label_pos, bar_rect.mBottom - TICK_LENGTH, + LLColor4(1.f, 1.f, 1.f, 0.5f), + LLFontGL::LEFT, LLFontGL::TOP); + last_label = label_pos; + } + else + { + gl_rect_2d(tick_begin, bar_rect.mTop, tick_end, bar_rect.mBottom - TICK_LENGTH/2, LLColor4(1.f, 1.f, 1.f, 0.1f)); + } + } + // always draw one tick value past tick_end, so we can see part of the text, if possible + if (tick_value > mCurMaxBar) + { + break; + } + } + } +} diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index 513fff323454128fc46e50c16c2545d94bc3ff03..89d7ff24ed97008af6952a8665b0138b76c18f3b 100755 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -29,74 +29,92 @@ #include "llview.h" #include "llframetimer.h" - -class LLStat; +#include "lltracerecording.h" class LLStatBar : public LLView { public: + struct Params : public LLInitParam::Block<Params, LLView::Params> { - Optional<std::string> label; - Optional<std::string> unit_label; - Optional<F32> bar_min; - Optional<F32> bar_max; - Optional<F32> tick_spacing; - Optional<F32> label_spacing; - Optional<U32> precision; - Optional<F32> update_rate; - Optional<bool> show_per_sec; - Optional<bool> show_bar; - Optional<bool> show_history; - Optional<bool> show_mean; - Optional<std::string> stat; - Params() - : label("label"), - unit_label("unit_label"), - bar_min("bar_min", 0.0f), - bar_max("bar_max", 50.0f), - tick_spacing("tick_spacing", 10.0f), - label_spacing("label_spacing", 10.0f), - precision("precision", 0), - update_rate("update_rate", 5.0f), - show_per_sec("show_per_sec", TRUE), - show_bar("show_bar", TRUE), - show_history("show_history", FALSE), - show_mean("show_mean", TRUE), - stat("stat") - { - changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT); - } + Optional<std::string> label, + unit_label; + + Optional<F32> bar_min, + bar_max, + tick_spacing; + + Optional<bool> show_bar, + show_history, + scale_range; + + Optional<S32> decimal_digits, + num_frames, + num_frames_short, + max_height; + Optional<std::string> stat; + Optional<EOrientation> orientation; + + Params(); }; LLStatBar(const Params&); virtual void draw(); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleHover(S32 x, S32 y, MASK mask); + + void setStat(const std::string& stat_name); - void setStat(LLStat* stat) { mStatp = stat; } - void setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing); - void getRange(F32& bar_min, F32& bar_max) { bar_min = mMinBar; bar_max = mMaxBar; } + void setRange(F32 bar_min, F32 bar_max); + void getRange(F32& bar_min, F32& bar_max) { bar_min = mTargetMinBar; bar_max = mTargetMaxBar; } /*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options. private: - F32 mMinBar; - F32 mMaxBar; - F32 mTickSpacing; - F32 mLabelSpacing; - U32 mPrecision; - F32 mUpdatesPerSec; - BOOL mPerSec; // Use the per sec stats. - BOOL mDisplayBar; // Display the bar graph. - BOOL mDisplayHistory; - BOOL mDisplayMean; // If true, display mean, if false, display current value - - LLStat* mStatp; - - LLFrameTimer mUpdateTimer; - LLUIString mLabel; - std::string mUnitLabel; - F32 mValue; + void drawLabelAndValue( F32 mean, std::string &unit_label, LLRect &bar_rect, S32 decimal_digits ); + void drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect ); + + F32 mTargetMinBar, + mTargetMaxBar, + mFloatingTargetMinBar, + mFloatingTargetMaxBar, + mCurMaxBar, + mCurMinBar, + mLabelSpacing, + mTickSpacing; + S32 mDecimalDigits, + mNumHistoryFrames, + mNumShortHistoryFrames; + S32 mMaxHeight; + EOrientation mOrientation; + F32 mLastDisplayValue; + LLFrameTimer mLastDisplayValueTimer; + + enum + { + STAT_NONE, + STAT_COUNT, + STAT_EVENT, + STAT_SAMPLE, + STAT_MEM + } mStatType; + + union + { + void* valid; + const LLTrace::StatType<LLTrace::CountAccumulator>* countStatp; + const LLTrace::StatType<LLTrace::EventAccumulator>* eventStatp; + const LLTrace::StatType<LLTrace::SampleAccumulator>* sampleStatp; + const LLTrace::StatType<LLTrace::MemAccumulator>* memStatp; + } mStat; + + LLUIString mLabel; + std::string mUnitLabel; + + bool mDisplayBar, // Display the bar graph. + mDisplayHistory, + mAutoScaleMax, + mAutoScaleMin; }; #endif diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index e44887ebf0ec2bb96e92cf1b35bd9b6231e20c49..a44bc1873381a410d0a0f627168d358bbcaad331 100755 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -32,48 +32,51 @@ #include "llmath.h" #include "llui.h" -#include "llstat.h" #include "llgl.h" #include "llglheaders.h" +#include "lltracerecording.h" +#include "lltracethreadrecorder.h" //#include "llviewercontrol.h" /////////////////////////////////////////////////////////////////////////////////// -LLStatGraph::LLStatGraph(const LLView::Params& p) -: LLView(p) +LLStatGraph::LLStatGraph(const Params& p) +: LLView(p), + mMin(p.min), + mMax(p.max), + mPerSec(true), + mPrecision(p.precision), + mValue(p.value), + mNewStatFloatp(p.stat.count_stat_float) { - mStatp = NULL; setToolTip(p.name()); - mNumThresholds = 3; - mThresholdColors[0] = LLColor4(0.f, 1.f, 0.f, 1.f); - mThresholdColors[1] = LLColor4(1.f, 1.f, 0.f, 1.f); - mThresholdColors[2] = LLColor4(1.f, 0.f, 0.f, 1.f); - mThresholdColors[3] = LLColor4(1.f, 0.f, 0.f, 1.f); - mThresholds[0] = 50.f; - mThresholds[1] = 75.f; - mThresholds[2] = 100.f; - mMin = 0.f; - mMax = 125.f; - mPerSec = TRUE; - mValue = 0.f; - mPrecision = 0; + + for(LLInitParam::ParamIterator<ThresholdParams>::const_iterator it = p.thresholds.threshold.begin(), end_it = p.thresholds.threshold.end(); + it != end_it; + ++it) + { + mThresholds.push_back(Threshold(it->value(), it->color)); + } } void LLStatGraph::draw() { F32 range, frac; range = mMax - mMin; - if (mStatp) + if (mNewStatFloatp) { + LLTrace::Recording& recording = LLTrace::get_frame_recording().getLastRecording(); + if (mPerSec) { - mValue = mStatp->getMeanPerSec(); + mValue = recording.getPerSec(*mNewStatFloatp); } else { - mValue = mStatp->getMean(); + mValue = recording.getSum(*mNewStatFloatp); } } + frac = (mValue - mMin) / range; frac = llmax(0.f, frac); frac = llmin(1.f, frac); @@ -91,19 +94,13 @@ void LLStatGraph::draw() LLColor4 color; - S32 i; - for (i = 0; i < mNumThresholds - 1; i++) + threshold_vec_t::iterator it = std::lower_bound(mThresholds.begin(), mThresholds.end(), Threshold(mValue / mMax, LLUIColor())); + + if (it != mThresholds.begin()) { - if (mThresholds[i] > mValue) - { - break; - } + it--; } - //gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0, - // LLUIColorTable::instance().getColor("ColorDropShadow"), - // (S32) gSavedSettings.getF32("DropShadowFloater") ); - color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); gGL.color4fv(color.mV); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, TRUE); @@ -111,16 +108,11 @@ void LLStatGraph::draw() gGL.color4fv(LLColor4::black.mV); gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, FALSE); - color = mThresholdColors[i]; + color = it->mColor; gGL.color4fv(color.mV); gl_rect_2d(1, llround(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE); } -void LLStatGraph::setValue(const LLSD& value) -{ - mValue = (F32)value.asReal(); -} - void LLStatGraph::setMin(const F32 min) { mMin = min; @@ -131,27 +123,3 @@ void LLStatGraph::setMax(const F32 max) mMax = max; } -void LLStatGraph::setStat(LLStat *statp) -{ - mStatp = statp; -} - -void LLStatGraph::setLabel(const std::string& label) -{ - mLabel = label; -} - -void LLStatGraph::setUnits(const std::string& units) -{ - mUnits = units; -} - -void LLStatGraph::setPrecision(const S32 precision) -{ - mPrecision = precision; -} - -void LLStatGraph::setThreshold(const S32 i, F32 value) -{ - mThresholds[i] = value; -} diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h index 757525e232ff64eddb95ca805ac60977ce9153b4..f381e92a4dba1364d5e269611707c307699d1ed2 100755 --- a/indra/llui/llstatgraph.h +++ b/indra/llui/llstatgraph.h @@ -30,29 +30,84 @@ #include "llview.h" #include "llframetimer.h" #include "v4color.h" - -class LLStat; +#include "lltrace.h" class LLStatGraph : public LLView { public: - LLStatGraph(const LLView::Params&); + struct ThresholdParams : public LLInitParam::Block<ThresholdParams> + { + Mandatory<F32> value; + Optional<LLUIColor> color; - virtual void draw(); + ThresholdParams() + : value("value"), + color("color", LLColor4::white) + {} + }; + + struct Thresholds : public LLInitParam::Block<Thresholds> + { + Multiple<ThresholdParams> threshold; + + Thresholds() + : threshold("threshold") + {} + }; + + struct StatParams : public LLInitParam::ChoiceBlock<StatParams> + { + Alternative<LLTrace::StatType<LLTrace::CountAccumulator>* > count_stat_float; + Alternative<LLTrace::StatType<LLTrace::EventAccumulator>* > event_stat_float; + Alternative<LLTrace::StatType<LLTrace::SampleAccumulator>* > sample_stat_float; + }; + + struct Params : public LLInitParam::Block<Params, LLView::Params> + { + Mandatory<StatParams> stat; + Optional<std::string> label, + units; + Optional<S32> precision; + Optional<F32> min, + max; + Optional<bool> per_sec; + Optional<F32> value; + + Optional<Thresholds> thresholds; + + Params() + : stat("stat"), + label("label"), + units("units"), + precision("precision", 0), + min("min", 0.f), + max("max", 125.f), + per_sec("per_sec", true), + value("value", 0.f), + thresholds("thresholds") + { + Thresholds _thresholds; + _thresholds.threshold.add(ThresholdParams().value(0.f).color(LLColor4::green)) + .add(ThresholdParams().value(0.33f).color(LLColor4::yellow)) + .add(ThresholdParams().value(0.5f).color(LLColor4::red)) + .add(ThresholdParams().value(0.75f).color(LLColor4::red)); + thresholds = _thresholds; + } + }; + LLStatGraph(const Params&); - void setLabel(const std::string& label); - void setUnits(const std::string& units); - void setPrecision(const S32 precision); - void setStat(LLStat *statp); - void setThreshold(const S32 i, F32 value); void setMin(const F32 min); void setMax(const F32 max); + virtual void draw(); + /*virtual*/ void setValue(const LLSD& value); - LLStat *mStatp; - BOOL mPerSec; private: + LLTrace::StatType<LLTrace::CountAccumulator>* mNewStatFloatp; + + BOOL mPerSec; + F32 mValue; F32 mMin; @@ -62,9 +117,25 @@ class LLStatGraph : public LLView std::string mUnits; S32 mPrecision; // Num of digits of precision after dot - S32 mNumThresholds; - F32 mThresholds[4]; - LLColor4 mThresholdColors[4]; + struct Threshold + { + Threshold(F32 value, const LLUIColor& color) + : mValue(value), + mColor(color) + {} + + F32 mValue; + LLUIColor mColor; + bool operator <(const Threshold& other) + { + return mValue < other.mValue; + } + }; + typedef std::vector<Threshold> threshold_vec_t; + threshold_vec_t mThresholds; + //S32 mNumThresholds; + //F32 mThresholds[4]; + //LLColor4 mThresholdColors[4]; }; #endif // LL_LLSTATGRAPH_H diff --git a/indra/llui/llstatview.h b/indra/llui/llstatview.h index 5abdc42448c3b21f55f655411b80131b0af2bdd5..bc78d3b5fdca9379bd0e8e1a01e0bea68fcafe1a 100755 --- a/indra/llui/llstatview.h +++ b/indra/llui/llstatview.h @@ -46,7 +46,8 @@ class LLStatView : public LLContainerView Params() : setting("setting") { - changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT); + changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT | FOLLOWS_RIGHT); + changeDefault(show_label, true); } }; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 2b9286f6639c980ced85a17c988a267d926ac861..ebc6183b8befc8ba577471949b9ef5899805318a 100755 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -407,7 +407,7 @@ void LLTabContainer::draw() } } - setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f))); + setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f))); BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); if (!mIsVertical) @@ -1585,7 +1585,7 @@ BOOL LLTabContainer::selectTabByName(const std::string& name) LLPanel* panel = getPanelByName(name); if (!panel) { - llwarns << "LLTabContainer::selectTabByName(" << name << ") failed" << llendl; + LL_WARNS() << "LLTabContainer::selectTabByName(" << name << ") failed" << LL_ENDL; return FALSE; } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 4144a42fd6559e98414843ac6b3c08590d776af7..62edbadb0776e4dbde38cf6090261c9845086a6e 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -691,7 +691,7 @@ void LLTextBase::drawText() seg_iter++; if (seg_iter == mSegments.end()) { - llwarns << "Ran off the segmentation end!" << llendl; + LL_WARNS() << "Ran off the segmentation end!" << LL_ENDL; return; } @@ -1261,13 +1261,13 @@ void LLTextBase::setReadOnlyColor(const LLColor4 &c) } //virtual -void LLTextBase::handleVisibilityChange( BOOL new_visibility ) +void LLTextBase::onVisibilityChange( BOOL new_visibility ) { if(!new_visibility && mPopupMenu) { mPopupMenu->hide(); } - LLUICtrl::handleVisibilityChange(new_visibility); + LLUICtrl::onVisibilityChange(new_visibility); } //virtual @@ -1320,6 +1320,7 @@ void LLTextBase::replaceWithSuggestion(U32 index) // Insert the suggestion in its place LLWString suggestion = utf8str_to_wstring(mSuggestionList[index]); insertStringNoUndo(it->first, utf8str_to_wstring(mSuggestionList[index])); + setCursorPos(it->first + (S32)suggestion.length()); break; @@ -1438,10 +1439,10 @@ S32 LLTextBase::getLeftOffset(S32 width) } -static LLFastTimer::DeclareTimer FTM_TEXT_REFLOW ("Text Reflow"); +static LLTrace::BlockTimerStatHandle FTM_TEXT_REFLOW ("Text Reflow"); void LLTextBase::reflow() { - LLFastTimer ft(FTM_TEXT_REFLOW); + LL_RECORD_BLOCK_TIME(FTM_TEXT_REFLOW); updateSegments(); @@ -1483,7 +1484,7 @@ void LLTextBase::reflow() // use an even number of iterations to avoid user visible oscillation of the layout if(++reflow_count > 2) { - lldebugs << "Breaking out of reflow due to possible infinite loop in " << getName() << llendl; + LL_DEBUGS() << "Breaking out of reflow due to possible infinite loop in " << getName() << LL_ENDL; break; } @@ -1780,10 +1781,10 @@ void LLTextBase::removeDocumentChild(LLView* view) } -static LLFastTimer::DeclareTimer FTM_UPDATE_TEXT_SEGMENTS("Update Text Segments"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_TEXT_SEGMENTS("Update Text Segments"); void LLTextBase::updateSegments() { - LLFastTimer ft(FTM_UPDATE_TEXT_SEGMENTS); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_TEXT_SEGMENTS); createDefaultSegment(); } @@ -1872,7 +1873,6 @@ LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index) // when there are no segments, we return the end iterator, which must be checked by caller if (mSegments.size() <= 1) { return mSegments.begin(); } - //FIXME: avoid operator new somehow (without running into refcount problems) index_segment->setStart(index); index_segment->setEnd(index); segment_set_t::iterator it = mSegments.upper_bound(index_segment); @@ -2022,7 +2022,7 @@ static LLUIImagePtr image_from_icon_name(const std::string& icon_name) } } -static LLFastTimer::DeclareTimer FTM_PARSE_HTML("Parse HTML"); +static LLTrace::BlockTimerStatHandle FTM_PARSE_HTML("Parse HTML"); void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Params& input_params) { @@ -2032,7 +2032,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para S32 part = (S32)LLTextParser::WHOLE; if (mParseHTML && !style_params.is_link) // Don't search for URLs inside a link segment (STORM-358). { - LLFastTimer _(FTM_PARSE_HTML); + LL_RECORD_BLOCK_TIME(FTM_PARSE_HTML); S32 start=0,end=0; LLUrlMatch match; std::string text = new_text; @@ -2099,11 +2099,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para } } -static LLFastTimer::DeclareTimer FTM_APPEND_TEXT("Append Text"); +static LLTrace::BlockTimerStatHandle FTM_APPEND_TEXT("Append Text"); void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params) { - LLFastTimer _(FTM_APPEND_TEXT); + LL_RECORD_BLOCK_TIME(FTM_APPEND_TEXT); if (new_text.empty()) return; @@ -2152,7 +2152,7 @@ void LLTextBase::setFont(const LLFontGL* font) void LLTextBase::needsReflow(S32 index) { - lldebugs << "reflow on object " << (void*)this << " index = " << mReflowIndex << ", new index = " << index << llendl; + LL_DEBUGS() << "reflow on object " << (void*)this << " index = " << mReflowIndex << ", new index = " << index << LL_ENDL; mReflowIndex = llmin(mReflowIndex, index); } @@ -3199,7 +3199,7 @@ void LLNormalTextSegment::setToolTip(const std::string& tooltip) // we cannot replace a keyword tooltip that's loaded from a file if (mToken) { - llwarns << "LLTextSegment::setToolTip: cannot replace keyword tooltip." << llendl; + LL_WARNS() << "LLTextSegment::setToolTip: cannot replace keyword tooltip." << LL_ENDL; return; } mTooltip = tooltip; @@ -3255,14 +3255,14 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin if(getLength() < segment_offset + mStart) { - llinfos << "getLength() < segment_offset + mStart\t getLength()\t" << getLength() << "\tsegment_offset:\t" - << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << "\tmax_chars\t" << max_chars << llendl; + LL_INFOS() << "getLength() < segment_offset + mStart\t getLength()\t" << getLength() << "\tsegment_offset:\t" + << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << "\tmax_chars\t" << max_chars << LL_ENDL; } if( (offsetLength + 1) < max_chars) { - llinfos << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetLength:\t" << offsetLength << " getLength() : " - << getLength() << "\tsegment_offset:\t" << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << llendl; + LL_INFOS() << "offsetString.length() + 1 < max_chars\t max_chars:\t" << max_chars << "\toffsetString.length():\t" << offsetLength << " getLength() : " + << getLength() << "\tsegment_offset:\t" << segment_offset << "\tmStart:\t" << mStart << "\tsegments\t" << mEditor.mSegments.size() << LL_ENDL; } S32 num_chars = mStyle->getFont()->maxDrawableChars( text.c_str() + (segment_offset + mStart), @@ -3292,13 +3292,13 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin void LLNormalTextSegment::dump() const { - llinfos << "Segment [" << + LL_INFOS() << "Segment [" << // mColor.mV[VX] << ", " << // mColor.mV[VY] << ", " << // mColor.mV[VZ] << "]\t[" << mStart << ", " << getEnd() << "]" << - llendl; + LL_ENDL; } /*virtual*/ diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 3603f55c3f42b50e730eff57ba8f7a0c3c66673e..d1f66b6cfe002fb28fa65b8d6328b61f6e3ed43f 100755 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -51,10 +51,15 @@ class LLUrlMatch; /// includes a start/end offset from the start of the string, a /// style to render with, an optional tooltip, etc. /// -class LLTextSegment : public LLRefCount, public LLMouseHandler +class LLTextSegment +: public LLRefCount, + public LLMouseHandler { public: - LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){}; + LLTextSegment(S32 start, S32 end) + : mStart(start), + mEnd(end) + {} virtual ~LLTextSegment(); virtual bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; @@ -92,10 +97,10 @@ class LLTextSegment : public LLRefCount, public LLMouseHandler /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; /*virtual*/ BOOL hasMouseCapture(); - S32 getStart() const { return mStart; } - void setStart(S32 start) { mStart = start; } - S32 getEnd() const { return mEnd; } - void setEnd( S32 end ) { mEnd = end; } + S32 getStart() const { return mStart; } + void setStart(S32 start) { mStart = start; } + S32 getEnd() const { return mEnd; } + void setEnd( S32 end ) { mEnd = end; } protected: S32 mStart; @@ -328,7 +333,7 @@ class LLTextBase /*virtual*/ BOOL acceptsTextInput() const { return !mReadOnly; } /*virtual*/ void setColor( const LLColor4& c ); virtual void setReadOnlyColor(const LLColor4 &c); - virtual void handleVisibilityChange( BOOL new_visibility ); + virtual void onVisibilityChange( BOOL new_visibility ); /*virtual*/ void setValue(const LLSD& value ); /*virtual*/ LLTextViewModel* getViewModel() const; @@ -608,7 +613,7 @@ class LLTextBase S32 mSelectionStart; S32 mSelectionEnd; LLTimer mTripleClickTimer; - + BOOL mIsSelecting; // Are we in the middle of a drag-select? // spell checking diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3bac15c5d4ae9b02466b09bbac21594aaafc919c..c797b6acc557d91e2e5861ad145f61fba24becd1 100755 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -792,7 +792,7 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) setCursorAtLocalPos( clamped_x, clamped_y, true ); mSelectionEnd = mCursorPos; } - lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (active)" << LL_ENDL; getWindow()->setCursor(UI_CURSOR_IBEAM); handled = TRUE; } @@ -2513,13 +2513,13 @@ BOOL LLTextEditor::tryToRevertToPristineState() } -static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting"); +static LLTrace::BlockTimerStatHandle FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting"); void LLTextEditor::loadKeywords(const std::string& filename, const std::vector<std::string>& funcs, const std::vector<std::string>& tooltips, const LLColor3& color) { - LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); + LL_RECORD_BLOCK_TIME(FTM_SYNTAX_HIGHLIGHTING); if(mKeywords.loadFromFile(filename)) { S32 count = llmin(funcs.size(), tooltips.size()); @@ -2544,7 +2544,7 @@ void LLTextEditor::updateSegments() { if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly) { - LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING); + LL_RECORD_BLOCK_TIME(FTM_SYNTAX_HIGHLIGHTING); // HACK: No non-ascii keywords for now segment_vec_t segment_list; mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this); @@ -2615,20 +2615,20 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) instream.getline(tbuf, MAX_STRING); if( 1 != sscanf(tbuf, "Linden text version %d", &version) ) { - llwarns << "Invalid Linden text file header " << llendl; + LL_WARNS() << "Invalid Linden text file header " << LL_ENDL; return FALSE; } if( 1 != version ) { - llwarns << "Invalid Linden text file version: " << version << llendl; + LL_WARNS() << "Invalid Linden text file version: " << version << LL_ENDL; return FALSE; } instream.getline(tbuf, MAX_STRING); if( 0 != sscanf(tbuf, "{") ) { - llwarns << "Invalid Linden text file format" << llendl; + LL_WARNS() << "Invalid Linden text file format" << LL_ENDL; return FALSE; } @@ -2636,13 +2636,13 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) instream.getline(tbuf, MAX_STRING); if( 1 != sscanf(tbuf, "Text length %d", &text_len) ) { - llwarns << "Invalid Linden text length field" << llendl; + LL_WARNS() << "Invalid Linden text length field" << LL_ENDL; return FALSE; } if( text_len > mMaxTextByteLength ) { - llwarns << "Invalid Linden text length: " << text_len << llendl; + LL_WARNS() << "Invalid Linden text length: " << text_len << LL_ENDL; return FALSE; } @@ -2651,21 +2651,21 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length ) char* text = new char[ text_len + 1]; if (text == NULL) { - llerrs << "Memory allocation failure." << llendl; + LL_ERRS() << "Memory allocation failure." << LL_ENDL; return FALSE; } instream.get(text, text_len + 1, '\0'); text[text_len] = '\0'; if( text_len != (S32)strlen(text) )/* Flawfinder: ignore */ { - llwarns << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << llendl;/* Flawfinder: ignore */ + LL_WARNS() << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << LL_ENDL;/* Flawfinder: ignore */ success = FALSE; } instream.getline(tbuf, MAX_STRING); if( success && (0 != sscanf(tbuf, "}")) ) { - llwarns << "Invalid Linden text file format: missing terminal }" << llendl; + LL_WARNS() << "Invalid Linden text file format: missing terminal }" << LL_ENDL; success = FALSE; } @@ -2728,7 +2728,7 @@ void LLTextEditor::resetPreedit() { if (hasPreeditString()) { - llwarns << "Preedit and selection!" << llendl; + LL_WARNS() << "Preedit and selection!" << LL_ENDL; deselect(); } else @@ -2738,6 +2738,12 @@ void LLTextEditor::resetPreedit() } if (hasPreeditString()) { + if (hasSelection()) + { + LL_WARNS() << "Preedit and selection!" << LL_ENDL; + deselect(); + } + setCursorPos(mPreeditPositions.front()); removeStringNoUndo(mCursorPos, mPreeditPositions.back() - mCursorPos); insertStringNoUndo(mCursorPos, mPreeditOverwrittenWString); @@ -2927,7 +2933,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length) setCursorPos(position); if (hasPreeditString()) { - llwarns << "markAsPreedit invoked when hasPreeditString is true." << llendl; + LL_WARNS() << "markAsPreedit invoked when hasPreeditString is true." << LL_ENDL; } mPreeditWString = LLWString( getWText(), position, length ); if (length > 0) diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index d3b7bc0eb7681ef04c31155ee3561496a9896b48..3a96d8ed249f4a48abbbf860f22bae78ccbd89c4 100755 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -32,10 +32,8 @@ #include "llrect.h" #include "llkeywords.h" #include "llframetimer.h" -#include "lldarray.h" #include "llstyle.h" #include "lleditmenuhandler.h" -#include "lldarray.h" #include "llviewborder.h" // for params #include "lltextbase.h" #include "lltextvalidate.h" diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp index 8a85f99e0cf87d05f881ee48ffe6f68595e80486..0b36241da0775d7ffca17ab0b869a00598bc9def 100755 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -228,7 +228,7 @@ bool LLTextParser::saveToDisk(LLSD highlights) std::string filename=getFileName(); if (filename.empty()) { - llwarns << "LLTextParser::saveToDisk() no valid user directory." << llendl; + LL_WARNS() << "LLTextParser::saveToDisk() no valid user directory." << LL_ENDL; return FALSE; } llofstream file; diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp index 00d52fe10d3b7079eac171df552874138e70966f..ccb92ffbb2a6a944660b7cb8b52f0b949df25bba 100755 --- a/indra/llui/lltoggleablemenu.cpp +++ b/indra/llui/lltoggleablemenu.cpp @@ -52,7 +52,7 @@ boost::signals2::connection LLToggleableMenu::setVisibilityChangeCallback(const } // virtual -void LLToggleableMenu::handleVisibilityChange (BOOL curVisibilityIn) +void LLToggleableMenu::onVisibilityChange (BOOL curVisibilityIn) { S32 x,y; LLUI::getMousePositionLocal(LLUI::getRootView(), &x, &y); diff --git a/indra/llui/lltoggleablemenu.h b/indra/llui/lltoggleablemenu.h index dfe70cbf546e870f3e791140e87ead17cae13a04..55a64830219557f492f3dcf3d0c2a93caea96e04 100755 --- a/indra/llui/lltoggleablemenu.h +++ b/indra/llui/lltoggleablemenu.h @@ -45,7 +45,7 @@ class LLToggleableMenu : public LLMenuGL boost::signals2::connection setVisibilityChangeCallback( const commit_signal_t::slot_type& cb ); - virtual void handleVisibilityChange (BOOL curVisibilityIn); + virtual void onVisibilityChange (BOOL curVisibilityIn); virtual bool addChild (LLView* view, S32 tab_group = 0); diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index ee82e0403b9f67b00ccc33db4945a27637f8d0ae..f9bdd87087af3b331d7131461bf6130939235f5c 100755 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -42,9 +42,9 @@ namespace LLToolBarEnums { - LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType) + LLView::EOrientation getOrientation(SideType sideType) { - LLLayoutStack::ELayoutOrientation orientation = LLLayoutStack::HORIZONTAL; + LLView::EOrientation orientation = LLLayoutStack::HORIZONTAL; if ((sideType == SIDE_LEFT) || (sideType == SIDE_RIGHT)) { @@ -158,7 +158,7 @@ void LLToolBar::createContextMenu() } else { - llwarns << "Unable to load toolbars context menu." << llendl; + LL_WARNS() << "Unable to load toolbars context menu." << LL_ENDL; } } @@ -174,7 +174,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p) // Initialize the base object LLUICtrl::initFromParams(p); - LLLayoutStack::ELayoutOrientation orientation = getOrientation(p.side); + LLView::EOrientation orientation = getOrientation(p.side); LLLayoutStack::Params centering_stack_p; centering_stack_p.name = "centering_stack"; @@ -527,7 +527,7 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y) int rank = 0; // Convert the toolbar coord into button panel coords - LLLayoutStack::ELayoutOrientation orientation = getOrientation(mSideType); + LLView::EOrientation orientation = getOrientation(mSideType); S32 button_panel_x = 0; S32 button_panel_y = 0; localPointToOtherView(x, y, &button_panel_x, &button_panel_y, mButtonPanel); @@ -646,7 +646,7 @@ void LLToolBar::updateLayoutAsNeeded() { if (!mNeedsLayout) return; - LLLayoutStack::ELayoutOrientation orientation = getOrientation(mSideType); + LLView::EOrientation orientation = getOrientation(mSideType); // our terminology for orientation-agnostic layout is such that // length refers to a distance in the direction we stack the buttons @@ -1065,7 +1065,7 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, mDragRank = getRankFromPosition(x, y); // Don't DaD if we're dragging a command on itself mDragAndDropTarget = ((orig_rank != RANK_NONE) && ((mDragRank == orig_rank) || ((mDragRank-1) == orig_rank)) ? false : true); - //llinfos << "Merov debug : DaD, rank = " << mDragRank << ", dragged uui = " << inv_item->getUUID() << llendl; + //LL_INFOS() << "Merov debug : DaD, rank = " << mDragRank << ", dragged uui = " << inv_item->getUUID() << LL_ENDL; /* Do the following if you want to animate the button itself LLCommandId dragged_command(inv_item->getUUID()); removeCommand(dragged_command); diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 9e17eaed8bce7a8632c4b0085f8d046abdf89994..370941c787e8441e80a17fb261e84c385cc275f1 100755 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -138,7 +138,7 @@ namespace LLToolBarEnums TOOLBAR_LAST = TOOLBAR_BOTTOM, }; - LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType); + LLView::EOrientation getOrientation(SideType sideType); } // NOTE: This needs to occur before Param block declaration for proper compilation. @@ -167,7 +167,6 @@ class LLToolBar class LLCenterLayoutPanel : public LLLayoutPanel { public: - typedef struct LLLayoutPanel::Params Params; typedef boost::function<void(LLToolBarEnums::EToolBarLocation tb, const LLRect& rect)> reshape_callback_t; virtual ~LLCenterLayoutPanel() {} diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index f52a3b332305c313686831d6fedb40413c20c13c..5e1f12996e194d5af557cd35679a8be8890797c9 100755 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -476,12 +476,15 @@ void LLToolTipMgr::show(const std::string& msg) void LLToolTipMgr::show(const LLToolTip::Params& params) { + if (!params.styled_message.isProvided() + && (!params.message.isProvided() || params.message().empty())) return; + // fill in default tooltip params from tool_tip.xml LLToolTip::Params params_with_defaults(params); params_with_defaults.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLToolTip>()); if (!params_with_defaults.validateBlock()) { - llwarns << "Could not display tooltip!" << llendl; + LL_WARNS() << "Could not display tooltip!" << LL_ENDL; return; } diff --git a/indra/llui/lltrans.cpp b/indra/llui/lltrans.cpp index 5388069c24910c2b5a2ca4a54790127f82e9b950..4d4ff4236d37e40439dea09c64382b0ead823821 100755 --- a/indra/llui/lltrans.cpp +++ b/indra/llui/lltrans.cpp @@ -63,8 +63,8 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa std::string xml_filename = "(strings file)"; if (!root->hasName("strings")) { - llerrs << "Invalid root node name in " << xml_filename - << ": was " << root->getName() << ", expected \"strings\"" << llendl; + LL_ERRS() << "Invalid root node name in " << xml_filename + << ": was " << root->getName() << ", expected \"strings\"" << LL_ENDL; } StringTable string_table; @@ -73,7 +73,7 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa if (!string_table.validateBlock()) { - llerrs << "Problem reading strings: " << xml_filename << llendl; + LL_ERRS() << "Problem reading strings: " << xml_filename << LL_ENDL; return false; } @@ -107,8 +107,8 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root) std::string xml_filename = "(language strings file)"; if (!root->hasName("strings")) { - llerrs << "Invalid root node name in " << xml_filename - << ": was " << root->getName() << ", expected \"strings\"" << llendl; + LL_ERRS() << "Invalid root node name in " << xml_filename + << ": was " << root->getName() << ", expected \"strings\"" << LL_ENDL; } StringTable string_table; @@ -117,7 +117,7 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root) if (!string_table.validateBlock()) { - llerrs << "Problem reading strings: " << xml_filename << llendl; + LL_ERRS() << "Problem reading strings: " << xml_filename << LL_ENDL; return false; } @@ -135,14 +135,14 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root) -static LLFastTimer::DeclareTimer FTM_GET_TRANS("Translate string"); +static LLTrace::BlockTimerStatHandle FTM_GET_TRANS("Translate string"); //static std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args) { // Don't care about time as much as call count. Make sure we're not // calling LLTrans::getString() in an inner loop. JC - LLFastTimer timer(FTM_GET_TRANS); + LL_RECORD_BLOCK_TIME(FTM_GET_TRANS); template_map_t::iterator iter = sStringTemplates.find(xml_desc); if (iter != sStringTemplates.end()) @@ -166,7 +166,7 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args { // Don't care about time as much as call count. Make sure we're not // calling LLTrans::getString() in an inner loop. JC - LLFastTimer timer(FTM_GET_TRANS); + LL_RECORD_BLOCK_TIME(FTM_GET_TRANS); template_map_t::iterator iter = sStringTemplates.find(xml_desc); if (iter != sStringTemplates.end()) @@ -185,7 +185,7 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args //static bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args) { - LLFastTimer timer(FTM_GET_TRANS); + LL_RECORD_BLOCK_TIME(FTM_GET_TRANS); template_map_t::iterator iter = sStringTemplates.find(xml_desc); if (iter != sStringTemplates.end()) @@ -207,7 +207,7 @@ bool LLTrans::findString(std::string &result, const std::string &xml_desc, const //static bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLSD& msg_args) { - LLFastTimer timer(FTM_GET_TRANS); + LL_RECORD_BLOCK_TIME(FTM_GET_TRANS); template_map_t::iterator iter = sStringTemplates.find(xml_desc); if (iter != sStringTemplates.end()) diff --git a/indra/llui/lltrans.h b/indra/llui/lltrans.h index 128b51d3831dcd70f0c9a97edf1e93cebc41004d..a47ce94f080658d5d0b0ce4cfe8123c6f274f820 100755 --- a/indra/llui/lltrans.h +++ b/indra/llui/lltrans.h @@ -28,6 +28,7 @@ #define LL_TRANS_H #include <map> +#include <set> #include "llpointer.h" #include "llstring.h" diff --git a/indra/llui/lltransutil.cpp b/indra/llui/lltransutil.cpp index 80d079cbc8ca3c0781976841fc79172355c9f007..220cee4c90b37eb8e100f31d169bb4d250a1e034 100755 --- a/indra/llui/lltransutil.cpp +++ b/indra/llui/lltransutil.cpp @@ -44,7 +44,7 @@ bool LLTransUtil::parseStrings(const std::string& xml_filename, const std::set<s bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root, LLDir::ALL_SKINS); if (!success) { - llerrs << "Couldn't load string table " << xml_filename << llendl; + LL_ERRS() << "Couldn't load string table " << xml_filename << LL_ENDL; return false; } @@ -59,7 +59,7 @@ bool LLTransUtil::parseLanguageStrings(const std::string& xml_filename) if (!success) { - llerrs << "Couldn't load localization table " << xml_filename << llendl; + LL_ERRS() << "Couldn't load localization table " << xml_filename << LL_ENDL; return false; } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 0ddb14973831628f9fc1922909aaafc6e7dd11a6..1f570edd88540bb18c88f9c997f4cc2d0d45a255 100755 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -107,7 +107,7 @@ LLUUID find_ui_sound(const char * namep) LLUUID uuid = LLUUID(NULL); if (!LLUI::sSettingGroups["config"]->controlExists(name)) { - llwarns << "tried to make UI sound for unknown sound name: " << name << llendl; + LL_WARNS() << "tried to make UI sound for unknown sound name: " << name << LL_ENDL; } else { @@ -118,19 +118,19 @@ LLUUID find_ui_sound(const char * namep) { if (LLUI::sSettingGroups["config"]->getBOOL("UISndDebugSpamToggle")) { - llinfos << "UI sound name: " << name << " triggered but silent (null uuid)" << llendl; + LL_INFOS() << "UI sound name: " << name << " triggered but silent (null uuid)" << LL_ENDL; } } else { - llwarns << "UI sound named: " << name << " does not translate to a valid uuid" << llendl; + LL_WARNS() << "UI sound named: " << name << " does not translate to a valid uuid" << LL_ENDL; } } else if (LLUI::sAudioCallback != NULL) { if (LLUI::sSettingGroups["config"]->getBOOL("UISndDebugSpamToggle")) { - llinfos << "UI sound name: " << name << llendl; + LL_INFOS() << "UI sound name: " << name << LL_ENDL; } } } @@ -170,7 +170,7 @@ void LLUI::initClass(const settings_map_t& settings, (get_ptr_in_map(sSettingGroups, std::string("floater")) == NULL) || (get_ptr_in_map(sSettingGroups, std::string("ignores")) == NULL)) { - llerrs << "Failure to initialize configuration groups" << llendl; + LL_ERRS() << "Failure to initialize configuration groups" << LL_ENDL; } sAudioCallback = audio_callback; diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 0bc4424a8cab7b39a58a7fce63b8558fab524ca6..b162f2588786c0f8a97b4c5ee72d46353233e713 100755 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -29,9 +29,11 @@ #define LL_LLUI_H #include "llrect.h" +#include "llcoord.h" #include "llcontrol.h" #include "llcoord.h" -#include "v2math.h" +#include "llcontrol.h" +#include "llglslshader.h" #include "llinitparam.h" #include "llregistry.h" #include "llrender2dutils.h" @@ -40,8 +42,8 @@ #include "lluicolortable.h" #include "lluiimage.h" #include <boost/signals2.hpp> -#include "lllazyvalue.h" #include "llframetimer.h" +#include "v2math.h" #include <limits> // for initparam specialization @@ -53,6 +55,52 @@ class LLWindow; class LLView; class LLHelp; + +// this enum is used by the llview.h (viewer) and the llassetstorage.h (viewer and sim) +enum EDragAndDropType +{ + DAD_NONE = 0, + DAD_TEXTURE = 1, + DAD_SOUND = 2, + DAD_CALLINGCARD = 3, + DAD_LANDMARK = 4, + DAD_SCRIPT = 5, + DAD_CLOTHING = 6, + DAD_OBJECT = 7, + DAD_NOTECARD = 8, + DAD_CATEGORY = 9, + DAD_ROOT_CATEGORY = 10, + DAD_BODYPART = 11, + DAD_ANIMATION = 12, + DAD_GESTURE = 13, + DAD_LINK = 14, + DAD_MESH = 15, + DAD_WIDGET = 16, + DAD_PERSON = 17, + DAD_COUNT = 18, // number of types in this enum +}; + +// Reasons for drags to be denied. +// ordered by priority for multi-drag +enum EAcceptance +{ + ACCEPT_POSTPONED, // we are asynchronously determining acceptance + ACCEPT_NO, // Uninformative, general purpose denial. + ACCEPT_NO_LOCKED, // Operation would be valid, but permissions are set to disallow it. + ACCEPT_YES_COPY_SINGLE, // We'll take a copy of a single item + ACCEPT_YES_SINGLE, // Accepted. OK to drag and drop single item here. + ACCEPT_YES_COPY_MULTI, // We'll take a copy of multiple items + ACCEPT_YES_MULTI // Accepted. OK to drag and drop multiple items here. +}; + +enum EAddPosition +{ + ADD_TOP, + ADD_BOTTOM, + ADD_DEFAULT +}; + + void make_ui_sound(const char* name); void make_ui_sound_deferred(const char * name); @@ -123,7 +171,7 @@ class LLUI { if (mMin > mMax) { - llwarns << "Bad interval range (" << mMin << ", " << mMax << ")" << llendl; + LL_WARNS() << "Bad interval range (" << mMin << ", " << mMax << ")" << LL_ENDL; // since max is usually the most dangerous one to ignore (buffer overflow, etc), prefer it // in the case of a malformed range mMin = mMax; @@ -362,7 +410,7 @@ class LLInitClass static void initClass() { - llerrs << "No static initClass() method defined for " << typeid(T).name() << llendl; + LL_ERRS() << "No static initClass() method defined for " << typeid(T).name() << LL_ENDL; } }; @@ -377,7 +425,7 @@ class LLDestroyClass static void destroyClass() { - llerrs << "No static destroyClass() method defined for " << typeid(T).name() << llendl; + LL_ERRS() << "No static destroyClass() method defined for " << typeid(T).name() << LL_ENDL; } }; diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp index ffeff15968391ec2ce985791abd0299586fe1e9d..244f0c6f009077694aca4399cd58a1f4eb55ae0e 100755 --- a/indra/llui/lluicolortable.cpp +++ b/indra/llui/lluicolortable.cpp @@ -117,7 +117,7 @@ void LLUIColorTable::insertFromParams(const Params& p, string_color_map_t& table unresolved_refs.erase(iter->second); } - llwarns << warning + ending_ref << llendl; + LL_WARNS() << warning + ending_ref << LL_ENDL; break; } @@ -156,7 +156,7 @@ void LLUIColorTable::insertFromParams(const Params& p, string_color_map_t& table iter != visited_refs.end(); ++iter) { - llwarns << iter->first << " references a non-existent color" << llendl; + LL_WARNS() << iter->first << " references a non-existent color" << LL_ENDL; unresolved_refs.erase(iter->second); } @@ -293,13 +293,13 @@ bool LLUIColorTable::loadFromFilename(const std::string& filename, string_color_ if(!LLXMLNode::parseFile(filename, root, NULL)) { - llwarns << "Unable to parse color file " << filename << llendl; + LL_WARNS() << "Unable to parse color file " << filename << LL_ENDL; return false; } if(!root->hasName("colors")) { - llwarns << filename << " is not a valid color definition file" << llendl; + LL_WARNS() << filename << " is not a valid color definition file" << LL_ENDL; return false; } @@ -313,7 +313,7 @@ bool LLUIColorTable::loadFromFilename(const std::string& filename, string_color_ } else { - llwarns << filename << " failed to load" << llendl; + LL_WARNS() << filename << " failed to load" << LL_ENDL; return false; } diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 1722bf27bddcda5937d681f7ebff1d22b1bb2383..df74e113e9bc954f56f526e29427cc2c34da3547 100755 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -33,6 +33,8 @@ #include "llfocusmgr.h" #include "llpanel.h" #include "lluictrlfactory.h" +#include "lltabcontainer.h" +#include "llaccordionctrltab.h" static LLDefaultChildRegistry::Register<LLUICtrl> r("ui_ctrl"); @@ -118,6 +120,7 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel) mDoubleClickSignal(NULL), mTransparencyType(TT_DEFAULT) { + claimMem(viewmodel.get()); } void LLUICtrl::initFromParams(const Params& p) @@ -211,7 +214,7 @@ LLUICtrl::~LLUICtrl() if( gFocusMgr.getTopCtrl() == this ) { - llwarns << "UI Control holding top ctrl deleted: " << getName() << ". Top view removed." << llendl; + LL_WARNS() << "UI Control holding top ctrl deleted: " << getName() << ". Top view removed." << LL_ENDL; gFocusMgr.removeTopCtrlWithoutCallback( this ); } @@ -257,7 +260,7 @@ LLUICtrl::commit_signal_t::slot_type LLUICtrl::initCommitCallback(const CommitCa } else if (!function_name.empty()) { - llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl; + LL_WARNS() << "No callback found for: '" << function_name << "' in control: " << getName() << LL_ENDL; } } return default_commit_handler; @@ -309,7 +312,7 @@ void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask) BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) { - lldebugs << "LLUICtrl::handleMouseDown calling LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << llendl; + LL_DEBUGS() << "LLUICtrl::handleMouseDown calling LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL; BOOL handled = LLView::handleMouseDown(x,y,mask); @@ -317,7 +320,7 @@ BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) { (*mMouseDownSignal)(this,x,y,mask); } - lldebugs << "LLUICtrl::handleMousedown - handled is returning as: " << handled << " " << llendl; + LL_DEBUGS() << "LLUICtrl::handleMousedown - handled is returning as: " << handled << " " << LL_ENDL; if (handled) { LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-56,-56,getPathname()); @@ -329,7 +332,7 @@ BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask) { - lldebugs << "LLUICtrl::handleMouseUp calling LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << llendl; + LL_DEBUGS() << "LLUICtrl::handleMouseUp calling LLView)'s handleMouseUp (first initialized xui to: " << getPathname() << " )" << LL_ENDL; BOOL handled = LLView::handleMouseUp(x,y,mask); if (handled) { @@ -340,7 +343,7 @@ BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask) (*mMouseUpSignal)(this,x,y,mask); } - lldebugs << "LLUICtrl::handleMouseUp - handled for xui " << getPathname() << " - is returning as: " << handled << " " << llendl; + LL_DEBUGS() << "LLUICtrl::handleMouseUp - handled for xui " << getPathname() << " - is returning as: " << handled << " " << LL_ENDL; return handled; } @@ -469,7 +472,7 @@ void LLUICtrl::setControlVariable(LLControlVariable* control) if (mControlVariable) { //RN: this will happen in practice, should we try to avoid it? - //llwarns << "setControlName called twice on same control!" << llendl; + //LL_WARNS() << "setControlName called twice on same control!" << LL_ENDL; mControlConnection.disconnect(); // disconnect current signal mControlVariable = NULL; } @@ -719,54 +722,19 @@ BOOL LLUICtrl::getIsChrome() const } } -// this comparator uses the crazy disambiguating logic of LLCompareByTabOrder, -// but to switch up the order so that children that have the default tab group come first -// and those that are prior to the default tab group come last -class CompareByDefaultTabGroup: public LLCompareByTabOrder -{ -public: - CompareByDefaultTabGroup(const LLView::child_tab_order_t& order, S32 default_tab_group): - LLCompareByTabOrder(order), - mDefaultTabGroup(default_tab_group) {} -private: - /*virtual*/ bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const - { - S32 ag = a.first; // tab group for a - S32 bg = b.first; // tab group for b - // these two ifs have the effect of moving elements prior to the default tab group to the end of the list - // (still sorted relative to each other, though) - if(ag < mDefaultTabGroup && bg >= mDefaultTabGroup) return false; - if(bg < mDefaultTabGroup && ag >= mDefaultTabGroup) return true; - return a < b; // sort correctly if they're both on the same side of the default tab group - } - S32 mDefaultTabGroup; -}; -// Sorter for plugging into the query. -// I'd have defined it local to the one method that uses it but that broke the VS 05 compiler. -MG -class LLUICtrl::DefaultTabGroupFirstSorter : public LLQuerySorter, public LLSingleton<DefaultTabGroupFirstSorter> -{ -public: - /*virtual*/ void operator() (LLView * parent, viewList_t &children) const - { - children.sort(CompareByDefaultTabGroup(parent->getCtrlOrder(), parent->getDefaultTabGroup())); - } -}; - -LLFastTimer::DeclareTimer FTM_FOCUS_FIRST_ITEM("Focus First Item"); +LLTrace::BlockTimerStatHandle FTM_FOCUS_FIRST_ITEM("Focus First Item"); BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) { - LLFastTimer _(FTM_FOCUS_FIRST_ITEM); + LL_RECORD_BLOCK_TIME(FTM_FOCUS_FIRST_ITEM); // try to select default tab group child - LLCtrlQuery query = getTabOrderQuery(); - // sort things such that the default tab group is at the front - query.setSorter(DefaultTabGroupFirstSorter::getInstance()); + LLViewQuery query = getTabOrderQuery(); child_list_t result = query(this); if(result.size() > 0) { - LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front()); + LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); if(!ctrl->hasFocus()) { ctrl->setFocus(TRUE); @@ -781,17 +749,20 @@ BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) // search for text field first if(prefer_text_fields) { - LLCtrlQuery query = getTabOrderQuery(); + LLViewQuery query = getTabOrderQuery(); query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance()); child_list_t result = query(this); if(result.size() > 0) { - LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front()); + LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); if(!ctrl->hasFocus()) { ctrl->setFocus(TRUE); ctrl->onTabInto(); - gFocusMgr.triggerFocusFlash(); + if(focus_flash) + { + gFocusMgr.triggerFocusFlash(); + } } return TRUE; } @@ -800,58 +771,26 @@ BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash) result = getTabOrderQuery().run(this); if(result.size() > 0) { - LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front()); + LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); if(!ctrl->hasFocus()) { ctrl->setFocus(TRUE); ctrl->onTabInto(); - gFocusMgr.triggerFocusFlash(); - } - return TRUE; - } - return FALSE; -} - -BOOL LLUICtrl::focusLastItem(BOOL prefer_text_fields) -{ - // search for text field first - if(prefer_text_fields) - { - LLCtrlQuery query = getTabOrderQuery(); - query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance()); - child_list_t result = query(this); - if(result.size() > 0) - { - LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); - if(!ctrl->hasFocus()) + if(focus_flash) { - ctrl->setFocus(TRUE); - ctrl->onTabInto(); gFocusMgr.triggerFocusFlash(); } - return TRUE; - } - } - // no text field found, or we don't care about text fields - child_list_t result = getTabOrderQuery().run(this); - if(result.size() > 0) - { - LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.back()); - if(!ctrl->hasFocus()) - { - ctrl->setFocus(TRUE); - ctrl->onTabInto(); - gFocusMgr.triggerFocusFlash(); } return TRUE; } return FALSE; } + BOOL LLUICtrl::focusNextItem(BOOL text_fields_only) { // this assumes that this method is called on the focus root. - LLCtrlQuery query = getTabOrderQuery(); + LLViewQuery query = getTabOrderQuery(); static LLUICachedControl<bool> tab_to_text_fields_only ("TabToTextFieldsOnly", false); if(text_fields_only || tab_to_text_fields_only) { @@ -864,7 +803,7 @@ BOOL LLUICtrl::focusNextItem(BOOL text_fields_only) BOOL LLUICtrl::focusPrevItem(BOOL text_fields_only) { // this assumes that this method is called on the focus root. - LLCtrlQuery query = getTabOrderQuery(); + LLViewQuery query = getTabOrderQuery(); static LLUICachedControl<bool> tab_to_text_fields_only ("TabToTextFieldsOnly", false); if(text_fields_only || tab_to_text_fields_only) { @@ -921,8 +860,26 @@ bool LLUICtrl::findHelpTopic(std::string& help_topic_out) if (panel) { + + LLView *child; + LLPanel *subpanel = NULL; + // does the panel have a sub-panel with a help topic? - LLPanel *subpanel = panel->childGetVisiblePanelWithHelp(); + bfs_tree_iterator_t it = beginTreeBFS(); + // skip ourselves + ++it; + for (; it != endTreeBFS(); ++it) + { + child = *it; + // do we have a panel with a help topic? + LLPanel *panel = dynamic_cast<LLPanel *>(child); + if (panel && panel->isInVisibleChain() && !panel->getHelpTopic().empty()) + { + subpanel = panel; + break; + } + } + if (subpanel) { help_topic_out = subpanel->getHelpTopic(); @@ -930,10 +887,41 @@ bool LLUICtrl::findHelpTopic(std::string& help_topic_out) } // does the panel have an active tab with a help topic? - LLPanel *tab = panel->childGetVisibleTabWithHelp(); - if (tab) + LLPanel *tab_panel = NULL; + + it = beginTreeBFS(); + // skip ourselves + ++it; + for (; it != endTreeBFS(); ++it) + { + child = *it; + LLPanel *curTabPanel = NULL; + + // do we have a tab container? + LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child); + if (tab && tab->getVisible()) + { + curTabPanel = tab->getCurrentPanel(); + } + + // do we have an accordion tab? + LLAccordionCtrlTab* accordion = dynamic_cast<LLAccordionCtrlTab *>(child); + if (accordion && accordion->getDisplayChildren()) + { + curTabPanel = dynamic_cast<LLPanel *>(accordion->getAccordionView()); + } + + // if we found a valid tab, does it have a help topic? + if (curTabPanel && !curTabPanel->getHelpTopic().empty()) + { + tab_panel = curTabPanel; + break; + } + } + + if (tab_panel) { - help_topic_out = tab->getHelpTopic(); + help_topic_out = tab_panel->getHelpTopic(); return true; // success (tab) } @@ -959,6 +947,8 @@ boost::signals2::connection LLUICtrl::setCommitCallback( boost::function<void (L boost::signals2::connection LLUICtrl::setValidateBeforeCommit( boost::function<bool (const LLSD& data)> cb ) { if (!mValidateSignal) mValidateSignal = new enable_signal_t(); + claimMem(mValidateSignal); + return mValidateSignal->connect(boost::bind(cb, _2)); } @@ -1022,54 +1012,72 @@ boost::signals2::connection LLUICtrl::setValidateCallback(const EnableCallbackPa boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb ) { if (!mCommitSignal) mCommitSignal = new commit_signal_t(); + claimMem(mCommitSignal); + return mCommitSignal->connect(cb); } boost::signals2::connection LLUICtrl::setValidateCallback( const enable_signal_t::slot_type& cb ) { if (!mValidateSignal) mValidateSignal = new enable_signal_t(); + claimMem(mValidateSignal); + return mValidateSignal->connect(cb); } boost::signals2::connection LLUICtrl::setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { if (!mMouseEnterSignal) mMouseEnterSignal = new commit_signal_t(); + claimMem(mMouseEnterSignal); + return mMouseEnterSignal->connect(cb); } boost::signals2::connection LLUICtrl::setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { if (!mMouseLeaveSignal) mMouseLeaveSignal = new commit_signal_t(); + claimMem(mMouseLeaveSignal); + return mMouseLeaveSignal->connect(cb); } boost::signals2::connection LLUICtrl::setMouseDownCallback( const mouse_signal_t::slot_type& cb ) { if (!mMouseDownSignal) mMouseDownSignal = new mouse_signal_t(); + claimMem(mMouseDownSignal); + return mMouseDownSignal->connect(cb); } boost::signals2::connection LLUICtrl::setMouseUpCallback( const mouse_signal_t::slot_type& cb ) { if (!mMouseUpSignal) mMouseUpSignal = new mouse_signal_t(); + claimMem(mMouseUpSignal); + return mMouseUpSignal->connect(cb); } boost::signals2::connection LLUICtrl::setRightMouseDownCallback( const mouse_signal_t::slot_type& cb ) { if (!mRightMouseDownSignal) mRightMouseDownSignal = new mouse_signal_t(); + claimMem(mRightMouseDownSignal); + return mRightMouseDownSignal->connect(cb); } boost::signals2::connection LLUICtrl::setRightMouseUpCallback( const mouse_signal_t::slot_type& cb ) { if (!mRightMouseUpSignal) mRightMouseUpSignal = new mouse_signal_t(); + claimMem(mRightMouseUpSignal); + return mRightMouseUpSignal->connect(cb); } boost::signals2::connection LLUICtrl::setDoubleClickCallback( const mouse_signal_t::slot_type& cb ) { if (!mDoubleClickSignal) mDoubleClickSignal = new mouse_signal_t(); + claimMem(mDoubleClickSignal); + return mDoubleClickSignal->connect(cb); } diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index fb2196bb1640a164a23b390a27c9927a3d7f7e61..99553ee0d26c701fb042895c54c15d6a7d987498 100755 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -220,7 +220,6 @@ class LLUICtrl BOOL focusNextItem(BOOL text_entry_only); BOOL focusPrevItem(BOOL text_entry_only); BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE ); - BOOL focusLastItem(BOOL prefer_text_fields = FALSE); // Non Virtuals LLHandle<LLUICtrl> getHandle() const { return getDerivedHandle<LLUICtrl>(); } @@ -315,8 +314,6 @@ class LLUICtrl BOOL mTentative; ETypeTransparency mTransparencyType; - - class DefaultTabGroupFirstSorter; }; // Build time optimization, generate once in .cpp file diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 60fee47ae058acb7e2a413896b6ab02df4e5002a..4cc7da12679a94d8a4741dd65a3939687e8d1f30 100755 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -44,9 +44,9 @@ // this library includes #include "llpanel.h" -LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION("Widget Construction"); -LLFastTimer::DeclareTimer FTM_INIT_FROM_PARAMS("Widget InitFromParams"); -LLFastTimer::DeclareTimer FTM_WIDGET_SETUP("Widget Setup"); +LLTrace::BlockTimerStatHandle FTM_WIDGET_CONSTRUCTION("Widget Construction"); +LLTrace::BlockTimerStatHandle FTM_INIT_FROM_PARAMS("Widget InitFromParams"); +LLTrace::BlockTimerStatHandle FTM_WIDGET_SETUP("Widget Setup"); //----------------------------------------------------------------------------- @@ -105,12 +105,12 @@ void LLUICtrlFactory::loadWidgetTemplate(const std::string& widget_tag, LLInitPa } } -static LLFastTimer::DeclareTimer FTM_CREATE_CHILDREN("Create XUI Children"); +static LLTrace::BlockTimerStatHandle FTM_CREATE_CHILDREN("Create XUI Children"); //static void LLUICtrlFactory::createChildren(LLView* viewp, LLXMLNodePtr node, const widget_registry_t& registry, LLXMLNodePtr output_node) { - LLFastTimer ft(FTM_CREATE_CHILDREN); + LL_RECORD_BLOCK_TIME(FTM_CREATE_CHILDREN); if (node.isNull()) return; for (LLXMLNodePtr child_node = node->getFirstChild(); child_node.notNull(); child_node = child_node->getNextSibling()) @@ -131,11 +131,11 @@ void LLUICtrlFactory::createChildren(LLView* viewp, LLXMLNodePtr node, const wid // for the child widget // You might need to add something like: // static ParentWidgetRegistry::Register<ChildWidgetType> register("child_widget_name"); - llwarns << child_name << " is not a valid child of " << node->getName()->mString << llendl; + LL_WARNS() << child_name << " is not a valid child of " << node->getName()->mString << LL_ENDL; } else { - llwarns << "Could not create widget named " << child_node->getName()->mString << llendl; + LL_WARNS() << "Could not create widget named " << child_node->getName()->mString << LL_ENDL; } } @@ -147,14 +147,14 @@ void LLUICtrlFactory::createChildren(LLView* viewp, LLXMLNodePtr node, const wid } -static LLFastTimer::DeclareTimer FTM_XML_PARSE("XML Reading/Parsing"); +static LLTrace::BlockTimerStatHandle FTM_XML_PARSE("XML Reading/Parsing"); //----------------------------------------------------------------------------- // getLayeredXMLNode() //----------------------------------------------------------------------------- bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root, LLDir::ESkinConstraint constraint) { - LLFastTimer timer(FTM_XML_PARSE); + LL_RECORD_BLOCK_TIME(FTM_XML_PARSE); std::vector<std::string> paths = gDirUtilp->findSkinnedFilenames(LLDir::XUI, xui_filename, constraint); @@ -179,11 +179,11 @@ S32 LLUICtrlFactory::saveToXML(LLView* viewp, const std::string& filename) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_CREATE_FROM_XML("Create child widget"); +static LLTrace::BlockTimerStatHandle FTM_CREATE_FROM_XML("Create child widget"); LLView *LLUICtrlFactory::createFromXML(LLXMLNodePtr node, LLView* parent, const std::string& filename, const widget_registry_t& registry, LLXMLNodePtr output_node) { - LLFastTimer timer(FTM_CREATE_FROM_XML); + LL_RECORD_BLOCK_TIME(FTM_CREATE_FROM_XML); std::string ctrl_type = node->getName()->mString; LLStringUtil::toLower(ctrl_type); diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 876bb5ef46fe9a519037565ca0e5fc1b7ea0e9c1..a5796c8af2931fd395d6971dbe903550fc0e1695 100755 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -74,9 +74,9 @@ class LLWidgetNameRegistry //: public LLRegistrySingleton<const std::type_info*, empty_param_block_func_t, LLDefaultParamBlockRegistry> //{}; -extern LLFastTimer::DeclareTimer FTM_WIDGET_SETUP; -extern LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION; -extern LLFastTimer::DeclareTimer FTM_INIT_FROM_PARAMS; +extern LLTrace::BlockTimerStatHandle FTM_WIDGET_SETUP; +extern LLTrace::BlockTimerStatHandle FTM_WIDGET_CONSTRUCTION; +extern LLTrace::BlockTimerStatHandle FTM_INIT_FROM_PARAMS; // Build time optimization, generate this once in .cpp file #ifndef LLUICTRLFACTORY_CPP @@ -170,8 +170,8 @@ class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory> LLXMLNodePtr root_node; if (!LLUICtrlFactory::getLayeredXMLNode(filename, root_node)) - { - llwarns << "Couldn't parse XUI file: " << instance().getCurFileName() << llendl; + { + LL_WARNS() << "Couldn't parse XUI file: " << instance().getCurFileName() << LL_ENDL; goto fail; } @@ -182,7 +182,7 @@ class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory> // not of right type, so delete it if (!widget) { - llwarns << "Widget in " << filename << " was of type " << typeid(view).name() << " instead of expected type " << typeid(T).name() << llendl; + LL_WARNS() << "Widget in " << filename << " was of type " << typeid(view).name() << " instead of expected type " << typeid(T).name() << LL_ENDL; delete view; view = NULL; } @@ -225,14 +225,14 @@ class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory> if (!params.validateBlock()) { - llwarns << getInstance()->getCurFileName() << ": Invalid parameter block for " << typeid(T).name() << llendl; + LL_WARNS() << getInstance()->getCurFileName() << ": Invalid parameter block for " << typeid(T).name() << LL_ENDL; //return NULL; } - { LLFastTimer _(FTM_WIDGET_CONSTRUCTION); + { LL_RECORD_BLOCK_TIME(FTM_WIDGET_CONSTRUCTION); widget = new T(params); } - { LLFastTimer _(FTM_INIT_FROM_PARAMS); + { LL_RECORD_BLOCK_TIME(FTM_INIT_FROM_PARAMS); widget->initFromParams(params); } @@ -247,7 +247,7 @@ class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory> template<typename T> static T* defaultBuilder(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node) { - LLFastTimer timer(FTM_WIDGET_SETUP); + LL_RECORD_BLOCK_TIME(FTM_WIDGET_SETUP); typename T::Params params(getDefaultParams<T>()); @@ -259,10 +259,8 @@ class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory> // We always want to output top-left coordinates typename T::Params output_params(params); T::setupParamsForExport(output_params, parent); - // Export only the differences between this any default params - typename T::Params default_params(getDefaultParams<T>()); copyName(node, output_node); - parser.writeXUI(output_node, output_params, &default_params); + parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &getDefaultParams<T>()); } // Apply layout transformations, usually munging rect diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp index c4e073ccdb9cb9892a7fe502a4d56daaca8f8b1b..98d0c215e6bb07d74886b1fe9945088263c15288 100755 --- a/indra/llui/lluistring.cpp +++ b/indra/llui/lluistring.cpp @@ -26,10 +26,12 @@ #include "linden_common.h" #include "lluistring.h" + +#include "llfasttimer.h" #include "llsd.h" #include "lltrans.h" -LLFastTimer::DeclareTimer FTM_UI_STRING("UI String"); +LLTrace::BlockTimerStatHandle FTM_UI_STRING("UI String"); LLUIString::LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args) @@ -54,7 +56,7 @@ void LLUIString::setArgList(const LLStringUtil::format_map_t& args) void LLUIString::setArgs(const LLSD& sd) { - LLFastTimer timer(FTM_UI_STRING); + LL_RECORD_BLOCK_TIME(FTM_UI_STRING); if (!sd.isMap()) return; for(LLSD::map_const_iterator sd_it = sd.beginMap(); @@ -117,7 +119,7 @@ void LLUIString::updateResult() const { mNeedsResult = false; - LLFastTimer timer(FTM_UI_STRING); + LL_RECORD_BLOCK_TIME(FTM_UI_STRING); // optimize for empty strings (don't attempt string replacement) if (mOrig.empty()) diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h index cb40c8558235cf65867575818ac254265c5a3dcb..07e02de6d857acbd31632a6d038d3c28e6e7a097 100755 --- a/indra/llui/lluistring.h +++ b/indra/llui/lluistring.h @@ -42,12 +42,12 @@ // LLUIString mMessage("Welcome [USERNAME] to [SECONDLIFE]!"); // mMessage.setArg("[USERNAME]", "Steve"); // mMessage.setArg("[SECONDLIFE]", "Second Life"); -// llinfos << mMessage.getString() << llendl; // outputs "Welcome Steve to Second Life" +// LL_INFOS() << mMessage.getString() << LL_ENDL; // outputs "Welcome Steve to Second Life" // mMessage.setArg("[USERNAME]", "Joe"); -// llinfos << mMessage.getString() << llendl; // outputs "Welcome Joe to Second Life" +// LL_INFOS() << mMessage.getString() << LL_ENDL; // outputs "Welcome Joe to Second Life" // mMessage = "Bienvenido a la [SECONDLIFE] [USERNAME]" // mMessage.setArg("[SECONDLIFE]", "Segunda Vida"); -// llinfos << mMessage.getString() << llendl; // outputs "Bienvenido a la Segunda Vida Joe" +// LL_INFOS() << mMessage.getString() << LL_ENDL; // outputs "Bienvenido a la Segunda Vida Joe" // Implementation Notes: // Attempting to have operator[](const std::string& s) return mArgs[s] fails because we have diff --git a/indra/llui/llundo.cpp b/indra/llui/llundo.cpp index 06b05142233238d4813b5ab1c4c44ff18b7092ea..7c4c183a30a27ec004336e45b3e7399afd9c3273 100755 --- a/indra/llui/llundo.cpp +++ b/indra/llui/llundo.cpp @@ -51,7 +51,7 @@ LLUndoBuffer::LLUndoBuffer( LLUndoAction (*create_func()), S32 initial_count ) mActions[i] = create_func(); if (!mActions[i]) { - llerrs << "Unable to create action for undo buffer" << llendl; + LL_ERRS() << "Unable to create action for undo buffer" << LL_ENDL; } } } diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 840f67968d2a68178dd71bfd93b5eaf08a30ff31..6f3122e7a1c9cd934311b5142277fdc73d4bf735 100755 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -789,7 +789,7 @@ std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelC if (path_parts < 3) // no parcel id { - llwarns << "Failed to parse url [" << url << "]" << llendl; + LL_WARNS() << "Failed to parse url [" << url << "]" << LL_ENDL; return url; } @@ -929,7 +929,7 @@ std::string LLUrlEntryRegion::getLabel(const std::string &url, const LLUrlLabelC if (path_parts < 3) // no region name { - llwarns << "Failed to parse url [" << url << "]" << llendl; + LL_WARNS() << "Failed to parse url [" << url << "]" << LL_ENDL; return url; } diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 8c6c32178af66856990ff00967c639d6560afeb4..d4684e2e1e1f04185863f8b36b838c10e781ce34 100755 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -32,6 +32,7 @@ #include "lluicolor.h" #include "llstyle.h" +#include "llavatarname.h" #include "llhost.h" // for resolving parcel name by parcel id #include <boost/signals2.hpp> diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 5ee2169b664718444144b6daa1092ea08e31e7f9..77c8878f4b4c3036315a75d0e695be2d621dbd77 100755 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -30,7 +30,6 @@ #define LLVIEW_CPP #include "llview.h" -#include <cassert> #include <sstream> #include <boost/tokenizer.hpp> #include <boost/foreach.hpp> @@ -87,6 +86,16 @@ template class LLView* LLView::getChild<class LLView>( static LLDefaultChildRegistry::Register<LLView> r("view"); +namespace LLInitParam +{ + void TypeValues<LLView::EOrientation>::declareValues() + { + declare("horizontal", LLView::HORIZONTAL); + declare("vertical", LLView::VERTICAL); + } +} + + LLView::Follows::Follows() : string(""), flags("flags", FOLLOWS_LEFT | FOLLOWS_TOP) @@ -124,7 +133,8 @@ LLView::Params::Params() } LLView::LLView(const LLView::Params& p) -: mVisible(p.visible), +: LLTrace::MemTrackable<LLView>("LLView"), + mVisible(p.visible), mInDraw(false), mName(p.name), mParentView(NULL), @@ -132,7 +142,6 @@ LLView::LLView(const LLView::Params& p) mFromXUI(p.from_xui), mIsFocusRoot(p.focus_root), mLastVisible(FALSE), - mNextInsertionOrdinal(0), mHoverCursor(getCursorFromString(p.hover_cursor)), mEnabled(p.enabled), mMouseOpaque(p.mouse_opaque), @@ -151,10 +160,10 @@ LLView::LLView(const LLView::Params& p) LLView::~LLView() { dirtyRect(); - //llinfos << "Deleting view " << mName << ":" << (void*) this << llendl; + //LL_INFOS() << "Deleting view " << mName << ":" << (void*) this << LL_ENDL; if (LLView::sIsDrawing) { - lldebugs << "Deleting view " << mName << " during UI draw() phase" << llendl; + LL_DEBUGS() << "Deleting view " << mName << " during UI draw() phase" << LL_ENDL; } // llassert(LLView::sIsDrawing == FALSE); @@ -162,7 +171,7 @@ LLView::~LLView() if( hasMouseCapture() ) { - //llwarns << "View holding mouse capture deleted: " << getName() << ". Mouse capture removed." << llendl; + //LL_WARNS() << "View holding mouse capture deleted: " << getName() << ". Mouse capture removed." << LL_ENDL; gFocusMgr.removeMouseCaptureWithoutCallback( this ); } @@ -267,22 +276,6 @@ void LLView::sendChildToBack(LLView* child) } } -void LLView::moveChildToFrontOfTabGroup(LLUICtrl* child) -{ - if(mCtrlOrder.find(child) != mCtrlOrder.end()) - { - mCtrlOrder[child].second = -1 * mNextInsertionOrdinal++; - } -} - -void LLView::moveChildToBackOfTabGroup(LLUICtrl* child) -{ - if(mCtrlOrder.find(child) != mCtrlOrder.end()) - { - mCtrlOrder[child].second = mNextInsertionOrdinal++; - } -} - // virtual bool LLView::addChild(LLView* child, S32 tab_group) { @@ -290,9 +283,10 @@ bool LLView::addChild(LLView* child, S32 tab_group) { return false; } - if (mParentView == child) + + if (this == child) { - llerrs << "Adding view " << child->getName() << " as child of itself" << llendl; + LL_ERRS() << "Adding view " << child->getName() << " as child of itself" << LL_ENDL; } // remove from current parent @@ -304,14 +298,10 @@ bool LLView::addChild(LLView* child, S32 tab_group) // add to front of child list, as normal mChildList.push_front(child); - // add to ctrl list if is LLUICtrl - if (child->isCtrl()) + // add to tab order list + if (tab_group != 0) { - LLUICtrl* ctrl = static_cast<LLUICtrl*>(child); - mCtrlOrder.insert(tab_order_pair_t(ctrl, - tab_order_t(tab_group, mNextInsertionOrdinal))); - - mNextInsertionOrdinal++; + mTabOrder.insert(tab_order_pair_t(child, tab_group)); } child->mParentView = this; @@ -342,69 +332,19 @@ void LLView::removeChild(LLView* child) llassert(child->mInDraw == false); mChildList.remove( child ); child->mParentView = NULL; - if (child->isCtrl()) + child_tab_order_t::iterator found = mTabOrder.find(child); + if(found != mTabOrder.end()) { - child_tab_order_t::iterator found = mCtrlOrder.find(static_cast<LLUICtrl*>(child)); - if(found != mCtrlOrder.end()) - { - mCtrlOrder.erase(found); - } + mTabOrder.erase(found); } } else { - llwarns << "\"" << child->getName() << "\" is not a child of " << getName() << llendl; + LL_WARNS() << "\"" << child->getName() << "\" is not a child of " << getName() << LL_ENDL; } updateBoundingRect(); } -LLView::ctrl_list_t LLView::getCtrlList() const -{ - ctrl_list_t controls; - BOOST_FOREACH(LLView* viewp, mChildList) - { - if(viewp->isCtrl()) - { - controls.push_back(static_cast<LLUICtrl*>(viewp)); - } - } - return controls; -} - -LLView::ctrl_list_t LLView::getCtrlListSorted() const -{ - ctrl_list_t controls = getCtrlList(); - std::sort(controls.begin(), controls.end(), LLCompareByTabOrder(mCtrlOrder)); - return controls; -} - - -// This method compares two LLViews by the tab order specified in the comparator object. The -// code for this is a little convoluted because each argument can have four states: -// 1) not a control, 2) a control but not in the tab order, 3) a control in the tab order, 4) null -bool LLCompareByTabOrder::operator() (const LLView* const a, const LLView* const b) const -{ - S32 a_score = 0, b_score = 0; - if(a) a_score--; - if(b) b_score--; - if(a && a->isCtrl()) a_score--; - if(b && b->isCtrl()) b_score--; - if(a_score == -2 && b_score == -2) - { - const LLUICtrl * const a_ctrl = static_cast<const LLUICtrl*>(a); - const LLUICtrl * const b_ctrl = static_cast<const LLUICtrl*>(b); - LLView::child_tab_order_const_iter_t a_found = mTabOrder.find(a_ctrl), b_found = mTabOrder.find(b_ctrl); - if(a_found != mTabOrder.end()) a_score--; - if(b_found != mTabOrder.end()) b_score--; - if(a_score == -3 && b_score == -3) - { - // whew! Once we're in here, they're both in the tab order, and we can compare based on that - return compareTabOrders(a_found->second, b_found->second); - } - } - return (a_score == b_score) ? a < b : a_score < b_score; -} - BOOL LLView::isInVisibleChain() const { BOOL visible = TRUE; @@ -528,9 +468,9 @@ BOOL LLView::focusPrevRoot() // static BOOL LLView::focusNext(LLView::child_list_t & result) { - LLView::child_list_iter_t focused = result.end(); - for(LLView::child_list_iter_t iter = result.begin(); - iter != result.end(); + LLView::child_list_reverse_iter_t focused = result.rend(); + for(LLView::child_list_reverse_iter_t iter = result.rbegin(); + iter != result.rend(); ++iter) { if(gFocusMgr.childHasKeyboardFocus(*iter)) @@ -539,14 +479,14 @@ BOOL LLView::focusNext(LLView::child_list_t & result) break; } } - LLView::child_list_iter_t next = focused; - next = (next == result.end()) ? result.begin() : ++next; + LLView::child_list_reverse_iter_t next = focused; + next = (next == result.rend()) ? result.rbegin() : ++next; while(next != focused) { // wrap around to beginning if necessary - if(next == result.end()) + if(next == result.rend()) { - next = result.begin(); + next = result.rbegin(); } if((*next)->isCtrl()) { @@ -564,9 +504,9 @@ BOOL LLView::focusNext(LLView::child_list_t & result) // static BOOL LLView::focusPrev(LLView::child_list_t & result) { - LLView::child_list_reverse_iter_t focused = result.rend(); - for(LLView::child_list_reverse_iter_t iter = result.rbegin(); - iter != result.rend(); + LLView::child_list_iter_t focused = result.end(); + for(LLView::child_list_iter_t iter = result.begin(); + iter != result.end(); ++iter) { if(gFocusMgr.childHasKeyboardFocus(*iter)) @@ -575,14 +515,14 @@ BOOL LLView::focusPrev(LLView::child_list_t & result) break; } } - LLView::child_list_reverse_iter_t next = focused; - next = (next == result.rend()) ? result.rbegin() : ++next; + LLView::child_list_iter_t next = focused; + next = (next == result.end()) ? result.begin() : ++next; while(next != focused) { // wrap around to beginning if necessary - if(next == result.rend()) + if(next == result.end()) { - next = result.rbegin(); + next = result.begin(); } if((*next)->isCtrl()) { @@ -606,7 +546,7 @@ BOOL LLView::focusPrev(LLView::child_list_t & result) void LLView::deleteAllChildren() { // clear out the control ordering - mCtrlOrder.clear(); + mTabOrder.clear(); while (!mChildList.empty()) { @@ -635,14 +575,14 @@ void LLView::setVisible(BOOL visible) { // tell all children of this view that the visibility may have changed dirtyRect(); - handleVisibilityChange( visible ); + onVisibilityChange( visible ); } updateBoundingRect(); } } // virtual -void LLView::handleVisibilityChange ( BOOL new_visibility ) +void LLView::onVisibilityChange ( BOOL new_visibility ) { BOOL old_visibility; BOOL log_visibility_change = LLViewerEventRecorder::instance().getLoggingStatus(); @@ -653,23 +593,24 @@ void LLView::handleVisibilityChange ( BOOL new_visibility ) if(log_visibility_change) { - if (old_visibility!=new_visibility) - { - LLViewerEventRecorder::instance().logVisibilityChange( viewp->getPathname(), viewp->getName(), new_visibility,"widget"); - } + if (old_visibility!=new_visibility) + { + LLViewerEventRecorder::instance().logVisibilityChange( viewp->getPathname(), viewp->getName(), new_visibility,"widget"); + } } if (old_visibility) { - viewp->handleVisibilityChange ( new_visibility ); + viewp->onVisibilityChange ( new_visibility ); } if(log_visibility_change) { // Consider changing returns to confirm success and know which widget grabbed it - // For now assume success and log at highest xui possible + // For now assume success and log at highest xui possible // NOTE we log actual state - which may differ if it somehow failed to set visibility - lldebugs << "LLView::handleVisibilityChange - now: " << getVisible() << " xui: " << viewp->getPathname() << " name: " << viewp->getName() << llendl; + LL_DEBUGS() << "LLView::handleVisibilityChange - now: " << getVisible() << " xui: " << viewp->getPathname() << " name: " << viewp->getName() << LL_ENDL; + } } } @@ -699,12 +640,12 @@ BOOL LLView::handleHover(S32 x, S32 y, MASK mask) void LLView::onMouseEnter(S32 x, S32 y, MASK mask) { - //llinfos << "Mouse entered " << getName() << llendl; + //LL_INFOS() << "Mouse entered " << getName() << LL_ENDL; } void LLView::onMouseLeave(S32 x, S32 y, MASK mask) { - //llinfos << "Mouse left " << getName() << llendl; + //LL_INFOS() << "Mouse left " << getName() << LL_ENDL; } bool LLView::visibleAndContains(S32 local_x, S32 local_y) @@ -740,7 +681,7 @@ LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& m { if (LLView::sDebugKeys) { - llinfos << desc << " handled by " << viewp->getName() << llendl; + LL_INFOS() << desc << " handled by " << viewp->getName() << LL_ENDL; } return viewp; } @@ -766,8 +707,8 @@ LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDA if ((viewp->*method)( local_x, local_y, extra ) || (allow_mouse_block && viewp->blockMouseEvent( local_x, local_y ))) { - lldebugs << "LLView::childrenHandleMouseEvent calling updatemouseeventinfo - local_x|global x "<< local_x << " " << x << "local/global y " << local_y << " " << y << llendl; - lldebugs << "LLView::childrenHandleMouseEvent getPathname for viewp result: " << viewp->getPathname() << "for this view: " << getPathname() << llendl; + LL_DEBUGS() << "LLView::childrenHandleMouseEvent calling updatemouseeventinfo - local_x|global x "<< local_x << " " << x << "local/global y " << local_y << " " << y << LL_ENDL; + LL_DEBUGS() << "LLView::childrenHandleMouseEvent getPathname for viewp result: " << viewp->getPathname() << "for this view: " << getPathname() << LL_ENDL; LLViewerEventRecorder::instance().updateMouseEventInfo(x,y,-55,-55,getPathname()); @@ -944,7 +885,7 @@ BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent) handled = handleKeyHere( key, mask ); if (handled) { - llwarns << "Key handled by " << getName() << llendl; + LL_WARNS() << "Key handled by " << getName() << LL_ENDL; } } } @@ -981,7 +922,7 @@ BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) handled = handleUnicodeCharHere(uni_char); if (handled && LLView::sDebugKeys) { - llinfos << "Unicode key handled by " << getName() << llendl; + LL_INFOS() << "Unicode key handled by " << getName() << LL_ENDL; } } } @@ -1163,7 +1104,7 @@ void LLView::drawChildren() // Check for bogus rectangle if (!getRect().isValid()) { - llwarns << "Bogus rectangle for " << getName() << " with " << mRect << llendl; + LL_WARNS() << "Bogus rectangle for " << getName() << " with " << mRect << LL_ENDL; } } } @@ -1316,56 +1257,56 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) { if (viewp != NULL) { - LLRect child_rect( viewp->mRect ); + LLRect child_rect( viewp->mRect ); - if (viewp->followsRight() && viewp->followsLeft()) - { - child_rect.mRight += delta_width; - } - else if (viewp->followsRight()) - { - child_rect.mLeft += delta_width; - child_rect.mRight += delta_width; - } - else if (viewp->followsLeft()) - { - // left is 0, don't need to adjust coords - } - else - { - // BUG what to do when we don't follow anyone? - // for now, same as followsLeft - } + if (viewp->followsRight() && viewp->followsLeft()) + { + child_rect.mRight += delta_width; + } + else if (viewp->followsRight()) + { + child_rect.mLeft += delta_width; + child_rect.mRight += delta_width; + } + else if (viewp->followsLeft()) + { + // left is 0, don't need to adjust coords + } + else + { + // BUG what to do when we don't follow anyone? + // for now, same as followsLeft + } - if (viewp->followsTop() && viewp->followsBottom()) - { - child_rect.mTop += delta_height; - } - else if (viewp->followsTop()) - { - child_rect.mTop += delta_height; - child_rect.mBottom += delta_height; - } - else if (viewp->followsBottom()) - { - // bottom is 0, so don't need to adjust coords - } - else - { - // BUG what to do when we don't follow? - // for now, same as bottom - } + if (viewp->followsTop() && viewp->followsBottom()) + { + child_rect.mTop += delta_height; + } + else if (viewp->followsTop()) + { + child_rect.mTop += delta_height; + child_rect.mBottom += delta_height; + } + else if (viewp->followsBottom()) + { + // bottom is 0, so don't need to adjust coords + } + else + { + // BUG what to do when we don't follow? + // for now, same as bottom + } - S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft; - S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom; - viewp->translate( delta_x, delta_y ); - if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight()) - { - viewp->reshape(child_rect.getWidth(), child_rect.getHeight()); - } + S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft; + S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom; + viewp->translate( delta_x, delta_y ); + if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight()) + { + viewp->reshape(child_rect.getWidth(), child_rect.getHeight()); } } } + } if (!called_from_parent) { @@ -1540,11 +1481,11 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse) const return getChild<LLView>(name, recurse); } -static LLFastTimer::DeclareTimer FTM_FIND_VIEWS("Find Widgets"); +static LLTrace::BlockTimerStatHandle FTM_FIND_VIEWS("Find Widgets"); LLView* LLView::findChildView(const std::string& name, BOOL recurse) const { - LLFastTimer ft(FTM_FIND_VIEWS); + LL_RECORD_BLOCK_TIME(FTM_FIND_VIEWS); //richard: should we allow empty names? //if(name.empty()) // return NULL; @@ -1859,15 +1800,63 @@ BOOL LLView::localRectToOtherView( const LLRect& local, LLRect* other, const LLV return FALSE; } + +class CompareByTabOrder +{ +public: + CompareByTabOrder(const LLView::child_tab_order_t& order, S32 default_tab_group = 0) + : mTabOrder(order), + mDefaultTabGroup(default_tab_group) + {} + virtual ~CompareByTabOrder() {} + + // This method compares two LLViews by the tab order specified in the comparator object. The + // code for this is a little convoluted because each argument can have four states: + // 1) not a control, 2) a control but not in the tab order, 3) a control in the tab order, 4) null + bool operator() (const LLView* const a, const LLView* const b) const + { + S32 a_group = 0, b_group = 0; + if(!a) return false; + if(!b) return true; + + LLView::child_tab_order_const_iter_t a_found = mTabOrder.find(a), b_found = mTabOrder.find(b); + if(a_found != mTabOrder.end()) + { + a_group = a_found->second; + } + if(b_found != mTabOrder.end()) + { + b_group = b_found->second; + } + + if(a_group < mDefaultTabGroup && b_group >= mDefaultTabGroup) return true; + if(b_group < mDefaultTabGroup && a_group >= mDefaultTabGroup) return false; + return a_group > b_group; // sort correctly if they're both on the same side of the default tab groupreturn a > b; + } +private: + // ok to store a reference, as this should only be allocated on stack during view query operations + const LLView::child_tab_order_t& mTabOrder; + const S32 mDefaultTabGroup; +}; + +class SortByTabOrder : public LLQuerySorter, public LLSingleton<SortByTabOrder> +{ + /*virtual*/ void sort(LLView * parent, LLView::child_list_t &children) const + { + children.sort(CompareByTabOrder(parent->getTabOrder(), parent->getDefaultTabGroup())); + } +}; + // static -const LLCtrlQuery & LLView::getTabOrderQuery() +const LLViewQuery & LLView::getTabOrderQuery() { - static LLCtrlQuery query; + static LLViewQuery query; if(query.getPreFilters().size() == 0) { query.addPreFilter(LLVisibleFilter::getInstance()); query.addPreFilter(LLEnabledFilter::getInstance()); query.addPreFilter(LLTabStopFilter::getInstance()); query.addPostFilter(LLLeavesFilter::getInstance()); + query.setSorter(SortByTabOrder::getInstance()); } return query; } @@ -1882,9 +1871,9 @@ class LLFocusRootsFilter : public LLQueryFilter, public LLSingleton<LLFocusRoots }; // static -const LLCtrlQuery & LLView::getFocusRootsQuery() +const LLViewQuery & LLView::getFocusRootsQuery() { - static LLCtrlQuery query; + static LLViewQuery query; if(query.getPreFilters().size() == 0) { query.addPreFilter(LLVisibleFilter::getInstance()); query.addPreFilter(LLEnabledFilter::getInstance()); @@ -2036,7 +2025,7 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna } break; default: - llerrs << "Invalid snap edge" << llendl; + LL_ERRS() << "Invalid snap edge" << LL_ENDL; } } @@ -2138,7 +2127,7 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna } break; default: - llerrs << "Invalid snap edge" << llendl; + LL_ERRS() << "Invalid snap edge" << LL_ENDL; } } } @@ -2465,7 +2454,7 @@ static S32 invert_vertical(S32 y, LLView* parent) } else { - llwarns << "Attempting to convert layout to top-left with no parent" << llendl; + LL_WARNS() << "Attempting to convert layout to top-left with no parent" << LL_ENDL; return y; } } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 15b85a6418fde2184c49eadc77bcbf68643aee3c..7861c8f72976c26f9254ae52c4c8b7de7f8d3e05 100755 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -42,7 +42,6 @@ #include "llui.h" #include "lluistring.h" #include "llviewquery.h" -#include "stdenums.h" #include "lluistring.h" #include "llcursortypes.h" #include "lluictrlfactory.h" @@ -67,6 +66,7 @@ const BOOL NOT_MOUSE_OPAQUE = FALSE; const U32 GL_NAME_UI_RESERVED = 2; + // maintains render state during traversal of UI tree class LLViewDrawContext { @@ -100,9 +100,13 @@ class LLView : public LLMouseHandler, // handles mouse events public LLFocusableElement, // handles keyboard events public LLMortician, // lazy deletion - public LLHandleProvider<LLView> // passes out weak references to self + public LLHandleProvider<LLView>, // passes out weak references to self + public LLTrace::MemTrackable<LLView> // track memory usage { public: + + enum EOrientation { HORIZONTAL, VERTICAL, ORIENTATION_COUNT }; + struct Follows : public LLInitParam::ChoiceBlock<Follows> { Alternative<std::string> string; @@ -163,7 +167,7 @@ class LLView private: // widgets in general are not copyable - LLView(const LLView& other) {}; + LLView(const LLView& other); public: //#if LL_DEBUG static BOOL sIsDrawing; @@ -196,12 +200,9 @@ class LLView typedef child_list_t::reverse_iterator child_list_reverse_iter_t; typedef child_list_t::const_reverse_iterator child_list_const_reverse_iter_t; - typedef std::vector<class LLUICtrl *> ctrl_list_t; - - typedef std::pair<S32, S32> tab_order_t; - typedef std::pair<LLUICtrl *, tab_order_t> tab_order_pair_t; + typedef std::pair<LLView *, S32> tab_order_pair_t; // this structure primarily sorts by the tab group, secondarily by the insertion ordinal (lastly by the value of the pointer) - typedef std::map<const LLUICtrl*, tab_order_t> child_tab_order_t; + typedef std::map<const LLView*, S32> child_tab_order_t; typedef child_tab_order_t::iterator child_tab_order_iter_t; typedef child_tab_order_t::const_iterator child_tab_order_const_iter_t; typedef child_tab_order_t::reverse_iterator child_tab_order_reverse_iter_t; @@ -247,8 +248,6 @@ class LLView void sendChildToFront(LLView* child); void sendChildToBack(LLView* child); - void moveChildToFrontOfTabGroup(LLUICtrl* child); - void moveChildToBackOfTabGroup(LLUICtrl* child); virtual bool addChild(LLView* view, S32 tab_group = 0); @@ -260,9 +259,7 @@ class LLView virtual BOOL postBuild() { return TRUE; } - const child_tab_order_t& getCtrlOrder() const { return mCtrlOrder; } - ctrl_list_t getCtrlList() const; - ctrl_list_t getCtrlListSorted() const; + const child_tab_order_t& getTabOrder() const { return mTabOrder; } void setDefaultTabGroup(S32 d) { mDefaultTabGroup = d; } S32 getDefaultTabGroup() const { return mDefaultTabGroup; } @@ -303,7 +300,7 @@ class LLView virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); - virtual void handleVisibilityChange ( BOOL new_visibility ); + virtual void onVisibilityChange ( BOOL new_visibility ); void pushVisible(BOOL visible) { mLastVisible = mVisible; setVisible(visible); } void popVisible() { setVisible(mLastVisible); } @@ -496,9 +493,9 @@ class LLView static BOOL focusPrev(LLView::child_list_t & result); // returns query for iterating over controls in tab order - static const LLCtrlQuery & getTabOrderQuery(); + static const LLViewQuery & getTabOrderQuery(); // return query for iterating over focus roots in tab order - static const LLCtrlQuery & getFocusRootsQuery(); + static const LLViewQuery & getFocusRootsQuery(); static LLWindow* getWindow(void) { return LLUI::sWindow; } @@ -592,7 +589,7 @@ class LLView U32 mReshapeFlags; - child_tab_order_t mCtrlOrder; + child_tab_order_t mTabOrder; S32 mDefaultTabGroup; S32 mLastTabGroup; @@ -609,8 +606,6 @@ class LLView BOOL mLastVisible; - S32 mNextInsertionOrdinal; - bool mInDraw; static LLWindow* sWindow; // All root views must know about their window. @@ -673,17 +668,14 @@ class LLView static BOOL sForceReshape; }; -class LLCompareByTabOrder +namespace LLInitParam { -public: - LLCompareByTabOrder(const LLView::child_tab_order_t& order) : mTabOrder(order) {} - virtual ~LLCompareByTabOrder() {} - bool operator() (const LLView* const a, const LLView* const b) const; -private: - virtual bool compareTabOrders(const LLView::tab_order_t & a, const LLView::tab_order_t & b) const { return a < b; } - // ok to store a reference, as this should only be allocated on stack during view query operations - const LLView::child_tab_order_t& mTabOrder; +template<> +struct TypeValues<LLView::EOrientation> : public LLInitParam::TypeValuesHelper<LLView::EOrientation> +{ + static void declareValues(); }; +} template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) const { @@ -694,7 +686,7 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co // did we find *something* with that name? if (child) { - llwarns << "Found child named \"" << name << "\" but of wrong type " << typeid(*child).name() << ", expecting " << typeid(T*).name() << llendl; + LL_WARNS() << "Found child named \"" << name << "\" but of wrong type " << typeid(*child).name() << ", expecting " << typeid(T*).name() << LL_ENDL; } result = getDefaultWidget<T>(name); if (!result) @@ -706,11 +698,11 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co // *NOTE: You cannot call mFoo = getChild<LLFoo>("bar") // in a floater or panel constructor. The widgets will not // be ready. Instead, put it in postBuild(). - llwarns << "Making dummy " << typeid(T).name() << " named \"" << name << "\" in " << getName() << llendl; + LL_WARNS() << "Making dummy " << typeid(T).name() << " named \"" << name << "\" in " << getName() << LL_ENDL; } else { - llwarns << "Failed to create dummy " << typeid(T).name() << llendl; + LL_WARNS() << "Failed to create dummy " << typeid(T).name() << LL_ENDL; return NULL; } diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index 546a0f58667fbee559d52904d36b3b49da296fc9..c5a4354f3247f6d923230d3072ca7eb022111fd7 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -53,14 +53,14 @@ void LLViewerEventRecorder::setEventLoggingOn() { mLog.open(mLogFilename, llofstream::out); } logEvents=true; - lldebugs << "LLViewerEventRecorder::setEventLoggingOn event logging turned on" << llendl; + LL_DEBUGS() << "LLViewerEventRecorder::setEventLoggingOn event logging turned on" << LL_ENDL; } void LLViewerEventRecorder::setEventLoggingOff() { logEvents=false; mLog.flush(); mLog.close(); - lldebugs << "LLViewerEventRecorder::setEventLoggingOff event logging turned off" << llendl; + LL_DEBUGS() << "LLViewerEventRecorder::setEventLoggingOff event logging turned off" << LL_ENDL; } @@ -101,10 +101,10 @@ void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 g LLView * target_view = LLUI::resolvePath(LLUI::getRootView(), xui); if (! target_view) { - lldebugs << "LLViewerEventRecorder::updateMouseEventInfo - xui path on file at moment is NOT valid - so DO NOT record these local coords" << llendl; + LL_DEBUGS() << "LLViewerEventRecorder::updateMouseEventInfo - xui path on file at moment is NOT valid - so DO NOT record these local coords" << LL_ENDL; return; } - lldebugs << "LLViewerEventRecorder::updateMouseEventInfo b4 updatemouseeventinfo - local_x|global x "<< this->local_x << " " << this->global_x << "local/global y " << this->local_y << " " << this->global_y << " mname: " << mName << " xui: " << xui << llendl; + LL_DEBUGS() << "LLViewerEventRecorder::updateMouseEventInfo b4 updatemouseeventinfo - local_x|global x "<< this->local_x << " " << this->global_x << "local/global y " << this->local_y << " " << this->global_y << " mname: " << mName << " xui: " << xui << LL_ENDL; if (this->local_x < 1 && this->local_y<1 && local_x && local_y) { @@ -121,7 +121,7 @@ void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 g xui = mName; // TODO review confirm we never call with partial path - also cAN REMOVE CHECK FOR "" - ON OTHER HAND IT'S PRETTY HARMLESS } - lldebugs << "LLViewerEventRecorder::updateMouseEventInfo after updatemouseeventinfo - local_x|global x "<< this->local_x << " " << this->global_x << "local/global y " << this->local_y << " " << this->global_y << " mname: " << mName << " xui: " << xui << llendl; + LL_DEBUGS() << "LLViewerEventRecorder::updateMouseEventInfo after updatemouseeventinfo - local_x|global x "<< this->local_x << " " << this->global_x << "local/global y " << this->local_y << " " << this->global_y << " mname: " << mName << " xui: " << xui << LL_ENDL; } void LLViewerEventRecorder::logVisibilityChange(std::string xui, std::string name, BOOL visibility, std::string event_subtype) { @@ -158,10 +158,10 @@ std::string LLViewerEventRecorder::get_xui() { } void LLViewerEventRecorder::update_xui(std::string xui) { if (xui!="" && this->xui=="" ) { - lldebugs << "LLViewerEventRecorder::update_xui to " << xui << llendl; + LL_DEBUGS() << "LLViewerEventRecorder::update_xui to " << xui << LL_ENDL; this->xui=xui; } else { - lldebugs << "LLViewerEventRecorder::update_xui called with empty string" << llendl; + LL_DEBUGS() << "LLViewerEventRecorder::update_xui called with empty string" << LL_ENDL; } } @@ -200,11 +200,11 @@ void LLViewerEventRecorder::logKeyEvent(KEY key, MASK mask) { // (maybe it should) - instead it has a convenience method that generates the keydown and keyup events // Here we will use "type" as our event type - lldebugs << "LLVIewerEventRecorder::logKeyEvent Serialized LLSD for event " << event.asString() << "\n" << llendl; + LL_DEBUGS() << "LLVIewerEventRecorder::logKeyEvent Serialized LLSD for event " << event.asString() << "\n" << LL_ENDL; - //lldebugs << "[VITA] key_name: " << LLKeyboard::stringFromKey(key) << "mask: "<< mask << "handled by " << getName() << llendl; - lldebugs << "LLVIewerEventRecorder::logKeyEvent key_name: " << LLKeyboard::stringFromKey(key) << "mask: "<< mask << llendl; + //LL_DEBUGS() << "[VITA] key_name: " << LLKeyboard::stringFromKey(key) << "mask: "<< mask << "handled by " << getName() << LL_ENDL; + LL_DEBUGS() << "LLVIewerEventRecorder::logKeyEvent key_name: " << LLKeyboard::stringFromKey(key) << "mask: "<< mask << LL_ENDL; recordEvent(event); @@ -218,14 +218,14 @@ void LLViewerEventRecorder::playbackRecording() { // ivita sets this on startup, it also sends commands to the viewer to make start, stop, and playback menu items visible in viewer LeapCommand =LLUI::sSettingGroups["config"]->getLLSD("LeapPlaybackEventsCommand"); - lldebugs << "[VITA] launching playback - leap command is: " << LLSDXMLStreamer(LeapCommand) << llendl; + LL_DEBUGS() << "[VITA] launching playback - leap command is: " << LLSDXMLStreamer(LeapCommand) << LL_ENDL; LLLeap::create("", LeapCommand, false); // exception=false } void LLViewerEventRecorder::recordEvent(LLSD event) { - lldebugs << "LLViewerEventRecorder::recordEvent event written to log: " << LLSDXMLStreamer(event) << llendl; + LL_DEBUGS() << "LLViewerEventRecorder::recordEvent event written to log: " << LLSDXMLStreamer(event) << LL_ENDL; mLog << event << std::endl; } @@ -243,7 +243,7 @@ void LLViewerEventRecorder::logKeyUnicodeEvent(llwchar uni_char) { // keycode...or // char - lldebugs << "Wrapped in conversion to wstring " << wstring_to_utf8str(LLWString( 1, uni_char)) << "\n" << llendl; + LL_DEBUGS() << "Wrapped in conversion to wstring " << wstring_to_utf8str(LLWString( 1, uni_char)) << "\n" << LL_ENDL; event.insert("char", LLSD( wstring_to_utf8str(LLWString( 1,uni_char)) ) @@ -257,8 +257,8 @@ void LLViewerEventRecorder::logKeyUnicodeEvent(llwchar uni_char) { event.insert("event",LLSD("keyDown")); - lldebugs << "[VITA] unicode key: " << uni_char << llendl; - lldebugs << "[VITA] dumpxml " << LLSDXMLStreamer(event) << "\n" << llendl; + LL_DEBUGS() << "[VITA] unicode key: " << uni_char << LL_ENDL; + LL_DEBUGS() << "[VITA] dumpxml " << LLSDXMLStreamer(event) << "\n" << LL_ENDL; recordEvent(event); diff --git a/indra/llui/llviewmodel.cpp b/indra/llui/llviewmodel.cpp index a9f8acc440f1546e2136a64d0c1715d9057f233c..282addf6925d089043c8e953d8c3c54ab7b6a8bf 100755 --- a/indra/llui/llviewmodel.cpp +++ b/indra/llui/llviewmodel.cpp @@ -37,13 +37,15 @@ /// LLViewModel::LLViewModel() - : mDirty(false) +: LLTrace::MemTrackable<LLViewModel>("LLViewModel"), + mDirty(false) { } /// Instantiate an LLViewModel with an existing data value LLViewModel::LLViewModel(const LLSD& value) - : mDirty(false) +: LLTrace::MemTrackable<LLViewModel>("LLViewModel"), + mDirty(false) { setValue(value); } @@ -79,8 +81,16 @@ LLTextViewModel::LLTextViewModel(const LLSD& value) /// Update the stored value void LLTextViewModel::setValue(const LLSD& value) { + // approximate LLSD storage usage + disclaimMem(mDisplay.size()); LLViewModel::setValue(value); + disclaimMem(mDisplay); mDisplay = utf8str_to_wstring(value.asString()); + + claimMem(mDisplay); + // approximate LLSD storage usage + claimMem(mDisplay.size()); + // mDisplay and mValue agree mUpdateFromDisplay = false; } @@ -91,7 +101,11 @@ void LLTextViewModel::setDisplay(const LLWString& value) // and do the utf8str_to_wstring() to get the corresponding mDisplay // value. But a text editor might want to edit the display string // directly, then convert back to UTF8 on commit. + disclaimMem(mDisplay.size()); + disclaimMem(mDisplay); mDisplay = value; + claimMem(mDisplay); + claimMem(mDisplay.size()); mDirty = true; // Don't immediately convert to UTF8 -- do it lazily -- we expect many // more setDisplay() calls than getValue() calls. Just flag that it needs diff --git a/indra/llui/llviewmodel.h b/indra/llui/llviewmodel.h index ef2e3147992801c9d60fc2bf301983df28797201..49d7c322a3d5f99f420a7856ab0e87acbefb1823 100755 --- a/indra/llui/llviewmodel.h +++ b/indra/llui/llviewmodel.h @@ -37,8 +37,9 @@ #include "llpointer.h" #include "llsd.h" #include "llrefcount.h" -#include "stdenums.h" #include "llstring.h" +#include "lltrace.h" +#include "llui.h" #include <string> class LLScrollListItem; @@ -60,7 +61,9 @@ typedef LLPointer<LLListViewModel> LLListViewModelPtr; * LLViewModel data. This way, the LLViewModel is quietly deleted when the * last referencing widget is destroyed. */ -class LLViewModel: public LLRefCount +class LLViewModel +: public LLRefCount, + public LLTrace::MemTrackable<LLViewModel> { public: LLViewModel(); diff --git a/indra/llui/llviewquery.cpp b/indra/llui/llviewquery.cpp index d0b78ba186427da3a405749f1b2fe81f4201f31d..66262609ae313f9a9058d83ba8a0b8c03266a984 100755 --- a/indra/llui/llviewquery.cpp +++ b/indra/llui/llviewquery.cpp @@ -30,7 +30,7 @@ #include "lluictrl.h" #include "llviewquery.h" -void LLQuerySorter::operator() (LLView * parent, viewList_t &children) const {} +void LLQuerySorter::sort(LLView * parent, viewList_t &children) const {} filterResult_t LLLeavesFilter::operator() (const LLView* const view, const viewList_t & children) const { @@ -89,8 +89,8 @@ viewList_t LLViewQuery::run(LLView* view) const if (pre.first) { post = runFilters(view, filtered_children, mPostFilters); - } } + } if(pre.first && post.first) { @@ -105,12 +105,12 @@ viewList_t LLViewQuery::run(LLView* view) const return result; } -void LLViewQuery::filterChildren(LLView * view, viewList_t & filtered_children) const +void LLViewQuery::filterChildren(LLView* parent_view, viewList_t & filtered_children) const { - LLView::child_list_t views(*(view->getChildList())); + LLView::child_list_t views(*(parent_view->getChildList())); if (mSorterp) { - (*mSorterp)(view, views); // sort the children per the sorter + mSorterp->sort(parent_view, views); // sort the children per the sorter } for(LLView::child_list_iter_t iter = views.begin(); iter != views.end(); @@ -134,18 +134,3 @@ filterResult_t LLViewQuery::runFilters(LLView * view, const viewList_t children, } return result; } - -class SortByTabOrder : public LLQuerySorter, public LLSingleton<SortByTabOrder> -{ - /*virtual*/ void operator() (LLView * parent, LLView::child_list_t &children) const - { - children.sort(LLCompareByTabOrder(parent->getCtrlOrder())); - } -}; - -LLCtrlQuery::LLCtrlQuery() : - LLViewQuery() -{ - setSorter(SortByTabOrder::getInstance()); -} - diff --git a/indra/llui/llviewquery.h b/indra/llui/llviewquery.h index 210f95162acac729f34328953556445d96bd46c6..9044c4ff29c16d7d016e4f9853ff834ca67d9b9b 100755 --- a/indra/llui/llviewquery.h +++ b/indra/llui/llviewquery.h @@ -49,7 +49,7 @@ class LLQuerySorter { public: virtual ~LLQuerySorter() {}; - virtual void operator() (LLView * parent, viewList_t &children) const; + virtual void sort(LLView * parent, viewList_t &children) const; }; class LLLeavesFilter : public LLQueryFilter, public LLSingleton<LLLeavesFilter> @@ -127,10 +127,5 @@ class LLViewQuery const LLQuerySorter* mSorterp; }; -class LLCtrlQuery : public LLViewQuery -{ -public: - LLCtrlQuery(); -}; #endif // LL_LLVIEWQUERY_H diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 6322da91235d90a3084371f61d8d03503828b2cd..4390ca83e938428753e0b965909d5931ae31e16b 100755 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -29,7 +29,7 @@ #include "llxuiparser.h" #include "llxmlnode.h" - +#include "llfasttimer.h" #ifdef LL_STANDALONE #include <expat.h> #else @@ -38,6 +38,7 @@ #include <fstream> #include <boost/tokenizer.hpp> +#include <boost/bind.hpp> //#include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/classic_core.hpp> @@ -334,6 +335,8 @@ LLXSDWriter::LLXSDWriter() registerInspectFunc<LLSD>(boost::bind(&LLXSDWriter::writeAttribute, this, "xs:string", _1, _2, _3, _4)); } +LLXSDWriter::~LLXSDWriter() {} + void LLXSDWriter::writeXSD(const std::string& type_name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace) { Schema schema(xml_namespace); @@ -674,12 +677,12 @@ LLXUIParser::LLXUIParser() } } -static LLFastTimer::DeclareTimer FTM_PARSE_XUI("XUI Parsing"); +static LLTrace::BlockTimerStatHandle FTM_PARSE_XUI("XUI Parsing"); const LLXMLNodePtr DUMMY_NODE = new LLXMLNode(); void LLXUIParser::readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename, bool silent) { - LLFastTimer timer(FTM_PARSE_XUI); + LL_RECORD_BLOCK_TIME(FTM_PARSE_XUI); mNameStack.clear(); mRootNodeName = node->getName()->mString; mCurFileName = filename; @@ -858,11 +861,11 @@ bool LLXUIParser::readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& blo return any_parsed; } -void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &block, const LLInitParam::BaseBlock* diff_block) +void LLXUIParser::writeXUIImpl(LLXMLNodePtr node, const LLInitParam::BaseBlock &block, const LLInitParam::predicate_rule_t rules, const LLInitParam::BaseBlock* diff_block) { mWriteRootNode = node; name_stack_t name_stack = Parser::name_stack_t(); - block.serializeBlock(*this, name_stack, diff_block); + block.serializeBlock(*this, name_stack, rules, diff_block); mOutNodes.clear(); } @@ -1310,7 +1313,7 @@ void LLXUIParser::parserWarning(const std::string& message) { #ifdef LL_WINDOWS // use Visual Studio friendly formatting of output message for easy access to originating xml - LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str())); + LL_INFOS() << llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()) << LL_ENDL; #else Parser::parserWarning(message); #endif @@ -1319,8 +1322,8 @@ void LLXUIParser::parserWarning(const std::string& message) void LLXUIParser::parserError(const std::string& message) { #ifdef LL_WINDOWS - // use Visual Studio friendly formatting of output message for easy access to originating xml - LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str())); + // use Visual Studio friendly formatting of output message for easy access to originating xml + LL_INFOS() << llformat("%s(%d):\t%s", mCurFileName.c_str(), mCurReadNode->getLineNumber(), message.c_str()) << LL_ENDL; #else Parser::parserError(message); #endif @@ -1391,7 +1394,7 @@ LLSimpleXUIParser::~LLSimpleXUIParser() bool LLSimpleXUIParser::readXUI(const std::string& filename, LLInitParam::BaseBlock& block, bool silent) { - LLFastTimer timer(FTM_PARSE_XUI); + LL_RECORD_BLOCK_TIME(FTM_PARSE_XUI); mParser = XML_ParserCreate(NULL); XML_SetUserData(mParser, this); @@ -1638,7 +1641,7 @@ void LLSimpleXUIParser::parserWarning(const std::string& message) { #ifdef LL_WINDOWS // use Visual Studio friendly formatting of output message for easy access to originating xml - LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str())); + LL_INFOS() << llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()) << LL_ENDL; #else Parser::parserWarning(message); #endif @@ -1648,7 +1651,7 @@ void LLSimpleXUIParser::parserError(const std::string& message) { #ifdef LL_WINDOWS // use Visual Studio friendly formatting of output message for easy access to originating xml - LL_WINDOWS_OUTPUT_DEBUG(llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str())); + LL_INFOS() << llformat("%s(%d):\t%s", mCurFileName.c_str(), LINE_NUMBER_HERE, message.c_str()) << LL_ENDL; #else Parser::parserError(message); #endif diff --git a/indra/llui/llxuiparser.h b/indra/llui/llxuiparser.h index e48663e5cc94fc3d4963f0637bca4b06a2f21519..ad2a39cab7f0082f84520bfc1bd0b8156c9bc1a1 100755 --- a/indra/llui/llxuiparser.h +++ b/indra/llui/llxuiparser.h @@ -29,21 +29,15 @@ #include "llinitparam.h" #include "llregistry.h" -#include "llpointer.h" +#include "llxmlnode.h" #include <boost/function.hpp> #include <iosfwd> #include <stack> #include <set> - - class LLView; - -typedef LLPointer<class LLXMLNode> LLXMLNodePtr; - - // lookup widget type by name class LLWidgetTypeRegistry : public LLRegistrySingleton<std::string, const std::type_info*, LLWidgetTypeRegistry> @@ -59,8 +53,6 @@ class LLChildRegistryRegistry : public LLRegistrySingleton<const std::type_info*, widget_registry_t, LLChildRegistryRegistry> {}; - - class LLXSDWriter : public LLInitParam::Parser { LOG_CLASS(LLXSDWriter); @@ -70,6 +62,7 @@ class LLXSDWriter : public LLInitParam::Parser /*virtual*/ std::string getCurrentElementName() { return LLStringUtil::null; } LLXSDWriter(); + ~LLXSDWriter(); protected: void writeAttribute(const std::string& type, const Parser::name_stack_t&, S32 min_count, S32 max_count, const std::vector<std::string>* possible_values); @@ -109,9 +102,26 @@ LOG_CLASS(LLXUIParser); /*virtual*/ void parserError(const std::string& message); void readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename = LLStringUtil::null, bool silent=false); - void writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const LLInitParam::BaseBlock* diff_block = NULL); + template<typename BLOCK> + void writeXUI(LLXMLNodePtr node, + const BLOCK& block, + const LLInitParam::predicate_rule_t rules = LLInitParam::default_parse_rules(), + const LLInitParam::BaseBlock* diff_block = NULL) + { + if (!diff_block + && !rules.isAmbivalent(LLInitParam::HAS_DEFAULT_VALUE)) + { + diff_block = &LLInitParam::defaultValue<BLOCK>(); + } + writeXUIImpl(node, block, rules, diff_block); + } private: + LLXUIParser(const LLXUIParser& other); // no-copy + void writeXUIImpl(LLXMLNodePtr node, + const LLInitParam::BaseBlock& block, + const LLInitParam::predicate_rule_t rules, + const LLInitParam::BaseBlock* diff_block); bool readXUIImpl(LLXMLNodePtr node, LLInitParam::BaseBlock& block); bool readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block); diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index 0d65c3f8c338ef0e761cb72a7392072515c4163d..5f4fb8f4a00fdab8c332def5c3f708cfa71b241f 100755 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -137,7 +137,7 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask) // File masks starting with "/" will match nothing, so we consider them invalid. if (LLStringUtil::startsWith(mask, getDirDelimiter())) { - llwarns << "Invalid file mask: " << mask << llendl; + LL_WARNS() << "Invalid file mask: " << mask << LL_ENDL; llassert(!"Invalid file mask"); } @@ -160,12 +160,12 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask) { retry_count++; result = errno; - llwarns << "Problem removing " << fullpath << " - errorcode: " - << result << " attempt " << retry_count << llendl; + LL_WARNS() << "Problem removing " << fullpath << " - errorcode: " + << result << " attempt " << retry_count << LL_ENDL; if(retry_count >= 5) { - llwarns << "Failed to remove " << fullpath << llendl ; + LL_WARNS() << "Failed to remove " << fullpath << LL_ENDL ; return count ; } @@ -175,7 +175,7 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask) { if (retry_count) { - llwarns << "Successfully removed " << fullpath << llendl; + LL_WARNS() << "Successfully removed " << fullpath << LL_ENDL; } break; } @@ -208,7 +208,7 @@ U32 LLDir::deleteDirAndContents(const std::string& dir_name) } catch (boost::filesystem::filesystem_error &er) { - llwarns << "Failed to delete " << dir_name << " with error " << er.code().message() << llendl; + LL_WARNS() << "Failed to delete " << dir_name << " with error " << er.code().message() << LL_ENDL; } return num_deleted; } @@ -293,7 +293,7 @@ const std::string &LLDir::getLindenUserDir() const { if (mLindenUserDir.empty()) { - lldebugs << "getLindenUserDir() called early, we don't have the user name yet - returning empty string to caller" << llendl; + LL_DEBUGS() << "getLindenUserDir() called early, we don't have the user name yet - returning empty string to caller" << LL_ENDL; } return mLindenUserDir; @@ -575,9 +575,9 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd if (prefix.empty()) { - llwarns << ELLPathToString(location) + LL_WARNS() << ELLPathToString(location) << ", '" << subdir1 << "', '" << subdir2 << "', '" << in_filename - << "': prefix is empty, possible bad filename" << llendl; + << "': prefix is empty, possible bad filename" << LL_ENDL; } std::string expanded_filename = add(add(prefix, subdir1), subdir2); @@ -886,7 +886,7 @@ void LLDir::setLindenUserDir(const std::string &username) } else { - llerrs << "NULL name for LLDir::setLindenUserDir" << llendl; + LL_ERRS() << "NULL name for LLDir::setLindenUserDir" << LL_ENDL; } dumpCurrentDirectories(); @@ -900,7 +900,7 @@ void LLDir::setChatLogsDir(const std::string &path) } else { - llwarns << "Invalid name for LLDir::setChatLogsDir" << llendl; + LL_WARNS() << "Invalid name for LLDir::setChatLogsDir" << LL_ENDL; } } @@ -925,7 +925,7 @@ void LLDir::setPerAccountChatLogsDir(const std::string &username) } else { - llerrs << "NULL name for LLDir::setPerAccountChatLogsDir" << llendl; + LL_ERRS() << "NULL name for LLDir::setPerAccountChatLogsDir" << LL_ENDL; } } @@ -1010,22 +1010,22 @@ bool LLDir::setCacheDir(const std::string &path) void LLDir::dumpCurrentDirectories() { - LL_DEBUGS2("AppInit","Directories") << "Current Directories:" << LL_ENDL; - - LL_DEBUGS2("AppInit","Directories") << " CurPath: " << getCurPath() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " AppName: " << getAppName() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " ExecutableFilename: " << getExecutableFilename() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " ExecutableDir: " << getExecutableDir() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " ExecutablePathAndName: " << getExecutablePathAndName() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " WorkingDir: " << getWorkingDir() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " AppRODataDir: " << getAppRODataDir() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " OSUserDir: " << getOSUserDir() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " OSUserAppDir: " << getOSUserAppDir() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " LindenUserDir: " << getLindenUserDir() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " TempDir: " << getTempDir() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " CAFile: " << getCAFile() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " SkinBaseDir: " << getSkinBaseDir() << LL_ENDL; - LL_DEBUGS2("AppInit","Directories") << " SkinDir: " << getSkinDir() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << "Current Directories:" << LL_ENDL; + + LL_DEBUGS("AppInit","Directories") << " CurPath: " << getCurPath() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " AppName: " << getAppName() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " ExecutableFilename: " << getExecutableFilename() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " ExecutableDir: " << getExecutableDir() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " ExecutablePathAndName: " << getExecutablePathAndName() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " WorkingDir: " << getWorkingDir() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " AppRODataDir: " << getAppRODataDir() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " OSUserDir: " << getOSUserDir() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " OSUserAppDir: " << getOSUserAppDir() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " LindenUserDir: " << getLindenUserDir() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " TempDir: " << getTempDir() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " CAFile: " << getCAFile() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " SkinBaseDir: " << getSkinBaseDir() << LL_ENDL; + LL_DEBUGS("AppInit","Directories") << " SkinDir: " << getSkinDir() << LL_ENDL; } std::string LLDir::add(const std::string& path, const std::string& name) const @@ -1095,13 +1095,13 @@ void dir_exists_or_crash(const std::string &dir_name) { if(0 != LLFile::mkdir(dir_name, 0700)) // octal { - llerrs << "Unable to create directory: " << dir_name << llendl; + LL_ERRS() << "Unable to create directory: " << dir_name << LL_ENDL; } } else { - llerrs << "Unable to stat: " << dir_name << " errno = " << stat_rv - << llendl; + LL_ERRS() << "Unable to stat: " << dir_name << " errno = " << stat_rv + << LL_ENDL; } } else @@ -1109,7 +1109,7 @@ void dir_exists_or_crash(const std::string &dir_name) // data_dir exists, make sure it's a directory. if(!S_ISDIR(dir_stat.st_mode)) { - llerrs << "Data directory collision: " << dir_name << llendl; + LL_ERRS() << "Data directory collision: " << dir_name << LL_ENDL; } } #endif diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp index 4edd078640377ba9e7ccd78fda9e66ec73749db1..7a4034c22878dfe45d673dff231aaec3ab87deb6 100755 --- a/indra/llvfs/lldir_linux.cpp +++ b/indra/llvfs/lldir_linux.cpp @@ -49,7 +49,7 @@ static std::string getCurrentUserHome(char* fallback) } else { - llinfos << "Couldn't detect home directory from passwd - trying $HOME" << llendl; + LL_INFOS() << "Couldn't detect home directory from passwd - trying $HOME" << LL_ENDL; const char *const home_env = getenv("HOME"); /* Flawfinder: ignore */ if (home_env) { @@ -57,7 +57,7 @@ static std::string getCurrentUserHome(char* fallback) } else { - llwarns << "Couldn't detect home directory! Falling back to " << fallback << llendl; + LL_WARNS() << "Couldn't detect home directory! Falling back to " << fallback << LL_ENDL; } } @@ -76,11 +76,11 @@ LLDir_Linux::LLDir_Linux() if (getcwd(tmp_str, LL_MAX_PATH) == NULL) { strcpy(tmp_str, "/tmp"); - llwarns << "Could not get current directory; changing to " - << tmp_str << llendl; + LL_WARNS() << "Could not get current directory; changing to " + << tmp_str << LL_ENDL; if (chdir(tmp_str) == -1) { - llerrs << "Could not change directory to " << tmp_str << llendl; + LL_ERRS() << "Could not change directory to " << tmp_str << LL_ENDL; } } @@ -98,8 +98,8 @@ LLDir_Linux::LLDir_Linux() { // ...we're in a dev checkout mSkinBaseDir = mExecutableDir.substr(0, build_dir_pos) + "/indra/newview/skins"; - llinfos << "Running in dev checkout with mSkinBaseDir " - << mSkinBaseDir << llendl; + LL_INFOS() << "Running in dev checkout with mSkinBaseDir " + << mSkinBaseDir << LL_ENDL; } else { @@ -187,8 +187,8 @@ void LLDir_Linux::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create app user dir " << mOSUserAppDir << llendl; - llwarns << "Default to base dir" << mOSUserDir << llendl; + LL_WARNS() << "Couldn't create app user dir " << mOSUserAppDir << LL_ENDL; + LL_WARNS() << "Default to base dir" << mOSUserDir << LL_ENDL; mOSUserAppDir = mOSUserDir; } } @@ -198,7 +198,7 @@ void LLDir_Linux::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << llendl; + LL_WARNS() << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << LL_ENDL; } } @@ -207,7 +207,7 @@ void LLDir_Linux::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << llendl; + LL_WARNS() << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << LL_ENDL; } } @@ -216,7 +216,7 @@ void LLDir_Linux::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << llendl; + LL_WARNS() << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << LL_ENDL; } } @@ -247,7 +247,7 @@ std::string LLDir_Linux::getCurPath() char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ if (getcwd(tmp_str, LL_MAX_PATH) == NULL) { - llwarns << "Could not get current directory" << llendl; + LL_WARNS() << "Could not get current directory" << LL_ENDL; tmp_str[0] = '\0'; } return tmp_str; diff --git a/indra/llvfs/lldir_mac.cpp b/indra/llvfs/lldir_mac.cpp index 2f47ab35071a1d891739c717e59726e05ee32bc4..4038c924654487e00cbdb8504fdef98d040061a1 100755 --- a/indra/llvfs/lldir_mac.cpp +++ b/indra/llvfs/lldir_mac.cpp @@ -100,8 +100,8 @@ LLDir_Mac::LLDir_Mac() // ...we're in a dev checkout mSkinBaseDir = mExecutableDir.substr(0, build_dir_pos) + "/indra/newview/skins"; - llinfos << "Running in dev checkout with mSkinBaseDir " - << mSkinBaseDir << llendl; + LL_INFOS() << "Running in dev checkout with mSkinBaseDir " + << mSkinBaseDir << LL_ENDL; } else { diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp index a97d72d539e28029f8c5daf92479320d4d1ed51a..b43b2f27ce0a00576a83f33f5f6bddf75456bb4c 100755 --- a/indra/llvfs/lldir_solaris.cpp +++ b/indra/llvfs/lldir_solaris.cpp @@ -52,7 +52,7 @@ static std::string getCurrentUserHome(char* fallback) } else { - llinfos << "Couldn't detect home directory from passwd - trying $HOME" << llendl; + LL_INFOS() << "Couldn't detect home directory from passwd - trying $HOME" << LL_ENDL; const char *const home_env = getenv("HOME"); /* Flawfinder: ignore */ if (home_env) { @@ -60,7 +60,7 @@ static std::string getCurrentUserHome(char* fallback) } else { - llwarns << "Couldn't detect home directory! Falling back to " << fallback << llendl; + LL_WARNS() << "Couldn't detect home directory! Falling back to " << fallback << LL_ENDL; } } @@ -79,11 +79,11 @@ LLDir_Solaris::LLDir_Solaris() if (getcwd(tmp_str, LL_MAX_PATH) == NULL) { strcpy(tmp_str, "/tmp"); - llwarns << "Could not get current directory; changing to " - << tmp_str << llendl; + LL_WARNS() << "Could not get current directory; changing to " + << tmp_str << LL_ENDL; if (chdir(tmp_str) == -1) { - llerrs << "Could not change directory to " << tmp_str << llendl; + LL_ERRS() << "Could not change directory to " << tmp_str << LL_ENDL; } } @@ -101,12 +101,12 @@ LLDir_Solaris::LLDir_Solaris() sprintf(path, "/proc/%d/psinfo", (int)getpid()); int proc_fd = -1; if((proc_fd = open(path, O_RDONLY)) == -1){ - llwarns << "unable to open " << path << llendl; + LL_WARNS() << "unable to open " << path << LL_ENDL; return; } psinfo_t proc_psinfo; if(read(proc_fd, &proc_psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)){ - llwarns << "Unable to read " << path << llendl; + LL_WARNS() << "Unable to read " << path << LL_ENDL; close(proc_fd); return; } @@ -114,13 +114,13 @@ LLDir_Solaris::LLDir_Solaris() close(proc_fd); mExecutableFilename = strdup(proc_psinfo.pr_fname); - llinfos << "mExecutableFilename = [" << mExecutableFilename << "]" << llendl; + LL_INFOS() << "mExecutableFilename = [" << mExecutableFilename << "]" << LL_ENDL; sprintf(path, "/proc/%d/path/a.out", (int)getpid()); char execpath[LL_MAX_PATH]; if(readlink(path, execpath, LL_MAX_PATH) == -1){ - llwarns << "Unable to read link from " << path << llendl; + LL_WARNS() << "Unable to read link from " << path << LL_ENDL; return; } @@ -130,7 +130,7 @@ LLDir_Solaris::LLDir_Solaris() *p = NULL; mExecutablePathAndName = strdup(execpath); - llinfos << "mExecutablePathAndName = [" << mExecutablePathAndName << "]" << llendl; + LL_INFOS() << "mExecutablePathAndName = [" << mExecutablePathAndName << "]" << LL_ENDL; //NOTE: Why force people to cd into the package directory? // Look for SECONDLIFE env variable and use it, if set. @@ -151,7 +151,7 @@ LLDir_Solaris::LLDir_Solaris() *s = (char)NULL; mExecutableDir = strdup(execpath); - llinfos << "mExecutableDir = [" << mExecutableDir << "]" << llendl; + LL_INFOS() << "mExecutableDir = [" << mExecutableDir << "]" << LL_ENDL; } } @@ -205,8 +205,8 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create app user dir " << mOSUserAppDir << llendl; - llwarns << "Default to base dir" << mOSUserDir << llendl; + LL_WARNS() << "Couldn't create app user dir " << mOSUserAppDir << LL_ENDL; + LL_WARNS() << "Default to base dir" << mOSUserDir << LL_ENDL; mOSUserAppDir = mOSUserDir; } } @@ -216,7 +216,7 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << llendl; + LL_WARNS() << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << LL_ENDL; } } @@ -225,7 +225,7 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << llendl; + LL_WARNS() << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << LL_ENDL; } } @@ -234,7 +234,7 @@ void LLDir_Solaris::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << llendl; + LL_WARNS() << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << LL_ENDL; } } @@ -265,7 +265,7 @@ std::string LLDir_Solaris::getCurPath() char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */ if (getcwd(tmp_str, LL_MAX_PATH) == NULL) { - llwarns << "Could not get current directory" << llendl; + LL_WARNS() << "Could not get current directory" << LL_ENDL; tmp_str[0] = '\0'; } return tmp_str; diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index 618409595767c965fc6c02052a521767197bf7e5..ebc8fdca33051815cb7ec79eb8760056360136d7 100755 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -131,7 +131,7 @@ LLDir_Win32::LLDir_Win32() mAppRODataDir = mExecutableDir; } -// llinfos << "mAppRODataDir = " << mAppRODataDir << llendl; +// LL_INFOS() << "mAppRODataDir = " << mAppRODataDir << LL_ENDL; mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins"; @@ -144,7 +144,7 @@ LLDir_Win32::LLDir_Win32() { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_CACHE dir " << mDefaultCacheDir << llendl; + LL_WARNS() << "Couldn't create LL_PATH_CACHE dir " << mDefaultCacheDir << LL_ENDL; } } @@ -176,8 +176,8 @@ void LLDir_Win32::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create app user dir " << mOSUserAppDir << llendl; - llwarns << "Default to base dir" << mOSUserDir << llendl; + LL_WARNS() << "Couldn't create app user dir " << mOSUserAppDir << LL_ENDL; + LL_WARNS() << "Default to base dir" << mOSUserDir << LL_ENDL; mOSUserAppDir = mOSUserDir; } } @@ -188,7 +188,7 @@ void LLDir_Win32::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << llendl; + LL_WARNS() << "Couldn't create LL_PATH_LOGS dir " << getExpandedFilename(LL_PATH_LOGS,"") << LL_ENDL; } } @@ -197,7 +197,7 @@ void LLDir_Win32::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << llendl; + LL_WARNS() << "Couldn't create LL_PATH_USER_SETTINGS dir " << getExpandedFilename(LL_PATH_USER_SETTINGS,"") << LL_ENDL; } } @@ -206,7 +206,7 @@ void LLDir_Win32::initAppDirs(const std::string &app_name, { if (errno != EEXIST) { - llwarns << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << llendl; + LL_WARNS() << "Couldn't create LL_PATH_CACHE dir " << getExpandedFilename(LL_PATH_CACHE,"") << LL_ENDL; } } diff --git a/indra/llvfs/lldirguard.h b/indra/llvfs/lldirguard.h index 4330095ad05bb3fded756eb5aeb9e3b4ce56835f..37b9e9b83e115f638eed0cd7561db7c92d8e7ba8 100755 --- a/indra/llvfs/lldirguard.h +++ b/indra/llvfs/lldirguard.h @@ -48,7 +48,7 @@ class LLDirectoryGuard // Dir has changed std::string mOrigDirUtf8 = utf16str_to_utf8str(llutf16string(mOrigDir)); std::string mFinalDirUtf8 = utf16str_to_utf8str(llutf16string(mFinalDir)); - llinfos << "Resetting working dir from " << mFinalDirUtf8 << " to " << mOrigDirUtf8 << llendl; + LL_INFOS() << "Resetting working dir from " << mFinalDirUtf8 << " to " << mOrigDirUtf8 << LL_ENDL; SetCurrentDirectory(mOrigDir); } } diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp index 229608231ca5ccfc88a17d2ba85b7f3f7d062ce8..a9d96c980728954a892b22630ec890c5e9bc5119 100755 --- a/indra/llvfs/lldiriterator.cpp +++ b/indra/llvfs/lldiriterator.cpp @@ -62,13 +62,13 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) } catch (const fs::filesystem_error& e) { - llwarns << e.what() << llendl; + LL_WARNS() << e.what() << LL_ENDL; return; } if (!is_dir) { - llwarns << "Invalid path: \"" << dir_path.string() << "\"" << llendl; + LL_WARNS() << "Invalid path: \"" << dir_path.string() << "\"" << LL_ENDL; return; } @@ -79,7 +79,7 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) } catch (const fs::filesystem_error& e) { - llwarns << e.what() << llendl; + LL_WARNS() << e.what() << LL_ENDL; return; } @@ -95,8 +95,8 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask) } catch (boost::regex_error& e) { - llwarns << "\"" << exp << "\" is not a valid regular expression: " - << e.what() << llendl; + LL_WARNS() << "\"" << exp << "\" is not a valid regular expression: " + << e.what() << LL_ENDL; return; } @@ -113,7 +113,7 @@ bool LLDirIterator::Impl::next(std::string &fname) if (!mIsValid) { - llwarns << "The iterator is not correctly initialized." << llendl; + LL_WARNS() << "The iterator is not correctly initialized." << LL_ENDL; return false; } @@ -137,7 +137,7 @@ bool LLDirIterator::Impl::next(std::string &fname) } catch (const fs::filesystem_error& e) { - llwarns << e.what() << llendl; + LL_WARNS() << e.what() << LL_ENDL; } return found; @@ -185,7 +185,7 @@ std::string glob_to_regex(const std::string& glob) case '}': if (!braces) { - llerrs << "glob_to_regex: Closing brace without an equivalent opening brace: " << glob << llendl; + LL_ERRS() << "glob_to_regex: Closing brace without an equivalent opening brace: " << glob << LL_ENDL; } regex+=')'; @@ -216,7 +216,7 @@ std::string glob_to_regex(const std::string& glob) if (braces) { - llerrs << "glob_to_regex: Unterminated brace expression: " << glob << llendl; + LL_ERRS() << "glob_to_regex: Unterminated brace expression: " << glob << LL_ENDL; } return regex; diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp index 073b1af2a1b3b029231d8d9b6b4710d2f7711a7c..2fd2614cce95a2fb9fbd45e755681325f5751c30 100755 --- a/indra/llvfs/lllfsthread.cpp +++ b/indra/llvfs/lllfsthread.cpp @@ -97,7 +97,7 @@ LLLFSThread::handle_t LLLFSThread::read(const std::string& filename, /* Flawfind bool res = addRequest(req); if (!res) { - llerrs << "LLLFSThread::read called after LLLFSThread::cleanupClass()" << llendl; + LL_ERRS() << "LLLFSThread::read called after LLLFSThread::cleanupClass()" << LL_ENDL; } return handle; @@ -119,7 +119,7 @@ LLLFSThread::handle_t LLLFSThread::write(const std::string& filename, bool res = addRequest(req); if (!res) { - llerrs << "LLLFSThread::read called after LLLFSThread::cleanupClass()" << llendl; + LL_ERRS() << "LLLFSThread::read called after LLLFSThread::cleanupClass()" << LL_ENDL; } return handle; @@ -144,7 +144,7 @@ LLLFSThread::Request::Request(LLLFSThread* thread, { if (numbytes <= 0) { - llwarns << "LLLFSThread: Request with numbytes = " << numbytes << llendl; + LL_WARNS() << "LLLFSThread: Request with numbytes = " << numbytes << LL_ENDL; } } @@ -166,7 +166,7 @@ void LLLFSThread::Request::deleteRequest() { if (getStatus() == STATUS_QUEUED) { - llerrs << "Attempt to delete a queued LLLFSThread::Request!" << llendl; + LL_ERRS() << "Attempt to delete a queued LLLFSThread::Request!" << LL_ENDL; } if (mResponder.notNull()) { @@ -186,7 +186,7 @@ bool LLLFSThread::Request::processRequest() infile.open(mFileName, LL_APR_RB, mThread->getLocalAPRFilePool()); if (!infile.getFileHandle()) { - llwarns << "LLLFS: Unable to read file: " << mFileName << llendl; + LL_WARNS() << "LLLFS: Unable to read file: " << mFileName << LL_ENDL; mBytesRead = 0; // fail return true; } @@ -198,7 +198,7 @@ bool LLLFSThread::Request::processRequest() llassert_always(off >= 0); mBytesRead = infile.read(mBuffer, mBytes ); complete = true; -// llinfos << "LLLFSThread::READ:" << mFileName << " Bytes: " << mBytesRead << llendl; +// LL_INFOS() << "LLLFSThread::READ:" << mFileName << " Bytes: " << mBytesRead << LL_ENDL; } else if (mOperation == FILE_WRITE) { @@ -209,7 +209,7 @@ bool LLLFSThread::Request::processRequest() outfile.open(mFileName, flags, mThread->getLocalAPRFilePool()); if (!outfile.getFileHandle()) { - llwarns << "LLLFS: Unable to write file: " << mFileName << llendl; + LL_WARNS() << "LLLFS: Unable to write file: " << mFileName << LL_ENDL; mBytesRead = 0; // fail return true; } @@ -218,18 +218,18 @@ bool LLLFSThread::Request::processRequest() S32 seek = outfile.seek(APR_SET, mOffset); if (seek < 0) { - llwarns << "LLLFS: Unable to write file (seek failed): " << mFileName << llendl; + LL_WARNS() << "LLLFS: Unable to write file (seek failed): " << mFileName << LL_ENDL; mBytesRead = 0; // fail return true; } } mBytesRead = outfile.write(mBuffer, mBytes ); complete = true; -// llinfos << "LLLFSThread::WRITE:" << mFileName << " Bytes: " << mBytesRead << "/" << mBytes << " Offset:" << mOffset << llendl; +// LL_INFOS() << "LLLFSThread::WRITE:" << mFileName << " Bytes: " << mBytesRead << "/" << mBytes << " Offset:" << mOffset << LL_ENDL; } else { - llerrs << "LLLFSThread::unknown operation: " << (S32)mOperation << llendl; + LL_ERRS() << "LLLFSThread::unknown operation: " << (S32)mOperation << LL_ENDL; } return complete; } diff --git a/indra/llvfs/llpidlock.cpp b/indra/llvfs/llpidlock.cpp old mode 100755 new mode 100644 index b5fd3673a60629d330a7becb9e3e42da9ece559c..e64368e8d771e207323371f769b39de81ae300b1 --- a/indra/llvfs/llpidlock.cpp +++ b/indra/llvfs/llpidlock.cpp @@ -38,12 +38,6 @@ #include <windows.h> -namespace { - inline DWORD getpid() { - return GetCurrentProcessId(); - } -} - bool isProcessAlive(U32 pid) { return (bool) GetProcessVersion((DWORD)pid); @@ -105,7 +99,7 @@ void LLPidLockFile::writeLockFile(LLSD pids) if (!LLSDSerialize::toXML(pids,ofile)) { - llwarns << "Unable to write concurrent save lock file." << llendl; + LL_WARNS() << "Unable to write concurrent save lock file." << LL_ENDL; } ofile.close(); } diff --git a/indra/llvfs/llpidlock.h b/indra/llvfs/llpidlock.h old mode 100755 new mode 100644 diff --git a/indra/llvfs/llvfile.cpp b/indra/llvfs/llvfile.cpp index 306d7d8ec706dadbe0533abd5207c118e1261916..34b61ee0a0f6e911b51dfbfa3a63b5dfae012aad 100755 --- a/indra/llvfs/llvfile.cpp +++ b/indra/llvfs/llvfile.cpp @@ -30,16 +30,17 @@ #include "llerror.h" #include "llthread.h" -#include "llstat.h" -#include "llvfs.h" +#include "lltimer.h" +#include "llfasttimer.h" #include "llmemory.h" +#include "llvfs.h" const S32 LLVFile::READ = 0x00000001; const S32 LLVFile::WRITE = 0x00000002; const S32 LLVFile::READ_WRITE = 0x00000003; // LLVFile::READ & LLVFile::WRITE const S32 LLVFile::APPEND = 0x00000006; // 0x00000004 & LLVFile::WRITE -static LLFastTimer::DeclareTimer FTM_VFILE_WAIT("VFile Wait"); +static LLTrace::BlockTimerStatHandle FTM_VFILE_WAIT("VFile Wait"); //---------------------------------------------------------------------------- LLVFSThread* LLVFile::sVFSThread = NULL; @@ -72,7 +73,7 @@ LLVFile::~LLVFile() { if (!(mMode & LLVFile::WRITE)) { - //llwarns << "Destroying LLVFile with pending async read/write, aborting..." << llendl; + //LL_WARNS() << "Destroying LLVFile with pending async read/write, aborting..." << LL_ENDL; sVFSThread->setFlags(mHandle, LLVFSThread::FLAG_AUTO_COMPLETE | LLVFSThread::FLAG_ABORT); } else // WRITE @@ -88,13 +89,13 @@ BOOL LLVFile::read(U8 *buffer, S32 bytes, BOOL async, F32 priority) { if (! (mMode & READ)) { - llwarns << "Attempt to read from file " << mFileID << " opened with mode " << std::hex << mMode << std::dec << llendl; + LL_WARNS() << "Attempt to read from file " << mFileID << " opened with mode " << std::hex << mMode << std::dec << LL_ENDL; return FALSE; } if (mHandle != LLVFSThread::nullHandle()) { - llwarns << "Attempt to read from vfile object " << mFileID << " with pending async operation" << llendl; + LL_WARNS() << "Attempt to read from vfile object " << mFileID << " with pending async operation" << LL_ENDL; return FALSE; } mPriority = priority; @@ -135,13 +136,13 @@ U8* LLVFile::readFile(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, S data = NULL; } else - { - data = (U8*) ll_aligned_malloc_16(file_size); + { + data = (U8*) ll_aligned_malloc<16>(file_size); file.read(data, file_size); /* Flawfinder: ignore */ if (file.getLastBytesRead() != (S32)file_size) { - ll_aligned_free(data); + ll_aligned_free<16>(data); data = NULL; file_size = 0; } @@ -198,11 +199,11 @@ BOOL LLVFile::write(const U8 *buffer, S32 bytes) { if (! (mMode & WRITE)) { - llwarns << "Attempt to write to file " << mFileID << " opened with mode " << std::hex << mMode << std::dec << llendl; + LL_WARNS() << "Attempt to write to file " << mFileID << " opened with mode " << std::hex << mMode << std::dec << LL_ENDL; } if (mHandle != LLVFSThread::nullHandle()) { - llerrs << "Attempt to write to vfile object " << mFileID << " with pending async operation" << llendl; + LL_ERRS() << "Attempt to write to vfile object " << mFileID << " with pending async operation" << LL_ENDL; return FALSE; } BOOL success = TRUE; @@ -232,7 +233,7 @@ BOOL LLVFile::write(const U8 *buffer, S32 bytes) if (wrote < bytes) { - llwarns << "Tried to write " << bytes << " bytes, actually wrote " << wrote << llendl; + LL_WARNS() << "Tried to write " << bytes << " bytes, actually wrote " << wrote << LL_ENDL; success = FALSE; } @@ -252,7 +253,7 @@ BOOL LLVFile::seek(S32 offset, S32 origin) { if (mMode == APPEND) { - llwarns << "Attempt to seek on append-only file" << llendl; + LL_WARNS() << "Attempt to seek on append-only file" << LL_ENDL; return FALSE; } @@ -267,14 +268,14 @@ BOOL LLVFile::seek(S32 offset, S32 origin) if (new_pos > size) { - llwarns << "Attempt to seek past end of file" << llendl; + LL_WARNS() << "Attempt to seek past end of file" << LL_ENDL; mPosition = size; return FALSE; } else if (new_pos < 0) { - llwarns << "Attempt to seek past beginning of file" << llendl; + LL_WARNS() << "Attempt to seek past beginning of file" << LL_ENDL; mPosition = 0; return FALSE; @@ -308,20 +309,20 @@ BOOL LLVFile::setMaxSize(S32 size) { if (! (mMode & WRITE)) { - llwarns << "Attempt to change size of file " << mFileID << " opened with mode " << std::hex << mMode << std::dec << llendl; + LL_WARNS() << "Attempt to change size of file " << mFileID << " opened with mode " << std::hex << mMode << std::dec << LL_ENDL; return FALSE; } if (!mVFS->checkAvailable(size)) { - //LLFastTimer t(FTM_VFILE_WAIT); + //LL_RECORD_BLOCK_TIME(FTM_VFILE_WAIT); S32 count = 0; while (sVFSThread->getPending() > 1000) { if (count % 100 == 0) { - llinfos << "VFS catching up... Pending: " << sVFSThread->getPending() << llendl; + LL_INFOS() << "VFS catching up... Pending: " << sVFSThread->getPending() << LL_ENDL; } if (sVFSThread->isPaused()) { @@ -337,14 +338,14 @@ BOOL LLVFile::rename(const LLUUID &new_id, const LLAssetType::EType new_type) { if (! (mMode & WRITE)) { - llwarns << "Attempt to rename file " << mFileID << " opened with mode " << std::hex << mMode << std::dec << llendl; + LL_WARNS() << "Attempt to rename file " << mFileID << " opened with mode " << std::hex << mMode << std::dec << LL_ENDL; return FALSE; } if (mHandle != LLVFSThread::nullHandle()) { - llwarns << "Renaming file with pending async read" << llendl; + LL_WARNS() << "Renaming file with pending async read" << LL_ENDL; } waitForLock(VFSLOCK_READ); @@ -364,18 +365,18 @@ BOOL LLVFile::rename(const LLUUID &new_id, const LLAssetType::EType new_type) BOOL LLVFile::remove() { -// llinfos << "Removing file " << mFileID << llendl; +// LL_INFOS() << "Removing file " << mFileID << LL_ENDL; if (! (mMode & WRITE)) { // Leaving paranoia warning just because this should be a very infrequent // operation. - llwarns << "Remove file " << mFileID << " opened with mode " << std::hex << mMode << std::dec << llendl; + LL_WARNS() << "Remove file " << mFileID << " opened with mode " << std::hex << mMode << std::dec << LL_ENDL; } if (mHandle != LLVFSThread::nullHandle()) { - llwarns << "Removing file with pending async read" << llendl; + LL_WARNS() << "Removing file with pending async read" << LL_ENDL; } // why not seek back to the beginning of the file too? @@ -423,7 +424,7 @@ bool LLVFile::isLocked(EVFSLock lock) void LLVFile::waitForLock(EVFSLock lock) { - //LLFastTimer t(FTM_VFILE_WAIT); + //LL_RECORD_BLOCK_TIME(FTM_VFILE_WAIT); // spin until the lock clears while (isLocked(lock)) { diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp index 7b589f5b9672fbcb866d59b17284b53d8c363d9c..1cc0e819db5e30ab75b5dede39c30aa7d33753dc 100755 --- a/indra/llvfs/llvfs.cpp +++ b/indra/llvfs/llvfs.cpp @@ -638,7 +638,7 @@ void LLVFS::presizeDataFile(const U32 size) { if (!mDataFP) { - llerrs << "LLVFS::presizeDataFile() with no data file open" << llendl; + LL_ERRS() << "LLVFS::presizeDataFile() with no data file open" << LL_ENDL; return; } @@ -653,11 +653,11 @@ void LLVFS::presizeDataFile(const U32 size) if (tmp) { - llinfos << "Pre-sized VFS data file to " << ftell(mDataFP) << " bytes" << llendl; + LL_INFOS() << "Pre-sized VFS data file to " << ftell(mDataFP) << " bytes" << LL_ENDL; } else { - llwarns << "Failed to pre-size VFS data file" << llendl; + LL_WARNS() << "Failed to pre-size VFS data file" << LL_ENDL; } } @@ -667,7 +667,7 @@ BOOL LLVFS::getExists(const LLUUID &file_id, const LLAssetType::EType file_type) if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } lockData(); @@ -693,7 +693,7 @@ S32 LLVFS::getSize(const LLUUID &file_id, const LLAssetType::EType file_type) if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } @@ -720,7 +720,7 @@ S32 LLVFS::getMaxSize(const LLUUID &file_id, const LLAssetType::EType file_type if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } lockData(); @@ -756,15 +756,15 @@ BOOL LLVFS::setMaxSize(const LLUUID &file_id, const LLAssetType::EType file_type { if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } if (mReadOnly) { - llerrs << "Attempt to write to read-only VFS" << llendl; + LL_ERRS() << "Attempt to write to read-only VFS" << LL_ENDL; } if (max_size <= 0) { - llwarns << "VFS: Attempt to assign size " << max_size << " to vfile " << file_id << llendl; + LL_WARNS() << "VFS: Attempt to assign size " << max_size << " to vfile " << file_id << LL_ENDL; return FALSE; } @@ -811,7 +811,7 @@ BOOL LLVFS::setMaxSize(const LLUUID &file_id, const LLAssetType::EType file_type if (block->mLength < block->mSize) { // JC: Was a warning, but Ian says it's bad. - llerrs << "Truncating virtual file " << file_id << " to " << block->mLength << " bytes" << llendl; + LL_ERRS() << "Truncating virtual file " << file_id << " to " << block->mLength << " bytes" << LL_ENDL; block->mSize = block->mLength; } @@ -879,10 +879,10 @@ BOOL LLVFS::setMaxSize(const LLUUID &file_id, const LLAssetType::EType file_type fseek(mDataFP, new_data_location, SEEK_SET); if (fwrite(&buffer[0], block->mSize, 1, mDataFP) != 1) { - llwarns << "Short write" << llendl; + LL_WARNS() << "Short write" << LL_ENDL; } } else { - llwarns << "Short read" << llendl; + LL_WARNS() << "Short read" << LL_ENDL; } } } @@ -899,7 +899,7 @@ BOOL LLVFS::setMaxSize(const LLUUID &file_id, const LLAssetType::EType file_type } else { - llwarns << "VFS: No space (" << max_size << ") to resize existing vfile " << file_id << llendl; + LL_WARNS() << "VFS: No space (" << max_size << ") to resize existing vfile " << file_id << LL_ENDL; //dumpMap(); unlockData(); dumpStatistics(); @@ -935,7 +935,7 @@ BOOL LLVFS::setMaxSize(const LLUUID &file_id, const LLAssetType::EType file_type } else { - llwarns << "VFS: No space (" << max_size << ") for new virtual file " << file_id << llendl; + LL_WARNS() << "VFS: No space (" << max_size << ") for new virtual file " << file_id << LL_ENDL; //dumpMap(); unlockData(); dumpStatistics(); @@ -954,11 +954,11 @@ void LLVFS::renameFile(const LLUUID &file_id, const LLAssetType::EType file_type { if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } if (mReadOnly) { - llerrs << "Attempt to write to read-only VFS" << llendl; + LL_ERRS() << "Attempt to write to read-only VFS" << LL_ENDL; } lockData(); @@ -990,7 +990,7 @@ void LLVFS::renameFile(const LLUUID &file_id, const LLAssetType::EType file_type { if(dest_block->mLocks[i]) { - llerrs << "Renaming VFS block to a locked file." << llendl; + LL_ERRS() << "Renaming VFS block to a locked file." << LL_ENDL; } dest_block->mLocks[i] = src_block->mLocks[i]; } @@ -1010,7 +1010,7 @@ void LLVFS::renameFile(const LLUUID &file_id, const LLAssetType::EType file_type } else { - llwarns << "VFS: Attempt to rename nonexistent vfile " << file_id << ":" << file_type << llendl; + LL_WARNS() << "VFS: Attempt to rename nonexistent vfile " << file_id << ":" << file_type << LL_ENDL; } unlockData(); } @@ -1042,11 +1042,11 @@ void LLVFS::removeFile(const LLUUID &file_id, const LLAssetType::EType file_type { if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } if (mReadOnly) { - llerrs << "Attempt to write to read-only VFS" << llendl; + LL_ERRS() << "Attempt to write to read-only VFS" << LL_ENDL; } lockData(); @@ -1060,7 +1060,7 @@ void LLVFS::removeFile(const LLUUID &file_id, const LLAssetType::EType file_type } else { - llwarns << "VFS: attempting to remove nonexistent file " << file_id << " type " << file_type << llendl; + LL_WARNS() << "VFS: attempting to remove nonexistent file " << file_id << " type " << file_type << LL_ENDL; } unlockData(); @@ -1073,7 +1073,7 @@ S32 LLVFS::getData(const LLUUID &file_id, const LLAssetType::EType file_type, U8 if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } llassert(location >= 0); llassert(length >= 0); @@ -1092,7 +1092,7 @@ S32 LLVFS::getData(const LLUUID &file_id, const LLAssetType::EType file_type, U8 if (location > block->mSize) { - llwarns << "VFS: Attempt to read location " << location << " in file " << file_id << " of length " << block->mSize << llendl; + LL_WARNS() << "VFS: Attempt to read location " << location << " in file " << file_id << " of length " << block->mSize << LL_ENDL; } else { @@ -1120,11 +1120,11 @@ S32 LLVFS::storeData(const LLUUID &file_id, const LLAssetType::EType file_type, { if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } if (mReadOnly) { - llerrs << "Attempt to write to read-only VFS" << llendl; + LL_ERRS() << "Attempt to write to read-only VFS" << LL_ENDL; } llassert(length > 0); @@ -1149,22 +1149,22 @@ S32 LLVFS::storeData(const LLUUID &file_id, const LLAssetType::EType file_type, if (block->mLength == BLOCK_LENGTH_INVALID) { // Block was removed, ignore write - llwarns << "VFS: Attempt to write to invalid block" + LL_WARNS() << "VFS: Attempt to write to invalid block" << " in file " << file_id << " location: " << in_loc << " bytes: " << length - << llendl; + << LL_ENDL; unlockData(); return length; } else if (location > block->mLength) { - llwarns << "VFS: Attempt to write to location " << location + LL_WARNS() << "VFS: Attempt to write to location " << location << " in file " << file_id << " type " << S32(file_type) << " of size " << block->mSize << " block length " << block->mLength - << llendl; + << LL_ENDL; unlockData(); return length; } @@ -1172,7 +1172,7 @@ S32 LLVFS::storeData(const LLUUID &file_id, const LLAssetType::EType file_type, { if (length > block->mLength - location ) { - llwarns << "VFS: Truncating write to virtual file " << file_id << " type " << S32(file_type) << llendl; + LL_WARNS() << "VFS: Truncating write to virtual file " << file_id << " type " << S32(file_type) << LL_ENDL; length = block->mLength - location; } U32 file_location = location + block->mLocation; @@ -1181,7 +1181,7 @@ S32 LLVFS::storeData(const LLUUID &file_id, const LLAssetType::EType file_type, S32 write_len = (S32)fwrite(buffer, 1, length, mDataFP); if (write_len != length) { - llwarns << llformat("VFS Write Error: %d != %d",write_len,length) << llendl; + LL_WARNS() << llformat("VFS Write Error: %d != %d",write_len,length) << LL_ENDL; } // fflush(mDataFP); @@ -1244,7 +1244,7 @@ void LLVFS::decLock(const LLUUID &file_id, const LLAssetType::EType file_type, E } else { - llwarns << "VFS: Decrementing zero-value lock " << lock << llendl; + LL_WARNS() << "VFS: Decrementing zero-value lock " << lock << LL_ENDL; } mLockCounts[lock]--; } @@ -1296,7 +1296,7 @@ void LLVFS::eraseBlockLength(LLVFSBlock *block) } if(!found_block) { - llerrs << "eraseBlock could not find block" << llendl; + LL_ERRS() << "eraseBlock could not find block" << LL_ENDL; } } @@ -1319,7 +1319,7 @@ void LLVFS::addFreeBlock(LLVFSBlock *block) size_t dbgcount = mFreeBlocksByLocation.count(block->mLocation); if(dbgcount > 0) { - llerrs << "addFreeBlock called with block already in list" << llendl; + LL_ERRS() << "addFreeBlock called with block already in list" << LL_ENDL; } #endif @@ -1348,7 +1348,7 @@ void LLVFS::addFreeBlock(LLVFSBlock *block) if (merge_prev && merge_next) { - // llinfos << "VFS merge BOTH" << llendl; + // LL_INFOS() << "VFS merge BOTH" << LL_ENDL; // Previous block is changing length (a lot), so only need to update length map. // Next block is going away completely. JC eraseBlockLength(prev_block); @@ -1362,7 +1362,7 @@ void LLVFS::addFreeBlock(LLVFSBlock *block) } else if (merge_prev) { - // llinfos << "VFS merge previous" << llendl; + // LL_INFOS() << "VFS merge previous" << LL_ENDL; // Previous block is maintaining location, only changing length, // therefore only need to update the length map. JC eraseBlockLength(prev_block); @@ -1373,7 +1373,7 @@ void LLVFS::addFreeBlock(LLVFSBlock *block) } else if (merge_next) { - // llinfos << "VFS merge next" << llendl; + // LL_INFOS() << "VFS merge next" << LL_ENDL; // Next block is changing both location and length, // so both free lists must update. JC eraseBlock(next_block); @@ -1400,7 +1400,7 @@ void LLVFS::addFreeBlock(LLVFSBlock *block) //{ // if (!isValid()) // { -// llerrs << "Attempting to use invalid VFS!" << llendl; +// LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; // } // // TODO: could we optimize this with hints from the calling code? // blocks_location_map_t::iterator iter = mFreeBlocksByLocation.begin(); @@ -1459,11 +1459,11 @@ void LLVFS::sync(LLVFSFileBlock *block, BOOL remove) { if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } if (mReadOnly) { - llwarns << "Attempt to sync read-only VFS" << llendl; + LL_WARNS() << "Attempt to sync read-only VFS" << LL_ENDL; return; } if (block->mLength == BLOCK_LENGTH_INVALID) @@ -1473,7 +1473,7 @@ void LLVFS::sync(LLVFSFileBlock *block, BOOL remove) } if (block->mLength == 0) { - llerrs << "VFS syncing zero-length block" << llendl; + LL_ERRS() << "VFS syncing zero-length block" << LL_ENDL; } BOOL set_index_to_end = FALSE; @@ -1525,7 +1525,7 @@ void LLVFS::sync(LLVFSFileBlock *block, BOOL remove) if (fwrite(buffer, LLVFSFileBlock::SERIAL_SIZE, 1, mIndexFP) != 1) { - llwarns << "Short write" << llendl; + LL_WARNS() << "Short write" << LL_ENDL; } // *NOTE: Why was this commented out? @@ -1541,7 +1541,7 @@ LLVFSBlock *LLVFS::findFreeBlock(S32 size, LLVFSFileBlock *immune) { if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } LLVFSBlock *block = NULL; @@ -1586,7 +1586,7 @@ LLVFSBlock *LLVFS::findFreeBlock(S32 size, LLVFSFileBlock *immune) if (lru_list.size() == 0) { // No more files to delete, and still not enough room! - llwarns << "VFS: Can't make " << size << " bytes of free space in VFS, giving up" << llendl; + LL_WARNS() << "VFS: Can't make " << size << " bytes of free space in VFS, giving up" << LL_ENDL; break; } @@ -1597,7 +1597,7 @@ LLVFSBlock *LLVFS::findFreeBlock(S32 size, LLVFSFileBlock *immune) { // ditch this file and look again for a free block - should find it // TODO: it'll be faster just to assign the free block and break - llinfos << "LRU: Removing " << file_block->mFileID << ":" << file_block->mFileType << llendl; + LL_INFOS() << "LRU: Removing " << file_block->mFileID << ":" << file_block->mFileType << LL_ENDL; lru_list.erase(it); removeFileBlock(file_block); file_block = NULL; @@ -1605,7 +1605,7 @@ LLVFSBlock *LLVFS::findFreeBlock(S32 size, LLVFSFileBlock *immune) } - llinfos << "VFS: LRU: Aggressive: " << (S32)lru_list.size() << " files remain" << llendl; + LL_INFOS() << "VFS: LRU: Aggressive: " << (S32)lru_list.size() << " files remain" << LL_ENDL; dumpLockCounts(); // Now it's time to aggressively make more space @@ -1620,7 +1620,7 @@ LLVFSBlock *LLVFS::findFreeBlock(S32 size, LLVFSFileBlock *immune) file_block = *it; // TODO: it would be great to be able to batch all these sync() calls - // llinfos << "LRU2: Removing " << file_block->mFileID << ":" << file_block->mFileType << " last accessed" << file_block->mAccessTime << llendl; + // LL_INFOS() << "LRU2: Removing " << file_block->mFileID << ":" << file_block->mFileType << " last accessed" << file_block->mAccessTime << LL_ENDL; cleaned_up += file_block->mLength; lru_list.erase(it++); @@ -1634,7 +1634,7 @@ LLVFSBlock *LLVFS::findFreeBlock(S32 size, LLVFSFileBlock *immune) F32 time = timer.getElapsedTimeF32(); if (time > 0.5f) { - llwarns << "VFS: Spent " << time << " seconds in findFreeBlock!" << llendl; + LL_WARNS() << "VFS: Spent " << time << " seconds in findFreeBlock!" << LL_ENDL; } return block; @@ -1648,7 +1648,7 @@ void LLVFS::pokeFiles() { if (!isValid()) { - llerrs << "Attempting to use invalid VFS!" << llendl; + LL_ERRS() << "Attempting to use invalid VFS!" << LL_ENDL; } U32 word; @@ -1660,7 +1660,7 @@ void LLVFS::pokeFiles() fseek(mDataFP, 0, SEEK_SET); if (fwrite(&word, sizeof(word), 1, mDataFP) != 1) { - llwarns << "Could not write to data file" << llendl; + LL_WARNS() << "Could not write to data file" << LL_ENDL; } fflush(mDataFP); } @@ -1671,7 +1671,7 @@ void LLVFS::pokeFiles() fseek(mIndexFP, 0, SEEK_SET); if (fwrite(&word, sizeof(word), 1, mIndexFP) != 1) { - llwarns << "Could not write to index file" << llendl; + LL_WARNS() << "Could not write to index file" << LL_ENDL; } fflush(mIndexFP); } @@ -1680,20 +1680,20 @@ void LLVFS::pokeFiles() void LLVFS::dumpMap() { - llinfos << "Files:" << llendl; + LL_INFOS() << "Files:" << LL_ENDL; for (fileblock_map::iterator it = mFileBlocks.begin(); it != mFileBlocks.end(); ++it) { LLVFSFileBlock *file_block = (*it).second; - llinfos << "Location: " << file_block->mLocation << "\tLength: " << file_block->mLength << "\t" << file_block->mFileID << "\t" << file_block->mFileType << llendl; + LL_INFOS() << "Location: " << file_block->mLocation << "\tLength: " << file_block->mLength << "\t" << file_block->mFileID << "\t" << file_block->mFileType << LL_ENDL; } - llinfos << "Free Blocks:" << llendl; + LL_INFOS() << "Free Blocks:" << LL_ENDL; for (blocks_location_map_t::iterator iter = mFreeBlocksByLocation.begin(), end = mFreeBlocksByLocation.end(); iter != end; iter++) { LLVFSBlock *free_block = iter->second; - llinfos << "Location: " << free_block->mLocation << "\tLength: " << free_block->mLength << llendl; + LL_INFOS() << "Location: " << free_block->mLocation << "\tLength: " << free_block->mLength << LL_ENDL; } } @@ -1717,7 +1717,7 @@ void LLVFS::audit() if (fread(&buffer[0], 1, index_size, mIndexFP) != index_size) { - llwarns << "Index truncated" << llendl; + LL_WARNS() << "Index truncated" << LL_ENDL; vfs_corrupt = TRUE; } @@ -1746,7 +1746,7 @@ void LLVFS::audit() { if (mFileBlocks.find(*block) == mFileBlocks.end()) { - llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " on disk, not in memory, loc " << block->mIndexLocation << llendl; + LL_WARNS() << "VFile " << block->mFileID << ":" << block->mFileType << " on disk, not in memory, loc " << block->mIndexLocation << LL_ENDL; } else if (found_files.find(*block) != found_files.end()) { @@ -1758,22 +1758,22 @@ void LLVFS::audit() mIndexFP = NULL; unlockAndClose(mDataFP); mDataFP = NULL; - llwarns << "VFS: Original block index " << block->mIndexLocation + LL_WARNS() << "VFS: Original block index " << block->mIndexLocation << " location " << block->mLocation << " length " << block->mLength << " size " << block->mSize << " id " << block->mFileID << " type " << block->mFileType - << llendl; - llwarns << "VFS: Duplicate block index " << dupe->mIndexLocation + << LL_ENDL; + LL_WARNS() << "VFS: Duplicate block index " << dupe->mIndexLocation << " location " << dupe->mLocation << " length " << dupe->mLength << " size " << dupe->mSize << " id " << dupe->mFileID << " type " << dupe->mFileType - << llendl; - llwarns << "VFS: Index size " << index_size << llendl; - llwarns << "VFS: INDEX CORRUPT" << llendl; + << LL_ENDL; + LL_WARNS() << "VFS: Index size " << index_size << LL_ENDL; + LL_WARNS() << "VFS: INDEX CORRUPT" << LL_ENDL; vfs_corrupt = TRUE; break; } @@ -1786,7 +1786,7 @@ void LLVFS::audit() { if (block->mLength) { - llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " corrupt on disk" << llendl; + LL_WARNS() << "VFile " << block->mFileID << ":" << block->mFileType << " corrupt on disk" << LL_ENDL; } // else this is just a hole } @@ -1802,19 +1802,19 @@ void LLVFS::audit() { if (! found_files.count(*block)) { - llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " in memory, not on disk, loc " << block->mIndexLocation<< llendl; + LL_WARNS() << "VFile " << block->mFileID << ":" << block->mFileType << " in memory, not on disk, loc " << block->mIndexLocation<< LL_ENDL; fseek(mIndexFP, block->mIndexLocation, SEEK_SET); U8 buf[LLVFSFileBlock::SERIAL_SIZE]; if (fread(buf, LLVFSFileBlock::SERIAL_SIZE, 1, mIndexFP) != 1) { - llwarns << "VFile " << block->mFileID - << " gave short read" << llendl; + LL_WARNS() << "VFile " << block->mFileID + << " gave short read" << LL_ENDL; } LLVFSFileBlock disk_block; disk_block.deserialize(buf, block->mIndexLocation); - llwarns << "Instead found " << disk_block.mFileID << ":" << block->mFileType << llendl; + LL_WARNS() << "Instead found " << disk_block.mFileID << ":" << block->mFileType << LL_ENDL; } else { @@ -1828,10 +1828,10 @@ void LLVFS::audit() iter != found_files.end(); iter++) { LLVFSFileBlock* block = iter->second; - llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " szie:" << block->mSize << " leftover" << llendl; + LL_WARNS() << "VFile " << block->mFileID << ":" << block->mFileType << " szie:" << block->mSize << " leftover" << LL_ENDL; } - llinfos << "VFS: audit OK" << llendl; + LL_INFOS() << "VFS: audit OK" << LL_ENDL; // mutex released by LLMutexLock() destructor. } @@ -1859,12 +1859,12 @@ void LLVFS::checkMem() S32 index_loc = *iter; if (index_loc == block->mIndexLocation) { - llwarns << "VFile block " << block->mFileID << ":" << block->mFileType << " is marked as a hole" << llendl; + LL_WARNS() << "VFile block " << block->mFileID << ":" << block->mFileType << " is marked as a hole" << LL_ENDL; } } } - llinfos << "VFS: mem check OK" << llendl; + LL_INFOS() << "VFS: mem check OK" << LL_ENDL; unlockData(); } @@ -1874,7 +1874,7 @@ void LLVFS::dumpLockCounts() S32 i; for (i = 0; i < VFSLOCK_COUNT; i++) { - llinfos << "LockType: " << i << ": " << mLockCounts[i] << llendl; + LL_INFOS() << "LockType: " << i << ": " << mLockCounts[i] << LL_ENDL; } } @@ -1899,7 +1899,7 @@ void LLVFS::dumpStatistics() } else if (file_block->mLength <= 0) { - llinfos << "Bad file block at: " << file_block->mLocation << "\tLength: " << file_block->mLength << "\t" << file_block->mFileID << "\t" << file_block->mFileType << llendl; + LL_INFOS() << "Bad file block at: " << file_block->mLocation << "\tLength: " << file_block->mLength << "\t" << file_block->mFileID << "\t" << file_block->mFileType << LL_ENDL; size_counts[file_block->mLength]++; location_counts[file_block->mLocation]++; } @@ -1921,13 +1921,13 @@ void LLVFS::dumpStatistics() { S32 size = it->first; S32 size_count = it->second; - llinfos << "Bad files size " << size << " count " << size_count << llendl; + LL_INFOS() << "Bad files size " << size << " count " << size_count << LL_ENDL; } for (std::map<U32,S32>::iterator it = location_counts.begin(); it != location_counts.end(); ++it) { U32 location = it->first; S32 location_count = it->second; - llinfos << "Bad files location " << location << " count " << location_count << llendl; + LL_INFOS() << "Bad files location " << location << " count " << location_count << LL_ENDL; } // Investigate free list. @@ -1941,14 +1941,14 @@ void LLVFS::dumpStatistics() LLVFSBlock *free_block = iter->second; if (free_block->mLength <= 0) { - llinfos << "Bad free block at: " << free_block->mLocation << "\tLength: " << free_block->mLength << llendl; + LL_INFOS() << "Bad free block at: " << free_block->mLocation << "\tLength: " << free_block->mLength << LL_ENDL; } else { - llinfos << "Block: " << free_block->mLocation + LL_INFOS() << "Block: " << free_block->mLocation << "\tLength: " << free_block->mLength << "\tEnd: " << free_block->mLocation + free_block->mLength - << llendl; + << LL_ENDL; total_free_size += free_block->mLength; } @@ -1963,38 +1963,38 @@ void LLVFS::dumpStatistics() // Dump histogram of free block sizes for (std::map<S32,S32>::iterator it = free_length_counts.begin(); it != free_length_counts.end(); ++it) { - llinfos << "Free length " << it->first << " count " << it->second << llendl; + LL_INFOS() << "Free length " << it->first << " count " << it->second << LL_ENDL; } - llinfos << "Invalid blocks: " << invalid_file_count << llendl; - llinfos << "File blocks: " << mFileBlocks.size() << llendl; + LL_INFOS() << "Invalid blocks: " << invalid_file_count << LL_ENDL; + LL_INFOS() << "File blocks: " << mFileBlocks.size() << LL_ENDL; S32 length_list_count = (S32)mFreeBlocksByLength.size(); S32 location_list_count = (S32)mFreeBlocksByLocation.size(); if (length_list_count == location_list_count) { - llinfos << "Free list lengths match, free blocks: " << location_list_count << llendl; + LL_INFOS() << "Free list lengths match, free blocks: " << location_list_count << LL_ENDL; } else { - llwarns << "Free list lengths do not match!" << llendl; - llwarns << "By length: " << length_list_count << llendl; - llwarns << "By location: " << location_list_count << llendl; + LL_WARNS() << "Free list lengths do not match!" << LL_ENDL; + LL_WARNS() << "By length: " << length_list_count << LL_ENDL; + LL_WARNS() << "By location: " << location_list_count << LL_ENDL; } - llinfos << "Max file: " << max_file_size/1024 << "K" << llendl; - llinfos << "Max free: " << max_free_size/1024 << "K" << llendl; - llinfos << "Total file size: " << total_file_size/1024 << "K" << llendl; - llinfos << "Total free size: " << total_free_size/1024 << "K" << llendl; - llinfos << "Sum: " << (total_file_size + total_free_size) << " bytes" << llendl; - llinfos << llformat("%.0f%% full",((F32)(total_file_size)/(F32)(total_file_size+total_free_size))*100.f) << llendl; + LL_INFOS() << "Max file: " << max_file_size/1024 << "K" << LL_ENDL; + LL_INFOS() << "Max free: " << max_free_size/1024 << "K" << LL_ENDL; + LL_INFOS() << "Total file size: " << total_file_size/1024 << "K" << LL_ENDL; + LL_INFOS() << "Total free size: " << total_free_size/1024 << "K" << LL_ENDL; + LL_INFOS() << "Sum: " << (total_file_size + total_free_size) << " bytes" << LL_ENDL; + LL_INFOS() << llformat("%.0f%% full",((F32)(total_file_size)/(F32)(total_file_size+total_free_size))*100.f) << LL_ENDL; - llinfos << " " << llendl; + LL_INFOS() << " " << LL_ENDL; for (std::map<LLAssetType::EType, std::pair<S32,S32> >::iterator iter = filetype_counts.begin(); iter != filetype_counts.end(); ++iter) { - llinfos << "Type: " << LLAssetType::getDesc(iter->first) + LL_INFOS() << "Type: " << LLAssetType::getDesc(iter->first) << " Count: " << iter->second.first - << " Bytes: " << (iter->second.second>>20) << " MB" << llendl; + << " Bytes: " << (iter->second.second>>20) << " MB" << LL_ENDL; } // Look for potential merges @@ -2009,7 +2009,7 @@ void LLVFS::dumpStatistics() LLVFSBlock *second_block = iter->second; if (first_block->mLocation + first_block->mLength == second_block->mLocation) { - llinfos << "Potential merge at " << first_block->mLocation << llendl; + LL_INFOS() << "Potential merge at " << first_block->mLocation << LL_ENDL; } first_block = second_block; } @@ -2064,10 +2064,10 @@ void LLVFS::listFiles() { LLUUID id = file_spec.mFileID; std::string extension = get_extension(file_spec.mFileType); - llinfos << " File: " << id + LL_INFOS() << " File: " << id << " Type: " << LLAssetType::getDesc(file_spec.mFileType) << " Size: " << size - << llendl; + << LL_ENDL; } } @@ -2098,7 +2098,7 @@ void LLVFS::dumpFiles() std::string extension = get_extension(type); std::string filename = id.asString() + extension; - llinfos << " Writing " << filename << llendl; + LL_INFOS() << " Writing " << filename << LL_ENDL; LLAPRFile outfile; outfile.open(filename, LL_APR_WB); @@ -2111,7 +2111,7 @@ void LLVFS::dumpFiles() unlockData(); - llinfos << "Extracted " << files_extracted << " files out of " << mFileBlocks.size() << llendl; + LL_INFOS() << "Extracted " << files_extracted << " files out of " << mFileBlocks.size() << LL_ENDL; } //============================================================================ diff --git a/indra/llvfs/llvfs.h b/indra/llvfs/llvfs.h index 63f0f289334f1d2f57f1662b90c5ae650cbe5fad..39f31a221b9143c19fe529aa9433d04640b8cd53 100755 --- a/indra/llvfs/llvfs.h +++ b/indra/llvfs/llvfs.h @@ -29,7 +29,6 @@ #include <deque> #include "lluuid.h" -#include "linked_lists.h" #include "llassettype.h" #include "llthread.h" diff --git a/indra/llvfs/llvfsthread.cpp b/indra/llvfs/llvfsthread.cpp index a57e2b15abc68f42ee607b48776abbf08fcca717..8cd85929e2aa8cec6b2e4fa3bdc68a958f34368b 100755 --- a/indra/llvfs/llvfsthread.cpp +++ b/indra/llvfs/llvfsthread.cpp @@ -88,7 +88,7 @@ LLVFSThread::handle_t LLVFSThread::read(LLVFS* vfs, const LLUUID &file_id, const bool res = addRequest(req); if (!res) { - llerrs << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << llendl; + LL_ERRS() << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << LL_ENDL; req->deleteRequest(); handle = nullHandle(); } @@ -107,7 +107,7 @@ S32 LLVFSThread::readImmediate(LLVFS* vfs, const LLUUID &file_id, const LLAssetT S32 res = addRequest(req) ? 1 : 0; if (res == 0) { - llerrs << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << llendl; + LL_ERRS() << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << LL_ENDL; req->deleteRequest(); } else @@ -130,7 +130,7 @@ LLVFSThread::handle_t LLVFSThread::write(LLVFS* vfs, const LLUUID &file_id, cons bool res = addRequest(req); if (!res) { - llerrs << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << llendl; + LL_ERRS() << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << LL_ENDL; req->deleteRequest(); handle = nullHandle(); } @@ -149,7 +149,7 @@ S32 LLVFSThread::writeImmediate(LLVFS* vfs, const LLUUID &file_id, const LLAsset S32 res = addRequest(req) ? 1 : 0; if (res == 0) { - llerrs << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << llendl; + LL_ERRS() << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << LL_ENDL; req->deleteRequest(); } else @@ -175,7 +175,7 @@ S32 LLVFSThread::writeImmediate(LLVFS* vfs, const LLUUID &file_id, const LLAsset // bool res = addRequest(req); // if (!res) // { -// llerrs << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << llendl; +// LL_ERRS() << "LLVFSThread::read called after LLVFSThread::cleanupClass()" << LL_ENDL; // req->deleteRequest(); // handle = nullHandle(); // } @@ -203,17 +203,17 @@ LLVFSThread::Request::Request(handle_t handle, U32 priority, U32 flags, if (numbytes <= 0 && mOperation != FILE_RENAME) { - llwarns << "LLVFSThread: Request with numbytes = " << numbytes + LL_WARNS() << "LLVFSThread: Request with numbytes = " << numbytes << " operation = " << op << " offset " << offset - << " file_type " << file_type << llendl; + << " file_type " << file_type << LL_ENDL; } if (mOperation == FILE_WRITE) { S32 blocksize = mVFS->getMaxSize(mFileID, mFileType); if (blocksize < 0) { - llwarns << "VFS write to temporary block (shouldn't happen)" << llendl; + LL_WARNS() << "VFS write to temporary block (shouldn't happen)" << LL_ENDL; } mVFS->incLock(mFileID, mFileType, VFSLOCK_APPEND); } @@ -248,7 +248,7 @@ void LLVFSThread::Request::deleteRequest() { if (getStatus() == STATUS_QUEUED) { - llerrs << "Attempt to delete a queued LLVFSThread::Request!" << llendl; + LL_ERRS() << "Attempt to delete a queued LLVFSThread::Request!" << LL_ENDL; } if (mOperation == FILE_WRITE) { @@ -273,13 +273,13 @@ bool LLVFSThread::Request::processRequest() llassert(mOffset >= 0); mBytesRead = mVFS->getData(mFileID, mFileType, mBuffer, mOffset, mBytes); complete = true; - //llinfos << llformat("LLVFSThread::READ '%s': %d bytes arg:%d",getFilename(),mBytesRead) << llendl; + //LL_INFOS() << llformat("LLVFSThread::READ '%s': %d bytes arg:%d",getFilename(),mBytesRead) << LL_ENDL; } else if (mOperation == FILE_WRITE) { mBytesRead = mVFS->storeData(mFileID, mFileType, mBuffer, mOffset, mBytes); complete = true; - //llinfos << llformat("LLVFSThread::WRITE '%s': %d bytes arg:%d",getFilename(),mBytesRead) << llendl; + //LL_INFOS() << llformat("LLVFSThread::WRITE '%s': %d bytes arg:%d",getFilename(),mBytesRead) << LL_ENDL; } else if (mOperation == FILE_RENAME) { @@ -288,11 +288,11 @@ bool LLVFSThread::Request::processRequest() mVFS->renameFile(mFileID, mFileType, *new_idp, new_type); mFileID = *new_idp; complete = true; - //llinfos << llformat("LLVFSThread::RENAME '%s': %d bytes arg:%d",getFilename(),mBytesRead) << llendl; + //LL_INFOS() << llformat("LLVFSThread::RENAME '%s': %d bytes arg:%d",getFilename(),mBytesRead) << LL_ENDL; } else { - llerrs << llformat("LLVFSThread::unknown operation: %d", mOperation) << llendl; + LL_ERRS() << llformat("LLVFSThread::unknown operation: %d", mOperation) << LL_ENDL; } return complete; } diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index aec6d7af4a58c89829ef7c26f402944b4f8491ef..0743fd899f2795e5a07dea6c10a5f7c432c4bc52 100755 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -38,6 +38,7 @@ include_directories(SYSTEM ) set(llwindow_SOURCE_FILES + llcursortypes.cpp llkeyboard.cpp llkeyboardheadless.cpp llwindowheadless.cpp @@ -48,6 +49,7 @@ set(llwindow_SOURCE_FILES set(llwindow_HEADER_FILES CMakeLists.txt + llcursortypes.h llkeyboard.h llkeyboardheadless.h llwindowheadless.h diff --git a/indra/llcommon/llcursortypes.cpp b/indra/llwindow/llcursortypes.cpp similarity index 100% rename from indra/llcommon/llcursortypes.cpp rename to indra/llwindow/llcursortypes.cpp diff --git a/indra/llcommon/llcursortypes.h b/indra/llwindow/llcursortypes.h similarity index 100% rename from indra/llcommon/llcursortypes.h rename to indra/llwindow/llcursortypes.h diff --git a/indra/llwindow/lldragdropwin32.cpp b/indra/llwindow/lldragdropwin32.cpp index 15acddd987682a605ce90c0e5a449ada22c26e50..d00d9ab47ea1caa2d0a8347f4fbefc13ba4ebe64 100755 --- a/indra/llwindow/lldragdropwin32.cpp +++ b/indra/llwindow/lldragdropwin32.cpp @@ -242,11 +242,11 @@ class LLDragDropWin32Target: LLCoordWindow cursor_coord_window( pt_client.x, pt_client.y ); LLCoordGL gl_coord(cursor_coord_window.convert()); - llinfos << "### (Drop) URL is: " << mDropUrl << llendl; - llinfos << "### raw coords are: " << pt.x << " x " << pt.y << llendl; - llinfos << "### client coords are: " << pt_client.x << " x " << pt_client.y << llendl; - llinfos << "### GL coords are: " << gl_coord.mX << " x " << gl_coord.mY << llendl; - llinfos << llendl; + LL_INFOS() << "### (Drop) URL is: " << mDropUrl << LL_ENDL; + LL_INFOS() << "### raw coords are: " << pt.x << " x " << pt.y << LL_ENDL; + LL_INFOS() << "### client coords are: " << pt_client.x << " x " << pt_client.y << LL_ENDL; + LL_INFOS() << "### GL coords are: " << gl_coord.mX << " x " << gl_coord.mY << LL_ENDL; + LL_INFOS() << LL_ENDL; // no keyboard modifier option yet but we could one day MASK mask = gKeyboard->currentMask( TRUE ); diff --git a/indra/llwindow/lldragdropwin32.h b/indra/llwindow/lldragdropwin32.h index a6824f3e904a5800177d99ed8279590672bb97ac..4673242cbab0769801dbcda6633027eea25509bc 100755 --- a/indra/llwindow/lldragdropwin32.h +++ b/indra/llwindow/lldragdropwin32.h @@ -31,7 +31,7 @@ #ifndef LL_LLDRAGDROP32_H #define LL_LLDRAGDROP32_H -#include <windows.h> +#include "llwin32headerslean.h" #include <ole2.h> class LLDragDropWin32 @@ -54,7 +54,7 @@ class LLDragDropWin32 #ifndef LL_LLDRAGDROP32_H #define LL_LLDRAGDROP32_H -#include <windows.h> +#include "llwin32headerslean.h" #include <ole2.h> // impostor class that does nothing diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index b0f4bc55035dfa835c798b5000eaf6439f428ece..ba5bc8fcfb33ce584e3133766c63b7101db3baf9 100755 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -120,7 +120,7 @@ BOOL LLVersion::set(const std::string &version_string) } if (count < 4) { - //llwarns << "Potentially bogus version string!" << version_string << llendl; + //LL_WARNS() << "Potentially bogus version string!" << version_string << LL_ENDL; for (i = 0; i < 4; i++) { mFields[i] = 0; @@ -160,10 +160,10 @@ std::string LLDXDriverFile::dump() gWriteDebug(mDateString.c_str()); gWriteDebug("\n"); } - llinfos << mFilepath << llendl; - llinfos << mName << llendl; - llinfos << mVersionString << llendl; - llinfos << mDateString << llendl; + LL_INFOS() << mFilepath << LL_ENDL; + LL_INFOS() << mName << LL_ENDL; + LL_INFOS() << mVersionString << LL_ENDL; + LL_INFOS() << mDateString << LL_ENDL; return ""; } @@ -186,11 +186,11 @@ std::string LLDXDevice::dump() gWriteDebug(mPCIString.c_str()); gWriteDebug("\n"); } - llinfos << llendl; - llinfos << "DeviceName:" << mName << llendl; - llinfos << "PCIString:" << mPCIString << llendl; - llinfos << "Drivers" << llendl; - llinfos << "-------" << llendl; + LL_INFOS() << LL_ENDL; + LL_INFOS() << "DeviceName:" << mName << LL_ENDL; + LL_INFOS() << "PCIString:" << mPCIString << LL_ENDL; + LL_INFOS() << "Drivers" << LL_ENDL; + LL_INFOS() << "-------" << LL_ENDL; for (driver_file_map_t::iterator iter = mDriverFiles.begin(), end = mDriverFiles.end(); iter != end; iter++) @@ -551,7 +551,7 @@ LLSD LLDXHardware::getDisplayInfo() IDxDiagContainer *driver_containerp = NULL; // CoCreate a IDxDiagProvider* - llinfos << "CoCreateInstance IID_IDxDiagProvider" << llendl; + LL_INFOS() << "CoCreateInstance IID_IDxDiagProvider" << LL_ENDL; hr = CoCreateInstance(CLSID_DxDiagProvider, NULL, CLSCTX_INPROC_SERVER, @@ -560,7 +560,7 @@ LLSD LLDXHardware::getDisplayInfo() if (FAILED(hr)) { - llwarns << "No DXDiag provider found! DirectX 9 not installed!" << llendl; + LL_WARNS() << "No DXDiag provider found! DirectX 9 not installed!" << LL_ENDL; gWriteDebug("No DXDiag provider found! DirectX 9 not installed!\n"); goto LCleanup; } @@ -578,14 +578,14 @@ LLSD LLDXHardware::getDisplayInfo() dx_diag_init_params.bAllowWHQLChecks = TRUE; dx_diag_init_params.pReserved = NULL; - llinfos << "dx_diag_providerp->Initialize" << llendl; + LL_INFOS() << "dx_diag_providerp->Initialize" << LL_ENDL; hr = dx_diag_providerp->Initialize(&dx_diag_init_params); if(FAILED(hr)) { goto LCleanup; } - llinfos << "dx_diag_providerp->GetRootContainer" << llendl; + LL_INFOS() << "dx_diag_providerp->GetRootContainer" << LL_ENDL; hr = dx_diag_providerp->GetRootContainer( &dx_diag_rootp ); if(FAILED(hr) || !dx_diag_rootp) { @@ -595,7 +595,7 @@ LLSD LLDXHardware::getDisplayInfo() HRESULT hr; // Get display driver information - llinfos << "dx_diag_rootp->GetChildContainer" << llendl; + LL_INFOS() << "dx_diag_rootp->GetChildContainer" << LL_ENDL; hr = dx_diag_rootp->GetChildContainer(L"DxDiag_DisplayDevices", &devices_containerp); if(FAILED(hr) || !devices_containerp) { @@ -603,7 +603,7 @@ LLSD LLDXHardware::getDisplayInfo() } // Get device 0 - llinfos << "devices_containerp->GetChildContainer" << llendl; + LL_INFOS() << "devices_containerp->GetChildContainer" << LL_ENDL; hr = devices_containerp->GetChildContainer(L"0", &device_containerp); if(FAILED(hr) || !device_containerp) { diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index 8b356ba1387099345db95809228b1e8f49e9e235..f6f6c3931cb16073b2c43ffb1fa9773fa2cbd404 100755 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -187,7 +187,7 @@ BOOL LLKeyboard::translateKey(const U16 os_key, KEY *out_key) iter = mTranslateKeyMap.find(os_key); if (iter == mTranslateKeyMap.end()) { - //llwarns << "Unknown virtual key " << os_key << llendl; + //LL_WARNS() << "Unknown virtual key " << os_key << LL_ENDL; *out_key = 0; return FALSE; } @@ -258,7 +258,7 @@ BOOL LLKeyboard::handleTranslatedKeyUp(KEY translated_key, U32 translated_mask) handled = mCallbacks->handleTranslatedKeyUp(translated_key, translated_mask); } - lldebugst(LLERR_USER_INPUT) << "keyup -" << translated_key << "-" << llendl; + LL_DEBUGS("UserInput") << "keyup -" << translated_key << "-" << LL_ENDL; return handled; } @@ -321,7 +321,7 @@ BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key) *key = res; return TRUE; } - llwarns << "keyFromString failed: " << str << llendl; + LL_WARNS() << "keyFromString failed: " << str << LL_ENDL; return FALSE; } @@ -363,7 +363,7 @@ std::string LLKeyboard::stringFromAccelerator( MASK accel_mask, KEY key ) if( trans == NULL ) { - llerrs << "No mKeyStringTranslator" << llendl; + LL_ERRS() << "No mKeyStringTranslator" << LL_ENDL; return res; } diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index 92449c123f58562d339cc9201ec101f33bec9de3..6f2dc87317a0ed62768475182883efd347b0c625 100755 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -28,8 +28,9 @@ #define LL_LLKEYBOARD_H #include <map> +#include <boost/function.hpp> -#include "string_table.h" +#include "llstringtable.h" #include "lltimer.h" #include "indra_constants.h" diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index be3fe5deb056426b8ce852cba1443cf9c77e42bd..dc40dcdde093f37d73c1d45a47a989abbe145913 100755 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -28,10 +28,7 @@ #include "linden_common.h" -#define WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> - +#include "llwin32headerslean.h" #include "llkeyboardwin32.h" #include "llwindowcallbacks.h" @@ -269,7 +266,7 @@ void LLKeyboardWin32::scanKeyboard() // keydown in highest bit if (!pending_key_events && !(GetAsyncKeyState(virtual_key) & 0x8000)) { - //llinfos << "Key up event missed, resetting" << llendl; + //LL_INFOS() << "Key up event missed, resetting" << LL_ENDL; mKeyLevel[key] = FALSE; } } diff --git a/indra/llwindow/llmousehandler.cpp b/indra/llwindow/llmousehandler.cpp index 8695e92f77aec822c1fe4724c6152df92c40fb20..bea66e763c21cee23b736f471aa679b935f6643c 100755 --- a/indra/llwindow/llmousehandler.cpp +++ b/indra/llwindow/llmousehandler.cpp @@ -39,7 +39,7 @@ BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType cli case CLICK_MIDDLE: handled = handleMiddleMouseDown(x, y, mask); break; case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; default: - llwarns << "Unhandled enum." << llendl; + LL_WARNS() << "Unhandled enum." << LL_ENDL; } } else @@ -51,7 +51,7 @@ BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType cli case CLICK_MIDDLE: handled = handleMiddleMouseUp(x, y, mask); break; case CLICK_DOUBLELEFT: handled = handleDoubleClick(x, y, mask); break; default: - llwarns << "Unhandled enum." << llendl; + LL_WARNS() << "Unhandled enum." << LL_ENDL; } } return handled; diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 93b9d36939002d60729f52e7a1c5ddf4b284d34f..466c3baccfb3bb7ad771b868f2104bdb5b387f0d 100755 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -39,7 +39,6 @@ #include "llerror.h" #include "llkeyboard.h" -#include "linked_lists.h" #include "llwindowcallbacks.h" @@ -73,7 +72,7 @@ S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type) S32 result = 0; #if LL_MESA_HEADLESS // !!! *FIX: (???) - llwarns << "OSMessageBox: " << text << llendl; + LL_WARNS() << "OSMessageBox: " << text << LL_ENDL; return OSBTN_OK; #elif LL_WINDOWS result = OSMessageBoxWin32(text, caption, type); @@ -423,7 +422,7 @@ LLWindow* LLWindowManager::createWindow( if (FALSE == new_window->isValid()) { delete new_window; - llwarns << "LLWindowManager::create() : Error creating window." << llendl; + LL_WARNS() << "LLWindowManager::create() : Error creating window." << LL_ENDL; return NULL; } sWindowList.insert(new_window); @@ -434,8 +433,8 @@ BOOL LLWindowManager::destroyWindow(LLWindow* window) { if (sWindowList.find(window) == sWindowList.end()) { - llerrs << "LLWindowManager::destroyWindow() : Window pointer not valid, this window doesn't exist!" - << llendl; + LL_ERRS() << "LLWindowManager::destroyWindow() : Window pointer not valid, this window doesn't exist!" + << LL_ENDL; return FALSE; } diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 50ea61463465dd11b9bbbafae5dc6ef08d238234..0a30f4c807fefa91ca85edf89ab2bfc455584aec 100755 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -31,6 +31,7 @@ #include "llcoord.h" #include "llstring.h" #include "llcursortypes.h" +#include "llinstancetracker.h" #include "llsd.h" class LLSplashScreen; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 11c0b5108692e787d5276529be7ba7cc1f13d4ea..b771e125f94e3718b8973204f9edcc372cb743f6 100755 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -785,7 +785,7 @@ BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) } else { - llerrs << "LLWindowMacOSX::getPosition(): no window and not fullscreen!" << llendl; + LL_ERRS() << "LLWindowMacOSX::getPosition(): no window and not fullscreen!" << LL_ENDL; } return (err == noErr); @@ -811,7 +811,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) } else { - llerrs << "LLWindowMacOSX::getPosition(): no window and not fullscreen!" << llendl; + LL_ERRS() << "LLWindowMacOSX::getPosition(): no window and not fullscreen!" << LL_ENDL; } return (err == noErr); @@ -837,7 +837,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) } else { - llerrs << "LLWindowMacOSX::getPosition(): no window and not fullscreen!" << llendl; + LL_ERRS() << "LLWindowMacOSX::getPosition(): no window and not fullscreen!" << LL_ENDL; } return (err == noErr); @@ -998,11 +998,11 @@ void LLWindowMacOSX::setMouseClipping( BOOL b ) if(b) { - // llinfos << "setMouseClipping(TRUE)" << llendl; + // LL_INFOS() << "setMouseClipping(TRUE)" << LL_ENDL; } else { - // llinfos << "setMouseClipping(FALSE)" << llendl; + // LL_INFOS() << "setMouseClipping(FALSE)" << LL_ENDL; } adjustCursorDecouple(); @@ -1020,7 +1020,7 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) CGPoint newPosition; - // llinfos << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << llendl; + // LL_INFOS() << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << LL_ENDL; newPosition.x = screen_pos.mX; newPosition.y = screen_pos.mY; @@ -1082,7 +1082,7 @@ void LLWindowMacOSX::adjustCursorDecouple(bool warpingMouse) // The cursor should be decoupled. Make sure it is. if(!mCursorDecoupled) { - // llinfos << "adjustCursorDecouple: decoupling cursor" << llendl; + // LL_INFOS() << "adjustCursorDecouple: decoupling cursor" << LL_ENDL; CGAssociateMouseAndMouseCursorPosition(false); mCursorDecoupled = true; mCursorIgnoreNextDelta = TRUE; @@ -1094,7 +1094,7 @@ void LLWindowMacOSX::adjustCursorDecouple(bool warpingMouse) // The cursor should not be decoupled. Make sure it isn't. if(mCursorDecoupled) { - // llinfos << "adjustCursorDecouple: recoupling cursor" << llendl; + // LL_INFOS() << "adjustCursorDecouple: recoupling cursor" << LL_ENDL; CGAssociateMouseAndMouseCursorPosition(true); mCursorDecoupled = false; } @@ -1359,7 +1359,7 @@ const char* cursorIDToName(int id) case UI_CURSOR_TOOLNO: return "UI_CURSOR_NO"; } - llerrs << "cursorIDToName: unknown cursor id" << id << llendl; + LL_ERRS() << "cursorIDToName: unknown cursor id" << id << LL_ENDL; return "UI_CURSOR_ARROW"; } @@ -1542,14 +1542,14 @@ void LLWindowMacOSX::hideCursor() { if(!mCursorHidden) { - // llinfos << "hideCursor: hiding" << llendl; + // LL_INFOS() << "hideCursor: hiding" << LL_ENDL; mCursorHidden = TRUE; mHideCursorPermanent = TRUE; hideNSCursor(); } else { - // llinfos << "hideCursor: already hidden" << llendl; + // LL_INFOS() << "hideCursor: already hidden" << LL_ENDL; } adjustCursorDecouple(); @@ -1559,14 +1559,14 @@ void LLWindowMacOSX::showCursor() { if(mCursorHidden) { - // llinfos << "showCursor: showing" << llendl; + // LL_INFOS() << "showCursor: showing" << LL_ENDL; mCursorHidden = FALSE; mHideCursorPermanent = FALSE; showNSCursor(); } else { - // llinfos << "showCursor: already visible" << llendl; + // LL_INFOS() << "showCursor: already visible" << LL_ENDL; } adjustCursorDecouple(); @@ -1651,14 +1651,14 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async) if (!found) { - llwarns << "spawn_web_browser called for url with protocol not on whitelist: " << escaped_url << llendl; + LL_WARNS() << "spawn_web_browser called for url with protocol not on whitelist: " << escaped_url << LL_ENDL; return; } S32 result = 0; CFURLRef urlRef = NULL; - llinfos << "Opening URL " << escaped_url << llendl; + LL_INFOS() << "Opening URL " << escaped_url << LL_ENDL; CFStringRef stringRef = CFStringCreateWithCString(NULL, escaped_url.c_str(), kCFStringEncodingUTF8); if (stringRef) @@ -1678,14 +1678,14 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async) if (result != noErr) { - llinfos << "Error " << result << " on open." << llendl; + LL_INFOS() << "Error " << result << " on open." << LL_ENDL; } CFRelease(urlRef); } else { - llinfos << "Error: couldn't create URL." << llendl; + LL_INFOS() << "Error: couldn't create URL." << LL_ENDL; } } @@ -1738,7 +1738,7 @@ LLSD LLWindowMacOSX::getNativeKeyData() } #endif - lldebugs << "native key data is: " << result << llendl; + LL_DEBUGS() << "native key data is: " << result << LL_ENDL; return result; } @@ -1849,7 +1849,7 @@ S16 LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef t S16 result = 0; LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon; - lldebugs << "drag tracking handler, message = " << message << llendl; + LL_DEBUGS() << "drag tracking handler, message = " << message << LL_ENDL; switch(message) { diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp index 11c22ac94e5b41ab1dc0e6c7131dbf1a57cbb01c..4b01f7a979b373463156339655ca5c6fff215ac2 100755 --- a/indra/llwindow/llwindowmesaheadless.cpp +++ b/indra/llwindow/llwindowmesaheadless.cpp @@ -46,7 +46,7 @@ LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks, { if (use_gl) { - llinfos << "MESA Init" << llendl; + LL_INFOS() << "MESA Init" << LL_ENDL; mMesaContext = OSMesaCreateContextExt( GL_RGBA, 32, 0, 0, NULL ); /* Allocate the image buffer */ @@ -58,7 +58,7 @@ LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks, /* Bind the buffer to the context and make it current */ if (!OSMesaMakeCurrent( mMesaContext, mMesaBuffer, MESA_CHANNEL_TYPE, width, height )) { - llerrs << "MESA: OSMesaMakeCurrent failed!" << llendl; + LL_ERRS() << "MESA: OSMesaMakeCurrent failed!" << LL_ENDL; } llverify(gGLManager.initGL()); diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 205466e9369255d8b0e0e29e1a73ceab07fcdc75..bb77a24590312ba24cb9f38fbf2359c033bbfdf1 100755 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -109,7 +109,7 @@ bool LLWindowSDL::ll_try_gtk_init(void) if (!done_setlocale) { - llinfos << "Starting GTK Initialization." << llendl; + LL_INFOS() << "Starting GTK Initialization." << LL_ENDL; maybe_lock_display(); gtk_disable_setlocale(); maybe_unlock_display(); @@ -124,20 +124,20 @@ bool LLWindowSDL::ll_try_gtk_init(void) gtk_is_good = gtk_init_check(NULL, NULL); maybe_unlock_display(); if (!gtk_is_good) - llwarns << "GTK Initialization failed." << llendl; + LL_WARNS() << "GTK Initialization failed." << LL_ENDL; } if (gtk_is_good && !done_gtk_diag) { - llinfos << "GTK Initialized." << llendl; - llinfos << "- Compiled against GTK version " + LL_INFOS() << "GTK Initialized." << LL_ENDL; + LL_INFOS() << "- Compiled against GTK version " << GTK_MAJOR_VERSION << "." << GTK_MINOR_VERSION << "." - << GTK_MICRO_VERSION << llendl; - llinfos << "- Running against GTK version " + << GTK_MICRO_VERSION << LL_ENDL; + LL_INFOS() << "- Running against GTK version " << gtk_major_version << "." << gtk_minor_version << "." - << gtk_micro_version << llendl; + << gtk_micro_version << LL_ENDL; maybe_lock_display(); const gchar* gtk_warning = gtk_check_version( GTK_MAJOR_VERSION, @@ -146,11 +146,11 @@ bool LLWindowSDL::ll_try_gtk_init(void) maybe_unlock_display(); if (gtk_warning) { - llwarns << "- GTK COMPATIBILITY WARNING: " << - gtk_warning << llendl; + LL_WARNS() << "- GTK COMPATIBILITY WARNING: " << + gtk_warning << LL_ENDL; gtk_is_good = FALSE; } else { - llinfos << "- GTK version is good." << llendl; + LL_INFOS() << "- GTK version is good." << LL_ENDL; } done_gtk_diag = TRUE; @@ -278,7 +278,7 @@ static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str) char line_buf[line_buf_size]; while (fgets(line_buf, line_buf_size, fp)) { - //lldebugs << "XLOG: " << line_buf << llendl; + //LL_DEBUGS() << "XLOG: " << line_buf << LL_ENDL; // Why the ad-hoc parser instead of using a regex? Our // favourite regex implementation - libboost_regex - is @@ -353,8 +353,8 @@ static int x11_detect_VRAM_kb() fp = fopen(fname.c_str(), "r"); if (fp) { - llinfos << "Looking in " << fname - << " for VRAM info..." << llendl; + LL_INFOS() << "Looking in " << fname + << " for VRAM info..." << LL_ENDL; rtn = x11_detect_VRAM_kb_fp(fp, ": VideoRAM: "); fclose(fp); if (0 == rtn) @@ -378,8 +378,8 @@ static int x11_detect_VRAM_kb() } else { - llinfos << "Could not open " << fname - << " - skipped." << llendl; + LL_INFOS() << "Could not open " << fname + << " - skipped." << LL_ENDL; // Try old XFree86 log otherwise fname = x_log_location; fname += "XFree86."; @@ -388,8 +388,8 @@ static int x11_detect_VRAM_kb() fp = fopen(fname.c_str(), "r"); if (fp) { - llinfos << "Looking in " << fname - << " for VRAM info..." << llendl; + LL_INFOS() << "Looking in " << fname + << " for VRAM info..." << LL_ENDL; rtn = x11_detect_VRAM_kb_fp(fp, ": VideoRAM: "); fclose(fp); if (0 == rtn) @@ -404,8 +404,8 @@ static int x11_detect_VRAM_kb() } else { - llinfos << "Could not open " << fname - << " - skipped." << llendl; + LL_INFOS() << "Could not open " << fname + << " - skipped." << LL_ENDL; } } return rtn; @@ -417,8 +417,8 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B { //bool glneedsinit = false; - llinfos << "createContext, fullscreen=" << fullscreen << - " size=" << width << "x" << height << llendl; + LL_INFOS() << "createContext, fullscreen=" << fullscreen << + " size=" << width << "x" << height << LL_ENDL; // captures don't survive contexts mGrabbyKeyFlags = 0; @@ -426,28 +426,28 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B if (SDL_Init(SDL_INIT_VIDEO) < 0) { - llinfos << "sdl_init() failed! " << SDL_GetError() << llendl; + LL_INFOS() << "sdl_init() failed! " << SDL_GetError() << LL_ENDL; setupFailure("sdl_init() failure, window creation error", "error", OSMB_OK); return false; } SDL_version c_sdl_version; SDL_VERSION(&c_sdl_version); - llinfos << "Compiled against SDL " + LL_INFOS() << "Compiled against SDL " << int(c_sdl_version.major) << "." << int(c_sdl_version.minor) << "." - << int(c_sdl_version.patch) << llendl; + << int(c_sdl_version.patch) << LL_ENDL; const SDL_version *r_sdl_version; r_sdl_version = SDL_Linked_Version(); - llinfos << " Running against SDL " + LL_INFOS() << " Running against SDL " << int(r_sdl_version->major) << "." << int(r_sdl_version->minor) << "." - << int(r_sdl_version->patch) << llendl; + << int(r_sdl_version->patch) << LL_ENDL; const SDL_VideoInfo *video_info = SDL_GetVideoInfo( ); if (!video_info) { - llinfos << "SDL_GetVideoInfo() failed! " << SDL_GetError() << llendl; + LL_INFOS() << "SDL_GetVideoInfo() failed! " << SDL_GetError() << LL_ENDL; setupFailure("SDL_GetVideoInfo() failed, Window creation error", "Error", OSMB_OK); return FALSE; } @@ -455,7 +455,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B if (video_info->current_h > 0) { mOriginalAspectRatio = (float)video_info->current_w / (float)video_info->current_h; - llinfos << "Original aspect ratio was " << video_info->current_w << ":" << video_info->current_h << "=" << mOriginalAspectRatio << llendl; + LL_INFOS() << "Original aspect ratio was " << video_info->current_w << ":" << video_info->current_h << "=" << mOriginalAspectRatio << LL_ENDL; } SDL_EnableUNICODE(1); @@ -525,7 +525,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B if (mFullscreen) { - llinfos << "createContext: setting up fullscreen " << width << "x" << height << llendl; + LL_INFOS() << "createContext: setting up fullscreen " << width << "x" << height << LL_ENDL; // If the requested width or height is 0, find the best default for the monitor. if((width == 0) || (height == 0)) @@ -543,18 +543,18 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B U32 closestWidth = 0; int i; - llinfos << "createContext: searching for a display mode, original aspect is " << mOriginalAspectRatio << llendl; + LL_INFOS() << "createContext: searching for a display mode, original aspect is " << mOriginalAspectRatio << LL_ENDL; for(i=0; i < resolutionCount; i++) { F32 aspect = (F32)resolutionList[i].mWidth / (F32)resolutionList[i].mHeight; - llinfos << "createContext: width " << resolutionList[i].mWidth << " height " << resolutionList[i].mHeight << " aspect " << aspect << llendl; + LL_INFOS() << "createContext: width " << resolutionList[i].mWidth << " height " << resolutionList[i].mHeight << " aspect " << aspect << LL_ENDL; if( (resolutionList[i].mHeight >= 700) && (resolutionList[i].mHeight <= 800) && (fabs(aspect - mOriginalAspectRatio) < fabs(closestAspect - mOriginalAspectRatio))) { - llinfos << " (new closest mode) " << llendl; + LL_INFOS() << " (new closest mode) " << LL_ENDL; // This is the closest mode we've seen yet. closestWidth = resolutionList[i].mWidth; @@ -590,15 +590,15 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B mFullscreenBits = mWindow->format->BitsPerPixel; mFullscreenRefresh = -1; - llinfos << "Running at " << mFullscreenWidth + LL_INFOS() << "Running at " << mFullscreenWidth << "x" << mFullscreenHeight << "x" << mFullscreenBits << " @ " << mFullscreenRefresh - << llendl; + << LL_ENDL; } else { - llwarns << "createContext: fullscreen creation failure. SDL: " << SDL_GetError() << llendl; + LL_WARNS() << "createContext: fullscreen creation failure. SDL: " << SDL_GetError() << LL_ENDL; // No fullscreen support mFullscreen = FALSE; mFullscreenWidth = -1; @@ -618,7 +618,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B if (height == 0) width = 768; - llinfos << "createContext: creating window " << width << "x" << height << "x" << bits << llendl; + LL_INFOS() << "createContext: creating window " << width << "x" << height << "x" << bits << LL_ENDL; mWindow = SDL_SetVideoMode(width, height, bits, sdlflags); if (!mWindow && bits > 16) { @@ -628,13 +628,13 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B if (!mWindow) { - llwarns << "createContext: window creation failure. SDL: " << SDL_GetError() << llendl; + LL_WARNS() << "createContext: window creation failure. SDL: " << SDL_GetError() << LL_ENDL; setupFailure("Window creation error", "Error", OSMB_OK); return FALSE; } } else if (!mFullscreen && (mWindow != NULL)) { - llinfos << "createContext: SKIPPING - !fullscreen, but +mWindow " << width << "x" << height << "x" << bits << llendl; + LL_INFOS() << "createContext: SKIPPING - !fullscreen, but +mWindow " << width << "x" << height << "x" << bits << LL_ENDL; } // Detect video memory size. @@ -642,7 +642,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B gGLManager.mVRAM = x11_detect_VRAM_kb() / 1024; if (gGLManager.mVRAM != 0) { - llinfos << "X11 log-parser detected " << gGLManager.mVRAM << "MB VRAM." << llendl; + LL_INFOS() << "X11 log-parser detected " << gGLManager.mVRAM << "MB VRAM." << LL_ENDL; } else # endif // LL_X11 { @@ -652,7 +652,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B gGLManager.mVRAM = video_info->video_mem / 1024; if (gGLManager.mVRAM != 0) { - llinfos << "SDL detected " << gGLManager.mVRAM << "MB VRAM." << llendl; + LL_INFOS() << "SDL detected " << gGLManager.mVRAM << "MB VRAM." << LL_ENDL; } } // If VRAM is not detected, that is handled later @@ -670,13 +670,13 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B glGetIntegerv(GL_DEPTH_BITS, &depthBits); glGetIntegerv(GL_STENCIL_BITS, &stencilBits); - llinfos << "GL buffer:" << llendl; - llinfos << " Red Bits " << S32(redBits) << llendl; - llinfos << " Green Bits " << S32(greenBits) << llendl; - llinfos << " Blue Bits " << S32(blueBits) << llendl; - llinfos << " Alpha Bits " << S32(alphaBits) << llendl; - llinfos << " Depth Bits " << S32(depthBits) << llendl; - llinfos << " Stencil Bits " << S32(stencilBits) << llendl; + LL_INFOS() << "GL buffer:" << LL_ENDL; + LL_INFOS() << " Red Bits " << S32(redBits) << LL_ENDL; + LL_INFOS() << " Green Bits " << S32(greenBits) << LL_ENDL; + LL_INFOS() << " Blue Bits " << S32(blueBits) << LL_ENDL; + LL_INFOS() << " Alpha Bits " << S32(alphaBits) << LL_ENDL; + LL_INFOS() << " Depth Bits " << S32(depthBits) << LL_ENDL; + LL_INFOS() << " Stencil Bits " << S32(stencilBits) << LL_ENDL; GLint colorBits = redBits + greenBits + blueBits + alphaBits; // fixme: actually, it's REALLY important for picking that we get at @@ -741,14 +741,14 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B } else { - llwarns << "We're not running under X11? Wild." - << llendl; + LL_WARNS() << "We're not running under X11? Wild." + << LL_ENDL; } } else { - llwarns << "We're not running under any known WM. Wild." - << llendl; + LL_WARNS() << "We're not running under any known WM. Wild." + << LL_ENDL; } #endif // LL_X11 @@ -759,7 +759,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B // We need to do this here, once video is init'd if (-1 == SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL)) - llwarns << "Couldn't enable key-repeat: " << SDL_GetError() <<llendl; + LL_WARNS() << "Couldn't enable key-repeat: " << SDL_GetError() <<LL_ENDL; // Don't need to get the current gamma, since there's a call that restores it to the system defaults. return TRUE; @@ -772,7 +772,7 @@ BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL const BOOL needsRebuild = TRUE; // Just nuke the context and start over. BOOL result = true; - llinfos << "switchContext, fullscreen=" << fullscreen << llendl; + LL_INFOS() << "switchContext, fullscreen=" << fullscreen << LL_ENDL; stop_glerror(); if(needsRebuild) { @@ -795,7 +795,7 @@ BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL void LLWindowSDL::destroyContext() { - llinfos << "destroyContext begins" << llendl; + LL_INFOS() << "destroyContext begins" << LL_ENDL; #if LL_X11 mSDL_Display = NULL; @@ -805,9 +805,9 @@ void LLWindowSDL::destroyContext() #endif // LL_X11 // Clean up remaining GL state before blowing away window - llinfos << "shutdownGL begins" << llendl; + LL_INFOS() << "shutdownGL begins" << LL_ENDL; gGLManager.shutdownGL(); - llinfos << "SDL_QuitSS/VID begins" << llendl; + LL_INFOS() << "SDL_QuitSS/VID begins" << LL_ENDL; SDL_QuitSubSystem(SDL_INIT_VIDEO); // *FIX: this might be risky... mWindow = NULL; @@ -1081,12 +1081,12 @@ BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position) return FALSE; } - //llinfos << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << llendl; + //LL_INFOS() << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << LL_ENDL; // do the actual forced cursor move. SDL_WarpMouse(screen_pos.mX, screen_pos.mY); - //llinfos << llformat("llcw %d,%d -> scr %d,%d", position.mX, position.mY, screen_pos.mX, screen_pos.mY) << llendl; + //LL_INFOS() << llformat("llcw %d,%d -> scr %d,%d", position.mX, position.mY, screen_pos.mX, screen_pos.mY) << LL_ENDL; return result; } @@ -1171,7 +1171,7 @@ void LLWindowSDL::beforeDialog() running_x11 = (mSDL_XWindowID != None); #endif //LL_X11 - llinfos << "LLWindowSDL::beforeDialog()" << llendl; + LL_INFOS() << "LLWindowSDL::beforeDialog()" << LL_ENDL; if (SDLReallyCaptureInput(FALSE)) // must ungrab input so popup works! { @@ -1214,7 +1214,7 @@ void LLWindowSDL::afterDialog() running_x11 = (mSDL_XWindowID != None); #endif //LL_X11 - llinfos << "LLWindowSDL::afterDialog()" << llendl; + LL_INFOS() << "LLWindowSDL::afterDialog()" << LL_ENDL; maybe_unlock_display(); @@ -1238,7 +1238,7 @@ void LLWindowSDL::x11_set_urgent(BOOL urgent) { XWMHints *wm_hints; - llinfos << "X11 hint for urgency, " << urgent << llendl; + LL_INFOS() << "X11 hint for urgency, " << urgent << LL_ENDL; maybe_lock_display(); wm_hints = XGetWMHints(mSDL_Display, mSDL_XWindowID); @@ -1261,9 +1261,9 @@ void LLWindowSDL::x11_set_urgent(BOOL urgent) void LLWindowSDL::flashIcon(F32 seconds) { #if !LL_X11 - llinfos << "Stub LLWindowSDL::flashIcon(" << seconds << ")" << llendl; + LL_INFOS() << "Stub LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL; #else - llinfos << "X11 LLWindowSDL::flashIcon(" << seconds << ")" << llendl; + LL_INFOS() << "X11 LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL; F32 remaining_time = mFlashTimer.getRemainingTimeF32(); if (remaining_time < seconds) @@ -1530,7 +1530,7 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) if (mReallyCapturedCount < 0) // yuck, imbalance. { mReallyCapturedCount = 0; - llwarns << "ReallyCapture count was < 0" << llendl; + LL_WARNS() << "ReallyCapture count was < 0" << LL_ENDL; } if (!mFullscreen) /* only bother if we're windowed anyway */ @@ -1550,7 +1550,7 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) int result; if (wantmode == SDL_GRAB_ON) { - //llinfos << "X11 POINTER GRABBY" << llendl; + //LL_INFOS() << "X11 POINTER GRABBY" << LL_ENDL; //newmode = SDL_WM_GrabInput(wantmode); maybe_lock_display(); result = XGrabPointer(mSDL_Display, mSDL_XWindowID, @@ -1564,7 +1564,7 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) newmode = SDL_GRAB_OFF; } else if (wantmode == SDL_GRAB_OFF) { - //llinfos << "X11 POINTER UNGRABBY" << llendl; + //LL_INFOS() << "X11 POINTER UNGRABBY" << LL_ENDL; newmode = SDL_GRAB_OFF; //newmode = SDL_WM_GrabInput(SDL_GRAB_OFF); @@ -1625,7 +1625,7 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain) else mGrabbyKeyFlags &= ~mask; - //llinfos << "mGrabbyKeyFlags=" << mGrabbyKeyFlags << llendl; + //LL_INFOS() << "mGrabbyKeyFlags=" << mGrabbyKeyFlags << LL_ENDL; /* 0 means we don't need to mousegrab, otherwise grab. */ return mGrabbyKeyFlags; @@ -1655,7 +1655,7 @@ void check_vm_bloat() res = getdelim(&ptr, &dummy, ' ', fp); if (-1 == res) { - llwarns << "Unable to parse " << STATS_FILE << llendl; + LL_WARNS() << "Unable to parse " << STATS_FILE << LL_ENDL; goto finally; } free(ptr); @@ -1666,7 +1666,7 @@ void check_vm_bloat() llassert(ptr); if (-1 == res) { - llwarns << "Unable to parse " << STATS_FILE << llendl; + LL_WARNS() << "Unable to parse " << STATS_FILE << LL_ENDL; goto finally; } this_vm_size = atoll(ptr); @@ -1677,25 +1677,25 @@ void check_vm_bloat() llassert(ptr); if (-1 == res) { - llwarns << "Unable to parse " << STATS_FILE << llendl; + LL_WARNS() << "Unable to parse " << STATS_FILE << LL_ENDL; goto finally; } this_rss_size = getpagesize() * atoll(ptr); free(ptr); ptr = NULL; - llinfos << "VM SIZE IS NOW " << (this_vm_size/(1024*1024)) << " MB, RSS SIZE IS NOW " << (this_rss_size/(1024*1024)) << " MB" << llendl; + LL_INFOS() << "VM SIZE IS NOW " << (this_vm_size/(1024*1024)) << " MB, RSS SIZE IS NOW " << (this_rss_size/(1024*1024)) << " MB" << LL_ENDL; if (llabs(last_vm_size - this_vm_size) > significant_vm_difference) { if (this_vm_size > last_vm_size) { - llwarns << "VM size grew by " << (this_vm_size - last_vm_size)/(1024*1024) << " MB in last frame" << llendl; + LL_WARNS() << "VM size grew by " << (this_vm_size - last_vm_size)/(1024*1024) << " MB in last frame" << LL_ENDL; } else { - llinfos << "VM size shrank by " << (last_vm_size - this_vm_size)/(1024*1024) << " MB in last frame" << llendl; + LL_INFOS() << "VM size shrank by " << (last_vm_size - this_vm_size)/(1024*1024) << " MB in last frame" << LL_ENDL; } } @@ -1704,11 +1704,11 @@ void check_vm_bloat() { if (this_rss_size > last_rss_size) { - llwarns << "RSS size grew by " << (this_rss_size - last_rss_size)/(1024*1024) << " MB in last frame" << llendl; + LL_WARNS() << "RSS size grew by " << (this_rss_size - last_rss_size)/(1024*1024) << " MB in last frame" << LL_ENDL; } else { - llinfos << "RSS size shrank by " << (last_rss_size - this_rss_size)/(1024*1024) << " MB in last frame" << llendl; + LL_INFOS() << "RSS size shrank by " << (last_rss_size - this_rss_size)/(1024*1024) << " MB in last frame" << LL_ENDL; } } @@ -1905,8 +1905,8 @@ void LLWindowSDL::gatherInput() case SDL_VIDEORESIZE: // *FIX: handle this? { - llinfos << "Handling a resize event: " << event.resize.w << - "x" << event.resize.h << llendl; + LL_INFOS() << "Handling a resize event: " << event.resize.w << + "x" << event.resize.h << LL_ENDL; S32 width = llmax(event.resize.w, (S32)mMinWindowWidth); S32 height = llmax(event.resize.h, (S32)mMinWindowHeight); @@ -1916,7 +1916,7 @@ void LLWindowSDL::gatherInput() if (!mWindow) { // *FIX: More informative dialog? - llinfos << "Could not recreate context after resize! Quitting..." << llendl; + LL_INFOS() << "Could not recreate context after resize! Quitting..." << LL_ENDL; if(mCallbacks->handleCloseRequest(this)) { // Get the app to initiate cleanup. @@ -1957,11 +1957,11 @@ void LLWindowSDL::gatherInput() mIsMinimized = (!event.active.gain); mCallbacks->handleActivate(this, !mIsMinimized); - llinfos << "SDL deiconification state switched to " << BOOL(event.active.gain) << llendl; + LL_INFOS() << "SDL deiconification state switched to " << BOOL(event.active.gain) << LL_ENDL; } else { - llinfos << "Ignored bogus redundant SDL deiconification state switch to " << BOOL(event.active.gain) << llendl; + LL_INFOS() << "Ignored bogus redundant SDL deiconification state switch to " << BOOL(event.active.gain) << LL_ENDL; } } break; @@ -1975,7 +1975,7 @@ void LLWindowSDL::gatherInput() } break; default: - //llinfos << "Unhandled SDL event type " << event.type << llendl; + //LL_INFOS() << "Unhandled SDL event type " << event.type << LL_ENDL; break; } } @@ -2003,8 +2003,8 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty if (bmpsurface && bmpsurface->w%8==0) { SDL_Surface *cursurface; - lldebugs << "Loaded cursor file " << filename << " " - << bmpsurface->w << "x" << bmpsurface->h << llendl; + LL_DEBUGS() << "Loaded cursor file " << filename << " " + << bmpsurface->w << "x" << bmpsurface->h << LL_ENDL; cursurface = SDL_CreateRGBSurface (SDL_SWSURFACE, bmpsurface->w, bmpsurface->h, @@ -2056,12 +2056,12 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty delete[] cursor_data; delete[] cursor_mask; } else { - llwarns << "CURSOR BLIT FAILURE, cursurface: " << cursurface << llendl; + LL_WARNS() << "CURSOR BLIT FAILURE, cursurface: " << cursurface << LL_ENDL; } SDL_FreeSurface(cursurface); SDL_FreeSurface(bmpsurface); } else { - llwarns << "CURSOR LOAD FAILURE " << filename << llendl; + LL_WARNS() << "CURSOR LOAD FAILURE " << filename << LL_ENDL; } return sdlcursor; @@ -2087,7 +2087,7 @@ void LLWindowSDL::updateCursor() if (sdlcursor) SDL_SetCursor(sdlcursor); } else { - llwarns << "Tried to set invalid cursor number " << mNextCursor << llendl; + LL_WARNS() << "Tried to set invalid cursor number " << mNextCursor << LL_ENDL; } mCurrentCursor = mNextCursor; } @@ -2149,7 +2149,7 @@ void LLWindowSDL::initCursors() mSDLCursors[UI_CURSOR_TOOLNO] = makeSDLCursorFromBMP("llno.BMP",8,8); if (getenv("LL_ATI_MOUSE_CURSOR_BUG") != NULL) { - llinfos << "Disabling cursor updating due to LL_ATI_MOUSE_CURSOR_BUG" << llendl; + LL_INFOS() << "Disabling cursor updating due to LL_ATI_MOUSE_CURSOR_BUG" << LL_ENDL; ATIbug = true; } } @@ -2170,7 +2170,7 @@ void LLWindowSDL::quitCursors() } else { // SDL doesn't refcount cursors, so if the window has // already been destroyed then the cursors have gone with it. - llinfos << "Skipping quitCursors: mWindow already gone." << llendl; + LL_INFOS() << "Skipping quitCursors: mWindow already gone." << LL_ENDL; for (i=0; i<UI_CURSOR_COUNT; ++i) mSDLCursors[i] = NULL; } @@ -2181,31 +2181,31 @@ void LLWindowSDL::captureMouse() // SDL already enforces the semantics that captureMouse is // used for, i.e. that we continue to get mouse events as long // as a button is down regardless of whether we left the - // window, and in a less obnoxious way than SDL_WM_GrabInput + // window, and in a less obnoxious way than SDL_WM_GrabInput // which would confine the cursor to the window too. - lldebugs << "LLWindowSDL::captureMouse" << llendl; + LL_DEBUGS() << "LLWindowSDL::captureMouse" << LL_ENDL; } void LLWindowSDL::releaseMouse() { // see LWindowSDL::captureMouse() - lldebugs << "LLWindowSDL::releaseMouse" << llendl; + LL_DEBUGS() << "LLWindowSDL::releaseMouse" << LL_ENDL; } void LLWindowSDL::hideCursor() { if(!mCursorHidden) { - // llinfos << "hideCursor: hiding" << llendl; + // LL_INFOS() << "hideCursor: hiding" << LL_ENDL; mCursorHidden = TRUE; mHideCursorPermanent = TRUE; SDL_ShowCursor(0); } else { - // llinfos << "hideCursor: already hidden" << llendl; + // LL_INFOS() << "hideCursor: already hidden" << LL_ENDL; } } @@ -2213,14 +2213,14 @@ void LLWindowSDL::showCursor() { if(mCursorHidden) { - // llinfos << "showCursor: showing" << llendl; + // LL_INFOS() << "showCursor: showing" << LL_ENDL; mCursorHidden = FALSE; mHideCursorPermanent = FALSE; SDL_ShowCursor(1); } else { - // llinfos << "showCursor: already visible" << llendl; + // LL_INFOS() << "showCursor: already visible" << LL_ENDL; } } @@ -2291,7 +2291,7 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ { GtkWidget *win = NULL; - llinfos << "Creating a dialog because we're in windowed mode and GTK is happy." << llendl; + LL_INFOS() << "Creating a dialog because we're in windowed mode and GTK is happy." << LL_ENDL; GtkDialogFlags flags = GTK_DIALOG_MODAL; GtkMessageType messagetype; @@ -2350,7 +2350,7 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ gtk_widget_show_all (win); gtk_main(); - //llinfos << "response: " << response << llendl; + //LL_INFOS() << "response: " << response << LL_ENDL; switch (response) { case GTK_RESPONSE_OK: rtn = OSBTN_OK; break; @@ -2366,8 +2366,8 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ } else { - llinfos << "MSGBOX: " << caption << ": " << text << llendl; - llinfos << "Skipping dialog because we're in fullscreen mode or GTK is not happy." << llendl; + LL_INFOS() << "MSGBOX: " << caption << ": " << text << LL_ENDL; + LL_INFOS() << "Skipping dialog because we're in fullscreen mode or GTK is not happy." << LL_ENDL; rtn = OSBTN_OK; } @@ -2493,7 +2493,7 @@ BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b) #else S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type) { - llinfos << "MSGBOX: " << caption << ": " << text << llendl; + LL_INFOS() << "MSGBOX: " << caption << ": " << text << LL_ENDL; return 0; } @@ -2521,7 +2521,7 @@ void exec_cmd(const std::string& cmd, const std::string& arg) // end ourself by running the command execv(cmd.c_str(), argv); /* Flawfinder: ignore */ // if execv returns at all, there was a problem. - llwarns << "execv failure when trying to start " << cmd << llendl; + LL_WARNS() << "execv failure when trying to start " << cmd << LL_ENDL; _exit(1); // _exit because we don't want atexit() clean-up! } else { if (pid > 0) @@ -2530,7 +2530,7 @@ void exec_cmd(const std::string& cmd, const std::string& arg) int childExitStatus; waitpid(pid, &childExitStatus, 0); } else { - llwarns << "fork failure." << llendl; + LL_WARNS() << "fork failure." << LL_ENDL; } } } @@ -2553,11 +2553,11 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) if (!found) { - llwarns << "spawn_web_browser called for url with protocol not on whitelist: " << escaped_url << llendl; + LL_WARNS() << "spawn_web_browser called for url with protocol not on whitelist: " << escaped_url << LL_ENDL; return; } - llinfos << "spawn_web_browser: " << escaped_url << llendl; + LL_INFOS() << "spawn_web_browser: " << escaped_url << LL_ENDL; #if LL_LINUX || LL_SOLARIS # if LL_X11 @@ -2580,7 +2580,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) exec_cmd(cmd, arg); #endif // LL_LINUX || LL_SOLARIS - llinfos << "spawn_web_browser returning." << llendl; + LL_INFOS() << "spawn_web_browser returning." << LL_ENDL; } @@ -2615,7 +2615,7 @@ void LLWindowSDL::bringToFront() { // This is currently used when we are 'launched' to a specific // map position externally. - llinfos << "bringToFront" << llendl; + LL_INFOS() << "bringToFront" << LL_ENDL; #if LL_X11 if (mSDL_Display && !mFullscreen) { @@ -2650,7 +2650,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() FcFontSet *fs = NULL; FcPattern *sortpat = NULL; - llinfos << "Getting system font list from FontConfig..." << llendl; + LL_INFOS() << "Getting system font list from FontConfig..." << LL_ENDL; // If the user has a system-wide language preference, then favor // fonts from that language group. This doesn't affect the types @@ -2667,9 +2667,9 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() LL_INFOS("AppInit") << "Location " << locale->country << LL_ENDL; LL_INFOS("AppInit") << "Variant " << locale->variant << LL_ENDL; - llinfos << "Preferring fonts of language: " + LL_INFOS() << "Preferring fonts of language: " << locale->lang - << llendl; + << LL_ENDL; sort_order = "lang=" + std::string(locale->lang) + ":" + sort_order; } @@ -2678,7 +2678,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() if (!FcInit()) { - llwarns << "FontConfig failed to initialize." << llendl; + LL_WARNS() << "FontConfig failed to initialize." << LL_ENDL; rtns.push_back(final_fallback); return rtns; } @@ -2715,14 +2715,14 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() FcFontSetDestroy (fs); } - lldebugs << "Using font list: " << llendl; + LL_DEBUGS() << "Using font list: " << LL_ENDL; for (std::vector<std::string>::iterator it = rtns.begin(); it != rtns.end(); ++it) { - lldebugs << " file: " << *it << llendl; + LL_DEBUGS() << " file: " << *it << LL_ENDL; } - llinfos << "Using " << rtns.size() << "/" << found_font_count << " system fonts." << llendl; + LL_INFOS() << "Using " << rtns.size() << "/" << found_font_count << " system fonts." << LL_ENDL; rtns.push_back(final_fallback); return rtns; diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 30f5526500b494feca83bec85f39e0137a940b28..0637572f6710101ba1ccd875402c9cdcb4e67c0f 100755 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -38,6 +38,7 @@ // Linden library includes #include "llerror.h" +#include "llfasttimer.h" #include "llgl.h" #include "llstring.h" #include "lldir.h" @@ -202,7 +203,7 @@ LLWinImm::LLWinImm() : mHImmDll(NULL) // the case, since it is very unusual; these APIs are available from // the beginning, and all versions of IMM32.DLL should have them all. // Unfortunately, this code may be executed before initialization of - // the logging channel (llwarns), and we can't do it here... Yes, this + // the logging channel (LL_WARNS()), and we can't do it here... Yes, this // is one of disadvantages to use static constraction to DLL loading. FreeLibrary(mHImmDll); mHImmDll = NULL; @@ -1056,7 +1057,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO mhInstance, NULL); - LL_INFOS("Window") << "window is created." << llendl ; + LL_INFOS("Window") << "window is created." << LL_ENDL ; //----------------------------------------------------------------------- // Create GL drawing context @@ -1089,7 +1090,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO return FALSE; } - LL_INFOS("Window") << "Device context retrieved." << llendl ; + LL_INFOS("Window") << "Device context retrieved." << LL_ENDL ; if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd))) { @@ -1099,7 +1100,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO return FALSE; } - LL_INFOS("Window") << "Pixel format chosen." << llendl ; + LL_INFOS("Window") << "Pixel format chosen." << LL_ENDL ; // Verify what pixel format we actually received. if (!DescribePixelFormat(mhDC, pixel_format, sizeof(PIXELFORMATDESCRIPTOR), @@ -1112,35 +1113,35 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO } // (EXP-1765) dump pixel data to see if there is a pattern that leads to unreproducible crash - LL_INFOS("Window") << "--- begin pixel format dump ---" << llendl ; - LL_INFOS("Window") << "pixel_format is " << pixel_format << llendl ; - LL_INFOS("Window") << "pfd.nSize: " << pfd.nSize << llendl ; - LL_INFOS("Window") << "pfd.nVersion: " << pfd.nVersion << llendl ; - LL_INFOS("Window") << "pfd.dwFlags: 0x" << std::hex << pfd.dwFlags << std::dec << llendl ; - LL_INFOS("Window") << "pfd.iPixelType: " << (int)pfd.iPixelType << llendl ; - LL_INFOS("Window") << "pfd.cColorBits: " << (int)pfd.cColorBits << llendl ; - LL_INFOS("Window") << "pfd.cRedBits: " << (int)pfd.cRedBits << llendl ; - LL_INFOS("Window") << "pfd.cRedShift: " << (int)pfd.cRedShift << llendl ; - LL_INFOS("Window") << "pfd.cGreenBits: " << (int)pfd.cGreenBits << llendl ; - LL_INFOS("Window") << "pfd.cGreenShift: " << (int)pfd.cGreenShift << llendl ; - LL_INFOS("Window") << "pfd.cBlueBits: " << (int)pfd.cBlueBits << llendl ; - LL_INFOS("Window") << "pfd.cBlueShift: " << (int)pfd.cBlueShift << llendl ; - LL_INFOS("Window") << "pfd.cAlphaBits: " << (int)pfd.cAlphaBits << llendl ; - LL_INFOS("Window") << "pfd.cAlphaShift: " << (int)pfd.cAlphaShift << llendl ; - LL_INFOS("Window") << "pfd.cAccumBits: " << (int)pfd.cAccumBits << llendl ; - LL_INFOS("Window") << "pfd.cAccumRedBits: " << (int)pfd.cAccumRedBits << llendl ; - LL_INFOS("Window") << "pfd.cAccumGreenBits: " << (int)pfd.cAccumGreenBits << llendl ; - LL_INFOS("Window") << "pfd.cAccumBlueBits: " << (int)pfd.cAccumBlueBits << llendl ; - LL_INFOS("Window") << "pfd.cAccumAlphaBits: " << (int)pfd.cAccumAlphaBits << llendl ; - LL_INFOS("Window") << "pfd.cDepthBits: " << (int)pfd.cDepthBits << llendl ; - LL_INFOS("Window") << "pfd.cStencilBits: " << (int)pfd.cStencilBits << llendl ; - LL_INFOS("Window") << "pfd.cAuxBuffers: " << (int)pfd.cAuxBuffers << llendl ; - LL_INFOS("Window") << "pfd.iLayerType: " << (int)pfd.iLayerType << llendl ; - LL_INFOS("Window") << "pfd.bReserved: " << (int)pfd.bReserved << llendl ; - LL_INFOS("Window") << "pfd.dwLayerMask: " << pfd.dwLayerMask << llendl ; - LL_INFOS("Window") << "pfd.dwVisibleMask: " << pfd.dwVisibleMask << llendl ; - LL_INFOS("Window") << "pfd.dwDamageMask: " << pfd.dwDamageMask << llendl ; - LL_INFOS("Window") << "--- end pixel format dump ---" << llendl ; + LL_INFOS("Window") << "--- begin pixel format dump ---" << LL_ENDL ; + LL_INFOS("Window") << "pixel_format is " << pixel_format << LL_ENDL ; + LL_INFOS("Window") << "pfd.nSize: " << pfd.nSize << LL_ENDL ; + LL_INFOS("Window") << "pfd.nVersion: " << pfd.nVersion << LL_ENDL ; + LL_INFOS("Window") << "pfd.dwFlags: 0x" << std::hex << pfd.dwFlags << std::dec << LL_ENDL ; + LL_INFOS("Window") << "pfd.iPixelType: " << (int)pfd.iPixelType << LL_ENDL ; + LL_INFOS("Window") << "pfd.cColorBits: " << (int)pfd.cColorBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cRedBits: " << (int)pfd.cRedBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cRedShift: " << (int)pfd.cRedShift << LL_ENDL ; + LL_INFOS("Window") << "pfd.cGreenBits: " << (int)pfd.cGreenBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cGreenShift: " << (int)pfd.cGreenShift << LL_ENDL ; + LL_INFOS("Window") << "pfd.cBlueBits: " << (int)pfd.cBlueBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cBlueShift: " << (int)pfd.cBlueShift << LL_ENDL ; + LL_INFOS("Window") << "pfd.cAlphaBits: " << (int)pfd.cAlphaBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cAlphaShift: " << (int)pfd.cAlphaShift << LL_ENDL ; + LL_INFOS("Window") << "pfd.cAccumBits: " << (int)pfd.cAccumBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cAccumRedBits: " << (int)pfd.cAccumRedBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cAccumGreenBits: " << (int)pfd.cAccumGreenBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cAccumBlueBits: " << (int)pfd.cAccumBlueBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cAccumAlphaBits: " << (int)pfd.cAccumAlphaBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cDepthBits: " << (int)pfd.cDepthBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cStencilBits: " << (int)pfd.cStencilBits << LL_ENDL ; + LL_INFOS("Window") << "pfd.cAuxBuffers: " << (int)pfd.cAuxBuffers << LL_ENDL ; + LL_INFOS("Window") << "pfd.iLayerType: " << (int)pfd.iLayerType << LL_ENDL ; + LL_INFOS("Window") << "pfd.bReserved: " << (int)pfd.bReserved << LL_ENDL ; + LL_INFOS("Window") << "pfd.dwLayerMask: " << pfd.dwLayerMask << LL_ENDL ; + LL_INFOS("Window") << "pfd.dwVisibleMask: " << pfd.dwVisibleMask << LL_ENDL ; + LL_INFOS("Window") << "pfd.dwDamageMask: " << pfd.dwDamageMask << LL_ENDL ; + LL_INFOS("Window") << "--- end pixel format dump ---" << LL_ENDL ; if (pfd.cColorBits < 32) { @@ -1182,7 +1183,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO return FALSE; } - LL_INFOS("Window") << "Drawing context is created." << llendl ; + LL_INFOS("Window") << "Drawing context is created." << LL_ENDL ; gGLManager.initWGL(); @@ -1239,7 +1240,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO while(!result && mFSAASamples > 0) { - llwarns << "FSAASamples: " << mFSAASamples << " not supported." << llendl ; + LL_WARNS() << "FSAASamples: " << mFSAASamples << " not supported." << LL_ENDL ; mFSAASamples /= 2 ; //try to decrease sample pixel number until to disable anti-aliasing if(mFSAASamples < 2) @@ -1261,13 +1262,13 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO if(result) { - llwarns << "Only support FSAASamples: " << mFSAASamples << llendl ; + LL_WARNS() << "Only support FSAASamples: " << mFSAASamples << LL_ENDL ; } } if (!result) { - llwarns << "mFSAASamples: " << mFSAASamples << llendl ; + LL_WARNS() << "mFSAASamples: " << mFSAASamples << LL_ENDL ; close(); show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit"); @@ -1320,7 +1321,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO LL_INFOS("Window") << "Choosing pixel formats: " << num_formats << " pixel formats returned" << LL_ENDL; } - LL_INFOS("Window") << "pixel formats done." << llendl ; + LL_INFOS("Window") << "pixel formats done." << LL_ENDL ; S32 swap_method = 0; S32 cur_format = num_formats-1; @@ -1370,7 +1371,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO mhInstance, NULL); - LL_INFOS("Window") << "recreate window done." << llendl ; + LL_INFOS("Window") << "recreate window done." << LL_ENDL ; if (!(mhDC = GetDC(mWindowHandle))) { @@ -1479,8 +1480,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO } else { - llinfos << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) << - (LLRender::sGLCoreProfile ? " core" : " compatibility") << " context." << llendl; + LL_INFOS() << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) << + (LLRender::sGLCoreProfile ? " core" : " compatibility") << " context." << LL_ENDL; done = true; if (LLRender::sGLCoreProfile) @@ -1822,8 +1823,8 @@ void LLWindowWin32::gatherInput() mMousePositionModified = FALSE; } -static LLFastTimer::DeclareTimer FTM_KEYHANDLER("Handle Keyboard"); -static LLFastTimer::DeclareTimer FTM_MOUSEHANDLER("Handle Mouse"); +static LLTrace::BlockTimerStatHandle FTM_KEYHANDLER("Handle Keyboard"); +static LLTrace::BlockTimerStatHandle FTM_MOUSEHANDLER("Handle Mouse"); LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param) { @@ -1877,8 +1878,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_DEVICECHANGE"); if (gDebugWindowProc) { - llinfos << " WM_DEVICECHANGE: wParam=" << w_param - << "; lParam=" << l_param << llendl; + LL_INFOS() << " WM_DEVICECHANGE: wParam=" << w_param + << "; lParam=" << l_param << LL_ENDL; } if (w_param == DBT_DEVNODES_CHANGED || w_param == DBT_DEVICEARRIVAL) { @@ -2069,7 +2070,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mKeyVirtualKey = w_param; window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYUP"); - LLFastTimer t2(FTM_KEYHANDLER); + LL_RECORD_BLOCK_TIME(FTM_KEYHANDLER); if (gDebugWindowProc) { @@ -2089,7 +2090,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_SETCONTEXT"); if (gDebugWindowProc) { - llinfos << "WM_IME_SETCONTEXT" << llendl; + LL_INFOS() << "WM_IME_SETCONTEXT" << LL_ENDL; } if (LLWinImm::isAvailable() && window_imp->mPreeditor) { @@ -2102,7 +2103,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_STARTCOMPOSITION"); if (gDebugWindowProc) { - llinfos << "WM_IME_STARTCOMPOSITION" << llendl; + LL_INFOS() << "WM_IME_STARTCOMPOSITION" << LL_ENDL; } if (LLWinImm::isAvailable() && window_imp->mPreeditor) { @@ -2115,7 +2116,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_ENDCOMPOSITION"); if (gDebugWindowProc) { - llinfos << "WM_IME_ENDCOMPOSITION" << llendl; + LL_INFOS() << "WM_IME_ENDCOMPOSITION" << LL_ENDL; } if (LLWinImm::isAvailable() && window_imp->mPreeditor) { @@ -2127,7 +2128,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_COMPOSITION"); if (gDebugWindowProc) { - llinfos << "WM_IME_COMPOSITION" << llendl; + LL_INFOS() << "WM_IME_COMPOSITION" << LL_ENDL; } if (LLWinImm::isAvailable() && window_imp->mPreeditor) { @@ -2140,7 +2141,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_IME_REQUEST"); if (gDebugWindowProc) { - llinfos << "WM_IME_REQUEST" << llendl; + LL_INFOS() << "WM_IME_REQUEST" << LL_ENDL; } if (LLWinImm::isAvailable() && window_imp->mPreeditor) { @@ -2188,7 +2189,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_LBUTTONDOWN: { window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONDOWN"); - LLFastTimer t2(FTM_MOUSEHANDLER); + LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); sHandleLeftMouseUp = true; if (LLWinImm::isAvailable() && window_imp->mPreeditor) @@ -2254,7 +2255,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_LBUTTONUP: { window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_LBUTTONUP"); - LLFastTimer t2(FTM_MOUSEHANDLER); + LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); if (!sHandleLeftMouseUp) { @@ -2295,7 +2296,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_RBUTTONDOWN: { window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_RBUTTONDOWN"); - LLFastTimer t2(FTM_MOUSEHANDLER); + LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); if (LLWinImm::isAvailable() && window_imp->mPreeditor) { window_imp->interruptLanguageTextInput(); @@ -2329,7 +2330,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_RBUTTONUP: { window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_RBUTTONUP"); - LLFastTimer t2(FTM_MOUSEHANDLER); + LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); // Because we move the cursor position in the app, we need to query // to find out where the cursor at the time the event is handled. // If we don't do this, many clicks could get buffered up, and if the @@ -2359,7 +2360,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // case WM_MBUTTONDBLCLK: { window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONDOWN"); - LLFastTimer t2(FTM_MOUSEHANDLER); + LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); if (LLWinImm::isAvailable() && window_imp->mPreeditor) { window_imp->interruptLanguageTextInput(); @@ -2393,7 +2394,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_MBUTTONUP: { window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONUP"); - LLFastTimer t2(FTM_MOUSEHANDLER); + LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); // Because we move the cursor position in the llviewer app, we need to query // to find out where the cursor at the time the event is handled. // If we don't do this, many clicks could get buffered up, and if the diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 54c9ac4d4d182fd52349e67caeaf56fa92999b5c..169d264808d18677a807a5520e82783eeab7e750 100755 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -28,9 +28,7 @@ #define LL_LLWINDOWWIN32_H // Limit Windows API to small and manageable set. -#define WIN32_LEAN_AND_MEAN -#include <winsock2.h> -#include <windows.h> +#include "llwin32headerslean.h" #include "llwindow.h" #include "llwindowcallbacks.h" diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp index 97fad7feb0031b4b912e71b426dc3cc33c77b96d..598a802d67a3021e8cda383fe2c29bda4cbc266b 100755 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -141,7 +141,7 @@ LLControlVariable::LLControlVariable(const std::string& name, eControlType type, { if ((persist != PERSIST_NO) && mComment.empty()) { - llerrs << "Must supply a comment for control " << mName << llendl; + LL_ERRS() << "Must supply a comment for control " << mName << LL_ENDL; } //Push back versus setValue'ing here, since we don't want to call a signal yet mValues.push_back(initial); @@ -612,7 +612,7 @@ void LLControlGroup::setUntypedValue(const std::string& name, const LLSD& val) } else { - CONTROL_ERRS << "Invalid control " << name << llendl; + CONTROL_ERRS << "Invalid control " << name << LL_ENDL; } } @@ -914,9 +914,9 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v } else { - llerrs << "Mismatched type of control variable '" + LL_ERRS() << "Mismatched type of control variable '" << name << "' found while loading '" - << filename << "'." << llendl; + << filename << "'." << LL_ENDL; } } else if(existing_control->isPersisted()) @@ -1170,7 +1170,7 @@ bool convert_from_llsd<bool>(const LLSD& sd, eControlType type, const std::strin return sd.asBoolean(); else { - CONTROL_ERRS << "Invalid BOOL value for " << control_name << ": " << sd << llendl; + CONTROL_ERRS << "Invalid BOOL value for " << control_name << ": " << sd << LL_ENDL; return FALSE; } } @@ -1182,7 +1182,7 @@ S32 convert_from_llsd<S32>(const LLSD& sd, eControlType type, const std::string& return sd.asInteger(); else { - CONTROL_ERRS << "Invalid S32 value for " << control_name << ": " << sd << llendl; + CONTROL_ERRS << "Invalid S32 value for " << control_name << ": " << sd << LL_ENDL; return 0; } } @@ -1194,7 +1194,7 @@ U32 convert_from_llsd<U32>(const LLSD& sd, eControlType type, const std::string& return sd.asInteger(); else { - CONTROL_ERRS << "Invalid U32 value for " << control_name << ": " << sd << llendl; + CONTROL_ERRS << "Invalid U32 value for " << control_name << ": " << sd << LL_ENDL; return 0; } } @@ -1206,7 +1206,7 @@ F32 convert_from_llsd<F32>(const LLSD& sd, eControlType type, const std::string& return (F32) sd.asReal(); else { - CONTROL_ERRS << "Invalid F32 value for " << control_name << ": " << sd << llendl; + CONTROL_ERRS << "Invalid F32 value for " << control_name << ": " << sd << LL_ENDL; return 0.0f; } } @@ -1218,7 +1218,7 @@ std::string convert_from_llsd<std::string>(const LLSD& sd, eControlType type, co return sd.asString(); else { - CONTROL_ERRS << "Invalid string value for " << control_name << ": " << sd << llendl; + CONTROL_ERRS << "Invalid string value for " << control_name << ": " << sd << LL_ENDL; return LLStringUtil::null; } } @@ -1236,7 +1236,7 @@ LLVector3 convert_from_llsd<LLVector3>(const LLSD& sd, eControlType type, const return (LLVector3)sd; else { - CONTROL_ERRS << "Invalid LLVector3 value for " << control_name << ": " << sd << llendl; + CONTROL_ERRS << "Invalid LLVector3 value for " << control_name << ": " << sd << LL_ENDL; return LLVector3::zero; } } @@ -1248,7 +1248,7 @@ LLVector3d convert_from_llsd<LLVector3d>(const LLSD& sd, eControlType type, cons return (LLVector3d)sd; else { - CONTROL_ERRS << "Invalid LLVector3d value for " << control_name << ": " << sd << llendl; + CONTROL_ERRS << "Invalid LLVector3d value for " << control_name << ": " << sd << LL_ENDL; return LLVector3d::zero; } } @@ -1260,7 +1260,7 @@ LLRect convert_from_llsd<LLRect>(const LLSD& sd, eControlType type, const std::s return LLRect(sd); else { - CONTROL_ERRS << "Invalid rect value for " << control_name << ": " << sd << llendl; + CONTROL_ERRS << "Invalid rect value for " << control_name << ": " << sd << LL_ENDL; return LLRect::null; } } @@ -1293,7 +1293,7 @@ LLColor4 convert_from_llsd<LLColor4>(const LLSD& sd, eControlType type, const st } else { - CONTROL_ERRS << "Control " << control_name << " not a color" << llendl; + CONTROL_ERRS << "Control " << control_name << " not a color" << LL_ENDL; return LLColor4::white; } } @@ -1305,7 +1305,7 @@ LLColor3 convert_from_llsd<LLColor3>(const LLSD& sd, eControlType type, const st return sd; else { - CONTROL_ERRS << "Invalid LLColor3 value for " << control_name << ": " << sd << llendl; + CONTROL_ERRS << "Invalid LLColor3 value for " << control_name << ": " << sd << LL_ENDL; return LLColor3::white; } } @@ -1340,13 +1340,13 @@ static LLCachedControl<std::string> test_BrowserHomePage("BrowserHomePage", "hah void test_cached_control() { -#define TEST_LLCC(T, V) if((T)mySetting_##T != V) llerrs << "Fail "#T << llendl +#define TEST_LLCC(T, V) if((T)mySetting_##T != V) LL_ERRS() << "Fail "#T << LL_ENDL TEST_LLCC(U32, 666); TEST_LLCC(S32, (S32)-666); TEST_LLCC(F32, (F32)-666.666); TEST_LLCC(bool, true); TEST_LLCC(BOOL, FALSE); - if((std::string)mySetting_string != "Default String Value") llerrs << "Fail string" << llendl; + if((std::string)mySetting_string != "Default String Value") LL_ERRS() << "Fail string" << LL_ENDL; TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f)); TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f)); TEST_LLCC(LLRect, LLRect(0, 0, 100, 500)); @@ -1355,7 +1355,7 @@ void test_cached_control() TEST_LLCC(LLColor4U, LLColor4U(255, 200, 100, 255)); //There's no LLSD comparsion for LLCC yet. TEST_LLCC(LLSD, test_llsd); - if((std::string)test_BrowserHomePage != "http://www.secondlife.com") llerrs << "Fail BrowserHomePage" << llendl; + if((std::string)test_BrowserHomePage != "http://www.secondlife.com") LL_ERRS() << "Fail BrowserHomePage" << LL_ENDL; } #endif // TEST_CACHED_CONTROL diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h index f46d21408bfe2bcd0538679056ef1caab59342b3..04575d81e09d47b7bf636e6a28209ca5eae8af5e 100755 --- a/indra/llxml/llcontrol.h +++ b/indra/llxml/llcontrol.h @@ -29,8 +29,6 @@ #include "llboost.h" #include "llevent.h" -#include "llnametable.h" -#include "llmap.h" #include "llstring.h" #include "llrect.h" #include "llrefcount.h" @@ -166,7 +164,7 @@ typedef LLPointer<LLControlVariable> LLControlVariablePtr; template <class T> eControlType get_control_type() { - llwarns << "Usupported control type: " << typeid(T).name() << "." << llendl; + LL_WARNS() << "Usupported control type: " << typeid(T).name() << "." << LL_ENDL; return TYPE_COUNT; } @@ -258,7 +256,7 @@ class LLControlGroup : public LLInstanceTracker<LLControlGroup, std::string> } else { - llwarns << "Control " << name << " not found." << llendl; + LL_WARNS() << "Control " << name << " not found." << LL_ENDL; return T(); } return convert_from_llsd<T>(value, type, name); @@ -289,7 +287,7 @@ class LLControlGroup : public LLInstanceTracker<LLControlGroup, std::string> } else { - llwarns << "Invalid control " << name << llendl; + LL_WARNS() << "Invalid control " << name << LL_ENDL; } } @@ -325,7 +323,7 @@ class LLControlCache : public LLRefCount, public LLInstanceTracker<LLControlCach { if(!declareTypedControl(group, name, default_value, comment)) { - llerrs << "The control could not be created!!!" << llendl; + LL_ERRS() << "The control could not be created!!!" << LL_ENDL; } } @@ -338,7 +336,7 @@ class LLControlCache : public LLRefCount, public LLInstanceTracker<LLControlCach { if(!group.controlExists(name)) { - llerrs << "Control named " << name << "not found." << llendl; + LL_ERRS() << "Control named " << name << "not found." << LL_ENDL; } bindToControl(group, name); @@ -397,7 +395,6 @@ class LLCachedControl public: LLCachedControl(LLControlGroup& group, const std::string& name, - const T& default_value, const std::string& comment = "Declared In Code") { @@ -408,6 +405,16 @@ class LLCachedControl } } + LLCachedControl(LLControlGroup& group, + const std::string& name) + { + mCachedControlPtr = LLControlCache<T>::getInstance(name); + if (mCachedControlPtr.isNull()) + { + mCachedControlPtr = new LLControlCache<T>(group, name); + } + } + operator const T&() const { return mCachedControlPtr->getValue(); } operator boost::function<const T&()> () const { return boost::function<const T&()>(*this); } const T& operator()() { return mCachedControlPtr->getValue(); } diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 7aa2ce96067063174355c1536e1fa95191251f68..cb99496ef170791b4fa1d12bedaa86de6f91a28b 100755 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -388,7 +388,7 @@ void XMLCALL StartXMLNode(void *userData, if (NULL == parent) { - llwarns << "parent (userData) is NULL; aborting function" << llendl; + LL_WARNS() << "parent (userData) is NULL; aborting function" << LL_ENDL; return; } @@ -576,7 +576,7 @@ bool LLXMLNode::updateNode( if (!node || !update_node) { - llwarns << "Node invalid" << llendl; + LL_WARNS() << "Node invalid" << LL_ENDL; return FALSE; } @@ -700,10 +700,10 @@ bool LLXMLNode::parseBuffer( // Do the parsing if (XML_Parse(my_parser, (const char *)buffer, length, TRUE) != XML_STATUS_OK) { - llwarns << "Error parsing xml error code: " + LL_WARNS() << "Error parsing xml error code: " << XML_ErrorString(XML_GetErrorCode(my_parser)) << " on line " << XML_GetCurrentLineNumber(my_parser) - << llendl; + << LL_ENDL; } // Deinit @@ -711,8 +711,8 @@ bool LLXMLNode::parseBuffer( if (!file_node->mChildren || file_node->mChildren->map.size() != 1) { - llwarns << "Parse failure - wrong number of top-level nodes xml." - << llendl; + LL_WARNS() << "Parse failure - wrong number of top-level nodes xml." + << LL_ENDL; node = NULL ; return false; } @@ -755,10 +755,10 @@ bool LLXMLNode::parseStream( if (XML_Parse(my_parser, (const char *)buffer, count, !str.good()) != XML_STATUS_OK) { - llwarns << "Error parsing xml error code: " + LL_WARNS() << "Error parsing xml error code: " << XML_ErrorString(XML_GetErrorCode(my_parser)) << " on lne " << XML_GetCurrentLineNumber(my_parser) - << llendl; + << LL_ENDL; break; } } @@ -770,8 +770,8 @@ bool LLXMLNode::parseStream( if (!file_node->mChildren || file_node->mChildren->map.size() != 1) { - llwarns << "Parse failure - wrong number of top-level nodes xml." - << llendl; + LL_WARNS() << "Parse failure - wrong number of top-level nodes xml." + << LL_ENDL; node = NULL; return false; } @@ -839,7 +839,7 @@ bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, if (!LLXMLNode::parseFile(filename, root, NULL)) { - llwarns << "Problem reading UI description file: " << filename << llendl; + LL_WARNS() << "Problem reading UI description file: " << filename << LL_ENDL; return false; } @@ -859,7 +859,7 @@ bool LLXMLNode::getLayeredXMLNode(LLXMLNodePtr& root, if (!LLXMLNode::parseFile(layer_filename, updateRoot, NULL)) { - llwarns << "Problem reading localized UI description file: " << layer_filename << llendl; + LL_WARNS() << "Problem reading localized UI description file: " << layer_filename << LL_ENDL; return false; } @@ -898,7 +898,7 @@ void LLXMLNode::writeToFile(LLFILE *out_file, const std::string& indent, bool us size_t written = fwrite(outstring.c_str(), 1, outstring.length(), out_file); if (written != outstring.length()) { - llwarns << "Short write" << llendl; + LL_WARNS() << "Short write" << LL_ENDL; } } @@ -1735,9 +1735,9 @@ U32 LLXMLNode::getBoolValue(U32 expected_length, BOOL *array) #if LL_DEBUG if (ret_length != expected_length) { - lldebugs << "LLXMLNode::getBoolValue() failed for node named '" + LL_DEBUGS() << "LLXMLNode::getBoolValue() failed for node named '" << mName->mString << "' -- expected " << expected_length << " but " - << "only found " << ret_length << llendl; + << "only found " << ret_length << LL_ENDL; } #endif return ret_length; @@ -1756,8 +1756,8 @@ U32 LLXMLNode::getByteValue(U32 expected_length, U8 *array, Encoding encoding) if (mLength > 0 && mLength != expected_length) { - llwarns << "XMLNode::getByteValue asked for " << expected_length - << " elements, while node has " << mLength << llendl; + LL_WARNS() << "XMLNode::getByteValue asked for " << expected_length + << " elements, while node has " << mLength << LL_ENDL; return 0; } @@ -1780,7 +1780,7 @@ U32 LLXMLNode::getByteValue(U32 expected_length, U8 *array, Encoding encoding) } if (value > 255 || is_negative) { - llwarns << "getByteValue: Value outside of valid range." << llendl; + LL_WARNS() << "getByteValue: Value outside of valid range." << LL_ENDL; break; } array[i] = U8(value); @@ -1788,9 +1788,9 @@ U32 LLXMLNode::getByteValue(U32 expected_length, U8 *array, Encoding encoding) #if LL_DEBUG if (i != expected_length) { - lldebugs << "LLXMLNode::getByteValue() failed for node named '" + LL_DEBUGS() << "LLXMLNode::getByteValue() failed for node named '" << mName->mString << "' -- expected " << expected_length << " but " - << "only found " << i << llendl; + << "only found " << i << LL_ENDL; } #endif return i; @@ -1808,8 +1808,8 @@ U32 LLXMLNode::getIntValue(U32 expected_length, S32 *array, Encoding encoding) if (mLength > 0 && mLength != expected_length) { - llwarns << "XMLNode::getIntValue asked for " << expected_length - << " elements, while node has " << mLength << llendl; + LL_WARNS() << "XMLNode::getIntValue asked for " << expected_length + << " elements, while node has " << mLength << LL_ENDL; return 0; } @@ -1832,7 +1832,7 @@ U32 LLXMLNode::getIntValue(U32 expected_length, S32 *array, Encoding encoding) } if (value > 0x7fffffff) { - llwarns << "getIntValue: Value outside of valid range." << llendl; + LL_WARNS() << "getIntValue: Value outside of valid range." << LL_ENDL; break; } array[i] = S32(value) * (is_negative?-1:1); @@ -1841,9 +1841,9 @@ U32 LLXMLNode::getIntValue(U32 expected_length, S32 *array, Encoding encoding) #if LL_DEBUG if (i != expected_length) { - lldebugs << "LLXMLNode::getIntValue() failed for node named '" + LL_DEBUGS() << "LLXMLNode::getIntValue() failed for node named '" << mName->mString << "' -- expected " << expected_length << " but " - << "only found " << i << llendl; + << "only found " << i << LL_ENDL; } #endif return i; @@ -1861,8 +1861,8 @@ U32 LLXMLNode::getUnsignedValue(U32 expected_length, U32 *array, Encoding encodi if (mLength > 0 && mLength != expected_length) { - llwarns << "XMLNode::getUnsignedValue asked for " << expected_length - << " elements, while node has " << mLength << llendl; + LL_WARNS() << "XMLNode::getUnsignedValue asked for " << expected_length + << " elements, while node has " << mLength << LL_ENDL; return 0; } @@ -1886,7 +1886,7 @@ U32 LLXMLNode::getUnsignedValue(U32 expected_length, U32 *array, Encoding encodi } if (is_negative || value > 0xffffffff) { - llwarns << "getUnsignedValue: Value outside of valid range." << llendl; + LL_WARNS() << "getUnsignedValue: Value outside of valid range." << LL_ENDL; break; } array[i] = U32(value); @@ -1895,9 +1895,9 @@ U32 LLXMLNode::getUnsignedValue(U32 expected_length, U32 *array, Encoding encodi #if LL_DEBUG if (i != expected_length) { - lldebugs << "LLXMLNode::getUnsignedValue() failed for node named '" + LL_DEBUGS() << "LLXMLNode::getUnsignedValue() failed for node named '" << mName->mString << "' -- expected " << expected_length << " but " - << "only found " << i << llendl; + << "only found " << i << LL_ENDL; } #endif @@ -1916,7 +1916,7 @@ U32 LLXMLNode::getLongValue(U32 expected_length, U64 *array, Encoding encoding) if (mLength > 0 && mLength != expected_length) { - llwarns << "XMLNode::getLongValue asked for " << expected_length << " elements, while node has " << mLength << llendl; + LL_WARNS() << "XMLNode::getLongValue asked for " << expected_length << " elements, while node has " << mLength << LL_ENDL; return 0; } @@ -1940,7 +1940,7 @@ U32 LLXMLNode::getLongValue(U32 expected_length, U64 *array, Encoding encoding) } if (is_negative) { - llwarns << "getLongValue: Value outside of valid range." << llendl; + LL_WARNS() << "getLongValue: Value outside of valid range." << LL_ENDL; break; } array[i] = value; @@ -1949,9 +1949,9 @@ U32 LLXMLNode::getLongValue(U32 expected_length, U64 *array, Encoding encoding) #if LL_DEBUG if (i != expected_length) { - lldebugs << "LLXMLNode::getLongValue() failed for node named '" + LL_DEBUGS() << "LLXMLNode::getLongValue() failed for node named '" << mName->mString << "' -- expected " << expected_length << " but " - << "only found " << i << llendl; + << "only found " << i << LL_ENDL; } #endif @@ -1970,7 +1970,7 @@ U32 LLXMLNode::getFloatValue(U32 expected_length, F32 *array, Encoding encoding) if (mLength > 0 && mLength != expected_length) { - llwarns << "XMLNode::getFloatValue asked for " << expected_length << " elements, while node has " << mLength << llendl; + LL_WARNS() << "XMLNode::getFloatValue asked for " << expected_length << " elements, while node has " << mLength << LL_ENDL; return 0; } @@ -1995,9 +1995,9 @@ U32 LLXMLNode::getFloatValue(U32 expected_length, F32 *array, Encoding encoding) #if LL_DEBUG if (i != expected_length) { - lldebugs << "LLXMLNode::getFloatValue() failed for node named '" + LL_DEBUGS() << "LLXMLNode::getFloatValue() failed for node named '" << mName->mString << "' -- expected " << expected_length << " but " - << "only found " << i << llendl; + << "only found " << i << LL_ENDL; } #endif return i; @@ -2015,7 +2015,7 @@ U32 LLXMLNode::getDoubleValue(U32 expected_length, F64 *array, Encoding encoding if (mLength > 0 && mLength != expected_length) { - llwarns << "XMLNode::getDoubleValue asked for " << expected_length << " elements, while node has " << mLength << llendl; + LL_WARNS() << "XMLNode::getDoubleValue asked for " << expected_length << " elements, while node has " << mLength << LL_ENDL; return 0; } @@ -2040,9 +2040,9 @@ U32 LLXMLNode::getDoubleValue(U32 expected_length, F64 *array, Encoding encoding #if LL_DEBUG if (i != expected_length) { - lldebugs << "LLXMLNode::getDoubleValue() failed for node named '" + LL_DEBUGS() << "LLXMLNode::getDoubleValue() failed for node named '" << mName->mString << "' -- expected " << expected_length << " but " - << "only found " << i << llendl; + << "only found " << i << LL_ENDL; } #endif return i; @@ -2056,7 +2056,7 @@ U32 LLXMLNode::getStringValue(U32 expected_length, std::string *array) if (mLength > 0 && mLength != expected_length) { - llwarns << "XMLNode::getStringValue asked for " << expected_length << " elements, while node has " << mLength << llendl; + LL_WARNS() << "XMLNode::getStringValue asked for " << expected_length << " elements, while node has " << mLength << LL_ENDL; return 0; } @@ -2088,9 +2088,9 @@ U32 LLXMLNode::getStringValue(U32 expected_length, std::string *array) #if LL_DEBUG if (num_returned_strings != expected_length) { - lldebugs << "LLXMLNode::getStringValue() failed for node named '" + LL_DEBUGS() << "LLXMLNode::getStringValue() failed for node named '" << mName->mString << "' -- expected " << expected_length << " but " - << "only found " << num_returned_strings << llendl; + << "only found " << num_returned_strings << LL_ENDL; } #endif @@ -2133,9 +2133,9 @@ U32 LLXMLNode::getUUIDValue(U32 expected_length, LLUUID *array) #if LL_DEBUG if (i != expected_length) { - lldebugs << "LLXMLNode::getUUIDValue() failed for node named '" + LL_DEBUGS() << "LLXMLNode::getUUIDValue() failed for node named '" << mName->mString << "' -- expected " << expected_length << " but " - << "only found " << i << llendl; + << "only found " << i << LL_ENDL; } #endif return i; @@ -2164,11 +2164,11 @@ U32 LLXMLNode::getNodeRefValue(U32 expected_length, LLXMLNode **array) root->findID(string_array[strnum], node_list); if (node_list.empty()) { - llwarns << "XML: Could not find node ID: " << string_array[strnum] << llendl; + LL_WARNS() << "XML: Could not find node ID: " << string_array[strnum] << LL_ENDL; } else if (node_list.size() > 1) { - llwarns << "XML: Node ID not unique: " << string_array[strnum] << llendl; + LL_WARNS() << "XML: Node ID not unique: " << string_array[strnum] << LL_ENDL; } else { diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index ec486d7957eb8e030bb9769d5dd7cdc6f9af7f3f..7ffc8a4b174516c836ee155e11ebf2db3e6c6ee9 100755 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -38,17 +38,16 @@ #include <map> #include "indra_constants.h" +#include "llrefcount.h" #include "llpointer.h" -#include "llthread.h" // LLThreadSafeRefCount #include "llstring.h" #include "llstringtable.h" #include "llfile.h" - +#include "lluuid.h" class LLVector3; class LLVector3d; class LLQuaternion; -class LLUUID; class LLColor4; class LLColor4U; diff --git a/indra/llxml/llxmlparser.cpp b/indra/llxml/llxmlparser.cpp index 7db4a90b575698d1f8dc8f5fd87585ca46759852..1bdc283f670e67f080571c1cb45f69f629ee9f43 100755 --- a/indra/llxml/llxmlparser.cpp +++ b/indra/llxml/llxmlparser.cpp @@ -121,7 +121,7 @@ BOOL LLXmlParser::parseFile(const std::string &path) if( !success ) { - llwarns << mAuxErrorString << llendl; + LL_WARNS() << mAuxErrorString << LL_ENDL; } return success; diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp index f2386700a14013d81ffd26e282d222a4a41b68be..ca98953f9283d90065e7d134bedcfbdfc0740681 100755 --- a/indra/llxml/llxmltree.cpp +++ b/indra/llxml/llxmltree.cpp @@ -72,7 +72,7 @@ BOOL LLXmlTree::parseFile(const std::string &path, BOOL keep_contents) { S32 line_number = parser.getCurrentLineNumber(); const char* error = parser.getErrorString(); - llwarns << "LLXmlTree parse failed. Line " << line_number << ": " << error << llendl; + LL_WARNS() << "LLXmlTree parse failed. Line " << line_number << ": " << error << LL_ENDL; } return success; } @@ -118,19 +118,19 @@ LLXmlTreeNode::~LLXmlTreeNode() void LLXmlTreeNode::dump( const std::string& prefix ) { - llinfos << prefix << mName ; + LL_INFOS() << prefix << mName ; if( !mContents.empty() ) { - llcont << " contents = \"" << mContents << "\""; + LL_CONT << " contents = \"" << mContents << "\""; } attribute_map_t::iterator iter; for (iter=mAttributes.begin(); iter != mAttributes.end(); iter++) { LLStdStringHandle key = iter->first; const std::string* value = iter->second; - llcont << prefix << " " << key << "=" << (value->empty() ? "NULL" : *value); + LL_CONT << prefix << " " << key << "=" << (value->empty() ? "NULL" : *value); } - llcont << llendl; + LL_CONT << LL_ENDL; } BOOL LLXmlTreeNode::hasAttribute(const std::string& name) @@ -551,12 +551,12 @@ void LLXmlTreeParser::startElement(const char* name, const char **atts) { if( mDump ) { - llinfos << tabs() << "startElement " << name << llendl; + LL_INFOS() << tabs() << "startElement " << name << LL_ENDL; S32 i = 0; while( atts[i] && atts[i+1] ) { - llinfos << tabs() << "attribute: " << atts[i] << "=" << atts[i+1] << llendl; + LL_INFOS() << tabs() << "attribute: " << atts[i] << "=" << atts[i+1] << LL_ENDL; i += 2; } } @@ -593,7 +593,7 @@ void LLXmlTreeParser::endElement(const char* name) { if( mDump ) { - llinfos << tabs() << "endElement " << name << llendl; + LL_INFOS() << tabs() << "endElement " << name << LL_ENDL; } if( !mCurrent->mContents.empty() ) @@ -611,7 +611,7 @@ void LLXmlTreeParser::characterData(const char *s, int len) if (s) str = std::string(s, len); if( mDump ) { - llinfos << tabs() << "CharacterData " << str << llendl; + LL_INFOS() << tabs() << "CharacterData " << str << LL_ENDL; } if (mKeepContents) @@ -624,7 +624,7 @@ void LLXmlTreeParser::processingInstruction(const char *target, const char *data { if( mDump ) { - llinfos << tabs() << "processingInstruction " << data << llendl; + LL_INFOS() << tabs() << "processingInstruction " << data << LL_ENDL; } } @@ -632,7 +632,7 @@ void LLXmlTreeParser::comment(const char *data) { if( mDump ) { - llinfos << tabs() << "comment " << data << llendl; + LL_INFOS() << tabs() << "comment " << data << LL_ENDL; } } @@ -640,7 +640,7 @@ void LLXmlTreeParser::startCdataSection() { if( mDump ) { - llinfos << tabs() << "startCdataSection" << llendl; + LL_INFOS() << tabs() << "startCdataSection" << LL_ENDL; } } @@ -648,7 +648,7 @@ void LLXmlTreeParser::endCdataSection() { if( mDump ) { - llinfos << tabs() << "endCdataSection" << llendl; + LL_INFOS() << tabs() << "endCdataSection" << LL_ENDL; } } @@ -658,7 +658,7 @@ void LLXmlTreeParser::defaultData(const char *s, int len) { std::string str; if (s) str = std::string(s, len); - llinfos << tabs() << "defaultData " << str << llendl; + LL_INFOS() << tabs() << "defaultData " << str << LL_ENDL; } } @@ -671,12 +671,12 @@ void LLXmlTreeParser::unparsedEntityDecl( { if( mDump ) { - llinfos << tabs() << "unparsed entity:" << llendl; - llinfos << tabs() << " entityName " << entity_name << llendl; - llinfos << tabs() << " base " << base << llendl; - llinfos << tabs() << " systemId " << system_id << llendl; - llinfos << tabs() << " publicId " << public_id << llendl; - llinfos << tabs() << " notationName " << notation_name<< llendl; + LL_INFOS() << tabs() << "unparsed entity:" << LL_ENDL; + LL_INFOS() << tabs() << " entityName " << entity_name << LL_ENDL; + LL_INFOS() << tabs() << " base " << base << LL_ENDL; + LL_INFOS() << tabs() << " systemId " << system_id << LL_ENDL; + LL_INFOS() << tabs() << " publicId " << public_id << LL_ENDL; + LL_INFOS() << tabs() << " notationName " << notation_name<< LL_ENDL; } } diff --git a/indra/llxml/llxmltree.h b/indra/llxml/llxmltree.h index bdcb56f1f30d2cbbb43d52ec8258485de576fc57..a82fee041612a1697289d3c1b0b868f717dfd243 100755 --- a/indra/llxml/llxmltree.h +++ b/indra/llxml/llxmltree.h @@ -32,7 +32,7 @@ #include <list> #include "llstring.h" #include "llxmlparser.h" -#include "string_table.h" +#include "llstringtable.h" class LLColor4; class LLColor4U; @@ -227,7 +227,7 @@ class LLXmlTreeParser : public LLXmlParser LLXmlTree* mTree; LLXmlTreeNode* mRoot; LLXmlTreeNode* mCurrent; - BOOL mDump; // Dump parse tree to llinfos as it is read. + BOOL mDump; // Dump parse tree to LL_INFOS() as it is read. BOOL mKeepContents; }; diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index 05db551227662118df1e2ffa95ef625b6dd93075..7772c95609269cc3a19c64749ef630a776fc15d2 100755 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -25,7 +25,6 @@ FS (f|F) #include "indra.y.hpp" #include "lltimer.h" #include "indra_constants.h" -#include "llagentconstants.h" #include "lllslconstants.h" #include "lluuid.h" #include "llassetstorage.h" diff --git a/indra/lscript/lscript_compile/lscript_bytecode.cpp b/indra/lscript/lscript_compile/lscript_bytecode.cpp index 95b2f35a94ecb8c4c1c104791ac1b74c57f0e187..667e5dafc1b0ec9256c652fd63f85910d083dff1 100755 --- a/indra/lscript/lscript_compile/lscript_bytecode.cpp +++ b/indra/lscript/lscript_compile/lscript_bytecode.cpp @@ -40,8 +40,8 @@ LLScriptJumpTable::LLScriptJumpTable() LLScriptJumpTable::~LLScriptJumpTable() { - mLabelMap.deleteAllData(); - mJumpMap.deleteAllData(); + delete_and_clear(mLabelMap); + delete_and_clear(mJumpMap); } void LLScriptJumpTable::addLabel(char *name, S32 offset) @@ -203,17 +203,14 @@ void LLScriptByteCodeChunk::addJump(char *name) void LLScriptByteCodeChunk::connectJumps() { - char *jump; - S32 offset, jumppos; - if (mJumpTable) { - for (jump = mJumpTable->mJumpMap.getFirstKey(); - jump; - jump = mJumpTable->mJumpMap.getNextKey()) + for(std::map<char *, S32 *>::iterator it = mJumpTable->mJumpMap.begin(), end_it = mJumpTable->mJumpMap.end(); + it != end_it; + ++it) { - jumppos = *mJumpTable->mJumpMap[jump]; - offset = *mJumpTable->mLabelMap[jump] - jumppos; + S32 jumppos = *it->second; + S32 offset = *mJumpTable->mLabelMap[it->first] - jumppos; jumppos = jumppos - 4; integer2bytestream(mCodeChunk, jumppos, offset); } @@ -308,7 +305,7 @@ void LLScriptScriptCodeChunk::build(LLFILE *efp, LLFILE *bcfp) if (fwrite(mCompleteCode, 1, mTotalSize, bcfp) != (size_t)mTotalSize) { - llwarns << "Short write" << llendl; + LL_WARNS() << "Short write" << LL_ENDL; } } else diff --git a/indra/lscript/lscript_compile/lscript_bytecode.h b/indra/lscript/lscript_compile/lscript_bytecode.h index 0933c78b6f77b32e71e37914f540a9aee3ced763..1908bebcb9a9bb84b4c315a2760eb490ed38db8f 100755 --- a/indra/lscript/lscript_compile/lscript_bytecode.h +++ b/indra/lscript/lscript_compile/lscript_bytecode.h @@ -29,6 +29,7 @@ #include "lscript_byteconvert.h" #include "lscript_scope.h" +#include <map> class LLScriptJumpTable { @@ -39,8 +40,8 @@ class LLScriptJumpTable void addLabel(char *name, S32 offset); void addJump(char *name, S32 offset); - LLMap<char *, S32 *> mLabelMap; - LLMap<char *, S32 *> mJumpMap; + std::map<char *, S32 *> mLabelMap; + std::map<char *, S32 *> mJumpMap; }; class LLScriptByteCodeChunk diff --git a/indra/lscript/lscript_compile/lscript_scope.h b/indra/lscript/lscript_compile/lscript_scope.h index 5b2a73ad92e4d83bfffbe1de7c0da793fcf5ebec..ffff91c81bc0a3cc01fbf5ff4c030aac944ac2e3 100755 --- a/indra/lscript/lscript_compile/lscript_scope.h +++ b/indra/lscript/lscript_compile/lscript_scope.h @@ -27,8 +27,8 @@ #ifndef LL_LSCRIPT_SCOPE_H #define LL_LSCRIPT_SCOPE_H -#include "string_table.h" -#include "llmap.h" +#include <map> +#include "llstringtable.h" #include "lscript_byteformat.h" typedef enum e_lscript_identifier_type @@ -301,13 +301,13 @@ class LLScriptScope ~LLScriptScope() { - mEntryMap.deleteAllData(); + delete_and_clear(mEntryMap); } LLScriptScopeEntry *addEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type) { const char *name = mSTable->addString(identifier); - if (!mEntryMap.checkData(name)) + if (mEntryMap.find(name) == mEntryMap.end()) { if (idtype == LIT_FUNCTION) mEntryMap[name] = new LLScriptScopeEntry(name, idtype, type, mFunctionCount++); @@ -324,18 +324,10 @@ class LLScriptScope } } - BOOL checkEntry(const char *identifier) + bool checkEntry(const char *identifier) { const char *name = mSTable->addString(identifier); - if (mEntryMap.checkData(name)) - { - return TRUE; - } - else - { - // identifier already exists at this scope - return FALSE; - } + return mEntryMap.find(name) != mEntryMap.end(); } LLScriptScopeEntry *findEntry(const char *identifier) @@ -345,10 +337,11 @@ class LLScriptScope while (scope) { - if (scope->mEntryMap.checkData(name)) + entry_map_t::iterator found_it = mEntryMap.find(name); + if (found_it != mEntryMap.end()) { // cool, we found it at this scope - return scope->mEntryMap[name]; + return found_it->second; } scope = scope->mParentScope; } @@ -362,24 +355,25 @@ class LLScriptScope while (scope) { - if (scope->mEntryMap.checkData(name)) + entry_map_t::iterator found_it = scope->mEntryMap.find(name); + if (found_it != scope->mEntryMap.end()) { // need to check type, and if type is function we need to check both types if (idtype == LIT_FUNCTION) { - if (scope->mEntryMap[name]->mIDType == LIT_FUNCTION) + if (found_it->second->mIDType == LIT_FUNCTION) { - return scope->mEntryMap[name]; + return (found_it->second); } - else if (scope->mEntryMap[name]->mIDType == LIT_LIBRARY_FUNCTION) + else if (found_it->second->mIDType == LIT_LIBRARY_FUNCTION) { - return scope->mEntryMap[name]; + return (found_it->second); } } - else if (scope->mEntryMap[name]->mIDType == idtype) + else if (found_it->second->mIDType == idtype) { // cool, we found it at this scope - return scope->mEntryMap[name]; + return (found_it->second); } } scope = scope->mParentScope; @@ -392,11 +386,12 @@ class LLScriptScope mParentScope = scope; } - LLMap<const char *, LLScriptScopeEntry *> mEntryMap; - LLScriptScope *mParentScope; - LLStringTable *mSTable; - S32 mFunctionCount; - S32 mStateCount; + typedef std::map<const char *, LLScriptScopeEntry *> entry_map_t; + entry_map_t mEntryMap; + LLScriptScope* mParentScope; + LLStringTable* mSTable; + S32 mFunctionCount; + S32 mStateCount; }; extern LLStringTable *gScopeStringTable; diff --git a/indra/lscript/lscript_compile/lscript_tree.h b/indra/lscript/lscript_compile/lscript_tree.h index bf29f44518643b5ba37a47aae0b5dbbdb435b173..047c220b172479b4a7d8abd682650790983ab756 100755 --- a/indra/lscript/lscript_compile/lscript_tree.h +++ b/indra/lscript/lscript_compile/lscript_tree.h @@ -29,7 +29,6 @@ #include "v3math.h" #include "llquaternion.h" -#include "linked_lists.h" #include "lscript_error.h" #include "lscript_typecheck.h" #include "lscript_byteformat.h" @@ -2304,20 +2303,20 @@ class LLScriptAllocationManager LLScriptAllocationManager() {} ~LLScriptAllocationManager() { - mAllocationList.deleteAllData(); + deleteAllocations(); } void addAllocation(LLScriptFilePosition *ptr) { - mAllocationList.addData(ptr); + mAllocationList.push_front(ptr); } void deleteAllocations() { - mAllocationList.deleteAllData(); + delete_and_clear(mAllocationList); } - LLLinkedList<LLScriptFilePosition> mAllocationList; + std::list<LLScriptFilePosition*> mAllocationList; }; extern LLScriptAllocationManager *gAllocationManager; diff --git a/indra/lscript/lscript_execute.h b/indra/lscript/lscript_execute.h index fc491ead0fec38ab75ac573be0f0a69fd068150a..576c2ca2b71423a088689df3d11fb9e93e3fa4c7 100755 --- a/indra/lscript/lscript_execute.h +++ b/indra/lscript/lscript_execute.h @@ -27,9 +27,10 @@ #ifndef LL_LSCRIPT_EXECUTE_H #define LL_LSCRIPT_EXECUTE_H +#include "stdtypes.h" #include "lscript_byteconvert.h" -#include "linked_lists.h" #include "lscript_library.h" +#include "llstl.h" class LLTimer; @@ -262,7 +263,7 @@ class LLScriptEventData S32 i, number = bytestream2integer(src, offset); for (i = 0; i < number; i++) { - mEventDataList.addData(new LLScriptDataCollection(src, offset)); + mEventDataList.push_front(new LLScriptDataCollection(src, offset)); } } @@ -271,32 +272,32 @@ class LLScriptEventData S32 i, number = bytestream2integer(src, offset); for (i = 0; i < number; i++) { - mEventDataList.addData(new LLScriptDataCollection(src, offset)); + mEventDataList.push_front(new LLScriptDataCollection(src, offset)); } } ~LLScriptEventData() { - mEventDataList.deleteAllData(); + delete_and_clear(mEventDataList); } void addEventData(LLScriptDataCollection *data) { - if (mEventDataList.getLength() < MAX_EVENTS_IN_QUEUE) - mEventDataList.addDataAtEnd(data); + if (mEventDataList.size() < MAX_EVENTS_IN_QUEUE) + mEventDataList.push_back(data); else delete data; } LLScriptDataCollection *getNextEvent(LSCRIPTStateEventType type) { - LLScriptDataCollection *temp; - for (temp = mEventDataList.getFirstData(); - temp; - temp = mEventDataList.getNextData()) + for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end(); + it != end_it; + ++it) { + LLScriptDataCollection* temp = *it; if (temp->mType == type) { - mEventDataList.removeCurrentData(); + mEventDataList.erase(it); return temp; } } @@ -305,24 +306,24 @@ class LLScriptEventData LLScriptDataCollection *getNextEvent() { LLScriptDataCollection *temp; - temp = mEventDataList.getFirstData(); + temp = mEventDataList.front(); if (temp) { - mEventDataList.removeCurrentData(); + mEventDataList.pop_front(); return temp; } return NULL; } void removeEventType(LSCRIPTStateEventType type) { - LLScriptDataCollection *temp; - for (temp = mEventDataList.getFirstData(); - temp; - temp = mEventDataList.getNextData()) + for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end(); + it != end_it; + ++it) { - if (temp->mType == type) + if ((*it)->mType == type) { - mEventDataList.deleteCurrentData(); + delete *it; + mEventDataList.erase(it); } } } @@ -332,12 +333,11 @@ class LLScriptEventData S32 size = 0; // number in linked list size += 4; - LLScriptDataCollection *temp; - for (temp = mEventDataList.getFirstData(); - temp; - temp = mEventDataList.getNextData()) + for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end(); + it != end_it; + ++it) { - size += temp->getSavedSize(); + size += (*it)->getSavedSize(); } return size; } @@ -346,19 +346,18 @@ class LLScriptEventData { S32 offset = 0; // number in linked list - S32 number = mEventDataList.getLength(); + S32 number = mEventDataList.size(); integer2bytestream(dest, offset, number); - LLScriptDataCollection *temp; - for (temp = mEventDataList.getFirstData(); - temp; - temp = mEventDataList.getNextData()) + for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end(); + it != end_it; + ++it) { - offset += temp->write2bytestream(dest + offset); + offset += (*it)->write2bytestream(dest + offset); } return offset; } - LLLinkedList<LLScriptDataCollection> mEventDataList; + std::list<LLScriptDataCollection*> mEventDataList; }; class LLScriptExecute @@ -474,9 +473,9 @@ class LLScriptExecuteLSL2 : public LLScriptExecute virtual ~LLScriptExecuteLSL2(); virtual S32 getVersion() const {return get_register(mBuffer, LREG_VN);} - virtual void deleteAllEvents() {mEventData.mEventDataList.deleteAllData();} + virtual void deleteAllEvents() {delete_and_clear(mEventData.mEventDataList);} virtual void addEvent(LLScriptDataCollection* event); - virtual U32 getEventCount() {return mEventData.mEventDataList.getLength();} + virtual U32 getEventCount() {return mEventData.mEventDataList.size();} virtual void removeEventType(LSCRIPTStateEventType event_type); virtual S32 getFaults() {return get_register(mBuffer, LREG_FR);} virtual void setFault(LSCRIPTRunTimeFaults fault) {set_fault(mBuffer, fault);} diff --git a/indra/lscript/lscript_execute/llscriptresourceconsumer.cpp b/indra/lscript/lscript_execute/llscriptresourceconsumer.cpp index 55d47b6de25cb90807eba43cc2c125995fb8145f..0ce5eb7dab52c2971cacf5b67d277497192cca1b 100755 --- a/indra/lscript/lscript_execute/llscriptresourceconsumer.cpp +++ b/indra/lscript/lscript_execute/llscriptresourceconsumer.cpp @@ -56,7 +56,7 @@ bool LLScriptResourceConsumer::switchScriptResourcePools(LLScriptResourcePool& n { if (&new_pool == &LLScriptResourcePool::null) { - llwarns << "New pool is null" << llendl; + LL_WARNS() << "New pool is null" << LL_ENDL; } if (isInPool(new_pool)) diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index b12d2e4a1693bf2b9dff36e9df6c3d3315ffa535..5eb7ffc5a91bf038568675fe0e7e451ac93d9852 100755 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -35,7 +35,6 @@ #include "lscript_library.h" #include "lscript_heapruntime.h" #include "lscript_alloc.h" -#include "llstat.h" // Static @@ -77,7 +76,7 @@ LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp) S32 pos = 0; if (fread(&sizearray, 1, 4, fp) != 4) { - llwarns << "Short read" << llendl; + LL_WARNS() << "Short read" << LL_ENDL; filesize = 0; } else { filesize = bytestream2integer(sizearray, pos); @@ -86,7 +85,7 @@ LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp) fseek(fp, 0, SEEK_SET); if (fread(mBuffer, 1, filesize, fp) != filesize) { - llwarns << "Short read" << llendl; + LL_WARNS() << "Short read" << LL_ENDL; } fclose(fp); @@ -290,7 +289,7 @@ void LLScriptExecuteLSL2::init() void LLScriptExecuteLSL2::recordBoundaryError( const LLUUID &id ) { set_fault(mBuffer, LSRF_BOUND_CHECK_ERROR); - llwarns << "Script boundary error for ID " << id << llendl; + LL_WARNS() << "Script boundary error for ID " << id << LL_ENDL; } @@ -418,10 +417,13 @@ void LLScriptExecuteLSL2::callEventHandler(LSCRIPTStateEventType event, const LL void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice) { S32 major_version = getMajorVersion(); - LLScriptDataCollection* eventdata; - for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData()) + for (std::list<LLScriptDataCollection*>::iterator it = mEventData.mEventDataList.begin(), end_it = mEventData.mEventDataList.end(); + it != end_it; + ++it) { + LLScriptDataCollection* eventdata = *it; + if (eventdata->mType == event) { // push a zero to be popped @@ -459,7 +461,8 @@ void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, co S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); set_ip(mBuffer, opcode_start); - mEventData.mEventDataList.deleteCurrentData(); + delete *it; + mEventData.mEventDataList.erase(it); break; } } @@ -514,7 +517,7 @@ void LLScriptExecuteLSL2::callNextQueuedEventHandler(U64 event_register, const L } else { - llwarns << "Somehow got an event that we're not registered for!" << llendl; + LL_WARNS() << "Somehow got an event that we're not registered for!" << LL_ENDL; } delete eventdata; } @@ -622,7 +625,7 @@ S32 LLScriptExecuteLSL2::writeState(U8 **dest, U32 header_size, U32 footer_size) // registers integer2bytestream(*dest, dest_offset, registers_size); - // llinfos << "Writing CE: " << getCurrentEvents() << llendl; + // LL_INFOS() << "Writing CE: " << getCurrentEvents() << LL_ENDL; bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, registers_size); // heap @@ -674,11 +677,11 @@ S32 LLScriptExecuteLSL2::readState(U8 *src) // copy data into register area bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); -// llinfos << "Read CE: " << getCurrentEvents() << llendl; +// LL_INFOS() << "Read CE: " << getCurrentEvents() << LL_ENDL; if (get_register(mBuffer, LREG_TM) != TOP_OF_MEMORY) { - llwarns << "Invalid state. Top of memory register does not match" - << " constant." << llendl; + LL_WARNS() << "Invalid state. Top of memory register does not match" + << " constant." << LL_ENDL; reset_hp_to_safe_spot(mBuffer); return -1; } @@ -4021,7 +4024,7 @@ void lscript_run(const std::string& filename, BOOL b_debug) if (filename.empty()) { - llerrs << "filename is NULL" << llendl; + LL_ERRS() << "filename is NULL" << LL_ENDL; // Just reporting error is likely not enough. Need // to check how to abort or error out gracefully // from this function. XXXTBD @@ -4046,8 +4049,8 @@ void lscript_run(const std::string& filename, BOOL b_debug) F32 time = timer.getElapsedTimeF32(); F32 ips = execute->mInstructionCount / time; - llinfos << execute->mInstructionCount << " instructions in " << time << " seconds" << llendl; - llinfos << ips/1000 << "K instructions per second" << llendl; + LL_INFOS() << execute->mInstructionCount << " instructions in " << time << " seconds" << LL_ENDL; + LL_INFOS() << ips/1000 << "K instructions per second" << LL_ENDL; printf("ip: 0x%X\n", get_register(execute->mBuffer, LREG_IP)); printf("sp: 0x%X\n", get_register(execute->mBuffer, LREG_SP)); printf("bp: 0x%X\n", get_register(execute->mBuffer, LREG_BP)); diff --git a/indra/lscript/lscript_execute/lscript_readlso.cpp b/indra/lscript/lscript_execute/lscript_readlso.cpp index 6384a571008f74e6bbf2d36b6151f44280aa8a2e..7ec56c2409fd73031b440b647f585a38008bdaf8 100755 --- a/indra/lscript/lscript_execute/lscript_readlso.cpp +++ b/indra/lscript/lscript_execute/lscript_readlso.cpp @@ -37,7 +37,7 @@ LLScriptLSOParse::LLScriptLSOParse(LLFILE *fp) S32 pos = 0; if (fread(&sizearray, 1, 4, fp) != 4) { - llwarns << "Short read" << llendl; + LL_WARNS() << "Short read" << LL_ENDL; filesize = 0; } else { filesize = bytestream2integer(sizearray, pos); @@ -46,7 +46,7 @@ LLScriptLSOParse::LLScriptLSOParse(LLFILE *fp) fseek(fp, 0, SEEK_SET); if (fread(mRawData, 1, filesize, fp) != filesize) { - llwarns << "Short read" << llendl; + LL_WARNS() << "Short read" << LL_ENDL; } initOpCodePrinting(); diff --git a/indra/lscript/lscript_execute/lscript_readlso.h b/indra/lscript/lscript_execute/lscript_readlso.h index a545a9daf8bc2bdf91abfeb2afda4d59aace2b94..f3b2b66746a0f92c23c51e57db76921dedad91af 100755 --- a/indra/lscript/lscript_execute/lscript_readlso.h +++ b/indra/lscript/lscript_execute/lscript_readlso.h @@ -28,7 +28,6 @@ #define LL_LSCRIPT_READLSO_H #include "lscript_byteconvert.h" -#include "linked_lists.h" // list of op code print functions void print_noop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); diff --git a/indra/lscript/lscript_library.h b/indra/lscript/lscript_library.h index 89a473a6271d8a2ad3cad2a766f514decb46f147..f3dbb091962abb1ac8eb0a0da3cee2fb5beeb1c4 100755 --- a/indra/lscript/lscript_library.h +++ b/indra/lscript/lscript_library.h @@ -240,7 +240,7 @@ class LLScriptLibData mKey = new char[strlen(data.mKey) + 1]; /* Flawfinder: ignore */ if (mKey == NULL) { - llerrs << "Memory Allocation Failed" << llendl; + LL_ERRS() << "Memory Allocation Failed" << LL_ENDL; return; } strcpy(mKey, data.mKey); /* Flawfinder: ignore */ @@ -250,7 +250,7 @@ class LLScriptLibData mString = new char[strlen(data.mString) + 1]; /* Flawfinder: ignore */ if (mString == NULL) { - llerrs << "Memory Allocation Failed" << llendl; + LL_ERRS() << "Memory Allocation Failed" << LL_ENDL; return; } strcpy(mString, data.mString); /* Flawfinder: ignore */ @@ -275,7 +275,7 @@ class LLScriptLibData mKey = new char[strlen(temp) + 1]; /* Flawfinder: ignore */ if (mKey == NULL) { - llerrs << "Memory Allocation Failed" << llendl; + LL_ERRS() << "Memory Allocation Failed" << LL_ENDL; return; } strcpy(mKey, temp); /* Flawfinder: ignore */ @@ -287,7 +287,7 @@ class LLScriptLibData mString = new char[strlen(temp) + 1]; /* Flawfinder: ignore */ if (mString == NULL) { - llerrs << "Memory Allocation Failed" << llendl; + LL_ERRS() << "Memory Allocation Failed" << LL_ENDL; return; } strcpy(mString, temp); /* Flawfinder: ignore */ @@ -324,7 +324,7 @@ class LLScriptLibData mKey = new char[strlen(temp) + 1]; /* Flawfinder: ignore */ if (mKey == NULL) { - llerrs << "Memory Allocation Failed" << llendl; + LL_ERRS() << "Memory Allocation Failed" << LL_ENDL; return; } strcpy(mKey, temp); /* Flawfinder: ignore */ @@ -336,7 +336,7 @@ class LLScriptLibData mString = new char[strlen(temp) + 1]; /* Flawfinder: ignore */ if (mString == NULL) { - llerrs << "Memory Allocation Failed" << llendl; + LL_ERRS() << "Memory Allocation Failed" << LL_ENDL; return; } strcpy(mString, temp); /* Flawfinder: ignore */ @@ -364,7 +364,7 @@ class LLScriptLibData mString = new char[strlen(src) + 1]; /* Flawfinder: ignore */ if (mString == NULL) { - llerrs << "Memory Allocation Failed" << llendl; + LL_ERRS() << "Memory Allocation Failed" << LL_ENDL; return; } strcpy(mString, src); /* Flawfinder: ignore */ @@ -398,7 +398,7 @@ class LLScriptLibData mString = new char[strlen(string) + 1]; /* Flawfinder: ignore */ if (mString == NULL) { - llerrs << "Memory Allocation Failed" << llendl; + LL_ERRS() << "Memory Allocation Failed" << LL_ENDL; return; } strcpy(mString, string); /* Flawfinder: ignore */ diff --git a/indra/lscript/lscript_library/lscript_alloc.cpp b/indra/lscript/lscript_library/lscript_alloc.cpp index 92b1ab70fba90cf1d5625c6e4eda3279151dcbb0..62ba029e8aaf44bb5b7698be8a23c8c212819206 100755 --- a/indra/lscript/lscript_library/lscript_alloc.cpp +++ b/indra/lscript/lscript_library/lscript_alloc.cpp @@ -435,7 +435,7 @@ S32 lsa_create_data_block(U8 **buffer, LLScriptLibData *data, S32 base_offset) U8 *tbuff = new U8[size + listsize]; if (tbuff == NULL) { - llerrs << "Memory Allocation Failed" << llendl; + LL_ERRS() << "Memory Allocation Failed" << LL_ENDL; } memcpy(tbuff, *buffer, size); /*Flawfinder: ignore*/ memcpy(tbuff + size, listbuf, listsize); /*Flawfinder: ignore*/ diff --git a/indra/lscript/lscript_library/lscript_library.cpp b/indra/lscript/lscript_library/lscript_library.cpp index 7ffe53a3076a8be0d30049d5a64c8bb0c4e12ecb..84ce94eead1861810b7832fdf4d6bb30435e3ee0 100755 --- a/indra/lscript/lscript_library/lscript_library.cpp +++ b/indra/lscript/lscript_library/lscript_library.cpp @@ -498,7 +498,7 @@ void LLScriptLibrary::assignExec(const char *name, void (*exec_func)(LLScriptLib } } - llerrs << "Unknown LSL function in assignExec: " << name << llendl; + LL_ERRS() << "Unknown LSL function in assignExec: " << name << LL_ENDL; } void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma) diff --git a/indra/mac_crash_logger/mac_crash_logger.cpp b/indra/mac_crash_logger/mac_crash_logger.cpp index 2c83f3439dd3c5ab862c932df3b5863f12b7ed00..d6b913829ec8d0c15e1a304907b32a5a3d628190 100755 --- a/indra/mac_crash_logger/mac_crash_logger.cpp +++ b/indra/mac_crash_logger/mac_crash_logger.cpp @@ -46,7 +46,7 @@ int main(int argc, char **argv) if (! app.init()) { - llwarns << "Unable to initialize application." << llendl; + LL_WARNS() << "Unable to initialize application." << LL_ENDL; return 1; } if (app.getCrashBehavior() != CRASH_BEHAVIOR_ALWAYS_SEND) @@ -56,7 +56,7 @@ int main(int argc, char **argv) app.mainLoop(); app.cleanup(); - llinfos << "Crash reporter finished normally." << llendl; + LL_INFOS() << "Crash reporter finished normally." << LL_ENDL; return 0; } diff --git a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp index 2dd97a9ba751edad9dc67d30d3ab9117a5a9ffa8..93d2a8fa6e59971cda12e5073413f3de85610447 100755 --- a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp +++ b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp @@ -28,18 +28,10 @@ #include "linden_common.h" -#include "llgl.h" - -#include "llplugininstance.h" -#include "llpluginmessage.h" -#include "llpluginmessageclasses.h" -#include "media_plugin_base.h" - -#if LL_QUICKTIME_ENABLED - #if defined(LL_DARWIN) #include <QuickTime/QuickTime.h> #elif defined(LL_WINDOWS) + #include "llwin32headers.h" #include "MacTypes.h" #include "QTML.h" #include "Movies.h" @@ -48,6 +40,17 @@ #include "QTLoadLibraryUtils.h" #endif +#include "llgl.h" + +#include "llplugininstance.h" +#include "llpluginmessage.h" +#include "llpluginmessageclasses.h" +#include "media_plugin_base.h" + +#if LL_QUICKTIME_ENABLED + + + // TODO: Make sure that the only symbol exported from this library is LLPluginInitEntryPoint //////////////////////////////////////////////////////////////////////////////// // diff --git a/indra/media_plugins/webkit/mac_volume_catcher.cpp b/indra/media_plugins/webkit/mac_volume_catcher.cpp index cc94556413dc2b090033e973831ddaf2f8573701..73e5bf3da30cef155524d82f18c6401892072c26 100755 --- a/indra/media_plugins/webkit/mac_volume_catcher.cpp +++ b/indra/media_plugins/webkit/mac_volume_catcher.cpp @@ -37,6 +37,7 @@ #include <QuickTime/QuickTime.h> #include <AudioUnit/AudioUnit.h> +#include <list> #if LL_DARWIN #pragma GCC diagnostic ignored "-Wdeprecated-declarations" diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 1812abd7d54656c5784864b958ae4374837c7fef..3edeef51e3311e67e3cff32b2292d12664916e17 100755 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -220,7 +220,7 @@ class MediaPluginWebKit : char cwd[ FILENAME_MAX ]; // I *think* this is defined on all platforms we use if (NULL == getcwd( cwd, FILENAME_MAX - 1 )) { - llwarns << "Couldn't get cwd - probably too long - failing to init." << llendl; + LL_WARNS() << "Couldn't get cwd - probably too long - failing to init." << LL_ENDL; return false; } std::string application_dir = std::string( cwd ); @@ -380,13 +380,13 @@ class MediaPluginWebKit : url << std::setfill('0') << std::setw(2) << std::hex << int(mBackgroundB * 255.0f); url << "%22%3E%3C/body%3E%3C/html%3E"; - //lldebugs << "data url is: " << url.str() << llendl; + //LL_DEBUGS() << "data url is: " << url.str() << LL_ENDL; // always display loading overlay now #if LLQTWEBKIT_API_VERSION >= 16 LLQtWebKit::getInstance()->enableLoadingOverlay(mBrowserWindowId, true); #else - llwarns << "Ignoring enableLoadingOverlay() call (llqtwebkit version is too old)." << llendl; + LL_WARNS() << "Ignoring enableLoadingOverlay() call (llqtwebkit version is too old)." << LL_ENDL; #endif str.clear(); str << "Loading overlay enabled = " << mEnableMediaPluginDebugging << " for mBrowserWindowId = " << mBrowserWindowId; @@ -426,7 +426,7 @@ class MediaPluginWebKit : break; default: - llwarns << "Unknown cursor ID: " << (int)llqt_cursor << llendl; + LL_WARNS() << "Unknown cursor ID: " << (int)llqt_cursor << LL_ENDL; break; } @@ -1326,7 +1326,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) F32 factor = (F32)message_in.getValueReal("factor"); LLQtWebKit::getInstance()->setPageZoomFactor(factor); #else - llwarns << "Ignoring setPageZoomFactor message (llqtwebkit version is too old)." << llendl; + LL_WARNS() << "Ignoring setPageZoomFactor message (llqtwebkit version is too old)." << LL_ENDL; #endif } else if(message_name == "clear_cache") @@ -1405,7 +1405,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) bool val = message_in.getValueBoolean("show"); LLQtWebKit::getInstance()->showWebInspector( val ); #else - llwarns << "Ignoring showWebInspector message (llqtwebkit version is too old)." << llendl; + LL_WARNS() << "Ignoring showWebInspector message (llqtwebkit version is too old)." << LL_ENDL; #endif } else if(message_name == "ignore_ssl_cert_errors") @@ -1413,7 +1413,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) #if LLQTWEBKIT_API_VERSION >= 3 LLQtWebKit::getInstance()->setIgnoreSSLCertErrors( message_in.getValueBoolean("ignore") ); #else - llwarns << "Ignoring ignore_ssl_cert_errors message (llqtwebkit version is too old)." << llendl; + LL_WARNS() << "Ignoring ignore_ssl_cert_errors message (llqtwebkit version is too old)." << LL_ENDL; #endif } else if(message_name == "add_certificate_file_path") @@ -1421,7 +1421,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) #if LLQTWEBKIT_API_VERSION >= 6 LLQtWebKit::getInstance()->setCAFile( message_in.getValue("path") ); #else - llwarns << "Ignoring add_certificate_file_path message (llqtwebkit version is too old)." << llendl; + LL_WARNS() << "Ignoring add_certificate_file_path message (llqtwebkit version is too old)." << LL_ENDL; #endif } else if(message_name == "init_history") diff --git a/indra/media_plugins/winmmshim/winmm_shim.cpp b/indra/media_plugins/winmmshim/winmm_shim.cpp index 49a1c9dba3062f1f4685195e03f6190b76958cfc..78f7a9b0dab5797a21b7a3c6a294540c0efb500f 100755 --- a/indra/media_plugins/winmmshim/winmm_shim.cpp +++ b/indra/media_plugins/winmmshim/winmm_shim.cpp @@ -39,7 +39,7 @@ BOOL APIENTRY DllMain( HMODULE hModule, LPVOID lpReserved ) { - if (DLL_PROCESS_ATTACH == ul_reason_for_call) + if (ul_reason_for_call == DLL_PROCESS_ATTACH) { InitializeCriticalSection(&sCriticalSection); } diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index a9f6ef1ddd419b4a6e54b1fcd2c7f88ac21c413a..c94969435b2c04ac587190fa761bf37358731c6c 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -239,10 +239,12 @@ set(viewer_SOURCE_FILES llfloaterhelpbrowser.cpp llfloaterhud.cpp llfloaterimagepreview.cpp + llfloaterimsessiontab.cpp + llfloaterimsession.cpp + llfloaterimcontainer.cpp llfloaterinspect.cpp llfloaterinventory.cpp llfloaterjoystick.cpp - llfloaterlagmeter.cpp llfloaterland.cpp llfloaterlandholdings.cpp llfloatermap.cpp @@ -268,6 +270,7 @@ set(viewer_SOURCE_FILES llfloaterregioninfo.cpp llfloaterreporter.cpp llfloaterregionrestarting.cpp + llfloatersceneloadstats.cpp llfloaterscriptdebug.cpp llfloaterscriptlimits.cpp llfloatersearch.cpp @@ -323,9 +326,6 @@ set(viewer_SOURCE_FILES llhudrender.cpp llhudtext.cpp llhudview.cpp - llfloaterimsessiontab.cpp - llfloaterimsession.cpp - llfloaterimcontainer.cpp llimhandler.cpp llimview.cpp llinspect.cpp @@ -492,6 +492,7 @@ set(viewer_SOURCE_FILES llremoteparcelrequest.cpp llsavedsettingsglue.cpp llsaveoutfitcombobtn.cpp + llscenemonitor.cpp llsceneview.cpp llscreenchannel.cpp llscriptfloater.cpp @@ -614,6 +615,7 @@ set(viewer_SOURCE_FILES llviewernetwork.cpp llviewerobject.cpp llviewerobjectlist.cpp + llvieweroctree.cpp llviewerparcelmedia.cpp llviewerparcelmediaautoplay.cpp llviewerparcelmgr.cpp @@ -685,6 +687,7 @@ set(viewer_HEADER_FILES CMakeLists.txt ViewerInstall.cmake groupchatlistener.h + llaccountingcost.h llaccountingcostmanager.h llagent.h llagentaccess.h @@ -827,10 +830,15 @@ set(viewer_HEADER_FILES llfloaterhelpbrowser.h llfloaterhud.h llfloaterimagepreview.h + llfloaterimnearbychat.h + llfloaterimnearbychathandler.h + llfloaterimnearbychatlistener.h + llfloaterimsessiontab.h + llfloaterimsession.h + llfloaterimcontainer.h llfloaterinspect.h llfloaterinventory.h llfloaterjoystick.h - llfloaterlagmeter.h llfloaterland.h llfloaterlandholdings.h llfloatermap.h @@ -856,6 +864,7 @@ set(viewer_HEADER_FILES llfloaterregioninfo.h llfloaterreporter.h llfloaterregionrestarting.h + llfloatersceneloadstats.h llfloaterscriptdebug.h llfloaterscriptlimits.h llfloatersearch.h @@ -910,9 +919,6 @@ set(viewer_HEADER_FILES llhudrender.h llhudtext.h llhudview.h - llfloaterimsessiontab.h - llfloaterimsession.h - llfloaterimcontainer.h llimview.h llinspect.h llinspectavatar.h @@ -964,9 +970,6 @@ set(viewer_HEADER_FILES llnameeditor.h llnamelistctrl.h llnavigationbar.h - llfloaterimnearbychat.h - llfloaterimnearbychathandler.h - llfloaterimnearbychatlistener.h llnetmap.h llnotificationhandler.h llnotificationmanager.h @@ -1070,6 +1073,7 @@ set(viewer_HEADER_FILES llrootview.h llsavedsettingsglue.h llsaveoutfitcombobtn.h + llscenemonitor.h llsceneview.h llscreenchannel.h llscriptfloater.h @@ -1192,6 +1196,7 @@ set(viewer_HEADER_FILES llviewernetwork.h llviewerobject.h llviewerobjectlist.h + llvieweroctree.h llviewerparcelmedia.h llviewerparcelmediaautoplay.h llviewerparcelmgr.h @@ -1228,7 +1233,6 @@ set(viewer_HEADER_FILES llvosky.h llvosurfacepatch.h llvotree.h - llvotreenew.h llvovolume.h llvowater.h llvowlsky.h @@ -1256,6 +1260,7 @@ set(viewer_HEADER_FILES macmain.h noise.h pipeline.h + roles_constants.h VertexCache.h VorbisFramework.h ) @@ -2280,11 +2285,6 @@ if (LL_TESTS) "${test_libs}" ) - LL_ADD_INTEGRATION_TEST(llsimplestat - "" - "${test_libs}" - ) - LL_ADD_INTEGRATION_TEST(llviewerassetstats llviewerassetstats.cpp "${test_libs}" diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index d2577d975622d5415d4d59199a92a798af3c09cc..a0fc9e07cb13f797eae6c5d4900392f0e885e937 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -3.7.7 +3.7.8 diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 92a241857e02e055ce8c0ba7a71d06257b86e635..7da047aed5ae7d068d2713d37d23fcea61e045df 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -43,6 +43,7 @@ <key>tags</key> <array> <!-- sample entry for debugging specific items + <string>SceneLoadTiming</string> <string>Avatar</string> <string>Voice</string> --> diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8cea4a398e20936b850313fab2af244190aa83ae..b0b683aef9a61683324f2b26459bf20c9e503b4f 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -731,7 +731,6 @@ <key>Value</key> <integer>0</integer> </map> - <key>BackgroundYieldTime</key> <map> <key>Comment</key> @@ -1434,6 +1433,17 @@ <real>0.0</real> </array> </map> + <key>RestoreCameraPosOnLogin</key> + <map> + <key>Comment</key> + <string>Reset camera position to location at logout</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>CameraPositionSmoothing</key> <map> <key>Comment</key> @@ -2972,6 +2982,17 @@ <key>Value</key> <string>Female Shape & Outfit</string> </map> + <key>DefaultLoginLocation</key> + <map> + <key>Comment</key> + <string>Startup destination default (if not specified on command line)</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>String</string> + <key>Value</key> + <string/> + </map> <key>DefaultMaleAvatar</key> <map> <key>Comment</key> @@ -6437,6 +6458,28 @@ <key>Value</key> <integer>130</integer> </map> + <key>NewObjectCreationThrottle</key> + <map> + <key>Comment</key> + <string>maximum number of new objects created per frame, -1 to disable this throttle</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>S32</string> + <key>Value</key> + <integer>200</integer> + </map> + <key>NewObjectCreationThrottleDelayTime</key> + <map> + <key>Comment</key> + <string>time in seconds NewObjectCreationThrottle to take effect after the progress screen is lifted</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>2.0</real> + </map> <key>NextOwnerCopy</key> <map> <key>Comment</key> @@ -6536,6 +6579,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>NonvisibleObjectsInMemoryTime</key> + <map> + <key>Comment</key> + <string>Number of frames non-visible objects stay in memory before being removed. 0 means never to remove.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>300</integer> + </map> <key>NoPreload</key> <map> <key>Comment</key> @@ -6856,6 +6910,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>RequestFullRegionCache</key> + <map> + <key>Comment</key> + <string>If set, ask sim to send full region object cache. Needs to restart viewer.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>OpenDebugStatAdvanced</key> <map> <key>Comment</key> @@ -7058,7 +7123,6 @@ <real>0.75</real> </array> </map> - <key>ParcelMediaAutoPlayEnable</key> <map> <key>Comment</key> @@ -7424,6 +7488,17 @@ <string>F32</string> <key>Value</key> <real>6.0</real> + </map> + <key>ClothingLoadingDelay</key> + <map> + <key>Comment</key> + <string>Time to wait for avatar appearance to resolve before showing world (seconds)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>10.0</real> </map> <key>PreferredMaturity</key> <map> @@ -7980,7 +8055,6 @@ <key>Value</key> <integer>1</integer> </map> - <key>OctreeMaxNodeCapacity</key> <map> <key>Comment</key> @@ -10200,6 +10274,105 @@ <key>Value</key> <integer>0</integer> </map> + <key>SceneLoadFrontPixelThreshold</key> + <map> + <key>Comment</key> + <string>in pixels, all objects in view frustum whose screen area is greater than this threshold will be loaded</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>100.0</real> + </map> + <key>SceneLoadHighMemoryBound</key> + <map> + <key>Comment</key> + <string>in MB, when total memory usage above this threshold, minimum invisible objects are kept in memory </string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <real>1024</real> + </map> + <key>SceneLoadLowMemoryBound</key> + <map> + <key>Comment</key> + <string>in MB, when total memory usage above this threshold, start to reduce invisible objects kept in memory </string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <real>750</real> + </map> + <key>SceneLoadMinRadius</key> + <map> + <key>Comment</key> + <string>in meters, all objects (visible or invisible) within this radius will remain loaded in memory</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>32.0</real> + </map> + <key>SceneLoadRearMaxRadiusFraction</key> + <map> + <key>Comment</key> + <string>a percentage of draw distance beyond which all objects outside of view frustum will be unloaded, regardless of pixel threshold</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>75.0</real> + </map> + <key>SceneLoadRearPixelThreshold</key> + <map> + <key>Comment</key> + <string>in pixels, all objects out of view frustum whose screen area is greater than this threshold will remain loaded</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>400.0</real> + </map> + <key>SceneLoadingMonitorEnabled</key> + <map> + <key>Comment</key> + <string>Enabled scene loading monitor if set</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>SceneLoadingMonitorSampleTime</key> + <map> + <key>Comment</key> + <string>Time between screen samples when monitor scene load (seconds)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.25</real> + </map> + <key>SceneLoadingMonitorPixelDiffThreshold</key> + <map> + <key>Comment</key> + <string>Amount of pixels changed required to consider the scene as still loading (square root of fraction of pixels on screen)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.02</real> + </map> <key>ScriptHelpFollowsCursor</key> <map> <key>Comment</key> @@ -11916,50 +12089,6 @@ <key>Value</key> <integer>1</integer> </map> - <key>UIAvatariconctrlSymbolHPad</key> - <map> - <key>Comment</key> - <string>UI Avatar Icon Control Symbol Horizontal Pad</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>S32</string> - <key>Value</key> - <real>2</real> - </map> - <key>UIAvatariconctrlSymbolVPad</key> - <map> - <key>Comment</key> - <string>UI Avatar Icon Control Symbol Vertical Pad</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>S32</string> - <key>Value</key> - <real>2</real> - </map> - <key>UIAvatariconctrlSymbolSize</key> - <map> - <key>Comment</key> - <string>UI Avatar Icon Control Symbol Size</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>S32</string> - <key>Value</key> - <real>5</real> - </map> - <key>UIAvatariconctrlSymbolPosition</key> - <map> - <key>Comment</key> - <string>UI Avatar Icon Control Symbol Position (TopLeft|TopRight|BottomLeft|BottomRight)</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>String</string> - <key>Value</key> - <string>BottomRight</string> - </map> <key>UIButtonOrigHPad</key> <map> <key>Comment</key> @@ -13137,6 +13266,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>UseObjectCacheOcclusion</key> + <map> + <key>Comment</key> + <string>Enable object cache level object culling based on occlusion (coverage) by other objects</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>RenderSynchronousOcclusion</key> <map> <key>Comment</key> @@ -14914,6 +15054,28 @@ <key>Value</key> <integer>0</integer> </map> + <key>TeleportArrivalDelay</key> + <map> + <key>Comment</key> + <string>Time to wait before displaying world during teleport (seconds)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>2</real> + </map> + <key>TeleportLocalDelay</key> + <map> + <key>Comment</key> + <string>Delay to prevent teleports after starting an in-sim teleport. (seconds)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1</real> + </map> <key>FMODExProfilerEnable</key> <map> <key>Comment</key> diff --git a/indra/llcommon/timing.h b/indra/newview/app_settings/shaders/class1/interface/onetexturefilterF.glsl old mode 100755 new mode 100644 similarity index 63% rename from indra/llcommon/timing.h rename to indra/newview/app_settings/shaders/class1/interface/onetexturefilterF.glsl index c408d4c44655e04f325714122c38849374f9f929..f1400c9b44f5688acffaca57a3cdf7f8ce0d8dce --- a/indra/llcommon/timing.h +++ b/indra/newview/app_settings/shaders/class1/interface/onetexturefilterF.glsl @@ -1,10 +1,9 @@ /** - * @file timing.h - * @brief Cross-platform routines for doing timing. + * @file onetexturefilterF.glsl * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2007, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,19 +23,27 @@ * $/LicenseInfo$ */ -#ifndef LL_TIMING_H -#define LL_TIMING_H - - -#if LL_LINUX || LL_DARWIN || LL_SOLARIS -#include <sys/time.h> +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif +uniform sampler2D tex0; +uniform float tolerance; -const F32 SEC_TO_MICROSEC = 1000000.f; -const U64 SEC_TO_MICROSEC_U64 = 1000000; -const U32 SEC_PER_DAY = 86400; +VARYING vec2 vary_texcoord0; -// functionality has been moved lltimer.{cpp,h}. This file will be deprecated in the future. - -#endif +void main() +{ + frag_color = texture2D(tex0, vary_texcoord0.xy); + + if(frag_color[0] + frag_color[1] + frag_color[2] < tolerance) + { + discard; + } + else + { + frag_color[3] = 0.95f; + } +} diff --git a/indra/llcommon/reflective.cpp b/indra/newview/app_settings/shaders/class1/interface/onetexturefilterV.glsl old mode 100755 new mode 100644 similarity index 70% rename from indra/llcommon/reflective.cpp rename to indra/newview/app_settings/shaders/class1/interface/onetexturefilterV.glsl index 2cc0e7e1f2e79c5b785bd459e74956eb501050ad..a33ef7e92c18e457decf2f7cd286b336eff01dce --- a/indra/llcommon/reflective.cpp +++ b/indra/newview/app_settings/shaders/class1/interface/onetexturefilterV.glsl @@ -1,12 +1,9 @@ /** - * @file reflective.cpp - * @author Babbage - * @date 2006-05-15 - * @brief Implementation of LLReflective. + * @file onetexturefilterV.glsl * - * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2007, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,16 +22,17 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - -#include "linden_common.h" -#include "reflective.h" +uniform mat4 modelview_projection_matrix; -LLReflective::LLReflective() -{ -} +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; -//virtual -LLReflective::~LLReflective() +VARYING vec2 vary_texcoord0; + +void main() { + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + vary_texcoord0 = texcoord0; } + diff --git a/indra/llcommon/lllog.h b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl old mode 100755 new mode 100644 similarity index 52% rename from indra/llcommon/lllog.h rename to indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl index 7964412e83c56545fbdcb2b8403cdd04199a73e2..6eeb2596b2e1b99a1df7caa6ac7f0530236c8984 --- a/indra/llcommon/lllog.h +++ b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl @@ -1,12 +1,9 @@ -/** - * @file lllog.h - * @author Don - * @date 2007-11-27 - * @brief Class to log messages to syslog for streambase to process. +/** + * @file twotexturecompareF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2007, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,27 +23,36 @@ * $/LicenseInfo$ */ -#ifndef LL_LLLOG_H -#define LL_LLLOG_H +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif -#include <string> +uniform sampler2D tex0; +uniform sampler2D tex1; +uniform sampler2D dither_tex; +uniform float dither_scale; +uniform float dither_scale_s; +uniform float dither_scale_t; -class LLLogImpl; -class LLApp; -class LLSD; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; -class LL_COMMON_API LLLog +void main() { -public: - LLLog(LLApp* app); - virtual ~LLLog(); - - virtual void log(const std::string &message, LLSD& info); - virtual bool useLegacyLogMessage(const std::string &message); - -private: - LLLogImpl* mImpl; -}; - -#endif /* LL_LLLOG_H */ - + frag_color = abs(texture2D(tex0, vary_texcoord0.xy) - texture2D(tex1, vary_texcoord0.xy)); + + vec2 dither_coord; + dither_coord[0] = vary_texcoord0[0] * dither_scale_s; + dither_coord[1] = vary_texcoord0[1] * dither_scale_t; + vec4 dither_vec = texture(dither_tex, dither_coord.xy); + + for(int i = 0; i < 3; i++) + { + if(frag_color[i] < dither_vec[i] * dither_scale) + { + frag_color[i] = 0.f; + } + } +} diff --git a/indra/llcommon/lloptioninterface.cpp b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareV.glsl old mode 100755 new mode 100644 similarity index 65% rename from indra/llcommon/lloptioninterface.cpp rename to indra/newview/app_settings/shaders/class1/interface/twotexturecompareV.glsl index 23fae76dc04814c1d905715cf3bd6f6f3c190402..67c6674f0cec4a66c8c8e342c59998298101865a --- a/indra/llcommon/lloptioninterface.cpp +++ b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareV.glsl @@ -1,10 +1,9 @@ /** - * @file lloptioninterface.cpp - * @brief + * @file twotexturecompareV.glsl * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2007, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,11 +22,20 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ + +uniform mat4 modelview_projection_matrix; -#include "lloptioninterface.h" +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; -LLOptionInterface::~LLOptionInterface() +void main() { - + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + vary_texcoord0 = texcoord0; + vary_texcoord1 = texcoord1; } + diff --git a/indra/llcommon/llstack.h b/indra/newview/llaccountingcost.h similarity index 57% rename from indra/llcommon/llstack.h rename to indra/newview/llaccountingcost.h index 315de6ba2d2e70fce4b5cf56efc5484c8ad9dbae..bc770fe1d237eb1d1145495c9e5394af8e43dc9d 100755 --- a/indra/llcommon/llstack.h +++ b/indra/newview/llaccountingcost.h @@ -1,10 +1,10 @@ /** - * @file llstack.h - * @brief LLStack template class + * @file llaccountingcost.h + * @ * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2011, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,25 +24,32 @@ * $/LicenseInfo$ */ -#ifndef LL_LLSTACK_H -#define LL_LLSTACK_H +#ifndef LL_ACCOUNTINGQUOTA_H +#define LL_ACCOUNTINGQUOTA_H -#include "linked_lists.h" - -template <class DATA_TYPE> class LLStack +//SelectionQuota atm does not require a id +struct SelectionCost { -private: - LLLinkedList<DATA_TYPE> mStack; - -public: - LLStack() {} - ~LLStack() {} - - void push(DATA_TYPE *data) { mStack.addData(data); } - DATA_TYPE *pop() { DATA_TYPE *tempp = mStack.getFirstData(); mStack.removeCurrentData(); return tempp; } - void deleteAllData() { mStack.deleteAllData(); } - void removeAllNodes() { mStack.removeAllNodes(); } + SelectionCost( /*LLTransactionID transactionId, */ F32 physicsCost, F32 networkCost, F32 simulationCost ) + //: mTransactionId( transactionId) + : mPhysicsCost( physicsCost ) + , mNetworkCost( networkCost ) + , mSimulationCost( simulationCost ) + { + } + SelectionCost() + : mPhysicsCost( 0.0f ) + , mNetworkCost( 0.0f ) + , mSimulationCost( 0.0f ) + {} + + F32 mPhysicsCost, mNetworkCost, mSimulationCost; + //LLTransactionID mTransactionId; }; +typedef enum { Roots = 0 , Prims } eSelectionType; + #endif + + diff --git a/indra/newview/llaccountingcostmanager.cpp b/indra/newview/llaccountingcostmanager.cpp index 7662a9689daa0849a6a22146c722bb27dc48a9de..150b97baa5e6ad44dbba99c7d302636b52ebf711 100755 --- a/indra/newview/llaccountingcostmanager.cpp +++ b/indra/newview/llaccountingcostmanager.cpp @@ -58,7 +58,7 @@ class LLAccountingCostResponder : public LLCurl::Responder void errorWithContent( U32 statusNum, const std::string& reason, const LLSD& content ) { - llwarns << "Transport error [status:" << statusNum << "]: " << content <<llendl; + LL_WARNS() << "Transport error [status:" << statusNum << "]: " << content <<LL_ENDL; clearPendingRequests(); LLAccountingCostObserver* observer = mObserverHandle.get(); @@ -73,7 +73,7 @@ class LLAccountingCostResponder : public LLCurl::Responder //Check for error if ( !content.isMap() || content.has("error") ) { - llwarns << "Error on fetched data"<< llendl; + LL_WARNS() << "Error on fetched data"<< LL_ENDL; } else if (content.has("selected")) { @@ -148,7 +148,7 @@ void LLAccountingCostManager::fetchCosts( eSelectionType selectionType, } else { - llinfos<<"Invalid selection type "<<llendl; + LL_INFOS()<<"Invalid selection type "<<LL_ENDL; mObjectList.clear(); mPendingObjectQuota.clear(); return; @@ -163,7 +163,7 @@ void LLAccountingCostManager::fetchCosts( eSelectionType selectionType, else { //url was empty - warn & continue - llwarns<<"Supplied url is empty "<<llendl; + LL_WARNS()<<"Supplied url is empty "<<LL_ENDL; mObjectList.clear(); mPendingObjectQuota.clear(); } diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f150ceda67ffd4d4c670cde7ae6205fe7ac81949..eb9ca542a3622fdc8f72b743a65266f0b0fdd077 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -755,7 +755,7 @@ void LLAgent::setFlying(BOOL fly) } if( !was_flying ) { - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_FLY_COUNT); + add(LLStatViewer::FLY, 1); } setControlFlags(AGENT_CONTROL_FLY); } @@ -812,7 +812,7 @@ void LLAgent::standUp() void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) { - llinfos << "called" << llendl; + LL_INFOS() << "called" << LL_ENDL; // Old-style appearance entering a server-bake region. @@ -820,7 +820,7 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) !gAgentAvatarp->isUsingServerBakes() && (mRegionp->getCentralBakeVersion()>0)) { - llinfos << "update requested due to region transition" << llendl; + LL_INFOS() << "update requested due to region transition" << LL_ENDL; LLAppearanceMgr::instance().requestServerAppearanceUpdate(); } // new-style appearance entering a non-bake region, @@ -851,12 +851,12 @@ boost::signals2::connection LLAgent::addParcelChangedCallback(parcel_changed_cal void LLAgent::setRegion(LLViewerRegion *regionp) { bool notifyRegionChange; - + llassert(regionp); if (mRegionp != regionp) { notifyRegionChange = true; - + std::string ip = regionp->getHost().getString(); LL_INFOS("AgentLocation") << "Moving agent into region: " << regionp->getName() << " located at " << ip << LL_ENDL; @@ -1011,12 +1011,12 @@ void LLAgent::sendMessage() { if (gDisconnected) { - llwarns << "Trying to send message when disconnected!" << llendl; + LL_WARNS() << "Trying to send message when disconnected!" << LL_ENDL; return; } if (!mRegionp) { - llerrs << "No region for agent yet!" << llendl; + LL_ERRS() << "No region for agent yet!" << LL_ENDL; return; } gMessageSystem->sendMessage(mRegionp->getHost()); @@ -1030,12 +1030,12 @@ void LLAgent::sendReliableMessage() { if (gDisconnected) { - lldebugs << "Trying to send message when disconnected!" << llendl; + LL_DEBUGS() << "Trying to send message when disconnected!" << LL_ENDL; return; } if (!mRegionp) { - lldebugs << "LLAgent::sendReliableMessage No region for agent yet, not sending message!" << llendl; + LL_DEBUGS() << "LLAgent::sendReliableMessage No region for agent yet, not sending message!" << LL_ENDL; return; } gMessageSystem->sendReliable(mRegionp->getHost()); @@ -1064,7 +1064,7 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent) { if (!pos_agent.isFinite()) { - llerrs << "setPositionAgent is not a number" << llendl; + LL_ERRS() << "setPositionAgent is not a number" << LL_ENDL; } if (isAgentAvatarValid() && gAgentAvatarp->getParent()) @@ -1196,7 +1196,7 @@ void LLAgent::resetAxes(const LLVector3 &look_at) LLVector3 cross(look_at % skyward); if (cross.isNull()) { - llinfos << "LLAgent::resetAxes cross-product is zero" << llendl; + LL_INFOS() << "LLAgent::resetAxes cross-product is zero" << LL_ENDL; return; } @@ -2073,7 +2073,7 @@ void LLAgent::endAnimationUpdateUI() im_box->getDetachedConversationFloaters(conversations); BOOST_FOREACH(LLFloater* conversation, conversations) { - llinfos << "skip_list.insert(session_floater): " << conversation->getTitle() << llendl; + LL_INFOS() << "skip_list.insert(session_floater): " << conversation->getTitle() << LL_ENDL; skip_list.insert(conversation); } @@ -2336,7 +2336,7 @@ void LLAgent::setStartPosition( U32 location_id ) object = gObjectList.findObject(gAgentID); if (! object) { - llinfos << "setStartPosition - Can't find agent viewerobject id " << gAgentID << llendl; + LL_INFOS() << "setStartPosition - Can't find agent viewerobject id " << gAgentID << LL_ENDL; return; } // we've got the viewer object @@ -2437,7 +2437,7 @@ void LLAgent::requestStopMotion( LLMotion* motion ) // if motion is not looping, it could have stopped by running out of time // so we need to tell the server this -// llinfos << "Sending stop for motion " << motion->getName() << llendl; +// LL_INFOS() << "Sending stop for motion " << motion->getName() << LL_ENDL; sendAnimationRequest( anim_state, ANIM_REQUEST_STOP ); } @@ -2600,19 +2600,19 @@ void LLMaturityPreferencesResponder::result(const LLSD &pContent) if (actualMaturity != mPreferredMaturity) { - llwarns << "while attempting to change maturity preference from '" << LLViewerRegion::accessToString(mPreviousMaturity) + LL_WARNS() << "while attempting to change maturity preference from '" << LLViewerRegion::accessToString(mPreviousMaturity) << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) << "', the server responded with '" << LLViewerRegion::accessToString(actualMaturity) << "' [value:" << static_cast<U32>(actualMaturity) << ", llsd:" - << pContent << "]" << llendl; + << pContent << "]" << LL_ENDL; } mAgent->handlePreferredMaturityResult(actualMaturity); } void LLMaturityPreferencesResponder::errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent) { - llwarns << "while attempting to change maturity preference from '" << LLViewerRegion::accessToString(mPreviousMaturity) + LL_WARNS() << "while attempting to change maturity preference from '" << LLViewerRegion::accessToString(mPreviousMaturity) << "' to '" << LLViewerRegion::accessToString(mPreferredMaturity) << "', we got an error with [status:" - << pStatus << "]: " << (pContent.isDefined() ? pContent : LLSD(pReason)) << llendl; + << pStatus << "]: " << (pContent.isDefined() ? pContent : LLSD(pReason)) << LL_ENDL; mAgent->handlePreferredMaturityError(); } @@ -2661,8 +2661,8 @@ void LLAgent::handlePreferredMaturityResult(U8 pServerMaturity) // server by re-sending our last known request. Cap the re-tries at 3 just to be safe. else if (++mMaturityPreferenceNumRetries <= 3) { - llinfos << "Retrying attempt #" << mMaturityPreferenceNumRetries << " to set viewer preferred maturity to '" - << LLViewerRegion::accessToString(mLastKnownRequestMaturity) << "'" << llendl; + LL_INFOS() << "Retrying attempt #" << mMaturityPreferenceNumRetries << " to set viewer preferred maturity to '" + << LLViewerRegion::accessToString(mLastKnownRequestMaturity) << "'" << LL_ENDL; sendMaturityPreferenceToServer(mLastKnownRequestMaturity); } // Else, the viewer is style out of sync with the server after 3 retries, so inform the user @@ -2689,8 +2689,8 @@ void LLAgent::handlePreferredMaturityError() // the server, but not quite sure why we are if (mLastKnownRequestMaturity == mLastKnownResponseMaturity) { - llwarns << "Got an error but maturity preference '" << LLViewerRegion::accessToString(mLastKnownRequestMaturity) - << "' seems to be in sync with the server" << llendl; + LL_WARNS() << "Got an error but maturity preference '" << LLViewerRegion::accessToString(mLastKnownRequestMaturity) + << "' seems to be in sync with the server" << LL_ENDL; reportPreferredMaturitySuccess(); } // Else, the more likely case is that the last request does not match the last response, @@ -2744,7 +2744,7 @@ void LLAgent::reportPreferredMaturityError() { bool tmpIsDoSendMaturityPreferenceToServer = mIsDoSendMaturityPreferenceToServer; mIsDoSendMaturityPreferenceToServer = false; - llinfos << "Setting viewer preferred maturity to '" << LLViewerRegion::accessToString(mLastKnownResponseMaturity) << "'" << llendl; + LL_INFOS() << "Setting viewer preferred maturity to '" << LLViewerRegion::accessToString(mLastKnownResponseMaturity) << "'" << LL_ENDL; gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(mLastKnownResponseMaturity)); mIsDoSendMaturityPreferenceToServer = tmpIsDoSendMaturityPreferenceToServer; } @@ -2793,8 +2793,8 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity) LLSD body = LLSD::emptyMap(); body["access_prefs"] = access_prefs; - llinfos << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) - << "' via capability to: " << url << llendl; + LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity) + << "' via capability to: " << url << LL_ENDL; LLSD headers; LLHTTPClient::post(url, body, responderPtr, headers, 30.0f); } @@ -2869,10 +2869,10 @@ BOOL LLAgent::isInGroup(const LLUUID& group_id, BOOL ignore_god_mode /* FALSE */ if (!ignore_god_mode && isGodlike()) return true; - S32 count = mGroups.count(); - for(S32 i = 0; i < count; ++i) + U32 count = mGroups.size(); + for(U32 i = 0; i < count; ++i) { - if(mGroups.get(i).mID == group_id) + if(mGroups[i].mID == group_id) { return TRUE; } @@ -2889,12 +2889,12 @@ BOOL LLAgent::hasPowerInGroup(const LLUUID& group_id, U64 power) const // GP_NO_POWERS can also mean no power is enough to grant an ability. if (GP_NO_POWERS == power) return FALSE; - S32 count = mGroups.count(); - for(S32 i = 0; i < count; ++i) + U32 count = mGroups.size(); + for(U32 i = 0; i < count; ++i) { - if(mGroups.get(i).mID == group_id) + if(mGroups[i].mID == group_id) { - return (BOOL)((mGroups.get(i).mPowers & power) > 0); + return (BOOL)((mGroups[i].mPowers & power) > 0); } } return FALSE; @@ -2910,12 +2910,12 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const if (isGodlike()) return GP_ALL_POWERS; - S32 count = mGroups.count(); - for(S32 i = 0; i < count; ++i) + U32 count = mGroups.size(); + for(U32 i = 0; i < count; ++i) { - if(mGroups.get(i).mID == group_id) + if(mGroups[i].mID == group_id) { - return (mGroups.get(i).mPowers); + return (mGroups[i].mPowers); } } @@ -2924,12 +2924,12 @@ U64 LLAgent::getPowerInGroup(const LLUUID& group_id) const BOOL LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const { - S32 count = mGroups.count(); + S32 count = mGroups.size(); for(S32 i = 0; i < count; ++i) { - if(mGroups.get(i).mID == group_id) + if(mGroups[i].mID == group_id) { - data = mGroups.get(i); + data = mGroups[i]; return TRUE; } } @@ -2938,12 +2938,12 @@ BOOL LLAgent::getGroupData(const LLUUID& group_id, LLGroupData& data) const S32 LLAgent::getGroupContribution(const LLUUID& group_id) const { - S32 count = mGroups.count(); + S32 count = mGroups.size(); for(S32 i = 0; i < count; ++i) { - if(mGroups.get(i).mID == group_id) + if(mGroups[i].mID == group_id) { - S32 contribution = mGroups.get(i).mContribution; + S32 contribution = mGroups[i].mContribution; return contribution; } } @@ -2952,12 +2952,12 @@ S32 LLAgent::getGroupContribution(const LLUUID& group_id) const BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) { - S32 count = mGroups.count(); + S32 count = mGroups.size(); for(S32 i = 0; i < count; ++i) { - if(mGroups.get(i).mID == group_id) + if(mGroups[i].mID == group_id) { - mGroups.get(i).mContribution = contribution; + mGroups[i].mContribution = contribution; LLMessageSystem* msg = gMessageSystem; msg->newMessage("SetGroupContribution"); msg->nextBlock("AgentData"); @@ -2975,13 +2975,13 @@ BOOL LLAgent::setGroupContribution(const LLUUID& group_id, S32 contribution) BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile) { - S32 count = mGroups.count(); + S32 count = mGroups.size(); for(S32 i = 0; i < count; ++i) { - if(mGroups.get(i).mID == group_id) + if(mGroups[i].mID == group_id) { - mGroups.get(i).mAcceptNotices = accept_notices; - mGroups.get(i).mListInProfile = list_in_profile; + mGroups[i].mAcceptNotices = accept_notices; + mGroups[i].mListInProfile = list_in_profile; LLMessageSystem* msg = gMessageSystem; msg->newMessage("SetGroupAcceptNotices"); msg->nextBlock("AgentData"); @@ -3001,7 +3001,7 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO BOOL LLAgent::canJoinGroups() const { - return mGroups.count() < gMaxAgentGroups; + return (S32)mGroups.size() < gMaxAgentGroups; } LLQuaternion LLAgent::getHeadRotation() @@ -3030,7 +3030,7 @@ LLQuaternion LLAgent::getHeadRotation() return rot; } -void LLAgent::sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request) +void LLAgent::sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request) { if (gAgentID.isNull()) { @@ -3045,7 +3045,7 @@ void LLAgent::sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimReque msg->addUUIDFast(_PREHASH_AgentID, getID()); msg->addUUIDFast(_PREHASH_SessionID, getSessionID()); - for (S32 i = 0; i < anim_ids.count(); i++) + for (S32 i = 0; i < anim_ids.size(); i++) { if (anim_ids[i].isNull()) { @@ -3282,7 +3282,7 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **) if (agent_id != gAgentID) { - llwarns << "processAgentDropGroup for agent other than me" << llendl; + LL_WARNS() << "processAgentDropGroup for agent other than me" << LL_ENDL; return; } @@ -3292,10 +3292,10 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **) // Remove the group if it already exists remove it and add the new data to pick up changes. LLGroupData gd; gd.mID = group_id; - S32 index = gAgent.mGroups.find(gd); - if (index != -1) + std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd); + if (found_it != gAgent.mGroups.end()) { - gAgent.mGroups.remove(index); + gAgent.mGroups.erase(found_it); if (gAgent.getGroupID() == group_id) { gAgent.mGroupID.setNull(); @@ -3313,7 +3313,7 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **) } else { - llwarns << "processAgentDropGroup, agent is not part of group " << group_id << llendl; + LL_WARNS() << "processAgentDropGroup, agent is not part of group " << group_id << LL_ENDL; } } @@ -3346,7 +3346,7 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode body["AgentData"].isArray() && body["AgentData"][0].isMap() ) { - llinfos << "VALID DROP GROUP" << llendl; + LL_INFOS() << "VALID DROP GROUP" << LL_ENDL; //there is only one set of data in the AgentData block LLSD agent_data = body["AgentData"][0]; @@ -3358,8 +3358,8 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode if (agent_id != gAgentID) { - llwarns - << "AgentDropGroup for agent other than me" << llendl; + LL_WARNS() + << "AgentDropGroup for agent other than me" << LL_ENDL; response->notFound(); return; @@ -3369,10 +3369,10 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode // and add the new data to pick up changes. LLGroupData gd; gd.mID = group_id; - S32 index = gAgent.mGroups.find(gd); - if (index != -1) + std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), gd); + if (found_it != gAgent.mGroups.end()) { - gAgent.mGroups.remove(index); + gAgent.mGroups.erase(found_it); if (gAgent.getGroupID() == group_id) { gAgent.mGroupID.setNull(); @@ -3390,9 +3390,9 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode } else { - llwarns + LL_WARNS() << "AgentDropGroup, agent is not part of group " - << group_id << llendl; + << group_id << LL_ENDL; } response->result(LLSD()); @@ -3419,13 +3419,12 @@ void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **) if (agent_id != gAgentID) { - llwarns << "processAgentGroupDataUpdate for agent other than me" << llendl; + LL_WARNS() << "processAgentGroupDataUpdate for agent other than me" << LL_ENDL; return; } S32 count = msg->getNumberOfBlocksFast(_PREHASH_GroupData); LLGroupData group; - S32 index = -1; bool need_floater_update = false; for(S32 i = 0; i < count; ++i) { @@ -3440,12 +3439,12 @@ void LLAgent::processAgentGroupDataUpdate(LLMessageSystem *msg, void **) { need_floater_update = true; // Remove the group if it already exists remove it and add the new data to pick up changes. - index = gAgent.mGroups.find(group); - if (index != -1) + std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group); + if (found_it != gAgent.mGroups.end()) { - gAgent.mGroups.remove(index); + gAgent.mGroups.erase(found_it); } - gAgent.mGroups.put(group); + gAgent.mGroups.push_back(group); } if (need_floater_update) { @@ -3469,7 +3468,7 @@ class LLAgentGroupDataUpdateViewerNode : public LLHTTPNode if (agent_id != gAgentID) { - llwarns << "processAgentGroupDataUpdate for agent other than me" << llendl; + LL_WARNS() << "processAgentGroupDataUpdate for agent other than me" << LL_ENDL; return; } @@ -3484,7 +3483,6 @@ class LLAgentGroupDataUpdateViewerNode : public LLHTTPNode { LLGroupData group; - S32 index = -1; bool need_floater_update = false; group.mID = (*iter_group)["GroupID"].asUUID(); @@ -3501,12 +3499,12 @@ class LLAgentGroupDataUpdateViewerNode : public LLHTTPNode { need_floater_update = true; // Remove the group if it already exists remove it and add the new data to pick up changes. - index = gAgent.mGroups.find(group); - if (index != -1) + std::vector<LLGroupData>::iterator found_it = std::find(gAgent.mGroups.begin(), gAgent.mGroups.end(), group); + if (found_it != gAgent.mGroups.end()) { - gAgent.mGroups.remove(index); + gAgent.mGroups.erase(found_it); } - gAgent.mGroups.put(group); + gAgent.mGroups.push_back(group); } if (need_floater_update) { @@ -3528,7 +3526,7 @@ void LLAgent::processAgentDataUpdate(LLMessageSystem *msg, void **) if (agent_id != gAgentID) { - llwarns << "processAgentDataUpdate for agent other than me" << llendl; + LL_WARNS() << "processAgentDataUpdate for agent other than me" << LL_ENDL; return; } @@ -3696,7 +3694,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * if (!isAgentAvatarValid() || gAgentAvatarp->isDead()) { - llwarns << "No avatar for user in cached texture update!" << llendl; + LL_WARNS() << "No avatar for user in cached texture update!" << LL_ENDL; return; } @@ -3733,7 +3731,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * { if (texture_id.notNull()) { - //llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl; + //LL_INFOS() << "Received cached texture " << (U32)texture_index << ": " << texture_id << LL_ENDL; gAgentAvatarp->setCachedBakedTexture((ETextureIndex)texture_index, texture_id); //gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id ); gAgentQueryManager.mActiveCacheQueries[baked_index] = 0; @@ -3748,7 +3746,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void * } } } - llinfos << "Received cached texture response for " << num_results << " textures." << llendl; + LL_INFOS() << "Received cached texture response for " << num_results << " textures." << LL_ENDL; gAgentAvatarp->outputRezTiming("Fetched agent wearables textures from cache. Will now load them"); gAgentAvatarp->updateMeshTextures(); @@ -3826,7 +3824,7 @@ bool LLAgent::teleportCore(bool is_local) { if ((TELEPORT_NONE != mTeleportState) && (mTeleportState != TELEPORT_PENDING)) { - llwarns << "Attempt to teleport when already teleporting." << llendl; + LL_WARNS() << "Attempt to teleport when already teleporting." << LL_ENDL; return false; } @@ -3880,7 +3878,7 @@ bool LLAgent::teleportCore(bool is_local) gAgentCamera.resetView(FALSE); // local logic - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TELEPORT_COUNT); + add(LLStatViewer::TELEPORT, 1); if (is_local) { gAgent.setTeleportState( LLAgent::TELEPORT_LOCAL ); @@ -3892,6 +3890,7 @@ bool LLAgent::teleportCore(bool is_local) //release geometry from old location gPipeline.resetVertexBuffers(); + LLSpatialPartition::sTeleportRequested = TRUE; } make_ui_sound("UISndTeleportOut"); @@ -4104,6 +4103,7 @@ void LLAgent::teleportCancel() } clearTeleportRequest(); gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); + gPipeline.resetVertexBuffers(); } @@ -4136,7 +4136,7 @@ void LLAgent::doTeleportViaLocation(const LLVector3d& pos_global) else if(regionp && teleportCore(regionp->getHandle() == to_region_handle_global((F32)pos_global.mdV[VX], (F32)pos_global.mdV[VY]))) { - llwarns << "Using deprecated teleportlocationrequest." << llendl; + LL_WARNS() << "Using deprecated teleportlocationrequest." << LL_ENDL; // send the message LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_TeleportLocationRequest); @@ -4197,7 +4197,7 @@ void LLAgent::setTeleportState(ETeleportState state) case TELEPORT_ARRIVING: // First two position updates after a teleport tend to be weird - LLViewerStats::getInstance()->mAgentPositionSnaps.mCountOfNextUpdatesToIgnore = 2; + //LLViewerStats::getInstance()->mAgentPositionSnaps.mCountOfNextUpdatesToIgnore = 2; // Let the interested parties know we've teleported. LLViewerParcelMgr::getInstance()->onTeleportFinished(false, getPositionGlobal()); @@ -4214,7 +4214,7 @@ void LLAgent::stopCurrentAnimations() // avatar, propagating this change back to the server. if (isAgentAvatarValid()) { - LLDynamicArray<LLUUID> anim_ids; + std::vector<LLUUID> anim_ids; for ( LLVOAvatar::AnimIterator anim_it = gAgentAvatarp->mPlayingAnimations.begin(); @@ -4310,11 +4310,12 @@ void LLAgent::fidget() void LLAgent::stopFidget() { - LLDynamicArray<LLUUID> anims; - anims.put(ANIM_AGENT_STAND_1); - anims.put(ANIM_AGENT_STAND_2); - anims.put(ANIM_AGENT_STAND_3); - anims.put(ANIM_AGENT_STAND_4); + std::vector<LLUUID> anims; + anims.reserve(4); + anims.push_back(ANIM_AGENT_STAND_1); + anims.push_back(ANIM_AGENT_STAND_2); + anims.push_back(ANIM_AGENT_STAND_3); + anims.push_back(ANIM_AGENT_STAND_4); gAgent.sendAnimationRequests(anims, ANIM_REQUEST_STOP); } @@ -4365,7 +4366,7 @@ void LLAgent::dumpSentAppearance(const std::string& dump_prefix) } else { - LL_DEBUGS("Avatar") << "dumping sent appearance message to " << fullpath << llendl; + LL_DEBUGS("Avatar") << "dumping sent appearance message to " << fullpath << LL_ENDL; } LLVisualParam* appearance_version_param = gAgentAvatarp->getVisualParam(11000); @@ -4408,7 +4409,7 @@ void LLAgent::sendAgentSetAppearance() gAgentAvatarp->bakedTextureOriginCounts(sb_count, host_count, both_count, neither_count); if (both_count != 0 || neither_count != 0) { - llwarns << "bad bake texture state " << sb_count << "," << host_count << "," << both_count << "," << neither_count << llendl; + LL_WARNS() << "bad bake texture state " << sb_count << "," << host_count << "," << both_count << "," << neither_count << LL_ENDL; } if (sb_count != 0 && host_count == 0) { @@ -4420,7 +4421,7 @@ void LLAgent::sendAgentSetAppearance() } else if (sb_count + host_count > 0) { - llwarns << "unclear baked texture state, not sending appearance" << llendl; + LL_WARNS() << "unclear baked texture state, not sending appearance" << LL_ENDL; return; } @@ -4464,7 +4465,7 @@ void LLAgent::sendAgentSetAppearance() // IMG_DEFAULT_AVATAR means not baked. 0 index should be ignored for baked textures if (!gAgentAvatarp->isTextureDefined(texture_index, 0)) { - LL_DEBUGS("Avatar") << "texture not current for baked " << (S32)baked_index << " local " << (S32)texture_index << llendl; + LL_DEBUGS("Avatar") << "texture not current for baked " << (S32)baked_index << " local " << (S32)texture_index << LL_ENDL; textures_current = FALSE; break; } @@ -4532,7 +4533,7 @@ void LLAgent::sendAgentSetAppearance() } } -// llinfos << "Avatar XML num VisualParams transmitted = " << transmitted_params << llendl; + //LL_INFOS() << "Avatar XML num VisualParams transmitted = " << transmitted_params << LL_ENDL; sendReliableMessage(); } @@ -4573,8 +4574,8 @@ void LLAgent::parseTeleportMessages(const std::string& xml_filename) if (!success || !root || !root->hasName( "teleport_messages" )) { - llerrs << "Problem reading teleport string XML file: " - << xml_filename << llendl; + LL_ERRS() << "Problem reading teleport string XML file: " + << xml_filename << LL_ENDL; return; } @@ -4638,11 +4639,11 @@ void LLAgent::sendAgentUpdateUserInfo(bool im_via_email, const std::string& dire // static void LLAgent::dumpGroupInfo() { - llinfos << "group " << gAgent.mGroupName << llendl; - llinfos << "ID " << gAgent.mGroupID << llendl; - llinfos << "powers " << gAgent.mGroupPowers << llendl; - llinfos << "title " << gAgent.mGroupTitle << llendl; - //llinfos << "insig " << gAgent.mGroupInsigniaID << llendl; + LL_INFOS() << "group " << gAgent.mGroupName << LL_ENDL; + LL_INFOS() << "ID " << gAgent.mGroupID << LL_ENDL; + LL_INFOS() << "powers " << gAgent.mGroupPowers << LL_ENDL; + LL_INFOS() << "title " << gAgent.mGroupTitle << LL_ENDL; + //LL_INFOS() << "insig " << gAgent.mGroupInsigniaID << LL_ENDL; } // Draw a representation of current autopilot target diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 0766407494efd06637d9024a9e34fa92045a2deb..1a573d32ce67cac68079157ae7d68c8d883651c5 100755 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -29,12 +29,12 @@ #include "indra_constants.h" #include "llevent.h" // LLObservable base class -#include "llagentconstants.h" #include "llagentdata.h" // gAgentID, gAgentSessionID #include "llcharacter.h" #include "llcoordframe.h" // for mFrameAgent #include "llavatarappearancedefines.h" #include "llpermissionsflags.h" +#include "v3dmath.h" #include <boost/function.hpp> #include <boost/shared_ptr.hpp> @@ -247,7 +247,7 @@ class LLAgent : public LLOldEvents::LLObservable //-------------------------------------------------------------------- // Region //-------------------------------------------------------------------- - public: +public: void setRegion(LLViewerRegion *regionp); LLViewerRegion *getRegion() const; LLHost getRegionHost() const; @@ -276,7 +276,7 @@ class LLAgent : public LLOldEvents::LLObservable boost::signals2::connection addRegionChangedCallback(const region_changed_signal_t::slot_type& cb); void removeRegionChangedCallback(boost::signals2::connection callback); - private: +private: LLViewerRegion *mRegionp; region_changed_signal_t mRegionChangedSignal; @@ -290,6 +290,7 @@ class LLAgent : public LLOldEvents::LLObservable const LLVector3d &getLastPositionGlobal() const { return mLastPositionGlobal; } void setLastPositionGlobal(const LLVector3d &pos) { mLastPositionGlobal = pos; } + private: std::set<U64> mRegionsVisited; // Stat - what distinct regions has the avatar been to? F64 mDistanceTraveled; // Stat - how far has the avatar moved? @@ -468,7 +469,7 @@ class LLAgent : public LLOldEvents::LLObservable void stopCurrentAnimations(); void requestStopMotion(LLMotion* motion); void onAnimStop(const LLUUID& id); - void sendAnimationRequests(LLDynamicArray<LLUUID> &anim_ids, EAnimRequest request); + void sendAnimationRequests(const std::vector<LLUUID> &anim_ids, EAnimRequest request); void sendAnimationRequest(const LLUUID &anim_id, EAnimRequest request); void sendAnimationStateReset(); void sendRevokePermissions(const LLUUID & target, U32 permissions); @@ -841,7 +842,7 @@ class LLAgent : public LLOldEvents::LLObservable // Only used for building titles. BOOL isGroupMember() const { return !mGroupID.isNull(); } public: - LLDynamicArray<LLGroupData> mGroups; + std::vector<LLGroupData> mGroups; //-------------------------------------------------------------------- // Group Title diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 488a134aa24d008fc6cca74fdd3f708f75be5b89..d1dfbe3315c6fe5b411526a6706eacb2bc1fa1c3 100755 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -337,7 +337,7 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera) LLVector3 agent_at_axis = gAgent.getAtAxis(); agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector()); agent_at_axis.normalize(); - gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLCriticalDamp::getInterpolant(0.3f))); + gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLSmoothInterpolation::getInterpolant(0.3f))); } setFocusOnAvatar(TRUE, ANIMATE); @@ -563,10 +563,10 @@ BOOL LLAgentCamera::calcCameraMinDistance(F32 &obj_min_distance) if (mFocusObject->mDrawable.isNull()) { #ifdef LL_RELEASE_FOR_DOWNLOAD - llwarns << "Focus object with no drawable!" << llendl; + LL_WARNS() << "Focus object with no drawable!" << LL_ENDL; #else mFocusObject->dump(); - llerrs << "Focus object with no drawable!" << llendl; + LL_ERRS() << "Focus object with no drawable!" << LL_ENDL; #endif obj_min_distance = 0.f; return TRUE; @@ -1070,8 +1070,8 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot->getWorldRotation(); LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot->getWorldRotation(); - if ((gViewerWindow->getMouseVelocityStat()->getCurrent() < 0.01f) && - (root_at * last_at_axis > 0.95f)) + if (LLTrace::get_frame_recording().getLastRecording().getLastValue(*gViewerWindow->getMouseVelocityStat()) < 0.01f + && (root_at * last_at_axis > 0.95f)) { LLVector3 vel = gAgentAvatarp->getVelocity(); if (vel.magVecSquared() > 4.f) @@ -1126,13 +1126,14 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y) } } +static LLTrace::BlockTimerStatHandle FTM_UPDATE_CAMERA("Camera"); + //----------------------------------------------------------------------------- // updateCamera() //----------------------------------------------------------------------------- void LLAgentCamera::updateCamera() { - static LLFastTimer::DeclareTimer ftm("Camera"); - LLFastTimer t(ftm); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_CAMERA); // - changed camera_skyward to the new global "mCameraUpVector" mCameraUpVector = LLVector3::z_axis; @@ -1234,7 +1235,7 @@ void LLAgentCamera::updateCamera() gAgentCamera.clearPanKeys(); // lerp camera focus offset - mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLCriticalDamp::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); + mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLSmoothInterpolation::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); if ( mCameraMode == CAMERA_MODE_FOLLOW ) { @@ -1352,7 +1353,7 @@ void LLAgentCamera::updateCamera() { const F32 SMOOTHING_HALF_LIFE = 0.02f; - F32 smoothing = LLCriticalDamp::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); + F32 smoothing = LLSmoothInterpolation::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE); if (!mFocusObject) // we differentiate on avatar mode { @@ -1382,9 +1383,9 @@ void LLAgentCamera::updateCamera() } - mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLCriticalDamp::getInterpolant(FOV_ZOOM_HALF_LIFE)); + mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLSmoothInterpolation::getInterpolant(FOV_ZOOM_HALF_LIFE)); -// llinfos << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << llendl; +// LL_INFOS() << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << LL_ENDL; LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal); @@ -1688,7 +1689,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) { if (!isAgentAvatarValid() || gAgentAvatarp->mDrawable.isNull()) { - llwarns << "Null avatar drawable!" << llendl; + LL_WARNS() << "Null avatar drawable!" << LL_ENDL; return LLVector3d::zero; } head_offset.clearVec(); @@ -1796,7 +1797,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) if (mTargetCameraDistance != mCurrentCameraDistance) { - F32 camera_lerp_amt = LLCriticalDamp::getInterpolant(CAMERA_ZOOM_HALF_LIFE); + F32 camera_lerp_amt = LLSmoothInterpolation::getInterpolant(CAMERA_ZOOM_HALF_LIFE); mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt); } @@ -1813,7 +1814,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) if (isAgentAvatarValid()) { LLVector3d camera_lag_d; - F32 lag_interp = LLCriticalDamp::getInterpolant(CAMERA_LAG_HALF_LIFE); + F32 lag_interp = LLSmoothInterpolation::getInterpolant(CAMERA_LAG_HALF_LIFE); LLVector3 target_lag; LLVector3 vel = gAgent.getVelocity(); @@ -1858,7 +1859,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) } else { - mCameraLag = lerp(mCameraLag, LLVector3::zero, LLCriticalDamp::getInterpolant(0.15f)); + mCameraLag = lerp(mCameraLag, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.15f)); } camera_lag_d.setVec(mCameraLag); @@ -2267,22 +2268,22 @@ void LLAgentCamera::changeCameraToCustomizeAvatar() gFocusMgr.setKeyboardFocus( NULL ); gFocusMgr.setMouseCapture( NULL ); - // Remove any pitch or rotation from the avatar - LLVector3 at = gAgent.getAtAxis(); - at.mV[VZ] = 0.f; - at.normalize(); - gAgent.resetAxes(at); + // Remove any pitch or rotation from the avatar + LLVector3 at = gAgent.getAtAxis(); + at.mV[VZ] = 0.f; + at.normalize(); + gAgent.resetAxes(at); - gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); - gAgent.setCustomAnim(TRUE); - gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); - LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); + gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START); + gAgent.setCustomAnim(TRUE); + gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE); + LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE); - if (turn_motion) - { - // delay camera animation long enough to play through turn animation - setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); - } + if (turn_motion) + { + // delay camera animation long enough to play through turn animation + setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); + } } LLVector3 agent_at = gAgent.getAtAxis(); diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp index a4c0b056ac192f5384cb81e41fad73520279fb1d..7887184a11b01ed3968a6c4f5298c1e7d0caf0bf 100755 --- a/indra/newview/llagentlistener.cpp +++ b/indra/newview/llagentlistener.cpp @@ -193,8 +193,8 @@ void LLAgentListener::requestSit(LLSD const & event_data) const } else { - llwarns << "LLAgent requestSit could not find the sit target: " - << event_data << llendl; + LL_WARNS() << "LLAgent requestSit could not find the sit target: " + << event_data << LL_ENDL; } } @@ -276,8 +276,8 @@ void LLAgentListener::requestTouch(LLSD const & event_data) const } else { - llwarns << "LLAgent requestTouch could not find the touch target " - << event_data["obj_uuid"].asUUID() << llendl; + LL_WARNS() << "LLAgent requestTouch could not find the touch target " + << event_data["obj_uuid"].asUUID() << LL_ENDL; } } @@ -504,7 +504,7 @@ void LLAgentListener::lookAt(LLSD const & event_data) const void LLAgentListener::getGroups(const LLSD& event) const { LLSD reply(LLSD::emptyArray()); - for (LLDynamicArray<LLGroupData>::const_iterator + for (std::vector<LLGroupData>::const_iterator gi(mAgent.mGroups.begin()), gend(mAgent.mGroups.end()); gi != gend; ++gi) { diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp index 192ed141c746beb7bf368a43b3faec34d9b949d8..799060eeab1ba71142d15215ce97f09313c7a414 100755 --- a/indra/newview/llagentpicksinfo.cpp +++ b/indra/newview/llagentpicksinfo.cpp @@ -28,9 +28,11 @@ #include "llagentpicksinfo.h" #include "llagent.h" -#include "llavatarconstants.h" #include "llavatarpropertiesprocessor.h" +const S32 MAX_AVATAR_PICKS = 10; + + class LLAgentPicksInfo::LLAgentPicksObserver : public LLAvatarPropertiesObserver { public: @@ -117,7 +119,7 @@ void LLAgentPicksInfo::onServerRespond(LLAvatarPicks* picks) { if(!picks) { - llerrs << "Unexpected value" << llendl; + LL_ERRS() << "Unexpected value" << LL_ENDL; return; } diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index c7872fc5f61e5f9ee169947061db292e48fef769..44589f0d57da8c5a24cc165b86df68b5afcfe251 100755 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -72,7 +72,7 @@ void LLAgentPilot::load() } else { - lldebugs << "no autopilot file found" << llendl; + LL_DEBUGS() << "no autopilot file found" << LL_ENDL; return; } } @@ -88,20 +88,21 @@ void LLAgentPilot::loadTxt(const std::string& filename) if (!file) { - lldebugs << "Couldn't open " << filename - << ", aborting agentpilot load!" << llendl; + LL_DEBUGS() << "Couldn't open " << filename + << ", aborting agentpilot load!" << LL_ENDL; return; } else { - llinfos << "Opening pilot file " << filename << llendl; + LL_INFOS() << "Opening pilot file " << filename << LL_ENDL; } - mActions.reset(); + mActions.clear(); S32 num_actions; file >> num_actions; + mActions.reserve(num_actions); for (S32 i = 0; i < num_actions; i++) { S32 action_type; @@ -109,7 +110,7 @@ void LLAgentPilot::loadTxt(const std::string& filename) file >> new_action.mTime >> action_type; file >> new_action.mTarget.mdV[VX] >> new_action.mTarget.mdV[VY] >> new_action.mTarget.mdV[VZ]; new_action.mType = (EActionType)action_type; - mActions.put(new_action); + mActions.push_back(new_action); } mOverrideCamera = false; @@ -128,16 +129,16 @@ void LLAgentPilot::loadXML(const std::string& filename) if (!file) { - lldebugs << "Couldn't open " << filename - << ", aborting agentpilot load!" << llendl; + LL_DEBUGS() << "Couldn't open " << filename + << ", aborting agentpilot load!" << LL_ENDL; return; } else { - llinfos << "Opening pilot file " << filename << llendl; + LL_INFOS() << "Opening pilot file " << filename << LL_ENDL; } - mActions.reset(); + mActions.clear(); LLSD record; while (!file.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(record, file)) { @@ -150,7 +151,7 @@ void LLAgentPilot::loadXML(const std::string& filename) action.mCameraXAxis = ll_vector3_from_sd(record["camera_xaxis"]); action.mCameraYAxis = ll_vector3_from_sd(record["camera_yaxis"]); action.mCameraZAxis = ll_vector3_from_sd(record["camera_zaxis"]); - mActions.put(action); + mActions.push_back(action); } mOverrideCamera = true; file.close(); @@ -171,13 +172,13 @@ void LLAgentPilot::saveTxt(const std::string& filename) if (!file) { - llinfos << "Couldn't open " << filename << ", aborting agentpilot save!" << llendl; + LL_INFOS() << "Couldn't open " << filename << ", aborting agentpilot save!" << LL_ENDL; } - file << mActions.count() << '\n'; + file << mActions.size() << '\n'; S32 i; - for (i = 0; i < mActions.count(); i++) + for (i = 0; i < mActions.size(); i++) { file << mActions[i].mTime << "\t" << mActions[i].mType << "\t"; file << std::setprecision(32) << mActions[i].mTarget.mdV[VX] << "\t" << mActions[i].mTarget.mdV[VY] << "\t" << mActions[i].mTarget.mdV[VZ]; @@ -194,11 +195,11 @@ void LLAgentPilot::saveXML(const std::string& filename) if (!file) { - llinfos << "Couldn't open " << filename << ", aborting agentpilot save!" << llendl; + LL_INFOS() << "Couldn't open " << filename << ", aborting agentpilot save!" << LL_ENDL; } S32 i; - for (i = 0; i < mActions.count(); i++) + for (i = 0; i < mActions.size(); i++) { Action& action = mActions[i]; LLSD record; @@ -217,7 +218,7 @@ void LLAgentPilot::saveXML(const std::string& filename) void LLAgentPilot::startRecord() { - mActions.reset(); + mActions.clear(); mTimer.reset(); addAction(STRAIGHT); mRecording = TRUE; @@ -232,7 +233,7 @@ void LLAgentPilot::stopRecord() void LLAgentPilot::addAction(enum EActionType action_type) { - llinfos << "Adding waypoint: " << gAgent.getPositionGlobal() << llendl; + LL_INFOS() << "Adding waypoint: " << gAgent.getPositionGlobal() << LL_ENDL; Action action; action.mType = action_type; action.mTarget = gAgent.getPositionGlobal(); @@ -244,7 +245,7 @@ void LLAgentPilot::addAction(enum EActionType action_type) action.mCameraYAxis = cam->getYAxis(); action.mCameraZAxis = cam->getZAxis(); mLastRecordTime = (F32)action.mTime; - mActions.put(action); + mActions.push_back(action); } void LLAgentPilot::startPlayback() @@ -255,16 +256,16 @@ void LLAgentPilot::startPlayback() mCurrentAction = 0; mTimer.reset(); - if (mActions.count()) + if (mActions.size()) { - llinfos << "Starting playback, moving to waypoint 0" << llendl; + LL_INFOS() << "Starting playback, moving to waypoint 0" << LL_ENDL; gAgent.startAutoPilotGlobal(mActions[0].mTarget); moveCamera(); mStarted = FALSE; } else { - llinfos << "No autopilot data, cancelling!" << llendl; + LL_INFOS() << "No autopilot data, cancelling!" << LL_ENDL; mPlaying = FALSE; } } @@ -291,7 +292,7 @@ void LLAgentPilot::moveCamera() if (!getOverrideCamera()) return; - if (mCurrentAction<mActions.count()) + if (mCurrentAction<mActions.size()) { S32 start_index = llmax(mCurrentAction-1,0); S32 end_index = mCurrentAction; @@ -305,7 +306,7 @@ void LLAgentPilot::moveCamera() if ((t<0.0)||(t>1.0)) { - llwarns << "mCurrentAction is invalid, t = " << t << llendl; + LL_WARNS() << "mCurrentAction is invalid, t = " << t << LL_ENDL; return; } @@ -331,7 +332,7 @@ void LLAgentPilot::updateTarget() { if (mPlaying) { - if (mCurrentAction < mActions.count()) + if (mCurrentAction < mActions.size()) { if (0 == mCurrentAction) { @@ -344,7 +345,7 @@ void LLAgentPilot::updateTarget() { if (!mStarted) { - llinfos << "At start, beginning playback" << llendl; + LL_INFOS() << "At start, beginning playback" << LL_ENDL; mTimer.reset(); mStarted = TRUE; } @@ -355,7 +356,7 @@ void LLAgentPilot::updateTarget() //gAgent.stopAutoPilot(); mCurrentAction++; - if (mCurrentAction < mActions.count()) + if (mCurrentAction < mActions.size()) { gAgent.startAutoPilotGlobal(mActions[mCurrentAction].mTarget); moveCamera(); @@ -368,17 +369,17 @@ void LLAgentPilot::updateTarget() { if ((mNumRuns < 0) || (mNumRuns > 0)) { - llinfos << "Looping, restarting playback" << llendl; + LL_INFOS() << "Looping, restarting playback" << LL_ENDL; startPlayback(); } else if (mQuitAfterRuns) { - llinfos << "Done with all runs, quitting viewer!" << llendl; + LL_INFOS() << "Done with all runs, quitting viewer!" << LL_ENDL; LLAppViewer::instance()->forceQuit(); } else { - llinfos << "Done with all runs, disabling pilot" << llendl; + LL_INFOS() << "Done with all runs, disabling pilot" << LL_ENDL; stopPlayback(); } } diff --git a/indra/newview/llagentpilot.h b/indra/newview/llagentpilot.h index dd1709ec0c21cb1af0d562a96d865c21c0a8c1d3..f6b63760862e4e9ec5c372583fdecd649e102754 100755 --- a/indra/newview/llagentpilot.h +++ b/indra/newview/llagentpilot.h @@ -30,7 +30,6 @@ #include "stdtypes.h" #include "lltimer.h" #include "v3dmath.h" -#include "lldarray.h" // Class that drives the agent around according to a "script". @@ -113,7 +112,7 @@ class LLAgentPilot LLVector3 mCameraZAxis; }; - LLDynamicArray<Action> mActions; + std::vector<Action> mActions; LLTimer mTimer; }; diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index fa810aac76bb6950fd5a3359cf794abe7f1ad5d7..58981d0e063765514930994d0c19e127d3a69236 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -39,6 +39,7 @@ #include "llinventoryfunctions.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" +#include "lllocaltextureobject.h" #include "llmd5.h" #include "llnotificationsutil.h" #include "lloutfitobserver.h" @@ -62,15 +63,15 @@ using namespace LLAvatarAppearanceDefines; // Callback to wear and start editing an item that has just been created. void wear_and_edit_cb(const LLUUID& inv_item) - { - if (inv_item.isNull()) return; - - // Request editing the item after it gets worn. - gAgentWearables.requestEditingWearable(inv_item); - - // Wear it. - LLAppearanceMgr::instance().wearItemOnAvatar(inv_item); - } +{ + if (inv_item.isNull()) return; + + // Request editing the item after it gets worn. + gAgentWearables.requestEditingWearable(inv_item); + + // Wear it. + LLAppearanceMgr::instance().wearItemOnAvatar(inv_item); +} /////////////////////////////////////////////////////////////////////////////// @@ -90,48 +91,48 @@ void checkWearableAgainstInventory(LLViewerWearable *wearable) { if (!item->isWearableType()) { - llwarns << "wearable associated with non-wearable item" << llendl; + LL_WARNS() << "wearable associated with non-wearable item" << LL_ENDL; } if (item->getWearableType() != wearable->getType()) { - llwarns << "type mismatch: wearable " << wearable->getName() + LL_WARNS() << "type mismatch: wearable " << wearable->getName() << " has type " << wearable->getType() << " but inventory item " << item->getName() - << " has type " << item->getWearableType() << llendl; + << " has type " << item->getWearableType() << LL_ENDL; } } else { - llwarns << "wearable inventory item not found" << wearable->getName() - << " itemID " << wearable->getItemID().asString() << llendl; + LL_WARNS() << "wearable inventory item not found" << wearable->getName() + << " itemID " << wearable->getItemID().asString() << LL_ENDL; } } void LLAgentWearables::dump() { - llinfos << "LLAgentWearablesDump" << llendl; + LL_INFOS() << "LLAgentWearablesDump" << LL_ENDL; for (S32 i = 0; i < LLWearableType::WT_COUNT; i++) { U32 count = getWearableCount((LLWearableType::EType)i); - llinfos << "Type: " << i << " count " << count << llendl; + LL_INFOS() << "Type: " << i << " count " << count << LL_ENDL; for (U32 j=0; j<count; j++) { LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)i,j); if (wearable == NULL) { - llinfos << " " << j << " NULL wearable" << llendl; + LL_INFOS() << " " << j << " NULL wearable" << LL_ENDL; } - llinfos << " " << j << " Name " << wearable->getName() - << " description " << wearable->getDescription() << llendl; + LL_INFOS() << " " << j << " Name " << wearable->getName() + << " description " << wearable->getDescription() << LL_ENDL; } } - llinfos << "Total items awaiting wearable update " << mItemsAwaitingWearableUpdate.size() << llendl; + LL_INFOS() << "Total items awaiting wearable update " << mItemsAwaitingWearableUpdate.size() << LL_ENDL; for (std::set<LLUUID>::iterator it = mItemsAwaitingWearableUpdate.begin(); it != mItemsAwaitingWearableUpdate.end(); ++it) { - llinfos << (*it).asString() << llendl; + LL_INFOS() << (*it).asString() << LL_ENDL; } } @@ -140,15 +141,15 @@ struct LLAgentDumper LLAgentDumper(std::string name): mName(name) { - llinfos << llendl; - llinfos << "LLAgentDumper " << mName << llendl; + LL_INFOS() << LL_ENDL; + LL_INFOS() << "LLAgentDumper " << mName << LL_ENDL; gAgentWearables.dump(); } ~LLAgentDumper() { - llinfos << llendl; - llinfos << "~LLAgentDumper " << mName << llendl; + LL_INFOS() << LL_ENDL; + LL_INFOS() << "~LLAgentDumper " << mName << LL_ENDL; gAgentWearables.dump(); } @@ -180,17 +181,17 @@ void LLAgentWearables::initClass() } void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar) -{ +{ llassert(avatar); - avatar->outputRezTiming("Sending wearables request"); - sendAgentWearablesRequest(); + avatar->outputRezTiming("Sending wearables request"); + sendAgentWearablesRequest(); setAvatarAppearance(avatar); } // wearables LLAgentWearables::createStandardWearablesAllDoneCallback::~createStandardWearablesAllDoneCallback() { - llinfos << "destructor - all done?" << llendl; + LL_INFOS() << "destructor - all done?" << LL_ENDL; gAgentWearables.createStandardWearablesAllDone(); } @@ -218,14 +219,14 @@ LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInvento mCB(cb), mDescription(description) { - llinfos << "constructor" << llendl; + LL_INFOS() << "constructor" << LL_ENDL; } void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& inv_item) { if (mTodo & CALL_CREATESTANDARDDONE) { - llinfos << "callback fired, inv_item " << inv_item.asString() << llendl; + LL_INFOS() << "callback fired, inv_item " << inv_item.asString() << LL_ENDL; } if (inv_item.isNull()) @@ -265,7 +266,7 @@ void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::ETy const LLUUID& item_id, LLViewerWearable* wearable) { - llinfos << "type " << type << " index " << index << " item " << item_id.asString() << llendl; + LL_INFOS() << "type " << type << " index " << index << " item " << item_id.asString() << LL_ENDL; if (item_id.isNull()) return; @@ -343,7 +344,7 @@ void LLAgentWearables::sendAgentWearablesUpdate() gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - lldebugs << "sendAgentWearablesUpdate()" << llendl; + LL_DEBUGS() << "sendAgentWearablesUpdate()" << LL_ENDL; // MULTI-WEARABLE: DEPRECATED: HACK: index to 0- server database tables don't support concept of multiwearables. for (S32 type=0; type < LLWearableType::WT_COUNT; ++type) { @@ -355,7 +356,7 @@ void LLAgentWearables::sendAgentWearablesUpdate() LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type, 0); if (wearable) { - //llinfos << "Sending wearable " << wearable->getName() << llendl; + //LL_INFOS() << "Sending wearable " << wearable->getName() << LL_ENDL; LLUUID item_id = wearable->getItemID(); const LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item && item->getIsLinkType()) @@ -368,11 +369,11 @@ void LLAgentWearables::sendAgentWearablesUpdate() } else { - //llinfos << "Not wearing wearable type " << LLWearableType::getTypeName((LLWearableType::EType)i) << llendl; + //LL_INFOS() << "Not wearing wearable type " << LLWearableType::getTypeName((LLWearableType::EType)i) << LL_ENDL; gMessageSystem->addUUIDFast(_PREHASH_ItemID, LLUUID::null); } - lldebugs << " " << LLWearableType::getTypeLabel((LLWearableType::EType)type) << ": " << (wearable ? wearable->getAssetID() : LLUUID::null) << llendl; + LL_DEBUGS() << " " << LLWearableType::getTypeLabel((LLWearableType::EType)type) << ": " << (wearable ? wearable->getAssetID() : LLUUID::null) << LL_ENDL; } gAgent.sendReliableMessage(); } @@ -401,7 +402,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 std::string item_name = item->getName(); if (name_changed) { - llinfos << "saveWearable changing name from " << item->getName() << " to " << new_name << llendl; + LL_INFOS() << "saveWearable changing name from " << item->getName() << " to " << new_name << LL_ENDL; item_name = new_name; } // Update existing inventory item @@ -461,20 +462,20 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, { if (!isWearableCopyable(type, index)) { - llwarns << "LLAgent::saveWearableAs() not copyable." << llendl; + LL_WARNS() << "LLAgent::saveWearableAs() not copyable." << LL_ENDL; return; } LLViewerWearable* old_wearable = getViewerWearable(type, index); if (!old_wearable) { - llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl; + LL_WARNS() << "LLAgent::saveWearableAs() no old wearable." << LL_ENDL; return; } LLInventoryItem* item = gInventory.getItem(getWearableItemID(type,index)); if (!item) { - llwarns << "LLAgent::saveWearableAs() no inventory item." << llendl; + LL_WARNS() << "LLAgent::saveWearableAs() no inventory item." << LL_ENDL; return; } std::string trunc_name(new_name); @@ -706,7 +707,7 @@ LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::ETyp } const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const - { +{ return dynamic_cast<const LLViewerWearable*> (getWearable(type, index)); } @@ -714,39 +715,39 @@ const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type) { return (gAgentWearables.getWearableCount(type) > 0); - } - +} + // virtual void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed) - { +{ if (isAgentAvatarValid()) { const BOOL upload_result = removed; gAgentAvatarp->wearableUpdated(wearable->getType(), upload_result); -} + } LLWearableData::wearableUpdated(wearable, removed); if (!removed) -{ + { LLViewerWearable* viewer_wearable = dynamic_cast<LLViewerWearable*>(wearable); viewer_wearable->refreshName(); - // Hack pt 2. If the wearable we just loaded has definition version 24, - // then force a re-save of this wearable after slamming the version number to 22. - // This number was incorrectly incremented for internal builds before release, and - // this fix will ensure that the affected wearables are re-saved with the right version number. - // the versions themselves are compatible. This code can be removed before release. - if( wearable->getDefinitionVersion() == 24 ) - { - wearable->setDefinitionVersion(22); - U32 index = getWearableIndex(wearable); - llinfos << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << llendl; - saveWearable(wearable->getType(),index,TRUE); - } + // Hack pt 2. If the wearable we just loaded has definition version 24, + // then force a re-save of this wearable after slamming the version number to 22. + // This number was incorrectly incremented for internal builds before release, and + // this fix will ensure that the affected wearables are re-saved with the right version number. + // the versions themselves are compatible. This code can be removed before release. + if( wearable->getDefinitionVersion() == 24 ) + { + wearable->setDefinitionVersion(22); + U32 index = getWearableIndex(wearable); + LL_INFOS() << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << LL_ENDL; + saveWearable(wearable->getType(),index,TRUE); + } checkWearableAgainstInventory(viewer_wearable); -} + } } BOOL LLAgentWearables::itemUpdatePending(const LLUUID& item_id) const @@ -830,7 +831,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); LLInitialWearablesFetch* outfit = new LLInitialWearablesFetch(current_outfit_id); - //lldebugs << "processAgentInitialWearablesUpdate()" << llendl; + //LL_DEBUGS() << "processAgentInitialWearablesUpdate()" << LL_ENDL; // Add wearables // MULTI-WEARABLE: DEPRECATED: Message only supports one wearable per type, will be ignored in future. gAgentWearables.mItemsAwaitingWearableUpdate.clear(); @@ -869,7 +870,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs outfit->add(wearable_data); } - lldebugs << " " << LLWearableType::getTypeLabel(type) << llendl; + LL_DEBUGS() << " " << LLWearableType::getTypeLabel(type) << LL_ENDL; } // Get the complete information on the items in the inventory and set up an observer @@ -897,7 +898,7 @@ void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type, { // Try to recover by replacing missing wearable with a new one. LLNotificationsUtil::add("ReplacedMissingWearable"); - lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << llendl; + LL_DEBUGS() << "Wearable " << LLWearableType::getTypeLabel(type) << " could not be downloaded. Replaced inventory item with default wearable." << LL_ENDL; LLViewerWearable* new_wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp); setWearable(type,index,new_wearable); @@ -938,7 +939,7 @@ void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearabl LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)wearable_type, wearable_index); if (!wearable) { - llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl; + LL_ERRS() << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << LL_ENDL; return; } LLLocalTextureObject lto; @@ -951,28 +952,28 @@ class OnWearableItemCreatedCB: public LLInventoryCallback OnWearableItemCreatedCB(): mWearablesAwaitingItems(LLWearableType::WT_COUNT,NULL) { - llinfos << "created callback" << llendl; + LL_INFOS() << "created callback" << LL_ENDL; } /* virtual */ void fire(const LLUUID& inv_item) { - llinfos << "One item created " << inv_item.asString() << llendl; + LL_INFOS() << "One item created " << inv_item.asString() << LL_ENDL; LLViewerInventoryItem *item = gInventory.getItem(inv_item); - mItemsToLink.put(item); + mItemsToLink.push_back(item); updatePendingWearable(inv_item); } ~OnWearableItemCreatedCB() { - llinfos << "All items created" << llendl; + LL_INFOS() << "All items created" << LL_ENDL; LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy; LLAppearanceMgr::instance().linkAll(LLAppearanceMgr::instance().getCOF(), - mItemsToLink, - link_waiter); + mItemsToLink, + link_waiter); } void addPendingWearable(LLViewerWearable *wearable) { if (!wearable) { - llwarns << "no wearable" << llendl; + LL_WARNS() << "no wearable" << LL_ENDL; return; } LLWearableType::EType type = wearable->getType(); @@ -982,7 +983,7 @@ class OnWearableItemCreatedCB: public LLInventoryCallback } else { - llwarns << "invalid type " << type << llendl; + LL_WARNS() << "invalid type " << type << LL_ENDL; } } void updatePendingWearable(const LLUUID& inv_item) @@ -990,12 +991,12 @@ class OnWearableItemCreatedCB: public LLInventoryCallback LLViewerInventoryItem *item = gInventory.getItem(inv_item); if (!item) { - llwarns << "no item found" << llendl; + LL_WARNS() << "no item found" << LL_ENDL; return; } if (!item->isWearableType()) { - llwarns << "non-wearable item found" << llendl; + LL_WARNS() << "non-wearable item found" << LL_ENDL; return; } if (item && item->isWearableType()) @@ -1009,7 +1010,7 @@ class OnWearableItemCreatedCB: public LLInventoryCallback } else { - llwarns << "invalid wearable type " << type << llendl; + LL_WARNS() << "invalid wearable type " << type << LL_ENDL; } } } @@ -1021,7 +1022,7 @@ class OnWearableItemCreatedCB: public LLInventoryCallback void LLAgentWearables::createStandardWearables() { - llwarns << "Creating standard wearables" << llendl; + LL_WARNS() << "Creating standard wearables" << LL_ENDL; if (!isAgentAvatarValid()) return; @@ -1069,7 +1070,7 @@ void LLAgentWearables::createStandardWearables() void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index) { - llinfos << "type " << type << " index " << index << llendl; + LL_INFOS() << "type " << type << " index " << index << LL_ENDL; if (!isAgentAvatarValid()) return; gAgentAvatarp->updateVisualParams(); @@ -1079,7 +1080,7 @@ void LLAgentWearables::createStandardWearablesAllDone() { // ... because sendAgentWearablesUpdate will notify inventory // observers. - llinfos << "all done?" << llendl; + LL_INFOS() << "all done?" << LL_ENDL; mWearablesLoaded = TRUE; checkWearablesLoaded(); @@ -1234,10 +1235,10 @@ void LLAgentWearables::removeWearableFinal(const LLWearableType::EType type, boo // Assumes existing wearables are not dirty. void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items, - const LLDynamicArray< LLViewerWearable* >& wearables, + const std::vector< LLViewerWearable* >& wearables, BOOL remove) { - llinfos << "setWearableOutfit() start" << llendl; + LL_INFOS() << "setWearableOutfit() start" << LL_ENDL; // TODO: Removed check for ensuring that teens don't remove undershirt and underwear. Handle later if (remove) @@ -1253,8 +1254,8 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it } } - S32 count = wearables.count(); - llassert(items.count() == count); + S32 count = wearables.size(); + llassert(items.size() == count); S32 i; for (i = 0; i < count; i++) @@ -1311,7 +1312,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it gAgentAvatarp->dumpAvatarTEs("setWearableOutfit"); - lldebugs << "setWearableOutfit() end" << llendl; + LL_DEBUGS() << "setWearableOutfit() end" << LL_ENDL; } @@ -1321,7 +1322,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearab //LLAgentDumper dumper("setWearableItem"); if (isWearingItem(new_item->getUUID())) { - llwarns << "wearable " << new_item->getUUID() << " is already worn" << llendl; + LL_WARNS() << "wearable " << new_item->getUUID() << " is already worn" << LL_ENDL; return; } @@ -1338,7 +1339,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearab if ((old_wearable->getAssetID() == new_wearable->getAssetID()) && (old_item_id == new_item->getUUID())) { - lldebugs << "No change to wearable asset and item: " << LLWearableType::getTypeName(type) << llendl; + LL_DEBUGS() << "No change to wearable asset and item: " << LLWearableType::getTypeName(type) << LL_ENDL; return; } @@ -1402,8 +1403,8 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara new_wearable->setItemID(new_item->getUUID()); const bool trigger_updated = false; pushWearable(type, new_wearable, trigger_updated); - llinfos << "Added additional wearable for type " << type - << " size is now " << getWearableCount(type) << llendl; + LL_INFOS() << "Added additional wearable for type " << type + << " size is now " << getWearableCount(type) << LL_ENDL; checkWearableAgainstInventory(new_wearable); } else @@ -1425,11 +1426,11 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWeara gInventory.addChangedMask(LLInventoryObserver::LABEL, old_item_id); gInventory.notifyObservers(); } - llinfos << "Replaced current element 0 for type " << type - << " size is now " << getWearableCount(type) << llendl; + LL_INFOS() << "Replaced current element 0 for type " << type + << " size is now " << getWearableCount(type) << LL_ENDL; } - //llinfos << "LLVOAvatar::setWearableItem()" << llendl; + //LL_INFOS() << "LLVOAvatar::setWearableItem()" << LL_ENDL; queryWearableCache(); //new_wearable->writeToAvatar(TRUE); @@ -1469,7 +1470,7 @@ void LLAgentWearables::queryWearableCache() ETextureIndex te_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index); - //llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl; + //LL_INFOS() << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << LL_ENDL; gMessageSystem->nextBlockFast(_PREHASH_WearableData); gMessageSystem->addUUIDFast(_PREHASH_ID, hash_id); gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)te_index); @@ -1496,12 +1497,12 @@ void LLAgentWearables::queryWearableCache() // virtual void LLAgentWearables::invalidateBakedTextureHash(LLMD5& hash) const { - // Add some garbage into the hash so that it becomes invalid. - if (isAgentAvatarValid()) - { - hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES); - } - } + // Add some garbage into the hash so that it becomes invalid. + if (isAgentAvatarValid()) + { + hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES); + } +} // User has picked "remove from avatar" from a menu. // static @@ -1537,10 +1538,10 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj std::set<LLUUID> requested_item_ids; std::set<LLUUID> current_item_ids; - for (S32 i=0; i<obj_item_array.count(); i++) + for (S32 i=0; i<obj_item_array.size(); i++) { const LLUUID & requested_id = obj_item_array[i].get()->getLinkedUUID(); - //llinfos << "Requested attachment id " << requested_id << llendl; + //LL_INFOS() << "Requested attachment id " << requested_id << LL_ENDL; requested_item_ids.insert(requested_id); } @@ -1573,12 +1574,12 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj if (remove_attachment) { - // llinfos << "found object to remove, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << llendl; + // LL_INFOS() << "found object to remove, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL; objects_to_remove.push_back(objectp); } else { - // llinfos << "found object to keep, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << llendl; + // LL_INFOS() << "found object to keep, id " << objectp->getID() << ", item " << objectp->getAttachmentItemID() << LL_ENDL; current_item_ids.insert(object_item_id); } } @@ -1603,7 +1604,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj } // S32 remove_count = objects_to_remove.size(); // S32 add_count = items_to_add.size(); - // llinfos << "remove " << remove_count << " add " << add_count << llendl; + // LL_INFOS() << "remove " << remove_count << " add " << add_count << LL_ENDL; // Remove everything in objects_to_remove userRemoveMultipleAttachments(objects_to_remove); @@ -1638,7 +1639,7 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_array_t& obj_item_array) { // Build a compound message to send all the objects that need to be rezzed. - S32 obj_count = obj_item_array.count(); + S32 obj_count = obj_item_array.size(); // Limit number of packets to send const S32 MAX_PACKETS_TO_SEND = 10; @@ -1669,7 +1670,7 @@ void LLAgentWearables::userAttachMultipleAttachments(LLInventoryModel::item_arra msg->addBOOLFast(_PREHASH_FirstDetachAll, false ); } - const LLInventoryItem* item = obj_item_array.get(i).get(); + const LLInventoryItem* item = obj_item_array.at(i).get(); msg->nextBlockFast(_PREHASH_ObjectData ); msg->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID()); msg->addUUIDFast(_PREHASH_OwnerID, item->getPermissions().getOwner()); @@ -1830,20 +1831,20 @@ void LLAgentWearables::editWearable(const LLUUID& item_id) LLViewerInventoryItem* item = gInventory.getLinkedItem(item_id); if (!item) { - llwarns << "Failed to get linked item" << llendl; + LL_WARNS() << "Failed to get linked item" << LL_ENDL; return; } LLViewerWearable* wearable = gAgentWearables.getWearableFromItemID(item_id); if (!wearable) { - llwarns << "Cannot get wearable" << llendl; + LL_WARNS() << "Cannot get wearable" << LL_ENDL; return; } if (!gAgentWearables.isWearableModifiable(item->getUUID())) { - llwarns << "Cannot modify wearable" << llendl; + LL_WARNS() << "Cannot modify wearable" << LL_ENDL; return; } @@ -1877,7 +1878,7 @@ void LLAgentWearables::updateServer() void LLAgentWearables::populateMyOutfitsFolder(void) { - llinfos << "starting outfit population" << llendl; + LL_INFOS() << "starting outfit population" << LL_ENDL; const LLUUID& my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS); LLLibraryOutfitsFetch* outfits = new LLLibraryOutfitsFetch(my_outfits_id); diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 5be4648636792a5c883750c57b635b1ea5abb46a..02d24892b5e5e9bbd2e11ffc55bf4295c088633c 100755 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -107,7 +107,7 @@ class LLAgentWearables : public LLInitClass<LLAgentWearables>, public LLWearable /*virtual*/void wearableUpdated(LLWearable *wearable, BOOL removed); public: void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false); - void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove); + void setWearableOutfit(const LLInventoryItem::item_array_t& items, const std::vector< LLViewerWearable* >& wearables, BOOL remove); void setWearableName(const LLUUID& item_id, const std::string& new_name); // *TODO: Move this into llappearance/LLWearableData ? void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index); diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 8b6b6db525058d2547a04262d55deffaf41e27f1..af0f02861de0e7f7c8bc7d447ba768f7533b84f1 100755 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -39,7 +39,7 @@ void order_my_outfits_cb() { if (!LLApp::isRunning()) { - llwarns << "called during shutdown, skipping" << llendl; + LL_WARNS() << "called during shutdown, skipping" << LL_ENDL; return; } @@ -54,11 +54,11 @@ void order_my_outfits_cb() //My Outfits should at least contain saved initial outfit and one another outfit if (cats->size() < 2) { - llwarning("My Outfits category was not populated properly", 0); + LL_WARNS() << "My Outfits category was not populated properly" << LL_ENDL; return; } - llinfos << "Starting updating My Outfits with wearables ordering information" << llendl; + LL_INFOS() << "Starting updating My Outfits with wearables ordering information" << LL_ENDL; for (LLInventoryModel::cat_array_t::iterator outfit_iter = cats->begin(); outfit_iter != cats->end(); ++outfit_iter) @@ -72,7 +72,7 @@ void order_my_outfits_cb() LLAppearanceMgr::getInstance()->updateClothingOrderingInfo(cat_id); } - llinfos << "Finished updating My Outfits with wearables ordering information" << llendl; + LL_INFOS() << "Finished updating My Outfits with wearables ordering information" << LL_ENDL; } LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) : @@ -127,7 +127,7 @@ void LLInitialWearablesFetch::processContents() LLInventoryModel::EXCLUDE_TRASH, is_wearable); LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); - if (wearable_array.count() > 0) + if (wearable_array.size() > 0) { gAgentWearables.notifyLoadingStarted(); LLAppearanceMgr::instance().updateAppearanceFromCOF(); @@ -165,7 +165,7 @@ class LLFetchAndLinkObserver: public LLInventoryFetchItemsObserver LLViewerInventoryItem *item = gInventory.getItem(*it); if (!item) { - llwarns << "fetch failed!" << llendl; + LL_WARNS() << "fetch failed!" << LL_ENDL; continue; } @@ -197,8 +197,8 @@ void LLInitialWearablesFetch::processWearablesMessage() } else { - llinfos << "Invalid wearable, type " << wearable_data->mType << " itemID " - << wearable_data->mItemID << " assetID " << wearable_data->mAssetID << llendl; + LL_INFOS() << "Invalid wearable, type " << wearable_data->mType << " itemID " + << wearable_data->mItemID << " assetID " << wearable_data->mAssetID << LL_ENDL; delete wearable_data; } } @@ -249,7 +249,7 @@ LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const LLUUID& my_outfits_id) : mCurrFetchStep(LOFS_FOLDER), mOutfitsPopulated(false) { - llinfos << "created" << llendl; + LL_INFOS() << "created" << LL_ENDL; mMyOutfitsID = LLUUID::null; mClothingID = LLUUID::null; @@ -260,12 +260,12 @@ LLLibraryOutfitsFetch::LLLibraryOutfitsFetch(const LLUUID& my_outfits_id) : LLLibraryOutfitsFetch::~LLLibraryOutfitsFetch() { - llinfos << "destroyed" << llendl; + LL_INFOS() << "destroyed" << LL_ENDL; } void LLLibraryOutfitsFetch::done() { - llinfos << "start" << llendl; + LL_INFOS() << "start" << LL_ENDL; // Delay this until idle() routine, since it's a heavy operation and // we also can't have it run within notifyObservers. @@ -275,7 +275,7 @@ void LLLibraryOutfitsFetch::done() void LLLibraryOutfitsFetch::doneIdle() { - llinfos << "start" << llendl; + LL_INFOS() << "start" << LL_ENDL; gInventory.addObserver(this); // Add this back in since it was taken out during ::done() @@ -301,7 +301,7 @@ void LLLibraryOutfitsFetch::doneIdle() contentsDone(); break; default: - llwarns << "Got invalid state for outfit fetch: " << mCurrFetchStep << llendl; + LL_WARNS() << "Got invalid state for outfit fetch: " << mCurrFetchStep << LL_ENDL; mOutfitsPopulated = TRUE; break; } @@ -317,7 +317,7 @@ void LLLibraryOutfitsFetch::doneIdle() void LLLibraryOutfitsFetch::folderDone() { - llinfos << "start" << llendl; + LL_INFOS() << "start" << LL_ENDL; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; @@ -326,7 +326,7 @@ void LLLibraryOutfitsFetch::folderDone() // Early out if we already have items in My Outfits // except the case when My Outfits contains just initial outfit - if (cat_array.count() > 1) + if (cat_array.size() > 1) { mOutfitsPopulated = true; return; @@ -342,9 +342,9 @@ void LLLibraryOutfitsFetch::folderDone() cat_array, wearable_array, LLInventoryModel::EXCLUDE_TRASH, matchFolderFunctor); - if (cat_array.count() > 0) + if (cat_array.size() > 0) { - const LLViewerInventoryCategory *cat = cat_array.get(0); + const LLViewerInventoryCategory *cat = cat_array.at(0); mLibraryClothingID = cat->getUUID(); } @@ -364,7 +364,7 @@ void LLLibraryOutfitsFetch::folderDone() void LLLibraryOutfitsFetch::outfitsDone() { - llinfos << "start" << llendl; + LL_INFOS() << "start" << LL_ENDL; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; @@ -374,7 +374,7 @@ void LLLibraryOutfitsFetch::outfitsDone() gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array, LLInventoryModel::EXCLUDE_TRASH); - llassert(cat_array.count() > 0); + llassert(cat_array.size() > 0); for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin(); iter != cat_array.end(); ++iter) @@ -401,7 +401,7 @@ void LLLibraryOutfitsFetch::outfitsDone() matchFolderFunctor); if (cat_array.size() > 0) { - const LLViewerInventoryCategory *cat = cat_array.get(0); + const LLViewerInventoryCategory *cat = cat_array.at(0); mImportedClothingID = cat->getUUID(); } @@ -443,7 +443,7 @@ class LLLibraryOutfitsCopyDone: public LLInventoryCallback // Copy the clothing folders from the library into the imported clothing folder void LLLibraryOutfitsFetch::libraryDone() { - llinfos << "start" << llendl; + LL_INFOS() << "start" << LL_ENDL; if (mImportedClothingID != LLUUID::null) { @@ -468,13 +468,13 @@ void LLLibraryOutfitsFetch::libraryDone() const LLViewerInventoryCategory *cat = gInventory.getCategory(src_folder_id); if (!cat) { - llwarns << "Library folder import for uuid:" << src_folder_id << " failed to find folder." << llendl; + LL_WARNS() << "Library folder import for uuid:" << src_folder_id << " failed to find folder." << LL_ENDL; continue; } if (!LLAppearanceMgr::getInstance()->getCanMakeFolderIntoOutfit(src_folder_id)) { - llinfos << "Skipping non-outfit folder name:" << cat->getName() << llendl; + LL_INFOS() << "Skipping non-outfit folder name:" << cat->getName() << LL_ENDL; continue; } @@ -500,7 +500,7 @@ void LLLibraryOutfitsFetch::libraryDone() void LLLibraryOutfitsFetch::importedFolderFetch() { - llinfos << "start" << llendl; + LL_INFOS() << "start" << LL_ENDL; // Fetch the contents of the Imported Clothing Folder uuid_vec_t folders; @@ -517,7 +517,7 @@ void LLLibraryOutfitsFetch::importedFolderFetch() void LLLibraryOutfitsFetch::importedFolderDone() { - llinfos << "start" << llendl; + LL_INFOS() << "start" << LL_ENDL; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; @@ -549,7 +549,7 @@ void LLLibraryOutfitsFetch::importedFolderDone() void LLLibraryOutfitsFetch::contentsDone() { - llinfos << "start" << llendl; + LL_INFOS() << "start" << LL_ENDL; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; @@ -564,7 +564,7 @@ void LLLibraryOutfitsFetch::contentsDone() const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id); if (!cat) { - llwarns << "Library folder import for uuid:" << folder_id << " failed to find folder." << llendl; + LL_WARNS() << "Library folder import for uuid:" << folder_id << " failed to find folder." << LL_ENDL; continue; } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index da1609297e434fe036d0f6a135786b7f4722ebe9..81f713502f6545248de1c303248f482dd28ba449 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -148,16 +148,16 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string item_array, LLInventoryModel::EXCLUDE_TRASH, has_name); - if (0 == cat_array.count()) + if (0 == cat_array.size()) return LLUUID(); else { - LLViewerInventoryCategory *cat = cat_array.get(0); + LLViewerInventoryCategory *cat = cat_array.at(0); if (cat) return cat->getUUID(); else { - llwarns << "null cat" << llendl; + LL_WARNS() << "null cat" << LL_ENDL; return LLUUID(); } } @@ -216,11 +216,11 @@ class LLCallAfterInventoryBatchMgr: public LLEventTimer // Request or re-request operation for specified item. void addItem(const LLUUID& item_id) { - LL_DEBUGS("Avatar") << "item_id " << item_id << llendl; + LL_DEBUGS("Avatar") << "item_id " << item_id << LL_ENDL; if (!requestOperation(item_id)) { - LL_DEBUGS("Avatar") << "item_id " << item_id << " requestOperation false, skipping" << llendl; + LL_DEBUGS("Avatar") << "item_id " << item_id << " requestOperation false, skipping" << LL_ENDL; return; } @@ -243,20 +243,20 @@ class LLCallAfterInventoryBatchMgr: public LLEventTimer { if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateLateOpRate")) { - llwarns << "Simulating late operation by punting handling to later" << llendl; + LL_WARNS() << "Simulating late operation by punting handling to later" << LL_ENDL; doAfterInterval(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,src_id,dst_id,timestamp), mRetryAfter); return; } mPendingRequests--; F32 elapsed = timestamp.getElapsedTimeF32(); - LL_DEBUGS("Avatar") << "op done, src_id " << src_id << " dst_id " << dst_id << " after " << elapsed << " seconds" << llendl; + LL_DEBUGS("Avatar") << "op done, src_id " << src_id << " dst_id " << dst_id << " after " << elapsed << " seconds" << LL_ENDL; if (mWaitTimes.find(src_id) == mWaitTimes.end()) { // No longer waiting for this item - either serviced // already or gave up after too many retries. - llwarns << "duplicate or late operation, src_id " << src_id << "dst_id " << dst_id - << " elapsed " << elapsed << " after end " << (S32) mCompletionOrFailureCalled << llendl; + LL_WARNS() << "duplicate or late operation, src_id " << src_id << "dst_id " << dst_id + << " elapsed " << elapsed << " after end " << (S32) mCompletionOrFailureCalled << LL_ENDL; } mTimeStats.push(elapsed); mWaitTimes.erase(src_id); @@ -291,13 +291,13 @@ class LLCallAfterInventoryBatchMgr: public LLEventTimer void onFailure() { - llinfos << "failed" << llendl; + LL_INFOS() << "failed" << LL_ENDL; mOnFailureFunc(); } void onCompletion() { - llinfos << "done" << llendl; + LL_INFOS() << "done" << LL_ENDL; mOnCompletionFunc(); } @@ -316,7 +316,7 @@ class LLCallAfterInventoryBatchMgr: public LLEventTimer if (!mWaitTimes.empty()) { - llwarns << "still waiting on " << mWaitTimes.size() << " items" << llendl; + LL_WARNS() << "still waiting on " << mWaitTimes.size() << " items" << LL_ENDL; for (std::map<LLUUID,LLTimer>::iterator it = mWaitTimes.begin(); it != mWaitTimes.end();) { @@ -331,13 +331,13 @@ class LLCallAfterInventoryBatchMgr: public LLEventTimer if (retries < mMaxRetries) { LL_DEBUGS("Avatar") << "Waited " << time_waited << - " for " << curr_it->first << ", retrying" << llendl; + " for " << curr_it->first << ", retrying" << LL_ENDL; mRetryCount++; addItem(curr_it->first); } else { - llwarns << "Giving up on " << curr_it->first << " after too many retries" << llendl; + LL_WARNS() << "Giving up on " << curr_it->first << " after too many retries" << LL_ENDL; mWaitTimes.erase(curr_it); mFailCount++; } @@ -354,16 +354,16 @@ class LLCallAfterInventoryBatchMgr: public LLEventTimer void reportStats() { - LL_DEBUGS("Avatar") << "Phase: " << mTrackingPhase << llendl; - LL_DEBUGS("Avatar") << "mFailCount: " << mFailCount << llendl; - LL_DEBUGS("Avatar") << "mRetryCount: " << mRetryCount << llendl; - LL_DEBUGS("Avatar") << "Times: n " << mTimeStats.getCount() << " min " << mTimeStats.getMinValue() << " max " << mTimeStats.getMaxValue() << llendl; - LL_DEBUGS("Avatar") << "Mean " << mTimeStats.getMean() << " stddev " << mTimeStats.getStdDev() << llendl; + LL_DEBUGS("Avatar") << "Phase: " << mTrackingPhase << LL_ENDL; + LL_DEBUGS("Avatar") << "mFailCount: " << mFailCount << LL_ENDL; + LL_DEBUGS("Avatar") << "mRetryCount: " << mRetryCount << LL_ENDL; + LL_DEBUGS("Avatar") << "Times: n " << mTimeStats.getCount() << " min " << mTimeStats.getMinValue() << " max " << mTimeStats.getMaxValue() << LL_ENDL; + LL_DEBUGS("Avatar") << "Mean " << mTimeStats.getMean() << " stddev " << mTimeStats.getStdDev() << LL_ENDL; } virtual ~LLCallAfterInventoryBatchMgr() { - LL_DEBUGS("Avatar") << "deleting" << llendl; + LL_DEBUGS("Avatar") << "deleting" << LL_ENDL; } protected: @@ -402,10 +402,10 @@ class LLCallAfterInventoryCopyMgr: public LLCallAfterInventoryBatchMgr { LLViewerInventoryItem *item = gInventory.getItem(item_id); llassert(item); - LL_DEBUGS("Avatar") << "copying item " << item_id << llendl; + LL_DEBUGS("Avatar") << "copying item " << item_id << LL_ENDL; if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateOpFailureRate")) { - LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << llendl; + LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << LL_ENDL; return true; } copy_inventory_item( @@ -444,14 +444,14 @@ class LLCallAfterInventoryLinkMgr: public LLCallAfterInventoryBatchMgr { if (item->getParentUUID() == mDstCatID) { - LL_DEBUGS("Avatar") << "item " << item_id << " name " << item->getName() << " is already a child of " << mDstCatID << llendl; + LL_DEBUGS("Avatar") << "item " << item_id << " name " << item->getName() << " is already a child of " << mDstCatID << LL_ENDL; return false; } - LL_DEBUGS("Avatar") << "linking item " << item_id << " name " << item->getName() << " to " << mDstCatID << llendl; + LL_DEBUGS("Avatar") << "linking item " << item_id << " name " << item->getName() << " to " << mDstCatID << LL_ENDL; // create an inventory item link. if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateOpFailureRate")) { - LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << llendl; + LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << LL_ENDL; return true; } link_inventory_item(gAgent.getID(), @@ -470,7 +470,7 @@ class LLCallAfterInventoryLinkMgr: public LLCallAfterInventoryBatchMgr LLViewerInventoryCategory *catp = gInventory.getCategory(item_id); if (!catp) { - llwarns << "link request failed, id not found as inventory item or category " << item_id << llendl; + LL_WARNS() << "link request failed, id not found as inventory item or category " << item_id << LL_ENDL; return false; } const LLUUID cof = LLAppearanceMgr::instance().getCOF(); @@ -482,10 +482,10 @@ class LLCallAfterInventoryLinkMgr: public LLCallAfterInventoryBatchMgr { if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateOpFailureRate")) { - LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << llendl; + LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << LL_ENDL; return true; } - LL_DEBUGS("Avatar") << "linking folder " << item_id << " name " << catp->getName() << " to cof " << cof << llendl; + LL_DEBUGS("Avatar") << "linking folder " << item_id << " name " << catp->getName() << " to cof " << cof << LL_ENDL; link_inventory_item(gAgent.getID(), item_id, cof, catp->getName(), "", LLAssetType::AT_LINK_FOLDER, new LLBoostFuncInventoryCallback( @@ -621,11 +621,11 @@ LLWearableHoldingPattern::LLWearableHoldingPattern(): { if (sActiveHoldingPatterns.size()>0) { - llinfos << "Creating LLWearableHoldingPattern when " + LL_INFOS() << "Creating LLWearableHoldingPattern when " << sActiveHoldingPatterns.size() << " other attempts are active." << " Flagging others as invalid." - << llendl; + << LL_ENDL; for (type_set_hp::iterator it = sActiveHoldingPatterns.begin(); it != sActiveHoldingPatterns.end(); ++it) @@ -692,7 +692,7 @@ void LLWearableHoldingPattern::checkMissingWearables() if (!isMostRecent()) { // runway why don't we actually skip here? - llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL; } std::vector<S32> found_by_type(LLWearableType::WT_COUNT,0); @@ -710,7 +710,7 @@ void LLWearableHoldingPattern::checkMissingWearables() { if (requested_by_type[type] > found_by_type[type]) { - llwarns << self_av_string() << "got fewer wearables than requested, type " << type << ": requested " << requested_by_type[type] << ", found " << found_by_type[type] << llendl; + LL_WARNS() << self_av_string() << "got fewer wearables than requested, type " << type << ": requested " << requested_by_type[type] << ", found " << found_by_type[type] << LL_ENDL; } if (found_by_type[type] > 0) continue; @@ -727,7 +727,7 @@ void LLWearableHoldingPattern::checkMissingWearables() mTypesToRecover.insert(type); mTypesToLink.insert(type); recoverMissingWearable((LLWearableType::EType)type); - llwarns << self_av_string() << "need to replace " << type << llendl; + LL_WARNS() << self_av_string() << "need to replace " << type << LL_ENDL; } } @@ -750,13 +750,13 @@ void LLWearableHoldingPattern::onAllComplete() if (!isMostRecent()) { // runway need to skip here? - llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL; } // Activate all gestures in this folder - if (mGestItems.count() > 0) + if (mGestItems.size() > 0) { - LL_DEBUGS("Avatar") << self_av_string() << "Activating " << mGestItems.count() << " gestures" << LL_ENDL; + LL_DEBUGS("Avatar") << self_av_string() << "Activating " << mGestItems.size() << " gestures" << LL_ENDL; LLGestureMgr::instance().activateGestures(mGestItems); @@ -779,7 +779,7 @@ void LLWearableHoldingPattern::onAllComplete() // Update attachments to match those requested. if (isAgentAvatarValid()) { - LL_DEBUGS("Avatar") << self_av_string() << "Updating " << mObjItems.count() << " attachments" << LL_ENDL; + LL_DEBUGS("Avatar") << self_av_string() << "Updating " << mObjItems.size() << " attachments" << LL_ENDL; LLAgentWearables::userUpdateAttachments(mObjItems); } @@ -802,7 +802,7 @@ void LLWearableHoldingPattern::onFetchCompletion() if (!isMostRecent()) { // runway skip here? - llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL; } checkMissingWearables(); @@ -814,7 +814,7 @@ bool LLWearableHoldingPattern::pollFetchCompletion() if (!isMostRecent()) { // runway skip here? - llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL; } bool completed = isFetchCompleted(); @@ -830,7 +830,7 @@ bool LLWearableHoldingPattern::pollFetchCompletion() if (timed_out) { - llwarns << self_av_string() << "Exceeded max wait time for wearables, updating appearance based on what has arrived" << llendl; + LL_WARNS() << self_av_string() << "Exceeded max wait time for wearables, updating appearance based on what has arrived" << LL_ENDL; } onFetchCompletion(); @@ -842,11 +842,11 @@ void recovered_item_link_cb(const LLUUID& item_id, LLWearableType::EType type, L { if (!holder->isMostRecent()) { - llwarns << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + LL_WARNS() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL; // runway skip here? } - llinfos << "Recovered item link for type " << type << llendl; + LL_INFOS() << "Recovered item link for type " << type << LL_ENDL; holder->eraseTypeToLink(type); // Add wearable to FoundData for actual wearing LLViewerInventoryItem *item = gInventory.getItem(item_id); @@ -870,12 +870,12 @@ void recovered_item_link_cb(const LLUUID& item_id, LLWearableType::EType type, L } else { - llwarns << self_av_string() << "inventory item not found for recovered wearable" << llendl; + LL_WARNS() << self_av_string() << "inventory item not found for recovered wearable" << LL_ENDL; } } else { - llwarns << self_av_string() << "inventory link not found for recovered wearable" << llendl; + LL_WARNS() << self_av_string() << "inventory link not found for recovered wearable" << LL_ENDL; } } @@ -884,7 +884,7 @@ void recovered_item_cb(const LLUUID& item_id, LLWearableType::EType type, LLView if (!holder->isMostRecent()) { // runway skip here? - llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL; } LL_DEBUGS("Avatar") << self_av_string() << "Recovered item for type " << type << LL_ENDL; @@ -910,13 +910,13 @@ void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type if (!isMostRecent()) { // runway skip here? - llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL; } // Try to recover by replacing missing wearable with a new one. LLNotificationsUtil::add("ReplacedMissingWearable"); - lldebugs << "Wearable " << LLWearableType::getTypeLabel(type) - << " could not be downloaded. Replaced inventory item with default wearable." << llendl; + LL_DEBUGS() << "Wearable " << LLWearableType::getTypeLabel(type) + << " could not be downloaded. Replaced inventory item with default wearable." << LL_ENDL; LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp); // Add a new one in the lost and found folder. @@ -960,7 +960,7 @@ bool LLWearableHoldingPattern::pollMissingWearables() if (!isMostRecent()) { // runway skip here? - llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL; } bool timed_out = isTimedOut(); @@ -1009,11 +1009,11 @@ void LLWearableHoldingPattern::handleLateArrivals() } if (!isMostRecent()) { - llwarns << self_av_string() << "Late arrivals not handled - outfit change no longer valid" << llendl; + LL_WARNS() << self_av_string() << "Late arrivals not handled - outfit change no longer valid" << LL_ENDL; } if (!mIsAllComplete) { - llwarns << self_av_string() << "Late arrivals not handled - in middle of missing wearables processing" << llendl; + LL_WARNS() << self_av_string() << "Late arrivals not handled - in middle of missing wearables processing" << LL_ENDL; } LL_INFOS("Avatar") << self_av_string() << "Need to handle " << mLateArrivals.size() << " late arriving wearables" << LL_ENDL; @@ -1092,19 +1092,19 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLViewerWearable *wearable) { if (!isMostRecent()) { - llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; + LL_WARNS() << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << LL_ENDL; } mResolved += 1; // just counting callbacks, not successes. LL_DEBUGS("Avatar") << self_av_string() << "resolved " << mResolved << "/" << getFoundList().size() << LL_ENDL; if (!wearable) { - llwarns << self_av_string() << "no wearable found" << llendl; + LL_WARNS() << self_av_string() << "no wearable found" << LL_ENDL; } if (mFired) { - llwarns << self_av_string() << "called after holder fired" << llendl; + LL_WARNS() << self_av_string() << "called after holder fired" << LL_ENDL; if (wearable) { mLateArrivals.insert(wearable); @@ -1130,7 +1130,7 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLViewerWearable *wearable) // Failing this means inventory or asset server are corrupted in a way we don't handle. if ((data.mWearableType >= LLWearableType::WT_COUNT) || (wearable->getType() != data.mWearableType)) { - llwarns << self_av_string() << "recovered wearable but type invalid. inventory wearable type: " << data.mWearableType << " asset wearable type: " << wearable->getType() << llendl; + LL_WARNS() << self_av_string() << "recovered wearable but type invalid. inventory wearable type: " << data.mWearableType << " asset wearable type: " << wearable->getType() << LL_ENDL; break; } @@ -1155,9 +1155,9 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items) // encountered, so we actually keep the *last* of each duplicate // item. This is needed to give the right priority when adding // duplicate items to an existing outfit. - for (S32 i=items.count()-1; i>=0; i--) + for (S32 i=items.size()-1; i>=0; i--) { - LLViewerInventoryItem *item = items.get(i); + LLViewerInventoryItem *item = items.at(i); LLUUID item_id = item->getLinkedUUID(); if (items_seen.find(item_id)!=items_seen.end()) continue; @@ -1168,7 +1168,7 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items) it != tmp_list.end(); ++it) { - new_items.put(*it); + new_items.push_back(*it); } items = new_items; } @@ -1251,7 +1251,7 @@ const LLUUID LLAppearanceMgr::getBaseOutfitUUID() if (outfit_cat->getPreferredType() != LLFolderType::FT_OUTFIT) { - llwarns << "Expected outfit type:" << LLFolderType::FT_OUTFIT << " but got type:" << outfit_cat->getType() << " for folder name:" << outfit_cat->getName() << llendl; + LL_WARNS() << "Expected outfit type:" << LLFolderType::FT_OUTFIT << " but got type:" << outfit_cat->getType() << " for folder name:" << outfit_cat->getName() << LL_ENDL; return LLUUID::null; } @@ -1440,10 +1440,10 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds LLInventoryCategory *src_cat = gInventory.getCategory(src_id); if (!src_cat) { - llwarns << "folder not found for src " << src_id.asString() << llendl; + LL_WARNS() << "folder not found for src " << src_id.asString() << LL_ENDL; return; } - llinfos << "starting, src_id " << src_id << " name " << src_cat->getName() << " dst_id " << dst_id << llendl; + LL_INFOS() << "starting, src_id " << src_id << " name " << src_cat->getName() << " dst_id " << dst_id << LL_ENDL; LLUUID parent_id = dst_id; if(parent_id.isNull()) { @@ -1464,7 +1464,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL LLInventoryModel::cat_array_t* cats; LLInventoryModel::item_array_t* items; gInventory.getDirectDescendentsOf(src_id, cats, items); - llinfos << "copying " << items->count() << " items" << llendl; + LL_INFOS() << "copying " << items->size() << " items" << LL_ENDL; for (LLInventoryModel::item_array_t::const_iterator iter = items->begin(); iter != items->end(); ++iter) @@ -1504,7 +1504,7 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL case LLAssetType::AT_BODYPART: case LLAssetType::AT_GESTURE: { - llinfos << "copying inventory item " << item->getName() << llendl; + LL_INFOS() << "copying inventory item " << item->getName() << LL_ENDL; copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), @@ -1644,9 +1644,9 @@ void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category) LLInventoryModel::item_array_t items; gInventory.collectDescendents(category, cats, items, LLInventoryModel::EXCLUDE_TRASH); - for (S32 i = 0; i < items.count(); ++i) + for (S32 i = 0; i < items.size(); ++i) { - LLViewerInventoryItem *item = items.get(i); + LLViewerInventoryItem *item = items.at(i); if (item->getActualType() != LLAssetType::AT_LINK_FOLDER) continue; if (item->getIsLinkType()) @@ -1666,9 +1666,9 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin LLInventoryModel::item_array_t items; gInventory.collectDescendents(category, cats, items, LLInventoryModel::EXCLUDE_TRASH); - for (S32 i = 0; i < items.count(); ++i) + for (S32 i = 0; i < items.size(); ++i) { - LLViewerInventoryItem *item = items.get(i); + LLViewerInventoryItem *item = items.at(i); if (keep_outfit_links && (item->getActualType() == LLAssetType::AT_LINK_FOLDER)) continue; if (item->getIsLinkType()) @@ -1676,7 +1676,7 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin #if 0 if (keep_items && keep_items->find(item) != LLInventoryModel::item_array_t::FAIL) { - llinfos << "preserved item" << llendl; + LL_INFOS() << "preserved item" << LL_ENDL; } else { @@ -1718,9 +1718,9 @@ void LLAppearanceMgr::linkAll(const LLUUID& cat_uuid, LLInventoryModel::item_array_t& items, LLPointer<LLInventoryCallback> cb) { - for (S32 i=0; i<items.count(); i++) + for (S32 i=0; i<items.size(); i++) { - const LLInventoryItem* item = items.get(i).get(); + const LLInventoryItem* item = items.at(i).get(); link_inventory_item(gAgent.getID(), item->getLinkedUUID(), cat_uuid, @@ -1749,9 +1749,9 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) { LLInventoryModel::item_array_t gest_items; getDescendentsOfAssetType(cof, gest_items, LLAssetType::AT_GESTURE, false); - for(S32 i = 0; i < gest_items.count(); ++i) + for(S32 i = 0; i < gest_items.size(); ++i) { - LLViewerInventoryItem *gest_item = gest_items.get(i); + LLViewerInventoryItem *gest_item = gest_items.at(i); if ( LLGestureMgr::instance().isGestureActive( gest_item->getLinkedUUID()) ) { LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() ); @@ -1798,10 +1798,10 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) // Create links to new COF contents. LLInventoryModel::item_array_t all_items; - all_items += body_items; - all_items += wear_items; - all_items += obj_items; - all_items += gest_items; + std::copy(body_items.begin(), body_items.end(), std::back_inserter(all_items)); + std::copy(wear_items.begin(), wear_items.end(), std::back_inserter(all_items)); + std::copy(obj_items.begin(), obj_items.end(), std::back_inserter(all_items)); + std::copy(gest_items.begin(), gest_items.end(), std::back_inserter(all_items)); // Will link all the above items. LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy; @@ -1854,9 +1854,10 @@ void LLAppearanceMgr::createBaseOutfitLink(const LLUUID& category, LLPointer<LLI void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, bool append) { - lldebugs << "updateAgentWearables()" << llendl; + LL_DEBUGS() << "updateAgentWearables()" << LL_ENDL; LLInventoryItem::item_array_t items; - LLDynamicArray< LLViewerWearable* > wearables; + std::vector< LLViewerWearable* > wearables; + wearables.reserve(32); // For each wearable type, find the wearables of that type. for( S32 i = 0; i < LLWearableType::WT_COUNT; i++ ) @@ -1871,14 +1872,14 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID); if( item && (item->getAssetUUID() == wearable->getAssetID()) ) { - items.put(item); - wearables.put(wearable); + items.push_back(item); + wearables.push_back(wearable); } } } } - if(wearables.count() > 0) + if(wearables.size() > 0) { gAgentWearables.setWearableOutfit(items, wearables, !append); } @@ -1905,7 +1906,7 @@ bool sort_by_actual_description(const LLInventoryItem* item1, const LLInventoryI { if (!item1 || !item2) { - llwarning("either item1 or item2 is NULL", 0); + LL_WARNS() << "either item1 or item2 is NULL" << LL_ENDL; return true; } @@ -1922,7 +1923,7 @@ void item_array_diff(LLInventoryModel::item_array_t& full_list, ++it) { LLViewerInventoryItem *item = *it; - if (keep_list.find(item) < 0) // Why on earth does LLDynamicArray need to redefine find()? + if (std::find(keep_list.begin(), keep_list.end(), item) == keep_list.end()) { kill_list.push_back(item); } @@ -1987,7 +1988,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) { if (mIsInUpdateAppearanceFromCOF) { - llwarns << "Called updateAppearanceFromCOF inside updateAppearanceFromCOF, skipping" << llendl; + LL_WARNS() << "Called updateAppearanceFromCOF inside updateAppearanceFromCOF, skipping" << LL_ENDL; return; } @@ -2023,7 +2024,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) LLUUID current_outfit_id = getCOF(); // Find all the wearables that are in the COF's subtree. - lldebugs << "LLAppearanceMgr::updateFromCOF()" << llendl; + LL_DEBUGS() << "LLAppearanceMgr::updateFromCOF()" << LL_ENDL; LLInventoryModel::item_array_t wear_items; LLInventoryModel::item_array_t obj_items; LLInventoryModel::item_array_t gest_items; @@ -2036,7 +2037,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) dumpItemArray(wear_items,"asset_dump: wear_item"); dumpItemArray(obj_items,"asset_dump: obj_item"); - if(!wear_items.count()) + if(!wear_items.size()) { LLNotificationsUtil::add("CouldNotPutOnOutfit"); return; @@ -2056,9 +2057,9 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) // callback will be called (and this object deleted) // before the final getNextData(). - for(S32 i = 0; i < wear_items.count(); ++i) + for(S32 i = 0; i < wear_items.size(); ++i) { - LLViewerInventoryItem *item = wear_items.get(i); + LLViewerInventoryItem *item = wear_items.at(i); LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL; // Fault injection: use debug setting to test asset @@ -2086,11 +2087,11 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) { if (!item) { - llwarns << "Attempt to wear a null item " << llendl; + LL_WARNS() << "Attempt to wear a null item " << LL_ENDL; } else if (!linked_item) { - llwarns << "Attempt to wear a broken link [ name:" << item->getName() << " ] " << llendl; + LL_WARNS() << "Attempt to wear a broken link [ name:" << item->getName() << " ] " << LL_ENDL; } } } @@ -2102,7 +2103,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) { LLFoundData& found = *it; - lldebugs << self_av_string() << "waiting for onWearableAssetFetch callback, asset " << found.mAssetID.asString() << llendl; + LL_DEBUGS() << self_av_string() << "waiting for onWearableAssetFetch callback, asset " << found.mAssetID.asString() << LL_ENDL; // Fetch the wearables about to be worn. LLWearableList::instance().getAsset(found.mAssetID, @@ -2301,10 +2302,10 @@ void LLAppearanceMgr::wearOutfitByName(const std::string& name) has_name); bool copy_items = false; LLInventoryCategory* cat = NULL; - if (cat_array.count() > 0) + if (cat_array.size() > 0) { // Just wear the first one that matches - cat = cat_array.get(0); + cat = cat_array.at(0); } else { @@ -2313,9 +2314,9 @@ void LLAppearanceMgr::wearOutfitByName(const std::string& name) item_array, LLInventoryModel::EXCLUDE_TRASH, has_name); - if(cat_array.count() > 0) + if(cat_array.size() > 0) { - cat = cat_array.get(0); + cat = cat_array.at(0); copy_items = true; } } @@ -2326,8 +2327,8 @@ void LLAppearanceMgr::wearOutfitByName(const std::string& name) } else { - llwarns << "Couldn't find outfit " <<name<< " in wearOutfitByName()" - << llendl; + LL_WARNS() << "Couldn't find outfit " <<name<< " in wearOutfitByName()" + << LL_ENDL; } } @@ -2412,7 +2413,7 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update const LLViewerInventoryItem *vitem = dynamic_cast<const LLViewerInventoryItem*>(item); if (!vitem) { - llwarns << "not an llviewerinventoryitem, failed" << llendl; + LL_WARNS() << "not an llviewerinventoryitem, failed" << LL_ENDL; return; } @@ -2426,10 +2427,10 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update LLInventoryModel::EXCLUDE_TRASH); bool linked_already = false; U32 count = 0; - for (S32 i=0; i<item_array.count(); i++) + for (S32 i=0; i<item_array.size(); i++) { // Are these links to the same object? - const LLViewerInventoryItem* inv_item = item_array.get(i).get(); + const LLViewerInventoryItem* inv_item = item_array.at(i).get(); const LLWearableType::EType wearable_type = inv_item->getWearableType(); const bool is_body_part = (wearable_type == LLWearableType::WT_SHAPE) @@ -2502,12 +2503,12 @@ LLInventoryModel::item_array_t LLAppearanceMgr::findCOFItemLinks(const LLUUID& i cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH); - for (S32 i=0; i<item_array.count(); i++) + for (S32 i=0; i<item_array.size(); i++) { - const LLViewerInventoryItem* inv_item = item_array.get(i).get(); + const LLViewerInventoryItem* inv_item = item_array.at(i).get(); if (inv_item->getLinkedUUID() == vitem->getLinkedUUID()) { - result.put(item_array.get(i)); + result.push_back(item_array.at(i)); } } } @@ -2579,9 +2580,9 @@ void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id) cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH); - for (S32 i=0; i<item_array.count(); i++) + for (S32 i=0; i<item_array.size(); i++) { - const LLInventoryItem* item = item_array.get(i).get(); + const LLInventoryItem* item = item_array.at(i).get(); if (item->getIsLinkType() && item->getLinkedUUID() == item_id) { gInventory.purgeObject(item->getUUID()); @@ -2611,7 +2612,7 @@ bool sort_by_linked_uuid(const LLViewerInventoryItem* item1, const LLViewerInven { if (!item1 || !item2) { - llwarning("item1, item2 cannot be null, something is very wrong", 0); + LL_WARNS() << "item1, item2 cannot be null, something is very wrong" << LL_ENDL; return true; } @@ -2653,7 +2654,7 @@ void LLAppearanceMgr::updateIsDirty() gInventory.collectDescendentsIf(base_outfit, outfit_cats, outfit_items, LLInventoryModel::EXCLUDE_TRASH, collector); - if(outfit_items.count() != cof_items.count()) + if(outfit_items.size() != cof_items.size()) { // Current outfit folder should have one more item than the outfit folder. // this one item is the link back to the outfit folder itself. @@ -2667,8 +2668,8 @@ void LLAppearanceMgr::updateIsDirty() for (U32 i = 0; i < cof_items.size(); ++i) { - LLViewerInventoryItem *item1 = cof_items.get(i); - LLViewerInventoryItem *item2 = outfit_items.get(i); + LLViewerInventoryItem *item1 = cof_items.at(i); + LLViewerInventoryItem *item2 = outfit_items.at(i); if (item1->getLinkedUUID() != item2->getLinkedUUID() || item1->getName() != item2->getName() || @@ -2698,7 +2699,7 @@ void LLAppearanceMgr::copyLibraryGestures() gInventory.findLibraryCategoryUUIDForType(LLFolderType::FT_GESTURE,false); if (lib_gesture_cat_id.isNull()) { - llwarns << "Unable to copy gestures, source category not found" << llendl; + LL_WARNS() << "Unable to copy gestures, source category not found" << LL_ENDL; } LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE); @@ -2747,7 +2748,7 @@ void LLAppearanceMgr::copyLibraryGestures() LLUUID cat_id = findDescendentCategoryIDByName(lib_gesture_cat_id,folder_name); if (cat_id.isNull()) { - llwarns << self_av_string() << "failed to find gesture folder for " << folder_name << llendl; + LL_WARNS() << self_av_string() << "failed to find gesture folder for " << folder_name << LL_ENDL; } else { @@ -2839,12 +2840,12 @@ void LLAppearanceMgr::divvyWearablesByType(const LLInventoryModel::item_array_t& items_by_type.resize(LLWearableType::WT_COUNT); if (items.empty()) return; - for (S32 i=0; i<items.count(); i++) + for (S32 i=0; i<items.size(); i++) { - LLViewerInventoryItem *item = items.get(i); + LLViewerInventoryItem *item = items.at(i); if (!item) { - LL_WARNS("Appearance") << "NULL item found" << llendl; + LL_WARNS("Appearance") << "NULL item found" << LL_ENDL; continue; } // Ignore non-wearables. @@ -2879,7 +2880,7 @@ struct WearablesOrderComparator { if (!item1 || !item2) { - llwarning("either item1 or item2 is NULL", 0); + LL_WARNS() << "either item1 or item2 is NULL" << LL_ENDL; return true; } @@ -3044,7 +3045,7 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder // Error /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "appearance update request failed, status: " << status << " reason: " << reason << " code: " << content["code"].asInteger() << " error: \"" << content["error"].asString() << "\"" << llendl; + LL_WARNS() << "appearance update request failed, status: " << status << " reason: " << reason << " code: " << content["code"].asInteger() << " error: \"" << content["error"].asString() << "\"" << LL_ENDL; if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { dumpContents(gAgentAvatarp->getFullname() + "_appearance_request_error", content); @@ -3059,7 +3060,7 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder F32 seconds_to_wait; if (mRetryPolicy->shouldRetry(status,seconds_to_wait)) { - llinfos << "retrying" << llendl; + LL_INFOS() << "retrying" << LL_ENDL; doAfterInterval(boost::bind(&LLAppearanceMgr::requestServerAppearanceUpdate, LLAppearanceMgr::getInstance(), LLCurl::ResponderPtr(this)), @@ -3067,7 +3068,7 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder } else { - llwarns << "giving up after too many retries" << llendl; + LL_WARNS() << "giving up after too many retries" << LL_ENDL; } } @@ -3082,7 +3083,7 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder void debugCOF(const LLSD& content) { - LL_DEBUGS("Avatar") << "AIS COF, version found: " << content["expected"].asInteger() << llendl; + LL_DEBUGS("Avatar") << "AIS COF, version found: " << content["expected"].asInteger() << LL_ENDL; std::set<LLUUID> ais_items, local_items; const LLSD& cof_raw = content["cof_raw"]; for (LLSD::array_const_iterator it = cof_raw.beginArray(); @@ -3097,14 +3098,14 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder LL_DEBUGS("Avatar") << "Link: item_id: " << item["item_id"].asUUID() << " linked_item_id: " << item["asset_id"].asUUID() << " name: " << item["name"].asString() - << llendl; + << LL_ENDL; } else if (item["type"].asInteger() == 25) // folder link { LL_DEBUGS("Avatar") << "Folder link: item_id: " << item["item_id"].asUUID() << " linked_item_id: " << item["asset_id"].asUUID() << " name: " << item["name"].asString() - << llendl; + << LL_ENDL; } else @@ -3112,38 +3113,38 @@ class RequestAgentUpdateAppearanceResponder: public LLHTTPClient::Responder LL_DEBUGS("Avatar") << "Other: item_id: " << item["item_id"].asUUID() << " linked_item_id: " << item["asset_id"].asUUID() << " name: " << item["name"].asString() - << llendl; + << LL_ENDL; } } } - LL_DEBUGS("Avatar") << llendl; - LL_DEBUGS("Avatar") << "Local COF, version requested: " << content["observed"].asInteger() << llendl; + LL_DEBUGS("Avatar") << LL_ENDL; + LL_DEBUGS("Avatar") << "Local COF, version requested: " << content["observed"].asInteger() << LL_ENDL; LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(LLAppearanceMgr::instance().getCOF(), cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH); - for (S32 i=0; i<item_array.count(); i++) + for (S32 i=0; i<item_array.size(); i++) { - const LLViewerInventoryItem* inv_item = item_array.get(i).get(); + const LLViewerInventoryItem* inv_item = item_array.at(i).get(); local_items.insert(inv_item->getUUID()); LL_DEBUGS("Avatar") << "item_id: " << inv_item->getUUID() << " linked_item_id: " << inv_item->getLinkedUUID() << " name: " << inv_item->getName() - << llendl; + << LL_ENDL; } - LL_DEBUGS("Avatar") << llendl; + LL_DEBUGS("Avatar") << LL_ENDL; for (std::set<LLUUID>::iterator it = local_items.begin(); it != local_items.end(); ++it) { if (ais_items.find(*it) == ais_items.end()) { - LL_DEBUGS("Avatar") << "LOCAL ONLY: " << *it << llendl; + LL_DEBUGS("Avatar") << "LOCAL ONLY: " << *it << LL_ENDL; } } for (std::set<LLUUID>::iterator it = ais_items.begin(); it != ais_items.end(); ++it) { if (local_items.find(*it) == local_items.end()) { - LL_DEBUGS("Avatar") << "AIS ONLY: " << *it << llendl; + LL_DEBUGS("Avatar") << "AIS ONLY: " << *it << LL_ENDL; } } } @@ -3159,9 +3160,9 @@ LLSD LLAppearanceMgr::dumpCOF() const LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; gInventory.collectDescendents(getCOF(),cat_array,item_array,LLInventoryModel::EXCLUDE_TRASH); - for (S32 i=0; i<item_array.count(); i++) + for (S32 i=0; i<item_array.size(); i++) { - const LLViewerInventoryItem* inv_item = item_array.get(i).get(); + const LLViewerInventoryItem* inv_item = item_array.at(i).get(); LLSD item; LLUUID item_id(inv_item->getUUID()); md5.update((unsigned char*)item_id.mData, 16); @@ -3177,17 +3178,17 @@ LLSD LLAppearanceMgr::dumpCOF() const const LLViewerInventoryItem* linked_item = inv_item->getLinkedItem(); if (NULL == linked_item) { - llwarns << "Broken link for item '" << inv_item->getName() + LL_WARNS() << "Broken link for item '" << inv_item->getName() << "' (" << inv_item->getUUID() - << ") during requestServerAppearanceUpdate" << llendl; + << ") during requestServerAppearanceUpdate" << LL_ENDL; continue; } // Some assets may be 'hidden' and show up as null in the viewer. //if (linked_item->getAssetUUID().isNull()) //{ - // llwarns << "Broken link (null asset) for item '" << inv_item->getName() + // LL_WARNS() << "Broken link (null asset) for item '" << inv_item->getName() // << "' (" << inv_item->getUUID() - // << ") during requestServerAppearanceUpdate" << llendl; + // << ") during requestServerAppearanceUpdate" << LL_ENDL; // continue; //} LLUUID linked_asset_id(linked_item->getAssetUUID()); @@ -3197,10 +3198,10 @@ LLSD LLAppearanceMgr::dumpCOF() const } else if (LLAssetType::AT_LINK_FOLDER != inv_item->getActualType()) { - llwarns << "Non-link item '" << inv_item->getName() + LL_WARNS() << "Non-link item '" << inv_item->getName() << "' (" << inv_item->getUUID() << ") type " << (S32) inv_item->getActualType() - << " during requestServerAppearanceUpdate" << llendl; + << " during requestServerAppearanceUpdate" << LL_ENDL; continue; } links.append(item); @@ -3224,17 +3225,17 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond if (!gAgent.getRegion()) { - llwarns << "Region not set, cannot request server appearance update" << llendl; + LL_WARNS() << "Region not set, cannot request server appearance update" << LL_ENDL; return; } if (gAgent.getRegion()->getCentralBakeVersion()==0) { - llwarns << "Region does not support baking" << llendl; + LL_WARNS() << "Region does not support baking" << LL_ENDL; } std::string url = gAgent.getRegion()->getCapability("UpdateAvatarAppearance"); if (url.empty()) { - llwarns << "No cap for UpdateAvatarAppearance." << llendl; + LL_WARNS() << "No cap for UpdateAvatarAppearance." << LL_ENDL; return; } @@ -3252,7 +3253,7 @@ void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr respond body["cof_version"] = cof_version+999; } } - LL_DEBUGS("Avatar") << "request url " << url << " my_cof_version " << cof_version << llendl; + LL_DEBUGS("Avatar") << "request url " << url << " my_cof_version " << cof_version << LL_ENDL; //LLCurl::ResponderPtr responder_ptr; if (!responder_ptr.get()) @@ -3278,7 +3279,7 @@ class LLIncrementCofVersionResponder : public LLHTTPClient::Responder virtual void result(const LLSD &pContent) { - llinfos << "Successfully incremented agent's COF." << llendl; + LL_INFOS() << "Successfully incremented agent's COF." << LL_ENDL; S32 new_version = pContent["category"]["version"].asInteger(); // cof_version should have increased @@ -3288,12 +3289,12 @@ class LLIncrementCofVersionResponder : public LLHTTPClient::Responder } virtual void errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& content) { - llwarns << "While attempting to increment the agent's cof we got an error with [status:" - << pStatus << "]: " << content << llendl; + LL_WARNS() << "While attempting to increment the agent's cof we got an error with [status:" + << pStatus << "]: " << content << LL_ENDL; F32 seconds_to_wait; if (mRetryPolicy->shouldRetry(pStatus,seconds_to_wait)) { - llinfos << "retrying" << llendl; + LL_INFOS() << "retrying" << LL_ENDL; doAfterInterval(boost::bind(&LLAppearanceMgr::incrementCofVersion, LLAppearanceMgr::getInstance(), LLHTTPClient::ResponderPtr(this)), @@ -3301,7 +3302,7 @@ class LLIncrementCofVersionResponder : public LLHTTPClient::Responder } else { - llwarns << "giving up after too many retries" << llendl; + LL_WARNS() << "giving up after too many retries" << LL_ENDL; } } @@ -3313,19 +3314,19 @@ void LLAppearanceMgr::incrementCofVersion(LLHTTPClient::ResponderPtr responder_p // If we don't have a region, report it as an error if (gAgent.getRegion() == NULL) { - llwarns << "Region not set, cannot request cof_version increment" << llendl; + LL_WARNS() << "Region not set, cannot request cof_version increment" << LL_ENDL; return; } std::string url = gAgent.getRegion()->getCapability("IncrementCofVersion"); if (url.empty()) { - llwarns << "No cap for IncrementCofVersion." << llendl; + LL_WARNS() << "No cap for IncrementCofVersion." << LL_ENDL; return; } - llinfos << "Requesting cof_version be incremented via capability to: " - << url << llendl; + LL_INFOS() << "Requesting cof_version be incremented via capability to: " + << url << LL_ENDL; LLSD headers; LLSD body = LLSD::emptyMap(); @@ -3350,7 +3351,7 @@ void show_created_outfit(LLUUID& folder_id, bool show_panel = true) { if (!LLApp::isRunning()) { - llwarns << "called during shutdown, skipping" << llendl; + LL_WARNS() << "called during shutdown, skipping" << LL_ENDL; return; } @@ -3412,7 +3413,7 @@ void LLAppearanceMgr::removeItemsFromAvatar(const uuid_vec_t& ids_to_remove) { if (ids_to_remove.empty()) { - llwarns << "called with empty list, nothing to do" << llendl; + LL_WARNS() << "called with empty list, nothing to do" << LL_ENDL; } for (uuid_vec_t::const_iterator it = ids_to_remove.begin(); it != ids_to_remove.end(); ++it) { @@ -3442,7 +3443,7 @@ void LLAppearanceMgr::addDoomedTempAttachment(const LLUUID& id_to_remove) { // If this is a temp attachment and we want to remove it, record the ID // so it will be deleted when attachments are synced up with COF mDoomedTempAttachmentIDs.insert(id_to_remove); - //llinfos << "Will remove temp attachment id " << id_to_remove << llendl; + //LL_INFOS() << "Will remove temp attachment id " << id_to_remove << LL_ENDL; } } @@ -3531,26 +3532,26 @@ void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg) gInventory.collectDescendents(cat_id, cats, items, LLInventoryModel::EXCLUDE_TRASH); #ifdef DUMP_CAT_VERBOSE - llinfos << llendl; - llinfos << str << llendl; + LL_INFOS() << LL_ENDL; + LL_INFOS() << str << LL_ENDL; S32 hitcount = 0; - for(S32 i=0; i<items.count(); i++) + for(S32 i=0; i<items.size(); i++) { LLViewerInventoryItem *item = items.get(i); if (item) hitcount++; - llinfos << i <<" "<< item->getName() <<llendl; + LL_INFOS() << i <<" "<< item->getName() <<LL_ENDL; } #endif - llinfos << msg << " count " << items.count() << llendl; + LL_INFOS() << msg << " count " << items.size() << LL_ENDL; } void LLAppearanceMgr::dumpItemArray(const LLInventoryModel::item_array_t& items, const std::string& msg) { - for (S32 i=0; i<items.count(); i++) + for (S32 i=0; i<items.size(); i++) { - LLViewerInventoryItem *item = items.get(i); + LLViewerInventoryItem *item = items.at(i); LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL; LLUUID asset_id; if (linked_item) @@ -3585,13 +3586,13 @@ LLAppearanceMgr::~LLAppearanceMgr() void LLAppearanceMgr::setAttachmentInvLinkEnable(bool val) { - LL_DEBUGS("Avatar") << "setAttachmentInvLinkEnable => " << (int) val << llendl; + LL_DEBUGS("Avatar") << "setAttachmentInvLinkEnable => " << (int) val << LL_ENDL; mAttachmentInvLinkEnabled = val; } void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg) { - llinfos << msg << llendl; + LL_INFOS() << msg << LL_ENDL; for (std::set<LLUUID>::const_iterator it = atts.begin(); it != atts.end(); ++it) @@ -3599,11 +3600,11 @@ void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg) LLUUID item_id = *it; LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item) - llinfos << "atts " << item->getName() << llendl; + LL_INFOS() << "atts " << item->getName() << LL_ENDL; else - llinfos << "atts " << "UNKNOWN[" << item_id.asString() << "]" << llendl; + LL_INFOS() << "atts " << "UNKNOWN[" << item_id.asString() << "]" << LL_ENDL; } - llinfos << llendl; + LL_INFOS() << LL_ENDL; } void LLAppearanceMgr::registerAttachment(const LLUUID& item_id) @@ -3619,7 +3620,7 @@ void LLAppearanceMgr::registerAttachment(const LLUUID& item_id) } else { - //llinfos << "no link changes, inv link not enabled" << llendl; + //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL; } } @@ -3633,7 +3634,7 @@ void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id) } else { - //llinfos << "no link changes, inv link not enabled" << llendl; + //LL_INFOS() << "no link changes, inv link not enabled" << LL_ENDL; } } @@ -3699,8 +3700,8 @@ class CallAfterCategoryFetchStage2: public LLInventoryFetchItemsObserver } virtual void done() { - llinfos << this << " done with incomplete " << mIncomplete.size() - << " complete " << mComplete.size() << " calling callable" << llendl; + LL_INFOS() << this << " done with incomplete " << mIncomplete.size() + << " complete " << mComplete.size() << " calling callable" << LL_ENDL; gInventory.removeObserver(this); doOnIdleOneTime(mCallable); @@ -3732,11 +3733,11 @@ class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver cat_array, item_array, LLInventoryModel::EXCLUDE_TRASH); - S32 count = item_array.count(); + S32 count = item_array.size(); if(!count) { - llwarns << "Nothing fetched in category " << mComplete.front() - << llendl; + LL_WARNS() << "Nothing fetched in category " << mComplete.front() + << LL_ENDL; gInventory.removeObserver(this); doOnIdleOneTime(mCallable); @@ -3744,11 +3745,11 @@ class CallAfterCategoryFetchStage1: public LLInventoryFetchDescendentsObserver return; } - llinfos << "stage1 got " << item_array.count() << " items, passing to stage2 " << llendl; + LL_INFOS() << "stage1 got " << item_array.size() << " items, passing to stage2 " << LL_ENDL; uuid_vec_t ids; for(S32 i = 0; i < count; ++i) { - ids.push_back(item_array.get(i)->getUUID()); + ids.push_back(item_array.at(i)->getUUID()); } gInventory.removeObserver(this); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 5ec80f1cf086d17956ca43e1a3e11571267b9c53..b5ef0bd935dd5c08d4410506ca0f57257bc74c1e 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -34,6 +34,7 @@ #include "llinventorymodel.h" #include "llinventoryobserver.h" #include "llviewerinventory.h" +#include "llhttpclient.h" class LLWearableHoldingPattern; class LLInventoryCallback; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4ddce9e7ed205aba96b93b68d4ebf6143a58ee73..f98ec697327da500631b6c90e69874ee7e443c33 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -63,7 +63,8 @@ #include "llconversationlog.h" #include "lldxhardware.h" #include "lltexturestats.h" -#include "lltexturestats.h" +#include "lltrace.h" +#include "lltracethreadrecorder.h" #include "llviewerwindow.h" #include "llviewerdisplay.h" #include "llviewermedia.h" @@ -94,10 +95,10 @@ #include "llvocache.h" #include "llvopartgroup.h" #include "llweb.h" -#include "llsecondlifeurls.h" #include "llupdaterservice.h" #include "llfloatertexturefetchdebugger.h" #include "llspellcheck.h" +#include "llscenemonitor.h" #include "llavatarrenderinfoaccountant.h" // Linden library includes @@ -299,12 +300,12 @@ U32 gFrameCount = 0; U32 gForegroundFrameCount = 0; // number of frames that app window was in foreground LLPumpIO* gServicePump = NULL; -U64 gFrameTime = 0; -F32 gFrameTimeSeconds = 0.f; -F32 gFrameIntervalSeconds = 0.f; +U64MicrosecondsImplicit gFrameTime = 0; +F32SecondsImplicit gFrameTimeSeconds = 0.f; +F32SecondsImplicit gFrameIntervalSeconds = 0.f; F32 gFPSClamped = 10.f; // Pretend we start at target rate. F32 gFrameDTClamped = 0.f; // Time between adjacent checks to network for packets -U64 gStartTime = 0; // gStartTime is "private", used only to calculate gFrameTimeSeconds +U64MicrosecondsImplicit gStartTime = 0; // gStartTime is "private", used only to calculate gFrameTimeSeconds U32 gFrameStalls = 0; const F64 FRAME_STALL_THRESHOLD = 1.0; @@ -330,7 +331,7 @@ BOOL gUseWireframe = FALSE; LLVFS* gStaticVFS = NULL; LLMemoryInfo gSysMemory; -U64 gMemoryAllocated = 0; // updated in display_stats() in llviewerdisplay.cpp +U64Bytes gMemoryAllocated(0); // updated in display_stats() in llviewerdisplay.cpp std::string gLastVersionChannel; @@ -632,7 +633,7 @@ class LLFastTimerLogThread : public LLThread while (!LLAppViewer::instance()->isQuitting()) { - LLFastTimer::writeLog(os); + LLTrace::BlockTimer::writeLog(os); os.flush(); ms_sleep(32); } @@ -665,8 +666,13 @@ LLTextureCache* LLAppViewer::sTextureCache = NULL; LLImageDecodeThread* LLAppViewer::sImageDecodeThread = NULL; LLTextureFetch* LLAppViewer::sTextureFetch = NULL; -LLAppViewer::LLAppViewer() : - mMarkerFile(), +std::string getRuntime() +{ + return llformat("%.4f", (F32)LLTimer::getElapsedSeconds().value()); +} + +LLAppViewer::LLAppViewer() +: mMarkerFile(), mLogoutMarkerFile(), mReportedCrash(false), mNumSessions(0), @@ -688,7 +694,7 @@ LLAppViewer::LLAppViewer() : { if(NULL != sInstance) { - llerrs << "Oh no! An instance of LLAppViewer already exists! LLAppViewer is sort of like a singleton." << llendl; + LL_ERRS() << "Oh no! An instance of LLAppViewer already exists! LLAppViewer is sort of like a singleton." << LL_ENDL; } mDumpPath =""; @@ -745,9 +751,6 @@ bool LLAppViewer::init() // // Start of the application // - LLFastTimer::reset(); - - #ifdef LL_DARWIN mMainLoopInitialized = false; #endif @@ -1064,9 +1067,8 @@ bool LLAppViewer::init() // get RAM data from XML std::stringstream minRAMString(LLNotifications::instance().getGlobalString("UnsupportedRAMAmount")); - U64 minRAM = 0; + U64Bytes minRAM; minRAMString >> minRAM; - minRAM = minRAM * 1024 * 1024; if(!LLFeatureManager::getInstance()->isGPUSupported() && LLFeatureManager::getInstance()->getGPUClass() != GPU_CLASS_UNKNOWN) { @@ -1220,7 +1222,7 @@ void LLAppViewer::initMaxHeapSize() //currently SL is built under 32-bit setting, we set its max heap size no more than 1.6 GB. //F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ; - F32 max_heap_size_gb = gSavedSettings.getF32("MaxHeapSize") ; + F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ; BOOL enable_mem_failure_prevention = (BOOL)gSavedSettings.getBOOL("MemoryFailurePreventionEnabled") ; LLMemory::initMaxHeapSizeGB(max_heap_size_gb, enable_mem_failure_prevention) ; @@ -1243,8 +1245,8 @@ void LLAppViewer::checkMemory() } mMemCheckTimer.reset() ; - //update the availability of memory - LLMemory::updateMemoryInfo() ; + //update the availability of memory + LLMemory::updateMemoryInfo() ; bool is_low = LLMemory::isMemoryPoolLow() ; @@ -1256,24 +1258,25 @@ void LLAppViewer::checkMemory() } } -static LLFastTimer::DeclareTimer FTM_MESSAGES("System Messages"); -static LLFastTimer::DeclareTimer FTM_SLEEP("Sleep"); -static LLFastTimer::DeclareTimer FTM_YIELD("Yield"); - -static LLFastTimer::DeclareTimer FTM_TEXTURE_CACHE("Texture Cache"); -static LLFastTimer::DeclareTimer FTM_DECODE("Image Decode"); -static LLFastTimer::DeclareTimer FTM_VFS("VFS Thread"); -static LLFastTimer::DeclareTimer FTM_LFS("LFS Thread"); -static LLFastTimer::DeclareTimer FTM_PAUSE_THREADS("Pause Threads"); -static LLFastTimer::DeclareTimer FTM_IDLE("Idle"); -static LLFastTimer::DeclareTimer FTM_PUMP("Pump"); -static LLFastTimer::DeclareTimer FTM_PUMP_ARES("Ares"); -static LLFastTimer::DeclareTimer FTM_PUMP_SERVICE("Service"); -static LLFastTimer::DeclareTimer FTM_SERVICE_CALLBACK("Callback"); -static LLFastTimer::DeclareTimer FTM_AGENT_AUTOPILOT("Autopilot"); -static LLFastTimer::DeclareTimer FTM_AGENT_UPDATE("Update"); - -LLFastTimer::DeclareTimer FTM_FRAME("Frame", true); +static LLTrace::BlockTimerStatHandle FTM_MESSAGES("System Messages"); +static LLTrace::BlockTimerStatHandle FTM_SLEEP("Sleep"); +static LLTrace::BlockTimerStatHandle FTM_YIELD("Yield"); + +static LLTrace::BlockTimerStatHandle FTM_TEXTURE_CACHE("Texture Cache"); +static LLTrace::BlockTimerStatHandle FTM_DECODE("Image Decode"); +static LLTrace::BlockTimerStatHandle FTM_VFS("VFS Thread"); +static LLTrace::BlockTimerStatHandle FTM_LFS("LFS Thread"); +static LLTrace::BlockTimerStatHandle FTM_PAUSE_THREADS("Pause Threads"); +static LLTrace::BlockTimerStatHandle FTM_IDLE("Idle"); +static LLTrace::BlockTimerStatHandle FTM_PUMP("Pump"); +static LLTrace::BlockTimerStatHandle FTM_PUMP_ARES("Ares"); +static LLTrace::BlockTimerStatHandle FTM_PUMP_SERVICE("Service"); +static LLTrace::BlockTimerStatHandle FTM_SERVICE_CALLBACK("Callback"); +static LLTrace::BlockTimerStatHandle FTM_AGENT_AUTOPILOT("Autopilot"); +static LLTrace::BlockTimerStatHandle FTM_AGENT_UPDATE("Update"); + +// externally visible timers +LLTrace::BlockTimerStatHandle FTM_FRAME("Frame"); bool LLAppViewer::mainLoop() { @@ -1281,6 +1284,7 @@ bool LLAppViewer::mainLoop() if (!mMainLoopInitialized) #endif { + LL_INFOS() << "Entering main_loop" << LL_ENDL; mMainloopTimeout = new LLWatchdogTimeout(); //------------------------------------------- @@ -1329,11 +1333,15 @@ bool LLAppViewer::mainLoop() while (!LLApp::isExiting()) #endif { - LLFastTimer _(FTM_FRAME); - LLFastTimer::nextFrame(); + LL_RECORD_BLOCK_TIME(FTM_FRAME); + LLTrace::BlockTimer::processTimes(); + LLTrace::get_frame_recording().nextPeriod(); + LLTrace::BlockTimer::logStats(); + + LLTrace::get_thread_recorder()->pullFromChildren(); //clear call stack records - llclearcallstacks; + LL_CLEAR_CALLSTACKS(); //check memory availability information checkMemory() ; @@ -1344,7 +1352,7 @@ bool LLAppViewer::mainLoop() if (gViewerWindow) { - LLFastTimer t2(FTM_MESSAGES); + LL_RECORD_BLOCK_TIME(FTM_MESSAGES); gViewerWindow->getWindow()->processMiscNativeEvents(); } @@ -1352,10 +1360,10 @@ bool LLAppViewer::mainLoop() if (gViewerWindow) { - LLFastTimer t2(FTM_MESSAGES); + LL_RECORD_BLOCK_TIME(FTM_MESSAGES); if (!restoreErrorTrap()) { - llwarns << " Someone took over my signal/exception handler (post messagehandling)!" << llendl; + LL_WARNS() << " Someone took over my signal/exception handler (post messagehandling)!" << LL_ENDL; } gViewerWindow->getWindow()->gatherInput(); @@ -1402,24 +1410,24 @@ bool LLAppViewer::mainLoop() { pauseMainloopTimeout(); // *TODO: Remove. Messages shouldn't be stalling for 20+ seconds! - LLFastTimer t3(FTM_IDLE); + LL_RECORD_BLOCK_TIME(FTM_IDLE); idle(); if (gAres != NULL && gAres->isInitialized()) { pingMainloopTimeout("Main:ServicePump"); - LLFastTimer t4(FTM_PUMP); + LL_RECORD_BLOCK_TIME(FTM_PUMP); { - LLFastTimer t(FTM_PUMP_ARES); + LL_RECORD_BLOCK_TIME(FTM_PUMP_ARES); gAres->process(); } { - LLFastTimer t(FTM_PUMP_SERVICE); + LL_RECORD_BLOCK_TIME(FTM_PUMP_SERVICE); // this pump is necessary to make the login screen show up gServicePump->pump(); { - LLFastTimer t(FTM_SERVICE_CALLBACK); + LL_RECORD_BLOCK_TIME(FTM_SERVICE_CALLBACK); gServicePump->callback(); } } @@ -1447,7 +1455,6 @@ bool LLAppViewer::mainLoop() LLFloaterSnapshot::update(); // take snapshots gGLActive = FALSE; } - } pingMainloopTimeout("Main:Sleep"); @@ -1456,12 +1463,12 @@ bool LLAppViewer::mainLoop() // Sleep and run background threads { - LLFastTimer t2(FTM_SLEEP); + LL_RECORD_BLOCK_TIME(FTM_SLEEP); // yield some time to the os based on command line option if(mYieldTime >= 0) { - LLFastTimer t(FTM_YIELD); + LL_RECORD_BLOCK_TIME(FTM_YIELD); ms_sleep(mYieldTime); } @@ -1490,11 +1497,11 @@ bool LLAppViewer::mainLoop() if (mPeriodicSlowFrame && (gFrameCount % 10 == 0)) { - llinfos << "Periodic slow frame - sleeping 500 ms" << llendl; + LL_INFOS() << "Periodic slow frame - sleeping 500 ms" << LL_ENDL; ms_sleep(500); } - const F64 max_idle_time = llmin(.005*10.0*gFrameTimeSeconds, 0.005); // 5 ms a second + const F64Milliseconds max_idle_time = llmin(.005f*10.f*(F32Milliseconds)gFrameTimeSeconds, F32Milliseconds(5)); // 5 ms a second idleTimer.reset(); S32 total_work_pending = 0; S32 total_io_pending = 0; @@ -1502,27 +1509,16 @@ bool LLAppViewer::mainLoop() { S32 work_pending = 0; S32 io_pending = 0; - F32 max_time = llmin(gFrameIntervalSeconds*10.f, 1.f); + F32 max_time = llmin(gFrameIntervalSeconds.value() *10.f, 1.f); - { - LLFastTimer ftm(FTM_TEXTURE_CACHE); - work_pending += LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread - } - { - LLFastTimer ftm(FTM_DECODE); - work_pending += LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread - } - { - LLFastTimer ftm(FTM_DECODE); - work_pending += LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread - } + work_pending += updateTextureThreads(max_time); { - LLFastTimer ftm(FTM_VFS); + LL_RECORD_BLOCK_TIME(FTM_VFS); io_pending += LLVFSThread::updateClass(1); } { - LLFastTimer ftm(FTM_LFS); + LL_RECORD_BLOCK_TIME(FTM_LFS); io_pending += LLLFSThread::updateClass(1); } @@ -1591,14 +1587,14 @@ bool LLAppViewer::mainLoop() if(mem_leak_instance) { mem_leak_instance->stop() ; - llwarns << "Bad memory allocation in LLAppViewer::mainLoop()!" << llendl ; + LL_WARNS() << "Bad memory allocation in LLAppViewer::mainLoop()!" << LL_ENDL ; } else { //output possible call stacks to log file. LLError::LLCallStacks::print() ; - llerrs << "Bad memory allocation in LLAppViewer::mainLoop()!" << llendl ; + LL_ERRS() << "Bad memory allocation in LLAppViewer::mainLoop()!" << LL_ENDL ; } } } @@ -1614,7 +1610,7 @@ bool LLAppViewer::mainLoop() } catch(std::bad_alloc) { - llwarns << "Bad memory allocation when saveFinalSnapshot() is called!" << llendl ; + LL_WARNS() << "Bad memory allocation when saveFinalSnapshot() is called!" << LL_ENDL ; //stop memory leaking simulation LLFloaterMemLeak* mem_leak_instance = @@ -1630,12 +1626,30 @@ bool LLAppViewer::mainLoop() destroyMainloopTimeout(); - llinfos << "Exiting main_loop" << llendflush; + LL_INFOS() << "Exiting main_loop" << LL_ENDL; } return LLApp::isExiting(); } +S32 LLAppViewer::updateTextureThreads(F32 max_time) +{ + S32 work_pending = 0; + { + LL_RECORD_BLOCK_TIME(FTM_TEXTURE_CACHE); + work_pending += LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread + } + { + LL_RECORD_BLOCK_TIME(FTM_DECODE); + work_pending += LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread + } + { + LL_RECORD_BLOCK_TIME(FTM_DECODE); + work_pending += LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread + } + return work_pending; +} + void LLAppViewer::flushVFSIO() { while (1) @@ -1646,7 +1660,7 @@ void LLAppViewer::flushVFSIO() { break; } - llinfos << "Waiting for pending IO to finish: " << pending << llendflush; + LL_INFOS() << "Waiting for pending IO to finish: " << pending << LL_ENDL; ms_sleep(100); } } @@ -1661,12 +1675,15 @@ bool LLAppViewer::cleanup() // workaround for DEV-35406 crash on shutdown LLEventPumps::instance().reset(); + //dump scene loading monitor results + LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv")); + if (LLFastTimerView::sAnalyzePerformance) { - llinfos << "Analyzing performance" << llendl; - std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp"; - std::string current_name = LLFastTimer::sLogName + ".slp"; - std::string report_name = LLFastTimer::sLogName + "_report.csv"; + LL_INFOS() << "Analyzing performance" << LL_ENDL; + std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp"; + std::string current_name = LLTrace::BlockTimer::sLogName + ".slp"; + std::string report_name = LLTrace::BlockTimer::sLogName + "_report.csv"; LLFastTimerView::doAnalysis( gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name), @@ -1709,7 +1726,7 @@ bool LLAppViewer::cleanup() disconnectViewer(); - llinfos << "Viewer disconnected" << llendflush; + LL_INFOS() << "Viewer disconnected" << LL_ENDL; display_cleanup(); @@ -1717,7 +1734,7 @@ bool LLAppViewer::cleanup() LLError::logToFixedBuffer(NULL); - llinfos << "Cleaning Up" << llendflush; + LL_INFOS() << "Cleaning Up" << LL_ENDL; // shut down mesh streamer gMeshRepo.shutdown(); @@ -1732,7 +1749,7 @@ bool LLAppViewer::cleanup() LLHUDObject::updateAll(); LLHUDManager::getInstance()->cleanupEffects(); LLHUDObject::cleanupHUDObjects(); - llinfos << "HUD Objects cleaned up" << llendflush; + LL_INFOS() << "HUD Objects cleaned up" << LL_ENDL; } LLKeyframeDataCache::clear(); @@ -1763,7 +1780,7 @@ bool LLAppViewer::cleanup() LLCalc::cleanUp(); - llinfos << "Global stuff deleted" << llendflush; + LL_INFOS() << "Global stuff deleted" << LL_ENDL; if (gAudiop) { @@ -1774,7 +1791,7 @@ bool LLAppViewer::cleanup() gAudiop->setStreamingAudioImpl(NULL); // shut down the audio subsystem - gAudiop->shutdown(); + gAudiop->shutdown(); delete gAudiop; gAudiop = NULL; @@ -1787,7 +1804,7 @@ bool LLAppViewer::cleanup() // such that we can suck rectangle information out of // it. cleanupSavedSettings(); - llinfos << "Settings patched up" << llendflush; + LL_INFOS() << "Settings patched up" << LL_ENDL; // delete some of the files left around in the cache. removeCacheFiles("*.wav"); @@ -1798,29 +1815,29 @@ bool LLAppViewer::cleanup() removeCacheFiles("*.bodypart"); removeCacheFiles("*.clothing"); - llinfos << "Cache files removed" << llendflush; + LL_INFOS() << "Cache files removed" << LL_ENDL; // Wait for any pending VFS IO flushVFSIO(); - llinfos << "Shutting down Views" << llendflush; + LL_INFOS() << "Shutting down Views" << LL_ENDL; // Destroy the UI if( gViewerWindow) gViewerWindow->shutdownViews(); - llinfos << "Cleaning up Inventory" << llendflush; + LL_INFOS() << "Cleaning up Inventory" << LL_ENDL; // Cleanup Inventory after the UI since it will delete any remaining observers // (Deleted observers should have already removed themselves) gInventory.cleanupInventory(); - llinfos << "Cleaning up Selections" << llendflush; + LL_INFOS() << "Cleaning up Selections" << LL_ENDL; // Clean up selection managers after UI is destroyed, as UI may be observing them. // Clean up before GL is shut down because we might be holding on to objects with texture references LLSelectMgr::cleanupGlobals(); - llinfos << "Shutting down OpenGL" << llendflush; + LL_INFOS() << "Shutting down OpenGL" << LL_ENDL; // Shut down OpenGL if( gViewerWindow) @@ -1832,10 +1849,10 @@ bool LLAppViewer::cleanup() // Therefore must do this before destroying the message system. delete gViewerWindow; gViewerWindow = NULL; - llinfos << "ViewerWindow deleted" << llendflush; + LL_INFOS() << "ViewerWindow deleted" << LL_ENDL; } - llinfos << "Cleaning up Keyboard & Joystick" << llendflush; + LL_INFOS() << "Cleaning up Keyboard & Joystick" << LL_ENDL; // viewer UI relies on keyboard so keep it aound until viewer UI isa gone delete gKeyboard; @@ -1844,7 +1861,7 @@ bool LLAppViewer::cleanup() // Turn off Space Navigator and similar devices LLViewerJoystick::getInstance()->terminate(); - llinfos << "Cleaning up Objects" << llendflush; + LL_INFOS() << "Cleaning up Objects" << LL_ENDL; LLViewerObject::cleanupVOClasses(); @@ -1866,11 +1883,11 @@ bool LLAppViewer::cleanup() LLVolumeMgr* volume_manager = LLPrimitive::getVolumeManager(); if (!volume_manager->cleanup()) { - llwarns << "Remaining references in the volume manager!" << llendflush; + LL_WARNS() << "Remaining references in the volume manager!" << LL_ENDL; } LLPrimitive::cleanupVolumeManager(); - llinfos << "Additional Cleanup..." << llendflush; + LL_INFOS() << "Additional Cleanup..." << LL_ENDL; LLViewerParcelMgr::cleanupGlobals(); @@ -1891,10 +1908,10 @@ bool LLAppViewer::cleanup() // Also after shutting down the messaging system since it has VFS dependencies // - llinfos << "Cleaning up VFS" << llendflush; + LL_INFOS() << "Cleaning up VFS" << LL_ENDL; LLVFile::cleanupClass(); - llinfos << "Saving Data" << llendflush; + LL_INFOS() << "Saving Data" << LL_ENDL; // Store the time of our current logoff gSavedPerAccountSettings.setU32("LastLogoff", time_corrected()); @@ -1909,19 +1926,19 @@ bool LLAppViewer::cleanup() // *FIX:Mani This should get really saved in a "logoff" mode. if (gSavedSettings.getString("PerAccountSettingsFile").empty()) { - llinfos << "Not saving per-account settings; don't know the account name yet." << llendl; + LL_INFOS() << "Not saving per-account settings; don't know the account name yet." << LL_ENDL; } // Only save per account settings if the previous login succeeded, otherwise // we might end up with a cleared out settings file in case a previous login // failed after loading per account settings. else if (!mSavePerAccountSettings) { - llinfos << "Not saving per-account settings; last login was not successful." << llendl; + LL_INFOS() << "Not saving per-account settings; last login was not successful." << LL_ENDL; } else { gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); - llinfos << "Saved settings" << llendflush; + LL_INFOS() << "Saved settings" << LL_ENDL; } std::string warnings_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Warnings")); @@ -1938,7 +1955,7 @@ bool LLAppViewer::cleanup() if (mPurgeOnExit) { - llinfos << "Purging all cache files on exit" << llendflush; + LL_INFOS() << "Purging all cache files on exit" << LL_ENDL; gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""), "*.*"); } @@ -1953,7 +1970,7 @@ bool LLAppViewer::cleanup() // Stop the plugin read thread if it's running. LLPluginProcessParent::setUseReadThread(false); - llinfos << "Shutting down Threads" << llendflush; + LL_INFOS() << "Shutting down Threads" << LL_ENDL; // Let threads finish LLTimer idleTimer; @@ -1975,7 +1992,7 @@ bool LLAppViewer::cleanup() } else if(idle_time >= max_idle_time) { - llwarns << "Quitting with pending background tasks." << llendl; + LL_WARNS() << "Quitting with pending background tasks." << LL_ENDL; break; } } @@ -1991,7 +2008,7 @@ bool LLAppViewer::cleanup() sTextureFetch->shutDownTextureCacheThread() ; sTextureFetch->shutDownImageDecodeThread() ; - llinfos << "Shutting down message system" << llendflush; + LL_INFOS() << "Shutting down message system" << LL_ENDL; end_messaging_system(); // *NOTE:Mani - The following call is not thread safe. @@ -2016,11 +2033,11 @@ bool LLAppViewer::cleanup() if (LLFastTimerView::sAnalyzePerformance) { - llinfos << "Analyzing performance" << llendl; + LL_INFOS() << "Analyzing performance" << LL_ENDL; - std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp"; - std::string current_name = LLFastTimer::sLogName + ".slp"; - std::string report_name = LLFastTimer::sLogName + "_report.csv"; + std::string baseline_name = LLTrace::BlockTimer::sLogName + "_baseline.slp"; + std::string current_name = LLTrace::BlockTimer::sLogName + ".slp"; + std::string report_name = LLTrace::BlockTimer::sLogName + "_report.csv"; LLFastTimerView::doAnalysis( gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name), @@ -2030,7 +2047,7 @@ bool LLAppViewer::cleanup() LLMetricPerformanceTesterBasic::cleanClass() ; - llinfos << "Cleaning up Media and Textures" << llendflush; + LL_INFOS() << "Cleaning up Media and Textures" << LL_ENDL; //Note: //LLViewerMedia::cleanupClass() has to be put before gTextureList.shutdown() @@ -2046,14 +2063,14 @@ bool LLAppViewer::cleanup() LLLFSThread::cleanupClass(); #ifndef LL_RELEASE_FOR_DOWNLOAD - llinfos << "Auditing VFS" << llendl; + LL_INFOS() << "Auditing VFS" << LL_ENDL; if(gVFS) { gVFS->audit(); } #endif - llinfos << "Misc Cleanup" << llendflush; + LL_INFOS() << "Misc Cleanup" << LL_ENDL; // For safety, the LLVFS has to be deleted *after* LLVFSThread. This should be cleaned up. // (LLVFS doesn't know about LLVFSThread so can't kill pending requests) -Steve @@ -2073,7 +2090,7 @@ bool LLAppViewer::cleanup() // is at the right resolution before we launch IE. if (!gLaunchFileOnQuit.empty()) { - llinfos << "Launch file on quit." << llendflush; + LL_INFOS() << "Launch file on quit." << LL_ENDL; #if LL_WINDOWS // Indicate an application is starting. SetCursor(LoadCursor(NULL, IDC_WAIT)); @@ -2083,9 +2100,9 @@ bool LLAppViewer::cleanup() ms_sleep(1000); LLWeb::loadURLExternal( gLaunchFileOnQuit, false ); - llinfos << "File launched." << llendflush; + LL_INFOS() << "File launched." << LL_ENDL; } - llinfos << "Cleaning up LLProxy." << llendl; + LL_INFOS() << "Cleaning up LLProxy." << LL_ENDL; LLProxy::cleanupClass(); LLWearableType::cleanupClass(); @@ -2099,9 +2116,7 @@ bool LLAppViewer::cleanup() removeMarkerFiles(); - MEM_TRACK_RELEASE - - llinfos << "Goodbye!" << llendflush; + LL_INFOS() << "Goodbye!" << LL_ENDL; removeDumpDir(); @@ -2109,7 +2124,7 @@ bool LLAppViewer::cleanup() return true; } -// A callback for llerrs to call during the watchdog error. +// A callback for LL_ERRS() to call during the watchdog error. void watchdog_llerrs_callback(const std::string &error_string) { gLLErrorActivated = true; @@ -2125,16 +2140,12 @@ void watchdog_llerrs_callback(const std::string &error_string) void watchdog_killer_callback() { LLError::setFatalFunction(watchdog_llerrs_callback); - llerrs << "Watchdog killer event" << llendl; + LL_ERRS() << "Watchdog killer event" << LL_ENDL; } bool LLAppViewer::initThreads() { -#if MEM_TRACK_MEM - static const bool enable_threads = false; -#else static const bool enable_threads = true; -#endif LLImage::initClass(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange")); @@ -2149,10 +2160,10 @@ bool LLAppViewer::initThreads() enable_threads && true, app_metrics_qa_mode); - if (LLFastTimer::sLog || LLFastTimer::sMetricLog) + if (LLTrace::BlockTimer::sLog || LLTrace::BlockTimer::sMetricLog) { - LLFastTimer::sLogLock = new LLMutex(NULL); - mFastTimerLogThread = new LLFastTimerLogThread(LLFastTimer::sLogName); + LLTrace::BlockTimer::setLogLock(new LLMutex(NULL)); + mFastTimerLogThread = new LLFastTimerLogThread(LLTrace::BlockTimer::sLogName); mFastTimerLogThread->start(); } @@ -2185,6 +2196,7 @@ void LLAppViewer::initLoggingAndGetLastDuration() LLError::initForApplication( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "")); LLError::setFatalFunction(errorCallback); + //LLError::setTimeFunction(getRuntime); // Remove the last ".old" log file. std::string old_log_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, @@ -2253,7 +2265,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, { if (!mSettingsLocationList) { - llerrs << "Invalid settings location list" << llendl; + LL_ERRS() << "Invalid settings location list" << LL_ENDL; } BOOST_FOREACH(const SettingsGroup& group, mSettingsLocationList->groups) @@ -2264,7 +2276,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, ELLPath path_index = (ELLPath)group.path_index(); if(path_index <= LL_PATH_NONE || path_index >= LL_PATH_LAST) { - llerrs << "Out of range path index in app_settings/settings_files.xml" << llendl; + LL_ERRS() << "Out of range path index in app_settings/settings_files.xml" << LL_ENDL; return false; } @@ -2311,7 +2323,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key, { // failed to load if(file.required) { - llerrs << "Error: Cannot load required settings file from: " << full_settings_path << llendl; + LL_ERRS() << "Error: Cannot load required settings file from: " << full_settings_path << LL_ENDL; return false; } else @@ -2358,9 +2370,9 @@ namespace { void handleCommandLineError(LLControlGroupCLP& clp) { - llwarns << "Error parsing command line options. Command Line options ignored." << llendl; + LL_WARNS() << "Error parsing command line options. Command Line options ignored." << LL_ENDL; - llinfos << "Command line usage:\n" << clp << llendl; + LL_INFOS() << "Command line usage:\n" << clp << LL_ENDL; OSMessageBox(STRINGIZE(LLTrans::getString("MBCmdLineError") << clp.getErrorMessage()), LLStringUtil::null, @@ -2376,7 +2388,7 @@ bool LLAppViewer::initConfiguration() BOOL success = LLXMLNode::parseFile(settings_file_list, root, NULL); if (!success) { - llerrs << "Cannot load default configuration file " << settings_file_list << llendl; + LL_ERRS() << "Cannot load default configuration file " << settings_file_list << LL_ENDL; } mSettingsLocationList = new SettingsFiles(); @@ -2386,7 +2398,7 @@ bool LLAppViewer::initConfiguration() if (!mSettingsLocationList->validateBlock()) { - llerrs << "Invalid settings file list " << settings_file_list << llendl; + LL_ERRS() << "Invalid settings file list " << settings_file_list << LL_ENDL; } // The settings and command line parsing have a fragile @@ -2522,7 +2534,7 @@ bool LLAppViewer::initConfiguration() // ASAP or we might miss init issue etc. if(gSavedSettings.getBOOL("DisableCrashLogger")) { - llwarns << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << llendl; + LL_WARNS() << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << LL_ENDL; LLAppViewer::instance()->disableCrashlogger(); } @@ -2537,7 +2549,7 @@ bool LLAppViewer::initConfiguration() { std::ostringstream msg; msg << LLTrans::getString("MBCmdLineUsg") << "\n" << clp; - llinfos << msg.str() << llendl; + LL_INFOS() << msg.str() << LL_ENDL; OSMessageBox( msg.str().c_str(), @@ -2552,7 +2564,7 @@ bool LLAppViewer::initConfiguration() const LLCommandLineParser::token_vector_t& set_values = clp.getOption("set"); if(0x1 & set_values.size()) { - llwarns << "Invalid '--set' parameter count." << llendl; + LL_WARNS() << "Invalid '--set' parameter count." << LL_ENDL; } else { @@ -2571,13 +2583,13 @@ bool LLAppViewer::initConfiguration() { group_part = name.substr(0, pos); name_part = name.substr(pos+1); - llinfos << "Setting " << group_part << "." << name_part << " to " << value << llendl; + LL_INFOS() << "Setting " << group_part << "." << name_part << " to " << value << LL_ENDL; LLControlGroup* g = LLControlGroup::getInstance(group_part); if (g) control = g->getControl(name_part); } else { - llinfos << "Setting Global." << name << " to " << value << llendl; + LL_INFOS() << "Setting Global." << name << " to " << value << LL_ENDL; control = gSavedSettings.getControl(name); } @@ -2587,7 +2599,7 @@ bool LLAppViewer::initConfiguration() } else { - llwarns << "Failed --set " << name << ": setting name unknown." << llendl; + LL_WARNS() << "Failed --set " << name << ": setting name unknown." << LL_ENDL; } } } @@ -2608,19 +2620,19 @@ bool LLAppViewer::initConfiguration() if (gSavedSettings.getBOOL("LogPerformance")) { - LLFastTimer::sLog = TRUE; - LLFastTimer::sLogName = std::string("performance"); + LLTrace::BlockTimer::sLog = true; + LLTrace::BlockTimer::sLogName = std::string("performance"); } std::string test_name(gSavedSettings.getString("LogMetrics")); if (! test_name.empty()) { - LLFastTimer::sMetricLog = TRUE ; + LLTrace::BlockTimer::sMetricLog = TRUE; // '--logmetrics' is specified with a named test metric argument so the data gathering is done only on that test // In the absence of argument, every metric would be gathered (makes for a rather slow run and hard to decipher report...) - llinfos << "'--logmetrics' argument : " << test_name << llendl; - LLFastTimer::sLogName = test_name; - } + LL_INFOS() << "'--logmetrics' argument : " << test_name << LL_ENDL; + LLTrace::BlockTimer::sLogName = test_name; + } if (clp.hasOption("graphicslevel")) { @@ -2667,11 +2679,27 @@ bool LLAppViewer::initConfiguration() // What can happen is that someone can use IE (or potentially // other browsers) and do the rough equivalent of command // injection and steal passwords. Phoenix. SL-55321 + + std::string starting_location; + + std::string cmd_line_login_location(gSavedSettings.getString("CmdLineLoginLocation")); + if(! cmd_line_login_location.empty()) + { + starting_location = cmd_line_login_location; + } + else + { + std::string default_login_location(gSavedSettings.getString("DefaultLoginLocation")); + if (! default_login_location.empty()) + { + starting_location = default_login_location; + } + } + LLSLURL start_slurl; - std::string CmdLineLoginLocation(gSavedSettings.getString("CmdLineLoginLocation")); - if(! CmdLineLoginLocation.empty()) + if (! starting_location.empty()) { - start_slurl = CmdLineLoginLocation; + start_slurl = starting_location; LLStartUp::setStartSLURL(start_slurl); if(start_slurl.getType() == LLSLURL::LOCATION) { @@ -2688,7 +2716,7 @@ bool LLAppViewer::initConfiguration() (gSavedSettings.getBOOL("SLURLPassToOtherInstance"))) { if (sendURLToOtherInstance(start_slurl.getSLURLString())) - { + { // successfully handed off URL to existing instance, exit return false; } @@ -2880,10 +2908,10 @@ namespace { void apply_update_callback(LLSD const & notification, LLSD const & response) { - lldebugs << "LLUpdate user response: " << response << llendl; + LL_DEBUGS() << "LLUpdate user response: " << response << LL_ENDL; if(response["OK_okcancelbuttons"].asBoolean()) { - llinfos << "LLUpdate restarting viewer" << llendl; + LL_INFOS() << "LLUpdate restarting viewer" << LL_ENDL; static const bool install_if_ready = true; // *HACK - this lets us launch the installer immediately for now LLUpdaterService().startChecking(install_if_ready); @@ -2892,7 +2920,7 @@ namespace { void apply_update_ok_callback(LLSD const & notification, LLSD const & response) { - llinfos << "LLUpdate restarting viewer" << llendl; + LL_INFOS() << "LLUpdate restarting viewer" << LL_ENDL; static const bool install_if_ready = true; // *HACK - this lets us launch the installer immediately for now LLUpdaterService().startChecking(install_if_ready); @@ -3100,8 +3128,7 @@ bool LLAppViewer::meetsRequirementsForMaximizedStart() { bool maximizedOk = (LLFeatureManager::getInstance()->getGPUClass() >= GPU_CLASS_2); - const U32 one_gigabyte_kb = 1024 * 1024; - maximizedOk &= (gSysMemory.getPhysicalMemoryKB() >= one_gigabyte_kb); + maximizedOk &= (gSysMemory.getPhysicalMemoryKB() >= U32Gigabytes(1)); return maximizedOk; } @@ -3222,6 +3249,7 @@ bool LLAppViewer::initWindow() //gViewerWindow->getWindow()->show(); LL_INFOS("AppInit") << "Window initialization done." << LL_ENDL; + return true; } @@ -3233,7 +3261,7 @@ void LLAppViewer::writeDebugInfo(bool isStatic) ? getStaticDebugFile() : getDynamicDebugFile() ); - llinfos << "Opening debug file " << *debug_filename << llendl; + LL_INFOS() << "Opening debug file " << *debug_filename << LL_ENDL; llofstream out_file(*debug_filename); isStatic ? LLSDSerialize::toPrettyXML(gDebugInfo, out_file) @@ -3297,7 +3325,7 @@ LLSD LLAppViewer::getViewerInfo() const // CPU info["CPU"] = gSysCPU.getCPUString(); - info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB() / 1024); + info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits<LLUnits::Megabytes>()); // Moved hack adjustment to Windows memory size into llsys.cpp info["OS_VERSION"] = LLAppViewer::instance()->getOSInfo().getOSString(); info["GRAPHICS_CARD_VENDOR"] = (const char*)(glGetString(GL_VENDOR)); @@ -3333,8 +3361,9 @@ LLSD LLAppViewer::getViewerInfo() const if (gPacketsIn > 0) { - info["PACKETS_LOST"] = LLViewerStats::getInstance()->mPacketsLostStat.getCurrent(); - info["PACKETS_IN"] = F32(gPacketsIn); + LLTrace::Recording& last_frame = LLTrace::get_frame_recording().getLastRecording(); + info["PACKETS_LOST"] = last_frame.getSum(LLStatViewer::PACKETS_LOST); + info["PACKETS_IN"] = last_frame.getSum(LLStatViewer::PACKETS_IN); info["PACKETS_PCT"] = 100.f*info["PACKETS_LOST"].asReal() / info["PACKETS_IN"].asReal(); } @@ -3493,8 +3522,8 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["CPUInfo"]["CPUSSE"] = gSysCPU.hasSSE(); gDebugInfo["CPUInfo"]["CPUSSE2"] = gSysCPU.hasSSE2(); - gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB()); - gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated>>10); // MB -> KB + gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB().value()); + gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated.valueInUnits<LLUnits::Kilobytes>()); gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple(); // The user is not logged on yet, but record the current grid choice login url @@ -3591,9 +3620,9 @@ void getFileList() void LLAppViewer::handleViewerCrash() { - llinfos << "Handle viewer crash entry." << llendl; + LL_INFOS() << "Handle viewer crash entry." << LL_ENDL; - llinfos << "Last render pool type: " << LLPipeline::sCurRenderPoolType << llendl ; + LL_INFOS() << "Last render pool type: " << LLPipeline::sCurRenderPoolType << LL_ENDL ; LLMemory::logMemoryInfo(true) ; @@ -3721,7 +3750,7 @@ void LLAppViewer::handleViewerCrash() llofstream file(filename, llofstream::binary); if(file.good()) { - llinfos << "Handle viewer crash generating stats log." << llendl; + LL_INFOS() << "Handle viewer crash generating stats log." << LL_ENDL; gMessageSystem->summarizeLogs(file); file.close(); } @@ -3997,7 +4026,7 @@ void LLAppViewer::fastQuit(S32 error_code) void LLAppViewer::requestQuit() { - llinfos << "requestQuit" << llendl; + LL_INFOS() << "requestQuit" << LL_ENDL; LLViewerRegion* region = gAgent.getRegion(); @@ -4082,7 +4111,7 @@ static bool finish_early_exit(const LLSD& notification, const LLSD& response) void LLAppViewer::earlyExit(const std::string& name, const LLSD& substitutions) { - llwarns << "app_early_exit: " << name << llendl; + LL_WARNS() << "app_early_exit: " << name << LL_ENDL; gDoDisconnect = TRUE; LLNotificationsUtil::add(name, substitutions, LLSD(), finish_early_exit); } @@ -4090,14 +4119,14 @@ void LLAppViewer::earlyExit(const std::string& name, const LLSD& substitutions) // case where we need the viewer to exit without any need for notifications void LLAppViewer::earlyExitNoNotify() { - llwarns << "app_early_exit with no notification: " << llendl; + LL_WARNS() << "app_early_exit with no notification: " << LL_ENDL; gDoDisconnect = TRUE; finish_early_exit( LLSD(), LLSD() ); } void LLAppViewer::abortQuit() { - llinfos << "abortQuit()" << llendl; + LL_INFOS() << "abortQuit()" << LL_ENDL; mQuitRequested = false; } @@ -4129,7 +4158,7 @@ void LLAppViewer::migrateCacheDirectory() if (gDirUtilp->fileExists(old_cache_dir)) { - llinfos << "Migrating cache from " << old_cache_dir << " to " << new_cache_dir << llendl; + LL_INFOS() << "Migrating cache from " << old_cache_dir << " to " << new_cache_dir << LL_ENDL; // Migrate inventory cache to avoid pain to inventory database after mass update S32 file_count = 0; @@ -4147,7 +4176,7 @@ void LLAppViewer::migrateCacheDirectory() file_count++; } } - llinfos << "Moved " << file_count << " files" << llendl; + LL_INFOS() << "Moved " << file_count << " files" << LL_ENDL; // Nuke the old cache gDirUtilp->setCacheDir(old_cache_dir); @@ -4164,7 +4193,7 @@ void LLAppViewer::migrateCacheDirectory() #endif if (LLFile::rmdir(old_cache_dir) != 0) { - llwarns << "could not delete old cache directory " << old_cache_dir << llendl; + LL_WARNS() << "could not delete old cache directory " << old_cache_dir << LL_ENDL; } } } @@ -4173,10 +4202,10 @@ void LLAppViewer::migrateCacheDirectory() void dumpVFSCaches() { - llinfos << "======= Static VFS ========" << llendl; + LL_INFOS() << "======= Static VFS ========" << LL_ENDL; gStaticVFS->listFiles(); #if LL_WINDOWS - llinfos << "======= Dumping static VFS to StaticVFSDump ========" << llendl; + LL_INFOS() << "======= Dumping static VFS to StaticVFSDump ========" << LL_ENDL; WCHAR w_str[MAX_PATH]; GetCurrentDirectory(MAX_PATH, w_str); S32 res = LLFile::mkdir("StaticVFSDump"); @@ -4184,7 +4213,7 @@ void dumpVFSCaches() { if (errno != EEXIST) { - llwarns << "Couldn't create dir StaticVFSDump" << llendl; + LL_WARNS() << "Couldn't create dir StaticVFSDump" << LL_ENDL; } } SetCurrentDirectory(utf8str_to_utf16str("StaticVFSDump").c_str()); @@ -4192,16 +4221,16 @@ void dumpVFSCaches() SetCurrentDirectory(w_str); #endif - llinfos << "========= Dynamic VFS ====" << llendl; + LL_INFOS() << "========= Dynamic VFS ====" << LL_ENDL; gVFS->listFiles(); #if LL_WINDOWS - llinfos << "========= Dumping dynamic VFS to VFSDump ====" << llendl; + LL_INFOS() << "========= Dumping dynamic VFS to VFSDump ====" << LL_ENDL; res = LLFile::mkdir("VFSDump"); if (res == -1) { if (errno != EEXIST) { - llwarns << "Couldn't create dir VFSDump" << llendl; + LL_WARNS() << "Couldn't create dir VFSDump" << LL_ENDL; } } SetCurrentDirectory(utf8str_to_utf16str("VFSDump").c_str()); @@ -4379,7 +4408,7 @@ bool LLAppViewer::initCache() { sscanf(found_file.substr(start_pos+1).c_str(), "%d", &old_salt); } - LL_DEBUGS("AppCache") << "Default vfs data file not present, found: " << old_vfs_data_file << " Old salt: " << old_salt << llendl; + LL_DEBUGS("AppCache") << "Default vfs data file not present, found: " << old_vfs_data_file << " Old salt: " << old_salt << LL_ENDL; } } @@ -4481,6 +4510,14 @@ void LLAppViewer::purgeCache() gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), "*.*"); } +//purge cache immediately, do not wait until the next login. +void LLAppViewer::purgeCacheImmediate() +{ + LL_INFOS("AppCache") << "Purging Object Cache and Texture Cache immediately..." << LL_ENDL; + LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE, false); + LLVOCache::getInstance()->removeCache(LL_PATH_CACHE, true); +} + std::string LLAppViewer::getSecondLifeTitle() const { return LLTrans::getString("APP_NAME"); @@ -4653,18 +4690,20 @@ class LLFrameStatsTimer : public LLFrameTimer } }; -static LLFastTimer::DeclareTimer FTM_AUDIO_UPDATE("Update Audio"); -static LLFastTimer::DeclareTimer FTM_CLEANUP("Cleanup"); -static LLFastTimer::DeclareTimer FTM_CLEANUP_DRAWABLES("Drawables"); -static LLFastTimer::DeclareTimer FTM_CLEANUP_OBJECTS("Objects"); -static LLFastTimer::DeclareTimer FTM_IDLE_CB("Idle Callbacks"); -static LLFastTimer::DeclareTimer FTM_LOD_UPDATE("Update LOD"); -static LLFastTimer::DeclareTimer FTM_OBJECTLIST_UPDATE("Update Objectlist"); -static LLFastTimer::DeclareTimer FTM_REGION_UPDATE("Update Region"); -static LLFastTimer::DeclareTimer FTM_WORLD_UPDATE("Update World"); -static LLFastTimer::DeclareTimer FTM_NETWORK("Network"); -static LLFastTimer::DeclareTimer FTM_AGENT_NETWORK("Agent Network"); -static LLFastTimer::DeclareTimer FTM_VLMANAGER("VL Manager"); +static LLTrace::BlockTimerStatHandle FTM_AUDIO_UPDATE("Update Audio"); +static LLTrace::BlockTimerStatHandle FTM_CLEANUP("Cleanup"); +static LLTrace::BlockTimerStatHandle FTM_CLEANUP_DRAWABLES("Drawables"); +static LLTrace::BlockTimerStatHandle FTM_CLEANUP_OBJECTS("Objects"); +static LLTrace::BlockTimerStatHandle FTM_IDLE_CB("Idle Callbacks"); +static LLTrace::BlockTimerStatHandle FTM_LOD_UPDATE("Update LOD"); +static LLTrace::BlockTimerStatHandle FTM_OBJECTLIST_UPDATE("Update Objectlist"); +static LLTrace::BlockTimerStatHandle FTM_REGION_UPDATE("Update Region"); +static LLTrace::BlockTimerStatHandle FTM_WORLD_UPDATE("Update World"); +static LLTrace::BlockTimerStatHandle FTM_NETWORK("Network"); +static LLTrace::BlockTimerStatHandle FTM_AGENT_NETWORK("Agent Network"); +static LLTrace::BlockTimerStatHandle FTM_VLMANAGER("VL Manager"); +static LLTrace::BlockTimerStatHandle FTM_AGENT_POSITION("Agent Position"); +static LLTrace::BlockTimerStatHandle FTM_HUD_EFFECTS("HUD Effects"); /////////////////////////////////////////////////////// // idle() @@ -4683,7 +4722,7 @@ void LLAppViewer::idle() LLFrameTimer::updateFrameCount(); LLEventTimer::updateClass(); LLNotificationsUI::LLToast::updateClass(); - LLCriticalDamp::updateInterpolants(); + LLSmoothInterpolation::updateInterpolants(); LLMortician::updateClass(); LLFilePickerThread::clearDead(); //calls LLFilePickerThread::notify() @@ -4708,6 +4747,7 @@ void LLAppViewer::idle() { if (gRenderStartTime.getElapsedTimeF32() > qas) { + LL_INFOS() << "Quitting after " << qas << " seconds. See setting \"QuitAfterSeconds\"." << LL_ENDL; LLAppViewer::instance()->forceQuit(); } } @@ -4737,9 +4777,9 @@ void LLAppViewer::idle() if (!gDisconnected) { - LLFastTimer t(FTM_NETWORK); + LL_RECORD_BLOCK_TIME(FTM_NETWORK); // Update spaceserver timeinfo - LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + (U32)(dt_raw * SEC_TO_MICROSEC)); + LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + LLUnits::Seconds::fromValue(dt_raw)); ////////////////////////////////////// @@ -4753,7 +4793,7 @@ void LLAppViewer::idle() } { - LLFastTimer t(FTM_AGENT_AUTOPILOT); + LL_RECORD_BLOCK_TIME(FTM_AGENT_AUTOPILOT); // Handle automatic walking towards points gAgentPilot.updateTarget(); gAgent.autoPilot(&yaw); @@ -4768,7 +4808,7 @@ void LLAppViewer::idle() if (flags_changed || (agent_update_time > (1.0f / (F32) AGENT_UPDATES_PER_SECOND))) { - LLFastTimer t(FTM_AGENT_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_AGENT_UPDATE); // Send avatar and camera info last_control_flags = gAgent.getControlFlags(); send_agent_update(TRUE); @@ -4791,7 +4831,7 @@ void LLAppViewer::idle() // *FIX: (???) SAMANTHA if (viewer_stats_timer.getElapsedTimeF32() >= SEND_STATS_PERIOD && !gDisconnected) { - llinfos << "Transmitting sessions stats" << llendl; + LL_INFOS() << "Transmitting sessions stats" << LL_ENDL; send_stats(); viewer_stats_timer.reset(); } @@ -4803,25 +4843,21 @@ void LLAppViewer::idle() object_debug_timer.reset(); if (gObjectList.mNumDeadObjectUpdates) { - llinfos << "Dead object updates: " << gObjectList.mNumDeadObjectUpdates << llendl; + LL_INFOS() << "Dead object updates: " << gObjectList.mNumDeadObjectUpdates << LL_ENDL; gObjectList.mNumDeadObjectUpdates = 0; } if (gObjectList.mNumUnknownUpdates) { - llinfos << "Unknown object updates: " << gObjectList.mNumUnknownUpdates << llendl; + LL_INFOS() << "Unknown object updates: " << gObjectList.mNumUnknownUpdates << LL_ENDL; gObjectList.mNumUnknownUpdates = 0; } - // ViewerMetrics FPS piggy-backing on the debug timer. - // The 5-second interval is nice for this purpose. If the object debug - // bit moves or is disabled, please give this a suitable home. - LLViewerAssetStatsFF::record_fps_main(gFPSClamped); } } if (!gDisconnected) { - LLFastTimer t(FTM_NETWORK); + LL_RECORD_BLOCK_TIME(FTM_NETWORK); //////////////////////////////////////////////// // @@ -4849,7 +4885,7 @@ void LLAppViewer::idle() // { -// LLFastTimer t(FTM_IDLE_CB); +// LL_RECORD_BLOCK_TIME(FTM_IDLE_CB); // Do event notifications if necessary. Yes, we may want to move this elsewhere. gEventNotifier.update(); @@ -4896,15 +4932,14 @@ void LLAppViewer::idle() { // Handle pending gesture processing - static LLFastTimer::DeclareTimer ftm("Agent Position"); - LLFastTimer t(ftm); + LL_RECORD_BLOCK_TIME(FTM_AGENT_POSITION); LLGestureMgr::instance().update(); gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY); } { - LLFastTimer t(FTM_OBJECTLIST_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_OBJECTLIST_UPDATE); if (!(logoutRequestSent() && hasSavedFinalSnapshot())) { @@ -4919,13 +4954,13 @@ void LLAppViewer::idle() // { - LLFastTimer t(FTM_CLEANUP); + LL_RECORD_BLOCK_TIME(FTM_CLEANUP); { - LLFastTimer t(FTM_CLEANUP_OBJECTS); + LL_RECORD_BLOCK_TIME(FTM_CLEANUP_OBJECTS); gObjectList.cleanDeadObjects(); } { - LLFastTimer t(FTM_CLEANUP_DRAWABLES); + LL_RECORD_BLOCK_TIME(FTM_CLEANUP_DRAWABLES); LLDrawable::cleanupDeadDrawables(); } } @@ -4944,8 +4979,7 @@ void LLAppViewer::idle() // { - static LLFastTimer::DeclareTimer ftm("HUD Effects"); - LLFastTimer t(ftm); + LL_RECORD_BLOCK_TIME(FTM_HUD_EFFECTS); LLSelectMgr::getInstance()->updateEffects(); LLHUDManager::getInstance()->cleanupEffects(); LLHUDManager::getInstance()->sendEffects(); @@ -4957,7 +4991,7 @@ void LLAppViewer::idle() // { - LLFastTimer t(FTM_NETWORK); + LL_RECORD_BLOCK_TIME(FTM_NETWORK); gVLManager.unpackData(); } @@ -4969,7 +5003,7 @@ void LLAppViewer::idle() LLWorld::getInstance()->updateVisibilities(); { const F32 max_region_update_time = .001f; // 1ms - LLFastTimer t(FTM_REGION_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_REGION_UPDATE); LLWorld::getInstance()->updateRegions(max_region_update_time); } @@ -5006,7 +5040,7 @@ void LLAppViewer::idle() // Here, particles are updated and drawables are moved. // - LLFastTimer t(FTM_WORLD_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_WORLD_UPDATE); gPipeline.updateMove(); LLWorld::getInstance()->updateParticles(); @@ -5038,7 +5072,7 @@ void LLAppViewer::idle() // objects and camera should be in sync, do LOD calculations now { - LLFastTimer t(FTM_LOD_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_LOD_UPDATE); gObjectList.updateApparentAngles(gAgent); } @@ -5046,7 +5080,7 @@ void LLAppViewer::idle() LLAvatarRenderInfoAccountant::idle(); { - LLFastTimer t(FTM_AUDIO_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_AUDIO_UPDATE); if (gAudiop) { @@ -5271,12 +5305,12 @@ void LLAppViewer::idleNameCache() static F32 CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME; #endif -static LLFastTimer::DeclareTimer FTM_IDLE_NETWORK("Idle Network"); -static LLFastTimer::DeclareTimer FTM_MESSAGE_ACKS("Message Acks"); -static LLFastTimer::DeclareTimer FTM_RETRANSMIT("Retransmit"); -static LLFastTimer::DeclareTimer FTM_TIMEOUT_CHECK("Timeout Check"); -static LLFastTimer::DeclareTimer FTM_DYNAMIC_THROTTLE("Dynamic Throttle"); -static LLFastTimer::DeclareTimer FTM_CHECK_REGION_CIRCUIT("Check Region Circuit"); +static LLTrace::BlockTimerStatHandle FTM_IDLE_NETWORK("Idle Network"); +static LLTrace::BlockTimerStatHandle FTM_MESSAGE_ACKS("Message Acks"); +static LLTrace::BlockTimerStatHandle FTM_RETRANSMIT("Retransmit"); +static LLTrace::BlockTimerStatHandle FTM_TIMEOUT_CHECK("Timeout Check"); +static LLTrace::BlockTimerStatHandle FTM_DYNAMIC_THROTTLE("Dynamic Throttle"); +static LLTrace::BlockTimerStatHandle FTM_CHECK_REGION_CIRCUIT("Check Region Circuit"); void LLAppViewer::idleNetwork() { @@ -5287,7 +5321,7 @@ void LLAppViewer::idleNetwork() if (!gSavedSettings.getBOOL("SpeedTest")) { - LLFastTimer t(FTM_IDLE_NETWORK); // decode + LL_RECORD_BLOCK_TIME(FTM_IDLE_NETWORK); // decode LLTimer check_message_timer; // Read all available packets from network @@ -5349,16 +5383,16 @@ void LLAppViewer::idleNetwork() if( remaining_possible_decodes <= 0 ) { - llinfos << "Maxed out number of messages per frame at " << MESSAGE_MAX_PER_FRAME << llendl; + LL_INFOS() << "Maxed out number of messages per frame at " << MESSAGE_MAX_PER_FRAME << LL_ENDL; } if (gPrintMessagesThisFrame) { - llinfos << "Decoded " << total_decoded << " msgs this frame!" << llendl; + LL_INFOS() << "Decoded " << total_decoded << " msgs this frame!" << LL_ENDL; gPrintMessagesThisFrame = FALSE; } } - LLViewerStats::getInstance()->mNumNewObjectsStat.addValue(gObjectList.mNumNewObjects); + add(LLStatViewer::NUM_NEW_OBJECTS, gObjectList.mNumNewObjects); // Retransmit unacknowledged packets. gXferManager->retransmitUnackedPackets(); @@ -5393,7 +5427,7 @@ void LLAppViewer::disconnectViewer() // // Save snapshot for next time, if we made it through initialization - llinfos << "Disconnecting viewer!" << llendl; + LL_INFOS() << "Disconnecting viewer!" << LL_ENDL; // Dump our frame statistics @@ -5437,6 +5471,7 @@ void LLAppViewer::disconnectViewer() { LLWorld::getInstance()->destroyClass(); } + LLVOCache::deleteSingleton(); // call all self-registered classes LLDestroyClassList::instance().fireCallbacks(); @@ -5451,12 +5486,12 @@ void LLAppViewer::disconnectViewer() void LLAppViewer::forceErrorLLError() { - llerrs << "This is a deliberate llerror" << llendl; + LL_ERRS() << "This is a deliberate llerror" << LL_ENDL; } void LLAppViewer::forceErrorBreakpoint() { - llwarns << "Forcing a deliberate breakpoint" << llendl; + LL_WARNS() << "Forcing a deliberate breakpoint" << LL_ENDL; #ifdef LL_WINDOWS DebugBreak(); #endif @@ -5465,7 +5500,7 @@ void LLAppViewer::forceErrorBreakpoint() void LLAppViewer::forceErrorBadMemoryAccess() { - llwarns << "Forcing a deliberate bad memory access" << llendl; + LL_WARNS() << "Forcing a deliberate bad memory access" << LL_ENDL; S32* crash = NULL; *crash = 0xDEADBEEF; return; @@ -5473,7 +5508,7 @@ void LLAppViewer::forceErrorBadMemoryAccess() void LLAppViewer::forceErrorInfiniteLoop() { - llwarns << "Forcing a deliberate infinite loop" << llendl; + LL_WARNS() << "Forcing a deliberate infinite loop" << LL_ENDL; while(true) { ; @@ -5483,14 +5518,14 @@ void LLAppViewer::forceErrorInfiniteLoop() void LLAppViewer::forceErrorSoftwareException() { - llwarns << "Forcing a deliberate exception" << llendl; + LL_WARNS() << "Forcing a deliberate exception" << LL_ENDL; // *FIX: Any way to insure it won't be handled? throw; } void LLAppViewer::forceErrorDriverCrash() { - llwarns << "Forcing a deliberate driver crash" << llendl; + LL_WARNS() << "Forcing a deliberate driver crash" << LL_ENDL; glDeleteTextures(1, NULL); } @@ -5538,7 +5573,7 @@ void LLAppViewer::pingMainloopTimeout(const std::string& state, F32 secs) { // if(!restoreErrorTrap()) // { -// llwarns << "!!!!!!!!!!!!! Its an error trap!!!!" << state << llendl; +// LL_WARNS() << "!!!!!!!!!!!!! Its an error trap!!!!" << state << LL_ENDL; // } if(mMainloopTimeout) @@ -5597,13 +5632,13 @@ void LLAppViewer::handleLoginComplete() writeDebugInfo(); // we logged in successfully, so save settings on logout - llinfos << "Login successful, per account settings will be saved on log out." << llendl; + LL_INFOS() << "Login successful, per account settings will be saved on log out." << LL_ENDL; mSavePerAccountSettings=true; } void LLAppViewer::launchUpdater() { - LLSD query_map = LLSD::emptyMap(); + LLSD query_map = LLSD::emptyMap(); query_map["os"] = gPlatform; // *TODO change userserver to be grid on both viewer and sim, since @@ -5700,7 +5735,7 @@ void LLAppViewer::launchUpdater() // Although we already have the full set of paths with the filename // appended, the linux-updater.bin command-line switches require us to // snip the filename OFF and pass it as a separate switch argument. :-P - llinfos << "Got a XUI path: " << this_skin_path << llendl; + LL_INFOS() << "Got a XUI path: " << this_skin_path << LL_ENDL; xml_search_paths.append(delim); xml_search_paths.append(gDirUtilp->getDirName(this_skin_path)); delim = ","; @@ -5722,9 +5757,9 @@ void LLAppViewer::launchUpdater() GError *error = NULL; if (!g_spawn_command_line_async(LLAppViewer::sUpdaterInfo->mUpdateExePath.c_str(), &error)) { - llerrs << "Failed to launch updater: " + LL_ERRS() << "Failed to launch updater: " << error->message - << llendl; + << LL_ENDL; } if (error) { g_error_free(error); @@ -5765,17 +5800,7 @@ void LLAppViewer::metricsUpdateRegion(U64 region_handle) { if (0 != region_handle) { - LLViewerAssetStatsFF::set_region_main(region_handle); - if (LLAppViewer::sTextureFetch) - { - // Send a region update message into 'thread1' to get the new region. - LLAppViewer::sTextureFetch->commandSetRegion(region_handle); - } - else - { - // No 'thread1', a.k.a. TextureFetch, so update directly - LLViewerAssetStatsFF::set_region_thread1(region_handle); - } + LLViewerAssetStatsFF::set_region(region_handle); } } @@ -5786,7 +5811,7 @@ void LLAppViewer::metricsUpdateRegion(U64 region_handle) */ void LLAppViewer::metricsSend(bool enable_reporting) { - if (! gViewerAssetStatsMain) + if (! gViewerAssetStats) return; if (LLAppViewer::sTextureFetch) @@ -5799,8 +5824,9 @@ void LLAppViewer::metricsSend(bool enable_reporting) // Make a copy of the main stats to send into another thread. // Receiving thread takes ownership. - LLViewerAssetStats * main_stats(new LLViewerAssetStats(*gViewerAssetStatsMain)); - + LLViewerAssetStats * main_stats(new LLViewerAssetStats(*gViewerAssetStats)); + main_stats->stop(); + // Send a report request into 'thread1' to get the rest of the data // and provide some additional parameters while here. LLAppViewer::sTextureFetch->commandSendMetrics(caps_url, @@ -5818,6 +5844,6 @@ void LLAppViewer::metricsSend(bool enable_reporting) // Reset even if we can't report. Rather than gather up a huge chunk of // data, we'll keep to our sampling interval and retain the data // resolution in time. - gViewerAssetStatsMain->reset(); + gViewerAssetStats->restart(); } diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 25b5c90bb05ad737b6e19ef7829413333b7b664f..e0f3f326c7a5a5af4948ebda73222b2518928a01 100755 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -32,7 +32,6 @@ #include "llsys.h" // for LLOSInfo #include "lltimer.h" #include "llappcorehttp.h" -#include <boost/optional.hpp> class LLCommandLineParser; class LLFrameTimer; @@ -44,7 +43,7 @@ class LLWatchdogTimeout; class LLUpdaterService; class LLViewerJoystick; -extern LLFastTimer::DeclareTimer FTM_FRAME; +extern LLTrace::BlockTimerStatHandle FTM_FRAME; class LLAppViewer : public LLApp { @@ -176,6 +175,8 @@ class LLAppViewer : public LLApp void addOnIdleCallback(const boost::function<void()>& cb); // add a callback to fire (once) when idle void purgeCache(); // Clear the local cache. + void purgeCacheImmediate(); //clear local cache immediately. + S32 updateTextureThreads(F32 max_time); // mute/unmute the system's master audio virtual void setMasterSystemAudioMute(bool mute); @@ -279,7 +280,7 @@ class LLAppViewer : public LLApp LLWatchdogTimeout* mMainloopTimeout; // For performance and metric gathering - LLThread* mFastTimerLogThread; + class LLThread* mFastTimerLogThread; // for tracking viewer<->region circuit death bool mAgentRegionLastAlive; @@ -342,12 +343,12 @@ extern U32 gForegroundFrameCount; extern LLPumpIO* gServicePump; -extern U64 gFrameTime; // The timestamp of the most-recently-processed frame -extern F32 gFrameTimeSeconds; // Loses msec precision after ~4.5 hours... -extern F32 gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds +extern U64MicrosecondsImplicit gStartTime; +extern U64MicrosecondsImplicit gFrameTime; // The timestamp of the most-recently-processed frame +extern F32SecondsImplicit gFrameTimeSeconds; // Loses msec precision after ~4.5 hours... +extern F32SecondsImplicit gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds extern F32 gFPSClamped; // Frames per second, smoothed, weighted toward last frame extern F32 gFrameDTClamped; -extern U64 gStartTime; extern U32 gFrameStalls; extern LLTimer gRenderStartTime; @@ -375,7 +376,7 @@ class LLVFS; extern LLVFS *gStaticVFS; extern LLMemoryInfo gSysMemory; -extern U64 gMemoryAllocated; +extern U64Bytes gMemoryAllocated; extern std::string gLastVersionChannel; diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 11fcf0018e3442b8df9484da325d818ec5a106b9..f5742b29cf09c414ceed55fa749e385810f489ce 100755 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -90,7 +90,7 @@ int main( int argc, char **argv ) bool ok = viewer_app_ptr->init(); if(!ok) { - llwarns << "Application init failed." << llendl; + LL_WARNS() << "Application init failed." << LL_ENDL; return -1; } @@ -220,7 +220,7 @@ void viewerappapi_init(ViewerAppAPI *server) } else { - llwarns << "Unable to register service name: " << error->message << llendl; + LL_WARNS() << "Unable to register service name: " << error->message << LL_ENDL; } g_object_unref(serverproxy); @@ -239,7 +239,7 @@ gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **succ { bool success = false; - llinfos << "Was asked to go to slurl: " << slurl << llendl; + LL_INFOS() << "Was asked to go to slurl: " << slurl << LL_ENDL; std::string url = slurl; LLMediaCtrl* web = NULL; @@ -305,14 +305,14 @@ bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url) } else { - llinfos << "Call-out to other instance failed (perhaps not running): " << error->message << llendl; + LL_INFOS() << "Call-out to other instance failed (perhaps not running): " << error->message << LL_ENDL; } g_object_unref(G_OBJECT(remote_object)); } else { - llwarns << "Couldn't connect to session bus: " << error->message << llendl; + LL_WARNS() << "Couldn't connect to session bus: " << error->message << LL_ENDL; } if (error) @@ -368,7 +368,7 @@ void LLAppViewerLinux::initCrashReporting(bool reportFreeze) if (pid == 0) { // child execv(cmd.c_str(), (char* const*) cmdargv); /* Flawfinder: ignore */ - llwarns << "execv failure when trying to start " << cmd << llendl; + LL_WARNS() << "execv failure when trying to start " << cmd << LL_ENDL; _exit(1); // avoid atexit() } else @@ -383,7 +383,7 @@ void LLAppViewerLinux::initCrashReporting(bool reportFreeze) } else { - llwarns << "fork failure." << llendl; + LL_WARNS() << "fork failure." << LL_ENDL; } } // Sometimes signals don't seem to quit the viewer. Also, we may diff --git a/indra/newview/llappviewerlinux_api_dbus.cpp b/indra/newview/llappviewerlinux_api_dbus.cpp index 32e7e0a83d5b10d350bcfceefa47d5478a5bd9c5..6ac30bd9b89647dbbb6bb60b651a48efa7c5ff5a 100755 --- a/indra/newview/llappviewerlinux_api_dbus.cpp +++ b/indra/newview/llappviewerlinux_api_dbus.cpp @@ -35,9 +35,9 @@ extern "C" { #include "apr_dso.h" } -#define DEBUGMSG(...) do { lldebugs << llformat(__VA_ARGS__) << llendl; } while(0) -#define INFOMSG(...) do { llinfos << llformat(__VA_ARGS__) << llendl; } while(0) -#define WARNMSG(...) do { llwarns << llformat(__VA_ARGS__) << llendl; } while(0) +#define DEBUGMSG(...) do { LL_DEBUGS() << llformat(__VA_ARGS__) << LL_ENDL; } while(0) +#define INFOMSG(...) do { LL_INFOS() << llformat(__VA_ARGS__) << LL_ENDL; } while(0) +#define WARNMSG(...) do { LL_WARNS() << llformat(__VA_ARGS__) << LL_ENDL; } while(0) #define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) RTN (*ll##DBUSSYM)(__VA_ARGS__) = NULL #include "llappviewerlinux_api_dbus_syms_raw.inc" diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index c6d45cf4d6d9f33fb08a5580a417c300f995f494..c792eb88131e7404b24e915158c134554640d36c 100755 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -98,9 +98,9 @@ bool initViewer() // Set the working dir to <bundle>/Contents/Resources if (chdir(gDirUtilp->getAppRODataDir().c_str()) == -1) { - llwarns << "Could not change directory to " - << gDirUtilp->getAppRODataDir() << ": " << strerror(errno) - << llendl; + LL_WARNS() << "Could not change directory to " + << gDirUtilp->getAppRODataDir() << ": " << strerror(errno) + << LL_ENDL; } gViewerAppPtr = new LLAppViewerMacOSX(); @@ -114,7 +114,7 @@ bool initViewer() bool ok = gViewerAppPtr->init(); if(!ok) { - llwarns << "Application init failed." << llendl; + LL_WARNS() << "Application init failed." << LL_ENDL; } return ok; diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 5585bd914c79c810b9614362e2b47f8876bde611..06f081e92046ff1af0aaf983511c253c3d7e4a60 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -29,11 +29,12 @@ #ifdef INCLUDE_VLD #include "vld.h" #endif +#include "llwin32headers.h" -#include "llappviewerwin32.h" +#include "llwindowwin32.h" // *FIX: for setting gIconResource. +#include "llappviewerwin32.h" -#include "llwindowwin32.h" // *FIX: for setting gIconResource. #include "llgl.h" #include "res/resource.h" // *FIX: for setting gIconResource. @@ -52,7 +53,6 @@ #include <stdlib.h> #include "llweb.h" -#include "llsecondlifeurls.h" #include "llviewernetwork.h" #include "llmd5.h" @@ -88,7 +88,7 @@ static void exceptionTerminateHandler() LONG WINAPI catchallCrashHandler(EXCEPTION_POINTERS * /*ExceptionInfo*/) { - llwarns << "Hit last ditch-effort attempt to catch crash." << llendl; + LL_WARNS() << "Hit last ditch-effort attempt to catch crash." << LL_ENDL; exceptionTerminateHandler(); return 0; } @@ -100,7 +100,7 @@ LONG WINAPI catchallCrashHandler(EXCEPTION_POINTERS * /*ExceptionInfo*/) extern "C" { void _wassert(const wchar_t * _Message, const wchar_t *_File, unsigned _Line) { - llerrs << _Message << llendl; + LL_ERRS() << _Message << LL_ENDL; } } #endif @@ -116,7 +116,7 @@ void nvapi_error(NvAPI_Status status) { NvAPI_ShortString szDesc = {0}; NvAPI_GetErrorMessage(status, szDesc); - llwarns << szDesc << llendl; + LL_WARNS() << szDesc << LL_ENDL; //should always trigger when asserts are enabled //llassert(status == NVAPI_OK); @@ -278,7 +278,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, bool ok = viewer_app_ptr->init(); if(!ok) { - llwarns << "Application init failed." << llendl; + LL_WARNS() << "Application init failed." << LL_ENDL; return -1; } @@ -306,12 +306,12 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // Have to wait until after logging is initialized to display LFH info if (num_heaps > 0) { - llinfos << "Attempted to enable LFH for " << num_heaps << " heaps." << llendl; + LL_INFOS() << "Attempted to enable LFH for " << num_heaps << " heaps." << LL_ENDL; for(S32 i = 0; i < num_heaps; i++) { if (heap_enable_lfh_error[i]) { - llinfos << " Failed to enable LFH for heap: " << i << " Error: " << heap_enable_lfh_error[i] << llendl; + LL_INFOS() << " Failed to enable LFH for heap: " << i << " Error: " << heap_enable_lfh_error[i] << LL_ENDL; } } } @@ -330,14 +330,14 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, // app cleanup if there was a problem. // #if WINDOWS_CRT_MEM_CHECKS - llinfos << "CRT Checking memory:" << llendflush; + LL_INFOS() << "CRT Checking memory:" << LL_ENDL; if (!_CrtCheckMemory()) { - llwarns << "_CrtCheckMemory() failed at prior to cleanup!" << llendflush; + LL_WARNS() << "_CrtCheckMemory() failed at prior to cleanup!" << LL_ENDL; } else { - llinfos << " No corruption detected." << llendflush; + LL_INFOS() << " No corruption detected." << LL_ENDL; } #endif @@ -346,14 +346,14 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, viewer_app_ptr->cleanup(); #if WINDOWS_CRT_MEM_CHECKS - llinfos << "CRT Checking memory:" << llendflush; + LL_INFOS() << "CRT Checking memory:" << LL_ENDL; if (!_CrtCheckMemory()) { - llwarns << "_CrtCheckMemory() failed after cleanup!" << llendflush; + LL_WARNS() << "_CrtCheckMemory() failed after cleanup!" << LL_ENDL; } else { - llinfos << " No corruption detected." << llendflush; + LL_INFOS() << " No corruption detected." << LL_ENDL; } #endif @@ -424,11 +424,11 @@ void LLAppViewerWin32::disableWinErrorReporting() if( 0 == pAddERExcludedApplicationA( executable_name ) ) { U32 error_code = GetLastError(); - llinfos << "AddERExcludedApplication() failed with error code " << error_code << llendl; + LL_INFOS() << "AddERExcludedApplication() failed with error code " << error_code << LL_ENDL; } else { - llinfos << "AddERExcludedApplication() success for " << executable_name << llendl; + LL_INFOS() << "AddERExcludedApplication() success for " << executable_name << LL_ENDL; } } FreeLibrary( fault_rep_dll_handle ); @@ -459,7 +459,7 @@ void create_console() h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); if (h_con_handle == -1) { - llwarns << "create_console() failed to open stdout handle" << llendl; + LL_WARNS() << "create_console() failed to open stdout handle" << LL_ENDL; } else { @@ -473,7 +473,7 @@ void create_console() h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); if (h_con_handle == -1) { - llwarns << "create_console() failed to open stdin handle" << llendl; + LL_WARNS() << "create_console() failed to open stdin handle" << LL_ENDL; } else { @@ -487,7 +487,7 @@ void create_console() h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); if (h_con_handle == -1) { - llwarns << "create_console() failed to open stderr handle" << llendl; + LL_WARNS() << "create_console() failed to open stderr handle" << LL_ENDL; } else { @@ -514,7 +514,7 @@ bool LLAppViewerWin32::init() // (Don't send our data to Microsoft--at least until we are Logo approved and have a way // of getting the data back from them.) // - // llinfos << "Turning off Windows error reporting." << llendl; + // LL_INFOS() << "Turning off Windows error reporting." << LL_ENDL; disableWinErrorReporting(); #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -603,7 +603,7 @@ bool LLAppViewerWin32::initHardwareTest() if (OSBTN_NO== button) { LL_INFOS("AppInit") << "User quitting after failed DirectX 9 detection" << LL_ENDL; - LLWeb::loadURLExternal(DIRECTX_9_URL, false); + LLWeb::loadURLExternal("http://secondlife.com/support/", false); return false; } gWarningSettings.setBOOL("AboutDirectX9", FALSE); @@ -734,7 +734,7 @@ bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) if (other_window != NULL) { - lldebugs << "Found other window with the name '" << getWindowTitle() << "'" << llendl; + LL_DEBUGS() << "Found other window with the name '" << getWindowTitle() << "'" << LL_ENDL; COPYDATASTRUCT cds; const S32 SLURL_MESSAGE_TYPE = 0; cds.dwData = SLURL_MESSAGE_TYPE; @@ -742,8 +742,8 @@ bool LLAppViewerWin32::sendURLToOtherInstance(const std::string& url) cds.lpData = (void*)url.c_str(); LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds); - lldebugs << "SendMessage(WM_COPYDATA) to other window '" - << getWindowTitle() << "' returned " << msg_result << llendl; + LL_DEBUGS() << "SendMessage(WM_COPYDATA) to other window '" + << getWindowTitle() << "' returned " << msg_result << LL_ENDL; return true; } return false; @@ -775,7 +775,7 @@ std::string LLAppViewerWin32::generateSerialNumber() } else { - llwarns << "GetVolumeInformation failed" << llendl; + LL_WARNS() << "GetVolumeInformation failed" << LL_ENDL; } return serial_md5; } diff --git a/indra/newview/llassetuploadqueue.cpp b/indra/newview/llassetuploadqueue.cpp index 4bdb690225d6b871876ceb0e5a33de65fcf81086..2b428aec4b05ee4a7a9566e8a95bb9c156b3f6e9 100755 --- a/indra/newview/llassetuploadqueue.cpp +++ b/indra/newview/llassetuploadqueue.cpp @@ -71,8 +71,8 @@ class LLAssetUploadChainResponder : public LLUpdateTaskInventoryResponder virtual void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llwarns << "LLAssetUploadChainResponder Error [status:" - << statusNum << "]: " << content << llendl; + LL_WARNS() << "LLAssetUploadChainResponder Error [status:" + << statusNum << "]: " << content << LL_ENDL; LLUpdateTaskInventoryResponder::errorWithContent(statusNum, reason, content); LLAssetUploadQueue *queue = mSupplier->get(); if (queue) @@ -102,7 +102,7 @@ class LLAssetUploadChainResponder : public LLUpdateTaskInventoryResponder std::string uploader = content["uploader"]; mSupplier->log(std::string("Compiling " + mScriptName).c_str()); - llinfos << "Compiling " << llendl; + LL_INFOS() << "Compiling " << LL_ENDL; // postRaw takes ownership of mData and will delete it. LLHTTPClient::postRaw(uploader, mData, mDataSize, this); @@ -116,7 +116,7 @@ class LLAssetUploadChainResponder : public LLUpdateTaskInventoryResponder if (content["compiled"]) { mSupplier->log("Compilation succeeded"); - llinfos << "Compiled!" << llendl; + LL_INFOS() << "Compiled!" << LL_ENDL; } else { @@ -127,7 +127,7 @@ class LLAssetUploadChainResponder : public LLUpdateTaskInventoryResponder std::string str = line->asString(); str.erase(std::remove(str.begin(), str.end(), '\n'), str.end()); mSupplier->log(str); - llinfos << content["errors"] << llendl; + LL_INFOS() << content["errors"] << LL_ENDL; } } LLUpdateTaskInventoryResponder::uploadComplete(content); diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 25648023879a9ee2e99ddd17f04df74292e4fcd7..d86e63589fd5c3b87d363ce2553543ff7895d7b4 100755 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -135,7 +135,7 @@ void on_new_single_inventory_upload_complete( inventory_item_flags = (U32) server_response["inventory_flags"].asInteger(); if (inventory_item_flags != 0) { - llinfos << "inventory_item_flags " << inventory_item_flags << llendl; + LL_INFOS() << "inventory_item_flags " << inventory_item_flags << LL_ENDL; } } S32 creation_date_now = time_corrected(); @@ -173,7 +173,7 @@ void on_new_single_inventory_upload_complete( } else { - llwarns << "Can't find a folder to put it in" << llendl; + LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL; } // remove the "Uploading..." message @@ -197,7 +197,7 @@ LLAssetUploadResponder::LLAssetUploadResponder(const LLSD &post_data, { if (!gVFS->getExists(vfile_id, asset_type)) { - llwarns << "LLAssetUploadResponder called with nonexistant vfile_id" << llendl; + LL_WARNS() << "LLAssetUploadResponder called with nonexistant vfile_id" << LL_ENDL; mVFileID.setNull(); mAssetType = LLAssetType::AT_NONE; return; @@ -227,8 +227,8 @@ LLAssetUploadResponder::~LLAssetUploadResponder() // virtual void LLAssetUploadResponder::errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llinfos << "LLAssetUploadResponder::error [status:" - << statusNum << "]: " << content << llendl; + LL_INFOS() << "LLAssetUploadResponder::error [status:" + << statusNum << "]: " << content << LL_ENDL; LLSD args; switch(statusNum) { @@ -253,7 +253,7 @@ void LLAssetUploadResponder::errorWithContent(U32 statusNum, const std::string& //virtual void LLAssetUploadResponder::result(const LLSD& content) { - lldebugs << "LLAssetUploadResponder::result from capabilities" << llendl; + LL_DEBUGS() << "LLAssetUploadResponder::result from capabilities" << LL_ENDL; std::string state = content["state"]; @@ -267,7 +267,7 @@ void LLAssetUploadResponder::result(const LLSD& content) if (mFileName.empty()) { // rename the file in the VFS to the actual asset id - // llinfos << "Changing uploaded asset UUID to " << content["new_asset"].asUUID() << llendl; + // LL_INFOS() << "Changing uploaded asset UUID to " << content["new_asset"].asUUID() << LL_ENDL; gVFS->renameFile(mVFileID, mAssetType, content["new_asset"].asUUID(), mAssetType); } uploadComplete(content); @@ -358,11 +358,11 @@ void LLNewAgentInventoryResponder::uploadFailure(const LLSD& content) //virtual void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) { - lldebugs << "LLNewAgentInventoryResponder::result from capabilities" << llendl; + LL_DEBUGS() << "LLNewAgentInventoryResponder::result from capabilities" << LL_ENDL; //std::ostringstream llsdxml; //LLSDSerialize::toXML(content, llsdxml); - //llinfos << "upload complete content:\n " << llsdxml.str() << llendl; + //LL_INFOS() << "upload complete content:\n " << llsdxml.str() << LL_ENDL; LLAssetType::EType asset_type = LLAssetType::lookup(mPostData["asset_type"].asString()); LLInventoryType::EType inventory_type = LLInventoryType::lookup(mPostData["inventory_type"].asString()); @@ -473,7 +473,7 @@ void LLSendTexLayerResponder::uploadComplete(const LLSD& content) std::string result = content["state"]; LLUUID new_id = content["new_asset"]; - llinfos << "result: " << result << " new_id: " << new_id << llendl; + LL_INFOS() << "result: " << result << " new_id: " << new_id << LL_ENDL; if (result == "complete" && mBakedUploadData != NULL) { // Invoke @@ -489,8 +489,8 @@ void LLSendTexLayerResponder::uploadComplete(const LLSD& content) void LLSendTexLayerResponder::errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llinfos << "LLSendTexLayerResponder error [status:" - << statusNum << "]: " << content << llendl; + LL_INFOS() << "LLSendTexLayerResponder error [status:" + << statusNum << "]: " << content << LL_ENDL; // Invoke the original callback with an error result LLViewerTexLayerSetBuffer::onTextureUploadComplete(LLUUID(), (void*) mBakedUploadData, -1, LL_EXSTAT_NONE); @@ -516,14 +516,14 @@ LLUpdateAgentInventoryResponder::LLUpdateAgentInventoryResponder( //virtual void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content) { - llinfos << "LLUpdateAgentInventoryResponder::result from capabilities" << llendl; + LL_INFOS() << "LLUpdateAgentInventoryResponder::result from capabilities" << LL_ENDL; LLUUID item_id = mPostData["item_id"]; LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(item_id); if(!item) { - llwarns << "Inventory item for " << mVFileID - << " is no longer in agent inventory." << llendl; + LL_WARNS() << "Inventory item for " << mVFileID + << " is no longer in agent inventory." << LL_ENDL; return; } @@ -533,8 +533,8 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content) gInventory.updateItem(new_item); gInventory.notifyObservers(); - llinfos << "Inventory item " << item->getName() << " saved into " - << content["new_asset"].asString() << llendl; + LL_INFOS() << "Inventory item " << item->getName() << " saved into " + << content["new_asset"].asString() << LL_ENDL; LLInventoryType::EType inventory_type = new_item->getInventoryType(); switch(inventory_type) @@ -630,7 +630,7 @@ LLUpdateTaskInventoryResponder::LLUpdateTaskInventoryResponder(const LLSD& post_ //virtual void LLUpdateTaskInventoryResponder::uploadComplete(const LLSD& content) { - llinfos << "LLUpdateTaskInventoryResponder::result from capabilities" << llendl; + LL_INFOS() << "LLUpdateTaskInventoryResponder::result from capabilities" << LL_ENDL; LLUUID item_id = mPostData["item_id"]; LLUUID task_id = mPostData["task_id"]; @@ -711,9 +711,9 @@ class LLNewAgentInventoryVariablePriceResponder::Impl { if (!gVFS->getExists(vfile_id, asset_type)) { - llwarns + LL_WARNS() << "LLAssetUploadResponder called with nonexistant " - << "vfile_id " << vfile_id << llendl; + << "vfile_id " << vfile_id << LL_ENDL; mVFileID.setNull(); mAssetType = LLAssetType::AT_NONE; } @@ -1014,9 +1014,9 @@ void LLNewAgentInventoryVariablePriceResponder::errorWithContent( const std::string& reason, const LLSD& content) { - lldebugs + LL_DEBUGS() << "LLNewAgentInventoryVariablePrice::error " << statusNum - << " reason: " << reason << llendl; + << " reason: " << reason << LL_ENDL; if ( content.has("error") ) { @@ -1060,7 +1060,7 @@ void LLNewAgentInventoryVariablePriceResponder::result(const LLSD& content) if (mImpl->getFilename().empty()) { // rename the file in the VFS to the actual asset id - // llinfos << "Changing uploaded asset UUID to " << content["new_asset"].asUUID() << llendl; + // LL_INFOS() << "Changing uploaded asset UUID to " << content["new_asset"].asUUID() << LL_ENDL; gVFS->renameFile( mImpl->getVFileID(), asset_type, diff --git a/indra/newview/llattachmentsmgr.cpp b/indra/newview/llattachmentsmgr.cpp index ea0b8f00a4342f63e68b7f104e6beee32625e188..256980eb04a29db249fbb3b83f001f710464da3c 100755 --- a/indra/newview/llattachmentsmgr.cpp +++ b/indra/newview/llattachmentsmgr.cpp @@ -110,7 +110,7 @@ void LLAttachmentsMgr::onIdle() LLViewerInventoryItem* item = gInventory.getItem(attachment.mItemID); if (!item) { - llinfos << "Attempted to add non-existant item ID:" << attachment.mItemID << llendl; + LL_INFOS() << "Attempted to add non-existant item ID:" << attachment.mItemID << LL_ENDL; continue; } S32 attachment_pt = attachment.mAttachmentPt; diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 307e72fe18cc1a1d49a2ac58e68db50a6200a633..dad85a016c071c69adbe595f901bd8ba97bb5b0b 100755 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -33,7 +33,6 @@ #include "llavatarnamecache.h" // IDEVO #include "llsd.h" -#include "lldarray.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "roles_constants.h" // for GP_MEMBER_INVITE @@ -76,6 +75,12 @@ #include "llavatarname.h" #include "llagentui.h" +// Flags for kick message +const U32 KICK_FLAGS_DEFAULT = 0x0; +const U32 KICK_FLAGS_FREEZE = 1 << 0; +const U32 KICK_FLAGS_UNFREEZE = 1 << 1; + + // static void LLAvatarActions::requestFriendshipDialog(const LLUUID& id, const std::string& name) { @@ -166,7 +171,7 @@ void LLAvatarActions::offerTeleport(const LLUUID& invitee) if (invitee.isNull()) return; - LLDynamicArray<LLUUID> ids; + std::vector<LLUUID> ids; ids.push_back(invitee); offerTeleport(ids); } @@ -244,8 +249,9 @@ void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids, const LLUUID& floate return; } - // convert vector into LLDynamicArray for addSession - LLDynamicArray<LLUUID> id_array; + // convert vector into std::vector for addSession + std::vector<LLUUID> id_array; + id_array.reserve(ids.size()); for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { id_array.push_back(*it); @@ -290,7 +296,9 @@ bool LLAvatarActions::canCall() void LLAvatarActions::startConference(const uuid_vec_t& ids, const LLUUID& floater_id) { // *HACK: Copy into dynamic array - LLDynamicArray<LLUUID> id_array; + std::vector<LLUUID> id_array; + + id_array.reserve(ids.size()); for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { id_array.push_back(*it); @@ -1043,7 +1051,7 @@ bool LLAvatarActions::handleRemove(const LLSD& notification, const LLSD& respons case 1: // NO default: - llinfos << "No removal performed." << llendl; + LL_INFOS() << "No removal performed." << LL_ENDL; break; } } diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 403414558e22943fa06bd92ac8beaf18db31b0a0..85813f2152f99c100d815110184d15825a2716c7 100755 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -27,7 +27,6 @@ #ifndef LL_LLAVATARACTIONS_H #define LL_LLAVATARACTIONS_H -#include "lldarray.h" #include "llsd.h" #include "lluuid.h" diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index f34ad2376994316c71cc874fd33af9e695a542a8..746b541f9d2ce76e8d50fad1900197881b5d5d21 100755 --- a/indra/newview/llavatariconctrl.cpp +++ b/indra/newview/llavatariconctrl.cpp @@ -32,7 +32,6 @@ // viewer includes #include "llagent.h" -#include "llavatarconstants.h" #include "llcallingcard.h" // for LLAvatarTracker #include "llavataractions.h" #include "llmenugl.h" @@ -50,6 +49,18 @@ static LLDefaultChildRegistry::Register<LLAvatarIconCtrl> r("avatar_icon"); +namespace LLInitParam +{ + void TypeValues<LLAvatarIconCtrlEnums::ESymbolPos>::declareValues() + { + declare("BottomLeft", LLAvatarIconCtrlEnums::BOTTOM_LEFT); + declare("BottomRight", LLAvatarIconCtrlEnums::BOTTOM_RIGHT); + declare("TopLeft", LLAvatarIconCtrlEnums::TOP_LEFT); + declare("TopRight", LLAvatarIconCtrlEnums::TOP_RIGHT); + } +} + + bool LLAvatarIconIDCache::LLAvatarIconIDCacheItem::expired() { const F64 SEC_PER_DAY_PLUS_HOUR = (24.0 + 1.0) * 60.0 * 60.0; @@ -61,7 +72,7 @@ bool LLAvatarIconIDCache::LLAvatarIconIDCacheItem::expired() void LLAvatarIconIDCache::load () { - llinfos << "Loading avatar icon id cache." << llendl; + LL_INFOS() << "Loading avatar icon id cache." << LL_ENDL; // build filename for each user std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename); @@ -106,7 +117,7 @@ void LLAvatarIconIDCache::save () llofstream file (resolved_filename); if (!file.is_open()) { - llwarns << "can't open avatar icons cache file\"" << mFilename << "\" for writing" << llendl; + LL_WARNS() << "can't open avatar icons cache file\"" << mFilename << "\" for writing" << LL_ENDL; return; } @@ -146,52 +157,63 @@ void LLAvatarIconIDCache::remove (const LLUUID& avatar_id) LLAvatarIconCtrl::Params::Params() : avatar_id("avatar_id"), draw_tooltip("draw_tooltip", true), - default_icon_name("default_icon_name") + default_icon_name("default_icon_name"), + symbol_hpad("symbol_hpad"), + symbol_vpad("symbol_vpad"), + symbol_size("symbol_size", 1), + symbol_pos("symbol_pos", LLAvatarIconCtrlEnums::BOTTOM_RIGHT) { + changeDefault(min_width, 32); + changeDefault(min_height, 32); } LLAvatarIconCtrl::LLAvatarIconCtrl(const LLAvatarIconCtrl::Params& p) - : LLIconCtrl(p), +: LLIconCtrl(p), LLAvatarPropertiesObserver(), mAvatarId(), mFullName(), mDrawTooltip(p.draw_tooltip), mDefaultIconName(p.default_icon_name), - mAvatarNameCacheConnection() + mAvatarNameCacheConnection(), + mSymbolHpad(p.symbol_hpad), + mSymbolVpad(p.symbol_vpad), + mSymbolSize(p.symbol_size), + mSymbolPos(p.symbol_pos) { mPriority = LLViewerFetchedTexture::BOOST_ICON; LLRect rect = p.rect; - mDrawWidth = llmax(32, rect.getWidth()) ; - mDrawHeight = llmax(32, rect.getHeight()) ; - - static LLUICachedControl<S32> llavatariconctrl_symbol_hpad("UIAvatariconctrlSymbolHPad", 2); - static LLUICachedControl<S32> llavatariconctrl_symbol_vpad("UIAvatariconctrlSymbolVPad", 2); - static LLUICachedControl<S32> llavatariconctrl_symbol_size("UIAvatariconctrlSymbolSize", 5); - static LLUICachedControl<std::string> llavatariconctrl_symbol_pos("UIAvatariconctrlSymbolPosition", "BottomRight"); // BottomRight is the default position - S32 left = rect.getWidth() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_hpad; - S32 bottom = llavatariconctrl_symbol_vpad; + S32 left = rect.getWidth() - mSymbolSize - mSymbolHpad; + S32 bottom = mSymbolVpad; - if ("BottomLeft" == (std::string)llavatariconctrl_symbol_pos) + switch(mSymbolPos) + { + case LLAvatarIconCtrlEnums::BOTTOM_LEFT: { - left = llavatariconctrl_symbol_hpad; - bottom = llavatariconctrl_symbol_vpad; + left = mSymbolHpad; + bottom = mSymbolVpad; } - else if ("TopLeft" == (std::string)llavatariconctrl_symbol_pos) + + case LLAvatarIconCtrlEnums::TOP_LEFT: { - left = llavatariconctrl_symbol_hpad; - bottom = rect.getHeight() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_vpad; + left = mSymbolHpad; + bottom = rect.getHeight() - mSymbolSize - mSymbolVpad; } - else if ("TopRight" == (std::string)llavatariconctrl_symbol_pos) + + case LLAvatarIconCtrlEnums::TOP_RIGHT: { - left = rect.getWidth() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_hpad; - bottom = rect.getHeight() - llavatariconctrl_symbol_size - llavatariconctrl_symbol_vpad; + left = rect.getWidth() - mSymbolSize - mSymbolHpad; + bottom = rect.getHeight() - mSymbolSize - mSymbolVpad; } - rect.setOriginAndSize(left, bottom, llavatariconctrl_symbol_size, llavatariconctrl_symbol_size); + case LLAvatarIconCtrlEnums::BOTTOM_RIGHT: + // fallthrough, is default + default: + rect.setOriginAndSize(left, bottom, mSymbolSize, mSymbolSize); + } if (p.avatar_id.isProvided()) { diff --git a/indra/newview/llavatariconctrl.h b/indra/newview/llavatariconctrl.h index 4929efb7d0300de292415b692026a8fa360e9056..5b5720f4ac8fd74887b723c5feefe9d36e940ae8 100755 --- a/indra/newview/llavatariconctrl.h +++ b/indra/newview/llavatariconctrl.h @@ -29,7 +29,7 @@ #include <boost/signals2.hpp> -#include "../llui/lliconctrl.h" +#include "lliconctrl.h" #include "llavatarpropertiesprocessor.h" #include "llviewermenu.h" @@ -41,14 +41,14 @@ class LLAvatarIconIDCache: public LLSingleton<LLAvatarIconIDCache> struct LLAvatarIconIDCacheItem { LLUUID icon_id; - LLDate cached_time; + LLDate cached_time; bool expired(); }; - LLAvatarIconIDCache():mFilename("avatar_icons_cache.txt") - { - } + LLAvatarIconIDCache() + : mFilename("avatar_icons_cache.txt") + {} void load (); void save (); @@ -64,15 +64,41 @@ class LLAvatarIconIDCache: public LLSingleton<LLAvatarIconIDCache> std::map<LLUUID,LLAvatarIconIDCacheItem> mCache;//we cache only LLUID and time }; +namespace LLAvatarIconCtrlEnums +{ + enum ESymbolPos + { + BOTTOM_LEFT, + BOTTOM_RIGHT, + TOP_LEFT, + TOP_RIGHT + }; +} + + +namespace LLInitParam +{ + template<> + struct TypeValues<LLAvatarIconCtrlEnums::ESymbolPos> : public TypeValuesHelper<LLAvatarIconCtrlEnums::ESymbolPos> + { + static void declareValues(); + }; +} + class LLAvatarIconCtrl : public LLIconCtrl, public LLAvatarPropertiesObserver { public: struct Params : public LLInitParam::Block<Params, LLIconCtrl::Params> { - Optional <LLUUID> avatar_id; - Optional <bool> draw_tooltip; - Optional <std::string> default_icon_name; + Optional<LLUUID> avatar_id; + Optional<bool> draw_tooltip; + Optional<std::string> default_icon_name; + Optional<S32> symbol_hpad, + symbol_vpad, + symbol_size; + Optional<LLAvatarIconCtrlEnums::ESymbolPos> symbol_pos; + Params(); }; @@ -98,6 +124,10 @@ class LLAvatarIconCtrl std::string mFullName; bool mDrawTooltip; std::string mDefaultIconName; + S32 mSymbolHpad, + mSymbolVpad, + mSymbolSize; + LLAvatarIconCtrlEnums::ESymbolPos mSymbolPos; bool updateFromCache(); diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 9f02f301a187390dad5879bda3fe83e64e750fca..8846d1317d1e173a469be467b3a4502c4e3ab7b7 100755 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -586,7 +586,7 @@ bool LLAvatarItemComparator::compare(const LLPanel* item1, const LLPanel* item2) if (!avatar_item1 || !avatar_item2) { - llerror("item1 and item2 cannot be null", 0); + LL_ERRS() << "item1 and item2 cannot be null" << LL_ENDL; return true; } diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 706bc42ea07cac99f442f40438bfd7fa9bd58e31..856eb3414ed998d27be6f2b95a850ecd59057b75 100755 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -36,7 +36,6 @@ #include "llstartup.h" // Linden library includes -#include "llavatarconstants.h" // AVATAR_TRANSACTED, etc. #include "lldate.h" #include "lltrans.h" #include "llui.h" // LLUI::getLanguage() @@ -171,11 +170,11 @@ void LLAvatarPropertiesProcessor::sendAvatarPropertiesUpdate(const LLAvatarData* { if (!gAgent.isInitialized() || (gAgent.getID() == LLUUID::null)) { - llwarns << "Sending avatarinfo update DENIED - invalid agent" << llendl; + LL_WARNS() << "Sending avatarinfo update DENIED - invalid agent" << LL_ENDL; return; } - llinfos << "Sending avatarinfo update" << llendl; + LL_INFOS() << "Sending avatarinfo update" << LL_ENDL; // This value is required by sendAvatarPropertiesUpdate method. //A profile should never be mature. (From the original code) diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index fdb88a41a11b760d50c53d0d17281c1b235d79ef..1dcd2c9b907b674a1f80d1f442914d408bba0e9c 100755 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -33,6 +33,14 @@ #include <list> #include <map> +// For Flags in AvatarPropertiesReply +const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not +const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature" +const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info +const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info +const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known. +const U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified + /* *TODO Vadim: This needs some refactoring: - Remove EAvatarProcessorType in favor of separate observers, derived from a common parent (to get rid of void*). diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index d6a72b0c05d72bb6f78e3d7483db502dd3495e53..38e153137c99c9fe27a64482021d597619e5f2ac 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -70,18 +70,18 @@ class LLAvatarRenderInfoGetResponder : public LLHTTPClient::Responder LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { - llwarns << "HTTP error result for avatar weight GET: " << statusNum + LL_WARNS() << "HTTP error result for avatar weight GET: " << statusNum << ", " << reason << " returned by region " << regionp->getName() - << llendl; + << LL_ENDL; } else { - llwarns << "Avatar render weight GET error recieved but region not found for " + LL_WARNS() << "Avatar render weight GET error recieved but region not found for " << mRegionHandle << ", error " << statusNum << ", " << reason - << llendl; + << LL_ENDL; } } @@ -93,7 +93,7 @@ class LLAvatarRenderInfoGetResponder : public LLHTTPClient::Responder { if (LLAvatarRenderInfoAccountant::logRenderInfo()) { - llinfos << "LRI: Result for avatar weights request for region " << regionp->getName() << ":" << llendl; + LL_INFOS() << "LRI: Result for avatar weights request for region " << regionp->getName() << ":" << LL_ENDL; } if (content.isMap()) @@ -116,8 +116,8 @@ class LLAvatarRenderInfoGetResponder : public LLHTTPClient::Responder if (LLAvatarRenderInfoAccountant::logRenderInfo()) { - llinfos << "LRI: Agent " << target_agent_id - << ": " << agent_info_map << llendl; + LL_INFOS() << "LRI: Agent " << target_agent_id + << ": " << agent_info_map << LL_ENDL; } if (agent_info_map.has(KEY_WEIGHT)) @@ -132,18 +132,18 @@ class LLAvatarRenderInfoGetResponder : public LLHTTPClient::Responder else if (content.has(KEY_ERROR)) { const LLSD & error = content[KEY_ERROR]; - llwarns << "Avatar render info GET error: " + LL_WARNS() << "Avatar render info GET error: " << error[KEY_IDENTIFIER] << ": " << error[KEY_MESSAGE] << " from region " << regionp->getName() - << llendl; + << LL_ENDL; } } } else { - llinfos << "Avatar render weight info recieved but region not found for " - << mRegionHandle << llendl; + LL_INFOS() << "Avatar render weight info recieved but region not found for " + << mRegionHandle << LL_ENDL; } } @@ -165,18 +165,18 @@ class LLAvatarRenderInfoPostResponder : public LLHTTPClient::Responder LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { - llwarns << "HTTP error result for avatar weight POST: " << statusNum + LL_WARNS() << "HTTP error result for avatar weight POST: " << statusNum << ", " << reason << " returned by region " << regionp->getName() - << llendl; + << LL_ENDL; } else { - llwarns << "Avatar render weight POST error recieved but region not found for " + LL_WARNS() << "Avatar render weight POST error recieved but region not found for " << mRegionHandle << ", error " << statusNum << ", " << reason - << llendl; + << LL_ENDL; } } @@ -187,8 +187,8 @@ class LLAvatarRenderInfoPostResponder : public LLHTTPClient::Responder { if (LLAvatarRenderInfoAccountant::logRenderInfo()) { - llinfos << "LRI: Result for avatar weights POST for region " << regionp->getName() - << ": " << content << llendl; + LL_INFOS() << "LRI: Result for avatar weights POST for region " << regionp->getName() + << ": " << content << LL_ENDL; } if (content.isMap()) @@ -196,18 +196,18 @@ class LLAvatarRenderInfoPostResponder : public LLHTTPClient::Responder if (content.has(KEY_ERROR)) { const LLSD & error = content[KEY_ERROR]; - llwarns << "Avatar render info POST error: " + LL_WARNS() << "Avatar render info POST error: " << error[KEY_IDENTIFIER] << ": " << error[KEY_MESSAGE] << " from region " << regionp->getName() - << llendl; + << LL_ENDL; } } } else { - llinfos << "Avatar render weight POST result recieved but region not found for " - << mRegionHandle << llendl; + LL_INFOS() << "Avatar render weight POST result recieved but region not found for " + << mRegionHandle << LL_ENDL; } } @@ -225,10 +225,10 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio { if (logRenderInfo()) { - llinfos << "LRI: Sending avatar render info to region " + LL_INFOS() << "LRI: Sending avatar render info to region " << regionp->getName() << " from " << url - << llendl; + << LL_ENDL; } // Build the render info to POST to the region @@ -254,11 +254,11 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio if (logRenderInfo()) { - llinfos << "LRI: Sending avatar render info for " << avatar->getID() - << ": " << info << llendl; - llinfos << "LRI: other info geometry " << avatar->getAttachmentGeometryBytes() + LL_INFOS() << "LRI: Sending avatar render info for " << avatar->getID() + << ": " << info << LL_ENDL; + LL_INFOS() << "LRI: other info geometry " << avatar->getAttachmentGeometryBytes() << ", area " << avatar->getAttachmentSurfaceArea() - << llendl; + << LL_ENDL; } } } @@ -285,10 +285,10 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi { if (logRenderInfo()) { - llinfos << "LRI: Requesting avatar render info for region " + LL_INFOS() << "LRI: Requesting avatar render info for region " << regionp->getName() << " from " << url - << llendl; + << LL_ENDL; } // First send a request to get the latest data @@ -310,8 +310,8 @@ void LLAvatarRenderInfoAccountant::idle() if (logRenderInfo()) { - llinfos << "LRI: Scanning all regions and checking for render info updates" - << llendl; + LL_INFOS() << "LRI: Scanning all regions and checking for render info updates" + << LL_ENDL; } // Check all regions and see if it's time to fetch/send data @@ -375,9 +375,9 @@ void LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer(const LLUUID& reg { if (logRenderInfo()) { - llinfos << "LRI: Viewer has new region capabilities, clearing global render info timer" + LL_INFOS() << "LRI: Viewer has new region capabilities, clearing global render info timer" << " and timer for region " << region_id - << llendl; + << LL_ENDL; } // Reset the global timer so it will scan regions immediately diff --git a/indra/newview/llblocklist.cpp b/indra/newview/llblocklist.cpp index 3849fbeb54b33fd0344b8827518ec1c7077286c7..1c68fabf8b9bbd41fac76ff8fd2d6cbbbb6328b4 100755 --- a/indra/newview/llblocklist.cpp +++ b/indra/newview/llblocklist.cpp @@ -324,7 +324,7 @@ bool LLBlockListItemComparator::compare(const LLPanel* item1, const LLPanel* ite if (!blocked_item1 || !blocked_item2) { - llerror("blocked_item1 and blocked_item2 cannot be null", 0); + LL_ERRS() << "blocked_item1 and blocked_item2 cannot be null" << LL_ENDL; return true; } diff --git a/indra/newview/llbuycurrencyhtml.cpp b/indra/newview/llbuycurrencyhtml.cpp index 459123a5d8b162b9c65f15fac4bd21d69417ac76..1c69dadb1227041179d32bffe0b6ec6fd4999f5f 100755 --- a/indra/newview/llbuycurrencyhtml.cpp +++ b/indra/newview/llbuycurrencyhtml.cpp @@ -148,7 +148,7 @@ void LLBuyCurrencyHTML::showDialog( bool specific_sum_requested, const std::stri } else { - llwarns << "Buy Currency (HTML) Floater not found" << llendl; + LL_WARNS() << "Buy Currency (HTML) Floater not found" << LL_ENDL; }; } diff --git a/indra/newview/llcallbacklist.cpp b/indra/newview/llcallbacklist.cpp index 79ec43dfe920278d25a72c4151921a32a904974c..59ecbdd0eafe8be7fa9b65f96186365ce553f904 100755 --- a/indra/newview/llcallbacklist.cpp +++ b/indra/newview/llcallbacklist.cpp @@ -56,7 +56,7 @@ void LLCallbackList::addFunction( callback_t func, void *data) { if (!func) { - llerrs << "LLCallbackList::addFunction - function is NULL" << llendl; + LL_ERRS() << "LLCallbackList::addFunction - function is NULL" << LL_ENDL; return; } @@ -234,14 +234,14 @@ void doPeriodically(bool_func_t callable, F32 seconds) void test1(void *data) { S32 *s32_data = (S32 *)data; - llinfos << "testfunc1 " << *s32_data << llendl; + LL_INFOS() << "testfunc1 " << *s32_data << LL_ENDL; } void test2(void *data) { S32 *s32_data = (S32 *)data; - llinfos << "testfunc2 " << *s32_data << llendl; + LL_INFOS() << "testfunc2 " << *s32_data << LL_ENDL; } @@ -252,54 +252,54 @@ LLCallbackList::test() S32 b = 2; LLCallbackList *list = new LLCallbackList; - llinfos << "Testing LLCallbackList" << llendl; + LL_INFOS() << "Testing LLCallbackList" << LL_ENDL; if (!list->deleteFunction(NULL)) { - llinfos << "passed 1" << llendl; + LL_INFOS() << "passed 1" << LL_ENDL; } else { - llinfos << "error, removed function from empty list" << llendl; + LL_INFOS() << "error, removed function from empty list" << LL_ENDL; } - // llinfos << "This should crash" << llendl; + // LL_INFOS() << "This should crash" << LL_ENDL; // list->addFunction(NULL); list->addFunction(&test1, &a); list->addFunction(&test1, &a); - llinfos << "Expect: test1 1, test1 1" << llendl; + LL_INFOS() << "Expect: test1 1, test1 1" << LL_ENDL; list->callFunctions(); list->addFunction(&test1, &b); list->addFunction(&test2, &b); - llinfos << "Expect: test1 1, test1 1, test1 2, test2 2" << llendl; + LL_INFOS() << "Expect: test1 1, test1 1, test1 2, test2 2" << LL_ENDL; list->callFunctions(); if (list->deleteFunction(&test1, &b)) { - llinfos << "passed 3" << llendl; + LL_INFOS() << "passed 3" << LL_ENDL; } else { - llinfos << "error removing function" << llendl; + LL_INFOS() << "error removing function" << LL_ENDL; } - llinfos << "Expect: test1 1, test1 1, test2 2" << llendl; + LL_INFOS() << "Expect: test1 1, test1 1, test2 2" << LL_ENDL; list->callFunctions(); list->deleteAllFunctions(); - llinfos << "Expect nothing" << llendl; + LL_INFOS() << "Expect nothing" << LL_ENDL; list->callFunctions(); - llinfos << "nothing :-)" << llendl; + LL_INFOS() << "nothing :-)" << LL_ENDL; delete list; - llinfos << "test complete" << llendl; + LL_INFOS() << "test complete" << LL_ENDL; } #endif // _DEBUG diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 91741c2a775a727f84f9589d9f6227179420f1b5..afbb73ee087200079e9ab352ff2c3fe5a4dda993 100755 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -32,13 +32,10 @@ #include "llcallingcard.h" -#include <vector> #include <algorithm> -//#include <iterator> #include "indra_constants.h" -#include "llavatarnamecache.h" -#include "llcachename.h" +//#include "llcachename.h" #include "llstl.h" #include "lltimer.h" #include "lluuid.h" @@ -46,19 +43,14 @@ #include "llagent.h" #include "llavatarnamecache.h" -#include "llbutton.h" #include "llinventoryobserver.h" #include "llinventorymodel.h" #include "llnotifications.h" -#include "llnotificationsutil.h" -#include "llresmgr.h" #include "llslurl.h" #include "llimview.h" #include "lltrans.h" #include "llviewercontrol.h" -#include "llviewernetwork.h" #include "llviewerobjectlist.h" -#include "llviewerwindow.h" #include "llvoavatar.h" #include "llavataractions.h" @@ -105,8 +97,6 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id, LLAvatarTracker::LLAvatarTracker() : mTrackingData(NULL), mTrackedAgentValid(false), - //mInventory(NULL), - //mInventoryObserver(NULL), mModifyMask(0x0) { } @@ -265,21 +255,21 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds) // IDEVO: is this necessary? name is unused? gCacheName->getFullName(agent_id, full_name); addChangedMask(LLFriendObserver::ADD, agent_id); - lldebugs << "Added buddy " << agent_id + LL_DEBUGS() << "Added buddy " << agent_id << ", " << (mBuddyInfo[agent_id]->isOnline() ? "Online" : "Offline") << ", TO: " << mBuddyInfo[agent_id]->getRightsGrantedTo() << ", FROM: " << mBuddyInfo[agent_id]->getRightsGrantedFrom() - << llendl; + << LL_ENDL; } else { LLRelationship* e_r = (*existing_buddy).second; LLRelationship* n_r = (*itr).second; - llwarns << "!! Add buddy for existing buddy: " << agent_id + LL_WARNS() << "!! Add buddy for existing buddy: " << agent_id << " [" << (e_r->isOnline() ? "Online" : "Offline") << "->" << (n_r->isOnline() ? "Online" : "Offline") << ", " << e_r->getRightsGrantedTo() << "->" << n_r->getRightsGrantedTo() << ", " << e_r->getRightsGrantedTo() << "->" << n_r->getRightsGrantedTo() - << "]" << llendl; + << "]" << LL_ENDL; } } notifyObservers(); @@ -300,7 +290,7 @@ void LLAvatarTracker::copyBuddyList(buddy_map_t& buddies) const void LLAvatarTracker::terminateBuddy(const LLUUID& id) { - lldebugs << "LLAvatarTracker::terminateBuddy()" << llendl; + LL_DEBUGS() << "LLAvatarTracker::terminateBuddy()" << LL_ENDL; LLRelationship* buddy = get_ptr_in_map(mBuddyInfo, id); if(!buddy) return; mBuddyInfo.erase(id); @@ -338,12 +328,12 @@ void LLAvatarTracker::setBuddyOnline(const LLUUID& id, bool is_online) { info->online(is_online); addChangedMask(LLFriendObserver::ONLINE, id); - lldebugs << "Set buddy " << id << (is_online ? " Online" : " Offline") << llendl; + LL_DEBUGS() << "Set buddy " << id << (is_online ? " Online" : " Offline") << LL_ENDL; } else { - llwarns << "!! No buddy info found for " << id - << ", setting to " << (is_online ? "Online" : "Offline") << llendl; + LL_WARNS() << "!! No buddy info found for " << id + << ", setting to " << (is_online ? "Online" : "Offline") << LL_ENDL; } } @@ -390,7 +380,7 @@ void LLAvatarTracker::empower(const LLUUID& id, bool grant) void LLAvatarTracker::empowerList(const buddy_map_t& list, bool grant) { - llwarns << "LLAvatarTracker::empowerList() not implemented." << llendl; + LL_WARNS() << "LLAvatarTracker::empowerList() not implemented." << LL_ENDL; /* LLMessageSystem* msg = gMessageSystem; const char* message_name; @@ -602,14 +592,14 @@ void LLAvatarTracker::agentFound(const LLUUID& prey, // static void LLAvatarTracker::processOnlineNotification(LLMessageSystem* msg, void**) { - lldebugs << "LLAvatarTracker::processOnlineNotification()" << llendl; + LL_DEBUGS() << "LLAvatarTracker::processOnlineNotification()" << LL_ENDL; instance().processNotify(msg, true); } // static void LLAvatarTracker::processOfflineNotification(LLMessageSystem* msg, void**) { - lldebugs << "LLAvatarTracker::processOfflineNotification()" << llendl; + LL_DEBUGS() << "LLAvatarTracker::processOfflineNotification()" << LL_ENDL; instance().processNotify(msg, false); } @@ -643,11 +633,11 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg) payload["from_id"] = agent_id; if(LLRelationship::GRANT_MODIFY_OBJECTS & new_rights) { - LLNotificationsUtil::add("GrantedModifyRights",args, payload); + LLNotifications::instance().add("GrantedModifyRights",args, payload); } else { - LLNotificationsUtil::add("RevokedModifyRights",args, payload); + LLNotifications::instance().add("RevokedModifyRights",args, payload); } } (mBuddyInfo[agent_id])->setRightsFrom(new_rights); @@ -661,7 +651,7 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg) void LLAvatarTracker::processChangeUserRights(LLMessageSystem* msg, void**) { - lldebugs << "LLAvatarTracker::processChangeUserRights()" << llendl; + LL_DEBUGS() << "LLAvatarTracker::processChangeUserRights()" << LL_ENDL; instance().processChange(msg); } @@ -670,7 +660,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) S32 count = msg->getNumberOfBlocksFast(_PREHASH_AgentBlock); BOOL chat_notify = gSavedSettings.getBOOL("ChatOnlineNotification"); - lldebugs << "Received " << count << " online notifications **** " << llendl; + LL_DEBUGS() << "Received " << count << " online notifications **** " << LL_ENDL; if(count > 0) { LLUUID agent_id; @@ -692,8 +682,8 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) } else { - llwarns << "Received online notification for unknown buddy: " - << agent_id << " is " << (online ? "ONLINE" : "OFFLINE") << llendl; + LL_WARNS() << "Received online notification for unknown buddy: " + << agent_id << " is " << (online ? "ONLINE" : "OFFLINE") << LL_ENDL; } if(tracking_id == agent_id) @@ -731,7 +721,7 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id, if (online) { notification = - LLNotificationsUtil::add("FriendOnlineOffline", + LLNotifications::instance().add("FriendOnlineOffline", args, payload.with("respond_on_mousedown", TRUE), boost::bind(&LLAvatarActions::startIM, agent_id)); @@ -739,7 +729,7 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id, else { notification = - LLNotificationsUtil::add("FriendOnlineOffline", args, payload); + LLNotifications::instance().add("FriendOnlineOffline", args, payload); } // If there's an open IM session with this agent, send a notification there too. @@ -805,8 +795,8 @@ void LLTrackingData::agentFound(const LLUUID& prey, { if(prey != mAvatarID) { - llwarns << "LLTrackingData::agentFound() - found " << prey - << " but looking for " << mAvatarID << llendl; + LL_WARNS() << "LLTrackingData::agentFound() - found " << prey + << " but looking for " << mAvatarID << LL_ENDL; } mHaveInfo = true; mAgentGone.setTimerExpirySec(OFFLINE_SECONDS); diff --git a/indra/newview/llcaphttpsender.cpp b/indra/newview/llcaphttpsender.cpp index 16bb48da9313106a2a644fe1867161f8502435fc..b2524d14f8fa26793e1d7a3857b31a8c2e856f6c 100755 --- a/indra/newview/llcaphttpsender.cpp +++ b/indra/newview/llcaphttpsender.cpp @@ -40,8 +40,8 @@ void LLCapHTTPSender::send(const LLHost& host, const std::string& message, const LLSD& body, LLHTTPClient::ResponderPtr response) const { - llinfos << "LLCapHTTPSender::send: message " << message - << " to host " << host << llendl; + LL_INFOS() << "LLCapHTTPSender::send: message " << message + << " to host " << host << LL_ENDL; LLSD llsd; llsd["message"] = message; llsd["body"] = body; diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp index 8b2d9e639fefb429507f6bbf345ea6f2fd5a21af..b0537a83f16a02630fa12d5a3dd7045749bb32a2 100755 --- a/indra/newview/llchannelmanager.cpp +++ b/indra/newview/llchannelmanager.cpp @@ -50,7 +50,7 @@ LLChannelManager::LLChannelManager() if(!gViewerWindow) { - llerrs << "LLChannelManager::LLChannelManager() - viwer window is not initialized yet" << llendl; + LL_ERRS() << "LLChannelManager::LLChannelManager() - viwer window is not initialized yet" << LL_ENDL; } } @@ -247,7 +247,7 @@ LLNotificationsUI::LLScreenChannel* LLChannelManager::getNotificationScreenChann if (channel == NULL) { - llwarns << "Can't find screen channel by NotificationChannelUUID" << llendl; + LL_WARNS() << "Can't find screen channel by NotificationChannelUUID" << LL_ENDL; llassert(!"Can't find screen channel by NotificationChannelUUID"); } diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index b3bc0ba966dca4760715f539dd433572a80afafd..00fa6dd9798793d036595787ecfdfc65d3520fe0 100755 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -28,7 +28,6 @@ #include "llchatbar.h" -#include "imageids.h" #include "llfontgl.h" #include "llrect.h" #include "llerror.h" @@ -522,10 +521,10 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) } } - //llinfos << "GESTUREDEBUG " << trigger + //LL_INFOS() << "GESTUREDEBUG " << trigger // << " len " << length // << " outlen " << out_str.getLength() - // << llendl; + // << LL_ENDL; } } @@ -589,22 +588,22 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL { if (type == CHAT_TYPE_WHISPER) { - lldebugs << "You whisper " << utf8_text << llendl; + LL_DEBUGS() << "You whisper " << utf8_text << LL_ENDL; gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START); } else if (type == CHAT_TYPE_NORMAL) { - lldebugs << "You say " << utf8_text << llendl; + LL_DEBUGS() << "You say " << utf8_text << LL_ENDL; gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START); } else if (type == CHAT_TYPE_SHOUT) { - lldebugs << "You shout " << utf8_text << llendl; + LL_DEBUGS() << "You shout " << utf8_text << LL_ENDL; gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START); } else { - llinfos << "send_chat_from_viewer() - invalid volume" << llendl; + LL_INFOS() << "send_chat_from_viewer() - invalid volume" << LL_ENDL; return; } } @@ -612,30 +611,12 @@ void LLChatBar::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL { if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP) { - lldebugs << "Channel chat: " << utf8_text << llendl; + LL_DEBUGS() << "Channel chat: " << utf8_text << LL_ENDL; } } send_chat_from_viewer(utf8_out_text, type, channel); } -/* -void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) -{ - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ChatFromViewer); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_ChatData); - msg->addStringFast(_PREHASH_Message, utf8_out_text); - msg->addU8Fast(_PREHASH_Type, type); - msg->addS32("Channel", channel); - - gAgent.sendReliableMessage(); - - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); -} -*/ void LLChatBar::onCommitGesture(LLUICtrl* ctrl) { diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index abeaf958ebab2c29b61b6d9556cbdf68cc5e97e3..05c4181714b5728c8f612db91e19b10b6345aef9 100755 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -839,11 +839,11 @@ void LLChatHistory::clear() mLastFromID = LLUUID::null; } -static LLFastTimer::DeclareTimer FTM_APPEND_MESSAGE("Append Chat Message"); +static LLTrace::BlockTimerStatHandle FTM_APPEND_MESSAGE("Append Chat Message"); void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LLStyle::Params& input_append_params) { - LLFastTimer _(FTM_APPEND_MESSAGE); + LL_RECORD_BLOCK_TIME(FTM_APPEND_MESSAGE); bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean(); bool square_brackets = false; // square brackets necessary for a system messages diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 131aea9da3890ce3ce24df217ab59b9dd5135dcd..b1dce42dfd6e0292a87b94dfbaae6c2583cb52ac 100755 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -192,7 +192,7 @@ void LLNotificationChiclet::createMenu() { if(mContextMenu) { - llwarns << "Menu already exists" << llendl; + LL_WARNS() << "Menu already exists" << LL_ENDL; return; } @@ -379,7 +379,7 @@ bool LLIMChiclet::canCreateMenu() { if(mPopupMenu) { - llwarns << "Menu already exists" << llendl; + LL_WARNS() << "Menu already exists" << LL_ENDL; return false; } if(getSessionId().isNull()) @@ -725,7 +725,7 @@ void LLChicletPanel::setChicletToggleState(const LLUUID& session_id, bool toggle { if(session_id.isNull()) { - llwarns << "Null Session ID" << llendl; + LL_WARNS() << "Null Session ID" << LL_ENDL; } // toggle off all chiclets, except specified diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index efaf03384ae3d186887c4b1eb6f29d60c6a83b5f..d5e3a55fdf61af1d296daf373736cf7db87abd8d 100755 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -825,13 +825,13 @@ T* LLChicletPanel::createChiclet(const LLUUID& session_id, S32 index) T* chiclet = LLUICtrlFactory::create<T>(params); if(!chiclet) { - llwarns << "Could not create chiclet" << llendl; + LL_WARNS() << "Could not create chiclet" << LL_ENDL; return NULL; } if(!addChiclet(chiclet, index)) { delete chiclet; - llwarns << "Could not add chiclet to chiclet panel" << llendl; + LL_WARNS() << "Could not add chiclet to chiclet panel" << LL_ENDL; return NULL; } @@ -871,7 +871,7 @@ T* LLChicletPanel::findChiclet(const LLUUID& im_session_id) T* result = dynamic_cast<T*>(chiclet); if(!result) { - llwarns << "Found chiclet but of wrong type " << llendl; + LL_WARNS() << "Found chiclet but of wrong type " << LL_ENDL; continue; } return result; @@ -891,7 +891,7 @@ template<class T> T* LLChicletPanel::getChiclet(S32 index) T*result = dynamic_cast<T*>(chiclet); if(!result && chiclet) { - llwarns << "Found chiclet but of wrong type " << llendl; + LL_WARNS() << "Found chiclet but of wrong type " << LL_ENDL; } return result; } diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp index a51c844775e0e8a1f51d6ffa4cd9ffda629d2e2f..28e367fbe1a964632c3df1d0632ff54ec65fee78 100755 --- a/indra/newview/llchicletbar.cpp +++ b/indra/newview/llchicletbar.cpp @@ -90,16 +90,16 @@ void LLChicletBar::log(LLView* panel, const std::string& descr) void LLChicletBar::reshape(S32 width, S32 height, BOOL called_from_parent) { static S32 debug_calling_number = 0; - lldebugs << "**************************************** " << ++debug_calling_number << llendl; + LL_DEBUGS() << "**************************************** " << ++debug_calling_number << LL_ENDL; S32 current_width = getRect().getWidth(); S32 delta_width = width - current_width; - lldebugs << "Reshaping: " + LL_DEBUGS() << "Reshaping: " << ", width: " << width << ", cur width: " << current_width << ", delta_width: " << delta_width << ", called_from_parent: " << called_from_parent - << llendl; + << LL_ENDL; if (mChicletPanel) log(mChicletPanel, "before"); @@ -155,7 +155,7 @@ void LLChicletBar::reshape(S32 width, S32 height, BOOL called_from_parent) if (should_be_reshaped) { - lldebugs << "Reshape all children with width: " << width << llendl; + LL_DEBUGS() << "Reshape all children with width: " << width << LL_ENDL; LLPanel::reshape(width, height, called_from_parent); } @@ -174,23 +174,23 @@ S32 LLChicletBar::processWidthDecreased(S32 delta_width) // we have some space to decrease chiclet panel S32 shrink_by = llmin(-delta_width, chiclet_panel_shrink_headroom); - lldebugs << "delta_width: " << delta_width + LL_DEBUGS() << "delta_width: " << delta_width << ", panel_delta_min: " << chiclet_panel_shrink_headroom << ", shrink_by: " << shrink_by - << llendl; + << LL_ENDL; // is chiclet panel wide enough to process resizing? delta_width += chiclet_panel_shrink_headroom; still_should_be_processed = delta_width < 0; - lldebugs << "Shrinking chiclet panel by " << shrink_by << " px" << llendl; + LL_DEBUGS() << "Shrinking chiclet panel by " << shrink_by << " px" << LL_ENDL; mChicletPanel->getParent()->reshape(mChicletPanel->getParent()->getRect().getWidth() - shrink_by, mChicletPanel->getParent()->getRect().getHeight()); log(mChicletPanel, "after processing panel decreasing via chiclet panel"); - lldebugs << "RS_CHICLET_PANEL" + LL_DEBUGS() << "RS_CHICLET_PANEL" << ", delta_width: " << delta_width - << llendl; + << LL_ENDL; } S32 extra_shrink_width = 0; @@ -198,8 +198,8 @@ S32 LLChicletBar::processWidthDecreased(S32 delta_width) if (still_should_be_processed) { extra_shrink_width = -delta_width; - llwarns << "There is no enough width to reshape all children: " - << extra_shrink_width << llendl; + LL_WARNS() << "There is no enough width to reshape all children: " + << extra_shrink_width << LL_ENDL; } return extra_shrink_width; diff --git a/indra/newview/llclassifiedstatsresponder.cpp b/indra/newview/llclassifiedstatsresponder.cpp index e3cd83e174211bc4bcd997285adf96c93fedf899..bc7815fba23682d026ee683f76f1d134a6b7302c 100755 --- a/indra/newview/llclassifiedstatsresponder.cpp +++ b/indra/newview/llclassifiedstatsresponder.cpp @@ -38,10 +38,8 @@ #include "message.h" LLClassifiedStatsResponder::LLClassifiedStatsResponder(LLUUID classified_id) -: -mClassifiedID(classified_id) -{ -} +: mClassifiedID(classified_id) +{} /*virtual*/ void LLClassifiedStatsResponder::result(const LLSD& content) @@ -53,16 +51,15 @@ void LLClassifiedStatsResponder::result(const LLSD& content) S32 search_map = content["search_map_clicks"].asInteger(); S32 search_profile = content["search_profile_clicks"].asInteger(); - LLPanelClassifiedInfo::setClickThrough( - mClassifiedID, - teleport + search_teleport, - map + search_map, - profile + search_profile, - true); + LLPanelClassifiedInfo::setClickThrough( mClassifiedID, + teleport + search_teleport, + map + search_map, + profile + search_profile, + true); } /*virtual*/ void LLClassifiedStatsResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llinfos << "LLClassifiedStatsResponder::error [status:" << status << "]: " << content << llendl; + LL_INFOS() << "LLClassifiedStatsResponder::error [status:" << status << "]: " << content << LL_ENDL; } diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index e200e0ee9ed8e4fe8caf8bea674163adcd9d8025..8ce5aca9094b804a9dbf515b20c0281d0c9d6852 100755 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -382,14 +382,14 @@ void LLCOFWearables::refresh() const LLUUID cof_id = LLAppearanceMgr::instance().getCOF(); if (cof_id.isNull()) { - llwarns << "COF ID cannot be NULL" << llendl; + LL_WARNS() << "COF ID cannot be NULL" << LL_ENDL; return; } LLViewerInventoryCategory* catp = gInventory.getCategory(cof_id); if (!catp) { - llwarns << "COF category cannot be NULL" << llendl; + LL_WARNS() << "COF category cannot be NULL" << LL_ENDL; return; } @@ -477,7 +477,7 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel { for (U32 i = 0; i < cof_items.size(); ++i) { - LLViewerInventoryItem* item = cof_items.get(i); + LLViewerInventoryItem* item = cof_items.at(i); if (!item) continue; const LLAssetType::EType item_type = item->getType(); diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index f1f7da5fd1f7f5865b5330578588c4fee9129656..a03178adf62cab76d674bae981c42f72361976d7 100755 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -37,13 +37,11 @@ #include "llui.h" #include "llrender.h" #include "lluiconstants.h" -#include "llviewercontrol.h" #include "llbutton.h" -#include "lltextbox.h" #include "llfloatercolorpicker.h" #include "llviewborder.h" -#include "llviewertexturelist.h" #include "llfocusmgr.h" +#include "lltextbox.h" static LLDefaultChildRegistry::Register<LLColorSwatchCtrl> r("color_swatch"); @@ -239,16 +237,9 @@ void LLColorSwatchCtrl::draw() } else { - if (!mFallbackImageName.empty()) + if (mFallbackImage.notNull()) { - LLPointer<LLViewerFetchedTexture> fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName, FTT_LOCAL_FILE, TRUE, - LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - if( fallback_image->getComponents() == 4 ) - { - gl_rect_2d_checkerboard( interior ); - } - gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), fallback_image, LLColor4::white % alpha); - fallback_image->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); + mFallbackImage->draw(interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), LLColor4::white % alpha); } else { diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h index 5bdd1712d2002cc84166b2643fb5fd9b7057085e..df907567ab8f69839a715a462b49be5bcf2b127a 100755 --- a/indra/newview/llcolorswatch.h +++ b/indra/newview/llcolorswatch.h @@ -30,16 +30,13 @@ #include "lluictrl.h" #include "v4color.h" #include "llfloater.h" -#include "llviewertexture.h" #include "lltextbox.h" // // Classes // class LLColor4; -class LLTextBox; class LLFloaterColorPicker; -class LLViewerTexture; class LLColorSwatchCtrl : public LLUICtrl @@ -87,7 +84,7 @@ class LLColorSwatchCtrl void setCanApplyImmediately(BOOL apply) { mCanApplyImmediately = apply; } void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; } void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; } - void setFallbackImageName(const std::string& name) { mFallbackImageName = name; } + void setFallbackImage(LLPointer<LLUIImage> image) { mFallbackImage = image; } void showPicker(BOOL take_focus); @@ -103,20 +100,20 @@ class LLColorSwatchCtrl void closeFloaterColorPicker(); protected: - BOOL mValid; - LLColor4 mColor; - LLUIColor mBorderColor; - LLTextBox* mCaption; - LLHandle<LLFloater> mPickerHandle; - LLViewBorder* mBorder; - BOOL mCanApplyImmediately; - commit_callback_t mOnCancelCallback; - commit_callback_t mOnSelectCallback; - S32 mLabelWidth; - S32 mLabelHeight; + bool mValid; + LLColor4 mColor; + LLUIColor mBorderColor; + LLTextBox* mCaption; + LLHandle<LLFloater> mPickerHandle; + class LLViewBorder* mBorder; + bool mCanApplyImmediately; + commit_callback_t mOnCancelCallback, + mOnSelectCallback; + S32 mLabelWidth, + mLabelHeight; LLPointer<LLUIImage> mAlphaGradientImage; - std::string mFallbackImageName; + LLPointer<LLUIImage> mFallbackImage; }; #endif // LL_LLBUTTON_H diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp index a6384ded1251b67fc48578b3c5978de0553c6352..06164e9597d90ede06815c8892dd3bccddd72bbf 100755 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -302,13 +302,13 @@ bool LLCommandLineParser::parseAndStoreResults(po::command_line_parser& clp) } catch(po::error& e) { - llwarns << "Caught Error:" << e.what() << llendl; + LL_WARNS() << "Caught Error:" << e.what() << LL_ENDL; mErrorMsg = e.what(); return false; } catch(LLCLPError& e) { - llwarns << "Caught Error:" << e.what() << llendl; + LL_WARNS() << "Caught Error:" << e.what() << LL_ENDL; mErrorMsg = e.what(); return false; } @@ -348,7 +348,7 @@ bool LLCommandLineParser::parseAndStoreResults(po::command_line_parser& clp) << last_option << " " << last_value; - llwarns << msg.str() << llendl; + LL_WARNS() << msg.str() << LL_ENDL; mErrorMsg = msg.str(); return false; } @@ -412,7 +412,7 @@ bool LLCommandLineParser::notify() } catch (const LLCLPError& e) { - llwarns << "Caught Error: " << e.what() << llendl; + LL_WARNS() << "Caught Error: " << e.what() << LL_ENDL; mErrorMsg = e.what(); return false; } @@ -430,7 +430,7 @@ void LLCommandLineParser::printOptions() const { oss << t_itr->c_str() << " "; } - llinfos << oss.str() << llendl; + LL_INFOS() << oss.str() << LL_ENDL; } } @@ -470,8 +470,8 @@ onevalue(const std::string& option, } else if (value.size() > 1) { - llwarns << "Ignoring extra tokens specified for --" - << option << "." << llendl; + LL_WARNS() << "Ignoring extra tokens specified for --" + << option << "." << LL_ENDL; } return value[0]; } @@ -609,8 +609,8 @@ void setControlValueCB(const LLCommandLineParser::token_vector_t& value, // This isn't anything a user can affect -- it's a misconfiguration on // the part of the coder. Rub the coder's nose in the problem right // away so even preliminary testing will surface it. - llerrs << "Command Line option --" << option - << " maps to unknown setting!" << llendl; + LL_ERRS() << "Command Line option --" << option + << " maps to unknown setting!" << LL_ENDL; } } } // anonymous namespace @@ -681,8 +681,8 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG std::set<std::string>::const_iterator found = unmapped_options.find(long_name); if (found == unmapped_options.end()) { - llerrs << "New command-line option " << long_name - << " should map-to a variable in settings.xml" << llendl; + LL_ERRS() << "New command-line option " << long_name + << " should map-to a variable in settings.xml" << LL_ENDL; } } else // option specifies map-to @@ -690,15 +690,15 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG std::string controlName = option_params["map-to"].asString(); if (! controlGroup) { - llerrs << "Must pass gSavedSettings to LLControlGroupCLP::configure() for " - << long_name << " (map-to " << controlName << ")" << llendl; + LL_ERRS() << "Must pass gSavedSettings to LLControlGroupCLP::configure() for " + << long_name << " (map-to " << controlName << ")" << LL_ENDL; } LLControlVariable* ctrl = controlGroup->getControl(controlName); if (! ctrl) { - llerrs << "Option " << long_name << " specifies map-to " << controlName - << " which does not exist" << llendl; + LL_ERRS() << "Option " << long_name << " specifies map-to " << controlName + << " which does not exist" << LL_ENDL; } callback = boost::bind(setControlValueCB, _1, long_name, ctrl); diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 458842447459c0a2391e6a1d21654a5e88aa87a3..b0916d769a835caa57b8fcaa54f803e6670ed7c3 100755 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -45,7 +45,6 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" -#include "lscript_rt_interface.h" #include "llviewercontrol.h" #include "llviewerobject.h" #include "llviewerregion.h" @@ -112,8 +111,8 @@ void LLFloaterScriptQueue::inventoryChanged(LLViewerObject* viewer_object, S32, void* q_id) { - llinfos << "LLFloaterScriptQueue::inventoryChanged() for object " - << viewer_object->getID() << llendl; + LL_INFOS() << "LLFloaterScriptQueue::inventoryChanged() for object " + << viewer_object->getID() << LL_ENDL; //Remove this listener from the object since its //listener callback is now being executed. @@ -138,8 +137,8 @@ void LLFloaterScriptQueue::inventoryChanged(LLViewerObject* viewer_object, // something went wrong... // note that we're not working on this one, and move onto the // next object in the list. - llwarns << "No inventory for " << mCurrentObjectID - << llendl; + LL_WARNS() << "No inventory for " << mCurrentObjectID + << LL_ENDL; nextObject(); } } @@ -154,7 +153,7 @@ void LLFloaterScriptQueue::onCloseBtn(void* user_data) void LLFloaterScriptQueue::addObject(const LLUUID& id) { - mObjectIDs.put(id); + mObjectIDs.push_back(id); } BOOL LLFloaterScriptQueue::start() @@ -163,7 +162,7 @@ BOOL LLFloaterScriptQueue::start() LLStringUtil::format_map_t args; args["[START]"] = mStartString; - args["[COUNT]"] = llformat ("%d", mObjectIDs.count()); + args["[COUNT]"] = llformat ("%d", mObjectIDs.size()); buffer = getString ("Starting", args); getChild<LLScrollListCtrl>("queue output")->addSimpleElement(buffer, ADD_BOTTOM); @@ -173,29 +172,29 @@ BOOL LLFloaterScriptQueue::start() BOOL LLFloaterScriptQueue::isDone() const { - return (mCurrentObjectID.isNull() && (mObjectIDs.count() == 0)); + return (mCurrentObjectID.isNull() && (mObjectIDs.size() == 0)); } // go to the next object. If no objects left, it falls out silently // and waits to be killed by the window being closed. BOOL LLFloaterScriptQueue::nextObject() { - S32 count; + U32 count; BOOL successful_start = FALSE; do { - count = mObjectIDs.count(); - llinfos << "LLFloaterScriptQueue::nextObject() - " << count - << " objects left to process." << llendl; + count = mObjectIDs.size(); + LL_INFOS() << "LLFloaterScriptQueue::nextObject() - " << count + << " objects left to process." << LL_ENDL; mCurrentObjectID.setNull(); if(count > 0) { successful_start = popNext(); } - llinfos << "LLFloaterScriptQueue::nextObject() " + LL_INFOS() << "LLFloaterScriptQueue::nextObject() " << (successful_start ? "successful" : "unsuccessful") - << llendl; - } while((mObjectIDs.count() > 0) && !successful_start); + << LL_ENDL; + } while((mObjectIDs.size() > 0) && !successful_start); if(isDone() && !mDone) { mDone = true; @@ -212,18 +211,18 @@ BOOL LLFloaterScriptQueue::popNext() // get the first element off of the container, and attempt to get // the inventory. BOOL rv = FALSE; - S32 count = mObjectIDs.count(); + S32 count = mObjectIDs.size(); if(mCurrentObjectID.isNull() && (count > 0)) { - mCurrentObjectID = mObjectIDs.get(0); - llinfos << "LLFloaterScriptQueue::popNext() - mCurrentID: " - << mCurrentObjectID << llendl; - mObjectIDs.remove(0); + mCurrentObjectID = mObjectIDs.at(0); + LL_INFOS() << "LLFloaterScriptQueue::popNext() - mCurrentID: " + << mCurrentObjectID << LL_ENDL; + mObjectIDs.erase(mObjectIDs.begin()); LLViewerObject* obj = gObjectList.findObject(mCurrentObjectID); if(obj) { - llinfos << "LLFloaterScriptQueue::popNext() requesting inv for " - << mCurrentObjectID << llendl; + LL_INFOS() << "LLFloaterScriptQueue::popNext() requesting inv for " + << mCurrentObjectID << LL_ENDL; LLUUID* id = new LLUUID(getKey().asUUID()); registerVOInventoryListener(obj,id); requestVOInventory(); @@ -306,7 +305,7 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, item->getPermissions().allowCopyBy(gAgent.getID(), gAgent.getGroupID()) ) { LLPointer<LLViewerInventoryItem> script = new LLViewerInventoryItem(item); - mCurrentScripts.put(script); + mCurrentScripts.push_back(script); asset_item_map.insert(std::make_pair(item->getAssetUUID(), item)); } } @@ -329,7 +328,7 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object, viewer_object->getID(), itemp->getUUID()); - //llinfos << "ITEM NAME 2: " << names.get(i) << llendl; + //LL_INFOS() << "ITEM NAME 2: " << names.get(i) << LL_ENDL; gAssetStorage->getInvItemAsset(viewer_object->getRegion()->getHost(), gAgent.getID(), gAgent.getSessionID(), @@ -350,7 +349,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { - llinfos << "LLFloaterCompileQueue::scriptArrived()" << llendl; + LL_INFOS() << "LLFloaterCompileQueue::scriptArrived()" << LL_ENDL; LLScriptQueueData* data = (LLScriptQueueData*)user_data; if(!data) { @@ -361,7 +360,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, std::string buffer; if(queue && (0 == status)) { - //llinfos << "ITEM NAME 3: " << data->mScriptName << llendl; + //LL_INFOS() << "ITEM NAME 3: " << data->mScriptName << LL_ENDL; // Dump this into a file on the local disk so we can compile it. std::string filename; @@ -388,44 +387,12 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, } else { - // It's now in the file, now compile it. - buffer = LLTrans::getString("CompileQueueDownloadedCompiling") + (": ") + data->mScriptName; - - // Write script to local file for compilation. - LLFILE *fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ - if (fp) - { - const S32 buf_size = 65536; - U8 copy_buf[buf_size]; - - while (file.read(copy_buf, buf_size)) /*Flawfinder: ignore*/ - { - if (fwrite(copy_buf, file.getLastBytesRead(), 1, fp) < 1) - { - // return a bad file error if we can't write the whole thing - status = LL_ERR_CANNOT_OPEN_FILE; - } - } - - fclose(fp); - } - else - { - llerrs << "Unable to find object to compile" << llendl; - } - - // TODO: babbage: No compile if no cap. - queue->compile(filename, data->mItemId); - - // Delete it after we're done compiling? - LLFile::remove(filename); + buffer = LLTrans::getString("CompileQueueServiceUnavailable") + (": ") + data->mScriptName; } } } else { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { LLSD args; @@ -447,7 +414,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, buffer = LLTrans::getString("CompileQueueUnknownFailure") + (" ") + data->mScriptName; } - llwarns << "Problem downloading script asset." << llendl; + LL_WARNS() << "Problem downloading script asset." << LL_ENDL; if(queue) queue->removeItemByItemID(data->mItemId); } if(queue && (buffer.size() > 0)) @@ -457,138 +424,6 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, delete data; } -// static -void LLFloaterCompileQueue::onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - llinfos << "LLFloaterCompileQueue::onSaveTextComplete()" << llendl; - if (status) - { - llwarns << "Unable to save text for script." << llendl; - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotificationsUtil::add("CompileQueueSaveText", args); - } -} - -// static -void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) -{ - llinfos << "LLFloaterCompileQueue::onSaveBytecodeComplete()" << llendl; - LLCompileQueueData* data = (LLCompileQueueData*)user_data; - LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance<LLFloaterCompileQueue>("compile_queue", data->mQueueID); - if(queue && (0 == status) && data) - { - queue->saveItemByItemID(data->mItemId); - queue->removeItemByItemID(data->mItemId); - } - else - { - llwarns << "Unable to save bytecode for script." << llendl; - LLSD args; - args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); - LLNotificationsUtil::add("CompileQueueSaveBytecode", args); - } - delete data; - data = NULL; -} - -// compile the file given and save it out. -void LLFloaterCompileQueue::compile(const std::string& filename, - const LLUUID& item_id) -{ - LLUUID new_asset_id; - LLTransactionID tid; - tid.generate(); - new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - - std::string uuid_string; - new_asset_id.toString(uuid_string); - std::string dst_filename; - dst_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".lso"; - std::string err_filename; - err_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,uuid_string) + ".out"; - - gAssetStorage->storeAssetData(filename, tid, - LLAssetType::AT_LSL_TEXT, - &onSaveTextComplete, NULL, FALSE); - - const BOOL compile_to_mono = FALSE; - if(!lscript_compile(filename.c_str(), dst_filename.c_str(), - err_filename.c_str(), compile_to_mono, - uuid_string.c_str(), gAgent.isGodlike())) - { - llwarns << "compile failed" << llendl; - removeItemByItemID(item_id); - } - else - { - llinfos << "compile successful." << llendl; - - // Save LSL bytecode - LLCompileQueueData* data = new LLCompileQueueData(getKey().asUUID(), item_id); - gAssetStorage->storeAssetData(dst_filename, new_asset_id, - LLAssetType::AT_LSL_BYTECODE, - &LLFloaterCompileQueue::onSaveBytecodeComplete, - (void*)data, FALSE); - } -} - -void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id) -{ - llinfos << "LLFloaterCompileQueue::removeItemByAssetID()" << llendl; - for(S32 i = 0; i < mCurrentScripts.count(); ) - { - if(asset_id == mCurrentScripts.get(i)->getUUID()) - { - mCurrentScripts.remove(i); - } - else - { - ++i; - } - } - if(mCurrentScripts.count() == 0) - { - nextObject(); - } -} - -const LLInventoryItem* LLFloaterCompileQueue::findItemByItemID(const LLUUID& asset_id) const -{ - LLInventoryItem* result = NULL; - S32 count = mCurrentScripts.count(); - for(S32 i = 0; i < count; ++i) - { - if(asset_id == mCurrentScripts.get(i)->getUUID()) - { - result = mCurrentScripts.get(i); - } - } - return result; -} - -void LLFloaterCompileQueue::saveItemByItemID(const LLUUID& asset_id) -{ - llinfos << "LLFloaterCompileQueue::saveItemByAssetID()" << llendl; - LLViewerObject* viewer_object = gObjectList.findObject(mCurrentObjectID); - if(viewer_object) - { - S32 count = mCurrentScripts.count(); - for(S32 i = 0; i < count; ++i) - { - if(asset_id == mCurrentScripts.get(i)->getUUID()) - { - // *FIX: this auto-resets active to TRUE. That might - // be a bad idea. - viewer_object->saveScript(mCurrentScripts.get(i), TRUE, false); - } - } - } - else - { - llwarns << "Unable to finish save!" << llendl; - } -} ///---------------------------------------------------------------------------- /// Class LLFloaterResetQueue @@ -610,8 +445,7 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. - LLDynamicArray<const char*> names; - + LLInventoryObject::object_list_t::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator end = inv->end(); for ( ; it != end; ++it) @@ -662,8 +496,6 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. - LLDynamicArray<const char*> names; - LLInventoryObject::object_list_t::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator end = inv->end(); for ( ; it != end; ++it) @@ -712,13 +544,31 @@ LLFloaterNotRunQueue::~LLFloaterNotRunQueue() { } +void LLFloaterCompileQueue::removeItemByItemID(const LLUUID& asset_id) +{ + LL_INFOS() << "LLFloaterCompileQueue::removeItemByAssetID()" << LL_ENDL; + for(S32 i = 0; i < mCurrentScripts.size(); ) + { + if(asset_id == mCurrentScripts.at(i)->getUUID()) + { + vector_replace_with_last(mCurrentScripts, mCurrentScripts.begin() + i); + } + else + { + ++i; + } + } + if(mCurrentScripts.empty()) + { + nextObject(); + } +} + void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv) { // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. - LLDynamicArray<const char*> names; - LLInventoryObject::object_list_t::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator end = inv->end(); for ( ; it != end; ++it) diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index 4ddab29d00eba0b62ccfa6c98dbb6cbadaca2c3f..28f4625de87d09bc1347c7adebe5fef440c2c60c 100755 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -27,11 +27,9 @@ #ifndef LL_LLCOMPILEQUEUE_H #define LL_LLCOMPILEQUEUE_H -#include "lldarray.h" #include "llinventory.h" #include "llviewerobject.h" #include "llvoinventorylistener.h" -#include "llmap.h" #include "lluuid.h" #include "llfloater.h" @@ -96,7 +94,7 @@ class LLFloaterScriptQueue : public LLFloater, public LLVOInventoryListener LLButton* mCloseBtn; // Object Queue - LLDynamicArray<LLUUID> mObjectIDs; + std::vector<LLUUID> mObjectIDs; LLUUID mCurrentObjectID; bool mDone; @@ -146,24 +144,6 @@ class LLFloaterCompileQueue : public LLFloaterScriptQueue LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status); - static void onSaveTextComplete(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status); - - static void onSaveBytecodeComplete(const LLUUID& asset_id, - void* user_data, - S32 status, LLExtStat ext_status); - - // compile the file given and save it out. - void compile(const std::string& filename, const LLUUID& asset_id); - - // remove any object in mScriptScripts with the matching uuid. - void removeItemByAssetID(const LLUUID& asset_id); - - // save the items indicated by the item id. - void saveItemByItemID(const LLUUID& item_id); - - // find InventoryItem given item id. - const LLInventoryItem* findItemByItemID(const LLUUID& item_id) const; - protected: LLViewerInventoryItem::item_array_t mCurrentScripts; diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 7883e4cb894c0c4eead6a694be438b2ce0d4e761..05c7e6caa5ddf93287d507b1ed0b6bd2c6f4e180 100755 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -35,23 +35,18 @@ #include <boost/foreach.hpp> #include "boost/lexical_cast.hpp" -const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec - -struct ConversationParams -{ - ConversationParams(time_t time) - : mTime(time), - mTimestamp(LLConversation::createTimestamp(time)) - {} - - time_t mTime; - std::string mTimestamp; - SessionType mConversationType; - std::string mConversationName; - std::string mHistoryFileName; - LLUUID mSessionID; - LLUUID mParticipantID; - bool mHasOfflineIMs; +const S32Days CONVERSATION_LIFETIME = (S32Days)30; // lifetime of LLConversation is 30 days by spec + +struct ConversationParams : public LLInitParam::Block<ConversationParams> +{ + Mandatory<U64Seconds > time; + Mandatory<std::string> timestamp; + Mandatory<SessionType> conversation_type; + Mandatory<std::string> conversation_name, + history_filename; + Mandatory<LLUUID> session_id, + participant_id; + Mandatory<bool> has_offline_ims; }; /************************************************************************/ @@ -59,14 +54,14 @@ struct ConversationParams /************************************************************************/ LLConversation::LLConversation(const ConversationParams& params) -: mTime(params.mTime), - mTimestamp(params.mTimestamp), - mConversationType(params.mConversationType), - mConversationName(params.mConversationName), - mHistoryFileName(params.mHistoryFileName), - mSessionID(params.mSessionID), - mParticipantID(params.mParticipantID), - mHasOfflineIMs(params.mHasOfflineIMs) +: mTime(params.time), + mTimestamp(params.timestamp.isProvided() ? params.timestamp : createTimestamp(params.time)), + mConversationType(params.conversation_type), + mConversationName(params.conversation_name), + mHistoryFileName(params.history_filename), + mSessionID(params.session_id), + mParticipantID(params.participant_id), + mHasOfflineIMs(params.has_offline_ims) { setListenIMFloaterOpened(); } @@ -77,7 +72,7 @@ LLConversation::LLConversation(const LLIMModel::LLIMSession& session) mConversationType(session.mSessionType), mConversationName(session.mName), mHistoryFileName(session.mHistoryFileName), - mSessionID(session.isOutgoingAdHoc() ? session.generateOutgouigAdHocHash() : session.mSessionID), + mSessionID(session.isOutgoingAdHoc() ? session.generateOutgoingAdHocHash() : session.mSessionID), mParticipantID(session.mOtherParticipantID), mHasOfflineIMs(session.mHasOfflineMessage) { @@ -105,7 +100,7 @@ LLConversation::~LLConversation() void LLConversation::updateTimestamp() { - mTime = time_corrected(); + mTime = (U64Seconds)time_corrected(); mTimestamp = createTimestamp(mTime); } @@ -118,11 +113,11 @@ void LLConversation::onIMFloaterShown(const LLUUID& session_id) } // static -const std::string LLConversation::createTimestamp(const time_t& utc_time) +const std::string LLConversation::createTimestamp(const U64Seconds& utc_time) { std::string timeStr; LLSD substitution; - substitution["datetime"] = (S32) utc_time; + substitution["datetime"] = (S32)utc_time.value(); timeStr = "["+LLTrans::getString ("TimeMonth")+"]/[" +LLTrans::getString ("TimeDay")+"]/[" @@ -135,10 +130,10 @@ const std::string LLConversation::createTimestamp(const time_t& utc_time) return timeStr; } -bool LLConversation::isOlderThan(U32 days) const +bool LLConversation::isOlderThan(U32Days days) const { - time_t now = time_corrected(); - U32 age = (U32)((now - mTime) / SEC_PER_DAY); // age of conversation in days + U64Seconds now(time_corrected()); + U32Days age = now - mTime; return age > days; } @@ -318,7 +313,7 @@ LLConversation* LLConversationLog::findConversation(const LLIMModel::LLIMSession { if (session) { - const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgouigAdHocHash() : session->mSessionID; + const LLUUID session_id = session->isOutgoingAdHoc() ? session->generateOutgoingAdHocHash() : session->mSessionID; conversations_vec_t::iterator conv_it = mConversations.begin(); for(; conv_it != mConversations.end(); ++conv_it) @@ -460,14 +455,14 @@ bool LLConversationLog::saveToFile(const std::string& filename) { if (!filename.size()) { - llwarns << "Call log list filename is empty!" << llendl; + LL_WARNS() << "Call log list filename is empty!" << LL_ENDL; return false; } LLFILE* fp = LLFile::fopen(filename, "wb"); if (!fp) { - llwarns << "Couldn't open call log list" << filename << llendl; + LL_WARNS() << "Couldn't open call log list" << filename << LL_ENDL; return false; } @@ -485,7 +480,7 @@ bool LLConversationLog::saveToFile(const std::string& filename) // [1343222639] 2 0 0 Ad-hoc Conference| c3g67c89-c479-4c97-b21d-32869bcfe8rc 68f1c33e-4135-3e3e-a897-8c9b23115c09 Ad-hoc Conference hash597394a0-9982-766d-27b8-c75560213b9a| fprintf(fp, "[%lld] %d %d %d %s| %s %s %s|\n", - (S64)conv_it->getTime(), + (S64)conv_it->getTime().value(), (S32)conv_it->getConversationType(), (S32)0, (S32)conv_it->hasOfflineMessages(), @@ -501,14 +496,14 @@ bool LLConversationLog::loadFromFile(const std::string& filename) { if(!filename.size()) { - llwarns << "Call log list filename is empty!" << llendl; + LL_WARNS() << "Call log list filename is empty!" << LL_ENDL; return false; } LLFILE* fp = LLFile::fopen(filename, "rb"); if (!fp) { - llwarns << "Couldn't open call log list" << filename << llendl; + LL_WARNS() << "Couldn't open call log list" << filename << LL_ENDL; return false; } @@ -539,13 +534,14 @@ bool LLConversationLog::loadFromFile(const std::string& filename) conv_id_buffer, history_file_name); - ConversationParams params((time_t)time); - params.mConversationType = (SessionType)stype; - params.mHasOfflineIMs = has_offline_ims; - params.mConversationName = std::string(conv_name_buffer); - params.mParticipantID = LLUUID(part_id_buffer); - params.mSessionID = LLUUID(conv_id_buffer); - params.mHistoryFileName = std::string(history_file_name); + ConversationParams params; + params.time(LLUnits::Seconds::fromValue(time)) + .conversation_type((SessionType)stype) + .has_offline_ims(has_offline_ims) + .conversation_name(conv_name_buffer) + .participant_id(LLUUID(part_id_buffer)) + .session_id(LLUUID(conv_id_buffer)) + .history_filename(history_file_name); LLConversation conversation(params); diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 265b1f0ef04a0c74b492c2073acc1da315b87612..b38d472156148efca0340db4a494d9a83f46a528 100755 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -55,12 +55,13 @@ class LLConversation const LLUUID& getSessionID() const { return mSessionID; } const LLUUID& getParticipantID() const { return mParticipantID; } const std::string& getTimestamp() const { return mTimestamp; } - const time_t& getTime() const { return mTime; } + const U64Seconds& + getTime() const { return mTime; } bool hasOfflineMessages() const { return mHasOfflineIMs; } void setConversationName(std::string conv_name) { mConversationName = conv_name; } void setOfflineMessages(bool new_messages) { mHasOfflineIMs = new_messages; } - bool isOlderThan(U32 days) const; + bool isOlderThan(U32Days days) const; /* * updates last interaction time @@ -75,7 +76,7 @@ class LLConversation /* * returns string representation(in form of: mm/dd/yyyy hh:mm) of time when conversation was started */ - static const std::string createTimestamp(const time_t& utc_time); + static const std::string createTimestamp(const U64Seconds& utc_time); private: @@ -87,7 +88,7 @@ class LLConversation boost::signals2::connection mIMFloaterShowedConnection; - time_t mTime; // last interaction time + U64Seconds mTime; // last interaction time SessionType mConversationType; std::string mConversationName; std::string mHistoryFileName; diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp index 44212298cf5cb73ac73f525ca3dc9aa9e54d1691..ffc235bdbf5145b0c2ac4b9ba2537fe0c1431422 100755 --- a/indra/newview/llconversationloglist.cpp +++ b/indra/newview/llconversationloglist.cpp @@ -494,7 +494,7 @@ bool LLConversationLogListItemComparator::compare(const LLPanel* item1, const LL if (!conversation_item1 || !conversation_item2) { - llerror("conversation_item1 and conversation_item2 cannot be null", 0); + LL_ERRS() << "conversation_item1 and conversation_item2 cannot be null" << LL_ENDL; return true; } @@ -522,8 +522,8 @@ bool LLConversationLogListNameComparator::doCompare(const LLConversationLogListI bool LLConversationLogListDateComparator::doCompare(const LLConversationLogListItem* conversation1, const LLConversationLogListItem* conversation2) const { - time_t date1 = conversation1->getConversation()->getTime(); - time_t date2 = conversation2->getConversation()->getTime(); + U64Seconds date1 = conversation1->getConversation()->getTime(); + U64Seconds date2 = conversation2->getConversation()->getTime(); const LLUUID& id1 = conversation1->getConversation()->getParticipantID(); const LLUUID& id2 = conversation2->getConversation()->getParticipantID(); diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index affa24f78cb0c641b77c15295939f48291a031da..74b77f760df0a9824a62a15914cdc3e2e903db57 100755 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -361,7 +361,7 @@ void LLConversationItemSession::setDistance(const LLUUID& participant_id, F64 di void LLConversationItemSession::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLConversationItemParticipant::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLConversationItemParticipant::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; if((flags & ITEM_IN_MULTI_SELECTION) && (this->getType() != CONV_SESSION_NEARBY)) @@ -439,7 +439,7 @@ const bool LLConversationItemSession::getTime(F64& time) const void LLConversationItemSession::dumpDebugData(bool dump_children) { // Session info - llinfos << "Merov debug : session " << this << ", uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; + LL_INFOS() << "Merov debug : session " << this << ", uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << LL_ENDL; // Children info if (dump_children) { @@ -557,7 +557,7 @@ LLConversationItemSession* LLConversationItemParticipant::getParentSession() void LLConversationItemParticipant::dumpDebugData() { - llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << isVoiceMuted() << ", moderator = " << mIsModerator << llendl; + LL_INFOS() << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", display name = " << mDisplayName << ", muted = " << isVoiceMuted() << ", moderator = " << mIsModerator << LL_ENDL; } void LLConversationItemParticipant::setDisplayModeratorRole(bool displayRole) diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 90800fee5877b8b85ede0c810e7933ec5beb6718..4250aeacd6e4a9ddd7a1ba99a1f25639786326b8 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -127,10 +127,11 @@ void LLConversationViewSession::setHighlightState(bool hihglight_state) void LLConversationViewSession::startFlashing() { - LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container"); - // Need to start flashing only when "Conversations" is opened or brought on top - if (isInVisibleChain() && !im_box->isMinimized() && mFlashStateOn && !mFlashStarted) + if (isInVisibleChain() + && mFlashStateOn + && !mFlashStarted + && ! LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container")->isMinimized() ) { mFlashStarted = true; mFlashTimer->startFlashing(); diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp index 8af2f4ea3366818c9cbcada2a4cdcb7236a1f209..131675310ee1b5082a2a33d369a9f7b2bf728427 100755 --- a/indra/newview/lldaycyclemanager.cpp +++ b/indra/newview/lldaycyclemanager.cpp @@ -193,7 +193,7 @@ bool LLDayCycleManager::loadPreset(const std::string& path) LLSD data = LLWLDayCycle::loadDayCycleFromPath(path); if (data.isUndefined()) { - llwarns << "Error loading day cycle from " << path << llendl; + LL_WARNS() << "Error loading day cycle from " << path << LL_ENDL; return false; } diff --git a/indra/newview/lldebugmessagebox.cpp b/indra/newview/lldebugmessagebox.cpp index 9ad812ab1e47a682bacbb009570b5678f732932a..c8b9b1ac63a37ec4cba6ffe1be26248d2d5290eb 100755 --- a/indra/newview/lldebugmessagebox.cpp +++ b/indra/newview/lldebugmessagebox.cpp @@ -112,7 +112,7 @@ LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarTy addChild(mSlider3); break; default: - llwarns << "Unhandled var type " << var_type << llendl; + LL_WARNS() << "Unhandled var type " << var_type << LL_ENDL; break; } @@ -234,7 +234,7 @@ void LLDebugVarMessageBox::sliderChanged(const LLSD& data) break; } default: - llwarns << "Unhandled var type " << mVarType << llendl; + LL_WARNS() << "Unhandled var type " << mVarType << LL_ENDL; break; } } @@ -263,7 +263,7 @@ void LLDebugVarMessageBox::draw() break; } default: - llwarns << "Unhandled var type " << mVarType << llendl; + LL_WARNS() << "Unhandled var type " << mVarType << LL_ENDL; break; } mText->setText(text); diff --git a/indra/newview/lldebugmessagebox.h b/indra/newview/lldebugmessagebox.h index 211af9e0742d0e48892a96c2b0502b77bdc3bd46..87a0910662aa119a456424f2f6b1aa2f5b774c8c 100755 --- a/indra/newview/lldebugmessagebox.h +++ b/indra/newview/lldebugmessagebox.h @@ -28,7 +28,6 @@ #ifndef LL_LLDEBUGMESSAGEBOX_H #define LL_LLDEBUGMESSAGEBOX_H -#include "lldarray.h" #include "llfloater.h" #include "v3math.h" #include "lltextbox.h" diff --git a/indra/newview/lldebugview.cpp b/indra/newview/lldebugview.cpp index aeecf054b8ba5245c1f0cf800bd39057a355e90f..dc1c085c88f227f98303730c5580b38c6c9db1af 100755 --- a/indra/newview/lldebugview.cpp +++ b/indra/newview/lldebugview.cpp @@ -33,14 +33,13 @@ #include "llconsole.h" #include "lltextureview.h" #include "llresmgr.h" -#include "imageids.h" #include "llviewercontrol.h" #include "llviewerwindow.h" #include "llappviewer.h" #include "llsceneview.h" #include "llviewertexture.h" #include "llfloaterreg.h" - +#include "llscenemonitor.h" // // Globals // @@ -55,7 +54,6 @@ static LLDefaultChildRegistry::Register<LLDebugView> r("debug_view"); LLDebugView::LLDebugView(const LLDebugView::Params& p) : LLView(p), mFastTimerView(NULL), - mMemoryView(NULL), mDebugConsolep(NULL), mFloaterSnapRegion(NULL) {} @@ -66,6 +64,7 @@ LLDebugView::~LLDebugView() gDebugView = NULL; gTextureView = NULL; gSceneView = NULL; + gSceneMonitorView = NULL; } void LLDebugView::init() @@ -90,7 +89,7 @@ void LLDebugView::init() r.setLeftTopAndSize(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f), (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f)); - mFastTimerView = dynamic_cast<LLFastTimerView*>(LLFloaterReg::getInstance("fast_timers")); + mFastTimerView = dynamic_cast<LLFastTimerView*>(LLFloaterReg::getInstance("block_timers")); gSceneView = new LLSceneView(r); gSceneView->setFollowsTop(); @@ -99,6 +98,13 @@ void LLDebugView::init() addChild(gSceneView); gSceneView->setRect(rect); + gSceneMonitorView = new LLSceneMonitorView(r); + gSceneMonitorView->setFollowsTop(); + gSceneMonitorView->setFollowsLeft(); + gSceneMonitorView->setVisible(FALSE); + addChild(gSceneMonitorView); + gSceneMonitorView->setRect(rect); + r.setLeftTopAndSize(25, rect.getHeight() - 50, (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f), (S32) (gViewerWindow->getWindowRectScaled().getHeight() * 0.75f)); diff --git a/indra/newview/lldebugview.h b/indra/newview/lldebugview.h index 5aec77ad6275fdff32f8406bf60b393b5ea9c159..a6490c876c03893c1a5a2c6486a594a98950dc38 100755 --- a/indra/newview/lldebugview.h +++ b/indra/newview/lldebugview.h @@ -36,7 +36,6 @@ class LLButton; class LLStatusPanel; class LLFastTimerView; -class LLMemoryView; class LLConsole; class LLTextureView; class LLFloaterStats; @@ -61,7 +60,6 @@ class LLDebugView : public LLView void setStatsVisible(BOOL visible); LLFastTimerView* mFastTimerView; - LLMemoryView* mMemoryView; LLConsole* mDebugConsolep; LLView* mFloaterSnapRegion; }; diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index 4c4424edc498c10af961c34e4d2ba28085c14884..5c4f0f4d5dbb460c580bc3c45947482421b03ad4 100755 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -27,7 +27,6 @@ #include "llviewerprecompiledheaders.h" #include "lldirpicker.h" -//#include "llviewermessage.h" #include "llworld.h" #include "llviewerwindow.h" #include "llkeyboard.h" @@ -36,6 +35,7 @@ #include "lltrans.h" #include "llwindow.h" // beforeDialog() #include "llviewercontrol.h" +#include "llwin32headerslean.h" #if LL_LINUX || LL_SOLARIS || LL_DARWIN # include "llfilepicker.h" diff --git a/indra/newview/lldirpicker.h b/indra/newview/lldirpicker.h index 9cc62431ef397c727e6d8e2e27b51f3d918b9a74..8656b23afd670314542ddf58eb85d20955cdfc54 100755 --- a/indra/newview/lldirpicker.h +++ b/indra/newview/lldirpicker.h @@ -45,11 +45,6 @@ #endif -// Need commdlg.h for OPENDIRNAMEA -#ifdef LL_WINDOWS -#include <commdlg.h> -#endif - class LLFilePicker; class LLDirPicker diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp index 495cd01349fa27f9aaa4a0bac82f918568840ad9..7836e2cb94e578251a6804a544db9cc2a2d51d09 100755 --- a/indra/newview/lldonotdisturbnotificationstorage.cpp +++ b/indra/newview/lldonotdisturbnotificationstorage.cpp @@ -97,11 +97,11 @@ void LLDoNotDisturbNotificationStorage::resetDirty() mDirty = false; } -static LLFastTimer::DeclareTimer FTM_SAVE_DND_NOTIFICATIONS("Save DND Notifications"); +static LLTrace::BlockTimerStatHandle FTM_SAVE_DND_NOTIFICATIONS("Save DND Notifications"); void LLDoNotDisturbNotificationStorage::saveNotifications() { - LLFastTimer _(FTM_SAVE_DND_NOTIFICATIONS); + LL_RECORD_BLOCK_TIME(FTM_SAVE_DND_NOTIFICATIONS); LLNotificationChannelPtr channelPtr = getCommunicationChannel(); const LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get()); @@ -128,11 +128,11 @@ void LLDoNotDisturbNotificationStorage::saveNotifications() resetDirty(); } -static LLFastTimer::DeclareTimer FTM_LOAD_DND_NOTIFICATIONS("Load DND Notifications"); +static LLTrace::BlockTimerStatHandle FTM_LOAD_DND_NOTIFICATIONS("Load DND Notifications"); void LLDoNotDisturbNotificationStorage::loadNotifications() { - LLFastTimer _(FTM_LOAD_DND_NOTIFICATIONS); + LL_RECORD_BLOCK_TIME(FTM_LOAD_DND_NOTIFICATIONS); LL_INFOS("LLDoNotDisturbNotificationStorage") << "start loading notifications" << LL_ENDL; diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 9682f3822738e6c79a87d042dea694f6d4f7298f..c56006d9a3672fa7c3a6305b1a21eb4230ad8afa 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -49,13 +49,14 @@ #include "llspatialpartition.h" #include "llviewerobjectlist.h" #include "llviewerwindow.h" +#include "llvocache.h" const F32 MIN_INTERPOLATE_DISTANCE_SQUARED = 0.001f * 0.001f; const F32 MAX_INTERPOLATE_DISTANCE_SQUARED = 10.f * 10.f; const F32 OBJECT_DAMPING_TIME_CONSTANT = 0.06f; const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f; -static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound"); +static LLTrace::BlockTimerStatHandle FTM_CULL_REBOUND("Cull Rebound"); extern bool gShiftFrame; @@ -75,43 +76,72 @@ extern bool gShiftFrame; // // static -U32 LLDrawable::sCurVisible = 0; U32 LLDrawable::sNumZombieDrawables = 0; F32 LLDrawable::sCurPixelAngle = 0; -LLDynamicArrayPtr<LLPointer<LLDrawable> > LLDrawable::sDeadList; +std::vector<LLPointer<LLDrawable> > LLDrawable::sDeadList; #define FORCE_INVISIBLE_AREA 16.f // static void LLDrawable::incrementVisible() { - sCurVisible++; + LLViewerOctreeEntryData::incrementVisible(); sCurPixelAngle = (F32) gViewerWindow->getWindowHeightRaw()/LLViewerCamera::getInstance()->getView(); } -void LLDrawable::init() +LLDrawable::LLDrawable(LLViewerObject *vobj, bool new_entry) +: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLDRAWABLE), + LLTrace::MemTrackable<LLDrawable, 16>("LLDrawable"), + mVObjp(vobj) +{ + init(new_entry); +} + +void LLDrawable::init(bool new_entry) { // mXform mParent = NULL; mRenderType = 0; mCurrentScale = LLVector3(1,1,1); mDistanceWRTCamera = 0.0f; - mPositionGroup.clear(); - mExtents[0].clear(); - mExtents[1].clear(); - mState = 0; - mVObjp = NULL; + // mFaces - mSpatialGroupp = NULL; - mVisible = sCurVisible - 2;//invisible for the current frame and the last frame. mRadius = 0.f; + mGeneration = -1; + mSpatialBridge = NULL; + + LLViewerOctreeEntry* entry = NULL; + LLVOCacheEntry* vo_entry = NULL; + if(!new_entry && mVObjp && getRegion() != NULL) + { + vo_entry = getRegion()->getCacheEntryForOctree(mVObjp->getLocalID()); + if(vo_entry) + { + entry = vo_entry->getEntry(); + } + } + setOctreeEntry(entry); + if(vo_entry) + { + if(!entry) + { + vo_entry->setOctreeEntry(mEntry); + } + + getRegion()->addActiveCacheEntry(vo_entry); + + if(vo_entry->getNumOfChildren() > 0) + { + getRegion()->addVisibleChildCacheEntry(vo_entry, NULL); //to load all children. + } + + llassert(!vo_entry->getGroup()); //not in the object cache octree. + } - mGeneration = -1; - mBinRadius = 1.f; - mBinIndex = -1; + llassert(!vo_entry || vo_entry->getEntry() == mEntry); - mSpatialBridge = NULL; + initVisible(sCurVisible - 2);//invisible for the current frame and the last frame. } // static @@ -140,7 +170,7 @@ void LLDrawable::destroy() /* cannot be guaranteed and causes crashes on false alarms if (LLSpatialGroup::sNoDelete) { - llerrs << "Illegal deletion of LLDrawable!" << llendl; + LL_ERRS() << "Illegal deletion of LLDrawable!" << LL_ENDL; }*/ std::for_each(mFaces.begin(), mFaces.end(), DeletePointer()); @@ -149,7 +179,7 @@ void LLDrawable::destroy() /*if (!(sNumZombieDrawables % 10)) { - llinfos << "- Zombie drawables: " << sNumZombieDrawables << llendl; + LL_INFOS() << "- Zombie drawables: " << sNumZombieDrawables << LL_ENDL; }*/ } @@ -158,9 +188,10 @@ void LLDrawable::markDead() { if (isDead()) { - llwarns << "Warning! Marking dead multiple times!" << llendl; + LL_WARNS() << "Warning! Marking dead multiple times!" << LL_ENDL; return; } + setState(DEAD); if (mSpatialBridge) { @@ -171,9 +202,8 @@ void LLDrawable::markDead() sNumZombieDrawables++; // We're dead. Free up all of our references to other objects - setState(DEAD); cleanupReferences(); -// sDeadList.put(this); +// sDeadList.push_back(this); } LLVOVolume* LLDrawable::getVOVolume() const @@ -207,16 +237,16 @@ BOOL LLDrawable::isLight() const } } -static LLFastTimer::DeclareTimer FTM_CLEANUP_DRAWABLE("Cleanup Drawable"); -static LLFastTimer::DeclareTimer FTM_DEREF_DRAWABLE("Deref"); -static LLFastTimer::DeclareTimer FTM_DELETE_FACES("Faces"); +static LLTrace::BlockTimerStatHandle FTM_CLEANUP_DRAWABLE("Cleanup Drawable"); +static LLTrace::BlockTimerStatHandle FTM_DEREF_DRAWABLE("Deref"); +static LLTrace::BlockTimerStatHandle FTM_DELETE_FACES("Faces"); void LLDrawable::cleanupReferences() { - LLFastTimer t(FTM_CLEANUP_DRAWABLE); + LL_RECORD_BLOCK_TIME(FTM_CLEANUP_DRAWABLE); { - LLFastTimer t(FTM_DELETE_FACES); + LL_RECORD_BLOCK_TIME(FTM_DELETE_FACES); std::for_each(mFaces.begin(), mFaces.end(), DeletePointer()); mFaces.clear(); } @@ -225,28 +255,45 @@ void LLDrawable::cleanupReferences() gPipeline.unlinkDrawable(this); + removeFromOctree(); + { - LLFastTimer t(FTM_DEREF_DRAWABLE); + LL_RECORD_BLOCK_TIME(FTM_DEREF_DRAWABLE); // Cleanup references to other objects mVObjp = NULL; mParent = NULL; } } +void LLDrawable::removeFromOctree() +{ + if(!mEntry) + { + return; + } + + mEntry->removeData(this); + if(mEntry->hasVOCacheEntry()) + { + getRegion()->removeActiveCacheEntry((LLVOCacheEntry*)mEntry->getVOCacheEntry(), this); + } + mEntry = NULL; +} + void LLDrawable::cleanupDeadDrawables() { /* S32 i; - for (i = 0; i < sDeadList.count(); i++) + for (i = 0; i < sDeadList.size(); i++) { if (sDeadList[i]->getNumRefs() > 1) { - llwarns << "Dead drawable has " << sDeadList[i]->getNumRefs() << " remaining refs" << llendl; + LL_WARNS() << "Dead drawable has " << sDeadList[i]->getNumRefs() << " remaining refs" << LL_ENDL; gPipeline.findReferences(sDeadList[i]); } } */ - sDeadList.reset(); + sDeadList.clear(); } S32 LLDrawable::findReferences(LLDrawable *drawablep) @@ -254,24 +301,24 @@ S32 LLDrawable::findReferences(LLDrawable *drawablep) S32 count = 0; if (mParent == drawablep) { - llinfos << this << ": parent reference" << llendl; + LL_INFOS() << this << ": parent reference" << LL_ENDL; count++; } return count; } -static LLFastTimer::DeclareTimer FTM_ALLOCATE_FACE("Allocate Face", true); +static LLTrace::BlockTimerStatHandle FTM_ALLOCATE_FACE("Allocate Face"); LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerTexture *texturep) { LLFace *face; { - LLFastTimer t(FTM_ALLOCATE_FACE); + LL_RECORD_BLOCK_TIME(FTM_ALLOCATE_FACE); face = new LLFace(this, mVObjp); } - if (!face) llerrs << "Allocating new Face: " << mFaces.size() << llendl; + if (!face) LL_ERRS() << "Allocating new Face: " << mFaces.size() << LL_ENDL; if (face) { @@ -295,7 +342,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep) LLFace *face; { - LLFastTimer t(FTM_ALLOCATE_FACE); + LL_RECORD_BLOCK_TIME(FTM_ALLOCATE_FACE); face = new LLFace(this, mVObjp); } @@ -428,7 +475,7 @@ void LLDrawable::deleteFaces(S32 offset, S32 count) void LLDrawable::update() { - llerrs << "Shouldn't be called!" << llendl; + LL_ERRS() << "Shouldn't be called!" << LL_ENDL; } @@ -450,7 +497,7 @@ void LLDrawable::makeActive() pcode == LLViewerObject::LL_VO_GROUND || pcode == LLViewerObject::LL_VO_SKY) { - llerrs << "Static viewer object has active drawable!" << llendl; + LL_ERRS() << "Static viewer object has active drawable!" << LL_ENDL; } } #endif @@ -488,6 +535,12 @@ void LLDrawable::makeActive() } updatePartition(); } + else if (!isRoot() && !mParent->isActive()) //this should not happen, but occasionally it does... + { + mParent->makeActive(); + //NOTE: linked set will now NEVER become static + mParent->setState(LLDrawable::ACTIVE_CHILD); + } llassert(isAvatar() || isRoot() || mParent->isActive()); } @@ -515,7 +568,7 @@ void LLDrawable::makeStatic(BOOL warning_enabled) { if (child_drawable->getParent() != this) { - llwarns << "Child drawable has unknown parent." << llendl; + LL_WARNS() << "Child drawable has unknown parent." << LL_ENDL; } child_drawable->makeStatic(warning_enabled); } @@ -569,7 +622,7 @@ F32 LLDrawable::updateXform(BOOL undamped) if (damped && isVisible()) { - F32 lerp_amt = llclamp(LLCriticalDamp::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f); + F32 lerp_amt = llclamp(LLSmoothInterpolation::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f); LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt); dist_squared = dist_vec_squared(new_pos, target_pos); @@ -690,7 +743,7 @@ BOOL LLDrawable::updateMove() { if (isDead()) { - llwarns << "Update move on dead drawable!" << llendl; + LL_WARNS() << "Update move on dead drawable!" << LL_ENDL; return TRUE; } @@ -765,7 +818,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) { if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) { - llwarns << "Attempted to update distance for non-world camera." << llendl; + LL_WARNS() << "Attempted to update distance for non-world camera." << LL_ENDL; return; } @@ -784,7 +837,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) LLVOVolume* volume = getVOVolume(); if (volume) { - if (getSpatialGroup()) + if (getGroup()) { pos.set(getPositionGroup().getF32ptr()); } @@ -830,7 +883,7 @@ void LLDrawable::updateTexture() { if (isDead()) { - llwarns << "Dead drawable updating texture!" << llendl; + LL_WARNS() << "Dead drawable updating texture!" << LL_ENDL; return; } @@ -856,7 +909,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) { if (isDead()) { - llwarns << "Shifting dead drawable" << llendl; + LL_WARNS() << "Shifting dead drawable" << LL_ENDL; return; } @@ -902,9 +955,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) } } - mExtents[0].add(shift_vector); - mExtents[1].add(shift_vector); - mPositionGroup.add(shift_vector); + shift(shift_vector); } else if (mSpatialBridge) { @@ -912,9 +963,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) } else if (isAvatar()) { - mExtents[0].add(shift_vector); - mExtents[1].add(shift_vector); - mPositionGroup.add(shift_vector); + shift(shift_vector); } mVObjp->onShift(shift_vector); @@ -926,40 +975,24 @@ const LLVector3& LLDrawable::getBounds(LLVector3& min, LLVector3& max) const return mXform.getPositionW(); } -const LLVector4a* LLDrawable::getSpatialExtents() const -{ - return mExtents; -} - -void LLDrawable::setSpatialExtents(const LLVector3& min, const LLVector3& max) -{ - mExtents[0].load3(min.mV); - mExtents[1].load3(max.mV); -} - -void LLDrawable::setSpatialExtents(const LLVector4a& min, const LLVector4a& max) -{ - mExtents[0] = min; - mExtents[1] = max; -} - -void LLDrawable::setPositionGroup(const LLVector4a& pos) -{ - mPositionGroup = pos; -} - void LLDrawable::updateSpatialExtents() { if (mVObjp) { - mVObjp->updateSpatialExtents(mExtents[0], mExtents[1]); + const LLVector4a* exts = getSpatialExtents(); + LLVector4a extents[2]; + extents[0] = exts[0]; + extents[1] = exts[1]; + + mVObjp->updateSpatialExtents(extents[0], extents[1]); + setSpatialExtents(extents[0], extents[1]); } updateBinRadius(); if (mSpatialBridge.notNull()) { - mPositionGroup.splat(0.f); + getGroupPosition().splat(0.f); } } @@ -968,11 +1001,11 @@ void LLDrawable::updateBinRadius() { if (mVObjp.notNull()) { - mBinRadius = llmin(mVObjp->getBinRadius(), 256.f); + setBinRadius(llmin(mVObjp->getBinRadius(), 256.f)); } else { - mBinRadius = llmin(getRadius()*4.f, 256.f); + setBinRadius(llmin(getRadius()*4.f, 256.f)); } } @@ -996,7 +1029,7 @@ F32 LLDrawable::getVisibilityRadius() const { return llmax(getRadius(), vov->getLightRadius()); } else { - // llwarns ? + // LL_WARNS() ? } } return getRadius(); @@ -1006,26 +1039,52 @@ void LLDrawable::updateUVMinMax() { } -LLSpatialGroup* LLDrawable::getSpatialGroup() const +//virtual +bool LLDrawable::isVisible() const +{ + if (LLViewerOctreeEntryData::isVisible()) { - llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1); - return mSpatialGroupp; + return true; +} + +{ + LLViewerOctreeGroup* group = mEntry->getGroup(); + if (group && group->isVisible()) + { + LLViewerOctreeEntryData::setVisible(); + return true; + } + } + + return false; } -void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp) +//virtual +bool LLDrawable::isRecentlyVisible() const { - //precondition: mSpatialGroupp MUST be null or DEAD or mSpatialGroupp MUST NOT contain this - llassert(!mSpatialGroupp || mSpatialGroupp->isDead() || !mSpatialGroupp->hasElement(this)); + //currently visible or visible in the previous frame. + bool vis = LLViewerOctreeEntryData::isRecentlyVisible(); - //precondition: groupp MUST be null or groupp MUST contain this - llassert(!groupp || groupp->hasElement(this)); + if(!vis) + { + const U32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. + vis = (sCurVisible - getVisible() < MIN_VIS_FRAME_RANGE); + } + + return vis ; +} -/*if (mSpatialGroupp && (groupp != mSpatialGroupp)) +void LLDrawable::setGroup(LLViewerOctreeGroup *groupp) { - mSpatialGroupp->setState(LLSpatialGroup::GEOM_DIRTY); - }*/ + LLSpatialGroup* cur_groupp = (LLSpatialGroup*)getGroup(); + + //precondition: mGroupp MUST be null or DEAD or mGroupp MUST NOT contain this + //llassert(!cur_groupp || cur_groupp->isDead() || !cur_groupp->hasElement(this)); - if (mSpatialGroupp != groupp && getVOVolume()) + //precondition: groupp MUST be null or groupp MUST contain this + llassert(!groupp || (LLSpatialGroup*)groupp->hasElement(this)); + + if (cur_groupp != groupp && getVOVolume()) { //NULL out vertex buffer references for volumes on spatial group change to maintain //requirement that every face vertex buffer is either NULL or points to a vertex buffer //contained by its drawable's spatial group @@ -1041,10 +1100,10 @@ void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp) //postcondition: if next group is NULL, previous group must be dead OR NULL OR binIndex must be -1 //postcondition: if next group is NOT NULL, binIndex must not be -1 - llassert(groupp == NULL ? (mSpatialGroupp == NULL || mSpatialGroupp->isDead()) || getBinIndex() == -1 : - getBinIndex() != -1); + //llassert(groupp == NULL ? (cur_groupp == NULL || cur_groupp->isDead()) || (!getEntry() || getEntry()->getBinIndex() == -1) : + // (getEntry() && getEntry()->getBinIndex() != -1)); - mSpatialGroupp = groupp; + LLViewerOctreeEntryData::setGroup(groupp); } LLSpatialPartition* LLDrawable::getSpatialPartition() @@ -1063,11 +1122,11 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() { if (mVObjp->isHUDAttachment()) { - setSpatialBridge(new LLHUDBridge(this)); + setSpatialBridge(new LLHUDBridge(this, getRegion())); } else { - setSpatialBridge(new LLVolumeBridge(this)); + setSpatialBridge(new LLVolumeBridge(this, getRegion())); } } return mSpatialBridge->asPartition(); @@ -1086,89 +1145,18 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() return retval; } -const S32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. -//static -S32 LLDrawable::getMinVisFrameRange() -{ - return MIN_VIS_FRAME_RANGE ; -} - -BOOL LLDrawable::isRecentlyVisible() const -{ - //currently visible or visible in the previous frame. - BOOL vis = isVisible() || (sCurVisible - mVisible < MIN_VIS_FRAME_RANGE) ; - - if(!vis) - { - LLSpatialGroup* group = getSpatialGroup(); - if (group && group->isRecentlyVisible()) - { - mVisible = sCurVisible; - vis = TRUE ; - } - } - - return vis ; -} - -BOOL LLDrawable::isVisible() const -{ - if (mVisible == sCurVisible) - { - return TRUE; - } - -#if 0 - //disabling this code fixes DEV-20105. Leaving in place in case some other bug pops up as a a result. - //should be safe to just always ask the spatial group for visibility. - if (isActive()) - { - if (isRoot()) - { - LLSpatialGroup* group = mSpatialBridge.notNull() ? mSpatialBridge->getSpatialGroup() : - getSpatialGroup(); - if (group && group->isVisible()) - { - mVisible = sCurVisible; - return TRUE; - } - } - else - { - if (getParent()->isVisible()) - { - mVisible = sCurVisible; - return TRUE; - } - } - } - else -#endif - { - LLSpatialGroup* group = getSpatialGroup(); - if (group && group->isVisible()) - { - mVisible = sCurVisible; - return TRUE; - } - } - - return FALSE; -} - //======================================= // Spatial Partition Bridging Drawable //======================================= -LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask) -: LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB) +LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp) : + LLDrawable(root->getVObj(), true), + LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB, regionp) { mBridge = this; mDrawable = root; root->setSpatialBridge(this); - mBinIndex = -1; - mRenderType = mDrawable->mRenderType; mDrawableType = mDrawable->mRenderType; @@ -1189,10 +1177,13 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat LLSpatialBridge::~LLSpatialBridge() { + if(mEntry) + { LLSpatialGroup* group = getSpatialGroup(); if (group) { - group->mSpatialPartition->remove(this, group); + group->getSpatialPartition()->remove(this, group); + } } //delete octree here so listeners will still be able to access bridge specific state @@ -1210,12 +1201,13 @@ void LLSpatialBridge::updateSpatialExtents() LLSpatialGroup* root = (LLSpatialGroup*) mOctree->getListener(0); { - LLFastTimer ftm(FTM_CULL_REBOUND); + LL_RECORD_BLOCK_TIME(FTM_CULL_REBOUND); root->rebound(); } + const LLVector4a* root_bounds = root->getBounds(); LLVector4a offset; - LLVector4a size = root->mBounds[1]; + LLVector4a size = root_bounds[1]; //VECTORIZE THIS LLMatrix4a mat; @@ -1227,7 +1219,7 @@ void LLSpatialBridge::updateSpatialExtents() LLVector4a center; mat.affineTransform(t, center); - mat.rotate(root->mBounds[0], offset); + mat.rotate(root_bounds[0], offset); center.add(offset); LLVector4a v[4]; @@ -1249,12 +1241,9 @@ void LLSpatialBridge::updateSpatialExtents() scale.mul(size); mat.rotate(scale, v[3]); - - LLVector4a& newMin = mExtents[0]; - LLVector4a& newMax = mExtents[1]; - + LLVector4a newMin; + LLVector4a newMax; newMin = newMax = center; - for (U32 i = 0; i < 4; i++) { LLVector4a delta; @@ -1267,19 +1256,21 @@ void LLSpatialBridge::updateSpatialExtents() newMin.setMin(newMin, min); newMax.setMax(newMax, max); } + setSpatialExtents(newMin, newMax); LLVector4a diagonal; diagonal.setSub(newMax, newMin); mRadius = diagonal.getLength3().getF32() * 0.5f; - mPositionGroup.setAdd(newMin,newMax); - mPositionGroup.mul(0.5f); + LLVector4a& pos = getGroupPosition(); + pos.setAdd(newMin,newMax); + pos.mul(0.5f); updateBinRadius(); } void LLSpatialBridge::updateBinRadius() { - mBinRadius = llmin( mOctree->getSize()[0]*0.5f, 256.f); + setBinRadius(llmin( mOctree->getSize()[0]*0.5f, 256.f)); } LLCamera LLSpatialBridge::transformCamera(LLCamera& camera) @@ -1313,7 +1304,7 @@ LLCamera LLSpatialBridge::transformCamera(LLCamera& camera) void LLDrawable::setVisible(LLCamera& camera, std::vector<LLDrawable*>* results, BOOL for_select) { - mVisible = sCurVisible; + LLViewerOctreeEntryData::setVisible(); #if 0 && !LL_RELEASE_FOR_DOWNLOAD //crazy paranoid rules checking @@ -1323,46 +1314,46 @@ void LLDrawable::setVisible(LLCamera& camera, std::vector<LLDrawable*>* results, { if (isActive() && !mParent->isActive()) { - llerrs << "Active drawable has static parent!" << llendl; + LL_ERRS() << "Active drawable has static parent!" << LL_ENDL; } if (isStatic() && !mParent->isStatic()) { - llerrs << "Static drawable has active parent!" << llendl; + LL_ERRS() << "Static drawable has active parent!" << LL_ENDL; } if (mSpatialBridge) { - llerrs << "Child drawable has spatial bridge!" << llendl; + LL_ERRS() << "Child drawable has spatial bridge!" << LL_ENDL; } } else if (isActive() && !mSpatialBridge) { - llerrs << "Active root drawable has no spatial bridge!" << llendl; + LL_ERRS() << "Active root drawable has no spatial bridge!" << LL_ENDL; } else if (isStatic() && mSpatialBridge.notNull()) { - llerrs << "Static drawable has spatial bridge!" << llendl; + LL_ERRS() << "Static drawable has spatial bridge!" << LL_ENDL; } } #endif } -class LLOctreeMarkNotCulled: public LLOctreeTraveler<LLDrawable> +class LLOctreeMarkNotCulled: public OctreeTraveler { public: LLCamera* mCamera; LLOctreeMarkNotCulled(LLCamera* camera_in) : mCamera(camera_in) { } - virtual void traverse(const LLOctreeNode<LLDrawable>* node) + virtual void traverse(const OctreeNode* node) { LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); group->setVisible(); - LLOctreeTraveler<LLDrawable>::traverse(node); + OctreeTraveler::traverse(node); } - void visit(const LLOctreeNode<LLDrawable>* branch) + void visit(const OctreeNode* branch) { gPipeline.markNotCulled((LLSpatialGroup*) branch->getListener(0), *mCamera); } @@ -1406,7 +1397,7 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* } if (!group || - LLDrawable::getCurrentFrame() - av->mVisible > 1 || + LLDrawable::getCurrentFrame() - av->getVisible() > 1 || impostor || !loaded) { @@ -1420,16 +1411,17 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* group->rebound(); LLVector4a center; - center.setAdd(mExtents[0], mExtents[1]); + const LLVector4a* exts = getSpatialExtents(); + center.setAdd(exts[0], exts[1]); center.mul(0.5f); LLVector4a size; - size.setSub(mExtents[1], mExtents[0]); + size.setSub(exts[1], exts[0]); size.mul(0.5f); if ((LLPipeline::sShadowRender && camera_in.AABBInFrustum(center, size)) || LLPipeline::sImpostorRender || (camera_in.AABBInFrustumNoFarClip(center, size) && - AABBSphereIntersect(mExtents[0], mExtents[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist))) + AABBSphereIntersect(exts[0], exts[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist))) { if (!LLPipeline::sImpostorRender && !LLPipeline::sShadowRender && @@ -1517,7 +1509,7 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update) void LLSpatialBridge::makeActive() { //it is an error to make a spatial bridge active (it's already active) - llerrs << "makeActive called on spatial bridge" << llendl; + LL_ERRS() << "makeActive called on spatial bridge" << LL_ENDL; } void LLSpatialBridge::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate) @@ -1544,9 +1536,7 @@ BOOL LLSpatialBridge::updateMove() void LLSpatialBridge::shiftPos(const LLVector4a& vec) { - mExtents[0].add(vec); - mExtents[1].add(vec); - mPositionGroup.add(vec); + LLDrawable::shift(vec); } void LLSpatialBridge::cleanupReferences() @@ -1554,11 +1544,8 @@ void LLSpatialBridge::cleanupReferences() LLDrawable::cleanupReferences(); if (mDrawable) { - /* - - DON'T DO THIS -- this should happen through octree destruction + mDrawable->setGroup(NULL); - mDrawable->setSpatialGroup(NULL); if (mDrawable->getVObj()) { LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren(); @@ -1569,10 +1556,10 @@ void LLSpatialBridge::cleanupReferences() LLDrawable* drawable = child->mDrawable; if (drawable) { - drawable->setSpatialGroup(NULL); + drawable->setGroup(NULL); + } } } - }*/ LLDrawable* drawablep = mDrawable; mDrawable = NULL; @@ -1641,8 +1628,8 @@ void LLDrawable::updateFaceSize(S32 idx) } } -LLBridgePartition::LLBridgePartition() -: LLSpatialPartition(0, FALSE, 0) +LLBridgePartition::LLBridgePartition(LLViewerRegion* regionp) +: LLSpatialPartition(0, FALSE, 0, regionp) { mDrawableType = LLPipeline::RENDER_TYPE_AVATAR; mPartitionType = LLViewerRegion::PARTITION_BRIDGE; @@ -1650,8 +1637,8 @@ LLBridgePartition::LLBridgePartition() mSlopRatio = 0.25f; } -LLHUDBridge::LLHUDBridge(LLDrawable* drawablep) -: LLVolumeBridge(drawablep) +LLHUDBridge::LLHUDBridge(LLDrawable* drawablep, LLViewerRegion* regionp) +: LLVolumeBridge(drawablep, regionp) { mDrawableType = LLPipeline::RENDER_TYPE_HUD; mPartitionType = LLViewerRegion::PARTITION_HUD; diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index c3f6d77edc3bd9ba31d1b221eb0089ef36c78b67..a3461d4c01141327750be99f5551aea3055bb732 100755 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -38,10 +38,10 @@ #include "llvector4a.h" #include "llquaternion.h" #include "xform.h" -#include "lldarray.h" #include "llviewerobject.h" #include "llrect.h" #include "llappviewer.h" // for gFrameTimeSeconds +#include "llvieweroctree.h" class LLCamera; class LLDrawPool; @@ -59,33 +59,27 @@ const U32 SILHOUETTE_HIGHLIGHT = 0; // All data for new renderer goes into this class. LL_ALIGN_PREFIX(16) -class LLDrawable : public LLRefCount +class LLDrawable +: public LLViewerOctreeEntryData, + public LLTrace::MemTrackable<LLDrawable, 16> { public: - LLDrawable(const LLDrawable& rhs) + LLDrawable(const LLDrawable& rhs) + : LLTrace::MemTrackable<LLDrawable, 16>("LLDrawable"), + LLViewerOctreeEntryData(rhs) { *this = rhs; } const LLDrawable& operator=(const LLDrawable& rhs) { - llerrs << "Illegal operation!" << llendl; + LL_ERRS() << "Illegal operation!" << LL_ENDL; return *this; } static void initClass(); - void* operator new(size_t size) - { - return ll_aligned_malloc_16(size); - } - - void operator delete(void* ptr) - { - ll_aligned_free_16(ptr); - } - - LLDrawable() { init(); } + LLDrawable(LLViewerObject *vobj, bool new_entry = false); void markDead(); // Mark this drawable as dead BOOL isDead() const { return isState(DEAD); } @@ -93,11 +87,9 @@ class LLDrawable : public LLRefCount BOOL isLight() const; - BOOL isVisible() const; - BOOL isRecentlyVisible() const; virtual void setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* results = NULL, BOOL for_select = FALSE); - + LLSpatialGroup* getSpatialGroup()const {return (LLSpatialGroup*)getGroup();} LLViewerRegion* getRegion() const { return mVObjp->getRegion(); } const LLTextureEntry* getTextureEntry(U8 which) const { return mVObjp->getTE(which); } LLPointer<LLViewerObject>& getVObj() { return mVObjp; } @@ -110,16 +102,12 @@ class LLDrawable : public LLRefCount const LLVector3& getPosition() const { return mXform.getPosition(); } const LLVector3& getWorldPosition() const { return mXform.getPositionW(); } const LLVector3 getPositionAgent() const; - const LLVector4a& getPositionGroup() const { return mPositionGroup; } const LLVector3& getScale() const { return mCurrentScale; } void setScale(const LLVector3& scale) { mCurrentScale = scale; } const LLQuaternion& getWorldRotation() const { return mXform.getWorldRotation(); } const LLQuaternion& getRotation() const { return mXform.getRotation(); } F32 getIntensity() const { return llmin(mXform.getScale().mV[0], 4.f); } S32 getLOD() const { return mVObjp ? mVObjp->getLOD() : 1; } - F32 getBinRadius() const { return mBinRadius; } - S32 getBinIndex() const { return mBinIndex; } - void setBinIndex(S32 index) const { mBinIndex = index; } void getMinMax(LLVector3& min,LLVector3& max) const { mXform.getMinMax(min,max); } LLXformMatrix* getXform() { return &mXform; } @@ -152,7 +140,7 @@ class LLDrawable : public LLRefCount void setNumFacesFast(const S32 numFaces, LLFacePool *poolp, LLViewerTexture *texturep); void mergeFaces(LLDrawable* src); - void init(); + void init(bool new_entry); void destroy(); void update(); @@ -183,8 +171,12 @@ class LLDrawable : public LLRefCount BOOL getLit() const { return isState(UNLIT) ? FALSE : TRUE; } void setLit(BOOL lit) { lit ? clearState(UNLIT) : setState(UNLIT); } + bool isVisible() const; + bool isRecentlyVisible() const; + virtual void cleanupReferences(); + void setGroup(LLViewerOctreeGroup* group); void setRadius(const F32 radius); F32 getRadius() const { return mRadius; } F32 getVisibilityRadius() const; @@ -194,11 +186,6 @@ class LLDrawable : public LLRefCount const LLVector3& getBounds(LLVector3& min, LLVector3& max) const; virtual void updateSpatialExtents(); virtual void updateBinRadius(); - const LLVector4a* getSpatialExtents() const; - void setSpatialExtents(const LLVector3& min, const LLVector3& max); - void setSpatialExtents(const LLVector4a& min, const LLVector4a& max); - - void setPositionGroup(const LLVector4a& pos); void setRenderType(S32 type) { mRenderType = type; } BOOL isRenderType(S32 type) { return mRenderType == type; } @@ -207,10 +194,13 @@ class LLDrawable : public LLRefCount // Debugging methods S32 findReferences(LLDrawable *drawablep); // Not const because of @#$! iterators... - void setSpatialGroup(LLSpatialGroup *groupp); - LLSpatialGroup *getSpatialGroup() const; LLSpatialPartition* getSpatialPartition(); + void removeFromOctree(); + + void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; } + LLSpatialBridge* getSpatialBridge() { return (LLSpatialBridge*) (LLDrawable*) mSpatialBridge; } + // Statics static void incrementVisible(); static void cleanupDeadDrawables(); @@ -294,10 +284,6 @@ class LLDrawable : public LLRefCount ACTIVE_CHILD = 0x40000000, } EDrawableFlags; -private: //aligned members - LL_ALIGN_16(LLVector4a mExtents[2]); - LL_ALIGN_16(LLVector4a mPositionGroup); - public: LLXformMatrix mXform; @@ -306,12 +292,6 @@ class LLDrawable : public LLRefCount F32 mDistanceWRTCamera; - static S32 getCurrentFrame() { return sCurVisible; } - static S32 getMinVisFrameRange(); - - void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; } - LLSpatialBridge* getSpatialBridge() { return (LLSpatialBridge*) (LLDrawable*) mSpatialBridge; } - static F32 sCurPixelAngle; //current pixels per radian private: @@ -321,39 +301,33 @@ class LLDrawable : public LLRefCount S32 mRenderType; LLPointer<LLViewerObject> mVObjp; face_list_t mFaces; - LLSpatialGroup* mSpatialGroupp; LLPointer<LLDrawable> mSpatialBridge; - mutable U32 mVisible; F32 mRadius; - F32 mBinRadius; - mutable S32 mBinIndex; S32 mGeneration; LLVector3 mCurrentScale; - static U32 sCurVisible; // Counter for what value of mVisible means currently visible - static U32 sNumZombieDrawables; - static LLDynamicArrayPtr<LLPointer<LLDrawable> > sDeadList; + static std::vector<LLPointer<LLDrawable> > sDeadList; } LL_ALIGN_POSTFIX(16); inline LLFace* LLDrawable::getFace(const S32 i) const { - //switch these asserts to llerrs -- davep + //switch these asserts to LL_ERRS() -- davep //llassert((U32)i < mFaces.size()); //llassert(mFaces[i]); if ((U32) i >= mFaces.size()) { - llwarns << "Invalid face index." << llendl; + LL_WARNS() << "Invalid face index." << LL_ENDL; return NULL; } if (!mFaces[i]) { - llwarns << "Null face found." << llendl; + LL_WARNS() << "Null face found." << LL_ENDL; return NULL; } diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 714f9a17188dca241b5b7c9f4885d2d622fe7cd9..5b151bdcda15ed053834e3f49538d4e6bfc4dd27 100755 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -113,7 +113,7 @@ LLDrawPool *LLDrawPool::createPool(const U32 type, LLViewerTexture *tex0) poolp = new LLDrawPoolWLSky(); break; default: - llerrs << "Unknown draw pool type!" << llendl; + LL_ERRS() << "Unknown draw pool type!" << LL_ENDL; return NULL; } @@ -257,7 +257,7 @@ void LLFacePool::destroy() { if (!mReferences.empty()) { - llinfos << mReferences.size() << " references left on deletion of draw pool!" << llendl; + LL_INFOS() << mReferences.size() << " references left on deletion of draw pool!" << LL_ENDL; } } @@ -332,7 +332,7 @@ BOOL LLFacePool::verify() const const LLFace* facep = *iter; if (facep->getPool() != this) { - llinfos << "Face in wrong pool!" << llendl; + LL_INFOS() << "Face in wrong pool!" << LL_ENDL; facep->printDebugInfo(); ok = FALSE; } @@ -347,7 +347,7 @@ BOOL LLFacePool::verify() const void LLFacePool::printDebugInfo() const { - llinfos << "Pool " << this << " Type: " << getType() << llendl; + LL_INFOS() << "Pool " << this << " Type: " << getType() << LL_ENDL; } BOOL LLFacePool::LLOverrideFaceColor::sOverrideFaceColor = FALSE; @@ -385,9 +385,9 @@ LLRenderPass::~LLRenderPass() LLDrawPool* LLRenderPass::instancePool() { #if LL_RELEASE_FOR_DOWNLOAD - llwarns << "Attempting to instance a render pass. Invalid operation." << llendl; + LL_WARNS() << "Attempting to instance a render pass. Invalid operation." << LL_ENDL; #else - llerrs << "Attempting to instance a render pass. Invalid operation." << llendl; + LL_ERRS() << "Attempting to instance a render pass. Invalid operation." << LL_ENDL; #endif return NULL; } diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index e27dc279f4e71745708b917e1e67aa36c2683b21..84ead0bdde2cc992afd791cc8188277e31c4bfbe 100755 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -89,7 +89,7 @@ S32 LLDrawPoolAlpha::getNumPostDeferredPasses() void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) { - LLFastTimer t(FTM_RENDER_ALPHA); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA); if (pass == 0) { @@ -179,7 +179,7 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass) void LLDrawPoolAlpha::beginRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_ALPHA); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA); if (LLPipeline::sImpostorRender) { @@ -211,7 +211,7 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass) void LLDrawPoolAlpha::endRenderPass( S32 pass ) { - LLFastTimer t(FTM_RENDER_ALPHA); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA); LLRenderPass::endRenderPass(pass); if(gPipeline.canUseWindLightShaders()) @@ -222,7 +222,7 @@ void LLDrawPoolAlpha::endRenderPass( S32 pass ) void LLDrawPoolAlpha::render(S32 pass) { - LLFastTimer t(FTM_RENDER_ALPHA); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA); LLGLSPipelineAlpha gls_pipeline_alpha; @@ -336,7 +336,7 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask) for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) { LLSpatialGroup* group = *i; - if (group->mSpatialPartition->mRenderByGroup && + if (group->getSpatialPartition()->mRenderByGroup && !group->isDead()) { LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA]; @@ -363,6 +363,9 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask) } } +static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_GROUP_LOOP("Alpha Group"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_PUSH("Alpha Push Verts"); + void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass) { BOOL initialized_lighting = FALSE; @@ -374,18 +377,18 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass) { LLSpatialGroup* group = *i; llassert(group); - llassert(group->mSpatialPartition); + llassert(group->getSpatialPartition()); - if (group->mSpatialPartition->mRenderByGroup && + if (group->getSpatialPartition()->mRenderByGroup && !group->isDead()) { - bool is_particle_or_hud_particle = group->mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_PARTICLE - || group->mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE; + bool is_particle_or_hud_particle = group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_PARTICLE + || group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE; bool draw_glow_for_this_partition = mVertexShaderLevel > 0; // no shaders = no glow. - static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_GROUP_LOOP("Alpha Group"); - LLFastTimer t(FTM_RENDER_ALPHA_GROUP_LOOP); + + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_GROUP_LOOP); bool disable_cull = is_particle_or_hud_particle; LLGLDisable cull(disable_cull ? GL_CULL_FACE : 0); @@ -398,7 +401,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass) if ((params.mVertexBuffer->getTypeMask() & mask) != mask) { //FIXME! - llwarns << "Missing required components, skipping render batch." << llendl; + LL_WARNS() << "Missing required components, skipping render batch." << LL_ENDL; continue; } @@ -420,14 +423,14 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass) } LLRenderPass::applyModelMatrix(params); - + LLMaterial* mat = NULL; if (deferred_render) { mat = params.mMaterial; } - + if (params.mFullbright) { // Turn off lighting if it hasn't already been so. @@ -497,7 +500,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass) LLGLSLShader::bindNoShader(); current_shader = NULL; } - + if (use_shaders && mat) { // We have a material. Supply the appropriate data here. @@ -547,7 +550,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass) } } } - else + else { //not batching textures or batch has only 1 texture -- might need a texture matrix if (params.mTexture.notNull()) { @@ -558,7 +561,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass) } else { - gGL.getTexUnit(0)->bind(params.mTexture, TRUE); + gGL.getTexUnit(0)->bind(params.mTexture, TRUE) ; } if (params.mTextureMatrix) @@ -576,9 +579,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass) } } - static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_PUSH("Alpha Push Verts"); { - LLFastTimer t(FTM_RENDER_ALPHA_PUSH); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_PUSH); gGL.blendFunc((LLRender::eBlendFactor) params.mBlendFuncSrc, (LLRender::eBlendFactor) params.mBlendFuncDst, mAlphaSFactor, mAlphaDFactor); params.mVertexBuffer->setBuffer(mask & ~(params.mFullbright ? (LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2) : 0)); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 716243b381931ed663ebc4bcc08452705a79f91c..90e6dfe351e6fd97a194d071ff6d0ea9176a944b 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -103,7 +103,7 @@ S32 normal_channel = -1; S32 specular_channel = -1; S32 cube_channel = -1; -static LLFastTimer::DeclareTimer FTM_SHADOW_AVATAR("Avatar Shadow"); +static LLTrace::BlockTimerStatHandle FTM_SHADOW_AVATAR("Avatar Shadow"); LLDrawPoolAvatar::LLDrawPoolAvatar() : LLFacePool(POOL_AVATAR) @@ -170,7 +170,7 @@ LLMatrix4& LLDrawPoolAvatar::getModelView() void LLDrawPoolAvatar::beginDeferredPass(S32 pass) { - LLFastTimer t(FTM_RENDER_CHARACTERS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_CHARACTERS); sSkipTransparent = TRUE; is_deferred_render = true; @@ -205,7 +205,7 @@ void LLDrawPoolAvatar::beginDeferredPass(S32 pass) void LLDrawPoolAvatar::endDeferredPass(S32 pass) { - LLFastTimer t(FTM_RENDER_CHARACTERS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_CHARACTERS); sSkipTransparent = FALSE; is_deferred_render = false; @@ -409,7 +409,7 @@ S32 LLDrawPoolAvatar::getNumShadowPasses() void LLDrawPoolAvatar::beginShadowPass(S32 pass) { - LLFastTimer t(FTM_SHADOW_AVATAR); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_AVATAR); if (pass == 0) { @@ -435,7 +435,7 @@ void LLDrawPoolAvatar::beginShadowPass(S32 pass) void LLDrawPoolAvatar::endShadowPass(S32 pass) { - LLFastTimer t(FTM_SHADOW_AVATAR); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_AVATAR); if (pass == 0) { if (sShaderLevel > 0) @@ -454,7 +454,7 @@ void LLDrawPoolAvatar::endShadowPass(S32 pass) void LLDrawPoolAvatar::renderShadow(S32 pass) { - LLFastTimer t(FTM_SHADOW_AVATAR); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_AVATAR); if (mDrawFace.empty()) { @@ -481,7 +481,7 @@ void LLDrawPoolAvatar::renderShadow(S32 pass) if (pass == 0) { - avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); + avatarp->renderSkinned(); } else { @@ -520,7 +520,7 @@ S32 LLDrawPoolAvatar::getNumDeferredPasses() void LLDrawPoolAvatar::render(S32 pass) { - LLFastTimer t(FTM_RENDER_CHARACTERS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_CHARACTERS); if (LLPipeline::sImpostorRender) { renderAvatars(NULL, pass+2); @@ -532,7 +532,7 @@ void LLDrawPoolAvatar::render(S32 pass) void LLDrawPoolAvatar::beginRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_CHARACTERS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_CHARACTERS); //reset vertex buffer mappings LLVertexBuffer::unbind(); @@ -583,7 +583,7 @@ void LLDrawPoolAvatar::beginRenderPass(S32 pass) void LLDrawPoolAvatar::endRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_CHARACTERS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_CHARACTERS); if (LLPipeline::sImpostorRender) { @@ -1175,12 +1175,12 @@ void LLDrawPoolAvatar::endDeferredSkinned() gGL.getTexUnit(0)->activate(); } -static LLFastTimer::DeclareTimer FTM_RENDER_AVATARS("renderAvatars"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_AVATARS("renderAvatars"); void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) { - LLFastTimer t(FTM_RENDER_AVATARS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_AVATARS); if (pass == -1) { @@ -1460,7 +1460,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) if( !single_avatar || (avatarp == single_avatar) ) { - avatarp->renderSkinned(AVATAR_RENDER_PASS_SINGLE); + avatarp->renderSkinned(); } } @@ -1517,7 +1517,9 @@ void LLDrawPoolAvatar::getRiggedGeometry(LLFace* face, LLPointer<LLVertexBuffer> face->setPoolType(LLDrawPool::POOL_AVATAR); } - //let getGeometryVolume know if a texture matrix is in play + //LL_INFOS() << "Rebuilt face " << face->getTEOffset() << " of " << face->getDrawable() << " at " << gFrameTimeSeconds << LL_ENDL; + + // Let getGeometryVolume know if a texture matrix is in play if (face->mTextureMatrix) { face->setState(LLFace::TEXTURE_ANIM); @@ -1528,7 +1530,6 @@ void LLDrawPoolAvatar::getRiggedGeometry(LLFace* face, LLPointer<LLVertexBuffer> } - //llinfos << "Rebuilt face " << face->getTEOffset() << " of " << face->getDrawable() << " at " << gFrameTimeSeconds << llendl; face->getGeometryVolume(*volume, face->getTEOffset(), mat_vert, mat_normal, offset, true); buffer->flush(); @@ -1882,11 +1883,11 @@ void LLDrawPoolAvatar::renderDeferredRiggedMaterial(LLVOAvatar* avatar, S32 pass renderRigged(avatar, pass); } -static LLFastTimer::DeclareTimer FTM_RIGGED_VBO("Rigged VBO"); +static LLTrace::BlockTimerStatHandle FTM_RIGGED_VBO("Rigged VBO"); void LLDrawPoolAvatar::updateRiggedVertexBuffers(LLVOAvatar* avatar) { - LLFastTimer t(FTM_RIGGED_VBO); + LL_RECORD_BLOCK_TIME(FTM_RIGGED_VBO); //update rigged vertex buffers for (U32 type = 0; type < NUM_RIGGED_PASSES; ++type) @@ -2044,12 +2045,12 @@ void LLDrawPoolAvatar::addRiggedFace(LLFace* facep, U32 type) { if (type >= NUM_RIGGED_PASSES) { - llerrs << "Invalid rigged face type." << llendl; + LL_ERRS() << "Invalid rigged face type." << LL_ENDL; } if (facep->getRiggedIndex(type) != -1) { - llerrs << "Tried to add a rigged face that's referenced elsewhere." << llendl; + LL_ERRS() << "Tried to add a rigged face that's referenced elsewhere." << LL_ENDL; } facep->setRiggedIndex(type, mRiggedFace[type].size()); @@ -2078,7 +2079,7 @@ void LLDrawPoolAvatar::removeRiggedFace(LLFace* facep) } else { - llerrs << "Face reference data corrupt for rigged type " << i << llendl; + LL_ERRS() << "Face reference data corrupt for rigged type " << i << LL_ENDL; } } } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 6b4c5cfca1abce22d1c4e56a41ab1677b8ec11c4..211a96b32daf7e0564676deba92a916a3a8a1dbb 100755 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -104,7 +104,7 @@ void LLStandardBumpmap::addstandard() // can't assert; we destroyGL and restoreGL a lot during *first* startup, which populates this list already, THEN we explicitly init the list as part of *normal* startup. Sigh. So clear the list every time before we (re-)add the standard bumpmaps. //llassert( LLStandardBumpmap::sStandardBumpmapCount == 0 ); clear(); - llinfos << "Adding standard bumpmaps." << llendl; + LL_INFOS() << "Adding standard bumpmaps." << LL_ENDL; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("None"); // BE_NO_BUMP gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Brightness"); // BE_BRIGHTNESS gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount++] = LLStandardBumpmap("Darkness"); // BE_DARKNESS @@ -113,7 +113,7 @@ void LLStandardBumpmap::addstandard() LLFILE* file = LLFile::fopen( file_name, "rt" ); /*Flawfinder: ignore*/ if( !file ) { - llwarns << "Could not open std_bump <" << file_name << ">" << llendl; + LL_WARNS() << "Could not open std_bump <" << file_name << ">" << LL_ENDL; return; } @@ -122,13 +122,13 @@ void LLStandardBumpmap::addstandard() S32 fields_read = fscanf( file, "LLStandardBumpmap version %d", &file_version ); if( fields_read != 1 ) { - llwarns << "Bad LLStandardBumpmap header" << llendl; + LL_WARNS() << "Bad LLStandardBumpmap header" << LL_ENDL; return; } if( file_version > STD_BUMP_LATEST_FILE_VERSION ) { - llwarns << "LLStandardBumpmap has newer version (" << file_version << ") than viewer (" << STD_BUMP_LATEST_FILE_VERSION << ")" << llendl; + LL_WARNS() << "LLStandardBumpmap has newer version (" << file_version << ") than viewer (" << STD_BUMP_LATEST_FILE_VERSION << ")" << LL_ENDL; return; } @@ -145,11 +145,11 @@ void LLStandardBumpmap::addstandard() } if( fields_read != 2 ) { - llwarns << "Bad LLStandardBumpmap entry" << llendl; + LL_WARNS() << "Bad LLStandardBumpmap entry" << LL_ENDL; return; } -// llinfos << "Loading bumpmap: " << bump_image_id << " from viewerart" << llendl; +// LL_INFOS() << "Loading bumpmap: " << bump_image_id << " from viewerart" << LL_ENDL; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label; gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage = LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id)); @@ -165,7 +165,7 @@ void LLStandardBumpmap::addstandard() // static void LLStandardBumpmap::clear() { - llinfos << "Clearing standard bumpmaps." << llendl; + LL_INFOS() << "Clearing standard bumpmaps." << LL_ENDL; for( U32 i = 0; i < LLStandardBumpmap::sStandardBumpmapCount; i++ ) { gStandardBumpmapList[i].mLabel.assign(""); @@ -234,7 +234,7 @@ S32 LLDrawPoolBump::getNumPasses() void LLDrawPoolBump::beginRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_BUMP); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); switch( pass ) { case 0: @@ -261,7 +261,7 @@ void LLDrawPoolBump::beginRenderPass(S32 pass) void LLDrawPoolBump::render(S32 pass) { - LLFastTimer t(FTM_RENDER_BUMP); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); if (!gPipeline.hasRenderType(LLDrawPool::POOL_SIMPLE)) { @@ -294,7 +294,7 @@ void LLDrawPoolBump::render(S32 pass) void LLDrawPoolBump::endRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_BUMP); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); switch( pass ) { case 0: @@ -325,7 +325,7 @@ void LLDrawPoolBump::endRenderPass(S32 pass) //static void LLDrawPoolBump::beginShiny(bool invisible) { - LLFastTimer t(FTM_RENDER_SHINY); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| (invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))) { @@ -418,7 +418,7 @@ void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& di void LLDrawPoolBump::renderShiny(bool invisible) { - LLFastTimer t(FTM_RENDER_SHINY); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| (invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))) { @@ -479,7 +479,7 @@ void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& void LLDrawPoolBump::endShiny(bool invisible) { - LLFastTimer t(FTM_RENDER_SHINY); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| (invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))) { @@ -499,7 +499,7 @@ void LLDrawPoolBump::endShiny(bool invisible) void LLDrawPoolBump::beginFullbrightShiny() { - LLFastTimer t(FTM_RENDER_SHINY); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY)) { return; @@ -561,7 +561,7 @@ void LLDrawPoolBump::beginFullbrightShiny() void LLDrawPoolBump::renderFullbrightShiny() { - LLFastTimer t(FTM_RENDER_SHINY); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY)) { return; @@ -584,7 +584,7 @@ void LLDrawPoolBump::renderFullbrightShiny() void LLDrawPoolBump::endFullbrightShiny() { - LLFastTimer t(FTM_RENDER_SHINY); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY); if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY)) { return; @@ -715,7 +715,7 @@ void LLDrawPoolBump::beginBump(U32 pass) } sVertexMask = VERTEX_MASK_BUMP; - LLFastTimer t(FTM_RENDER_BUMP); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); // Optional second pass: emboss bump map stop_glerror(); @@ -767,7 +767,7 @@ void LLDrawPoolBump::renderBump(U32 pass) return; } - LLFastTimer ftm(FTM_RENDER_BUMP); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); LLGLDisable fog(GL_FOG); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_LEQUAL); LLGLEnable blend(GL_BLEND); @@ -823,7 +823,7 @@ void LLDrawPoolBump::beginDeferredPass(S32 pass) { return; } - LLFastTimer ftm(FTM_RENDER_BUMP); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); mShiny = TRUE; gDeferredBumpProgram.bind(); diffuse_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); @@ -838,7 +838,7 @@ void LLDrawPoolBump::endDeferredPass(S32 pass) { return; } - LLFastTimer ftm(FTM_RENDER_BUMP); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); mShiny = FALSE; gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::BUMP_MAP); @@ -852,7 +852,7 @@ void LLDrawPoolBump::renderDeferred(S32 pass) { return; } - LLFastTimer ftm(FTM_RENDER_BUMP); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP); U32 type = LLRenderPass::PASS_BUMP; LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); @@ -929,7 +929,7 @@ void LLBumpImageList::init() void LLBumpImageList::clear() { - llinfos << "Clearing dynamic bumpmaps." << llendl; + LL_INFOS() << "Clearing dynamic bumpmaps." << LL_ENDL; // these will be re-populated on-demand mBrightnessEntries.clear(); mDarknessEntries.clear(); @@ -1005,7 +1005,7 @@ void LLBumpImageList::updateImages() if( destroy ) { - //llinfos << "*** Destroying bright " << (void*)image << llendl; + //LL_INFOS() << "*** Destroying bright " << (void*)image << LL_ENDL; mBrightnessEntries.erase(curiter); // deletes the image thanks to reference counting } } @@ -1032,7 +1032,7 @@ void LLBumpImageList::updateImages() if( destroy ) { - //llinfos << "*** Destroying dark " << (void*)image << llendl;; + //LL_INFOS() << "*** Destroying dark " << (void*)image << LL_ENDL;; mDarknessEntries.erase(curiter); // deletes the image thanks to reference counting } } @@ -1095,7 +1095,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText } -static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_STANDARD_LOADED("Bump Standard Callback"); +static LLTrace::BlockTimerStatHandle FTM_BUMP_SOURCE_STANDARD_LOADED("Bump Standard Callback"); // static void LLBumpImageList::onSourceBrightnessLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ) @@ -1119,22 +1119,22 @@ void LLBumpImageList::onSourceDarknessLoaded( BOOL success, LLViewerFetchedTextu } } -static LLFastTimer::DeclareTimer FTM_BUMP_GEN_NORMAL("Generate Normal Map"); -static LLFastTimer::DeclareTimer FTM_BUMP_CREATE_TEXTURE("Create GL Normal Map"); +static LLTrace::BlockTimerStatHandle FTM_BUMP_GEN_NORMAL("Generate Normal Map"); +static LLTrace::BlockTimerStatHandle FTM_BUMP_CREATE_TEXTURE("Create GL Normal Map"); void LLBumpImageList::onSourceStandardLoaded( BOOL success, LLViewerFetchedTexture* src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) { if (success && LLPipeline::sRenderDeferred) { - LLFastTimer t(FTM_BUMP_SOURCE_STANDARD_LOADED); + LL_RECORD_BLOCK_TIME(FTM_BUMP_SOURCE_STANDARD_LOADED); LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4); { - LLFastTimer t(FTM_BUMP_GEN_NORMAL); + LL_RECORD_BLOCK_TIME(FTM_BUMP_GEN_NORMAL); generateNormalMapFromAlpha(src, nrm_image); } src_vi->setExplicitFormat(GL_RGBA, GL_RGBA); { - LLFastTimer t(FTM_BUMP_CREATE_TEXTURE); + LL_RECORD_BLOCK_TIME(FTM_BUMP_CREATE_TEXTURE); src_vi->createGLTexture(src_vi->getDiscardLevel(), nrm_image); } } @@ -1196,27 +1196,27 @@ void LLBumpImageList::generateNormalMapFromAlpha(LLImageRaw* src, LLImageRaw* nr } -static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_LOADED("Bump Source Loaded"); -static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_ENTRIES_UPDATE("Entries Update"); -static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_MIN_MAX("Min/Max"); -static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_RGB2LUM("RGB to Luminance"); -static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_RESCALE("Rescale"); -static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_GEN_NORMAL("Generate Normal"); -static LLFastTimer::DeclareTimer FTM_BUMP_SOURCE_CREATE("Bump Source Create"); +static LLTrace::BlockTimerStatHandle FTM_BUMP_SOURCE_LOADED("Bump Source Loaded"); +static LLTrace::BlockTimerStatHandle FTM_BUMP_SOURCE_ENTRIES_UPDATE("Entries Update"); +static LLTrace::BlockTimerStatHandle FTM_BUMP_SOURCE_MIN_MAX("Min/Max"); +static LLTrace::BlockTimerStatHandle FTM_BUMP_SOURCE_RGB2LUM("RGB to Luminance"); +static LLTrace::BlockTimerStatHandle FTM_BUMP_SOURCE_RESCALE("Rescale"); +static LLTrace::BlockTimerStatHandle FTM_BUMP_SOURCE_GEN_NORMAL("Generate Normal"); +static LLTrace::BlockTimerStatHandle FTM_BUMP_SOURCE_CREATE("Bump Source Create"); // static void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLImageRaw* src, LLUUID& source_asset_id, EBumpEffect bump_code ) { if( success ) { - LLFastTimer t(FTM_BUMP_SOURCE_LOADED); + LL_RECORD_BLOCK_TIME(FTM_BUMP_SOURCE_LOADED); bump_image_map_t& entries_list(bump_code == BE_BRIGHTNESS ? gBumpImageList.mBrightnessEntries : gBumpImageList.mDarknessEntries ); bump_image_map_t::iterator iter = entries_list.find(source_asset_id); { - LLFastTimer t(FTM_BUMP_SOURCE_ENTRIES_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_BUMP_SOURCE_ENTRIES_UPDATE); if (iter == entries_list.end() || iter->second.isNull() || iter->second->getWidth() != src->getWidth() || @@ -1259,7 +1259,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI case 1: case 2: { - LLFastTimer t(FTM_BUMP_SOURCE_MIN_MAX); + LL_RECORD_BLOCK_TIME(FTM_BUMP_SOURCE_MIN_MAX); if( src_data_size == dst_data_size * src_components ) { for( S32 i = 0, j=0; i < dst_data_size; i++, j+= src_components ) @@ -1285,7 +1285,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI case 3: case 4: { - LLFastTimer t(FTM_BUMP_SOURCE_RGB2LUM); + LL_RECORD_BLOCK_TIME(FTM_BUMP_SOURCE_RGB2LUM); if( src_data_size == dst_data_size * src_components ) { for( S32 i = 0, j=0; i < dst_data_size; i++, j+= src_components ) @@ -1318,7 +1318,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI if( maximum > minimum ) { - LLFastTimer t(FTM_BUMP_SOURCE_RESCALE); + LL_RECORD_BLOCK_TIME(FTM_BUMP_SOURCE_RESCALE); U8 bias_and_scale_lut[256]; F32 twice_one_over_range = 2.f / (maximum - minimum); S32 i; @@ -1354,7 +1354,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI if (!LLPipeline::sRenderDeferred) { - LLFastTimer t(FTM_BUMP_SOURCE_CREATE); + LL_RECORD_BLOCK_TIME(FTM_BUMP_SOURCE_CREATE); bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA); bump->createGLTexture(0, dst_image); } @@ -1365,13 +1365,13 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI bump->getGLTexture()->setAllowCompression(false); { - LLFastTimer t(FTM_BUMP_SOURCE_CREATE); + LL_RECORD_BLOCK_TIME(FTM_BUMP_SOURCE_CREATE); bump->setExplicitFormat(GL_RGBA8, GL_ALPHA); bump->createGLTexture(0, dst_image); } { - LLFastTimer t(FTM_BUMP_SOURCE_GEN_NORMAL); + LL_RECORD_BLOCK_TIME(FTM_BUMP_SOURCE_GEN_NORMAL); gPipeline.mScreen.bindTarget(); LLGLDepthTest depth(GL_FALSE); @@ -1568,7 +1568,7 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL void LLDrawPoolInvisible::render(S32 pass) { //render invisiprims - LLFastTimer t(FTM_RENDER_INVISIBLE); + LL_RECORD_BLOCK_TIME(FTM_RENDER_INVISIBLE); if (gPipeline.canUseVertexShaders()) { @@ -1608,7 +1608,7 @@ void LLDrawPoolInvisible::endDeferredPass( S32 pass ) void LLDrawPoolInvisible::renderDeferred( S32 pass ) { //render invisiprims; this doesn't work becaue it also blocks all the post-deferred stuff #if 0 - LLFastTimer t(FTM_RENDER_INVISIBLE); + LL_RECORD_BLOCK_TIME(FTM_RENDER_INVISIBLE); U32 invisi_mask = LLVertexBuffer::MAP_VERTEX; glStencilMask(0); diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index d1b508065036b0d7ea5fd7f12193d5f08198b242..514411aef5ad20059a50ea1810899d5c4799b67b 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -82,12 +82,12 @@ void LLDrawPoolMaterials::beginDeferredPass(S32 pass) diffuse_channel = mShader->enableTexture(LLShaderMgr::DIFFUSE_MAP); - LLFastTimer t(FTM_RENDER_MATERIALS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_MATERIALS); } void LLDrawPoolMaterials::endDeferredPass(S32 pass) { - LLFastTimer t(FTM_RENDER_MATERIALS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_MATERIALS); mShader->unbind(); diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 0bc7ae766c9cedadc61b0d7eb534c2b9d3c36afd..bd180de6c608ef9a6cf5c3c3ca110bea43a0151e 100755 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -40,8 +40,8 @@ static LLGLSLShader* simple_shader = NULL; static LLGLSLShader* fullbright_shader = NULL; -static LLFastTimer::DeclareTimer FTM_RENDER_SIMPLE_DEFERRED("Deferred Simple"); -static LLFastTimer::DeclareTimer FTM_RENDER_GRASS_DEFERRED("Deferred Grass"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_SIMPLE_DEFERRED("Deferred Simple"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_GRASS_DEFERRED("Deferred Grass"); void LLDrawPoolGlow::beginPostDeferredPass(S32 pass) { @@ -49,11 +49,11 @@ void LLDrawPoolGlow::beginPostDeferredPass(S32 pass) gDeferredEmissiveProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); } -static LLFastTimer::DeclareTimer FTM_RENDER_GLOW_PUSH("Glow Push"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_GLOW_PUSH("Glow Push"); void LLDrawPoolGlow::renderPostDeferred(S32 pass) { - LLFastTimer t(FTM_RENDER_GLOW); + LL_RECORD_BLOCK_TIME(FTM_RENDER_GLOW); LLGLEnable blend(GL_BLEND); LLGLDisable test(GL_ALPHA_TEST); gGL.flush(); @@ -66,7 +66,7 @@ void LLDrawPoolGlow::renderPostDeferred(S32 pass) gGL.setColorMask(false, true); { - LLFastTimer t(FTM_RENDER_GLOW_PUSH); + LL_RECORD_BLOCK_TIME(FTM_RENDER_GLOW_PUSH); pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); } @@ -94,7 +94,7 @@ S32 LLDrawPoolGlow::getNumPasses() void LLDrawPoolGlow::render(S32 pass) { - LLFastTimer t(FTM_RENDER_GLOW); + LL_RECORD_BLOCK_TIME(FTM_RENDER_GLOW); LLGLEnable blend(GL_BLEND); LLGLDisable test(GL_ALPHA_TEST); gGL.flush(); @@ -152,7 +152,7 @@ void LLDrawPoolSimple::prerender() void LLDrawPoolSimple::beginRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_SIMPLE); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE); if (LLPipeline::sImpostorRender) { @@ -183,7 +183,7 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass) void LLDrawPoolSimple::endRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_SIMPLE); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE); stop_glerror(); LLRenderPass::endRenderPass(pass); stop_glerror(); @@ -198,7 +198,7 @@ void LLDrawPoolSimple::render(S32 pass) LLGLDisable blend(GL_BLEND); { //render simple - LLFastTimer t(FTM_RENDER_SIMPLE); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE); gPipeline.enableLightsDynamic(); if (mVertexShaderLevel > 0) @@ -235,7 +235,7 @@ void LLDrawPoolSimple::render(S32 pass) -static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_MASK("Alpha Mask"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MASK("Alpha Mask"); LLDrawPoolAlphaMask::LLDrawPoolAlphaMask() : LLRenderPass(POOL_ALPHA_MASK) @@ -249,7 +249,7 @@ void LLDrawPoolAlphaMask::prerender() void LLDrawPoolAlphaMask::beginRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_ALPHA_MASK); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK); if (LLPipeline::sUnderWaterRender) { @@ -276,7 +276,7 @@ void LLDrawPoolAlphaMask::beginRenderPass(S32 pass) void LLDrawPoolAlphaMask::endRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_ALPHA_MASK); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK); stop_glerror(); LLRenderPass::endRenderPass(pass); stop_glerror(); @@ -289,7 +289,7 @@ void LLDrawPoolAlphaMask::endRenderPass(S32 pass) void LLDrawPoolAlphaMask::render(S32 pass) { LLGLDisable blend(GL_BLEND); - LLFastTimer t(FTM_RENDER_ALPHA_MASK); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK); if (mVertexShaderLevel > 0) { @@ -322,7 +322,7 @@ void LLDrawPoolFullbrightAlphaMask::prerender() void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_ALPHA_MASK); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK); if (LLPipeline::sUnderWaterRender) { @@ -349,7 +349,7 @@ void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass) void LLDrawPoolFullbrightAlphaMask::endRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_ALPHA_MASK); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK); stop_glerror(); LLRenderPass::endRenderPass(pass); stop_glerror(); @@ -361,7 +361,7 @@ void LLDrawPoolFullbrightAlphaMask::endRenderPass(S32 pass) void LLDrawPoolFullbrightAlphaMask::render(S32 pass) { - LLFastTimer t(FTM_RENDER_ALPHA_MASK); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK); if (mVertexShaderLevel > 0) { @@ -395,13 +395,13 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass) void LLDrawPoolSimple::beginDeferredPass(S32 pass) { - LLFastTimer t(FTM_RENDER_SIMPLE_DEFERRED); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE_DEFERRED); gDeferredDiffuseProgram.bind(); } void LLDrawPoolSimple::endDeferredPass(S32 pass) { - LLFastTimer t(FTM_RENDER_SIMPLE_DEFERRED); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE_DEFERRED); LLRenderPass::endRenderPass(pass); gDeferredDiffuseProgram.unbind(); @@ -413,12 +413,12 @@ void LLDrawPoolSimple::renderDeferred(S32 pass) LLGLDisable alpha_test(GL_ALPHA_TEST); { //render simple - LLFastTimer t(FTM_RENDER_SIMPLE_DEFERRED); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE_DEFERRED); pushBatches(LLRenderPass::PASS_SIMPLE, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); } } -static LLFastTimer::DeclareTimer FTM_RENDER_ALPHA_MASK_DEFERRED("Deferred Alpha Mask"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MASK_DEFERRED("Deferred Alpha Mask"); void LLDrawPoolAlphaMask::beginDeferredPass(S32 pass) { @@ -432,7 +432,7 @@ void LLDrawPoolAlphaMask::endDeferredPass(S32 pass) void LLDrawPoolAlphaMask::renderDeferred(S32 pass) { - LLFastTimer t(FTM_RENDER_ALPHA_MASK_DEFERRED); + LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK_DEFERRED); gDeferredDiffuseAlphaMaskProgram.bind(); gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f); pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); @@ -455,7 +455,7 @@ void LLDrawPoolGrass::prerender() void LLDrawPoolGrass::beginRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_GRASS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS); stop_glerror(); if (LLPipeline::sUnderWaterRender) @@ -485,7 +485,7 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass) void LLDrawPoolGrass::endRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_GRASS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS); LLRenderPass::endRenderPass(pass); if (mVertexShaderLevel > 0) @@ -503,7 +503,7 @@ void LLDrawPoolGrass::render(S32 pass) LLGLDisable blend(GL_BLEND); { - LLFastTimer t(FTM_RENDER_GRASS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS); LLGLEnable test(GL_ALPHA_TEST); gGL.setSceneBlendType(LLRender::BT_ALPHA); //render grass @@ -524,7 +524,7 @@ void LLDrawPoolGrass::endDeferredPass(S32 pass) void LLDrawPoolGrass::renderDeferred(S32 pass) { { - LLFastTimer t(FTM_RENDER_GRASS_DEFERRED); + LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS_DEFERRED); gDeferredNonIndexedDiffuseAlphaMaskProgram.bind(); gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f); //render grass @@ -559,7 +559,7 @@ void LLDrawPoolFullbright::beginPostDeferredPass(S32 pass) void LLDrawPoolFullbright::renderPostDeferred(S32 pass) { - LLFastTimer t(FTM_RENDER_FULLBRIGHT); + LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT); gGL.setSceneBlendType(LLRender::BT_ALPHA); U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; @@ -581,7 +581,7 @@ void LLDrawPoolFullbright::endPostDeferredPass(S32 pass) void LLDrawPoolFullbright::beginRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_FULLBRIGHT); + LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT); if (LLPipeline::sUnderWaterRender) { @@ -595,7 +595,7 @@ void LLDrawPoolFullbright::beginRenderPass(S32 pass) void LLDrawPoolFullbright::endRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_FULLBRIGHT); + LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT); LLRenderPass::endRenderPass(pass); stop_glerror(); @@ -610,7 +610,7 @@ void LLDrawPoolFullbright::endRenderPass(S32 pass) void LLDrawPoolFullbright::render(S32 pass) { //render fullbright - LLFastTimer t(FTM_RENDER_FULLBRIGHT); + LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT); gGL.setSceneBlendType(LLRender::BT_ALPHA); stop_glerror(); @@ -673,7 +673,7 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass) void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass) { - LLFastTimer t(FTM_RENDER_FULLBRIGHT); + LL_RECORD_BLOCK_TIME(FTM_RENDER_FULLBRIGHT); LLGLDisable blend(GL_BLEND); U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, fullbright_mask, TRUE, TRUE); diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp index ef8bdc33048e2bc217277ee894203bd8d80b3a9b..bdb16abc78c23ffac3e67aefb0a8d0b7d4adec97 100755 --- a/indra/newview/lldrawpoolsky.cpp +++ b/indra/newview/lldrawpoolsky.cpp @@ -28,8 +28,6 @@ #include "lldrawpoolsky.h" -#include "imageids.h" - #include "llagent.h" #include "lldrawable.h" #include "llface.h" diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index c3ec23422310786c2176ab2d970709cfd2b49f3f..33ce3d0111029750751d20074f84bb559b4cfb6f 100755 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -55,7 +55,7 @@ int DebugDetailMap = 0; S32 LLDrawPoolTerrain::sDetailMode = 1; F32 LLDrawPoolTerrain::sDetailScale = DETAIL_SCALE; static LLGLSLShader* sShader = NULL; -static LLFastTimer::DeclareTimer FTM_SHADOW_TERRAIN("Terrain Shadow"); +static LLTrace::BlockTimerStatHandle FTM_SHADOW_TERRAIN("Terrain Shadow"); LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : @@ -129,7 +129,7 @@ void LLDrawPoolTerrain::prerender() void LLDrawPoolTerrain::beginRenderPass( S32 pass ) { - LLFastTimer t(FTM_RENDER_TERRAIN); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); LLFacePool::beginRenderPass(pass); sShader = LLPipeline::sUnderWaterRender ? @@ -144,7 +144,7 @@ void LLDrawPoolTerrain::beginRenderPass( S32 pass ) void LLDrawPoolTerrain::endRenderPass( S32 pass ) { - LLFastTimer t(FTM_RENDER_TERRAIN); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); //LLFacePool::endRenderPass(pass); if (mVertexShaderLevel > 1 && sShader->mShaderLevel > 0) { @@ -160,7 +160,7 @@ S32 LLDrawPoolTerrain::getDetailMode() void LLDrawPoolTerrain::render(S32 pass) { - LLFastTimer t(FTM_RENDER_TERRAIN); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); if (mDrawFace.empty()) { @@ -243,7 +243,7 @@ void LLDrawPoolTerrain::render(S32 pass) void LLDrawPoolTerrain::beginDeferredPass(S32 pass) { - LLFastTimer t(FTM_RENDER_TERRAIN); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); LLFacePool::beginRenderPass(pass); sShader = &gDeferredTerrainProgram; @@ -253,14 +253,14 @@ void LLDrawPoolTerrain::beginDeferredPass(S32 pass) void LLDrawPoolTerrain::endDeferredPass(S32 pass) { - LLFastTimer t(FTM_RENDER_TERRAIN); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); LLFacePool::endRenderPass(pass); sShader->unbind(); } void LLDrawPoolTerrain::renderDeferred(S32 pass) { - LLFastTimer t(FTM_RENDER_TERRAIN); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN); if (mDrawFace.empty()) { return; @@ -270,7 +270,7 @@ void LLDrawPoolTerrain::renderDeferred(S32 pass) void LLDrawPoolTerrain::beginShadowPass(S32 pass) { - LLFastTimer t(FTM_SHADOW_TERRAIN); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN); LLFacePool::beginRenderPass(pass); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gDeferredShadowProgram.bind(); @@ -278,14 +278,14 @@ void LLDrawPoolTerrain::beginShadowPass(S32 pass) void LLDrawPoolTerrain::endShadowPass(S32 pass) { - LLFastTimer t(FTM_SHADOW_TERRAIN); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN); LLFacePool::endRenderPass(pass); gDeferredShadowProgram.unbind(); } void LLDrawPoolTerrain::renderShadow(S32 pass) { - LLFastTimer t(FTM_SHADOW_TERRAIN); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN); if (mDrawFace.empty()) { return; diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index fedbd782dcb8e60e85dd5f58ce735559021e90cf..b1f40781f73e5bcdccd50ac111e41d928b8492cc 100755 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -41,7 +41,7 @@ S32 LLDrawPoolTree::sDiffTex = 0; static LLGLSLShader* shader = NULL; -static LLFastTimer::DeclareTimer FTM_SHADOW_TREE("Tree Shadow"); +static LLTrace::BlockTimerStatHandle FTM_SHADOW_TREE("Tree Shadow"); LLDrawPoolTree::LLDrawPoolTree(LLViewerTexture *texturep) : LLFacePool(POOL_TREE), @@ -62,7 +62,7 @@ void LLDrawPoolTree::prerender() void LLDrawPoolTree::beginRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_TREES); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES); if (LLPipeline::sUnderWaterRender) { @@ -88,7 +88,7 @@ void LLDrawPoolTree::beginRenderPass(S32 pass) void LLDrawPoolTree::render(S32 pass) { - LLFastTimer t(LLPipeline::sShadowRender ? FTM_SHADOW_TREE : FTM_RENDER_TREES); + LL_RECORD_BLOCK_TIME(LLPipeline::sShadowRender ? FTM_SHADOW_TREE : FTM_RENDER_TREES); if (mDrawFace.empty()) { @@ -131,7 +131,7 @@ void LLDrawPoolTree::render(S32 pass) void LLDrawPoolTree::endRenderPass(S32 pass) { - LLFastTimer t(FTM_RENDER_TREES); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES); if (gPipeline.canUseWindLightShadersOnObjects()) { @@ -149,7 +149,7 @@ void LLDrawPoolTree::endRenderPass(S32 pass) //============================================ void LLDrawPoolTree::beginDeferredPass(S32 pass) { - LLFastTimer t(FTM_RENDER_TREES); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES); shader = &gDeferredTreeProgram; shader->bind(); @@ -163,7 +163,7 @@ void LLDrawPoolTree::renderDeferred(S32 pass) void LLDrawPoolTree::endDeferredPass(S32 pass) { - LLFastTimer t(FTM_RENDER_TREES); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES); shader->unbind(); } @@ -173,7 +173,7 @@ void LLDrawPoolTree::endDeferredPass(S32 pass) //============================================ void LLDrawPoolTree::beginShadowPass(S32 pass) { - LLFastTimer t(FTM_SHADOW_TREE); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_TREE); glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"), gSavedSettings.getF32("RenderDeferredTreeShadowBias")); @@ -189,7 +189,7 @@ void LLDrawPoolTree::renderShadow(S32 pass) void LLDrawPoolTree::endShadowPass(S32 pass) { - LLFastTimer t(FTM_SHADOW_TREE); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_TREE); glPolygonOffset(gSavedSettings.getF32("RenderDeferredSpotShadowOffset"), gSavedSettings.getF32("RenderDeferredSpotShadowBias")); diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 76e89b26e4384776750b99169802448a84e89c39..df06ad31e6d1919cdc3c1495541cce801bd9dff8 100755 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -98,7 +98,7 @@ void LLDrawPoolWater::restoreGL() LLDrawPool *LLDrawPoolWater::instancePool() { - llerrs << "Should never be calling instancePool on a water pool!" << llendl; + LL_ERRS() << "Should never be calling instancePool on a water pool!" << LL_ENDL; return NULL; } @@ -142,7 +142,7 @@ void LLDrawPoolWater::endPostDeferredPass(S32 pass) //=============================== void LLDrawPoolWater::renderDeferred(S32 pass) { - LLFastTimer t(FTM_RENDER_WATER); + LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); deferred_render = TRUE; shade(); deferred_render = FALSE; @@ -152,7 +152,7 @@ void LLDrawPoolWater::renderDeferred(S32 pass) void LLDrawPoolWater::render(S32 pass) { - LLFastTimer ftm(FTM_RENDER_WATER); + LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER); if (mDrawFace.empty() || LLDrawable::getCurrentFrame() <= 1) { return; @@ -463,7 +463,7 @@ void LLDrawPoolWater::renderReflection(LLFace* face) gGL.getTexUnit(0)->bind(mHBTex[dr]); - LLOverrideFaceColor override(this, face->getFaceColor().mV); + LLOverrideFaceColor override(this, LLColor4(face->getFaceColor().mV)); face->renderIndexed(); } diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index a98d3e6b051a1ea132fdb4677944e034ec356fb8..309f535c39174e0bce708b29e87921b0dbfce6d8 100755 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -54,12 +54,12 @@ LLDrawPoolWLSky::LLDrawPoolWLSky(void) : LLDrawPool(POOL_WL_SKY) { const std::string cloudNoiseFilename(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "clouds2.tga")); - llinfos << "loading WindLight cloud noise from " << cloudNoiseFilename << llendl; + LL_INFOS() << "loading WindLight cloud noise from " << cloudNoiseFilename << LL_ENDL; LLPointer<LLImageFormatted> cloudNoiseFile(LLImageFormatted::createFromExtension(cloudNoiseFilename)); if(cloudNoiseFile.isNull()) { - llerrs << "Error: Failed to load cloud noise image " << cloudNoiseFilename << llendl; + LL_ERRS() << "Error: Failed to load cloud noise image " << cloudNoiseFilename << LL_ENDL; } if(cloudNoiseFile->load(cloudNoiseFilename)) @@ -69,8 +69,8 @@ LLDrawPoolWLSky::LLDrawPoolWLSky(void) : if(cloudNoiseFile->decode(sCloudNoiseRawImage, 0.0f)) { //debug use - lldebugs << "cloud noise raw image width: " << sCloudNoiseRawImage->getWidth() << " : height: " << sCloudNoiseRawImage->getHeight() << " : components: " << - (S32)sCloudNoiseRawImage->getComponents() << " : data size: " << sCloudNoiseRawImage->getDataSize() << llendl ; + LL_DEBUGS() << "cloud noise raw image width: " << sCloudNoiseRawImage->getWidth() << " : height: " << sCloudNoiseRawImage->getHeight() << " : components: " << + (S32)sCloudNoiseRawImage->getComponents() << " : data size: " << sCloudNoiseRawImage->getDataSize() << LL_ENDL ; llassert_always(sCloudNoiseRawImage->getData()) ; sCloudNoiseTexture = LLViewerTextureManager::getLocalTexture(sCloudNoiseRawImage.get(), TRUE); @@ -86,7 +86,7 @@ LLDrawPoolWLSky::LLDrawPoolWLSky(void) : LLDrawPoolWLSky::~LLDrawPoolWLSky() { - //llinfos << "destructing wlsky draw pool." << llendl; + //LL_INFOS() << "destructing wlsky draw pool." << LL_ENDL; sCloudNoiseTexture = NULL; sCloudNoiseRawImage = NULL; } @@ -197,7 +197,7 @@ void LLDrawPoolWLSky::renderStars(void) const // If start_brightness is not set, exit if( error ) { - llwarns << "star_brightness missing in mCurParams" << llendl; + LL_WARNS() << "star_brightness missing in mCurParams" << LL_ENDL; return; } @@ -308,7 +308,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) { return; } - LLFastTimer ftm(FTM_RENDER_WL_SKY); + LL_RECORD_BLOCK_TIME(FTM_RENDER_WL_SKY); const F32 camHeightLocal = LLWLParamManager::getInstance()->getDomeOffset() * LLWLParamManager::getInstance()->getDomeRadius(); @@ -355,7 +355,7 @@ void LLDrawPoolWLSky::render(S32 pass) { return; } - LLFastTimer ftm(FTM_RENDER_WL_SKY); + LL_RECORD_BLOCK_TIME(FTM_RENDER_WL_SKY); const F32 camHeightLocal = LLWLParamManager::getInstance()->getDomeOffset() * LLWLParamManager::getInstance()->getDomeRadius(); @@ -391,7 +391,7 @@ void LLDrawPoolWLSky::render(S32 pass) void LLDrawPoolWLSky::prerender() { - //llinfos << "wlsky prerendering pass." << llendl; + //LL_INFOS() << "wlsky prerendering pass." << LL_ENDL; } LLDrawPoolWLSky *LLDrawPoolWLSky::instancePool() diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 29ad4f34d25b2378c76772d1b5e59826273f2da1..fa9a0712fa4185cdbb2f0164ae77cec76370e008 100755 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -99,7 +99,7 @@ void LLViewerDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum { if (mComponents < 1 || mComponents > 4) { - llerrs << "Bad number of components in dynamic texture: " << mComponents << llendl; + LL_ERRS() << "Bad number of components in dynamic texture: " << mComponents << LL_ENDL; } LLPointer<LLImageRaw> raw_image = new LLImageRaw(mFullWidth, mFullHeight, mComponents); diff --git a/indra/newview/lldynamictexture.h b/indra/newview/lldynamictexture.h index d287ae6eebab25d83da53b8aa33bc0f4bb67c140..f3f57c9a6b2752e110021c3733afbb33bfdd4aca 100755 --- a/indra/newview/lldynamictexture.h +++ b/indra/newview/lldynamictexture.h @@ -38,12 +38,12 @@ class LLViewerDynamicTexture : public LLViewerTexture public: void* operator new(size_t size) { - return ll_aligned_malloc_16(size); + return LLTrace::MemTrackable<LLTexture>::aligned_new<16>(size); } - void operator delete(void* ptr) + void operator delete(void* ptr, size_t size) { - ll_aligned_free_16(ptr); + LLTrace::MemTrackable<LLTexture>::aligned_delete<16>(ptr, size); } enum diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index 589cf28615ac2a0e1d1342b3cb680765c93284a8..41d378fea14f11ec06ac6650c0bebce31ee0604f 100755 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -40,7 +40,7 @@ std::string LLEnvPrefs::getWaterPresetName() const { if (mWaterPresetName.empty()) { - llwarns << "Water preset name is empty" << llendl; + LL_WARNS() << "Water preset name is empty" << LL_ENDL; } return mWaterPresetName; @@ -50,7 +50,7 @@ std::string LLEnvPrefs::getSkyPresetName() const { if (mSkyPresetName.empty()) { - llwarns << "Sky preset name is empty" << llendl; + LL_WARNS() << "Sky preset name is empty" << LL_ENDL; } return mSkyPresetName; @@ -60,7 +60,7 @@ std::string LLEnvPrefs::getDayCycleName() const { if (mDayCycleName.empty()) { - llwarns << "Day cycle name is empty" << llendl; + LL_WARNS() << "Day cycle name is empty" << LL_ENDL; } return mDayCycleName; @@ -201,7 +201,7 @@ bool LLEnvManagerNew::useSkyPreset(const std::string& name) if (!sky_mgr.getParamSet(LLWLParamKey(name, LLEnvKey::SCOPE_LOCAL), param_set)) { - llwarns << "No sky preset named " << name << llendl; + LL_WARNS() << "No sky preset named " << name << LL_ENDL; return false; } @@ -232,7 +232,7 @@ bool LLEnvManagerNew::useDayCycle(const std::string& name, LLEnvKey::EScope scop if (!LLDayCycleManager::instance().getPreset(name, params)) { - llwarns << "No day cycle named " << name << llendl; + LL_WARNS() << "No day cycle named " << name << LL_ENDL; return false; } } @@ -260,7 +260,7 @@ void LLEnvManagerNew::setUseWaterPreset(const std::string& name) // *TODO: make sure the preset exists. if (name.empty()) { - llwarns << "Empty water preset name passed" << llendl; + LL_WARNS() << "Empty water preset name passed" << LL_ENDL; return; } @@ -274,7 +274,7 @@ void LLEnvManagerNew::setUseSkyPreset(const std::string& name) // *TODO: make sure the preset exists. if (name.empty()) { - llwarns << "Empty sky preset name passed" << llendl; + LL_WARNS() << "Empty sky preset name passed" << LL_ENDL; return; } @@ -287,7 +287,7 @@ void LLEnvManagerNew::setUseDayCycle(const std::string& name) { if (!LLDayCycleManager::instance().presetExists(name)) { - llwarns << "Invalid day cycle name passed" << llendl; + LL_WARNS() << "Invalid day cycle name passed" << LL_ENDL; return; } @@ -574,7 +574,7 @@ void LLEnvManagerNew::updateWaterFromPrefs(bool interpolate) LLWaterParamSet params; if (!water_mgr.getParamSet(water, params)) { - llwarns << "No water preset named " << water << ", falling back to defaults" << llendl; + LL_WARNS() << "No water preset named " << water << ", falling back to defaults" << LL_ENDL; water_mgr.getParamSet("Default", params); // *TODO: Fix user preferences accordingly. @@ -654,19 +654,19 @@ void LLEnvManagerNew::onRegionChange() LLUUID region_uuid = regionp ? regionp->getRegionID() : LLUUID::null; if (region_uuid != mCurRegionUUID) { - // Clear locally modified region settings. - mNewRegionPrefs.clear(); + // Clear locally modified region settings. + mNewRegionPrefs.clear(); - // *TODO: clear environment settings of the previous region? + // *TODO: clear environment settings of the previous region? - // Request environment settings of the new region. - mCurRegionUUID = region_uuid; + // Request environment settings of the new region. + mCurRegionUUID = region_uuid; // for region crossings, interpolate the change; for teleports, don't mInterpNextChangeMessage = (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE); LL_DEBUGS("Windlight") << (mInterpNextChangeMessage ? "Crossed" : "Teleported") << " to new region: " << region_uuid << LL_ENDL; - requestRegionSettings(); + requestRegionSettings(); } else { diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp index 2669b0340fbef96ce1b72b8114fda1c77326d13a..761adc59424690c98363d3306e796a6e7b95c2b8 100755 --- a/indra/newview/llestateinfomodel.cpp +++ b/indra/newview/llestateinfomodel.cpp @@ -93,7 +93,7 @@ void LLEstateInfoModel::update(const strings_t& strings) LL_DEBUGS("Windlight Sync") << "Received estate info: " << "is_sun_fixed = " << getUseFixedSun() << ", sun_hour = " << getSunHour() << LL_ENDL; - lldebugs << getInfoDump() << llendl; + LL_DEBUGS() << getInfoDump() << LL_ENDL; // Update region owner. LLViewerRegion* regionp = gAgent.getRegion(); @@ -117,14 +117,14 @@ class LLEstateChangeInfoResponder : public LLHTTPClient::Responder // if we get a normal response, handle it here virtual void result(const LLSD& content) { - llinfos << "Committed estate info" << llendl; + LL_INFOS() << "Committed estate info" << LL_ENDL; LLEstateInfoModel::instance().notifyCommit(); } // if we get an error response virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "Failed to commit estate info [status:" << status << "]: " << content << llendl; + LL_WARNS() << "Failed to commit estate info [status:" << status << "]: " << content << LL_ENDL; } }; @@ -155,7 +155,7 @@ bool LLEstateInfoModel::commitEstateInfoCaps() LL_DEBUGS("Windlight Sync") << "Sending estate caps: " << "is_sun_fixed = " << getUseFixedSun() << ", sun_hour = " << getSunHour() << LL_ENDL; - lldebugs << body << LL_ENDL; + LL_DEBUGS() << body << LL_ENDL; // we use a responder so that we can re-get the data after committing to the database LLHTTPClient::post(url, body, new LLEstateChangeInfoResponder); @@ -174,7 +174,7 @@ void LLEstateInfoModel::commitEstateInfoDataserver() LL_DEBUGS("Windlight Sync") << "Sending estate info: " << "is_sun_fixed = " << getUseFixedSun() << ", sun_hour = " << getSunHour() << LL_ENDL; - lldebugs << getInfoDump() << LL_ENDL; + LL_DEBUGS() << getInfoDump() << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessage("EstateOwnerMessage"); diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp index bedab75f98293593ff32c308e2ad629937a021df..e3c17f98777a0396f3595c9ae09e7c5388421208 100755 --- a/indra/newview/lleventnotifier.cpp +++ b/indra/newview/lleventnotifier.cpp @@ -167,7 +167,7 @@ bool LLEventNotifier::add(U32 eventId, F64 eventEpoch, const std::string& eventD { LLEventNotification *new_enp = new LLEventNotification(eventId, eventEpoch, eventDateStr, eventName); - llinfos << "Add event " << eventName << " id " << eventId << " date " << eventDateStr << llendl; + LL_INFOS() << "Add event " << eventName << " id " << eventId << " date " << eventDateStr << LL_ENDL; if(!new_enp->isValid()) { delete new_enp; diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index c1630318e8dcd45c06d86d4053c1e0ab8a5d2909..fbd9466afe3360a204aafef7f0e06eda4d53ff84 100755 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -109,15 +109,15 @@ namespace const std::string& pollURL, const LLHost& sender) { LLHTTPClient::ResponderPtr result = new LLEventPollResponder(pollURL, sender); - llinfos << "LLEventPollResponder::start <" << sCount << "> " - << pollURL << llendl; + LL_INFOS() << "LLEventPollResponder::start <" << sCount << "> " + << pollURL << LL_ENDL; return result; } void LLEventPollResponder::stop() { - llinfos << "LLEventPollResponder::stop <" << mCount << "> " - << mPollURL << llendl; + LL_INFOS() << "LLEventPollResponder::stop <" << mCount << "> " + << mPollURL << LL_ENDL; // there should be a way to stop a LLHTTPClient request in progress mDone = true; } @@ -134,18 +134,18 @@ namespace LLViewerRegion *regionp = gAgent.getRegion(); if (!regionp) { - llerrs << "LLEventPoll initialized before region is added." << llendl; + LL_ERRS() << "LLEventPoll initialized before region is added." << LL_ENDL; } mSender = sender.getIPandPort(); - llinfos << "LLEventPoll initialized with sender " << mSender << llendl; + LL_INFOS() << "LLEventPoll initialized with sender " << mSender << LL_ENDL; makeRequest(); } LLEventPollResponder::~LLEventPollResponder() { stop(); - lldebugs << "LLEventPollResponder::~Impl <" << mCount << "> " - << mPollURL << llendl; + LL_DEBUGS() << "LLEventPollResponder::~Impl <" << mCount << "> " + << mPollURL << LL_ENDL; } // virtual @@ -172,8 +172,8 @@ namespace request["ack"] = mAcknowledge; request["done"] = mDone; - lldebugs << "LLEventPollResponder::makeRequest <" << mCount << "> ack = " - << LLSDXMLStreamer(mAcknowledge) << llendl; + LL_DEBUGS() << "LLEventPollResponder::makeRequest <" << mCount << "> ack = " + << LLSDXMLStreamer(mAcknowledge) << LL_ENDL; LLHTTPClient::post(mPollURL, request, this); } @@ -207,13 +207,13 @@ namespace + mErrorCount * EVENT_POLL_ERROR_RETRY_SECONDS_INC , this); - llwarns << "LLEventPollResponder error [status:" << status << "]: " << content << llendl; + LL_WARNS() << "LLEventPollResponder error [status:" << status << "]: " << content << LL_ENDL; } else { - llwarns << "LLEventPollResponder error <" << mCount + LL_WARNS() << "LLEventPollResponder error <" << mCount << "> [status:" << status << "]: " << content - << (mDone ? " -- done" : "") << llendl; + << (mDone ? " -- done" : "") << LL_ENDL; stop(); // At this point we have given up and the viewer will not receive HTTP messages from the simulator. @@ -227,7 +227,7 @@ namespace // continue running. if(gAgent.getRegion() && gAgent.getRegion()->getHost().getIPandPort() == mSender) { - llwarns << "Forcing disconnect due to stalled main region event poll." << llendl; + LL_WARNS() << "Forcing disconnect due to stalled main region event poll." << LL_ENDL; LLAppViewer::instance()->forceDisconnect(LLTrans::getString("AgentLostConnection")); } } @@ -236,8 +236,8 @@ namespace //virtual void LLEventPollResponder::result(const LLSD& content) { - lldebugs << "LLEventPollResponder::result <" << mCount << ">" - << (mDone ? " -- done" : "") << llendl; + LL_DEBUGS() << "LLEventPollResponder::result <" << mCount << ">" + << (mDone ? " -- done" : "") << LL_ENDL; if (mDone) return; @@ -246,7 +246,7 @@ namespace if (!content.get("events") || !content.get("id")) { - llwarns << "received event poll with no events or id key" << llendl; + LL_WARNS() << "received event poll with no events or id key" << LL_ENDL; makeRequest(); return; } @@ -256,12 +256,12 @@ namespace if(mAcknowledge.isUndefined()) { - llwarns << "LLEventPollResponder: id undefined" << llendl; + LL_WARNS() << "LLEventPollResponder: id undefined" << LL_ENDL; } - // was llinfos but now that CoarseRegionUpdate is TCP @ 1/second, it'd be too verbose for viewer logs. -MG - lldebugs << "LLEventPollResponder::completed <" << mCount << "> " << events.size() << "events (id " - << LLSDXMLStreamer(mAcknowledge) << ")" << llendl; + // was LL_INFOS() but now that CoarseRegionUpdate is TCP @ 1/second, it'd be too verbose for viewer logs. -MG + LL_DEBUGS() << "LLEventPollResponder::completed <" << mCount << "> " << events.size() << "events (id " + << LLSDXMLStreamer(mAcknowledge) << ")" << LL_ENDL; LLSD::array_const_iterator i = events.beginArray(); LLSD::array_const_iterator end = events.endArray(); diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index 9480e54809a910861bcba2db5a22c103e66d4c25..df9c848cb812f9944f75a18a35210f37a5a77638 100755 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -44,7 +44,7 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env std::string cmd = findCommand(env_var, override); if (cmd.empty()) { - llwarns << "Editor command is empty or not set" << llendl; + LL_WARNS() << "Editor command is empty or not set" << LL_ENDL; return EC_NOT_SPECIFIED; } @@ -55,7 +55,7 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env std::string bin_path = tokens[0]; if (!LLFile::isfile(bin_path)) { - llwarns << "Editor binary [" << bin_path << "] not found" << llendl; + LL_WARNS() << "Editor binary [" << bin_path << "] not found" << LL_ENDL; return EC_BINARY_NOT_FOUND; } @@ -71,10 +71,10 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env if (cmd.find(sFilenameMarker) == std::string::npos) { mProcessParams.args.add(sFilenameMarker); - llinfos << "Adding the filename marker (" << sFilenameMarker << ")" << llendl; + LL_INFOS() << "Adding the filename marker (" << sFilenameMarker << ")" << LL_ENDL; } - llinfos << "Setting command [" << mProcessParams << "]" << llendl; + LL_INFOS() << "Setting command [" << mProcessParams << "]" << LL_ENDL; return EC_SUCCESS; } @@ -83,7 +83,7 @@ LLExternalEditor::EErrorCode LLExternalEditor::run(const std::string& file_path) { if (std::string(mProcessParams.executable).empty() || mProcessParams.args.empty()) { - llwarns << "Editor command not set" << llendl; + LL_WARNS() << "Editor command not set" << LL_ENDL; return EC_NOT_SPECIFIED; } @@ -181,12 +181,12 @@ std::string LLExternalEditor::findCommand( if (!override.empty()) // try the supplied override first { cmd = override; - llinfos << "Using override" << llendl; + LL_INFOS() << "Using override" << LL_ENDL; } else if (!LLUI::sSettingGroups["config"]->getString(sSetting).empty()) { cmd = LLUI::sSettingGroups["config"]->getString(sSetting); - llinfos << "Using setting" << llendl; + LL_INFOS() << "Using setting" << LL_ENDL; } else // otherwise use the path specified by the environment variable { @@ -194,10 +194,10 @@ std::string LLExternalEditor::findCommand( if (env_var_val) { cmd = env_var_val; - llinfos << "Using env var " << env_var << llendl; + LL_INFOS() << "Using env var " << env_var << LL_ENDL; } } - llinfos << "Found command [" << cmd << "]" << llendl; + LL_INFOS() << "Found command [" << cmd << "]" << LL_ENDL; return cmd; } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index d69c185a2b2be59c39838060bf4b22a5c45f70f4..32b510b21a57943efbe3692de6d6896a950ccf1f 100755 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -220,7 +220,7 @@ void LLFace::destroy() } setDrawInfo(NULL); - + mDrawablep = NULL; mVObjp = NULL; } @@ -233,7 +233,7 @@ void LLFace::initClass() void LLFace::setWorldMatrix(const LLMatrix4 &mat) { - llerrs << "Faces on this drawable are not independently modifiable\n" << llendl; + LL_ERRS() << "Faces on this drawable are not independently modifiable\n" << LL_ENDL; } void LLFace::setPool(LLFacePool* pool) @@ -245,7 +245,7 @@ void LLFace::setPool(LLFacePool* new_pool, LLViewerTexture *texturep) { if (!new_pool) { - llerrs << "Setting pool to null!" << llendl; + LL_ERRS() << "Setting pool to null!" << LL_ENDL; } if (new_pool != mDrawPoolp) @@ -355,7 +355,7 @@ void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture) if(!new_texture) { - llerrs << "Can not switch to a null texture." << llendl; + LL_ERRS() << "Can not switch to a null texture." << LL_ENDL; return; } @@ -365,7 +365,7 @@ void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture) if (ch == LLRender::DIFFUSE_MAP) { - getViewerObject()->changeTEImage(mTEOffset, new_texture) ; + getViewerObject()->changeTEImage(mTEOffset, new_texture) ; } setTexture(ch, new_texture) ; @@ -437,7 +437,7 @@ void LLFace::setTextureIndex(U8 index) { if (mDrawInfo && !mDrawInfo->mTextureList.empty()) { - llerrs << "Face with no texture index references indexed texture draw info." << llendl; + LL_ERRS() << "Face with no texture index references indexed texture draw info." << LL_ENDL; } } } @@ -629,29 +629,29 @@ void LLFace::setDrawInfo(LLDrawInfo* draw_info) void LLFace::printDebugInfo() const { LLFacePool *poolp = getPool(); - llinfos << "Object: " << getViewerObject()->mID << llendl; + LL_INFOS() << "Object: " << getViewerObject()->mID << LL_ENDL; if (getDrawable()) { - llinfos << "Type: " << LLPrimitive::pCodeToString(getDrawable()->getVObj()->getPCode()) << llendl; + LL_INFOS() << "Type: " << LLPrimitive::pCodeToString(getDrawable()->getVObj()->getPCode()) << LL_ENDL; } if (getTexture()) { - llinfos << "Texture: " << getTexture() << " Comps: " << (U32)getTexture()->getComponents() << llendl; + LL_INFOS() << "Texture: " << getTexture() << " Comps: " << (U32)getTexture()->getComponents() << LL_ENDL; } else { - llinfos << "No texture: " << llendl; + LL_INFOS() << "No texture: " << LL_ENDL; } - llinfos << "Face: " << this << llendl; - llinfos << "State: " << getState() << llendl; - llinfos << "Geom Index Data:" << llendl; - llinfos << "--------------------" << llendl; - llinfos << "GI: " << mGeomIndex << " Count:" << mGeomCount << llendl; - llinfos << "Face Index Data:" << llendl; - llinfos << "--------------------" << llendl; - llinfos << "II: " << mIndicesIndex << " Count:" << mIndicesCount << llendl; - llinfos << llendl; + LL_INFOS() << "Face: " << this << LL_ENDL; + LL_INFOS() << "State: " << getState() << LL_ENDL; + LL_INFOS() << "Geom Index Data:" << LL_ENDL; + LL_INFOS() << "--------------------" << LL_ENDL; + LL_INFOS() << "GI: " << mGeomIndex << " Count:" << mGeomCount << LL_ENDL; + LL_INFOS() << "Face Index Data:" << LL_ENDL; + LL_INFOS() << "--------------------" << LL_ENDL; + LL_INFOS() << "II: " << mIndicesIndex << " Count:" << mIndicesCount << LL_ENDL; + LL_INFOS() << LL_ENDL; if (poolp) { @@ -664,20 +664,20 @@ void LLFace::printDebugInfo() const LLFace *facep = *iter; if (facep == this) { - llinfos << "Pool reference: " << pool_references << llendl; + LL_INFOS() << "Pool reference: " << pool_references << LL_ENDL; pool_references++; } } if (pool_references != 1) { - llinfos << "Incorrect number of pool references!" << llendl; + LL_INFOS() << "Incorrect number of pool references!" << LL_ENDL; } } #if 0 - llinfos << "Indices:" << llendl; - llinfos << "--------------------" << llendl; + LL_INFOS() << "Indices:" << LL_ENDL; + LL_INFOS() << "--------------------" << LL_ENDL; const U32 *indicesp = getRawIndices(); S32 indices_count = getIndicesCount(); @@ -685,17 +685,17 @@ void LLFace::printDebugInfo() const for (S32 i = 0; i < indices_count; i++) { - llinfos << i << ":" << indicesp[i] << ":" << (S32)(indicesp[i] - geom_start) << llendl; + LL_INFOS() << i << ":" << indicesp[i] << ":" << (S32)(indicesp[i] - geom_start) << LL_ENDL; } - llinfos << llendl; + LL_INFOS() << LL_ENDL; - llinfos << "Vertices:" << llendl; - llinfos << "--------------------" << llendl; + LL_INFOS() << "Vertices:" << LL_ENDL; + LL_INFOS() << "--------------------" << LL_ENDL; for (S32 i = 0; i < mGeomCount; i++) { - llinfos << mGeomIndex + i << ":" << poolp->getVertex(mGeomIndex + i) << llendl; + LL_INFOS() << mGeomIndex + i << ":" << poolp->getVertex(mGeomIndex + i) << LL_ENDL; } - llinfos << llendl; + LL_INFOS() << LL_ENDL; #endif } @@ -798,7 +798,7 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, if (f >= volume.getNumVolumeFaces()) { - llwarns << "Generating bounding box for invalid face index!" << llendl; + LL_WARNS() << "Generating bounding box for invalid face index!" << LL_ENDL; f = 0; } @@ -828,7 +828,7 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f, mask[4].setElement<2>(); mask[5].setElement<0>(); //110 mask[5].setElement<1>(); - + LLVector4a v[8]; v[6] = min; @@ -928,7 +928,7 @@ LLVector2 LLFace::surfaceToTexture(LLVector2 surface_coord, const LLVector4a& po if (texgen == LLTextureEntry::TEX_GEN_PLANAR) { planarProjection(tc, volume_normal, center, volume_position); - } + } } if (mTextureMatrix) // if we have a texture matrix, use it @@ -1081,12 +1081,12 @@ bool LLFace::canRenderAsMask() } -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_VOLUME("Volume VB Cache"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_VOLUME("Volume VB Cache"); //static void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf) { - LLFastTimer t(FTM_FACE_GEOM_VOLUME); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_VOLUME); U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_NORMAL; @@ -1148,33 +1148,33 @@ void push_for_transform(LLVertexBuffer* buff, U32 source_count, U32 dest_count) } } -static LLFastTimer::DeclareTimer FTM_FACE_GET_GEOM("Face Geom"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_POSITION("Position"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_NORMAL("Normal"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_TEXTURE("Texture"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_COLOR("Color"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_EMISSIVE("Emissive"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_WEIGHTS("Weights"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_TANGENT("Binormal"); - -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK("Face Feedback"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_POSITION("Feedback Position"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_NORMAL("Feedback Normal"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_TEXTURE("Feedback Texture"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_COLOR("Feedback Color"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_EMISSIVE("Feedback Emissive"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_FEEDBACK_BINORMAL("Feedback Binormal"); - -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_INDEX("Index"); -static LLFastTimer::DeclareTimer FTM_FACE_GEOM_INDEX_TAIL("Tail"); -static LLFastTimer::DeclareTimer FTM_FACE_POSITION_STORE("Pos"); -static LLFastTimer::DeclareTimer FTM_FACE_TEXTURE_INDEX_STORE("TexIdx"); -static LLFastTimer::DeclareTimer FTM_FACE_POSITION_PAD("Pad"); -static LLFastTimer::DeclareTimer FTM_FACE_TEX_DEFAULT("Default"); -static LLFastTimer::DeclareTimer FTM_FACE_TEX_QUICK("Quick"); -static LLFastTimer::DeclareTimer FTM_FACE_TEX_QUICK_NO_XFORM("No Xform"); -static LLFastTimer::DeclareTimer FTM_FACE_TEX_QUICK_XFORM("Xform"); -static LLFastTimer::DeclareTimer FTM_FACE_TEX_QUICK_PLANAR("Quick Planar"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GET_GEOM("Face Geom"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_POSITION("Position"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_NORMAL("Normal"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_TEXTURE("Texture"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_COLOR("Color"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_EMISSIVE("Emissive"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_WEIGHTS("Weights"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_TANGENT("Binormal"); + +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK("Face Feedback"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_POSITION("Feedback Position"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_NORMAL("Feedback Normal"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_TEXTURE("Feedback Texture"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_COLOR("Feedback Color"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_EMISSIVE("Feedback Emissive"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_FEEDBACK_BINORMAL("Feedback Binormal"); + +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_INDEX("Index"); +static LLTrace::BlockTimerStatHandle FTM_FACE_GEOM_INDEX_TAIL("Tail"); +static LLTrace::BlockTimerStatHandle FTM_FACE_POSITION_STORE("Pos"); +static LLTrace::BlockTimerStatHandle FTM_FACE_TEXTURE_INDEX_STORE("TexIdx"); +static LLTrace::BlockTimerStatHandle FTM_FACE_POSITION_PAD("Pad"); +static LLTrace::BlockTimerStatHandle FTM_FACE_TEX_DEFAULT("Default"); +static LLTrace::BlockTimerStatHandle FTM_FACE_TEX_QUICK("Quick"); +static LLTrace::BlockTimerStatHandle FTM_FACE_TEX_QUICK_NO_XFORM("No Xform"); +static LLTrace::BlockTimerStatHandle FTM_FACE_TEX_QUICK_XFORM("Xform"); +static LLTrace::BlockTimerStatHandle FTM_FACE_TEX_QUICK_PLANAR("Quick Planar"); BOOL LLFace::getGeometryVolume(const LLVolume& volume, const S32 &f, @@ -1182,7 +1182,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, const U16 &index_offset, bool force_rebuild) { - LLFastTimer t(FTM_FACE_GET_GEOM); + LL_RECORD_BLOCK_TIME(FTM_FACE_GET_GEOM); llassert(verify()); const LLVolumeFace &vf = volume.getVolumeFace(f); S32 num_vertices = (S32)vf.mNumVertices; @@ -1203,13 +1203,13 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (gDebugGL) { - llwarns << "Index buffer overflow!" << llendl; - llwarns << "Indices Count: " << mIndicesCount + LL_WARNS() << "Index buffer overflow!" << LL_ENDL; + LL_WARNS() << "Indices Count: " << mIndicesCount << " VF Num Indices: " << num_indices << " Indices Index: " << mIndicesIndex - << " VB Num Indices: " << mVertexBuffer->getNumIndices() << llendl; - llwarns << " Face Index: " << f - << " Pool Type: " << mPoolType << llendl; + << " VB Num Indices: " << mVertexBuffer->getNumIndices() << LL_ENDL; + LL_WARNS() << " Face Index: " << f + << " Pool Type: " << mPoolType << LL_ENDL; } return FALSE; } @@ -1218,7 +1218,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { if (gDebugGL) { - llwarns << "Vertex buffer overflow!" << llendl; + LL_WARNS() << "Vertex buffer overflow!" << LL_ENDL; } return FALSE; } @@ -1278,7 +1278,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, { //decide if shiny goes in alpha channel of color if (tep && getPoolType() != LLDrawPool::POOL_ALPHA) // <--- alpha channel MUST contain transparency, not shiny - { + { LLMaterial* mat = tep->getMaterialParams().get(); bool shiny_in_alpha = false; @@ -1299,15 +1299,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } if (shiny_in_alpha) - { + { - GLfloat alpha[4] = - { - 0.00f, - 0.25f, - 0.5f, - 0.75f - }; + GLfloat alpha[4] = + { + 0.00f, + 0.25f, + 0.5f, + 0.75f + }; llassert(tep->getShiny() <= 3); color.mV[3] = U8 (alpha[tep->getShiny()] * 255); @@ -1318,7 +1318,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, // INDICES if (full_rebuild) { - LLFastTimer t(FTM_FACE_GEOM_INDEX); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_INDEX); mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount, map_range); volatile __m128i* dst = (__m128i*) indicesp.get(); @@ -1334,7 +1334,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } { - LLFastTimer t(FTM_FACE_GEOM_INDEX_TAIL); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_INDEX_TAIL); U16* idx = (U16*) dst; for (S32 i = end*8; i < num_indices; ++i) @@ -1397,7 +1397,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, !volume.isUnique()) //source volume is NOT flexi { //use transform feedback to pack vertex buffer //gGLDebugLoggingEnabled = TRUE; - LLFastTimer t(FTM_FACE_GEOM_FEEDBACK); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK); LLGLEnable discard(GL_RASTERIZER_DISCARD); LLVertexBuffer* buff = (LLVertexBuffer*) vf.mVertexBuffer.get(); @@ -1415,7 +1415,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_pos) { - LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_POSITION); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_POSITION); gTransformPositionProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_VERTEX, mGeomIndex, mGeomCount); @@ -1440,7 +1440,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_color) { - LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_COLOR); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_COLOR); gTransformColorProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_COLOR, mGeomIndex, mGeomCount); @@ -1456,7 +1456,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_emissive) { - LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_EMISSIVE); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_EMISSIVE); gTransformColorProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_EMISSIVE, mGeomIndex, mGeomCount); @@ -1477,7 +1477,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_normal) { - LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_NORMAL); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_NORMAL); gTransformNormalProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_NORMAL, mGeomIndex, mGeomCount); @@ -1490,7 +1490,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_tangent) { - LLFastTimer t(FTM_FACE_GEOM_TANGENT); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_TANGENT); gTransformTangentProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TANGENT, mGeomIndex, mGeomCount); @@ -1503,7 +1503,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_tcoord) { - LLFastTimer t(FTM_FACE_GEOM_FEEDBACK_TEXTURE); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_FEEDBACK_TEXTURE); gTransformTexCoordProgram.bind(); mVertexBuffer->bindForFeedback(0, LLVertexBuffer::TYPE_TEXCOORD0, mGeomIndex, mGeomCount); @@ -1542,7 +1542,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_tcoord) { - LLFastTimer t(FTM_FACE_GEOM_TEXTURE); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_TEXTURE); //bump setup LLVector4a binormal_dir( -sin_ang, cos_ang, 0.f ); @@ -1613,8 +1613,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, bool tex_anim = false; - LLVOVolume* vobj = (LLVOVolume*) (LLViewerObject*) mVObjp; - tex_mode = vobj->mTexAnimMode; + LLVOVolume* vobj = (LLVOVolume*) (LLViewerObject*) mVObjp; + tex_mode = vobj->mTexAnimMode; if (vobj->mTextureAnimp) { //texture animation is in play, override specular and normal map tex coords with diffuse texcoords @@ -1637,7 +1637,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, do_xform = false; } - + if (getVirtualSize() >= MIN_TEX_ANIM_SIZE || isState(LLFace::RIGGED)) { //don't override texture transform during tc bake tex_mode = 0; @@ -1658,25 +1658,25 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } bool do_tex_mat = tex_mode && mTextureMatrix; - + if (!do_bump) { //not bump mapped, might be able to do a cheap update mVertexBuffer->getTexCoord0Strider(tex_coords0, mGeomIndex, mGeomCount); if (texgen != LLTextureEntry::TEX_GEN_PLANAR) { - LLFastTimer t(FTM_FACE_TEX_QUICK); + LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_QUICK); if (!do_tex_mat) { if (!do_xform) { - LLFastTimer t(FTM_FACE_TEX_QUICK_NO_XFORM); + LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_QUICK_NO_XFORM); S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF; LLVector4a::memcpyNonAliased16((F32*) tex_coords0.get(), (F32*) vf.mTexCoords, tc_size); } else { - LLFastTimer t(FTM_FACE_TEX_QUICK_XFORM); + LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_QUICK_XFORM); F32* dst = (F32*) tex_coords0.get(); LLVector4a* src = (LLVector4a*) vf.mTexCoords; @@ -1729,7 +1729,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } else { //no bump, tex gen planar - LLFastTimer t(FTM_FACE_TEX_QUICK_PLANAR); + LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_QUICK_PLANAR); if (do_tex_mat) { for (S32 i = 0; i < num_vertices; i++) @@ -1774,10 +1774,10 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } else { //bump mapped or has material, just do the whole expensive loop - LLFastTimer t(FTM_FACE_TEX_DEFAULT); - - std::vector<LLVector2> bump_tc; + LL_RECORD_BLOCK_TIME(FTM_FACE_TEX_DEFAULT); + std::vector<LLVector2> bump_tc; + if (mat && !mat->getNormalID().isNull()) { //writing out normal and specular texture coordinates, not bump offsets do_bump = false; @@ -1834,45 +1834,45 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } - for (S32 i = 0; i < num_vertices; i++) - { - LLVector2 tc(vf.mTexCoords[i]); + for (S32 i = 0; i < num_vertices; i++) + { + LLVector2 tc(vf.mTexCoords[i]); - LLVector4a& norm = vf.mNormals[i]; + LLVector4a& norm = vf.mNormals[i]; - LLVector4a& center = *(vf.mCenter); + LLVector4a& center = *(vf.mCenter); - if (texgen != LLTextureEntry::TEX_GEN_DEFAULT) - { - LLVector4a vec = vf.mPositions[i]; + if (texgen != LLTextureEntry::TEX_GEN_DEFAULT) + { + LLVector4a vec = vf.mPositions[i]; - vec.mul(scalea); + vec.mul(scalea); if (texgen == LLTextureEntry::TEX_GEN_PLANAR) - { + { planarProjection(tc, norm, center, vec); - } - } + } + } - if (tex_mode && mTextureMatrix) - { - LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f); - tmp = tmp * *mTextureMatrix; - tc.mV[0] = tmp.mV[0]; - tc.mV[1] = tmp.mV[1]; - } - else - { - xform(tc, cos_ang, sin_ang, os, ot, ms, mt); - } + if (tex_mode && mTextureMatrix) + { + LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f); + tmp = tmp * *mTextureMatrix; + tc.mV[0] = tmp.mV[0]; + tc.mV[1] = tmp.mV[1]; + } + else + { + xform(tc, cos_ang, sin_ang, os, ot, ms, mt); + } *dst++ = tc; - if (do_bump) - { - bump_tc.push_back(tc); - } + if (do_bump) + { + bump_tc.push_back(tc); } } + } if (map_range) { @@ -1890,7 +1890,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a binorm; binorm.setCross3(vf.mNormals[i], tangent); binorm.mul(tangent.getF32ptr()[3]); - + LLMatrix4a tangent_to_object; tangent_to_object.setRows(tangent, binorm, vf.mNormals[i]); LLVector4a t; @@ -1932,7 +1932,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a* end = src+num_vertices; //LLVector4a* end_64 = end-4; - //LLFastTimer t(FTM_FACE_GEOM_POSITION); + //LL_RECORD_TIME_BLOCK(FTM_FACE_GEOM_POSITION); llassert(num_vertices > 0); mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount, map_range); @@ -1970,7 +1970,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLVector4a tmp; { - //LLFastTimer t2(FTM_FACE_POSITION_STORE); + //LL_RECORD_TIME_BLOCK(FTM_FACE_POSITION_STORE); /*if (num_vertices > 4) { //more than 64 bytes @@ -2010,7 +2010,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } { - //LLFastTimer t(FTM_FACE_POSITION_PAD); + //LL_RECORD_TIME_BLOCK(FTM_FACE_POSITION_PAD); while (dst < end_f32) { res0.store4a((F32*) dst); @@ -2027,7 +2027,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_normal) { - //LLFastTimer t(FTM_FACE_GEOM_NORMAL); + //LL_RECORD_TIME_BLOCK(FTM_FACE_GEOM_NORMAL); mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount, map_range); F32* normals = (F32*) norm.get(); LLVector4a* src = vf.mNormals; @@ -2049,7 +2049,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_tangent) { - LLFastTimer t(FTM_FACE_GEOM_TANGENT); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_TANGENT); mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount, map_range); F32* tangents = (F32*) tangent.get(); @@ -2082,7 +2082,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_weights && vf.mWeights) { - LLFastTimer t(FTM_FACE_GEOM_WEIGHTS); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_WEIGHTS); mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, map_range); F32* weights = (F32*) wght.get(); LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32)); @@ -2094,7 +2094,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_COLOR) ) { - LLFastTimer t(FTM_FACE_GEOM_COLOR); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_COLOR); mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount, map_range); LLVector4a src; @@ -2125,7 +2125,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, if (rebuild_emissive) { - LLFastTimer t(FTM_FACE_GEOM_EMISSIVE); + LL_RECORD_BLOCK_TIME(FTM_FACE_GEOM_EMISSIVE); LLStrider<LLColor4U> emissive; mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount, map_range); @@ -2137,7 +2137,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLColor4U glow4u = LLColor4U(0,0,0,glow); U32 glow32 = glow4u.mAll; - + U32 vec[4]; vec[0] = vec[1] = vec[2] = vec[3] = glow32; @@ -2282,7 +2282,7 @@ BOOL LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius) dist *= 16.f; } - lookAt.normalize3fast(); + lookAt.normalize3fast() ; //get area of circle around node F32 app_angle = atanf((F32) sqrt(size_squared) / dist); @@ -2382,8 +2382,6 @@ F32 LLFace::calcImportanceToCamera(F32 cos_angle_to_view_dir, F32 dist) return 0.f ; } - //F32 camera_relative_speed = camera_moving_speed * (lookAt * LLViewerCamera::getInstance()->getVelocityDir()) ; - S32 i = 0 ; for(i = 0; i < FACE_IMPORTANCE_LEVEL && dist > FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][0]; ++i); i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ; @@ -2432,7 +2430,7 @@ BOOL LLFace::verify(const U32* indices_array) const if ((mGeomIndex + mGeomCount) > mVertexBuffer->getNumVerts()) { ok = FALSE; - llinfos << "Face references invalid vertices!" << llendl; + LL_INFOS() << "Face references invalid vertices!" << LL_ENDL; } S32 indices_count = (S32)getIndicesCount(); @@ -2445,13 +2443,13 @@ BOOL LLFace::verify(const U32* indices_array) const if (indices_count > LL_MAX_INDICES_COUNT) { ok = FALSE; - llinfos << "Face has bogus indices count" << llendl; + LL_INFOS() << "Face has bogus indices count" << LL_ENDL; } if (mIndicesIndex + mIndicesCount > mVertexBuffer->getNumIndices()) { ok = FALSE; - llinfos << "Face references invalid indices!" << llendl; + LL_INFOS() << "Face references invalid indices!" << LL_ENDL; } #if 0 @@ -2465,14 +2463,14 @@ BOOL LLFace::verify(const U32* indices_array) const S32 delta = indicesp[i] - geom_start; if (0 > delta) { - llwarns << "Face index too low!" << llendl; - llinfos << "i:" << i << " Index:" << indicesp[i] << " GStart: " << geom_start << llendl; + LL_WARNS() << "Face index too low!" << LL_ENDL; + LL_INFOS() << "i:" << i << " Index:" << indicesp[i] << " GStart: " << geom_start << LL_ENDL; ok = FALSE; } else if (delta >= geom_count) { - llwarns << "Face index too high!" << llendl; - llinfos << "i:" << i << " Index:" << indicesp[i] << " GEnd: " << geom_start + geom_count << llendl; + LL_WARNS() << "Face index too high!" << LL_ENDL; + LL_INFOS() << "i:" << i << " Index:" << indicesp[i] << " GEnd: " << geom_start + geom_count << LL_ENDL; ok = FALSE; } } diff --git a/indra/newview/llface.h b/indra/newview/llface.h index c9037ce1eba8f91f8f670391d950d247a84e64cd..d3a561faccfd6861849f8b78a4f806c84a7245db 100755 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -28,7 +28,6 @@ #define LL_LLFACE_H #include "llstrider.h" - #include "llrender.h" #include "v2math.h" #include "v3math.h" @@ -37,7 +36,6 @@ #include "v4coloru.h" #include "llquaternion.h" #include "xform.h" -#include "lldarrayptr.h" #include "llvertexbuffer.h" #include "llviewertexture.h" #include "lldrawable.h" @@ -49,33 +47,24 @@ class LLTextureEntry; class LLVertexProgram; class LLViewerTexture; class LLGeometryManager; +class LLTextureAtlasSlot; +class LLDrawInfo; const F32 MIN_ALPHA_SIZE = 1024.f; const F32 MIN_TEX_ANIM_SIZE = 512.f; -class LLFace +class LLFace : public LLTrace::MemTrackableNonVirtual<LLFace, 16> { public: - - void* operator new(size_t size) - { - return ll_aligned_malloc_16(size); - } - - void operator delete(void* ptr) - { - ll_aligned_free_16(ptr); - } - - LLFace(const LLFace& rhs) + : LLTrace::MemTrackableNonVirtual<LLFace, 16>("LLFace") { *this = rhs; } const LLFace& operator=(const LLFace& rhs) { - llerrs << "Illegal operation!" << llendl; + LL_ERRS() << "Illegal operation!" << LL_ENDL; return *this; } @@ -96,7 +85,11 @@ class LLFace static void cacheFaceInVRAM(const LLVolumeFace& vf); public: - LLFace(LLDrawable* drawablep, LLViewerObject* objp) { init(drawablep, objp); } + LLFace(LLDrawable* drawablep, LLViewerObject* objp) + : LLTrace::MemTrackableNonVirtual<LLFace, 16>("LLFace") + { + init(drawablep, objp); + } ~LLFace() { destroy(); } const LLMatrix4& getWorldMatrix() const { return mVObjp->getWorldMatrix(mXform); } diff --git a/indra/newview/llface.inl b/indra/newview/llface.inl index 85c35a88f3ce189a52b6601fd74bd89bf5ceeab8..c37b77d2cd03059c959bf71a82e5801496e8f1e4 100755 --- a/indra/newview/llface.inl +++ b/indra/newview/llface.inl @@ -77,7 +77,7 @@ inline S32 LLFace::getColors (LLStrider<LLColor4U> &colors) if (!mBackupMem) { printDebugInfo(); - llerrs << "No backup memory for face" << llendl; + LL_ERRS() << "No backup memory for face" << LL_ENDL; } colorp = (LLColor4U*)(mBackupMem + (4 * mIndicesCount) + (mGeomCount * mDrawPoolp->getStride())); colors = colorp; @@ -89,7 +89,7 @@ inline S32 LLFace::getColors (LLStrider<LLColor4U> &colors) if (!mDrawPoolp->getColorStrider(colors, mGeomIndex)) { printDebugInfo(); - llerrs << "No color pointer for a color strider!" << llendl; + LL_ERRS() << "No color pointer for a color strider!" << LL_ENDL; } mDrawPoolp->setDirtyColors(); return mGeomIndex; @@ -107,7 +107,7 @@ inline S32 LLFace::getTexCoords (LLStrider<LLVector2> &texCoords, S32 pass ) if (!mBackupMem) { printDebugInfo(); - llerrs << "No backup memory for face" << llendl; + LL_ERRS() << "No backup memory for face" << LL_ENDL; } texCoords = (LLVector2*)(mBackupMem + (4 * mIndicesCount) + mDrawPoolp->mDataOffsets[LLDrawPool::DATA_TEX_COORDS0 + pass]); texCoords.setStride( mDrawPoolp->getStride()); diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 9a20ce8f1bc701c2febbfa90e0db15689396811b..514aac46fcc929d2b7d194016fcc3102ede0183f 100644 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -275,7 +275,7 @@ class LLFacebookInfoResponder : public LLHTTPClient::Responder { if (isGoodStatus(status)) { - llinfos << "Facebook: Info received" << llendl; + LL_INFOS() << "Facebook: Info received" << LL_ENDL; LL_DEBUGS("FacebookConnect") << "Getting Facebook info successful. info: " << info << LL_ENDL; LLFacebookConnect::instance().storeInfo(info); } @@ -458,7 +458,7 @@ void LLFacebookConnect::sharePhoto(LLPointer<LLImageFormatted> image, const std: } else { - llwarns << "Image to upload is not a PNG or JPEG" << llendl; + LL_WARNS() << "Image to upload is not a PNG or JPEG" << LL_ENDL; return; } diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 06119620de1287281156a0f5c31e6611ac20e2ad..76c37439abd691d2658bb19a4fa6ccf142c15f2c 100755 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -30,12 +30,14 @@ #include "llviewerwindow.h" #include "llrect.h" +#include "llcombobox.h" #include "llerror.h" #include "llgl.h" #include "llimagepng.h" #include "llrender.h" #include "llrendertarget.h" #include "lllocalcliprect.h" +#include "lllayoutstack.h" #include "llmath.h" #include "llfontgl.h" #include "llsdserialize.h" @@ -46,7 +48,6 @@ #include "llviewertexturelist.h" #include "llui.h" #include "llviewercontrol.h" -#include "llstat.h" #include "llfasttimer.h" #include "lltreeiterators.h" @@ -55,62 +56,73 @@ ////////////////////////////////////////////////////////////////////////////// -static const S32 MAX_VISIBLE_HISTORY = 10; -static const S32 LINE_GRAPH_HEIGHT = 240; - -//static const int FTV_DISPLAY_NUM = (sizeof(ft_display_table)/sizeof(ft_display_table[0])); -static S32 FTV_NUM_TIMERS; -const S32 FTV_MAX_DEPTH = 8; +using namespace LLTrace; -std::vector<LLFastTimer::NamedTimer*> ft_display_idx; // line of table entry for display purposes (for collapse) +static const S32 MAX_VISIBLE_HISTORY = 12; +static const S32 LINE_GRAPH_HEIGHT = 240; +static const S32 MIN_BAR_HEIGHT = 3; +static const S32 RUNNING_AVERAGE_WIDTH = 100; +static const S32 NUM_FRAMES_HISTORY = 200; -typedef LLTreeDFSIter<LLFastTimer::NamedTimer, LLFastTimer::NamedTimer::child_const_iter> timer_tree_iterator_t; +std::vector<BlockTimerStatHandle*> ft_display_idx; // line of table entry for display purposes (for collapse) BOOL LLFastTimerView::sAnalyzePerformance = FALSE; -static timer_tree_iterator_t begin_timer_tree(LLFastTimer::NamedTimer& id) -{ - return timer_tree_iterator_t(&id, - boost::bind(boost::mem_fn(&LLFastTimer::NamedTimer::beginChildren), _1), - boost::bind(boost::mem_fn(&LLFastTimer::NamedTimer::endChildren), _1)); -} - -static timer_tree_iterator_t end_timer_tree() -{ - return timer_tree_iterator_t(); +S32 get_depth(const BlockTimerStatHandle* blockp) +{ + S32 depth = 0; + BlockTimerStatHandle* timerp = blockp->getParent(); + while(timerp) + { + depth++; + if (timerp->getParent() == timerp) break; + timerp = timerp->getParent(); + } + return depth; } LLFastTimerView::LLFastTimerView(const LLSD& key) : LLFloater(key), - mHoverTimer(NULL) + mHoverTimer(NULL), + mDisplayMode(0), + mDisplayType(DISPLAY_TIME), + mScrollIndex(0), + mHoverID(NULL), + mHoverBarIndex(-1), + mStatsIndex(-1), + mPauseHistory(false), + mRecording(NUM_FRAMES_HISTORY) +{ + mTimerBarRows.resize(NUM_FRAMES_HISTORY); +} + +LLFastTimerView::~LLFastTimerView() { - mDisplayMode = 0; - mAvgCountTotal = 0; - mMaxCountTotal = 0; - mDisplayCenter = ALIGN_CENTER; - mDisplayCalls = 0; - mDisplayHz = 0; - mScrollIndex = 0; - mHoverID = NULL; - mHoverBarIndex = -1; - FTV_NUM_TIMERS = LLFastTimer::NamedTimer::instanceCount(); - mPrintStats = -1; } void LLFastTimerView::onPause() { - LLFastTimer::sPauseHistory = !LLFastTimer::sPauseHistory; + setPauseState(!mPauseHistory); +} + +void LLFastTimerView::setPauseState(bool pause_state) +{ + if (pause_state == mPauseHistory) return; + // reset scroll to bottom when unpausing - if (!LLFastTimer::sPauseHistory) + if (!pause_state) { - mScrollIndex = 0; - LLFastTimer::sResetHistory = true; + getChild<LLButton>("pause_btn")->setLabel(getString("pause")); } else { + mScrollIndex = 0; + getChild<LLButton>("pause_btn")->setLabel(getString("run")); } + + mPauseHistory = pause_state; } BOOL LLFastTimerView::postBuild() @@ -126,13 +138,13 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) if (mHoverTimer ) { // right click collapses timers - if (!mHoverTimer->getCollapsed()) + if (!mHoverTimer->getTreeNode().mCollapsed) { - mHoverTimer->setCollapsed(true); + mHoverTimer->getTreeNode().mCollapsed = true; } else if (mHoverTimer->getParent()) { - mHoverTimer->getParent()->setCollapsed(true); + mHoverTimer->getParent()->getTreeNode().mCollapsed = true; } return TRUE; } @@ -140,15 +152,15 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) { S32 bar_idx = MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight()); bar_idx = llclamp(bar_idx, 0, MAX_VISIBLE_HISTORY); - mPrintStats = LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex - bar_idx; + mStatsIndex = mScrollIndex + bar_idx; return TRUE; } return LLFloater::handleRightMouseDown(x, y, mask); } -LLFastTimer::NamedTimer* LLFastTimerView::getLegendID(S32 y) +BlockTimerStatHandle* LLFastTimerView::getLegendID(S32 y) { - S32 idx = (getRect().getHeight() - y) / (LLFontGL::getFontMonospace()->getLineHeight()+2) - 5; + S32 idx = (mLegendRect.mTop - y) / (LLFontGL::getFontMonospace()->getLineHeight() + 2); if (idx >= 0 && idx < (S32)ft_display_idx.size()) { @@ -160,11 +172,11 @@ LLFastTimer::NamedTimer* LLFastTimerView::getLegendID(S32 y) BOOL LLFastTimerView::handleDoubleClick(S32 x, S32 y, MASK mask) { - for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer()); - it != end_timer_tree(); + for(LLTrace::block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); + it != LLTrace::end_block_timer_tree_df(); ++it) { - (*it)->setCollapsed(false); + (*it)->getTreeNode().mCollapsed = false; } return TRUE; } @@ -173,52 +185,23 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) { if (x < mBarRect.mLeft) { - LLFastTimer::NamedTimer* idp = getLegendID(y); + BlockTimerStatHandle* idp = getLegendID(y); if (idp) { - idp->setCollapsed(!idp->getCollapsed()); + idp->getTreeNode().mCollapsed = !idp->getTreeNode().mCollapsed; } } else if (mHoverTimer) { //left click drills down by expanding timers - mHoverTimer->setCollapsed(false); - } - else if (mask & MASK_ALT) - { - if (mask & MASK_CONTROL) - { - mDisplayHz = !mDisplayHz; - } - else - { - mDisplayCalls = !mDisplayCalls; - } - } - else if (mask & MASK_SHIFT) - { - if (++mDisplayMode > 3) - mDisplayMode = 0; - } - else if (mask & MASK_CONTROL) - { - mDisplayCenter = (ChildAlignment)((mDisplayCenter + 1) % ALIGN_COUNT); + mHoverTimer->getTreeNode().mCollapsed = false; } else if (mGraphRect.pointInRect(x, y)) { gFocusMgr.setMouseCapture(this); return TRUE; } - //else - //{ - // // pause/unpause - // LLFastTimer::sPauseHistory = !LLFastTimer::sPauseHistory; - // // reset scroll to bottom when unpausing - // if (!LLFastTimer::sPauseHistory) - // { - // mScrollIndex = 0; - // } - //} + return LLFloater::handleMouseDown(x, y, mask); } @@ -236,17 +219,21 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) if (hasMouseCapture()) { F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f); - mScrollIndex = llround( lerp * (F32)(LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); - mScrollIndex = llclamp( mScrollIndex, 0, LLFastTimer::getLastFrameIndex()); + mScrollIndex = llround( lerp * (F32)(mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY)); + mScrollIndex = llclamp( mScrollIndex, 0, (S32)mRecording.getNumRecordedPeriods()); return TRUE; } mHoverTimer = NULL; mHoverID = NULL; - if(LLFastTimer::sPauseHistory && mBarRect.pointInRect(x, y)) + if(mPauseHistory && mBarRect.pointInRect(x, y)) { - mHoverBarIndex = llmin(LLFastTimer::getCurFrameIndex() - 1, - MAX_VISIBLE_HISTORY - ((y - mBarRect.mBottom) * (MAX_VISIBLE_HISTORY + 2) / mBarRect.getHeight())); + //const S32 bars_top = mBarRect.mTop; + const S32 bars_top = mBarRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4); + + mHoverBarIndex = llmin((bars_top - y) / (mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2)) - 1, + (S32)mRecording.getNumRecordedPeriods() - 1, + MAX_VISIBLE_HISTORY); if (mHoverBarIndex == 0) { return TRUE; @@ -256,40 +243,50 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) mHoverBarIndex = 0; } - S32 i = 0; - for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer()); - it != end_timer_tree(); - ++it, ++i) + TimerBarRow& row = mHoverBarIndex == 0 ? mAverageTimerRow : mTimerBarRows[mScrollIndex + mHoverBarIndex - 1]; + + TimerBar* hover_bar = NULL; + F32Seconds mouse_time_offset = ((F32)(x - mBarRect.mLeft) / (F32)mBarRect.getWidth()) * mTotalTimeDisplay; + for (int bar_index = 0, end_index = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); + bar_index < end_index; + ++bar_index) { - // is mouse over bar for this timer? - if (x > mBarStart[mHoverBarIndex][i] && - x < mBarEnd[mHoverBarIndex][i]) + TimerBar& bar = row.mBars[bar_index]; + if (bar.mSelfStart > mouse_time_offset) { - mHoverID = (*it); - if (mHoverTimer != *it) - { - // could be that existing tooltip is for a parent and is thus - // covering region for this new timer, go ahead and unblock - // so we can create a new tooltip - LLToolTipMgr::instance().unblockToolTips(); - mHoverTimer = (*it); + break; + } + if (bar.mSelfEnd > mouse_time_offset) + { + hover_bar = &bar; + if (bar.mTimeBlock->getTreeNode().mCollapsed) + { + // stop on first collapsed BlockTimerStatHandle, since we can't select any children + break; } - - mToolTipRect.set(mBarStart[mHoverBarIndex][i], - mBarRect.mBottom + llround(((F32)(MAX_VISIBLE_HISTORY - mHoverBarIndex + 1)) * ((F32)mBarRect.getHeight() / ((F32)MAX_VISIBLE_HISTORY + 2.f))), - mBarEnd[mHoverBarIndex][i], - mBarRect.mBottom + llround((F32)(MAX_VISIBLE_HISTORY - mHoverBarIndex) * ((F32)mBarRect.getHeight() / ((F32)MAX_VISIBLE_HISTORY + 2.f)))); } + } - if ((*it)->getCollapsed()) + if (hover_bar) + { + mHoverID = hover_bar->mTimeBlock; + if (mHoverTimer != mHoverID) { - it.skipDescendants(); + // could be that existing tooltip is for a parent and is thus + // covering region for this new timer, go ahead and unblock + // so we can create a new tooltip + LLToolTipMgr::instance().unblockToolTips(); + mHoverTimer = mHoverID; + mToolTipRect.set(mBarRect.mLeft + (hover_bar->mSelfStart / mTotalTimeDisplay) * mBarRect.getWidth(), + row.mTop, + mBarRect.mLeft + (hover_bar->mSelfEnd / mTotalTimeDisplay) * mBarRect.getWidth(), + row.mBottom); } } } else if (x < mBarRect.mLeft) { - LLFastTimer::NamedTimer* timer_id = getLegendID(y); + BlockTimerStatHandle* timer_id = getLegendID(y); if (timer_id) { mHoverID = timer_id; @@ -300,9 +297,24 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) } +static std::string get_tooltip(BlockTimerStatHandle& timer, S32 history_index, PeriodicRecording& frame_recording) +{ + std::string tooltip; + if (history_index == 0) + { + // by default, show average number of call + tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)F64Milliseconds(frame_recording.getPeriodMean (timer, RUNNING_AVERAGE_WIDTH)).value(), (S32)frame_recording.getPeriodMean(timer.callCount(), RUNNING_AVERAGE_WIDTH)); + } + else + { + tooltip = llformat("%s (%d ms, %d calls)", timer.getName().c_str(), (S32)F64Milliseconds(frame_recording.getPrevRecording(history_index).getSum(timer)).value(), (S32)frame_recording.getPrevRecording(history_index).getSum(timer.callCount())); + } + return tooltip; +} + BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) { - if(LLFastTimer::sPauseHistory && mBarRect.pointInRect(x, y)) + if(mPauseHistory && mBarRect.pointInRect(x, y)) { // tooltips for timer bars if (mHoverTimer) @@ -310,8 +322,10 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) LLRect screen_rect; localRectToScreen(mToolTipRect, &screen_rect); + std::string tooltip = get_tooltip(*mHoverTimer, mHoverBarIndex > 0 ? mScrollIndex + mHoverBarIndex : 0, mRecording); + LLToolTipMgr::instance().show(LLToolTip::Params() - .message(mHoverTimer->getToolTip(LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex - mHoverBarIndex)) + .message(tooltip) .sticky_rect(screen_rect) .delay_time(0.f)); @@ -323,10 +337,10 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) // tooltips for timer legend if (x < mBarRect.mLeft) { - LLFastTimer::NamedTimer* idp = getLegendID(y); + BlockTimerStatHandle* idp = getLegendID(y); if (idp) { - LLToolTipMgr::instance().show(idp->getToolTip()); + LLToolTipMgr::instance().show(get_tooltip(*idp, 0, mRecording)); return TRUE; } @@ -338,1221 +352,1300 @@ BOOL LLFastTimerView::handleToolTip(S32 x, S32 y, MASK mask) BOOL LLFastTimerView::handleScrollWheel(S32 x, S32 y, S32 clicks) { - LLFastTimer::sPauseHistory = TRUE; + setPauseState(true); mScrollIndex = llclamp( mScrollIndex + clicks, 0, - llmin(LLFastTimer::getLastFrameIndex(), (S32)LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); + llmin((S32)mRecording.getNumRecordedPeriods(), (S32)mRecording.getNumRecordedPeriods() - MAX_VISIBLE_HISTORY)); return TRUE; } -static LLFastTimer::DeclareTimer FTM_RENDER_TIMER("Timers"); +static BlockTimerStatHandle FTM_RENDER_TIMER("Timers"); +static const S32 MARGIN = 10; +static const S32 LEGEND_WIDTH = 220; -static std::map<LLFastTimer::NamedTimer*, LLColor4> sTimerColors; +static std::vector<LLColor4> sTimerColors; void LLFastTimerView::draw() { - LLFastTimer t(FTM_RENDER_TIMER); - - std::string tdesc; - - F64 clock_freq = (F64)LLFastTimer::countsPerSecond(); - F64 iclock_freq = 1000.0 / clock_freq; - - S32 margin = 10; - S32 height = getRect().getHeight(); - S32 width = getRect().getWidth(); + LL_RECORD_BLOCK_TIME(FTM_RENDER_TIMER); - LLRect new_rect; - new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); - setRect(new_rect); - - S32 left, top, right, bottom; - S32 x, y, barw, barh, dx, dy; - S32 texth; - LLPointer<LLUIImage> box_imagep = LLUI::getUIImage("Rounded_Square"); - - // Draw the window background - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); - - S32 xleft = margin; - S32 ytop = margin; - - // Draw some help + if (!mPauseHistory) { - - x = xleft; - y = height - ytop; - texth = (S32)LLFontGL::getFontMonospace()->getLineHeight(); - - char modedesc[][32] = { - "2 x Average ", - "Max ", - "Recent Max ", - "100 ms " - }; - char centerdesc[][32] = { - "Left ", - "Centered ", - "Ordered " - }; - - tdesc = llformat("Full bar = %s [Click to pause/reset] [SHIFT-Click to toggle]",modedesc[mDisplayMode]); - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); - - x = xleft, y -= (texth + 2); - tdesc = llformat("Justification = %s [CTRL-Click to toggle]",centerdesc[mDisplayCenter]); - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); - y -= (texth + 2); - - LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected] [ALT-Click toggle counts] [ALT-SHIFT-Click sub hidden]"), - 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); - y -= (texth + 2); + mRecording.appendRecording(LLTrace::get_frame_recording().getLastRecording()); + mTimerBarRows.pop_back(); + mTimerBarRows.push_front(TimerBarRow()); } - S32 histmax = llmin(LLFastTimer::getLastFrameIndex()+1, MAX_VISIBLE_HISTORY); + mDisplayMode = llclamp(getChild<LLComboBox>("time_scale_combo")->getCurrentIndex(), 0, 3); + mDisplayType = (EDisplayType)llclamp(getChild<LLComboBox>("metric_combo")->getCurrentIndex(), 0, 2); - // Draw the legend - xleft = margin; - ytop = y; + generateUniqueColors(); - y -= (texth + 2); + LLView::drawChildren(); + //getChild<LLLayoutStack>("timer_bars_stack")->updateLayout(); + //getChild<LLLayoutStack>("legend_stack")->updateLayout(); + LLView* bars_panel = getChildView("bars_panel"); + bars_panel->localRectToOtherView(bars_panel->getLocalRect(), &mBarRect, this); - sTimerColors[&getFrameTimer()] = LLColor4::grey; + LLView* lines_panel = getChildView("lines_panel"); + lines_panel->localRectToOtherView(lines_panel->getLocalRect(), &mGraphRect, this); - F32 hue = 0.f; + LLView* legend_panel = getChildView("legend"); + legend_panel->localRectToOtherView(legend_panel->getLocalRect(), &mLegendRect, this); - for (timer_tree_iterator_t it = begin_timer_tree(getFrameTimer()); - it != timer_tree_iterator_t(); - ++it) - { - LLFastTimer::NamedTimer* idp = (*it); + // Draw the window background + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gl_rect_2d(getLocalRect(), LLColor4(0.f, 0.f, 0.f, 0.25f)); - const F32 HUE_INCREMENT = 0.23f; - hue = fmodf(hue + HUE_INCREMENT, 1.f); - // saturation increases with depth - F32 saturation = clamp_rescale((F32)idp->getDepth(), 0.f, 3.f, 0.f, 1.f); - // lightness alternates with depth - F32 lightness = idp->getDepth() % 2 ? 0.5f : 0.6f; + drawHelp(getRect().getHeight() - MARGIN); + drawLegend(); + + //mBarRect.mLeft = MARGIN + LEGEND_WIDTH + 8; + //mBarRect.mTop = y; + //mBarRect.mRight = getRect().getWidth() - MARGIN; + //mBarRect.mBottom = MARGIN + LINE_GRAPH_HEIGHT; + + drawBars(); + drawLineGraph(); + printLineStats(); + LLView::draw(); - LLColor4 child_color; - child_color.setHSL(hue, saturation, lightness); + mAllTimeMax = llmax(mAllTimeMax, mRecording.getLastRecording().getSum(FTM_FRAME)); + mHoverID = NULL; + mHoverBarIndex = -1; +} - sTimerColors[idp] = child_color; +void LLFastTimerView::onOpen(const LLSD& key) +{ + setPauseState(false); + mRecording.reset(); + mRecording.appendPeriodicRecording(LLTrace::get_frame_recording()); + for(std::deque<TimerBarRow>::iterator it = mTimerBarRows.begin(), end_it = mTimerBarRows.end(); + it != end_it; + ++it) + { + delete []it->mBars; + it->mBars = NULL; } +} + +void LLFastTimerView::onClose(bool app_quitting) +{ + setVisible(FALSE); +} - const S32 LEGEND_WIDTH = 220; - { - LLLocalClipRect clip(LLRect(margin, y, LEGEND_WIDTH, margin)); - S32 cur_line = 0; - ft_display_idx.clear(); - std::map<LLFastTimer::NamedTimer*, S32> display_line; - for (timer_tree_iterator_t it = begin_timer_tree(getFrameTimer()); - it != timer_tree_iterator_t(); - ++it) - { - LLFastTimer::NamedTimer* idp = (*it); - display_line[idp] = cur_line; - ft_display_idx.push_back(idp); - cur_line++; +void saveChart(const std::string& label, const char* suffix, LLImageRaw* scratch) +{ + //read result back into raw image + glReadPixels(0, 0, 1024, 512, GL_RGB, GL_UNSIGNED_BYTE, scratch->getData()); - x = xleft; + //write results to disk + LLPointer<LLImagePNG> result = new LLImagePNG(); + result->encode(scratch, 0.f); - left = x; right = x + texth; - top = y; bottom = y - texth; - S32 scale_offset = 0; - if (idp == mHoverID) - { - scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 2.f); - } - gl_rect_2d(left - scale_offset, top + scale_offset, right + scale_offset, bottom - scale_offset, sTimerColors[idp]); + std::string ext = result->getExtension(); + std::string filename = llformat("%s_%s.%s", label.c_str(), suffix, ext.c_str()); + + std::string out_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, filename); + result->save(out_file); +} - F32 ms = 0; - S32 calls = 0; - if (mHoverBarIndex > 0 && mHoverID) - { - S32 hidx = LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex - mHoverBarIndex; - U64 ticks = idp->getHistoricalCount(hidx); - ms = (F32)((F64)ticks * iclock_freq); - calls = (S32)idp->getHistoricalCalls(hidx); - } - else - { - U64 ticks = idp->getCountAverage(); - ms = (F32)((F64)ticks * iclock_freq); - calls = (S32)idp->getCallAverage(); - } +//static +void LLFastTimerView::exportCharts(const std::string& base, const std::string& target) +{ + //allocate render target for drawing charts + LLRenderTarget buffer; + buffer.allocate(1024,512, GL_RGB, FALSE, FALSE); + - if (mDisplayCalls) - { - tdesc = llformat("%s (%d)",idp->getName().c_str(),calls); - } - else - { - tdesc = llformat("%s [%.1f]",idp->getName().c_str(),ms); - } - dx = (texth+4) + idp->getDepth()*8; + LLSD cur; - LLColor4 color = LLColor4::white; - if (idp->getDepth() > 0) - { - S32 line_start_y = (top + bottom) / 2; - S32 line_end_y = line_start_y + ((texth + 2) * (cur_line - display_line[idp->getParent()])) - texth; - gl_line_2d(x + dx - 8, line_start_y, x + dx, line_start_y, color); - S32 line_x = x + (texth + 4) + ((idp->getDepth() - 1) * 8); - gl_line_2d(line_x, line_start_y, line_x, line_end_y, color); - if (idp->getCollapsed() && !idp->getChildren().empty()) - { - gl_line_2d(line_x+4, line_start_y-3, line_x+4, line_start_y+4, color); - } - } + LLSD base_data; - x += dx; - BOOL is_child_of_hover_item = (idp == mHoverID); - LLFastTimer::NamedTimer* next_parent = idp->getParent(); - while(!is_child_of_hover_item && next_parent) - { - is_child_of_hover_item = (mHoverID == next_parent); - if (next_parent->getParent() == next_parent) break; - next_parent = next_parent->getParent(); - } + { //read base log into memory + S32 i = 0; + std::ifstream is(base.c_str()); + while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) + { + base_data[i++] = cur; + } + is.close(); + } - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, - x, y, - color, - LLFontGL::LEFT, LLFontGL::TOP, - is_child_of_hover_item ? LLFontGL::BOLD : LLFontGL::NORMAL); + LLSD cur_data; + std::set<std::string> chart_names; - y -= (texth + 2); + { //read current log into memory + S32 i = 0; + std::ifstream is(target.c_str()); + while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) + { + cur_data[i++] = cur; - if (idp->getCollapsed()) + for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) { - it.skipDescendants(); + std::string label = iter->first; + chart_names.insert(label); } } + is.close(); } - xleft += LEGEND_WIDTH + 8; - // ytop = ytop; + //get time domain + LLSD::Real cur_total_time = 0.0; - // update rectangle that includes timer bars - mBarRect.mLeft = xleft; - mBarRect.mRight = getRect().getWidth(); - mBarRect.mTop = ytop - (LLFontGL::getFontMonospace()->getLineHeight() + 4); - mBarRect.mBottom = margin + LINE_GRAPH_HEIGHT; + for (U32 i = 0; i < cur_data.size(); ++i) + { + cur_total_time += cur_data[i]["Total"]["Time"].asReal(); + } - y = ytop; - barh = (ytop - margin - LINE_GRAPH_HEIGHT) / (MAX_VISIBLE_HISTORY + 2); - dy = barh>>2; // spacing between bars - if (dy < 1) dy = 1; - barh -= dy; - barw = width - xleft - margin; + LLSD::Real base_total_time = 0.0; + for (U32 i = 0; i < base_data.size(); ++i) + { + base_total_time += base_data[i]["Total"]["Time"].asReal(); + } - // Draw the history bars - if (LLFastTimer::getLastFrameIndex() >= 0) - { - LLLocalClipRect clip(LLRect(xleft, ytop, getRect().getWidth() - margin, margin)); + //allocate raw scratch space + LLPointer<LLImageRaw> scratch = new LLImageRaw(1024, 512, 3); - U64 totalticks; - if (!LLFastTimer::sPauseHistory) - { - U64 ticks = getFrameTimer().getHistoricalCount(mScrollIndex); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadIdentity(); + gGL.ortho(-0.05f, 1.05f, -0.05f, 1.05f, -1.0f, 1.0f); - if (LLFastTimer::getCurFrameIndex() >= 10) - { - U64 framec = LLFastTimer::getCurFrameIndex(); - U64 avg = (U64)mAvgCountTotal; - mAvgCountTotal = (avg*framec + ticks) / (framec + 1); - if (ticks > mMaxCountTotal) - { - mMaxCountTotal = ticks; - } - } + //render charts + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + buffer.bindTarget(); - if (ticks < mAvgCountTotal/100 || ticks > mAvgCountTotal*100) - { - LLFastTimer::sResetHistory = true; - } + for (std::set<std::string>::iterator iter = chart_names.begin(); iter != chart_names.end(); ++iter) + { + std::string label = *iter; + + LLSD::Real max_time = 0.0; + LLSD::Integer max_calls = 0; + LLSD::Real max_execution = 0.0; - if (LLFastTimer::getCurFrameIndex() < 10 || LLFastTimer::sResetHistory) - { - mAvgCountTotal = ticks; - mMaxCountTotal = ticks; - LLFastTimer::sResetHistory = false; - } - } + std::vector<LLSD::Real> cur_execution; + std::vector<LLSD::Real> cur_times; + std::vector<LLSD::Integer> cur_calls; - if (mDisplayMode == 0) - { - totalticks = mAvgCountTotal*2; - } - else if (mDisplayMode == 1) - { - totalticks = mMaxCountTotal; - } - else if (mDisplayMode == 2) + std::vector<LLSD::Real> base_execution; + std::vector<LLSD::Real> base_times; + std::vector<LLSD::Integer> base_calls; + + for (U32 i = 0; i < cur_data.size(); ++i) { - // Calculate the max total ticks for the current history - totalticks = 0; - for (S32 j=0; j<histmax; j++) - { - U64 ticks = getFrameTimer().getHistoricalCount(j); + LLSD::Real time = cur_data[i][label]["Time"].asReal(); + LLSD::Integer calls = cur_data[i][label]["Calls"].asInteger(); - if (ticks > totalticks) - totalticks = ticks; + LLSD::Real execution = 0.0; + if (calls > 0) + { + execution = time/calls; + cur_execution.push_back(execution); + cur_times.push_back(time); } - } - else - { - totalticks = (U64)(clock_freq * .1); // 100 ms - } - - // Draw MS ticks - { - U32 ms = (U32)((F64)totalticks * iclock_freq) ; - tdesc = llformat("%.1f ms |", (F32)ms*.25f); - x = xleft + barw/4 - LLFontGL::getFontMonospace()->getWidth(tdesc); - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, - LLFontGL::LEFT, LLFontGL::TOP); - - tdesc = llformat("%.1f ms |", (F32)ms*.50f); - x = xleft + barw/2 - LLFontGL::getFontMonospace()->getWidth(tdesc); - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, - LLFontGL::LEFT, LLFontGL::TOP); - - tdesc = llformat("%.1f ms |", (F32)ms*.75f); - x = xleft + (barw*3)/4 - LLFontGL::getFontMonospace()->getWidth(tdesc); - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, - LLFontGL::LEFT, LLFontGL::TOP); - - tdesc = llformat( "%d ms |", ms); - x = xleft + barw - LLFontGL::getFontMonospace()->getWidth(tdesc); - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, - LLFontGL::LEFT, LLFontGL::TOP); + cur_calls.push_back(calls); } - // Draw borders + for (U32 i = 0; i < base_data.size(); ++i) { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f(0.5f,0.5f,0.5f,0.5f); + LLSD::Real time = base_data[i][label]["Time"].asReal(); + LLSD::Integer calls = base_data[i][label]["Calls"].asInteger(); - S32 by = y + 2; - - y -= ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4); + LLSD::Real execution = 0.0; + if (calls > 0) + { + execution = time/calls; + base_execution.push_back(execution); + base_times.push_back(time); + } - //heading - gl_rect_2d(xleft-5, by, getRect().getWidth()-5, y+5, FALSE); + base_calls.push_back(calls); + } - //tree view - gl_rect_2d(5, by, xleft-10, 5, FALSE); + std::sort(base_calls.begin(), base_calls.end()); + std::sort(base_times.begin(), base_times.end()); + std::sort(base_execution.begin(), base_execution.end()); - by = y + 5; - //average bar - gl_rect_2d(xleft-5, by, getRect().getWidth()-5, by-barh-dy-5, FALSE); - - by -= barh*2+dy; - - //current frame bar - gl_rect_2d(xleft-5, by, getRect().getWidth()-5, by-barh-dy-2, FALSE); - - by -= barh+dy+1; - - //history bars - gl_rect_2d(xleft-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-barh-dy-2, FALSE); - - by = LINE_GRAPH_HEIGHT-barh-dy-7; - - //line graph - mGraphRect = LLRect(xleft-5, by, getRect().getWidth()-5, 5); - - gl_rect_2d(mGraphRect, FALSE); + std::sort(cur_calls.begin(), cur_calls.end()); + std::sort(cur_times.begin(), cur_times.end()); + std::sort(cur_execution.begin(), cur_execution.end()); + + //remove outliers + const U32 OUTLIER_CUTOFF = 512; + if (base_times.size() > OUTLIER_CUTOFF) + { + ll_remove_outliers(base_times, 1.f); + } + + if (base_execution.size() > OUTLIER_CUTOFF) + { + ll_remove_outliers(base_execution, 1.f); + } + + if (cur_times.size() > OUTLIER_CUTOFF) + { + ll_remove_outliers(cur_times, 1.f); + } + + if (cur_execution.size() > OUTLIER_CUTOFF) + { + ll_remove_outliers(cur_execution, 1.f); + } + + + max_time = llmax(base_times.empty() ? 0.0 : *base_times.rbegin(), cur_times.empty() ? 0.0 : *cur_times.rbegin()); + max_calls = llmax(base_calls.empty() ? 0 : *base_calls.rbegin(), cur_calls.empty() ? 0 : *cur_calls.rbegin()); + max_execution = llmax(base_execution.empty() ? 0.0 : *base_execution.rbegin(), cur_execution.empty() ? 0.0 : *cur_execution.rbegin()); + + + LLVector3 last_p; + + //==================================== + // basic + //==================================== + buffer.clear(); + + last_p.clear(); + + LLGLDisable cull(GL_CULL_FACE); + + LLVector3 base_col(0, 0.7f, 0.f); + LLVector3 cur_col(1.f, 0.f, 0.f); + + gGL.setSceneBlendType(LLRender::BT_ADD); + + gGL.color3fv(base_col.mV); + for (U32 i = 0; i < base_times.size(); ++i) + { + gGL.begin(LLRender::TRIANGLE_STRIP); + gGL.vertex3fv(last_p.mV); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + last_p.set((F32)i/(F32) base_times.size(), base_times[i]/max_time, 0.f); + gGL.vertex3fv(last_p.mV); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + gGL.end(); } - mBarStart.clear(); - mBarEnd.clear(); + gGL.flush(); - // Draw bars for each history entry - // Special: -1 = show running average - gGL.getTexUnit(0)->bind(box_imagep->getImage()); - for (S32 j=-1; j<histmax && y > LINE_GRAPH_HEIGHT; j++) + + last_p.clear(); { - mBarStart.push_back(std::vector<S32>()); - mBarEnd.push_back(std::vector<S32>()); - int sublevel_dx[FTV_MAX_DEPTH]; - int sublevel_left[FTV_MAX_DEPTH]; - int sublevel_right[FTV_MAX_DEPTH]; - S32 tidx; - if (j >= 0) - { - tidx = LLFastTimer::NamedTimer::HISTORY_NUM - j - 1 - mScrollIndex; - } - else + LLGLEnable blend(GL_BLEND); + + gGL.color3fv(cur_col.mV); + for (U32 i = 0; i < cur_times.size(); ++i) { - tidx = -1; + gGL.begin(LLRender::TRIANGLE_STRIP); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + gGL.vertex3fv(last_p.mV); + last_p.set((F32) i / (F32) cur_times.size(), cur_times[i]/max_time, 0.f); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + gGL.vertex3fv(last_p.mV); + gGL.end(); } - x = xleft; - - // draw the bars for each stat - std::vector<S32> xpos; - std::vector<S32> deltax; - xpos.push_back(xleft); - - LLFastTimer::NamedTimer* prev_id = NULL; + gGL.flush(); + } - S32 i = 0; - for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer()); - it != end_timer_tree(); - ++it, ++i) - { - LLFastTimer::NamedTimer* idp = (*it); - F32 frac = tidx == -1 - ? (F32)idp->getCountAverage() / (F32)totalticks - : (F32)idp->getHistoricalCount(tidx) / (F32)totalticks; + saveChart(label, "time", scratch); - dx = llround(frac * (F32)barw); - S32 prev_delta_x = deltax.empty() ? 0 : deltax.back(); - deltax.push_back(dx); - - int level = idp->getDepth() - 1; - - while ((S32)xpos.size() > level + 1) - { - xpos.pop_back(); - } - left = xpos.back(); - - if (level == 0) - { - sublevel_left[level] = xleft; - sublevel_dx[level] = dx; - sublevel_right[level] = sublevel_left[level] + sublevel_dx[level]; - } - else if (prev_id && prev_id->getDepth() < idp->getDepth()) - { - U64 sublevelticks = 0; - - for (LLFastTimer::NamedTimer::child_const_iter it = prev_id->beginChildren(); - it != prev_id->endChildren(); - ++it) - { - sublevelticks += (tidx == -1) - ? (*it)->getCountAverage() - : (*it)->getHistoricalCount(tidx); - } - - F32 subfrac = (F32)sublevelticks / (F32)totalticks; - sublevel_dx[level] = (int)(subfrac * (F32)barw + .5f); - - if (mDisplayCenter == ALIGN_CENTER) - { - left += (prev_delta_x - sublevel_dx[level])/2; - } - else if (mDisplayCenter == ALIGN_RIGHT) - { - left += (prev_delta_x - sublevel_dx[level]); - } - - sublevel_left[level] = left; - sublevel_right[level] = sublevel_left[level] + sublevel_dx[level]; - } - - right = left + dx; - xpos.back() = right; - xpos.push_back(left); - - mBarStart.back().push_back(left); - mBarEnd.back().push_back(right); - - top = y; - bottom = y - barh; - - if (right > left) - { - //U32 rounded_edges = 0; - LLColor4 color = sTimerColors[idp];//*ft_display_table[i].color; - S32 scale_offset = 0; - - BOOL is_child_of_hover_item = (idp == mHoverID); - LLFastTimer::NamedTimer* next_parent = idp->getParent(); - while(!is_child_of_hover_item && next_parent) - { - is_child_of_hover_item = (mHoverID == next_parent); - if (next_parent->getParent() == next_parent) break; - next_parent = next_parent->getParent(); - } - - if (idp == mHoverID) - { - scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 3.f); - //color = lerp(color, LLColor4::black, -0.4f); - } - else if (mHoverID != NULL && !is_child_of_hover_item) - { - color = lerp(color, LLColor4::grey, 0.8f); - } - - gGL.color4fv(color.mV); - F32 start_fragment = llclamp((F32)(left - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f); - F32 end_fragment = llclamp((F32)(right - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f); - gl_segmented_rect_2d_fragment_tex(sublevel_left[level], top - level + scale_offset, sublevel_right[level], bottom + level - scale_offset, box_imagep->getTextureWidth(), box_imagep->getTextureHeight(), 16, start_fragment, end_fragment); + //====================================== + // calls + //====================================== + buffer.clear(); - } + last_p.clear(); - if ((*it)->getCollapsed()) - { - it.skipDescendants(); - } - - prev_id = idp; - } - y -= (barh + dy); - if (j < 0) - y -= barh; + gGL.color3fv(base_col.mV); + for (U32 i = 0; i < base_calls.size(); ++i) + { + gGL.begin(LLRender::TRIANGLE_STRIP); + gGL.vertex3fv(last_p.mV); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + last_p.set((F32) i / (F32) base_calls.size(), (F32)base_calls[i]/max_calls, 0.f); + gGL.vertex3fv(last_p.mV); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + gGL.end(); } - //draw line graph history + gGL.flush(); + { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLLocalClipRect clip(mGraphRect); - - //normalize based on last frame's maximum - static U64 last_max = 0; - static F32 alpha_interp = 0.f; - U64 max_ticks = llmax(last_max, (U64) 1); - F32 ms = (F32)((F64)max_ticks * iclock_freq); - - //display y-axis range - std::string tdesc; - if (mDisplayCalls) - tdesc = llformat("%d calls", (int)max_ticks); - else if (mDisplayHz) - tdesc = llformat("%d Hz", (int)max_ticks); - else - tdesc = llformat("%4.2f ms", ms); - - x = mGraphRect.mRight - LLFontGL::getFontMonospace()->getWidth(tdesc)-5; - y = mGraphRect.mTop - LLFontGL::getFontMonospace()->getLineHeight(); - - LLFontGL::getFontMonospace()->renderUTF8(tdesc, 0, x, y, LLColor4::white, - LLFontGL::LEFT, LLFontGL::TOP); - - //highlight visible range - { - S32 first_frame = LLFastTimer::NamedTimer::HISTORY_NUM - mScrollIndex; - S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; - - F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(LLFastTimer::NamedTimer::HISTORY_NUM-1); - - F32 right = (F32) mGraphRect.mLeft + frame_delta*first_frame; - F32 left = (F32) mGraphRect.mLeft + frame_delta*last_frame; - - gGL.color4f(0.5f,0.5f,0.5f,0.3f); - gl_rect_2d((S32) left, mGraphRect.mTop, (S32) right, mGraphRect.mBottom); - - if (mHoverBarIndex >= 0) - { - S32 bar_frame = first_frame - mHoverBarIndex; - F32 bar = (F32) mGraphRect.mLeft + frame_delta*bar_frame; + LLGLEnable blend(GL_BLEND); + gGL.color3fv(cur_col.mV); + last_p.clear(); - gGL.color4f(0.5f,0.5f,0.5f,1); - - gGL.begin(LLRender::LINES); - gGL.vertex2i((S32)bar, mGraphRect.mBottom); - gGL.vertex2i((S32)bar, mGraphRect.mTop); - gGL.end(); - } - } - - U64 cur_max = 0; - for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer()); - it != end_timer_tree(); - ++it) + for (U32 i = 0; i < cur_calls.size(); ++i) { - LLFastTimer::NamedTimer* idp = (*it); - - //fatten highlighted timer - if (mHoverID == idp) - { - gGL.flush(); - glLineWidth(3); - } - - const F32 * col = sTimerColors[idp].mV;// ft_display_table[idx].color->mV; - - F32 alpha = 1.f; - - if (mHoverID != NULL && - idp != mHoverID) - { //fade out non-highlighted timers - if (idp->getParent() != mHoverID) - { - alpha = alpha_interp; - } - } - - gGL.color4f(col[0], col[1], col[2], alpha); gGL.begin(LLRender::TRIANGLE_STRIP); - for (U32 j = llmax(0, LLFastTimer::NamedTimer::HISTORY_NUM - LLFastTimer::getLastFrameIndex()); - j < LLFastTimer::NamedTimer::HISTORY_NUM; - j++) - { - U64 ticks = idp->getHistoricalCount(j); - - if (mDisplayHz) - { - F64 tc = (F64) (ticks+1) * iclock_freq; - tc = 1000.f/tc; - ticks = llmin((U64) tc, (U64) 1024); - } - else if (mDisplayCalls) - { - ticks = (S32)idp->getHistoricalCalls(j); - } - - if (alpha == 1.f) - { - //normalize to highlighted timer - cur_max = llmax(cur_max, ticks); - } - F32 x = mGraphRect.mLeft + ((F32) (mGraphRect.getWidth()))/(LLFastTimer::NamedTimer::HISTORY_NUM-1)*j; - F32 y = mGraphRect.mBottom + (F32) mGraphRect.getHeight()/max_ticks*ticks; - gGL.vertex2f(x,y); - gGL.vertex2f(x,mGraphRect.mBottom); - } + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + gGL.vertex3fv(last_p.mV); + last_p.set((F32) i / (F32) cur_calls.size(), (F32) cur_calls[i]/max_calls, 0.f); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + gGL.vertex3fv(last_p.mV); gGL.end(); - if (mHoverID == idp) - { - gGL.flush(); - glLineWidth(1); - } - - if (idp->getCollapsed()) - { - //skip hidden timers - it.skipDescendants(); - } } - //interpolate towards new maximum - last_max = (U64) lerp((F32)last_max, (F32) cur_max, LLCriticalDamp::getInterpolant(0.1f)); - if (last_max - cur_max <= 1 || cur_max - last_max <= 1) - { - last_max = cur_max; - } - F32 alpha_target = last_max > cur_max ? - llmin((F32) last_max/ (F32) cur_max - 1.f,1.f) : - llmin((F32) cur_max/ (F32) last_max - 1.f,1.f); - alpha_interp = lerp(alpha_interp, alpha_target, LLCriticalDamp::getInterpolant(0.1f)); + gGL.flush(); + } - if (mHoverID != NULL) - { - x = (mGraphRect.mRight + mGraphRect.mLeft)/2; - y = mGraphRect.mBottom + 8; - - LLFontGL::getFontMonospace()->renderUTF8( - mHoverID->getName(), - 0, - x, y, - LLColor4::white, - LLFontGL::LEFT, LLFontGL::BOTTOM); - } + saveChart(label, "calls", scratch); + + //====================================== + // execution + //====================================== + buffer.clear(); + + + gGL.color3fv(base_col.mV); + U32 count = 0; + U32 total_count = base_execution.size(); + + last_p.clear(); + + for (std::vector<LLSD::Real>::iterator iter = base_execution.begin(); iter != base_execution.end(); ++iter) + { + gGL.begin(LLRender::TRIANGLE_STRIP); + gGL.vertex3fv(last_p.mV); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + last_p.set((F32)count/(F32)total_count, *iter/max_execution, 0.f); + gGL.vertex3fv(last_p.mV); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + gGL.end(); + count++; } - } - // Output stats for clicked bar to log - if (mPrintStats >= 0) - { - std::string legend_stat; - bool first = true; - for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer()); - it != end_timer_tree(); - ++it) + last_p.clear(); + { - LLFastTimer::NamedTimer* idp = (*it); + LLGLEnable blend(GL_BLEND); + gGL.color3fv(cur_col.mV); + count = 0; + total_count = cur_execution.size(); - if (!first) + for (std::vector<LLSD::Real>::iterator iter = cur_execution.begin(); iter != cur_execution.end(); ++iter) { - legend_stat += ", "; + gGL.begin(LLRender::TRIANGLE_STRIP); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + gGL.vertex3fv(last_p.mV); + last_p.set((F32)count/(F32)total_count, *iter/max_execution, 0.f); + gGL.vertex3f(last_p.mV[0], 0.f, 0.f); + gGL.vertex3fv(last_p.mV); + gGL.end(); + count++; } - first = false; - legend_stat += idp->getName(); - if (idp->getCollapsed()) - { - it.skipDescendants(); - } + gGL.flush(); } - llinfos << legend_stat << llendl; - std::string timer_stat; - first = true; - for(timer_tree_iterator_t it = begin_timer_tree(getFrameTimer()); - it != end_timer_tree(); - ++it) + saveChart(label, "execution", scratch); + } + + buffer.flush(); + + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); +} + +//static +LLSD LLFastTimerView::analyzePerformanceLogDefault(std::istream& is) +{ + LLSD ret; + + LLSD cur; + + LLSD::Real total_time = 0.0; + LLSD::Integer total_frames = 0; + + typedef std::map<std::string,LLViewerStats::StatsAccumulator> stats_map_t; + stats_map_t time_stats; + stats_map_t sample_stats; + + while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) + { + for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) { - LLFastTimer::NamedTimer* idp = (*it); + std::string label = iter->first; - if (!first) - { - timer_stat += ", "; - } - first = false; + F64 time = iter->second["Time"].asReal(); - U64 ticks; - if (mPrintStats > 0) - { - ticks = idp->getHistoricalCount(mPrintStats); - } - else + // Skip the total figure + if(label.compare("Total") != 0) { - ticks = idp->getCountAverage(); - } - F32 ms = (F32)((F64)ticks * iclock_freq); - - timer_stat += llformat("%.1f",ms); + total_time += time; + } - if (idp->getCollapsed()) + if (time > 0.0) { - it.skipDescendants(); + LLSD::Integer samples = iter->second["Calls"].asInteger(); + + time_stats[label].push(time); + sample_stats[label].push(samples); } } - llinfos << timer_stat << llendl; - mPrintStats = -1; + total_frames++; + } + + for(stats_map_t::iterator it = time_stats.begin(); it != time_stats.end(); ++it) + { + std::string label = it->first; + ret[label]["TotalTime"] = time_stats[label].mSum; + ret[label]["MeanTime"] = time_stats[label].getMean(); + ret[label]["MaxTime"] = time_stats[label].getMaxValue(); + ret[label]["MinTime"] = time_stats[label].getMinValue(); + ret[label]["StdDevTime"] = time_stats[label].getStdDev(); + + ret[label]["Samples"] = sample_stats[label].mSum; + ret[label]["MaxSamples"] = sample_stats[label].getMaxValue(); + ret[label]["MinSamples"] = sample_stats[label].getMinValue(); + ret[label]["StdDevSamples"] = sample_stats[label].getStdDev(); + + ret[label]["Frames"] = (LLSD::Integer)time_stats[label].getCount(); } - mHoverID = NULL; - mHoverBarIndex = -1; + ret["SessionTime"] = total_time; + ret["FrameCount"] = total_frames; + + return ret; - LLView::draw(); } -F64 LLFastTimerView::getTime(const std::string& name) +//static +void LLFastTimerView::doAnalysisDefault(std::string baseline, std::string target, std::string output) { - const LLFastTimer::NamedTimer* timerp = LLFastTimer::getTimerByName(name); - if (timerp) + // Open baseline and current target, exit if one is inexistent + std::ifstream base_is(baseline.c_str()); + std::ifstream target_is(target.c_str()); + if (!base_is.is_open() || !target_is.is_open()) { - return (F64)timerp->getCountAverage() / (F64)LLFastTimer::countsPerSecond(); + LL_WARNS() << "'-analyzeperformance' error : baseline or current target file inexistent" << LL_ENDL; + base_is.close(); + target_is.close(); + return; } - return 0.0; -} -void saveChart(const std::string& label, const char* suffix, LLImageRaw* scratch) -{ - //read result back into raw image - glReadPixels(0, 0, 1024, 512, GL_RGB, GL_UNSIGNED_BYTE, scratch->getData()); + //analyze baseline + LLSD base = analyzePerformanceLogDefault(base_is); + base_is.close(); - //write results to disk - LLPointer<LLImagePNG> result = new LLImagePNG(); - result->encode(scratch, 0.f); + //analyze current + LLSD current = analyzePerformanceLogDefault(target_is); + target_is.close(); - std::string ext = result->getExtension(); - std::string filename = llformat("%s_%s.%s", label.c_str(), suffix, ext.c_str()); - - std::string out_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, filename); - result->save(out_file); + //output comparison + std::ofstream os(output.c_str()); + + LLSD::Real session_time = current["SessionTime"].asReal(); + os << + "Label, " + "% Change, " + "% of Session, " + "Cur Min, " + "Cur Max, " + "Cur Mean/sample, " + "Cur Mean/frame, " + "Cur StdDev/frame, " + "Cur Total, " + "Cur Frames, " + "Cur Samples, " + "Base Min, " + "Base Max, " + "Base Mean/sample, " + "Base Mean/frame, " + "Base StdDev/frame, " + "Base Total, " + "Base Frames, " + "Base Samples\n"; + + for (LLSD::map_iterator iter = base.beginMap(); iter != base.endMap(); ++iter) + { + LLSD::String label = iter->first; + + if (current[label]["Samples"].asInteger() == 0 || + base[label]["Samples"].asInteger() == 0) + { + //cannot compare + continue; + } + LLSD::Real a = base[label]["TotalTime"].asReal() / base[label]["Samples"].asReal(); + LLSD::Real b = current[label]["TotalTime"].asReal() / current[label]["Samples"].asReal(); + + LLSD::Real diff = b-a; + + LLSD::Real perc = diff/a * 100; + + os << llformat("%s, %.2f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d\n", + label.c_str(), + (F32) perc, + (F32) (current[label]["TotalTime"].asReal()/session_time * 100.0), + + (F32) current[label]["MinTime"].asReal(), + (F32) current[label]["MaxTime"].asReal(), + (F32) b, + (F32) current[label]["MeanTime"].asReal(), + (F32) current[label]["StdDevTime"].asReal(), + (F32) current[label]["TotalTime"].asReal(), + current[label]["Frames"].asInteger(), + current[label]["Samples"].asInteger(), + (F32) base[label]["MinTime"].asReal(), + (F32) base[label]["MaxTime"].asReal(), + (F32) a, + (F32) base[label]["MeanTime"].asReal(), + (F32) base[label]["StdDevTime"].asReal(), + (F32) base[label]["TotalTime"].asReal(), + base[label]["Frames"].asInteger(), + base[label]["Samples"].asInteger()); + } + + exportCharts(baseline, target); + + os.flush(); + os.close(); } //static -void LLFastTimerView::exportCharts(const std::string& base, const std::string& target) +void LLFastTimerView::outputAllMetrics() { - //allocate render target for drawing charts - LLRenderTarget buffer; - buffer.allocate(1024,512, GL_RGB, FALSE, FALSE); - + if (LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters()) + { + for (LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin(); + iter != LLMetricPerformanceTesterBasic::sTesterMap.end(); ++iter) + { + LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second); + tester->outputTestResults(); + } + } +} - LLSD cur; +//static +void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::string output) +{ + if(BlockTimer::sLog) + { + doAnalysisDefault(baseline, target, output) ; + return ; + } - LLSD base_data; + if(BlockTimer::sMetricLog) + { + LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline, target, output) ; + return ; + } +} - { //read base log into memory - S32 i = 0; - std::ifstream is(base.c_str()); - while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) + +void LLFastTimerView::printLineStats() +{ + // Output stats for clicked bar to log + if (mStatsIndex >= 0) + { + std::string legend_stat; + bool first = true; + for(block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); + it != LLTrace::end_block_timer_tree_df(); + ++it) { - base_data[i++] = cur; - } - is.close(); - } + BlockTimerStatHandle* idp = (*it); - LLSD cur_data; - std::set<std::string> chart_names; + if (!first) + { + legend_stat += ", "; + } + first = false; + legend_stat += idp->getName(); - { //read current log into memory - S32 i = 0; - std::ifstream is(target.c_str()); - while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) + //if (idp->getTreeNode().mCollapsed) + //{ + // it.skipDescendants(); + //} + } + LL_INFOS() << legend_stat << LL_ENDL; + + std::string timer_stat; + first = true; + for(block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); + it != LLTrace::end_block_timer_tree_df(); + ++it) { - cur_data[i++] = cur; + BlockTimerStatHandle* idp = (*it); - for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) + if (!first) { - std::string label = iter->first; - chart_names.insert(label); + timer_stat += ", "; } - } - is.close(); - } + first = false; - //get time domain - LLSD::Real cur_total_time = 0.0; + F32Seconds ticks; + if (mStatsIndex == 0) + { + ticks = mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH); + } + else + { + ticks = mRecording.getPrevRecording(mStatsIndex).getSum(*idp); + } + F32Milliseconds ms = ticks; - for (U32 i = 0; i < cur_data.size(); ++i) - { - cur_total_time += cur_data[i]["Total"]["Time"].asReal(); - } + timer_stat += llformat("%.1f",ms.value()); - LLSD::Real base_total_time = 0.0; - for (U32 i = 0; i < base_data.size(); ++i) - { - base_total_time += base_data[i]["Total"]["Time"].asReal(); + //if (idp->getTreeNode().mCollapsed) + //{ + // it.skipDescendants(); + //} + } + LL_INFOS() << timer_stat << LL_ENDL; + mStatsIndex = -1; } +} - //allocate raw scratch space - LLPointer<LLImageRaw> scratch = new LLImageRaw(1024, 512, 3); - - gGL.pushMatrix(); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.loadIdentity(); - gGL.ortho(-0.05f, 1.05f, -0.05f, 1.05f, -1.0f, 1.0f); +static LLTrace::BlockTimerStatHandle FTM_DRAW_LINE_GRAPH("Draw line graph"); - //render charts +void LLFastTimerView::drawLineGraph() +{ + LL_RECORD_BLOCK_TIME(FTM_DRAW_LINE_GRAPH); + //draw line graph history gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - buffer.bindTarget(); + LLLocalClipRect clip(mGraphRect); - for (std::set<std::string>::iterator iter = chart_names.begin(); iter != chart_names.end(); ++iter) + //normalize based on last frame's maximum + static F32Seconds max_time(0.000001); + static U32 max_calls = 0; + static F32 alpha_interp = 0.f; + + //highlight visible range { - std::string label = *iter; - - LLSD::Real max_time = 0.0; - LLSD::Integer max_calls = 0; - LLSD::Real max_execution = 0.0; + S32 first_frame = mRecording.getNumRecordedPeriods() - mScrollIndex; + S32 last_frame = first_frame - MAX_VISIBLE_HISTORY; - std::vector<LLSD::Real> cur_execution; - std::vector<LLSD::Real> cur_times; - std::vector<LLSD::Integer> cur_calls; + F32 frame_delta = ((F32) (mGraphRect.getWidth()))/(mRecording.getNumRecordedPeriods()-1); - std::vector<LLSD::Real> base_execution; - std::vector<LLSD::Real> base_times; - std::vector<LLSD::Integer> base_calls; + F32 right = (F32) mGraphRect.mLeft + frame_delta*first_frame; + F32 left = (F32) mGraphRect.mLeft + frame_delta*last_frame; - for (U32 i = 0; i < cur_data.size(); ++i) + gGL.color4f(0.5f,0.5f,0.5f,0.3f); + gl_rect_2d((S32) left, mGraphRect.mTop, (S32) right, mGraphRect.mBottom); + + if (mHoverBarIndex > 0) { - LLSD::Real time = cur_data[i][label]["Time"].asReal(); - LLSD::Integer calls = cur_data[i][label]["Calls"].asInteger(); + S32 bar_frame = first_frame - (mScrollIndex + mHoverBarIndex) - 1; + F32 bar = (F32) mGraphRect.mLeft + frame_delta*bar_frame; - LLSD::Real execution = 0.0; - if (calls > 0) - { - execution = time/calls; - cur_execution.push_back(execution); - cur_times.push_back(time); - } + gGL.color4f(0.5f,0.5f,0.5f,1); - cur_calls.push_back(calls); + gGL.begin(LLRender::LINES); + gGL.vertex2i((S32)bar, mGraphRect.mBottom); + gGL.vertex2i((S32)bar, mGraphRect.mTop); + gGL.end(); } + } - for (U32 i = 0; i < base_data.size(); ++i) - { - LLSD::Real time = base_data[i][label]["Time"].asReal(); - LLSD::Integer calls = base_data[i][label]["Calls"].asInteger(); - - LLSD::Real execution = 0.0; - if (calls > 0) - { - execution = time/calls; - base_execution.push_back(execution); - base_times.push_back(time); - } + F32Seconds cur_max(0); + U32 cur_max_calls = 0; + for(block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); + it != LLTrace::end_block_timer_tree_df(); + ++it) + { + BlockTimerStatHandle* idp = (*it); - base_calls.push_back(calls); + //fatten highlighted timer + if (mHoverID == idp) + { + gGL.flush(); + glLineWidth(3); } - std::sort(base_calls.begin(), base_calls.end()); - std::sort(base_times.begin(), base_times.end()); - std::sort(base_execution.begin(), base_execution.end()); + llassert(idp->getIndex() < sTimerColors.size()); + const F32 * col = sTimerColors[idp->getIndex()].mV;// ft_display_table[idx].color->mV; - std::sort(cur_calls.begin(), cur_calls.end()); - std::sort(cur_times.begin(), cur_times.end()); - std::sort(cur_execution.begin(), cur_execution.end()); + F32 alpha = 1.f; + bool is_hover_timer = true; - //remove outliers - const U32 OUTLIER_CUTOFF = 512; - if (base_times.size() > OUTLIER_CUTOFF) - { - ll_remove_outliers(base_times, 1.f); + if (mHoverID != NULL && + mHoverID != idp) + { //fade out non-highlighted timers + if (idp->getParent() != mHoverID) + { + alpha = alpha_interp; + is_hover_timer = false; + } } - if (base_execution.size() > OUTLIER_CUTOFF) - { - ll_remove_outliers(base_execution, 1.f); + gGL.color4f(col[0], col[1], col[2], alpha); + gGL.begin(LLRender::TRIANGLE_STRIP); + F32 call_scale_factor = (F32)mGraphRect.getHeight() / (F32)max_calls; + F32 time_scale_factor = (F32)mGraphRect.getHeight() / max_time.value(); + F32 hz_scale_factor = (F32) mGraphRect.getHeight() / (1.f / max_time.value()); + for (U32 j = mRecording.getNumRecordedPeriods(); + j > 0; + j--) + { + LLTrace::Recording& recording = mRecording.getPrevRecording(j); + F32Seconds time = llmax(recording.getSum(*idp), F64Seconds(0.000001)); + U32 calls = recording.getSum(idp->callCount()); + + if (is_hover_timer) + { + //normalize to highlighted timer + cur_max = llmax(cur_max, time); + cur_max_calls = llmax(cur_max_calls, calls); + } + F32 x = mGraphRect.mRight - j * (F32)(mGraphRect.getWidth())/(mRecording.getNumRecordedPeriods()-1); + F32 y; + switch(mDisplayType) +{ + case DISPLAY_TIME: + y = mGraphRect.mBottom + time.value() * time_scale_factor; + break; + case DISPLAY_CALLS: + y = mGraphRect.mBottom + (F32)calls * call_scale_factor; + break; + case DISPLAY_HZ: + y = mGraphRect.mBottom + (1.f / time.value()) * hz_scale_factor; + break; + } + gGL.vertex2f(x,y); + gGL.vertex2f(x,mGraphRect.mBottom); } + gGL.end(); - if (cur_times.size() > OUTLIER_CUTOFF) - { - ll_remove_outliers(cur_times, 1.f); + if (mHoverID == idp) + { + gGL.flush(); + glLineWidth(1); } - if (cur_execution.size() > OUTLIER_CUTOFF) - { - ll_remove_outliers(cur_execution, 1.f); + if (idp->getTreeNode().mCollapsed) + { + //skip hidden timers + it.skipDescendants(); } + } + + //interpolate towards new maximum + max_time = (F32Seconds)lerp(max_time.value(), cur_max.value(), LLSmoothInterpolation::getInterpolant(0.1f)); + if (llabs((max_time - cur_max).value()) <= 1) + { + max_time = llmax(F32Microseconds(1.f), F32Microseconds(cur_max)); + } + max_calls = llround(lerp((F32)max_calls, (F32) cur_max_calls, LLSmoothInterpolation::getInterpolant(0.1f))); + if (llabs((S32)(max_calls - cur_max_calls)) <= 1) + { + max_calls = cur_max_calls; + } - max_time = llmax(base_times.empty() ? 0.0 : *base_times.rbegin(), cur_times.empty() ? 0.0 : *cur_times.rbegin()); - max_calls = llmax(base_calls.empty() ? 0 : *base_calls.rbegin(), cur_calls.empty() ? 0 : *cur_calls.rbegin()); - max_execution = llmax(base_execution.empty() ? 0.0 : *base_execution.rbegin(), cur_execution.empty() ? 0.0 : *cur_execution.rbegin()); + // TODO: make sure alpha is correct in DisplayHz mode + F32 alpha_target = (max_time > cur_max) + ? llmin(max_time / cur_max - 1.f,1.f) + : llmin(cur_max/ max_time - 1.f,1.f); + alpha_interp = lerp(alpha_interp, alpha_target, LLSmoothInterpolation::getInterpolant(0.1f)); + if (mHoverID != NULL) + { + S32 x = (mGraphRect.mRight + mGraphRect.mLeft)/2; + S32 y = mGraphRect.mBottom + 8; + + LLFontGL::getFontMonospace()->renderUTF8( + mHoverID->getName(), + 0, + x, y, + LLColor4::white, + LLFontGL::LEFT, LLFontGL::BOTTOM); + } - LLVector3 last_p; + //display y-axis range + std::string axis_label; + switch(mDisplayType) + { + case DISPLAY_TIME: + axis_label = llformat("%4.2f ms", F32Milliseconds(max_time).value()); + break; + case DISPLAY_CALLS: + axis_label = llformat("%d calls", (int)max_calls); + break; + case DISPLAY_HZ: + axis_label = llformat("%4.2f Hz", max_time.value() ? 1.f / max_time.value() : 0.f); + break; + } - //==================================== - // basic - //==================================== - buffer.clear(); + LLFontGL* font = LLFontGL::getFontMonospace(); + S32 x = mGraphRect.mRight - font->getWidth(axis_label)-5; + S32 y = mGraphRect.mTop - font->getLineHeight();; - last_p.clear(); + font->renderUTF8(axis_label, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); +} - LLGLDisable cull(GL_CULL_FACE); +void LLFastTimerView::drawLegend() +{ + // draw legend + S32 dx; + S32 x = mLegendRect.mLeft; + S32 y = mLegendRect.mTop; + const S32 TEXT_HEIGHT = (S32)LLFontGL::getFontMonospace()->getLineHeight(); - LLVector3 base_col(0, 0.7f, 0.f); - LLVector3 cur_col(1.f, 0.f, 0.f); + { + LLLocalClipRect clip(mLegendRect); + S32 cur_line = 0; + ft_display_idx.clear(); + std::map<BlockTimerStatHandle*, S32> display_line; + for (block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); + it != block_timer_tree_df_iterator_t(); + ++it) + { + BlockTimerStatHandle* idp = (*it); + display_line[idp] = cur_line; + ft_display_idx.push_back(idp); + cur_line++; - gGL.setSceneBlendType(LLRender::BT_ADD); + x = MARGIN; - gGL.color3fv(base_col.mV); - for (U32 i = 0; i < base_times.size(); ++i) - { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - last_p.set((F32)i/(F32) base_times.size(), base_times[i]/max_time, 0.f); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.end(); - } - - gGL.flush(); + LLRect bar_rect(x, y, x + TEXT_HEIGHT, y - TEXT_HEIGHT); + S32 scale_offset = 0; + if (idp == mHoverID) + { + scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 2.f); + } + bar_rect.stretch(scale_offset); + llassert(idp->getIndex() < sTimerColors.size()); + gl_rect_2d(bar_rect, sTimerColors[idp->getIndex()]); - - last_p.clear(); - { - LLGLEnable blend(GL_BLEND); - - gGL.color3fv(cur_col.mV); - for (U32 i = 0; i < cur_times.size(); ++i) + F32Milliseconds ms(0); + S32 calls = 0; + if (mHoverBarIndex > 0 && mHoverID) { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - last_p.set((F32) i / (F32) cur_times.size(), cur_times[i]/max_time, 0.f); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - gGL.end(); + S32 hidx = mScrollIndex + mHoverBarIndex; + ms = mRecording.getPrevRecording(hidx).getSum(*idp); + calls = mRecording.getPrevRecording(hidx).getSum(idp->callCount()); + } + else + { + ms = F64Seconds(mRecording.getPeriodMean(*idp, RUNNING_AVERAGE_WIDTH)); + calls = (S32)mRecording.getPeriodMean(idp->callCount(), RUNNING_AVERAGE_WIDTH); } - - gGL.flush(); - } - saveChart(label, "time", scratch); - - //====================================== - // calls - //====================================== - buffer.clear(); + std::string timer_label; + switch(mDisplayType) + { + case DISPLAY_TIME: + timer_label = llformat("%s [%.1f]",idp->getName().c_str(),ms.value()); + break; + case DISPLAY_CALLS: + timer_label = llformat("%s (%d)",idp->getName().c_str(),calls); + break; + case DISPLAY_HZ: + timer_label = llformat("%.1f", ms.value() ? (1.f / ms.value()) : 0.f); + break; + } + dx = (TEXT_HEIGHT+4) + get_depth(idp)*8; - last_p.clear(); + LLColor4 color = LLColor4::white; + if (get_depth(idp) > 0) + { + S32 line_start_y = bar_rect.getCenterY(); + S32 line_end_y = line_start_y + ((TEXT_HEIGHT + 2) * (cur_line - display_line[idp->getParent()])) - TEXT_HEIGHT; + gl_line_2d(x + dx - 8, line_start_y, x + dx, line_start_y, color); + S32 line_x = x + (TEXT_HEIGHT + 4) + ((get_depth(idp) - 1) * 8); + gl_line_2d(line_x, line_start_y, line_x, line_end_y, color); + if (idp->getTreeNode().mCollapsed && !idp->getChildren().empty()) + { + gl_line_2d(line_x+4, line_start_y-3, line_x+4, line_start_y+4, color); + } + } - gGL.color3fv(base_col.mV); - for (U32 i = 0; i < base_calls.size(); ++i) - { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - last_p.set((F32) i / (F32) base_calls.size(), (F32)base_calls[i]/max_calls, 0.f); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.end(); - } - - gGL.flush(); + x += dx; + BOOL is_child_of_hover_item = (idp == mHoverID); + BlockTimerStatHandle* next_parent = idp->getParent(); + while(!is_child_of_hover_item && next_parent) + { + is_child_of_hover_item = (mHoverID == next_parent); + if (next_parent->getParent() == next_parent) break; + next_parent = next_parent->getParent(); + } - { - LLGLEnable blend(GL_BLEND); - gGL.color3fv(cur_col.mV); - last_p.clear(); + LLFontGL::getFontMonospace()->renderUTF8(timer_label, 0, + x, y, + color, + LLFontGL::LEFT, LLFontGL::TOP, + is_child_of_hover_item ? LLFontGL::BOLD : LLFontGL::NORMAL); - for (U32 i = 0; i < cur_calls.size(); ++i) + y -= (TEXT_HEIGHT + 2); + + if (idp->getTreeNode().mCollapsed) { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - last_p.set((F32) i / (F32) cur_calls.size(), (F32) cur_calls[i]/max_calls, 0.f); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - gGL.end(); - + it.skipDescendants(); } - - gGL.flush(); } + } +} - saveChart(label, "calls", scratch); +void LLFastTimerView::generateUniqueColors() +{ + // generate unique colors + { + sTimerColors.resize(LLTrace::BlockTimerStatHandle::getNumIndices()); + sTimerColors[FTM_FRAME.getIndex()] = LLColor4::grey; - //====================================== - // execution - //====================================== - buffer.clear(); + F32 hue = 0.f; + for (block_timer_tree_df_iterator_t it = LLTrace::begin_block_timer_tree_df(FTM_FRAME); + it != block_timer_tree_df_iterator_t(); + ++it) + { + BlockTimerStatHandle* idp = (*it); - gGL.color3fv(base_col.mV); - U32 count = 0; - U32 total_count = base_execution.size(); + const F32 HUE_INCREMENT = 0.23f; + hue = fmodf(hue + HUE_INCREMENT, 1.f); + // saturation increases with depth + F32 saturation = clamp_rescale((F32)get_depth(idp), 0.f, 3.f, 0.f, 1.f); + // lightness alternates with depth + F32 lightness = get_depth(idp) % 2 ? 0.5f : 0.6f; - last_p.clear(); + LLColor4 child_color; + child_color.setHSL(hue, saturation, lightness); - for (std::vector<LLSD::Real>::iterator iter = base_execution.begin(); iter != base_execution.end(); ++iter) - { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - last_p.set((F32)count/(F32)total_count, *iter/max_execution, 0.f); - gGL.vertex3fv(last_p.mV); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.end(); - count++; + llassert(idp->getIndex() < sTimerColors.size()); + sTimerColors[idp->getIndex()] = child_color; } + } +} - last_p.clear(); - - { - LLGLEnable blend(GL_BLEND); - gGL.color3fv(cur_col.mV); - count = 0; - total_count = cur_execution.size(); +void LLFastTimerView::drawHelp( S32 y ) +{ + // Draw some help + const S32 texth = (S32)LLFontGL::getFontMonospace()->getLineHeight(); - for (std::vector<LLSD::Real>::iterator iter = cur_execution.begin(); iter != cur_execution.end(); ++iter) - { - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - last_p.set((F32)count/(F32)total_count, *iter/max_execution, 0.f); - gGL.vertex3f(last_p.mV[0], 0.f, 0.f); - gGL.vertex3fv(last_p.mV); - gGL.end(); - count++; - } + y -= (texth + 2); + y -= (texth + 2); - gGL.flush(); - } + LLFontGL::getFontMonospace()->renderUTF8(std::string("[Right-Click log selected]"), + 0, MARGIN, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); +} - saveChart(label, "execution", scratch); +void LLFastTimerView::drawTicks() +{ + // Draw MS ticks + { + U32Milliseconds ms = mTotalTimeDisplay; + std::string tick_label; + S32 x; + S32 barw = mBarRect.getWidth(); + + tick_label = llformat("%.1f ms |", (F32)ms.value()*.25f); + x = mBarRect.mLeft + barw/4 - LLFontGL::getFontMonospace()->getWidth(tick_label); + LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white, + LLFontGL::LEFT, LLFontGL::TOP); + + tick_label = llformat("%.1f ms |", (F32)ms.value()*.50f); + x = mBarRect.mLeft + barw/2 - LLFontGL::getFontMonospace()->getWidth(tick_label); + LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white, + LLFontGL::LEFT, LLFontGL::TOP); + + tick_label = llformat("%.1f ms |", (F32)ms.value()*.75f); + x = mBarRect.mLeft + (barw*3)/4 - LLFontGL::getFontMonospace()->getWidth(tick_label); + LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white, + LLFontGL::LEFT, LLFontGL::TOP); + + tick_label = llformat( "%d ms |", (U32)ms.value()); + x = mBarRect.mLeft + barw - LLFontGL::getFontMonospace()->getWidth(tick_label); + LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, x, mBarRect.mTop, LLColor4::white, + LLFontGL::LEFT, LLFontGL::TOP); } +} - buffer.flush(); +void LLFastTimerView::drawBorders( S32 y, const S32 x_start, S32 bar_height, S32 dy ) +{ + // Draw borders + { + S32 by = y + 6 + (S32)LLFontGL::getFontMonospace()->getLineHeight(); - gGL.popMatrix(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); + //heading + gl_rect_2d(x_start-5, by, getRect().getWidth()-5, y+5, LLColor4::grey, FALSE); + + //tree view + gl_rect_2d(5, by, x_start-10, 5, LLColor4::grey, FALSE); + + by = y + 5; + //average bar + gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-5, LLColor4::grey, FALSE); + + by -= bar_height*2+dy; + + //current frame bar + gl_rect_2d(x_start-5, by, getRect().getWidth()-5, by-bar_height-dy-2, LLColor4::grey, FALSE); + + by -= bar_height+dy+1; + + //history bars + gl_rect_2d(x_start-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-bar_height-dy-2, LLColor4::grey, FALSE); + + by = LINE_GRAPH_HEIGHT-dy; + + //line graph + //mGraphRect = LLRect(x_start-5, by, getRect().getWidth()-5, 5); + + gl_rect_2d(mGraphRect, FALSE); + } } -//static -LLSD LLFastTimerView::analyzePerformanceLogDefault(std::istream& is) +void LLFastTimerView::updateTotalTime() { - LLSD ret; + switch(mDisplayMode) + { + case 0: + mTotalTimeDisplay = mRecording.getPeriodMean(FTM_FRAME, RUNNING_AVERAGE_WIDTH)*2; + break; + case 1: + mTotalTimeDisplay = mRecording.getPeriodMax(FTM_FRAME); + break; + case 2: + // Calculate the max total ticks for the current history + mTotalTimeDisplay = mRecording.getPeriodMax(FTM_FRAME, 20); + break; + default: + mTotalTimeDisplay = F64Milliseconds(100); + break; + } - LLSD cur; + mTotalTimeDisplay = LLUnits::Milliseconds::fromValue(llceil(mTotalTimeDisplay.valueInUnits<LLUnits::Milliseconds>() / 20.f) * 20.f); +} - LLSD::Real total_time = 0.0; - LLSD::Integer total_frames = 0; +void LLFastTimerView::drawBars() +{ + LLLocalClipRect clip(mBarRect); - typedef std::map<std::string,LLViewerStats::StatsAccumulator> stats_map_t; - stats_map_t time_stats; - stats_map_t sample_stats; + S32 bar_height = mBarRect.getHeight() / (MAX_VISIBLE_HISTORY + 2); + const S32 vpad = llmax(1, bar_height / 4); // spacing between bars + bar_height -= vpad; - while (!is.eof() && LLSDParser::PARSE_FAILURE != LLSDSerialize::fromXML(cur, is)) - { - for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) - { - std::string label = iter->first; + updateTotalTime(); + if (mTotalTimeDisplay <= (F32Seconds)0.0) return; - F64 time = iter->second["Time"].asReal(); + drawTicks(); + const S32 bars_top = mBarRect.mTop - ((S32)LLFontGL::getFontMonospace()->getLineHeight() + 4); + drawBorders(bars_top, mBarRect.mLeft, bar_height, vpad); - // Skip the total figure - if(label.compare("Total") != 0) - { - total_time += time; - } + // Draw bars for each history entry + // Special: 0 = show running average + LLPointer<LLUIImage> bar_image = LLUI::getUIImage("Rounded_Square"); - if (time > 0.0) + const S32 image_width = bar_image->getTextureWidth(); + const S32 image_height = bar_image->getTextureHeight(); + + gGL.getTexUnit(0)->bind(bar_image->getImage()); + { + const S32 histmax = (S32)mRecording.getNumRecordedPeriods(); + + // update widths + if (!mPauseHistory) + { + U32 bar_index = 0; + if (!mAverageTimerRow.mBars) { - LLSD::Integer samples = iter->second["Calls"].asInteger(); + mAverageTimerRow.mBars = new TimerBar[LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount()]; + } + updateTimerBarWidths(&FTM_FRAME, mAverageTimerRow, -1, bar_index); + updateTimerBarOffsets(&FTM_FRAME, mAverageTimerRow); - time_stats[label].push(time); - sample_stats[label].push(samples); + for (S32 history_index = 1; history_index <= histmax; history_index++) + { + llassert(history_index <= mTimerBarRows.size()); + TimerBarRow& row = mTimerBarRows[history_index - 1]; + bar_index = 0; + if (!row.mBars) + { + row.mBars = new TimerBar[LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount()]; + updateTimerBarWidths(&FTM_FRAME, row, history_index, bar_index); + updateTimerBarOffsets(&FTM_FRAME, row); + } } } - total_frames++; - } - - for(stats_map_t::iterator it = time_stats.begin(); it != time_stats.end(); ++it) - { - std::string label = it->first; - ret[label]["TotalTime"] = time_stats[label].mSum; - ret[label]["MeanTime"] = time_stats[label].getMean(); - ret[label]["MaxTime"] = time_stats[label].getMaxValue(); - ret[label]["MinTime"] = time_stats[label].getMinValue(); - ret[label]["StdDevTime"] = time_stats[label].getStdDev(); - - ret[label]["Samples"] = sample_stats[label].mSum; - ret[label]["MaxSamples"] = sample_stats[label].getMaxValue(); - ret[label]["MinSamples"] = sample_stats[label].getMinValue(); - ret[label]["StdDevSamples"] = sample_stats[label].getStdDev(); - - ret[label]["Frames"] = (LLSD::Integer)time_stats[label].getCount(); - } - - ret["SessionTime"] = total_time; - ret["FrameCount"] = total_frames; - return ret; + // draw bars + LLRect frame_bar_rect; + frame_bar_rect.setLeftTopAndSize(mBarRect.mLeft, + bars_top, + llround((mAverageTimerRow.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth()), + bar_height); + mAverageTimerRow.mTop = frame_bar_rect.mTop; + mAverageTimerRow.mBottom = frame_bar_rect.mBottom; + drawBar(frame_bar_rect, mAverageTimerRow, image_width, image_height); + frame_bar_rect.translate(0, -(bar_height + vpad + bar_height)); + + for(S32 bar_index = mScrollIndex; bar_index < llmin(histmax, mScrollIndex + MAX_VISIBLE_HISTORY); ++bar_index) + { + llassert(bar_index < mTimerBarRows.size()); + TimerBarRow& row = mTimerBarRows[bar_index]; + row.mTop = frame_bar_rect.mTop; + row.mBottom = frame_bar_rect.mBottom; + frame_bar_rect.mRight = frame_bar_rect.mLeft + + llround((row.mBars[0].mTotalTime / mTotalTimeDisplay) * mBarRect.getWidth()); + drawBar(frame_bar_rect, row, image_width, image_height); + + frame_bar_rect.translate(0, -(bar_height + vpad)); + } + } + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } -//static -void LLFastTimerView::doAnalysisDefault(std::string baseline, std::string target, std::string output) +static LLTrace::BlockTimerStatHandle FTM_UPDATE_TIMER_BAR_WIDTHS("Update timer bar widths"); + +F32Seconds LLFastTimerView::updateTimerBarWidths(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 history_index, U32& bar_index) { - // Open baseline and current target, exit if one is inexistent - std::ifstream base_is(baseline.c_str()); - std::ifstream target_is(target.c_str()); - if (!base_is.is_open() || !target_is.is_open()) + LL_RECORD_BLOCK_TIME(FTM_UPDATE_TIMER_BAR_WIDTHS); + const F32Seconds self_time = history_index == -1 + ? mRecording.getPeriodMean(time_block->selfTime(), RUNNING_AVERAGE_WIDTH) + : mRecording.getPrevRecording(history_index).getSum(time_block->selfTime()); + + F32Seconds full_time = self_time; + + // reserve a spot for this bar to be rendered before its children + // even though we don't know its size yet + TimerBar& timer_bar = row.mBars[bar_index]; + bar_index++; + + for (BlockTimerStatHandle::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren(); it != end_it; ++it) { - llwarns << "'-analyzeperformance' error : baseline or current target file inexistent" << llendl; - base_is.close(); - target_is.close(); - return; + full_time += updateTimerBarWidths(*it, row, history_index, bar_index); } - //analyze baseline - LLSD base = analyzePerformanceLogDefault(base_is); - base_is.close(); + timer_bar.mTotalTime = full_time; + timer_bar.mSelfTime = self_time; + timer_bar.mTimeBlock = time_block; + + return full_time; +} - //analyze current - LLSD current = analyzePerformanceLogDefault(target_is); - target_is.close(); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_TIMER_BAR_FRACTIONS("Update timer bar fractions"); - //output comparision - std::ofstream os(output.c_str()); +S32 LLFastTimerView::updateTimerBarOffsets(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 timer_bar_index) +{ + LL_RECORD_BLOCK_TIME(FTM_UPDATE_TIMER_BAR_FRACTIONS); - LLSD::Real session_time = current["SessionTime"].asReal(); - os << - "Label, " - "% Change, " - "% of Session, " - "Cur Min, " - "Cur Max, " - "Cur Mean/sample, " - "Cur Mean/frame, " - "Cur StdDev/frame, " - "Cur Total, " - "Cur Frames, " - "Cur Samples, " - "Base Min, " - "Base Max, " - "Base Mean/sample, " - "Base Mean/frame, " - "Base StdDev/frame, " - "Base Total, " - "Base Frames, " - "Base Samples\n"; + TimerBar& timer_bar = row.mBars[timer_bar_index]; + const F32Seconds bar_time = timer_bar.mTotalTime - timer_bar.mSelfTime; + timer_bar.mChildrenStart = timer_bar.mSelfStart + timer_bar.mSelfTime / 2; + timer_bar.mChildrenEnd = timer_bar.mChildrenStart + timer_bar.mTotalTime - timer_bar.mSelfTime; - for (LLSD::map_iterator iter = base.beginMap(); iter != base.endMap(); ++iter) + if (timer_bar_index == 0) { - LLSD::String label = iter->first; + timer_bar.mSelfStart = F32Seconds(0.f); + timer_bar.mSelfEnd = bar_time; + } - if (current[label]["Samples"].asInteger() == 0 || - base[label]["Samples"].asInteger() == 0) - { - //cannot compare - continue; - } - LLSD::Real a = base[label]["TotalTime"].asReal() / base[label]["Samples"].asReal(); - LLSD::Real b = current[label]["TotalTime"].asReal() / current[label]["Samples"].asReal(); - - LLSD::Real diff = b-a; + //now loop through children and figure out portion of bar image covered by each bar, now that we know the + //sum of all children + F32 bar_fraction_start = 0.f; + TimerBar* last_child_timer_bar = NULL; - LLSD::Real perc = diff/a * 100; + bool first_child = true; + for (BlockTimerStatHandle::child_iter it = time_block->beginChildren(), end_it = time_block->endChildren(); + it != end_it; + ++it) + { + timer_bar_index++; + + TimerBar& child_timer_bar = row.mBars[timer_bar_index]; + BlockTimerStatHandle* child_time_block = *it; - os << llformat("%s, %.2f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d, %.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d\n", - label.c_str(), - (F32) perc, - (F32) (current[label]["TotalTime"].asReal()/session_time * 100.0), + if (last_child_timer_bar) + { + last_child_timer_bar->mLastChild = false; + } + child_timer_bar.mLastChild = true; + last_child_timer_bar = &child_timer_bar; - (F32) current[label]["MinTime"].asReal(), - (F32) current[label]["MaxTime"].asReal(), - (F32) b, - (F32) current[label]["MeanTime"].asReal(), - (F32) current[label]["StdDevTime"].asReal(), - (F32) current[label]["TotalTime"].asReal(), - current[label]["Frames"].asInteger(), - current[label]["Samples"].asInteger(), - (F32) base[label]["MinTime"].asReal(), - (F32) base[label]["MaxTime"].asReal(), - (F32) a, - (F32) base[label]["MeanTime"].asReal(), - (F32) base[label]["StdDevTime"].asReal(), - (F32) base[label]["TotalTime"].asReal(), - base[label]["Frames"].asInteger(), - base[label]["Samples"].asInteger()); - } + child_timer_bar.mFirstChild = first_child; + if (first_child) + { + first_child = false; + } - exportCharts(baseline, target); + child_timer_bar.mStartFraction = bar_fraction_start; + child_timer_bar.mEndFraction = bar_time > (S32Seconds)0 + ? bar_fraction_start + child_timer_bar.mTotalTime / bar_time + : 1.f; + child_timer_bar.mSelfStart = timer_bar.mChildrenStart + + child_timer_bar.mStartFraction + * (timer_bar.mChildrenEnd - timer_bar.mChildrenStart); + child_timer_bar.mSelfEnd = timer_bar.mChildrenStart + + child_timer_bar.mEndFraction + * (timer_bar.mChildrenEnd - timer_bar.mChildrenStart); - os.flush(); - os.close(); + timer_bar_index = updateTimerBarOffsets(child_time_block, row, timer_bar_index); + + bar_fraction_start = child_timer_bar.mEndFraction; + } + return timer_bar_index; } -//static -void LLFastTimerView::outputAllMetrics() +S32 LLFastTimerView::drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, S32 image_height, bool hovered, bool visible, S32 bar_index) { - if (LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters()) + TimerBar& timer_bar = row.mBars[bar_index]; + LLTrace::BlockTimerStatHandle* time_block = timer_bar.mTimeBlock; + + hovered |= mHoverID == time_block; + + // animate scale of bar when hovering over that particular timer + if (visible && (F32)bar_rect.getWidth() * (timer_bar.mEndFraction - timer_bar.mStartFraction) > 2.f) { - for (LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin(); - iter != LLMetricPerformanceTesterBasic::sTesterMap.end(); ++iter) + LLRect render_rect(bar_rect); + S32 scale_offset = 0; + if (mHoverID == time_block) { - LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second); - tester->outputTestResults(); + scale_offset = llfloor(sinf(mHighlightTimer.getElapsedTimeF32() * 6.f) * 3.f); + render_rect.mTop += scale_offset; + render_rect.mBottom -= scale_offset; } + + llassert(time_block->getIndex() < sTimerColors.size()); + LLColor4 color = sTimerColors[time_block->getIndex()]; + if (!hovered) color = lerp(color, LLColor4::grey, 0.2f); + gGL.color4fv(color.mV); + gl_segmented_rect_2d_fragment_tex(render_rect, + image_width, image_height, + 16, + timer_bar.mStartFraction, timer_bar.mEndFraction); } -} -//static -void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::string output) -{ - if(LLFastTimer::sLog) + LLRect children_rect; + children_rect.mLeft = llround(timer_bar.mChildrenStart / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft; + children_rect.mRight = llround(timer_bar.mChildrenEnd / mTotalTimeDisplay * (F32)mBarRect.getWidth()) + mBarRect.mLeft; + + if (bar_rect.getHeight() > MIN_BAR_HEIGHT) { - doAnalysisDefault(baseline, target, output) ; - return ; + // shrink as we go down a level + children_rect.mTop = bar_rect.mTop - 1; + children_rect.mBottom = bar_rect.mBottom + 1; } - - if(LLFastTimer::sMetricLog) + else { - LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline, target, output) ; - return ; + children_rect.mTop = bar_rect.mTop; + children_rect.mBottom = bar_rect.mBottom; } -} -void LLFastTimerView::onClickCloseBtn(bool) -{ - setVisible(false); -} -LLFastTimer::NamedTimer& LLFastTimerView::getFrameTimer() -{ - return FTM_FRAME.getNamedTimer(); -} + bool children_visible = visible && !time_block->getTreeNode().mCollapsed; + bar_index++; + const U32 num_bars = LLTrace::BlockTimerStatHandle::instance_tracker_t::instanceCount(); + if (bar_index < num_bars && row.mBars[bar_index].mFirstChild) + { + bool is_last = false; + do + { + is_last = row.mBars[bar_index].mLastChild; + bar_index = drawBar(children_rect, row, image_width, image_height, hovered, children_visible, bar_index); + } + while(!is_last && bar_index < num_bars); + } + return bar_index; +} diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 1349b1e99cdd8aafe81b94c5d4245ea23f93de2f..3e30bd86ba8bda4536cfbd134c8dc1430845ef3d 100755 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -29,11 +29,15 @@ #include "llfloater.h" #include "llfasttimer.h" +#include "llunits.h" +#include "lltracerecording.h" +#include <deque> class LLFastTimerView : public LLFloater { public: LLFastTimerView(const LLSD&); + ~LLFastTimerView(); BOOL postBuild(); static BOOL sAnalyzePerformance; @@ -46,7 +50,6 @@ class LLFastTimerView : public LLFloater static LLSD analyzePerformanceLogDefault(std::istream& is) ; static void exportCharts(const std::string& base, const std::string& target); void onPause(); - LLFastTimer::NamedTimer& getFrameTimer(); public: @@ -58,40 +61,87 @@ class LLFastTimerView : public LLFloater virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual void draw(); + virtual void onOpen(const LLSD& key); + virtual void onClose(bool app_quitting); + LLTrace::BlockTimerStatHandle* getLegendID(S32 y); - LLFastTimer::NamedTimer* getLegendID(S32 y); - F64 getTime(const std::string& name); - -protected: - virtual void onClickCloseBtn(bool app_quitting = false); private: - typedef std::vector<std::vector<S32> > bar_positions_t; - bar_positions_t mBarStart; - bar_positions_t mBarEnd; - S32 mDisplayMode; + void drawTicks(); + void drawLineGraph(); + void drawLegend(); + void drawHelp(S32 y); + void drawBorders( S32 y, const S32 x_start, S32 barh, S32 dy); + void drawBars(); + + void printLineStats(); + void generateUniqueColors(); + void updateTotalTime(); + + struct TimerBar + { + TimerBar() + : mTotalTime(0), + mSelfTime(0), + mStartFraction(0.f), + mEndFraction(1.f), + mFirstChild(false), + mLastChild(false) + {} + F32Seconds mTotalTime, + mSelfTime, + mChildrenStart, + mChildrenEnd, + mSelfStart, + mSelfEnd; + LLTrace::BlockTimerStatHandle* mTimeBlock; + bool mVisible, + mFirstChild, + mLastChild; + F32 mStartFraction, + mEndFraction; + }; + + struct TimerBarRow + { + TimerBarRow() + : mBottom(0), + mTop(0), + mBars(NULL) + {} + S32 mBottom, + mTop; + TimerBar* mBars; + }; + + F32Seconds updateTimerBarWidths(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 history_index, U32& bar_index); + S32 updateTimerBarOffsets(LLTrace::BlockTimerStatHandle* time_block, TimerBarRow& row, S32 timer_bar_index = 0); + S32 drawBar(LLRect bar_rect, TimerBarRow& row, S32 image_width, S32 image_height, bool hovered = false, bool visible = true, S32 bar_index = 0); + void setPauseState(bool pause_state); + + std::deque<TimerBarRow> mTimerBarRows; + TimerBarRow mAverageTimerRow; - typedef enum child_alignment + enum EDisplayType { - ALIGN_LEFT, - ALIGN_CENTER, - ALIGN_RIGHT, - ALIGN_COUNT - } ChildAlignment; - - ChildAlignment mDisplayCenter; - S32 mDisplayCalls; - S32 mDisplayHz; - U64 mAvgCountTotal; - U64 mMaxCountTotal; - LLRect mBarRect; - S32 mScrollIndex; - LLFastTimer::NamedTimer* mHoverID; - LLFastTimer::NamedTimer* mHoverTimer; - LLRect mToolTipRect; - S32 mHoverBarIndex; - LLFrameTimer mHighlightTimer; - S32 mPrintStats; - LLRect mGraphRect; + DISPLAY_TIME, + DISPLAY_CALLS, + DISPLAY_HZ + } mDisplayType; + bool mPauseHistory; + F64Seconds mAllTimeMax, + mTotalTimeDisplay; + S32 mScrollIndex, + mHoverBarIndex, + mStatsIndex; + S32 mDisplayMode; + LLTrace::BlockTimerStatHandle* mHoverID; + LLTrace::BlockTimerStatHandle* mHoverTimer; + LLRect mToolTipRect, + mGraphRect, + mBarRect, + mLegendRect; + LLFrameTimer mHighlightTimer; + LLTrace::PeriodicRecording mRecording; }; #endif diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index a2d075958725831d79e43289b18aeebff6e8a3f6..1b3cfb5ebd7094c9df4471fa58e8585e16030c7b 100755 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -480,7 +480,7 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, const LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); if (item->getParentUUID() == favorites_id) { - llwarns << "Attemt to copy a favorite item into the same folder." << llendl; + LL_WARNS() << "Attemt to copy a favorite item into the same folder." << LL_ENDL; break; } @@ -632,7 +632,7 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con // landmarks to an empty favorites bar. updateButtons(); - llinfos << "Copied inventory item #" << item->getUUID() << " to favorites." << llendl; + LL_INFOS() << "Copied inventory item #" << item->getUUID() << " to favorites." << LL_ENDL; } //virtual @@ -738,7 +738,7 @@ void LLFavoritesBarCtrl::updateButtons() int first_changed_item_index = 0; int rightest_point = getRect().mRight - mMoreTextBox->getRect().getWidth(); //lets find first changed button - while (child_it != childs->end() && first_changed_item_index < mItems.count()) + while (child_it != childs->end() && first_changed_item_index < mItems.size()) { LLFavoriteLandmarkButton* button = dynamic_cast<LLFavoriteLandmarkButton*> (*child_it); if (button) @@ -760,7 +760,7 @@ void LLFavoritesBarCtrl::updateButtons() } // now first_changed_item_index should contains a number of button that need to change - if (first_changed_item_index <= mItems.count()) + if (first_changed_item_index <= mItems.size()) { // Rebuild the buttons only // child_list_t is a linked list, so safe to erase from the middle if we pre-increment the iterator @@ -798,7 +798,7 @@ void LLFavoritesBarCtrl::updateButtons() //last_right_edge is saving coordinates LLButton* last_new_button = NULL; int j = first_changed_item_index; - for (; j < mItems.count(); j++) + for (; j < mItems.size(); j++) { last_new_button = createButton(mItems[j], button_params, last_right_edge); if (!last_new_button) @@ -812,7 +812,7 @@ void LLFavoritesBarCtrl::updateButtons() } mFirstDropDownItem = j; // Chevron button - if (mFirstDropDownItem < mItems.count()) + if (mFirstDropDownItem < mItems.size()) { // if updateButton had been called it means: //or there are some new favorites, or width had been changed @@ -871,7 +871,7 @@ LLButton* LLFavoritesBarCtrl::createButton(const LLPointer<LLViewerInventoryItem fav_btn = LLUICtrlFactory::create<LLFavoriteLandmarkButton>(fav_btn_params); if (NULL == fav_btn) { - llwarns << "Unable to create LLFavoriteLandmarkButton widget: " << item->getName() << llendl; + LL_WARNS() << "Unable to create LLFavoriteLandmarkButton widget: " << item->getName() << LL_ENDL; return NULL; } @@ -977,9 +977,9 @@ void LLFavoritesBarCtrl::updateMenuItems(LLToggleableMenu* menu) U32 widest_item = 0; - for (S32 i = mFirstDropDownItem; i < mItems.count(); i++) + for (S32 i = mFirstDropDownItem; i < mItems.size(); i++) { - LLViewerInventoryItem* item = mItems.get(i); + LLViewerInventoryItem* item = mItems.at(i); const std::string& item_name = item->getName(); LLFavoriteLandmarkMenuItem::Params item_params; @@ -1160,7 +1160,7 @@ bool LLFavoritesBarCtrl::enableSelected(const LLSD& userdata) void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata) { std::string action = userdata.asString(); - llinfos << "Action = " << action << " Item = " << mSelectedItemID.asString() << llendl; + LL_INFOS() << "Action = " << action << " Item = " << mSelectedItemID.asString() << LL_ENDL; LLViewerInventoryItem* item = gInventory.getItem(mSelectedItemID); if (!item) @@ -1235,12 +1235,12 @@ BOOL LLFavoritesBarCtrl::isClipboardPasteable() const return FALSE; } - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.count(); + S32 count = objects.size(); for(S32 i = 0; i < count; i++) { - const LLUUID &item_id = objects.get(i); + const LLUUID &item_id = objects.at(i); // Can't paste folders const LLInventoryCategory *cat = gInventory.getCategory(item_id); @@ -1264,13 +1264,13 @@ void LLFavoritesBarCtrl::pasteFromClipboard() const if(model && isClipboardPasteable()) { LLInventoryItem* item = NULL; - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.count(); + S32 count = objects.size(); LLUUID parent_id(mFavoriteFolderId); for(S32 i = 0; i < count; i++) { - item = model->getItem(objects.get(i)); + item = model->getItem(objects.at(i)); if (item) { copy_inventory_item( @@ -1487,14 +1487,14 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs() // Do not change the file if we are not logged in yet. if (!LLLoginInstance::getInstance()->authSuccess()) { - llwarns << "Cannot save favorites: not logged in" << llendl; + LL_WARNS() << "Cannot save favorites: not logged in" << LL_ENDL; return; } std::string user_dir = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, ""); if (user_dir.empty()) { - llwarns << "Cannot save favorites: empty user dir name" << llendl; + LL_WARNS() << "Cannot save favorites: empty user dir name" << LL_ENDL; return; } @@ -1522,13 +1522,13 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs() slurls_map_t::iterator slurl_iter = mSLURLs.find(value["asset_id"]); if (slurl_iter != mSLURLs.end()) { - lldebugs << "Saving favorite: idx=" << LLFavoritesOrderStorage::instance().getSortIndex((*it)->getUUID()) << ", SLURL=" << slurl_iter->second << ", value=" << value << llendl; + LL_DEBUGS() << "Saving favorite: idx=" << LLFavoritesOrderStorage::instance().getSortIndex((*it)->getUUID()) << ", SLURL=" << slurl_iter->second << ", value=" << value << LL_ENDL; value["slurl"] = slurl_iter->second; user_llsd[LLFavoritesOrderStorage::instance().getSortIndex((*it)->getUUID())] = value; } else { - llwarns << "Not saving favorite " << value["name"] << ": no matching SLURL" << llendl; + LL_WARNS() << "Not saving favorite " << value["name"] << ": no matching SLURL" << LL_ENDL; } } @@ -1536,7 +1536,7 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs() LLAvatarNameCache::get( gAgentID, &av_name ); // Note : use the "John Doe" and not the "john.doe" version of the name // as we'll compare it with the stored credentials in the login panel. - lldebugs << "Saved favorites for " << av_name.getUserName() << llendl; + LL_DEBUGS() << "Saved favorites for " << av_name.getUserName() << LL_ENDL; fav_llsd[av_name.getUserName()] = user_llsd; llofstream file; @@ -1557,7 +1557,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser() LLAvatarNameCache::get( gAgentID, &av_name ); // Note : use the "John Doe" and not the "john.doe" version of the name. // See saveFavoritesSLURLs() here above for the reason why. - lldebugs << "Removed favorites for " << av_name.getUserName() << llendl; + LL_DEBUGS() << "Removed favorites for " << av_name.getUserName() << LL_ENDL; if (fav_llsd.has(av_name.getUserName())) { fav_llsd.erase(av_name.getUserName()); @@ -1590,7 +1590,7 @@ void LLFavoritesOrderStorage::onLandmarkLoaded(const LLUUID& asset_id, LLLandmar void LLFavoritesOrderStorage::storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl) { - lldebugs << "Saving landmark SLURL: " << slurl << llendl; + LL_DEBUGS() << "Saving landmark SLURL: " << slurl << LL_ENDL; mSLURLs[asset_id] = slurl; } diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index ba6f26d3efa7fb2c59dc00ba1d86387861c2157b..8c3a4bb5c0b590c2c73183850aa60361311c9dfe 100755 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -37,7 +37,6 @@ #include "llsys.h" #include "llgl.h" -#include "llsecondlifeurls.h" #include "llappviewer.h" #include "llhttpclient.h" @@ -131,7 +130,7 @@ F32 LLFeatureList::getRecommendedValue(const std::string& name) BOOL LLFeatureList::maskList(LLFeatureList &mask) { - //llinfos << "Masking with " << mask.mName << llendl; + //LL_INFOS() << "Masking with " << mask.mName << LL_ENDL; // // Lookup the specified feature mask, and overlay it on top of the // current feature mask. @@ -626,7 +625,7 @@ class LLHTTPFeatureTableResponder : public LLHTTPClient::Responder { // write to file - llinfos << "writing feature table to " << mFilename << llendl; + LL_INFOS() << "writing feature table to " << mFilename << LL_ENDL; S32 file_size = buffer->countAfter(channels.in(), NULL); if (file_size > 0) @@ -671,7 +670,7 @@ void fetch_feature_table(std::string table) const std::string path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename); - llinfos << "LLFeatureManager fetching " << url << " into " << path << llendl; + LL_INFOS() << "LLFeatureManager fetching " << url << " into " << path << LL_ENDL; LLHTTPClient::get(url, new LLHTTPFeatureTableResponder(path)); } @@ -686,7 +685,7 @@ void fetch_gpu_table(std::string table) const std::string path = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename); - llinfos << "LLFeatureManager fetching " << url << " into " << path << llendl; + LL_INFOS() << "LLFeatureManager fetching " << url << " into " << path << LL_ENDL; LLHTTPClient::get(url, new LLHTTPFeatureTableResponder(path)); } @@ -723,7 +722,7 @@ void LLFeatureManager::applyRecommendedSettings() // cap the level at 2 (high) U32 level = llmax(GPU_CLASS_0, llmin(mGPUClass, GPU_CLASS_5)); - llinfos << "Applying Recommended Features" << llendl; + LL_INFOS() << "Applying Recommended Features" << LL_ENDL; setGraphicsLevel(level, false); gSavedSettings.setU32("RenderQualityPerformance", level); @@ -769,7 +768,7 @@ void LLFeatureManager::applyFeatures(bool skipFeatures) LLControlVariable* ctrl = gSavedSettings.getControl(mIt->first); if(ctrl == NULL) { - llwarns << "AHHH! Control setting " << mIt->first << " does not exist!" << llendl; + LL_WARNS() << "AHHH! Control setting " << mIt->first << " does not exist!" << LL_ENDL; continue; } @@ -792,7 +791,7 @@ void LLFeatureManager::applyFeatures(bool skipFeatures) } else { - llwarns << "AHHH! Control variable is not a numeric type!" << llendl; + LL_WARNS() << "AHHH! Control variable is not a numeric type!" << LL_ENDL; } } } @@ -944,11 +943,11 @@ void LLFeatureManager::applyBaseMasks() } } - //llinfos << "Masking features from gpu table match: " << gpustr << llendl; + //LL_INFOS() << "Masking features from gpu table match: " << gpustr << LL_ENDL; maskFeatures(gpustr); // now mask cpu type ones - if (gSysMemory.getPhysicalMemoryClamped() <= 256*1024*1024) + if (gSysMemory.getPhysicalMemoryClamped() <= U32Megabytes(256)) { maskFeatures("RAM256MB"); } diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 057acf69b91f8dc7a2b1292156eb317ff59e399c..8402148a46ccba0263cf003c69e78f491d05a057 100755 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -608,7 +608,7 @@ std::vector<std::string>* LLFilePicker::navOpenFilterProc(ELoadFilter filter) // case FFLOAD_DIRECTORY: break; default: - llwarns << "Unsupported format." << llendl; + LL_WARNS() << "Unsupported format." << LL_ENDL; } return allowedv; @@ -910,13 +910,13 @@ void LLFilePicker::add_to_selectedfiles(gpointer data, gpointer user_data) { display_name += (char)((*str >= 0x20 && *str <= 0x7E) ? *str : '?'); } - llwarns << "g_filename_to_utf8 failed on \"" << display_name << "\": " << error->message << llendl; + LL_WARNS() << "g_filename_to_utf8 failed on \"" << display_name << "\": " << error->message << LL_ENDL; } if (filename_utf8) { picker->mFiles.push_back(std::string(filename_utf8)); - lldebugs << "ADDED FILE " << filename_utf8 << llendl; + LL_DEBUGS() << "ADDED FILE " << filename_utf8 << LL_ENDL; g_free(filename_utf8); } @@ -928,7 +928,7 @@ void LLFilePicker::chooser_responder(GtkWidget *widget, gint response, gpointer { LLFilePicker* picker = (LLFilePicker*)user_data; - lldebugs << "GTK DIALOG RESPONSE " << response << llendl; + LL_DEBUGS() << "GTK DIALOG RESPONSE " << response << LL_ENDL; if (response == GTK_RESPONSE_ACCEPT) { @@ -1019,7 +1019,7 @@ GtkWindow* LLFilePicker::buildFilePicker(bool is_save, bool is_folder, std::stri } else { - llwarns << "Hmm, couldn't get xwid to use for transient." << llendl; + LL_WARNS() << "Hmm, couldn't get xwid to use for transient." << LL_ENDL; } # endif //LL_X11 @@ -1367,8 +1367,8 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename reset(); - llinfos << "getSaveFile suggested filename is [" << filename - << "]" << llendl; + LL_INFOS() << "getSaveFile suggested filename is [" << filename + << "]" << LL_ENDL; if (!filename.empty()) { mFiles.push_back(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + filename); @@ -1398,7 +1398,7 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking ) default: break; } mFiles.push_back(filename); - llinfos << "getOpenFile: Will try to open file: " << filename << llendl; + LL_INFOS() << "getOpenFile: Will try to open file: " << filename << LL_ENDL; return TRUE; } diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h index f0f82c51db0a218acef6ae0d1d41dbd0b5c99476..f6a700d1c6e772ceb54b41c4671df16accc2dc63 100755 --- a/indra/newview/llfilepicker.h +++ b/indra/newview/llfilepicker.h @@ -50,6 +50,7 @@ // Need commdlg.h for OPENFILENAMEA #ifdef LL_WINDOWS +#include "llwin32headers.h" #include <commdlg.h> #endif diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index e2850f51818ad9830a47f438e3212fa4d9dcaf14..2e1afc68b40427407430d97a731f5c37e508db0f 100755 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -96,6 +96,11 @@ void LLFirstUse::newInventory(bool enable) // firstUseNotification("FirstInventoryOffer", enable, "HintInventory", LLSD(), LLSD().with("target", "inventory_btn").with("direction", "left")); } +// first clean starts at 3 AM +const S32 SANDBOX_FIRST_CLEAN_HOUR = 3; +// clean every <n> hours +const S32 SANDBOX_CLEAN_FREQ = 12; + // static void LLFirstUse::useSandbox() { diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 98c0c0bf51742bbb78aed209d9c16dcc0f58ffda..b64034b9450278c92996d07f5098f35d0143879c 100755 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -47,8 +47,8 @@ std::vector<LLVolumeImplFlexible*> LLVolumeImplFlexible::sInstanceList; std::vector<S32> LLVolumeImplFlexible::sUpdateDelay; -static LLFastTimer::DeclareTimer FTM_FLEXIBLE_REBUILD("Rebuild"); -static LLFastTimer::DeclareTimer FTM_DO_FLEXIBLE_UPDATE("Flexible Update"); +static LLTrace::BlockTimerStatHandle FTM_FLEXIBLE_REBUILD("Rebuild"); +static LLTrace::BlockTimerStatHandle FTM_DO_FLEXIBLE_UPDATE("Flexible Update"); // LLFlexibleObjectData::pack/unpack now in llprimitive.cpp @@ -334,14 +334,14 @@ void LLVolumeImplFlexible::updateRenderRes() // updated every time step. In the future, perhaps there could be an // optimization similar to what Havok does for objects that are stationary. //--------------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_FLEXIBLE_UPDATE("Update Flexies"); +static LLTrace::BlockTimerStatHandle FTM_FLEXIBLE_UPDATE("Update Flexies"); void LLVolumeImplFlexible::doIdleUpdate() { LLDrawable* drawablep = mVO->mDrawable; if (drawablep) { - //LLFastTimer ftm(FTM_FLEXIBLE_UPDATE); + //LL_RECORD_BLOCK_TIME(FTM_FLEXIBLE_UPDATE); //ensure drawable is active drawablep->makeActive(); @@ -424,7 +424,7 @@ inline S32 log2(S32 x) void LLVolumeImplFlexible::doFlexibleUpdate() { - LLFastTimer ftm(FTM_DO_FLEXIBLE_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_DO_FLEXIBLE_UPDATE); LLVolume* volume = mVO->getVolume(); LLPath *path = &volume->getPath(); if ((mSimulateRes == 0 || !mInitialized) && mVO->mDrawable->isVisible()) @@ -660,7 +660,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate() mSection[i].mdPosition = (mSection[i].mPosition - mSection[i-1].mPosition) * inv_section_length; // Create points - llassert(mRenderRes > -1) + llassert(mRenderRes > -1); S32 num_render_sections = 1<<mRenderRes; if (path->getPathLength() != num_render_sections+1) { @@ -715,20 +715,24 @@ void LLVolumeImplFlexible::doFlexibleUpdate() mLastSegmentRotation = parentSegmentRotation; } -static LLFastTimer::DeclareTimer FTM_FLEXI_PREBUILD("Flexi Prebuild"); +static LLTrace::BlockTimerStatHandle FTM_FLEXI_PREBUILD("Flexi Prebuild"); void LLVolumeImplFlexible::preRebuild() { if (!mUpdated) { - LLFastTimer t(FTM_FLEXI_PREBUILD); - doFlexibleRebuild(); + LL_RECORD_BLOCK_TIME(FTM_FLEXI_PREBUILD); + doFlexibleRebuild(false); } } -void LLVolumeImplFlexible::doFlexibleRebuild() +void LLVolumeImplFlexible::doFlexibleRebuild(bool rebuild_volume) { LLVolume* volume = mVO->getVolume(); + if(rebuild_volume) + { + volume->setDirty(); + } volume->regen(); mUpdated = TRUE; @@ -780,7 +784,7 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) if (mRenderRes > -1) { - LLFastTimer t(FTM_DO_FLEXIBLE_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_DO_FLEXIBLE_UPDATE); doFlexibleUpdate(); } @@ -800,8 +804,8 @@ BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) volume->mDrawable->setState(LLDrawable::REBUILD_VOLUME); volume->dirtySpatialGroup(); { - LLFastTimer t(FTM_FLEXIBLE_REBUILD); - doFlexibleRebuild(); + LL_RECORD_BLOCK_TIME(FTM_FLEXIBLE_REBUILD); + doFlexibleRebuild(volume->mVolumeChanged); } volume->genBBoxes(isVolumeGlobal()); } diff --git a/indra/newview/llflexibleobject.h b/indra/newview/llflexibleobject.h index beb281a90626e1e194a13a5bf1e3b9555b0fce1a..a00551df8e10b5357f79a89f19ac7de52a026af0 100755 --- a/indra/newview/llflexibleobject.h +++ b/indra/newview/llflexibleobject.h @@ -100,7 +100,7 @@ class LLVolumeImplFlexible : public LLVolumeInterface const LLMatrix4& getWorldMatrix(LLXformMatrix* xform) const; void updateRelativeXform(bool force_identity); void doFlexibleUpdate(); // Called to update the simulation - void doFlexibleRebuild(); // Called to rebuild the geometry + void doFlexibleRebuild(bool rebuild_volume); // Called to rebuild the geometry void preRebuild(); //void setAttributes( LLFlexibleObjectData ); diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 4331a63346ae705f9ca807403639399ed5d3c5ed..efaba1d7a46e379f2913bb96fc847b010770191c 100755 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -35,7 +35,6 @@ #include "llagent.h" #include "llagentui.h" #include "llappviewer.h" -#include "llsecondlifeurls.h" #include "llslurl.h" #include "llvoiceclient.h" #include "lluictrlfactory.h" @@ -306,9 +305,9 @@ void LLServerReleaseNotesURLFetcher::startFetch() // virtual void LLServerReleaseNotesURLFetcher::completedHeader(U32 status, const std::string& reason, const LLSD& content) { - lldebugs << "Status: " << status << llendl; - lldebugs << "Reason: " << reason << llendl; - lldebugs << "Headers: " << content << llendl; + LL_DEBUGS() << "Status: " << status << LL_ENDL; + LL_DEBUGS() << "Reason: " << reason << LL_ENDL; + LL_DEBUGS() << "Headers: " << content << LL_ENDL; LLFloaterAbout* floater_about = LLFloaterReg::getTypedInstance<LLFloaterAbout>("sl_about"); if (floater_about) diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp index 3c40e2d4bccde545327912fbb3a9793c3b04eb00..51b59a7a7499d898c5a5daf51a7190203f2dc4cf 100755 --- a/indra/newview/llfloaterauction.cpp +++ b/indra/newview/llfloaterauction.cpp @@ -194,7 +194,7 @@ void LLFloaterAuction::onClickSnapshot(void* data) { gViewerWindow->playSnapshotAnimAndSound(); } - llinfos << "Writing TGA..." << llendl; + LL_INFOS() << "Writing TGA..." << LL_ENDL; LLPointer<LLImageTGA> tga = new LLImageTGA; tga->encode(raw); @@ -202,7 +202,7 @@ void LLFloaterAuction::onClickSnapshot(void* data) raw->biasedScaleToPowerOfTwo(LLViewerTexture::MAX_IMAGE_SIZE_DEFAULT); - llinfos << "Writing J2C..." << llendl; + LL_INFOS() << "Writing J2C..." << LL_ENDL; LLPointer<LLImageJ2C> j2c = new LLImageJ2C; j2c->encode(raw, 0.0f); @@ -214,7 +214,7 @@ void LLFloaterAuction::onClickSnapshot(void* data) } else { - llwarns << "Unable to take snapshot" << llendl; + LL_WARNS() << "Unable to take snapshot" << LL_ENDL; } } @@ -359,8 +359,8 @@ void LLFloaterAuction::doResetParcel() body["user_look_at"] = ll_sd_from_vector3( LLVector3::zero ); body["landing_type"] = (U8) LLParcel::L_DIRECT; - llinfos << "Sending parcel update to reset for auction via capability to: " - << mParcelUpdateCapUrl << llendl; + LL_INFOS() << "Sending parcel update to reset for auction via capability to: " + << mParcelUpdateCapUrl << LL_ENDL; LLHTTPClient::post(mParcelUpdateCapUrl, body, new LLHTTPClient::Responder()); // Send a message to clear the object return time @@ -509,8 +509,8 @@ void LLFloaterAuction::doSellToAnyone() body["sale_price"] = parcelp->getArea(); // Sell for L$1 per square meter body["auth_buyer_id"] = LLUUID::null; // To anyone - llinfos << "Sending parcel update to sell to anyone for L$1 via capability to: " - << mParcelUpdateCapUrl << llendl; + LL_INFOS() << "Sending parcel update to sell to anyone for L$1 via capability to: " + << mParcelUpdateCapUrl << LL_ENDL; LLHTTPClient::post(mParcelUpdateCapUrl, body, new LLHTTPClient::Responder()); // clean up floater, and get out @@ -526,8 +526,8 @@ void LLFloaterAuction::doSellToAnyone() void auction_tga_upload_done(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) { std::string* name = (std::string*)(user_data); - llinfos << "Upload of asset '" << *name << "' " << asset_id - << " returned " << status << llendl; + LL_INFOS() << "Upload of asset '" << *name << "' " << asset_id + << " returned " << status << LL_ENDL; delete name; gViewerWindow->getWindow()->decBusyCount(); @@ -547,8 +547,8 @@ void auction_tga_upload_done(const LLUUID& asset_id, void* user_data, S32 status void auction_j2c_upload_done(const LLUUID& asset_id, void* user_data, S32 status, LLExtStat ext_status) // StoreAssetData callback (fixed) { std::string* name = (std::string*)(user_data); - llinfos << "Upload of asset '" << *name << "' " << asset_id - << " returned " << status << llendl; + LL_INFOS() << "Upload of asset '" << *name << "' " << asset_id + << " returned " << status << LL_ENDL; delete name; gViewerWindow->getWindow()->decBusyCount(); diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index c0afb72cffb05ed6702c0c70ba374a445088be56..c1e66734067593dc6ef52e1746d8cf7906cf0b4f 100755 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -70,7 +70,7 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback, LLFloaterReg::showTypedInstance<LLFloaterAvatarPicker>("avatar_picker", LLSD(name)); if (!floater) { - llwarns << "Cannot instantiate avatar picker" << llendl; + LL_WARNS() << "Cannot instantiate avatar picker" << LL_ENDL; return NULL; } @@ -405,11 +405,11 @@ void LLFloaterAvatarPicker::drawFrustum() if (gFocusMgr.childHasMouseCapture(getDragHandle())) { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(mContextConeFadeTime)); + mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); } else { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(mContextConeFadeTime)); + mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); } } } @@ -468,7 +468,7 @@ class LLAvatarPickerResponder : public LLHTTPClient::Responder { //std::ostringstream ss; //LLSDSerialize::toPrettyXML(content, ss); - //llinfos << ss.str() << llendl; + //LL_INFOS() << ss.str() << LL_ENDL; // in case of invalid characters, the avatar picker returns a 400 // just set it to process so it displays 'not found' @@ -483,7 +483,7 @@ class LLAvatarPickerResponder : public LLHTTPClient::Responder } else { - llwarns << "avatar picker failed [status:" << status << "]: " << content << llendl; + LL_WARNS() << "avatar picker failed [status:" << status << "]: " << content << LL_ENDL; } } @@ -515,7 +515,7 @@ void LLFloaterAvatarPicker::find() url += "?page_size=100&names="; std::replace(text.begin(), text.end(), '.', ' '); url += LLURI::escape(text); - llinfos << "avatar picker " << url << llendl; + LL_INFOS() << "avatar picker " << url << LL_ENDL; LLHTTPClient::get(url, new LLAvatarPickerResponder(mQueryID, getKey().asString())); } else @@ -736,7 +736,7 @@ void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD& if (search_results->isEmpty()) { LLStringUtil::format_map_t map; - map["[TEXT]"] = childGetText("Edit"); + map["[TEXT]"] = getChild<LLUICtrl>("Edit")->getValue().asString(); LLSD item; item["id"] = LLUUID::null; item["columns"][0]["column"] = "name"; diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp index 048837acfec375183044c66715028ca0502bf946..78807a8e9950fc2a87a019dfce9d6fb005f6ff6b 100755 --- a/indra/newview/llfloateravatartextures.cpp +++ b/indra/newview/llfloateravatartextures.cpp @@ -37,6 +37,7 @@ #include "lluictrlfactory.h" #include "llviewerobjectlist.h" #include "llvoavatarself.h" +#include "lllocaltextureobject.h" using namespace LLAvatarAppearanceDefines; @@ -186,16 +187,16 @@ void LLFloaterAvatarTextures::onClickDump(void* data) } if (id != IMG_DEFAULT_AVATAR) { - llinfos << "TE " << i << " name:" << tex_entry->mName << " id:" << id << llendl; + LL_INFOS() << "TE " << i << " name:" << tex_entry->mName << " id:" << id << LL_ENDL; } else { - llinfos << "TE " << i << " name:" << tex_entry->mName << " id:" << "<DEFAULT>" << llendl; + LL_INFOS() << "TE " << i << " name:" << tex_entry->mName << " id:" << "<DEFAULT>" << LL_ENDL; } } else { - llinfos << "TE " << i << " name:" << tex_entry->mName << " id:" << te->getID() << llendl; + LL_INFOS() << "TE " << i << " name:" << tex_entry->mName << " id:" << te->getID() << LL_ENDL; } } } diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp index 07bd262c00a37943dc8a67935ab1f82021310b6c..f2040bc76080050e0108a14cfe4158ab553bc4dc 100755 --- a/indra/newview/llfloaterbulkpermission.cpp +++ b/indra/newview/llfloaterbulkpermission.cpp @@ -36,7 +36,6 @@ #include "llviewerobject.h" #include "llviewerobjectlist.h" #include "llviewerregion.h" -#include "lscript_rt_interface.h" #include "llviewercontrol.h" #include "llviewerinventory.h" #include "llviewerobject.h" @@ -96,17 +95,17 @@ void LLFloaterBulkPermission::doApply() class ModifiableGatherer : public LLSelectedNodeFunctor { public: - ModifiableGatherer(LLDynamicArray<LLUUID>& q) : mQueue(q) {} + ModifiableGatherer(std::vector<LLUUID>& q) : mQueue(q) { mQueue.reserve(32); } virtual bool apply(LLSelectNode* node) { if( node->allowOperationOnNode(PERM_MODIFY, GP_OBJECT_MANIPULATE) ) { - mQueue.put(node->getObject()->getID()); + mQueue.push_back(node->getObject()->getID()); } return true; } private: - LLDynamicArray<LLUUID>& mQueue; + std::vector<LLUUID>& mQueue; }; LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output"); list->deleteAllItems(); @@ -121,7 +120,7 @@ void LLFloaterBulkPermission::doApply() mDone = FALSE; if (!start()) { - llwarns << "Unexpected bulk permission change failure." << llendl; + LL_WARNS() << "Unexpected bulk permission change failure." << LL_ENDL; } } } @@ -135,7 +134,7 @@ void LLFloaterBulkPermission::inventoryChanged(LLViewerObject* viewer_object, S32, void* q_id) { - //llinfos << "changed object: " << viewer_object->getID() << llendl; + //LL_INFOS() << "changed object: " << viewer_object->getID() << LL_ENDL; //Remove this listener from the object since its //listener callback is now being executed. @@ -160,7 +159,7 @@ void LLFloaterBulkPermission::inventoryChanged(LLViewerObject* viewer_object, // something went wrong... // note that we're not working on this one, and move onto the // next object in the list. - llwarns << "No inventory for " << mCurrentObjectID << llendl; + LL_WARNS() << "No inventory for " << mCurrentObjectID << LL_ENDL; nextObject(); } } @@ -210,7 +209,7 @@ void LLFloaterBulkPermission::onCommitCopy() BOOL LLFloaterBulkPermission::start() { - // note: number of top-level objects to modify is mObjectIDs.count(). + // note: number of top-level objects to modify is mObjectIDs.size(). getChild<LLScrollListCtrl>("queue output")->setCommentText(getString("start_text")); return nextObject(); } @@ -222,15 +221,15 @@ BOOL LLFloaterBulkPermission::nextObject() BOOL successful_start = FALSE; do { - count = mObjectIDs.count(); - //llinfos << "Objects left to process = " << count << llendl; + count = mObjectIDs.size(); + //LL_INFOS() << "Objects left to process = " << count << LL_ENDL; mCurrentObjectID.setNull(); if(count > 0) { successful_start = popNext(); - //llinfos << (successful_start ? "successful" : "unsuccessful") << llendl; + //LL_INFOS() << (successful_start ? "successful" : "unsuccessful") << LL_ENDL; } - } while((mObjectIDs.count() > 0) && !successful_start); + } while((mObjectIDs.size() > 0) && !successful_start); if(isDone() && !mDone) { @@ -246,16 +245,16 @@ BOOL LLFloaterBulkPermission::popNext() { // get the head element from the container, and attempt to get its inventory. BOOL rv = FALSE; - S32 count = mObjectIDs.count(); + S32 count = mObjectIDs.size(); if(mCurrentObjectID.isNull() && (count > 0)) { - mCurrentObjectID = mObjectIDs.get(0); - //llinfos << "mCurrentID: " << mCurrentObjectID << llendl; - mObjectIDs.remove(0); + mCurrentObjectID = mObjectIDs.at(0); + //LL_INFOS() << "mCurrentID: " << mCurrentObjectID << LL_ENDL; + mObjectIDs.erase(mObjectIDs.begin()); LLViewerObject* obj = gObjectList.findObject(mCurrentObjectID); if(obj) { - //llinfos << "requesting inv for " << mCurrentObjectID << llendl; + //LL_INFOS() << "requesting inv for " << mCurrentObjectID << LL_ENDL; LLUUID* id = new LLUUID(mID); registerVOInventoryListener(obj,id); requestVOInventory(); @@ -263,7 +262,7 @@ BOOL LLFloaterBulkPermission::popNext() } else { - llinfos<<"NULL LLViewerObject" <<llendl; + LL_INFOS()<<"NULL LLViewerObject" <<LL_ENDL; } } diff --git a/indra/newview/llfloaterbulkpermission.h b/indra/newview/llfloaterbulkpermission.h index 25e76eca65159c02d2a4dde3c62f8f8407c52d67..0c042c3ee373b82dd0473810106da30331c22b79 100755 --- a/indra/newview/llfloaterbulkpermission.h +++ b/indra/newview/llfloaterbulkpermission.h @@ -28,11 +28,9 @@ #ifndef LL_LLBULKPERMISSION_H #define LL_LLBULKPERMISSION_H -#include "lldarray.h" #include "llinventory.h" #include "llviewerobject.h" #include "llvoinventorylistener.h" -#include "llmap.h" #include "lluuid.h" #include "llfloater.h" @@ -79,7 +77,7 @@ class LLFloaterBulkPermission : public LLFloater, public LLVOInventoryListener void onUncheckAll() { doCheckUncheckAll(FALSE); } // returns true if this is done - BOOL isDone() const { return (mCurrentObjectID.isNull() || (mObjectIDs.count() == 0)); } + BOOL isDone() const { return (mCurrentObjectID.isNull() || (mObjectIDs.size() == 0)); } //Read the settings and Apply the permissions void doApply(); @@ -91,7 +89,7 @@ class LLFloaterBulkPermission : public LLFloater, public LLVOInventoryListener LLButton* mCloseBtn; // Object Queue - LLDynamicArray<LLUUID> mObjectIDs; + std::vector<LLUUID> mObjectIDs; LLUUID mCurrentObjectID; BOOL mDone; diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index eeb81085bbbf017855e1c63eaffabfba95fd6ed1..ad44c509d99abc0cbcafaf5d8ca4c261f29bbe83 100755 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -110,8 +110,8 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) action = "physical_object_collide"; break; default: - llinfos << "LLFloaterBump::add unknown mean collision type " - << mcd->mType << llendl; + LL_INFOS() << "LLFloaterBump::add unknown mean collision type " + << mcd->mType << LL_ENDL; return; } diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp index 087b0007e19a3a7dd2204c4b53f1ed7c0c315dd1..5a9cdbba44d6bfe3aee80e43f079528bf4e32147 100755 --- a/indra/newview/llfloaterbuy.cpp +++ b/indra/newview/llfloaterbuy.cpp @@ -194,14 +194,14 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj, { if (!obj) { - llwarns << "No object in LLFloaterBuy::inventoryChanged" << llendl; + LL_WARNS() << "No object in LLFloaterBuy::inventoryChanged" << LL_ENDL; return; } if (!inv) { - llwarns << "No inventory in LLFloaterBuy::inventoryChanged" - << llendl; + LL_WARNS() << "No inventory in LLFloaterBuy::inventoryChanged" + << LL_ENDL; removeVOInventoryListener(); return; } diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index aa6ace2a616a072d359ab934cf8d9f97e0c00d3c..b32ac860aaa57299fec019a6e4fde0061e77026c 100755 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -145,7 +145,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, { if (!obj) { - llwarns << "No object in LLFloaterBuyContents::inventoryChanged" << llendl; + LL_WARNS() << "No object in LLFloaterBuyContents::inventoryChanged" << LL_ENDL; return; } @@ -160,8 +160,8 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj, if (!inv) { - llwarns << "No inventory in LLFloaterBuyContents::inventoryChanged" - << llendl; + LL_WARNS() << "No inventory in LLFloaterBuyContents::inventoryChanged" + << LL_ENDL; return; } diff --git a/indra/newview/llfloaterbuycurrencyhtml.cpp b/indra/newview/llfloaterbuycurrencyhtml.cpp index 013cf74c7bab3ee8260090ba21d204943a0134df..0c408f556d726547ff95a0905310a73718fe41ed 100755 --- a/indra/newview/llfloaterbuycurrencyhtml.cpp +++ b/indra/newview/llfloaterbuycurrencyhtml.cpp @@ -82,7 +82,7 @@ void LLFloaterBuyCurrencyHTML::navigateToFinalURL() LLStringUtil::format( buy_currency_url, replace ); // write final URL to debug console - llinfos << "Buy currency HTML parsed URL is " << buy_currency_url << llendl; + LL_INFOS() << "Buy currency HTML parsed URL is " << buy_currency_url << LL_ENDL; // kick off the navigation mBrowser->navigateTo( buy_currency_url, "text/html" ); diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 42857b2aa21d91f2622b28e328c40edca12d3d1f..060c091737e99d576bb3ccd69178d50ab6d95fc5 100755 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -202,7 +202,7 @@ class LLFloaterBuyLandUI virtual void draw(); virtual BOOL canClose(); - void onVisibilityChange ( const LLSD& new_visibility ); + void onVisibilityChanged ( const LLSD& new_visibility ); }; @@ -877,7 +877,7 @@ void LLFloaterBuyLandUI::startTransaction(TransactionType type, const LLXMLRPCVa method = "buyLandPrep"; break; default: - llwarns << "LLFloaterBuyLandUI: Unknown transaction type!" << llendl; + LL_WARNS() << "LLFloaterBuyLandUI: Unknown transaction type!" << LL_ENDL; return; } @@ -934,7 +934,7 @@ void LLFloaterBuyLandUI::tellUserError( // virtual BOOL LLFloaterBuyLandUI::postBuild() { - setVisibleCallback(boost::bind(&LLFloaterBuyLandUI::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLFloaterBuyLandUI::onVisibilityChanged, this, _2)); mCurrency.prepare(); @@ -1008,7 +1008,7 @@ BOOL LLFloaterBuyLandUI::canClose() return can_close; } -void LLFloaterBuyLandUI::onVisibilityChange ( const LLSD& new_visibility ) +void LLFloaterBuyLandUI::onVisibilityChanged ( const LLSD& new_visibility ) { if (new_visibility.asBoolean()) { diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index f2deb6a805e5083fe78e54ffef0daa2464bfc877..a22f5770bfcf34816a1b465f57312b6c8e133ebd 100755 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -228,7 +228,7 @@ BOOL LLFloaterBvhPreview::postBuild() if (!infile.getFileHandle()) { - llwarns << "Can't open BVH file:" << mFilename << llendl; + LL_WARNS() << "Can't open BVH file:" << mFilename << LL_ENDL; } else { @@ -239,7 +239,7 @@ BOOL LLFloaterBvhPreview::postBuild() if (file_size == infile.read(file_buffer, file_size)) { file_buffer[file_size] = '\0'; - llinfos << "Loading BVH file " << mFilename << llendl; + LL_INFOS() << "Loading BVH file " << mFilename << LL_ENDL; ELoadStatus load_status = E_ST_OK; S32 line_number = 0; loaderp = new LLBVHLoader(file_buffer, load_status, line_number); @@ -247,11 +247,11 @@ BOOL LLFloaterBvhPreview::postBuild() if(load_status == E_ST_NO_XLT_FILE) { - llwarns << "NOTE: No translation table found." << llendl; + LL_WARNS() << "NOTE: No translation table found." << LL_ENDL; } else { - llwarns << "ERROR: [line: " << line_number << "] " << status << llendl; + LL_WARNS() << "ERROR: [line: " << line_number << "] " << status << LL_ENDL; } } @@ -1009,7 +1009,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) } else { - llwarns << "Failure writing animation data." << llendl; + LL_WARNS() << "Failure writing animation data." << LL_ENDL; LLNotificationsUtil::add("WriteAnimationFail"); } } diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp index a03425649fd058879afa709b7a732fb5052c758a..9425f5645e5c731fe5502fa208cb25b4678f3e51 100755 --- a/indra/newview/llfloatercolorpicker.cpp +++ b/indra/newview/llfloatercolorpicker.cpp @@ -162,12 +162,7 @@ void LLFloaterColorPicker::createUI () // create palette for ( S32 each = 0; each < numPaletteColumns * numPaletteRows; ++each ) { - std::ostringstream codec; - codec << "ColorPaletteEntry" << std::setfill ( '0' ) << std::setw ( 2 ) << each + 1; - - // argh! - const std::string s ( codec.str () ); - mPalette.push_back ( new LLColor4 ( LLUIColorTable::instance().getColor ( s ) ) ); + mPalette.push_back(new LLColor4(LLUIColorTable::instance().getColor(llformat("ColorPaletteEntry%02d", each + 1)))); } } @@ -529,11 +524,11 @@ void LLFloaterColorPicker::draw() if (gFocusMgr.childHasMouseCapture(getDragHandle())) { mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), - LLCriticalDamp::getInterpolant(mContextConeFadeTime)); + LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); } else { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(mContextConeFadeTime)); + mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(mContextConeFadeTime)); } mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); diff --git a/indra/newview/llfloatercolorpicker.h b/indra/newview/llfloatercolorpicker.h index bab061771260790292ef80457bee968df7ded26e..d4d22b643a79d8830160c42e0ae145a627510836 100755 --- a/indra/newview/llfloatercolorpicker.h +++ b/indra/newview/llfloatercolorpicker.h @@ -33,7 +33,6 @@ #include "llpointer.h" #include "llcolorswatch.h" #include "llspinctrl.h" -#include "lltextureentry.h" class LLButton; class LLLineEditor; @@ -121,7 +120,7 @@ class LLFloaterColorPicker void onClickPipette ( ); static void onTextCommit ( LLUICtrl* ctrl, void* data ); static void onImmediateCheck ( LLUICtrl* ctrl, void* data ); - void onColorSelect( const LLTextureEntry& te ); + void onColorSelect( const class LLTextureEntry& te ); private: // draws color selection palette void drawPalette (); @@ -171,7 +170,7 @@ class LLFloaterColorPicker const S32 mPaletteRegionHeight; // image used to compose color grid - LLPointer<LLViewerTexture> mRGBImage; + LLPointer<class LLViewerTexture> mRGBImage; // current swatch in use LLColorSwatchCtrl* mSwatch; diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index d08aa81cfeb953c007c42e75a2e14fda6dc81d56..bb11c813b4e393675589319e89d44f36296bfe5f 100755 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -144,7 +144,7 @@ void LLFloaterDeleteEnvPreset::onBtnDelete() } else { - llwarns << "Unrecognized key" << llendl; + LL_WARNS() << "Unrecognized key" << LL_ENDL; } LLSD args; @@ -176,7 +176,7 @@ void LLFloaterDeleteEnvPreset::populatePresetsList() } else { - llwarns << "Unrecognized key" << llendl; + LL_WARNS() << "Unrecognized key" << LL_ENDL; } } diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp index e2cef5630b0c841e9c908c87bdddf21393a4456b..596e8c0dbef7b88f7b28dfcf329549926a08d1c9 100755 --- a/indra/newview/llfloaterdisplayname.cpp +++ b/indra/newview/llfloaterdisplayname.cpp @@ -127,7 +127,7 @@ void LLFloaterDisplayName::onCacheSetName(bool success, // Request failed, notify the user std::string error_tag = content["error_tag"].asString(); - llinfos << "set name failure error_tag " << error_tag << llendl; + LL_INFOS() << "set name failure error_tag " << error_tag << LL_ENDL; // We might have a localized string for this message // error_args will usually be empty from the server. diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 78e20e3bf0652bff13e6be6af0ffc57d253c3b87..5c0991b0b311dd6d1915dfac72c3c479c1f0413a 100755 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -172,7 +172,7 @@ void LLFloaterEditDayCycle::loadTrack() // add sliders - lldebugs << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << llendl; + LL_DEBUGS() << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << LL_ENDL; LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; for (std::map<F32, LLWLParamKey>::iterator it = cur_dayp.mTimeMap.begin(); it != cur_dayp.mTimeMap.end(); ++it) @@ -192,12 +192,12 @@ void LLFloaterEditDayCycle::loadTrack() void LLFloaterEditDayCycle::applyTrack() { - lldebugs << "Applying track (" << mSliderToKey.size() << ")" << llendl; + LL_DEBUGS() << "Applying track (" << mSliderToKey.size() << ")" << LL_ENDL; // if no keys, do nothing if (mSliderToKey.size() == 0) { - lldebugs << "No keys, not syncing" << llendl; + LL_DEBUGS() << "No keys, not syncing" << LL_ENDL; return; } @@ -342,7 +342,7 @@ void LLFloaterEditDayCycle::onKeyTimeMoved() // check to see if a key exists LLWLParamKey key = mSliderToKey[cur_sldr].keyframe; - lldebugs << "Setting key time: " << time24 << LL_ENDL; + LL_DEBUGS() << "Setting key time: " << time24 << LL_ENDL; mSliderToKey[cur_sldr].time = time24; // if it exists, turn on check box @@ -368,7 +368,7 @@ void LLFloaterEditDayCycle::onKeyTimeChanged() F32 time = mKeysSlider->getCurSliderValue() / sHoursPerDay; // now set the key's time in the sliderToKey map - lldebugs << "Setting key time: " << time << LL_ENDL; + LL_DEBUGS() << "Setting key time: " << time << LL_ENDL; mSliderToKey[cur_sldr].time = time; applyTrack(); @@ -564,7 +564,7 @@ void LLFloaterEditDayCycle::saveRegionDayCycle() #else // Temporary disabled ability to upload new region settings from the Day Cycle Editor. if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings)) { - llwarns << "Error applying region environment settings" << llendl; + LL_WARNS() << "Error applying region environment settings" << LL_ENDL; return; } @@ -637,7 +637,7 @@ void LLFloaterEditDayCycle::onRegionSettingsChange() // Change preference if requested. if (mMakeDefaultCheckBox->getValue()) { - LL_DEBUGS("Windlight") << "Changed environment preference to region settings" << llendl; + LL_DEBUGS("Windlight") << "Changed environment preference to region settings" << LL_ENDL; LLEnvManagerNew::instance().setUseRegionSettings(true); } @@ -699,7 +699,7 @@ void LLFloaterEditDayCycle::onDayCycleSelected() { if (!LLDayCycleManager::instance().getPreset(dc_key.name, day_data)) { - llwarns << "No day cycle named " << dc_key.name << llendl; + LL_WARNS() << "No day cycle named " << dc_key.name << LL_ENDL; return; } } @@ -708,7 +708,7 @@ void LLFloaterEditDayCycle::onDayCycleSelected() day_data = LLEnvManagerNew::instance().getRegionSettings().getWLDayCycle(); if (day_data.size() == 0) { - llwarns << "Empty region day cycle" << llendl; + LL_WARNS() << "Empty region day cycle" << LL_ENDL; llassert(day_data.size() > 0); return; } @@ -742,7 +742,7 @@ void LLFloaterEditDayCycle::onBtnSave() if (name.empty()) { // *TODO: show an alert - llwarns << "Empty day cycle name" << llendl; + LL_WARNS() << "Empty day cycle name" << LL_ENDL; return; } @@ -795,7 +795,7 @@ void LLFloaterEditDayCycle::onSaveConfirmed() // Change preference if requested. if (mMakeDefaultCheckBox->getValue()) { - LL_DEBUGS("Windlight") << name << " is now the new preferred day cycle" << llendl; + LL_DEBUGS("Windlight") << name << " is now the new preferred day cycle" << LL_ENDL; LLEnvManagerNew::instance().setUseDayCycle(name); } diff --git a/indra/newview/llfloatereditsky.cpp b/indra/newview/llfloatereditsky.cpp index 352361ce9e8af319722a51ed5cb8493ffc1b602d..d809211ea74120b39410fcec73bd9501ea447886 100755 --- a/indra/newview/llfloatereditsky.cpp +++ b/indra/newview/llfloatereditsky.cpp @@ -721,7 +721,7 @@ void LLFloaterEditSky::saveRegionSky() LLWLParamKey key(getSelectedSkyPreset()); llassert(key.scope == LLEnvKey::SCOPE_REGION); - LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << llendl; + LL_DEBUGS("Windlight") << "Saving region sky preset: " << key.name << LL_ENDL; LLWLParamManager& wl_mgr = LLWLParamManager::instance(); wl_mgr.mCurParams.mName = key.name; wl_mgr.setParamSet(key, wl_mgr.mCurParams); @@ -819,7 +819,7 @@ void LLFloaterEditSky::onSaveConfirmed() // Change preference if requested. if (mMakeDefaultCheckBox->getValue()) { - LL_DEBUGS("Windlight") << key.name << " is now the new preferred sky preset" << llendl; + LL_DEBUGS("Windlight") << key.name << " is now the new preferred sky preset" << LL_ENDL; LLEnvManagerNew::instance().setUseSkyPreset(key.name); } @@ -842,7 +842,7 @@ void LLFloaterEditSky::onBtnSave() if (name.empty()) { // *TODO: show an alert - llwarns << "Empty sky preset name" << llendl; + LL_WARNS() << "Empty sky preset name" << LL_ENDL; return; } diff --git a/indra/newview/llfloatereditwater.cpp b/indra/newview/llfloatereditwater.cpp index 64cfc4054f516986231573896079a1ed712f9050..43b44eae3750dcc31e2372adbb6f2dee69b618bd 100755 --- a/indra/newview/llfloatereditwater.cpp +++ b/indra/newview/llfloatereditwater.cpp @@ -546,7 +546,7 @@ void LLFloaterEditWater::saveRegionWater() { llassert(getCurrentScope() == LLEnvKey::SCOPE_REGION); // make sure we're editing region water - LL_DEBUGS("Windlight") << "Saving region water preset" << llendl; + LL_DEBUGS("Windlight") << "Saving region water preset" << LL_ENDL; //LLWaterParamSet region_water = water_mgr.mCurParams; @@ -665,7 +665,7 @@ void LLFloaterEditWater::onSaveConfirmed() // Change preference if requested. if (mMakeDefaultCheckBox->getEnabled() && mMakeDefaultCheckBox->getValue()) { - LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << llendl; + LL_DEBUGS("Windlight") << name << " is now the new preferred water preset" << LL_ENDL; LLEnvManagerNew::instance().setUseWaterPreset(name); } @@ -688,7 +688,7 @@ void LLFloaterEditWater::onBtnSave() if (name.empty()) { // *TODO: show an alert - llwarns << "Empty water preset name" << llendl; + LL_WARNS() << "Empty water preset name" << LL_ENDL; return; } diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp index a6dafda3e698235c06ff09fa0c3819f9f9940294..3e303e0932aa7b6431eb2eec5cee631c313775b0 100755 --- a/indra/newview/llfloaterevent.cpp +++ b/indra/newview/llfloaterevent.cpp @@ -45,7 +45,6 @@ #include "llmediactrl.h" #include "llfloaterworldmap.h" #include "llinventorymodel.h" -#include "llsecondlifeurls.h" #include "llslurl.h" #include "lltextbox.h" #include "lltexteditor.h" diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 56051ff68458f5cbd589ae833028116bbad3be41..1452d53265274d510b7d7944d69e01b8460c550c 100755 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -400,9 +400,9 @@ bool LLFloaterGesture::isActionEnabled(const LLSD& command) if(!LLClipboard::instance().hasContents()) return false; - LLDynamicArray<LLUUID> ids; + std::vector<LLUUID> ids; LLClipboard::instance().pasteFromClipboard(ids); - for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) + for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) { LLInventoryItem* item = gInventory.getItem(*it); @@ -514,7 +514,7 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command) } else if ("paste" == command_name) { - LLDynamicArray<LLUUID> ids; + std::vector<LLUUID> ids; LLClipboard::instance().pasteFromClipboard(ids); if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID)) return; @@ -522,7 +522,7 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command) llassert(gesture_dir); LLPointer<GestureCopiedCallback> cb = new GestureCopiedCallback(this); - for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) + for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) { LLInventoryItem* item = gInventory.getItem(*it); if(gesture_dir && item && item->getInventoryType() == LLInventoryType::IT_GESTURE) diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index fe6223fbf53598f804b21495d561d6430c2beec9..6966ca5639bf8822c0fc8a2399b0e3e2168deb2b 100755 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -796,7 +796,7 @@ void LLPanelRegionTools::onSwapTerrain() void LLPanelRegionTools::onSelectRegion() { - llinfos << "LLPanelRegionTools::onSelectRegion" << llendl; + LL_INFOS() << "LLPanelRegionTools::onSelectRegion" << LL_ENDL; LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(gAgent.getPositionGlobal()); if (!regionp) @@ -1262,8 +1262,8 @@ void LLPanelRequestTools::sendRequest(const std::string& request, const std::string& parameter, const LLHost& host) { - llinfos << "Sending request '" << request << "', '" - << parameter << "' to " << host << llendl; + LL_INFOS() << "Sending request '" << request << "', '" + << parameter << "' to " << host << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessage("GodlikeMessage"); msg->nextBlockFast(_PREHASH_AgentData); @@ -1316,7 +1316,7 @@ void terrain_download_done(void** data, S32 status, LLExtStat ext_status) void test_callback(const LLTSCode status) { - llinfos << "Test transfer callback returned!" << llendl; + LL_INFOS() << "Test transfer callback returned!" << LL_ENDL; } diff --git a/indra/newview/llfloatergroupinvite.cpp b/indra/newview/llfloatergroupinvite.cpp index d0f32897697386a4fb9eac6a77cbf13523b32144..7fdba8734a6cac29dcd180aa99a21b73003bccdc 100755 --- a/indra/newview/llfloatergroupinvite.cpp +++ b/indra/newview/llfloatergroupinvite.cpp @@ -117,7 +117,7 @@ void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id, uuid_vec_t *agen // Make sure group_id isn't null if (group_id.isNull()) { - llwarns << "LLFloaterGroupInvite::showForGroup with null group_id!" << llendl; + LL_WARNS() << "LLFloaterGroupInvite::showForGroup with null group_id!" << LL_ENDL; return; } diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index d84364a68a76e4fac73e28bfad7f4bc5330ae099..dbe7fee108e92e821f4f83eefe831f81c2b542e9 100755 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -171,7 +171,7 @@ void LLPanelGroups::reset() { group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); } - getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); + getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); init_group_list(getChild<LLScrollListCtrl>("group list"), gAgent.getGroupID()); @@ -182,7 +182,7 @@ BOOL LLPanelGroups::postBuild() { childSetCommitCallback("group list", onGroupList, this); - getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); + getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); getChild<LLUICtrl>("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); LLScrollListCtrl *list = getChild<LLScrollListCtrl>("group list"); @@ -341,7 +341,7 @@ void LLPanelGroups::onGroupList(LLUICtrl* ctrl, void* userdata) void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U64 powers_mask) { - S32 count = gAgent.mGroups.count(); + S32 count = gAgent.mGroups.size(); LLUUID id; if (!group_list) return; @@ -349,8 +349,8 @@ void init_group_list(LLScrollListCtrl* group_list, const LLUUID& highlight_id, U for(S32 i = 0; i < count; ++i) { - id = gAgent.mGroups.get(i).mID; - LLGroupData* group_datap = &gAgent.mGroups.get(i); + id = gAgent.mGroups.at(i).mID; + LLGroupData* group_datap = &gAgent.mGroups.at(i); if ((powers_mask == GP_ALL_POWERS) || ((group_datap->mPowers & powers_mask) != 0)) { std::string style = "NORMAL"; diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 792a2a5d2559a84bda1fe1acb866b572e303d820..035eb307c20b124907a2a07b8bc9bcc3fd9dc388 100755 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -89,12 +89,11 @@ void LLFloaterHardwareSettings::refresh() void LLFloaterHardwareSettings::refreshEnabledState() { - F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); - - S32 min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); - S32 max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier); - getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMinValue(min_tex_mem); - getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem); + F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); + S32Megabytes min_tex_mem = LLViewerTextureList::getMinVideoRamSetting(); + S32Megabytes max_tex_mem = LLViewerTextureList::getMaxVideoRamSetting(false, mem_multiplier); + getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMinValue(min_tex_mem.value()); + getChild<LLSliderCtrl>("GraphicsCardTextureMemory")->setMaxValue(max_tex_mem.value()); if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || !gGLManager.mHasVertexBufferObject) diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index bb4b9d2d401dba04cfb63979b23adfa3a776c373..ebb44561da6f2a46c7b7b81df722c62f539d9043 100755 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -424,7 +424,7 @@ bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event) // For debug only //std::ostringstream llsd_value; //llsd_value << LLSDOStreamer<LLSDNotationFormatter>(event) << std::endl; - //llinfos << "LLFloaterIMContainer::onConversationModelEvent, event = " << llsd_value.str() << llendl; + //LL_INFOS() << "LLFloaterIMContainer::onConversationModelEvent, event = " << llsd_value.str() << LL_ENDL; // end debug // Note: In conversations, the model is not responsible for creating the view, which is a good thing. This means that @@ -1612,7 +1612,7 @@ LLConversationItem* LLFloaterIMContainer::addConversationListItem(const LLUUID& } if (!item) { - llwarns << "Couldn't create conversation session item : " << display_name << llendl; + LL_WARNS() << "Couldn't create conversation session item : " << display_name << LL_ENDL; return NULL; } item->renameItem(display_name); @@ -1794,7 +1794,7 @@ bool LLFloaterIMContainer::isGroupModerator() LLSpeakerMgr * speaker_manager = getSpeakerMgrForSelectedParticipant(); if (NULL == speaker_manager) { - llwarns << "Speaker manager is missing" << llendl; + LL_WARNS() << "Speaker manager is missing" << LL_ENDL; return false; } @@ -1886,7 +1886,7 @@ LLSpeakerMgr * LLFloaterIMContainer::getSpeakerMgrForSelectedParticipant() LLFolderViewItem *selectedItem = mConversationsRoot->getCurSelectedItem(); if (NULL == selectedItem) { - llwarns << "Current selected item is null" << llendl; + LL_WARNS() << "Current selected item is null" << LL_ENDL; return NULL; } @@ -1904,7 +1904,7 @@ LLSpeakerMgr * LLFloaterIMContainer::getSpeakerMgrForSelectedParticipant() } if (NULL == conversation_uuidp) { - llwarns << "Cannot find conversation item widget" << llendl; + LL_WARNS() << "Cannot find conversation item widget" << LL_ENDL; return NULL; } @@ -1916,14 +1916,14 @@ LLSpeaker * LLFloaterIMContainer::getSpeakerOfSelectedParticipant(LLSpeakerMgr * { if (NULL == speaker_managerp) { - llwarns << "Speaker manager is missing" << llendl; + LL_WARNS() << "Speaker manager is missing" << LL_ENDL; return NULL; } const LLConversationItem * participant_itemp = getCurSelectedViewModelItem(); if (NULL == participant_itemp) { - llwarns << "Cannot evaluate current selected view model item" << llendl; + LL_WARNS() << "Cannot evaluate current selected view model item" << LL_ENDL; return NULL; } @@ -2136,14 +2136,7 @@ BOOL LLFloaterIMContainer::isFrontmost() // This is intentional so it doesn't confuse the user. onClickCloseBtn() closes the whole floater. void LLFloaterIMContainer::onClickCloseBtn(bool app_quitting/* = false*/) { - // Always unminimize before trying to close. - // Most of the time the user will never see this state. - if(isMinimized()) - { - LLMultiFloater::setMinimized(FALSE); - } - - LLFloater::closeFloater(app_quitting); + LLMultiFloater::closeFloater(app_quitting); } void LLFloaterIMContainer::closeHostedFloater() @@ -2153,7 +2146,7 @@ void LLFloaterIMContainer::closeHostedFloater() void LLFloaterIMContainer::closeAllConversations() { - LLDynamicArray<LLUUID> ids; + std::vector<LLUUID> ids; for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++) { LLUUID session_id = it_session->first; @@ -2163,7 +2156,7 @@ void LLFloaterIMContainer::closeAllConversations() } } - for (LLDynamicArray<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) + for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) { LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(*it); LLFloater::onClickClose(conversationFloater); diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index 323e84751f6f7b819ba0410562d17d7735fccd65..7a989806a1ff2ff1ead578d21ddd1b3e6e55afc3 100755 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -89,7 +89,7 @@ static LLChatTypeTrigger sChatTypeTriggers[] = { LLFloaterIMNearbyChat::LLFloaterIMNearbyChat(const LLSD& llsd) -: LLFloaterIMSessionTab(llsd), +: LLFloaterIMSessionTab(LLSD(LLUUID::null)), //mOutputMonitor(NULL), mSpeakerMgr(NULL), mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT) @@ -97,7 +97,6 @@ LLFloaterIMNearbyChat::LLFloaterIMNearbyChat(const LLSD& llsd) mIsP2PChat = false; mIsNearbyChat = true; mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); - mSessionID = LLUUID(); } //static @@ -331,7 +330,7 @@ void LLFloaterIMNearbyChat::onChatFontChange(LLFontGL* fontp) void LLFloaterIMNearbyChat::show() { openFloater(getKey()); - } +} bool LLFloaterIMNearbyChat::isChatVisible() const { @@ -507,10 +506,10 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() mInputEditor->endOfDoc(); } - //llinfos << "GESTUREDEBUG " << trigger + //LL_INFOS() << "GESTUREDEBUG " << trigger // << " len " << length // << " outlen " << out_str.getLength() - // << llendl; + // << LL_ENDL; } } @@ -697,22 +696,22 @@ void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType { if (type == CHAT_TYPE_WHISPER) { - lldebugs << "You whisper " << utf8_text << llendl; + LL_DEBUGS() << "You whisper " << utf8_text << LL_ENDL; gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START); } else if (type == CHAT_TYPE_NORMAL) { - lldebugs << "You say " << utf8_text << llendl; + LL_DEBUGS() << "You say " << utf8_text << LL_ENDL; gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START); } else if (type == CHAT_TYPE_SHOUT) { - lldebugs << "You shout " << utf8_text << llendl; + LL_DEBUGS() << "You shout " << utf8_text << LL_ENDL; gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START); } else { - llinfos << "send_chat_from_viewer() - invalid volume" << llendl; + LL_INFOS() << "send_chat_from_viewer() - invalid volume" << LL_ENDL; return; } } @@ -720,7 +719,7 @@ void LLFloaterIMNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType { if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP) { - lldebugs << "Channel chat: " << utf8_text << llendl; + LL_DEBUGS() << "Channel chat: " << utf8_text << LL_ENDL; } } @@ -850,7 +849,7 @@ void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 gAgent.sendReliableMessage(); - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); + add(LLStatViewer::CHAT_COUNT, 1); } class LLChatCommandHandler : public LLCommandHandler diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp index a8f815c389343de80ebd1aa120c4efb1c10e0de7..1f85c5ac1b75719610d3e25c25de4b2458b35814 100755 --- a/indra/newview/llfloaterimnearbychathandler.cpp +++ b/indra/newview/llfloaterimnearbychathandler.cpp @@ -111,7 +111,7 @@ class LLFloaterIMNearbyChatScreenChannel: public LLScreenChannelBase virtual void deleteAllChildren() { - LL_DEBUGS("NearbyChat") << "Clearing toast pool" << llendl; + LL_DEBUGS("NearbyChat") << "Clearing toast pool" << LL_ENDL; m_toast_pool.clear(); m_active_toasts.clear(); LLScreenChannelBase::deleteAllChildren(); @@ -122,7 +122,7 @@ class LLFloaterIMNearbyChatScreenChannel: public LLScreenChannelBase void addToToastPool(LLToast* toast) { if (!toast) return; - LL_DEBUGS("NearbyChat") << "Pooling toast" << llendl; + LL_DEBUGS("NearbyChat") << "Pooling toast" << LL_ENDL; toast->setVisible(FALSE); toast->stopTimer(); toast->setIsHidden(true); @@ -189,7 +189,7 @@ void LLFloaterIMNearbyChatScreenChannel::deactivateToast(LLToast* toast) if (pos != m_active_toasts.end()) { - LL_DEBUGS("NearbyChat") << "Deactivating toast" << llendl; + LL_DEBUGS("NearbyChat") << "Deactivating toast" << LL_ENDL; m_active_toasts.erase(pos); } } @@ -201,7 +201,7 @@ void LLFloaterIMNearbyChatScreenChannel::createOverflowToast(S32 bottom, F32 tim void LLFloaterIMNearbyChatScreenChannel::onToastDestroyed(LLToast* toast, bool app_quitting) { - LL_DEBUGS("NearbyChat") << "Toast destroyed (app_quitting=" << app_quitting << ")" << llendl; + LL_DEBUGS("NearbyChat") << "Toast destroyed (app_quitting=" << app_quitting << ")" << LL_ENDL; if (app_quitting) { @@ -220,7 +220,7 @@ void LLFloaterIMNearbyChatScreenChannel::onToastDestroyed(LLToast* toast, bool a void LLFloaterIMNearbyChatScreenChannel::onToastFade(LLToast* toast) { - LL_DEBUGS("NearbyChat") << "Toast fading" << llendl; + LL_DEBUGS("NearbyChat") << "Toast fading" << LL_ENDL; //fade mean we put toast to toast pool if(!toast) @@ -274,7 +274,7 @@ bool LLFloaterIMNearbyChatScreenChannel::createPoolToast() // If the toast gets somehow prematurely destroyed, deactivate it to prevent crash (STORM-1352). toast->setOnToastDestroyedCallback(boost::bind(&LLFloaterIMNearbyChatScreenChannel::onToastDestroyed, this, _1, false)); - LL_DEBUGS("NearbyChat") << "Creating and pooling toast" << llendl; + LL_DEBUGS("NearbyChat") << "Creating and pooling toast" << LL_ENDL; m_toast_pool.push_back(toast->getHandle()); return true; } @@ -315,7 +315,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) if(m_toast_pool.empty()) { //"pool" is empty - create one more panel - LL_DEBUGS("NearbyChat") << "Empty pool" << llendl; + LL_DEBUGS("NearbyChat") << "Empty pool" << LL_ENDL; if(!createPoolToast())//created toast will go to pool. so next call will find it return; addChat(chat); @@ -335,7 +335,7 @@ void LLFloaterIMNearbyChatScreenChannel::addChat(LLSD& chat) //take 1st element from pool, (re)initialize it, put it in active toasts - LL_DEBUGS("NearbyChat") << "Getting toast from pool" << llendl; + LL_DEBUGS("NearbyChat") << "Getting toast from pool" << LL_ENDL; LLToast* toast = m_toast_pool.back().get(); m_toast_pool.pop_back(); @@ -403,7 +403,7 @@ void LLFloaterIMNearbyChatScreenChannel::arrangeToasts() LLToast* toast = it->get(); if (!toast) { - llwarns << "NULL found in the active chat toasts list!" << llendl; + LL_WARNS() << "NULL found in the active chat toasts list!" << LL_ENDL; continue; } diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp old mode 100755 new mode 100644 index d94dd85bce54d54f359b788f9ecba36d4a01a79f..f61359f87a52e4f0e5bd5ca4bd91881cad6588cc --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -41,6 +41,7 @@ #include "llchicletbar.h" #include "lldonotdisturbnotificationstorage.h" #include "llfloaterreg.h" +#include "llhttpclient.h" #include "llfloateravatarpicker.h" #include "llfloaterimcontainer.h" // to replace separate IM Floaters with multifloater container #include "llinventoryfunctions.h" @@ -52,6 +53,7 @@ #include "lltrans.h" #include "llchathistory.h" #include "llnotifications.h" +#include "llviewerregion.h" #include "llviewerwindow.h" #include "lltransientfloatermgr.h" #include "llinventorymodel.h" @@ -102,7 +104,7 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id) void LLFloaterIMSession::refresh() { if (mMeTyping) - { +{ // Send an additional Start Typing packet every ME_TYPING_TIMEOUT seconds if (mMeTypingTimer.getElapsedTimeF32() > ME_TYPING_TIMEOUT && false == mShouldSendTypingState) { @@ -114,7 +116,7 @@ void LLFloaterIMSession::refresh() // Time out if user hasn't typed for a while. if (mTypingTimeoutTimer.getElapsedTimeF32() > LLAgent::TYPING_TIMEOUT_SECS) { - setTyping(false); + setTyping(false); LL_DEBUGS("TypingMsgs") << "Send stop typing due to timeout" << LL_ENDL; } } @@ -158,7 +160,7 @@ void LLFloaterIMSession::onClickCloseBtn(bool) } else { - llwarns << "Empty session with id: " << (mSessionID.asString()) << llendl; + LL_WARNS() << "Empty session with id: " << (mSessionID.asString()) << LL_ENDL; return; } @@ -182,7 +184,7 @@ void LLFloaterIMSession::newIMCallback(const LLSD& data) } } -void LLFloaterIMSession::onVisibilityChange(const LLSD& new_visibility) +void LLFloaterIMSession::onVisibilityChanged(const LLSD& new_visibility) { bool visible = new_visibility.asBoolean(); @@ -260,7 +262,7 @@ void LLFloaterIMSession::sendMsgFromInputEditor() } else { - llinfos << "Cannot send IM to everyone unless you're a god." << llendl; + LL_INFOS() << "Cannot send IM to everyone unless you're a god." << LL_ENDL; } } @@ -980,7 +982,7 @@ void LLFloaterIMSession::setTyping(bool typing) if ( mMeTyping ) { if ( mTypingTimer.getElapsedTimeF32() > 1.f ) - { + { // Still typing, send 'start typing' notification LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, TRUE); mShouldSendTypingState = false; @@ -991,7 +993,7 @@ void LLFloaterIMSession::setTyping(bool typing) { // Send 'stop typing' notification immediately LLIMModel::instance().sendTypingState(mSessionID, mOtherParticipantUUID, FALSE); - mShouldSendTypingState = false; + mShouldSendTypingState = false; } } @@ -1187,8 +1189,8 @@ class LLSessionInviteResponder : public LLHTTPClient::Responder void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llwarns << "Error inviting all agents to session [status:" - << statusNum << "]: " << content << llendl; + LL_WARNS() << "Error inviting all agents to session [status:" + << statusNum << "]: " << content << LL_ENDL; //throw something back to the viewer here? } @@ -1207,7 +1209,7 @@ BOOL LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) if( isInviteAllowed() && (count > 0) ) { - llinfos << "LLFloaterIMSession::inviteToSession() - inviting participants" << llendl; + LL_INFOS() << "LLFloaterIMSession::inviteToSession() - inviting participants" << LL_ENDL; std::string url = region->getCapability("ChatSessionRequest"); @@ -1223,9 +1225,9 @@ BOOL LLFloaterIMSession::inviteToSession(const uuid_vec_t& ids) } else { - llinfos << "LLFloaterIMSession::inviteToSession -" + LL_INFOS() << "LLFloaterIMSession::inviteToSession -" << " no need to invite agents for " - << mDialog << llendl; + << mDialog << LL_ENDL; // successful add, because everyone that needed to get added // was added. } diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h old mode 100755 new mode 100644 index 2b9d06e744eba00cd8631453de11ac4140be968a..0f7164a58596e083fe6ccf4cfdd8c104273964e2 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -107,7 +107,7 @@ class LLFloaterIMSession // called when docked floater's position has been set by chiclet void setPositioned(bool b) { mPositioned = b; }; - void onVisibilityChange(const LLSD& new_visibility); + void onVisibilityChanged(const LLSD& new_visibility); bool enableGearMenuItem(const LLSD& userdata); void GearDoToSelected(const LLSD& userdata); bool checkGearMenuItem(const LLSD& userdata); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 29511f56ff17f76ca2d318ffaf1f773bbcb0341e..fbdaca0e6f31a7b819581a4753a4c062010d6213 100755 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -47,24 +47,24 @@ const F32 REFRESH_INTERVAL = 1.0f; LLFloaterIMSessionTab::LLFloaterIMSessionTab(const LLSD& session_id) - : LLTransientDockableFloater(NULL, true, session_id) - , mIsP2PChat(false) - , mExpandCollapseBtn(NULL) - , mTearOffBtn(NULL) - , mCloseBtn(NULL) - , mSessionID(session_id.asUUID()) - , mConversationsRoot(NULL) - , mScroller(NULL) - , mChatHistory(NULL) - , mInputEditor(NULL) - , mInputEditorPad(0) - , mRefreshTimer(new LLTimer()) - , mIsHostAttached(false) - , mHasVisibleBeenInitialized(false) - , mIsParticipantListExpanded(true) - , mChatLayoutPanel(NULL) - , mInputPanels(NULL) - , mChatLayoutPanelHeight(0) +: LLTransientDockableFloater(NULL, true, session_id), + mIsP2PChat(false), + mExpandCollapseBtn(NULL), + mTearOffBtn(NULL), + mCloseBtn(NULL), + mSessionID(session_id.asUUID()), + mConversationsRoot(NULL), + mScroller(NULL), + mChatHistory(NULL), + mInputEditor(NULL), + mInputEditorPad(0), + mRefreshTimer(new LLTimer()), + mIsHostAttached(false), + mHasVisibleBeenInitialized(false), + mIsParticipantListExpanded(true), + mChatLayoutPanel(NULL), + mInputPanels(NULL), + mChatLayoutPanelHeight(0) { setAutoFocus(FALSE); mSession = LLIMModel::getInstance()->findIMSession(mSessionID); diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index d0c22d25f2b4d25f66067ff43b833df6ecaea89f..b7fff6cae37fb380520149930ab82766ee22ca34 100755 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -33,7 +33,7 @@ #include "llerror.h" #include "llrect.h" #include "llstring.h" -#include "llstat.h" +#include "lltrace.h" // project includes #include "lluictrlfactory.h" @@ -42,6 +42,22 @@ #include "llviewerjoystick.h" #include "llcheckboxctrl.h" +static LLTrace::SampleStatHandle<> sJoystickAxis0("Joystick axis 0"), + sJoystickAxis1("Joystick axis 1"), + sJoystickAxis2("Joystick axis 2"), + sJoystickAxis3("Joystick axis 3"), + sJoystickAxis4("Joystick axis 4"), + sJoystickAxis5("Joystick axis 5"); +static LLTrace::SampleStatHandle<>* sJoystickAxes[6] = +{ + &sJoystickAxis0, + &sJoystickAxis1, + &sJoystickAxis2, + &sJoystickAxis3, + &sJoystickAxis4, + &sJoystickAxis5 +}; + LLFloaterJoystick::LLFloaterJoystick(const LLSD& data) : LLFloater(data) { @@ -61,7 +77,7 @@ void LLFloaterJoystick::draw() for (U32 i = 0; i < 6; i++) { F32 value = joystick->getJoystickAxis(i); - mAxisStats[i]->addValue(value * gFrameIntervalSeconds); + sample(*sJoystickAxes[i], value * gFrameIntervalSeconds.value()); if (mAxisStatsBar[i]) { F32 minbar, maxbar; @@ -69,7 +85,7 @@ void LLFloaterJoystick::draw() if (llabs(value) > maxbar) { F32 range = llabs(value); - mAxisStatsBar[i]->setRange(-range, range, range * 0.25f, range * 0.5f); + mAxisStatsBar[i]->setRange(-range, range); } } } @@ -85,13 +101,12 @@ BOOL LLFloaterJoystick::postBuild() for (U32 i = 0; i < 6; i++) { std::string stat_name(llformat("Joystick axis %d", i)); - mAxisStats[i] = new LLStat(stat_name, 4); std::string axisname = llformat("axis%d", i); mAxisStatsBar[i] = getChild<LLStatBar>(axisname); if (mAxisStatsBar[i]) { - mAxisStatsBar[i]->setStat(mAxisStats[i]); - mAxisStatsBar[i]->setRange(-range, range, range * 0.25f, range * 0.5f); + mAxisStatsBar[i]->setStat(stat_name); + mAxisStatsBar[i]->setRange(-range, range); } } diff --git a/indra/newview/llfloaterjoystick.h b/indra/newview/llfloaterjoystick.h index dfdb108ff84236e2e8a4eb96bfee2980b19463d6..9c3752540d770d158ebc9cdd642953fd5f7a9d31 100755 --- a/indra/newview/llfloaterjoystick.h +++ b/indra/newview/llfloaterjoystick.h @@ -84,7 +84,6 @@ class LLFloaterJoystick : public LLFloater LLCheckBoxCtrl *mCheckFlycamEnabled; // stats view - LLStat* mAxisStats[6]; LLStatBar* mAxisStatsBar[6]; }; diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp deleted file mode 100755 index 68b1770bb2c40a444d6df496d90ad0a799b7d6d2..0000000000000000000000000000000000000000 --- a/indra/newview/llfloaterlagmeter.cpp +++ /dev/null @@ -1,375 +0,0 @@ -/** - * @file llfloaterlagmeter.cpp - * @brief The "Lag-o-Meter" floater used to tell users what is causing lag. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterlagmeter.h" - -#include "lluictrlfactory.h" -#include "llviewerstats.h" -#include "llviewertexture.h" -#include "llviewercontrol.h" -#include "llappviewer.h" - -#include "lltexturefetch.h" - -#include "llbutton.h" -#include "llfocusmgr.h" -#include "lltextbox.h" - -const std::string LAG_CRITICAL_IMAGE_NAME = "lag_status_critical.tga"; -const std::string LAG_WARNING_IMAGE_NAME = "lag_status_warning.tga"; -const std::string LAG_GOOD_IMAGE_NAME = "lag_status_good.tga"; - -LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key) - : LLFloater(key) -{ - mCommitCallbackRegistrar.add("LagMeter.ClickShrink", boost::bind(&LLFloaterLagMeter::onClickShrink, this)); -} - -BOOL LLFloaterLagMeter::postBuild() -{ - // Don't let this window take keyboard focus -- it's confusing to - // lose arrow-key driving when testing lag. - setIsChrome(TRUE); - - // were we shrunk last time? - if (isShrunk()) - { - onClickShrink(); - } - - mClientButton = getChild<LLButton>("client_lagmeter"); - mClientText = getChild<LLTextBox>("client_text"); - mClientCause = getChild<LLTextBox>("client_lag_cause"); - - mNetworkButton = getChild<LLButton>("network_lagmeter"); - mNetworkText = getChild<LLTextBox>("network_text"); - mNetworkCause = getChild<LLTextBox>("network_lag_cause"); - - mServerButton = getChild<LLButton>("server_lagmeter"); - mServerText = getChild<LLTextBox>("server_text"); - mServerCause = getChild<LLTextBox>("server_lag_cause"); - - std::string config_string = getString("client_frame_rate_critical_fps", mStringArgs); - mClientFrameTimeCritical = 1.0f / (float)atof( config_string.c_str() ); - config_string = getString("client_frame_rate_warning_fps", mStringArgs); - mClientFrameTimeWarning = 1.0f / (float)atof( config_string.c_str() ); - - config_string = getString("network_packet_loss_critical_pct", mStringArgs); - mNetworkPacketLossCritical = (float)atof( config_string.c_str() ); - config_string = getString("network_packet_loss_warning_pct", mStringArgs); - mNetworkPacketLossWarning = (float)atof( config_string.c_str() ); - - config_string = getString("network_ping_critical_ms", mStringArgs); - mNetworkPingCritical = (float)atof( config_string.c_str() ); - config_string = getString("network_ping_warning_ms", mStringArgs); - mNetworkPingWarning = (float)atof( config_string.c_str() ); - config_string = getString("server_frame_rate_critical_fps", mStringArgs); - - mServerFrameTimeCritical = 1000.0f / (float)atof( config_string.c_str() ); - config_string = getString("server_frame_rate_warning_fps", mStringArgs); - mServerFrameTimeWarning = 1000.0f / (float)atof( config_string.c_str() ); - config_string = getString("server_single_process_max_time_ms", mStringArgs); - mServerSingleProcessMaxTime = (float)atof( config_string.c_str() ); - -// mShrunk = false; - config_string = getString("max_width_px", mStringArgs); - mMaxWidth = atoi( config_string.c_str() ); - config_string = getString("min_width_px", mStringArgs); - mMinWidth = atoi( config_string.c_str() ); - - mStringArgs["[CLIENT_FRAME_RATE_CRITICAL]"] = getString("client_frame_rate_critical_fps"); - mStringArgs["[CLIENT_FRAME_RATE_WARNING]"] = getString("client_frame_rate_warning_fps"); - - mStringArgs["[NETWORK_PACKET_LOSS_CRITICAL]"] = getString("network_packet_loss_critical_pct"); - mStringArgs["[NETWORK_PACKET_LOSS_WARNING]"] = getString("network_packet_loss_warning_pct"); - - mStringArgs["[NETWORK_PING_CRITICAL]"] = getString("network_ping_critical_ms"); - mStringArgs["[NETWORK_PING_WARNING]"] = getString("network_ping_warning_ms"); - - mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps"); - mStringArgs["[SERVER_FRAME_RATE_WARNING]"] = getString("server_frame_rate_warning_fps"); - -// childSetAction("minimize", onClickShrink, this); - updateControls(isShrunk()); // if expanded append colon to the labels (EXT-4079) - - return TRUE; -} -LLFloaterLagMeter::~LLFloaterLagMeter() -{ - // save shrunk status for next time -// gSavedSettings.setBOOL("LagMeterShrunk", mShrunk); - // expand so we save the large window rectangle - if (isShrunk()) - { - onClickShrink(); - } -} - -void LLFloaterLagMeter::draw() -{ - determineClient(); - determineNetwork(); - determineServer(); - - LLFloater::draw(); -} - -void LLFloaterLagMeter::determineClient() -{ - F32 client_frame_time = LLViewerStats::getInstance()->mFPSStat.getMeanDuration(); - bool find_cause = false; - - if (!gFocusMgr.getAppHasFocus()) - { - mClientButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME)); - mClientText->setText( getString("client_frame_time_window_bg_msg", mStringArgs) ); - mClientCause->setText( LLStringUtil::null ); - } - else if(client_frame_time >= mClientFrameTimeCritical) - { - mClientButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME)); - mClientText->setText( getString("client_frame_time_critical_msg", mStringArgs) ); - find_cause = true; - } - else if(client_frame_time >= mClientFrameTimeWarning) - { - mClientButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME)); - mClientText->setText( getString("client_frame_time_warning_msg", mStringArgs) ); - find_cause = true; - } - else - { - mClientButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME)); - mClientText->setText( getString("client_frame_time_normal_msg", mStringArgs) ); - mClientCause->setText( LLStringUtil::null ); - } - - if(find_cause) - { - if(gSavedSettings.getF32("RenderFarClip") > 128) - { - mClientCause->setText( getString("client_draw_distance_cause_msg", mStringArgs) ); - } - else if(LLAppViewer::instance()->getTextureFetch()->getNumRequests() > 2) - { - mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) ); - } - else if((BYTES_TO_MEGA_BYTES(LLViewerTexture::sBoundTextureMemoryInBytes)) > LLViewerTexture::sMaxBoundTextureMemInMegaBytes) - { - mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) ); - } - else - { - mClientCause->setText( getString("client_complex_objects_cause_msg", mStringArgs) ); - } - } -} - -void LLFloaterLagMeter::determineNetwork() -{ - F32 packet_loss = LLViewerStats::getInstance()->mPacketsLostPercentStat.getMean(); - F32 ping_time = LLViewerStats::getInstance()->mSimPingStat.getMean(); - bool find_cause_loss = false; - bool find_cause_ping = false; - - // *FIXME: We can't blame a large ping time on anything in - // particular if the frame rate is low, because a low frame - // rate is a sure recipe for bad ping times right now until - // the network handlers are de-synched from the rendering. - F32 client_frame_time_ms = 1000.0f * LLViewerStats::getInstance()->mFPSStat.getMeanDuration(); - - if(packet_loss >= mNetworkPacketLossCritical) - { - mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME)); - mNetworkText->setText( getString("network_packet_loss_critical_msg", mStringArgs) ); - find_cause_loss = true; - } - else if(ping_time >= mNetworkPingCritical) - { - mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME)); - if (client_frame_time_ms < mNetworkPingCritical) - { - mNetworkText->setText( getString("network_ping_critical_msg", mStringArgs) ); - find_cause_ping = true; - } - } - else if(packet_loss >= mNetworkPacketLossWarning) - { - mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME)); - mNetworkText->setText( getString("network_packet_loss_warning_msg", mStringArgs) ); - find_cause_loss = true; - } - else if(ping_time >= mNetworkPingWarning) - { - mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME)); - if (client_frame_time_ms < mNetworkPingWarning) - { - mNetworkText->setText( getString("network_ping_warning_msg", mStringArgs) ); - find_cause_ping = true; - } - } - else - { - mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME)); - mNetworkText->setText( getString("network_performance_normal_msg", mStringArgs) ); - } - - if(find_cause_loss) - { - mNetworkCause->setText( getString("network_packet_loss_cause_msg", mStringArgs) ); - } - else if(find_cause_ping) - { - mNetworkCause->setText( getString("network_ping_cause_msg", mStringArgs) ); - } - else - { - mNetworkCause->setText( LLStringUtil::null ); - } -} - -void LLFloaterLagMeter::determineServer() -{ - F32 sim_frame_time = LLViewerStats::getInstance()->mSimFrameMsec.getCurrent(); - bool find_cause = false; - - if(sim_frame_time >= mServerFrameTimeCritical) - { - mServerButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME)); - mServerText->setText( getString("server_frame_time_critical_msg", mStringArgs) ); - find_cause = true; - } - else if(sim_frame_time >= mServerFrameTimeWarning) - { - mServerButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME)); - mServerText->setText( getString("server_frame_time_warning_msg", mStringArgs) ); - find_cause = true; - } - else - { - mServerButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME)); - mServerText->setText( getString("server_frame_time_normal_msg", mStringArgs) ); - mServerCause->setText( LLStringUtil::null ); - } - - if(find_cause) - { - if(LLViewerStats::getInstance()->mSimSimPhysicsMsec.getCurrent() > mServerSingleProcessMaxTime) - { - mServerCause->setText( getString("server_physics_cause_msg", mStringArgs) ); - } - else if(LLViewerStats::getInstance()->mSimScriptMsec.getCurrent() > mServerSingleProcessMaxTime) - { - mServerCause->setText( getString("server_scripts_cause_msg", mStringArgs) ); - } - else if(LLViewerStats::getInstance()->mSimNetMsec.getCurrent() > mServerSingleProcessMaxTime) - { - mServerCause->setText( getString("server_net_cause_msg", mStringArgs) ); - } - else if(LLViewerStats::getInstance()->mSimAgentMsec.getCurrent() > mServerSingleProcessMaxTime) - { - mServerCause->setText( getString("server_agent_cause_msg", mStringArgs) ); - } - else if(LLViewerStats::getInstance()->mSimImagesMsec.getCurrent() > mServerSingleProcessMaxTime) - { - mServerCause->setText( getString("server_images_cause_msg", mStringArgs) ); - } - else - { - mServerCause->setText( getString("server_generic_cause_msg", mStringArgs) ); - } - } -} - -void LLFloaterLagMeter::updateControls(bool shrink) -{ -// LLFloaterLagMeter * self = (LLFloaterLagMeter*)data; - - LLButton * button = getChild<LLButton>("minimize"); - S32 delta_width = mMaxWidth -mMinWidth; - LLRect r = getRect(); - - if(!shrink) - { - setTitle(getString("max_title_msg", mStringArgs) ); - // make left edge appear to expand - r.translate(-delta_width, 0); - setRect(r); - reshape(mMaxWidth, getRect().getHeight()); - - getChild<LLUICtrl>("client")->setValue(getString("client_text_msg", mStringArgs) + ":"); - getChild<LLUICtrl>("network")->setValue(getString("network_text_msg",mStringArgs) + ":"); - getChild<LLUICtrl>("server")->setValue(getString("server_text_msg", mStringArgs) + ":"); - - // usually "<<" - button->setLabel( getString("smaller_label", mStringArgs) ); - } - else - { - setTitle( getString("min_title_msg", mStringArgs) ); - // make left edge appear to collapse - r.translate(delta_width, 0); - setRect(r); - reshape(mMinWidth, getRect().getHeight()); - - getChild<LLUICtrl>("client")->setValue(getString("client_text_msg", mStringArgs) ); - getChild<LLUICtrl>("network")->setValue(getString("network_text_msg",mStringArgs) ); - getChild<LLUICtrl>("server")->setValue(getString("server_text_msg", mStringArgs) ); - - // usually ">>" - button->setLabel( getString("bigger_label", mStringArgs) ); - } - // Don't put keyboard focus on the button - button->setFocus(FALSE); - -// self->mClientText->setVisible(self->mShrunk); -// self->mClientCause->setVisible(self->mShrunk); -// self->getChildView("client_help")->setVisible( self->mShrunk); - -// self->mNetworkText->setVisible(self->mShrunk); -// self->mNetworkCause->setVisible(self->mShrunk); -// self->getChildView("network_help")->setVisible( self->mShrunk); - -// self->mServerText->setVisible(self->mShrunk); -// self->mServerCause->setVisible(self->mShrunk); -// self->getChildView("server_help")->setVisible( self->mShrunk); - -// self->mShrunk = !self->mShrunk; -} - -BOOL LLFloaterLagMeter::isShrunk() -{ - return gSavedSettings.getBOOL("LagMeterShrunk"); -} - -void LLFloaterLagMeter::onClickShrink() // toggle "LagMeterShrunk" -{ - bool shrunk = isShrunk(); - updateControls(!shrunk); - gSavedSettings.setBOOL("LagMeterShrunk", !shrunk); -} diff --git a/indra/newview/llfloaterlagmeter.h b/indra/newview/llfloaterlagmeter.h deleted file mode 100755 index eef69556014c4537a36a85c1de8dcacab1efbffa..0000000000000000000000000000000000000000 --- a/indra/newview/llfloaterlagmeter.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @file llfloaterlagmeter.h - * @brief The "Lag-o-Meter" floater used to tell users what is causing lag. - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LLFLOATERLAGMETER_H -#define LLFLOATERLAGMETER_H - -#include "llfloater.h" - -class LLTextBox; - -class LLFloaterLagMeter : public LLFloater -{ - friend class LLFloaterReg; - -public: - /*virtual*/ void draw(); - /*virtual*/ BOOL postBuild(); -private: - - LLFloaterLagMeter(const LLSD& key); - /*virtual*/ ~LLFloaterLagMeter(); - void determineClient(); - void determineNetwork(); - void determineServer(); - void updateControls(bool shrink); - BOOL isShrunk(); - - void onClickShrink(); - - bool mShrunk; - S32 mMaxWidth, mMinWidth; - - F32 mClientFrameTimeCritical; - F32 mClientFrameTimeWarning; - LLButton * mClientButton; - LLTextBox * mClientText; - LLTextBox * mClientCause; - - F32 mNetworkPacketLossCritical; - F32 mNetworkPacketLossWarning; - F32 mNetworkPingCritical; - F32 mNetworkPingWarning; - LLButton * mNetworkButton; - LLTextBox * mNetworkText; - LLTextBox * mNetworkCause; - - F32 mServerFrameTimeCritical; - F32 mServerFrameTimeWarning; - F32 mServerSingleProcessMaxTime; - LLButton * mServerButton; - LLTextBox * mServerText; - LLTextBox * mServerCause; - - LLStringUtil::format_map_t mStringArgs; -}; - -#endif diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index d79eee6be341af72a8c7942ba2f854ebf92ab611..7213064746a7fbbd88fb8b6216c49de2972745ca 100755 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -225,7 +225,7 @@ void LLFloaterLand::onOpen(const LLSD& key) refresh(); } -void LLFloaterLand::onVisibilityChange(const LLSD& visible) +void LLFloaterLand::onVisibilityChanged(const LLSD& visible) { if (!visible.asBoolean()) { @@ -255,7 +255,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed) BOOL LLFloaterLand::postBuild() { - setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChanged, this, _2)); LLTabContainer* tab = getChild<LLTabContainer>("landtab"); @@ -936,7 +936,7 @@ void LLPanelLandGeneral::onClickRelease(void*) // static void LLPanelLandGeneral::onClickReclaim(void*) { - lldebugs << "LLPanelLandGeneral::onClickReclaim()" << llendl; + LL_DEBUGS() << "LLPanelLandGeneral::onClickReclaim()" << LL_ENDL; LLViewerParcelMgr::getInstance()->reclaimParcel(); } @@ -1541,8 +1541,8 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo if (!self) { - llwarns << "Received message for nonexistent LLPanelLandObject" - << llendl; + LL_WARNS() << "Received message for nonexistent LLPanelLandObject" + << LL_ENDL; return; } @@ -1612,8 +1612,8 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo self->mOwnerList->addNameItemRow(item_params); - lldebugs << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent") - << ") owns " << object_count << " objects." << llendl; + LL_DEBUGS() << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent") + << ") owns " << object_count << " objects." << LL_ENDL; } // check for no results if (0 == self->mOwnerList->getItemCount()) @@ -1797,11 +1797,11 @@ void LLPanelLandObjects::onCommitClean(LLUICtrl *caller, void* user_data) { lop->mOtherTime = return_time; - parcel->setCleanOtherTime(lop->mOtherTime); - send_other_clean_time_message(parcel->getLocalID(), lop->mOtherTime); - } + parcel->setCleanOtherTime(lop->mOtherTime); + send_other_clean_time_message(parcel->getLocalID(), lop->mOtherTime); } } +} //--------------------------------------------------------------------------- @@ -1899,7 +1899,7 @@ BOOL LLPanelLandOptions::postBuild() } else { - llwarns << "LLUICtrlFactory::getTexturePickerByName() returned NULL for 'snapshot_ctrl'" << llendl; + LL_WARNS() << "LLUICtrlFactory::getTexturePickerByName() returned NULL for 'snapshot_ctrl'" << LL_ENDL; } diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index 95612fcb4a992bd8954f1212619c3518eea122b0..1d9bd33720ea5df87229272efa0d00ba684e11fd 100755 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -88,7 +88,7 @@ class LLFloaterLand LLFloaterLand(const LLSD& seed); virtual ~LLFloaterLand(); - void onVisibilityChange(const LLSD& visible); + void onVisibilityChanged(const LLSD& visible); protected: diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index 98e9b74278a9cd8f583af666618df2358c0aedae..cf03087afbc3d9fd7a9a23f2b73d426977f54660 100755 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -72,19 +72,19 @@ BOOL LLFloaterLandHoldings::postBuild() grant_list->sortByColumnIndex(0, TRUE); grant_list->setDoubleClickCallback(onGrantList, this); - S32 count = gAgent.mGroups.count(); + S32 count = gAgent.mGroups.size(); for(S32 i = 0; i < count; ++i) { - LLUUID id(gAgent.mGroups.get(i).mID); + LLUUID id(gAgent.mGroups.at(i).mID); LLSD element; element["id"] = id; element["columns"][0]["column"] = "group"; - element["columns"][0]["value"] = gAgent.mGroups.get(i).mName; + element["columns"][0]["value"] = gAgent.mGroups.at(i).mName; element["columns"][0]["font"] = "SANSSERIF"; LLUIString areastr = getString("area_string"); - areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.get(i).mContribution)); + areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.at(i).mContribution)); element["columns"][1]["column"] = "area"; element["columns"][1]["value"] = areastr; element["columns"][1]["font"] = "SANSSERIF"; @@ -194,7 +194,7 @@ void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**) if ( msg->getSizeFast(_PREHASH_QueryData, i, _PREHASH_ProductSKU) > 0 ) { msg->getStringFast( _PREHASH_QueryData, _PREHASH_ProductSKU, land_sku, i); - llinfos << "Land sku: " << land_sku << llendl; + LL_INFOS() << "Land sku: " << land_sku << LL_ENDL; land_type = LLProductInfoRequestManager::instance().getDescriptionForSku(land_sku); } else diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 855836af7ad620af7c76831c8229d1dfd2c7a048..12c1a68ccde5faad7d2b685f05f9a58953c9601c 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -113,8 +113,6 @@ #include "llviewernetwork.h" #include "llviewershadermgr.h" #include "glod/glod.h" -#include <boost/algorithm/string.hpp> - const S32 SLM_SUPPORTED_VERSION = 3; @@ -295,13 +293,13 @@ bool validate_face(const LLVolumeFace& face) { if(face.mPositions && !face.mPositions[v].isFinite3()) { - llwarns << "NaN position data in face found!" << llendl; + LL_WARNS() << "NaN position data in face found!" << LL_ENDL; return false; } if(face.mNormals && !face.mNormals[v].isFinite3()) { - llwarns << "NaN normal data in face found!" << llendl; + LL_WARNS() << "NaN normal data in face found!" << LL_ENDL; return false; } } @@ -310,14 +308,14 @@ bool validate_face(const LLVolumeFace& face) { if (face.mIndices[i] >= face.mNumVertices) { - llwarns << "Face has invalid index." << llendl; + LL_WARNS() << "Face has invalid index." << LL_ENDL; return false; } } if (face.mNumIndices % 3 != 0 || face.mNumIndices == 0) { - llwarns << "Face has invalid number of indices." << llendl; + LL_WARNS() << "Face has invalid number of indices." << LL_ENDL; return false; } @@ -337,7 +335,7 @@ bool validate_face(const LLVolumeFace& face) if (ll_is_degenerate(v1,v2,v3)) { - llwarns << "Degenerate face found!" << llendl; + LL_WARNS() << "Degenerate face found!" << LL_ENDL; return false; } }*/ @@ -348,7 +346,7 @@ bool validate_model(const LLModel* mdl) { if (mdl->getNumVolumeFaces() == 0) { - llwarns << "Model has no faces!" << llendl; + LL_WARNS() << "Model has no faces!" << LL_ENDL; return false; } @@ -356,13 +354,13 @@ bool validate_model(const LLModel* mdl) { if (mdl->getVolumeFace(i).mNumVertices == 0) { - llwarns << "Face has no vertices." << llendl; + LL_WARNS() << "Face has no vertices." << LL_ENDL; return false; } if (mdl->getVolumeFace(i).mNumIndices == 0) { - llwarns << "Face has no indices." << llendl; + LL_WARNS() << "Face has no indices." << LL_ENDL; return false; } @@ -381,7 +379,7 @@ BOOL stop_gloderror() if (error != GLOD_NO_ERROR) { - llwarns << "GLOD error detected, cannot generate LOD: " << std::hex << error << llendl; + LL_WARNS() << "GLOD error detected, cannot generate LOD: " << std::hex << error << LL_ENDL; return TRUE; } @@ -537,9 +535,9 @@ BOOL LLFloaterModelPreview::postBuild() if (LLConvexDecomposition::getInstance() != NULL) { - mCalculateBtn->setClickedCallback(boost::bind(&LLFloaterModelPreview::onClickCalculateBtn, this)); + mCalculateBtn->setClickedCallback(boost::bind(&LLFloaterModelPreview::onClickCalculateBtn, this)); - toggleCalculateButton(true); + toggleCalculateButton(true); } else { @@ -600,7 +598,7 @@ bool LLFloaterModelPreview::isViewOptionChecked(const LLSD& userdata) bool LLFloaterModelPreview::isViewOptionEnabled(const LLSD& userdata) { - return childIsEnabled(userdata.asString()); + return getChildView(userdata.asString())->getEnabled(); } void LLFloaterModelPreview::setViewOptionEnabled(const std::string& option, bool enabled) @@ -956,7 +954,7 @@ void LLFloaterModelPreview::onPhysicsParamCommit(LLUICtrl* ctrl, void* data) { if (LLConvexDecomposition::getInstance() == NULL) { - llinfos << "convex decomposition tool is a stub on this platform. cannot get decomp." << llendl; + LL_INFOS() << "convex decomposition tool is a stub on this platform. cannot get decomp." << LL_ENDL; return; } @@ -1004,7 +1002,7 @@ void LLFloaterModelPreview::onPhysicsStageExecute(LLUICtrl* ctrl, void* data) { if (!sInstance->mCurRequest.empty()) { - llinfos << "Decomposition request still pending." << llendl; + LL_INFOS() << "Decomposition request still pending." << LL_ENDL; return; } @@ -1055,13 +1053,13 @@ void LLFloaterModelPreview::onPhysicsUseLOD(LLUICtrl* ctrl, void* userdata) } else { - llwarns << "no iface" << llendl; + LL_WARNS() << "no iface" << LL_ENDL; return; } if (which_mode <= 0) { - llwarns << "which_mode out of range, " << which_mode << llendl; + LL_WARNS() << "which_mode out of range, " << which_mode << LL_ENDL; } S32 file_mode = iface->getItemCount() - 1; @@ -1146,8 +1144,8 @@ void LLFloaterModelPreview::initDecompControls() // protected against stub by stage_count being 0 for stub above LLConvexDecomposition::getInstance()->registerCallback(j, LLPhysicsDecomp::llcdCallback); - //llinfos << "Physics decomp stage " << stage[j].mName << " (" << j << ") parameters:" << llendl; - //llinfos << "------------------------------------" << llendl; + //LL_INFOS() << "Physics decomp stage " << stage[j].mName << " (" << j << ") parameters:" << LL_ENDL; + //LL_INFOS() << "------------------------------------" << LL_ENDL; for (S32 i = 0; i < param_count; ++i) { @@ -1161,12 +1159,12 @@ void LLFloaterModelPreview::initDecompControls() std::string type = "unknown"; - llinfos << name << " - " << description << llendl; + LL_INFOS() << name << " - " << description << LL_ENDL; if (param[i].mType == LLCDParam::LLCD_FLOAT) { mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mFloat); - //llinfos << "Type: float, Default: " << param[i].mDefault.mFloat << llendl; + //LL_INFOS() << "Type: float, Default: " << param[i].mDefault.mFloat << LL_ENDL; LLUICtrl* ctrl = getChild<LLUICtrl>(name); @@ -1216,7 +1214,7 @@ void LLFloaterModelPreview::initDecompControls() else if (param[i].mType == LLCDParam::LLCD_INTEGER) { mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mIntOrEnumValue); - //llinfos << "Type: integer, Default: " << param[i].mDefault.mIntOrEnumValue << llendl; + //LL_INFOS() << "Type: integer, Default: " << param[i].mDefault.mIntOrEnumValue << LL_ENDL; LLUICtrl* ctrl = getChild<LLUICtrl>(name); @@ -1242,7 +1240,7 @@ void LLFloaterModelPreview::initDecompControls() else if (param[i].mType == LLCDParam::LLCD_BOOLEAN) { mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mBool); - //llinfos << "Type: boolean, Default: " << (param[i].mDefault.mBool ? "True" : "False") << llendl; + //LL_INFOS() << "Type: boolean, Default: " << (param[i].mDefault.mBool ? "True" : "False") << LL_ENDL; LLCheckBoxCtrl* check_box = getChild<LLCheckBoxCtrl>(name); if (check_box) @@ -1254,16 +1252,16 @@ void LLFloaterModelPreview::initDecompControls() else if (param[i].mType == LLCDParam::LLCD_ENUM) { mDecompParams[param[i].mName] = LLSD(param[i].mDefault.mIntOrEnumValue); - //llinfos << "Type: enum, Default: " << param[i].mDefault.mIntOrEnumValue << llendl; + //LL_INFOS() << "Type: enum, Default: " << param[i].mDefault.mIntOrEnumValue << LL_ENDL; { //plug into combo box - //llinfos << "Accepted values: " << llendl; + //LL_INFOS() << "Accepted values: " << LL_ENDL; LLComboBox* combo_box = getChild<LLComboBox>(name); for (S32 k = 0; k < param[i].mDetails.mEnumValues.mNumEnums; ++k) { - //llinfos << param[i].mDetails.mEnumValues.mEnumsArray[k].mValue - // << " - " << param[i].mDetails.mEnumValues.mEnumsArray[k].mName << llendl; + //LL_INFOS() << param[i].mDetails.mEnumValues.mEnumsArray[k].mValue + // << " - " << param[i].mDetails.mEnumValues.mEnumsArray[k].mName << LL_ENDL; std::string name(param[i].mDetails.mEnumValues.mEnumsArray[k].mName); std::string localized_name; @@ -1276,9 +1274,9 @@ void LLFloaterModelPreview::initDecompControls() combo_box->setCommitCallback(onPhysicsParamCommit, (void*) ¶m[i]); } - //llinfos << "----" << llendl; + //LL_INFOS() << "----" << LL_ENDL; } - //llinfos << "-----------------------------" << llendl; + //LL_INFOS() << "-----------------------------" << LL_ENDL; } } @@ -1525,14 +1523,14 @@ bool LLModelLoader::doLoadModel() if (!dom) { - llinfos<<" Error with dae - traditionally indicates a corrupt file."<<llendl; + LL_INFOS()<<" Error with dae - traditionally indicates a corrupt file."<<LL_ENDL; setLoadState( ERROR_PARSING ); return false; } //Dom version daeString domVersion = dae.getDomVersion(); std::string sldom(domVersion); - llinfos<<"Collada Importer Version: "<<sldom<<llendl; + LL_INFOS()<<"Collada Importer Version: "<<sldom<<LL_ENDL; //Dae version domVersionType docVersion = dom->getVersion(); //0=1.4 @@ -1542,7 +1540,7 @@ bool LLModelLoader::doLoadModel() { docVersion = VERSIONTYPE_COUNT; } - llinfos<<"Dae version "<<colladaVersion[docVersion]<<llendl; + LL_INFOS()<<"Dae version "<<colladaVersion[docVersion]<<LL_ENDL; daeDatabase* db = dae.getDatabase(); @@ -1552,14 +1550,14 @@ bool LLModelLoader::doLoadModel() daeDocument* doc = dae.getDoc(mFilename); if (!doc) { - llwarns << "can't find internal doc" << llendl; + LL_WARNS() << "can't find internal doc" << LL_ENDL; return false; } daeElement* root = doc->getDomRoot(); if (!root) { - llwarns << "document has no root" << llendl; + LL_WARNS() << "document has no root" << LL_ENDL; return false; } @@ -1724,7 +1722,7 @@ bool LLModelLoader::doLoadModel() daeElement* pScene = root->getDescendant("visual_scene"); if ( !pScene ) { - llwarns<<"No visual scene - unable to parse bone offsets "<<llendl; + LL_WARNS()<<"No visual scene - unable to parse bone offsets "<<LL_ENDL; missingSkeletonOrScene = true; } else @@ -1762,7 +1760,7 @@ bool LLModelLoader::doLoadModel() //Build a joint for the resolver to work with char str[64]={0}; sprintf(str,"./%s",(*jointIt).first.c_str() ); - //llwarns<<"Joint "<< str <<llendl; + //LL_WARNS()<<"Joint "<< str <<LL_ENDL; //Setup the resolver daeSIDResolver resolver( pSkeletonRootNode, str ); @@ -1795,7 +1793,7 @@ bool LLModelLoader::doLoadModel() daeElement* pTranslateElement = getChildFromElement( pJoint, "translate" ); if ( pTranslateElement && pTranslateElement->typeID() != domTranslate::ID() ) { - llwarns<< "The found element is not a translate node" <<llendl; + LL_WARNS()<< "The found element is not a translate node" <<LL_ENDL; missingSkeletonOrScene = true; } else @@ -1819,7 +1817,7 @@ bool LLModelLoader::doLoadModel() //mention it if ( missingSkeletonOrScene ) { - llwarns<< "Partial jointmap found in asset - did you mean to just have a partial map?" << llendl; + LL_WARNS()<< "Partial jointmap found in asset - did you mean to just have a partial map?" << LL_ENDL; } }//got skeleton? } @@ -1932,7 +1930,7 @@ bool LLModelLoader::doLoadModel() if ( mJointList.find( lookingForJoint ) != mJointList.end() ) { - //llinfos<<"joint "<<lookingForJoint.c_str()<<llendl; + //LL_INFOS()<<"joint "<<lookingForJoint.c_str()<<LL_ENDL; LLMatrix4 jointTransform = mJointList[lookingForJoint]; LLJoint* pJoint = mPreview->getPreviewAvatar()->getJoint( lookingForJoint ); if ( pJoint ) @@ -1942,7 +1940,7 @@ bool LLModelLoader::doLoadModel() else { //Most likely an error in the asset. - llwarns<<"Tried to apply joint position from .dae, but it did not exist in the avatar rig." << llendl; + LL_WARNS()<<"Tried to apply joint position from .dae, but it did not exist in the avatar rig." << LL_ENDL; } } } @@ -1970,7 +1968,7 @@ bool LLModelLoader::doLoadModel() } else { - llwarns<<"Possibly misnamed/missing joint [" <<lookingForJoint.c_str()<<" ] "<<llendl; + LL_WARNS()<<"Possibly misnamed/missing joint [" <<lookingForJoint.c_str()<<" ] "<<LL_ENDL; } } @@ -1996,7 +1994,7 @@ bool LLModelLoader::doLoadModel() { if (pos.getCount() <= j+2) { - llerrs << "Invalid position array size." << llendl; + LL_ERRS() << "Invalid position array size." << LL_ENDL; } LLVector3 v(pos[j], pos[j+1], pos[j+2]); @@ -2122,7 +2120,7 @@ bool LLModelLoader::doLoadModel() if (!scene) { - llwarns << "document has no visual_scene" << llendl; + LL_WARNS() << "document has no visual_scene" << LL_ENDL; setLoadState( ERROR_PARSING ); return true; } @@ -2337,7 +2335,7 @@ void LLModelLoader::processJointToNodeMapping( domNode* pNode ) } else { - llinfos<<"Node is NULL"<<llendl; + LL_INFOS()<<"Node is NULL"<<LL_ENDL; } } @@ -2408,7 +2406,7 @@ void LLModelPreview::critiqueJointToNodeMappingFromScene( void ) } else { - llinfos<<"critiqueJointToNodeMappingFromScene is missing a: "<<name<<llendl; + LL_INFOS()<<"critiqueJointToNodeMappingFromScene is missing a: "<<name<<LL_ENDL; result = false; } } @@ -2460,7 +2458,7 @@ bool LLModelPreview::isRigLegacy( const std::vector<std::string> &jointListFromA } if ( !result ) { - llinfos<<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< llendl; + LL_INFOS()<<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< LL_ENDL; break; } } @@ -2494,7 +2492,7 @@ bool LLModelPreview::isRigSuitableForJointPositionUpload( const std::vector<std: } if ( !result ) { - llinfos<<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< llendl; + LL_INFOS()<<" Asset did not contain the joint (if you're u/l a fully rigged asset w/joint positions - it is required)." << *masterJointIt<< LL_ENDL; break; } } @@ -2542,17 +2540,17 @@ bool LLModelLoader::isNodeAJoint( domNode* pNode ) { if ( !pNode ) { - llinfos<<"Created node is NULL"<<llendl; + LL_INFOS()<<"Created node is NULL"<<LL_ENDL; return false; } if ( pNode->getName() == NULL ) { - llinfos<<"Parsed node has no name "<<llendl; + LL_INFOS()<<"Parsed node has no name "<<LL_ENDL; //Attempt to write the node id, if possible (aids in debugging the visual scene) if ( pNode->getId() ) { - llinfos<<"Parsed node ID: "<<pNode->getId()<<llendl; + LL_INFOS()<<"Parsed node ID: "<<pNode->getId()<<LL_ENDL; } return false; } @@ -2571,7 +2569,7 @@ bool LLModelPreview::verifyCount( int expected, int result ) { if ( expected != result ) { - llinfos<< "Error: (expected/got)"<<expected<<"/"<<result<<"verts"<<llendl; + LL_INFOS()<< "Error: (expected/got)"<<expected<<"/"<<result<<"verts"<<LL_ENDL; return false; } return true; @@ -2593,7 +2591,7 @@ bool LLModelPreview::verifyController( domController* pController ) if ( !pElement ) { - llinfos<<"Can't resolve skin source"<<llendl; + LL_INFOS()<<"Can't resolve skin source"<<LL_ENDL; return false; } @@ -2612,7 +2610,7 @@ bool LLModelPreview::verifyController( domController* pController ) domVertices* pVertices = pMesh->getVertices(); if ( !pVertices ) { - llinfos<<"No vertices!"<<llendl; + LL_INFOS()<<"No vertices!"<<LL_ENDL; return false; } @@ -2698,7 +2696,7 @@ void LLModelLoader::extractTranslationViaSID( daeElement* pElement, LLMatrix4& t } else { - llwarns<<"Element is nonexistent - empty/unsupported node."<<llendl; + LL_WARNS()<<"Element is nonexistent - empty/unsupported node."<<LL_ENDL; } } //----------------------------------------------------------------------------- @@ -2708,11 +2706,11 @@ void LLModelLoader::processJointNode( domNode* pNode, JointTransformMap& jointTr { if (pNode->getName() == NULL) { - llwarns << "nameless node, can't process" << llendl; + LL_WARNS() << "nameless node, can't process" << LL_ENDL; return; } - //llwarns<<"ProcessJointNode# Node:" <<pNode->getName()<<llendl; + //LL_WARNS()<<"ProcessJointNode# Node:" <<pNode->getName()<<LL_ENDL; //1. handle the incoming node - extract out translation via SID or element @@ -2740,12 +2738,12 @@ void LLModelLoader::processJointNode( domNode* pNode, JointTransformMap& jointTr daeElement* pTranslateElement = getChildFromElement( pNode, "translate" ); if ( !pTranslateElement || pTranslateElement->typeID() != domTranslate::ID() ) { - //llwarns<< "The found element is not a translate node" <<llendl; + //LL_WARNS()<< "The found element is not a translate node" <<LL_ENDL; daeSIDResolver jointResolver( pNode, "./matrix" ); domMatrix* pMatrix = daeSafeCast<domMatrix>( jointResolver.getElement() ); if ( pMatrix ) { - //llinfos<<"A matrix SID was however found!"<<llendl; + //LL_INFOS()<<"A matrix SID was however found!"<<LL_ENDL; domFloat4x4 domArray = pMatrix->getValue(); for ( int i = 0; i < 4; i++ ) { @@ -2757,7 +2755,7 @@ void LLModelLoader::processJointNode( domNode* pNode, JointTransformMap& jointTr } else { - llwarns<< "The found element is not translate or matrix node - most likely a corrupt export!" <<llendl; + LL_WARNS()<< "The found element is not translate or matrix node - most likely a corrupt export!" <<LL_ENDL; } } else @@ -2794,7 +2792,7 @@ daeElement* LLModelLoader::getChildFromElement( daeElement* pElement, std::strin { return pChildOfElement; } - llwarns<< "Could not find a child [" << name << "] for the element: \"" << pElement->getAttribute("id") << "\"" << llendl; + LL_WARNS()<< "Could not find a child [" << name << "] for the element: \"" << pElement->getAttribute("id") << "\"" << LL_ENDL; return NULL; } @@ -2876,7 +2874,7 @@ void LLModelLoader::processElement( daeElement* element, bool& badElement ) if (mTransform.determinant() < 0) { //negative scales are not supported - llinfos << "Negative scale detected, unsupported transform. domInstance_geometry: " << LLModel::getElementLabel(instance_geo) << llendl; + LL_INFOS() << "Negative scale detected, unsupported transform. domInstance_geometry: " << LLModel::getElementLabel(instance_geo) << LL_ENDL; badElement = true; } @@ -2906,7 +2904,7 @@ void LLModelLoader::processElement( daeElement* element, bool& badElement ) } else { - llinfos<<"Unable to resolve geometry URL."<<llendl; + LL_INFOS()<<"Unable to resolve geometry URL."<<LL_ENDL; badElement = true; } @@ -3541,7 +3539,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable if (lod < LLModel::LOD_IMPOSTOR || lod > LLModel::NUM_LODS - 1) { - llwarns << "Invalid level of detail: " << lod << llendl; + LL_WARNS() << "Invalid level of detail: " << lod << LL_ENDL; assert(lod >= LLModel::LOD_IMPOSTOR && lod < LLModel::NUM_LODS); return; } @@ -3564,7 +3562,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable if (mModelLoader) { - llwarns << "Incompleted model load operation pending." << llendl; + LL_WARNS() << "Incompleted model load operation pending." << LL_ENDL; return; } @@ -3596,11 +3594,11 @@ void LLModelPreview::loadModel(std::string filename, S32 lod, bool force_disable if (lod == mPreviewLOD) { - mFMP->childSetText("lod_file_" + lod_name[lod], mLODFile[lod]); + mFMP->childSetValue("lod_file_" + lod_name[lod], mLODFile[lod]); } else if (lod == LLModel::LOD_PHYSICS) { - mFMP->childSetText("physics_file", mLODFile[lod]); + mFMP->childSetValue("physics_file", mLODFile[lod]); } mFMP->openFloater(); @@ -3615,7 +3613,7 @@ void LLModelPreview::setPhysicsFromLOD(S32 lod) mModel[LLModel::LOD_PHYSICS] = mModel[lod]; mScene[LLModel::LOD_PHYSICS] = mScene[lod]; mLODFile[LLModel::LOD_PHYSICS].clear(); - mFMP->childSetText("physics_file", mLODFile[LLModel::LOD_PHYSICS]); + mFMP->childSetValue("physics_file", mLODFile[LLModel::LOD_PHYSICS]); mVertexBuffer[LLModel::LOD_PHYSICS].clear(); rebuildUploadData(); refresh(); @@ -3874,7 +3872,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim // Allow LoD from -1 to LLModel::LOD_PHYSICS if (which_lod < -1 || which_lod > LLModel::NUM_LODS - 1) { - llwarns << "Invalid level of detail: " << which_lod << llendl; + LL_WARNS() << "Invalid level of detail: " << which_lod << LL_ENDL; assert(which_lod >= -1 && which_lod < LLModel::NUM_LODS); return; } @@ -4162,7 +4160,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim if (!validate_face(target_model->getVolumeFace(names[i]))) { - llerrs << "Invalid face generated during LOD generation." << llendl; + LL_ERRS() << "Invalid face generated during LOD generation." << LL_ENDL; } } @@ -4177,7 +4175,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim if (!validate_model(target_model)) { - llerrs << "Invalid model generated when creating LODs" << llendl; + LL_ERRS() << "Invalid model generated when creating LODs" << LL_ENDL; } delete [] sizes; @@ -4331,8 +4329,8 @@ void LLModelPreview::updateStatusMessages() if (total_tris[lod] > 0) { - mFMP->childSetText(lod_triangles_name[lod], llformat("%d", total_tris[lod])); - mFMP->childSetText(lod_vertices_name[lod], llformat("%d", total_verts[lod])); + mFMP->childSetValue(lod_triangles_name[lod], llformat("%d", total_tris[lod])); + mFMP->childSetValue(lod_vertices_name[lod], llformat("%d", total_verts[lod])); } else { @@ -4353,8 +4351,8 @@ void LLModelPreview::updateStatusMessages() } } - mFMP->childSetText(lod_triangles_name[lod], mesh_status_na); - mFMP->childSetText(lod_vertices_name[lod], mesh_status_na); + mFMP->childSetValue(lod_triangles_name[lod], mesh_status_na); + mFMP->childSetValue(lod_vertices_name[lod], mesh_status_na); } const U32 lod_high = LLModel::LOD_HIGH; @@ -4403,7 +4401,7 @@ void LLModelPreview::updateStatusMessages() if (lod == mPreviewLOD) { - mFMP->childSetText("lod_status_message_text", mFMP->getString(message)); + mFMP->childSetValue("lod_status_message_text", mFMP->getString(message)); icon = mFMP->getChild<LLIconCtrl>("lod_status_message_icon"); icon->setImage(img); } @@ -4622,7 +4620,7 @@ void LLModelPreview::updateLodControls(S32 lod) { if (lod < LLModel::LOD_IMPOSTOR || lod > LLModel::LOD_HIGH) { - llwarns << "Invalid level of detail: " << lod << llendl; + LL_WARNS() << "Invalid level of detail: " << lod << LL_ENDL; assert(lod >= LLModel::LOD_IMPOSTOR && lod <= LLModel::LOD_HIGH); return; } @@ -4654,12 +4652,12 @@ void LLModelPreview::updateLodControls(S32 lod) fmp->mLODMode[lod] = 0; for (U32 i = 0; i < num_file_controls; ++i) { - mFMP->childShow(file_controls[i] + lod_name[lod]); + mFMP->childSetVisible(file_controls[i] + lod_name[lod], true); } for (U32 i = 0; i < num_lod_controls; ++i) { - mFMP->childHide(lod_controls[i] + lod_name[lod]); + mFMP->childSetVisible(lod_controls[i] + lod_name[lod], false); } } else if (lod_mode == USE_LOD_ABOVE) // use LoD above @@ -4667,12 +4665,12 @@ void LLModelPreview::updateLodControls(S32 lod) fmp->mLODMode[lod] = 2; for (U32 i = 0; i < num_file_controls; ++i) { - mFMP->childHide(file_controls[i] + lod_name[lod]); + mFMP->childSetVisible(file_controls[i] + lod_name[lod], false); } for (U32 i = 0; i < num_lod_controls; ++i) { - mFMP->childHide(lod_controls[i] + lod_name[lod]); + mFMP->childSetVisible(lod_controls[i] + lod_name[lod], false); } if (lod < LLModel::LOD_HIGH) @@ -4697,12 +4695,12 @@ void LLModelPreview::updateLodControls(S32 lod) for (U32 i = 0; i < num_file_controls; ++i) { - mFMP->childHide(file_controls[i] + lod_name[lod]); + mFMP->getChildView(file_controls[i] + lod_name[lod])->setVisible(false); } for (U32 i = 0; i < num_lod_controls; ++i) { - mFMP->childShow(lod_controls[i] + lod_name[lod]); + mFMP->getChildView(lod_controls[i] + lod_name[lod])->setVisible(true); } @@ -4935,7 +4933,7 @@ void LLModelPreview::createPreviewAvatar( void ) } else { - llinfos<<"Failed to create preview avatar for upload model window"<<llendl; + LL_INFOS()<<"Failed to create preview avatar for upload model window"<<LL_ENDL; } } @@ -5653,7 +5651,7 @@ void LLModelPreview::setPreviewLOD(S32 lod) LLComboBox* combo_box = mFMP->getChild<LLComboBox>("preview_lod_combo"); combo_box->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order - mFMP->childSetText("lod_file_" + lod_name[mPreviewLOD], mLODFile[mPreviewLOD]); + mFMP->childSetValue("lod_file_" + lod_name[mPreviewLOD], mLODFile[mPreviewLOD]); LLComboBox* combo_box2 = mFMP->getChild<LLComboBox>("preview_lod_combo2"); combo_box2->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order @@ -5865,7 +5863,7 @@ void LLFloaterModelPreview::handleModelPhysicsFeeReceived() void LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason) { - llwarns << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << llendl; + LL_WARNS() << "LLFloaterModelPreview::setModelPhysicsFeeErrorStatus(" << status << " : " << reason << ")" << LL_ENDL; doOnIdleOneTime(boost::bind(&LLFloaterModelPreview::toggleCalculateButton, this, true)); } @@ -5941,7 +5939,7 @@ void LLFloaterModelPreview::onPermissionsReceived(const LLSD& result) void LLFloaterModelPreview::setPermissonsErrorStatus(U32 status, const std::string& reason) { - llwarns << "LLFloaterModelPreview::setPermissonsErrorStatus(" << status << " : " << reason << ")" << llendl; + LL_WARNS() << "LLFloaterModelPreview::setPermissonsErrorStatus(" << status << " : " << reason << ")" << LL_ENDL; LLNotificationsUtil::add("MeshUploadPermError"); } diff --git a/indra/newview/llfloatermodeluploadbase.cpp b/indra/newview/llfloatermodeluploadbase.cpp index 6d3800bfa46f26a59bf2a12e941ab3796a0f01c3..2ad2d32652a271d95dd1c699ce1844b9fa8cb54d 100755 --- a/indra/newview/llfloatermodeluploadbase.cpp +++ b/indra/newview/llfloatermodeluploadbase.cpp @@ -44,7 +44,7 @@ void LLFloaterModelUploadBase::requestAgentUploadPermissions() if (!url.empty()) { - llinfos<< typeid(*this).name() <<"::requestAgentUploadPermissions() requesting for upload model permissions from: "<< url <<llendl; + LL_INFOS()<< typeid(*this).name() <<"::requestAgentUploadPermissions() requesting for upload model permissions from: "<< url <<LL_ENDL; LLHTTPClient::get(url, new LLUploadModelPremissionsResponder(getPermObserverHandle())); } else diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp index 4f35c325a872e0d5bf4b94e6c12612743ca15a05..c21e4ff7e8bbc125a64afe1a4e3b9d691772a7c7 100755 --- a/indra/newview/llfloaternotificationsconsole.cpp +++ b/indra/newview/llfloaternotificationsconsole.cpp @@ -257,7 +257,7 @@ void LLFloaterNotification::respond() LLComboBox* responses_combo = getChild<LLComboBox>("response"); LLCtrlListInterface* response_list = responses_combo->getListInterface(); const std::string& trigger = response_list->getSelectedValue().asString(); - //llinfos << trigger << llendl; + //LL_INFOS() << trigger << LL_ENDL; LLSD response = mNote->getResponseTemplate(); response[trigger] = true; diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp index 0862cd2897e0a7abe4ff1b8232c028b9ad4cacdb..94bf8974bbb7cbd48812455b5414485890e78f4a 100755 --- a/indra/newview/llfloaterobjectweights.cpp +++ b/indra/newview/llfloaterobjectweights.cpp @@ -207,7 +207,7 @@ void LLFloaterObjectWeights::refresh() } else { - llwarns << "Failed to get region capabilities" << llendl; + LL_WARNS() << "Failed to get region capabilities" << LL_ENDL; } } } diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp index de96f75602bd06177252e40acd5033bed95f763c..e5efca1102748dfdbb601a50f51b129de92c6ff1 100755 --- a/indra/newview/llfloateroutbox.cpp +++ b/indra/newview/llfloateroutbox.cpp @@ -235,7 +235,7 @@ void LLFloaterOutbox::setupOutbox() if (outbox_id.isNull()) { // We should never get there unless the inventory fails badly - llerrs << "Inventory problem: failure to create the outbox for a merchant!" << llendl; + LL_ERRS() << "Inventory problem: failure to create the outbox for a merchant!" << LL_ENDL; return; } @@ -245,7 +245,7 @@ void LLFloaterOutbox::setupOutbox() if (outbox_id == mOutboxId) { - llwarns << "Inventory warning: Merchant outbox already set" << llendl; + LL_WARNS() << "Inventory warning: Merchant outbox already set" << LL_ENDL; return; } mOutboxId = outbox_id; @@ -319,7 +319,7 @@ void LLFloaterOutbox::updateFolderCount() { if (mOutboxInventoryPanel.get() && mOutboxId.notNull()) { - S32 item_count = 0; + U32 item_count = 0; if (mOutboxId.notNull()) { @@ -327,7 +327,7 @@ void LLFloaterOutbox::updateFolderCount() LLInventoryModel::item_array_t * items; gInventory.getDirectDescendentsOf(mOutboxId, cats, items); - item_count = cats->count() + items->count(); + item_count = cats->size() + items->size(); } mOutboxItemCount = item_count; diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 161259d0495ced768d98f0b15cf01bf420c8623d..ccf3e723fd221cb336862701050449d8c4fe64f3 100755 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -207,7 +207,7 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) if ( LLPathingLib::getInstance() == NULL ) { setConsoleState(kConsoleStateLibraryNotImplemented); - llwarns <<"Errror: cannot find pathing library implementation."<<llendl; + LL_WARNS() <<"Errror: cannot find pathing library implementation."<<LL_ENDL; } else { diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index b50a2e6f853b2fb4d172f35eafdc3caff84bd0d6..c6b92d20bb936ac424553389f0446a5dd5928f29 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -37,7 +37,6 @@ #include "message.h" #include "llfloaterautoreplacesettings.h" #include "llagent.h" -#include "llavatarconstants.h" #include "llcheckboxctrl.h" #include "llcolorswatch.h" #include "llcombobox.h" @@ -113,6 +112,10 @@ const F32 MAX_USER_FAR_CLIP = 512.f; const F32 MIN_USER_FAR_CLIP = 64.f; const F32 BANDWIDTH_UPDATER_TIMEOUT = 0.5f; +char const* const VISIBILITY_DEFAULT = "default"; +char const* const VISIBILITY_HIDDEN = "hidden"; +char const* const VISIBILITY_VISIBLE = "visible"; +char const* const VISIBILITY_INVISIBLE = "invisible"; //control value for middle mouse as talk2push button const static std::string MIDDLE_MOUSE_CV = "MiddleMouse"; @@ -832,7 +835,7 @@ void LLFloaterPreference::onBtnOK() else { // Show beep, pop up dialog, etc. - llinfos << "Can't close preferences!" << llendl; + LL_INFOS() << "Can't close preferences!" << LL_ENDL; } LLPanelLogin::updateLocationSelectorsVisibility(); diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 3f00ba39c72550a2b2c138ae68cecbabc0f68dc9..a3bf99f054292ce7bb5681638e5e8f31660914cb 100755 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -561,7 +561,7 @@ void LLFloaterProperties::onClickOwner() // static void LLFloaterProperties::onCommitName() { - //llinfos << "LLFloaterProperties::onCommitName()" << llendl; + //LL_INFOS() << "LLFloaterProperties::onCommitName()" << LL_ENDL; LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) { @@ -597,7 +597,7 @@ void LLFloaterProperties::onCommitName() void LLFloaterProperties::onCommitDescription() { - //llinfos << "LLFloaterProperties::onCommitDescription()" << llendl; + //LL_INFOS() << "LLFloaterProperties::onCommitDescription()" << LL_ENDL; LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) return; @@ -635,7 +635,7 @@ void LLFloaterProperties::onCommitDescription() // static void LLFloaterProperties::onCommitPermissions() { - //llinfos << "LLFloaterProperties::onCommitPermissions()" << llendl; + //LL_INFOS() << "LLFloaterProperties::onCommitPermissions()" << LL_ENDL; LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); if(!item) return; LLPermissions perm(item->getPermissions()); @@ -732,14 +732,14 @@ void LLFloaterProperties::onCommitPermissions() // static void LLFloaterProperties::onCommitSaleInfo() { - //llinfos << "LLFloaterProperties::onCommitSaleInfo()" << llendl; + //LL_INFOS() << "LLFloaterProperties::onCommitSaleInfo()" << LL_ENDL; updateSaleInfo(); } // static void LLFloaterProperties::onCommitSaleType() { - //llinfos << "LLFloaterProperties::onCommitSaleType()" << llendl; + //LL_INFOS() << "LLFloaterProperties::onCommitSaleType()" << LL_ENDL; updateSaleInfo(); } diff --git a/indra/newview/llfloaterregiondebugconsole.cpp b/indra/newview/llfloaterregiondebugconsole.cpp index 3a7ca17b73d34d3d71c34bcf090c2e57b87f52d9..bed34abee8b0e4d7f958b6c28d9af09560420f0d 100755 --- a/indra/newview/llfloaterregiondebugconsole.cpp +++ b/indra/newview/llfloaterregiondebugconsole.cpp @@ -123,8 +123,8 @@ namespace const LLSD& context, const LLSD& input) const { - llinfos << "Received response from the debug console: " - << input << llendl; + LL_INFOS() << "Received response from the debug console: " + << input << LL_ENDL; sConsoleReplySignal(input["body"].asString()); } }; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index cc0f246d1b920bbefcb51aa06fb11b8402a4fd5a..d67089ff85e12fc8b29b22648fe079b3e7f5abe0 100755 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -281,7 +281,7 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**) LLDispatcher::unpackMessage(msg, request, invoice, strings); if(invoice != getLastInvoice()) { - llwarns << "Mismatched Estate message: " << request << llendl; + LL_WARNS() << "Mismatched Estate message: " << request << LL_ENDL; return; } @@ -560,7 +560,7 @@ void LLPanelRegionInfo::sendEstateOwnerMessage( const LLUUID& invoice, const strings_t& strings) { - llinfos << "Sending estate request '" << request << "'" << llendl; + LL_INFOS() << "Sending estate request '" << request << "'" << LL_ENDL; msg->newMessage("EstateOwnerMessage"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -656,7 +656,7 @@ BOOL LLPanelRegionGeneralInfo::postBuild() void LLPanelRegionGeneralInfo::onClickKick() { - llinfos << "LLPanelRegionGeneralInfo::onClickKick" << llendl; + LL_INFOS() << "LLPanelRegionGeneralInfo::onClickKick" << LL_ENDL; // this depends on the grandparent view being a floater // in order to set up floater dependency @@ -693,7 +693,7 @@ void LLPanelRegionGeneralInfo::onKickCommit(const uuid_vec_t& ids) // static void LLPanelRegionGeneralInfo::onClickKickAll(void* userdata) { - llinfos << "LLPanelRegionGeneralInfo::onClickKickAll" << llendl; + LL_INFOS() << "LLPanelRegionGeneralInfo::onClickKickAll" << LL_ENDL; LLNotificationsUtil::add("KickUsersFromRegion", LLSD(), LLSD(), @@ -721,7 +721,7 @@ bool LLPanelRegionGeneralInfo::onKickAllCommit(const LLSD& notification, const L // static void LLPanelRegionGeneralInfo::onClickMessage(void* userdata) { - llinfos << "LLPanelRegionGeneralInfo::onClickMessage" << llendl; + LL_INFOS() << "LLPanelRegionGeneralInfo::onClickMessage" << LL_ENDL; LLNotificationsUtil::add("MessageRegion", LLSD(), LLSD(), @@ -736,7 +736,7 @@ bool LLPanelRegionGeneralInfo::onMessageCommit(const LLSD& notification, const L std::string text = response["message"].asString(); if (text.empty()) return false; - llinfos << "Message to everyone: " << text << llendl; + LL_INFOS() << "Message to everyone: " << text << LL_ENDL; strings_t strings; // [0] grid_x, unused here // [1] grid_y, unused here @@ -763,8 +763,8 @@ class ConsoleRequestResponder : public LLHTTPClient::Responder /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "ConsoleRequestResponder error requesting mesh_rez_enabled [status:" - << status << "]: " << content << llendl; + LL_WARNS() << "ConsoleRequestResponder error requesting mesh_rez_enabled [status:" + << status << "]: " << content << LL_ENDL; } }; @@ -776,8 +776,8 @@ class ConsoleUpdateResponder : public LLHTTPClient::Responder /* virtual */ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "ConsoleRequestResponder error updating mesh enabled region setting [status:" - << status << "]: " << content << llendl; + LL_WARNS() << "ConsoleRequestResponder error updating mesh enabled region setting [status:" + << status << "]: " << content << LL_ENDL; } }; @@ -809,7 +809,7 @@ void LLFloaterRegionInfo::requestMeshRezInfo() // strings[9] = 'Y' - block parcel search, 'N' - allow BOOL LLPanelRegionGeneralInfo::sendUpdate() { - llinfos << "LLPanelRegionGeneralInfo::sendUpdate()" << llendl; + LL_INFOS() << "LLPanelRegionGeneralInfo::sendUpdate()" << LL_ENDL; // First try using a Cap. If that fails use the old method. LLSD body; @@ -924,7 +924,7 @@ bool LLPanelRegionDebugInfo::refreshFromRegion(LLViewerRegion* region) // virtual BOOL LLPanelRegionDebugInfo::sendUpdate() { - llinfos << "LLPanelRegionDebugInfo::sendUpdate" << llendl; + LL_INFOS() << "LLPanelRegionDebugInfo::sendUpdate" << LL_ENDL; strings_t strings; std::string buffer; @@ -1101,7 +1101,7 @@ BOOL LLPanelRegionTerrainInfo::validateTextureSizes() S32 width = img->getFullWidth(); S32 height = img->getFullHeight(); - //llinfos << "texture detail " << i << " is " << width << "x" << height << "x" << components << llendl; + //LL_INFOS() << "texture detail " << i << " is " << width << "x" << height << "x" << components << LL_ENDL; if (components != 3) { @@ -1187,8 +1187,8 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) texture_ctrl = getChild<LLTextureCtrl>(buffer); if(texture_ctrl) { - lldebugs << "Detail Texture " << i << ": " - << compp->getDetailTextureID(i) << llendl; + LL_DEBUGS() << "Detail Texture " << i << ": " + << compp->getDetailTextureID(i) << LL_ENDL; LLUUID tmp_id(compp->getDetailTextureID(i)); texture_ctrl->setImageAssetID(tmp_id); } @@ -1204,7 +1204,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) } else { - lldebugs << "no region set" << llendl; + LL_DEBUGS() << "no region set" << LL_ENDL; getChild<LLUICtrl>("region_text")->setValue(LLSD("")); } @@ -1219,7 +1219,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) // virtual BOOL LLPanelRegionTerrainInfo::sendUpdate() { - llinfos << "LLPanelRegionTerrainInfo::sendUpdate" << llendl; + LL_INFOS() << "LLPanelRegionTerrainInfo::sendUpdate" << LL_ENDL; std::string buffer; strings_t strings; LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); @@ -1288,7 +1288,7 @@ void LLPanelRegionTerrainInfo::onClickDownloadRaw(void* data) LLFilePicker& picker = LLFilePicker::instance(); if (!picker.getSaveFile(LLFilePicker::FFSAVE_RAW, "terrain.raw")) { - llwarns << "No file" << llendl; + LL_WARNS() << "No file" << LL_ENDL; return; } std::string filepath = picker.getFirstFile(); @@ -1308,7 +1308,7 @@ void LLPanelRegionTerrainInfo::onClickUploadRaw(void* data) LLFilePicker& picker = LLFilePicker::instance(); if (!picker.getOpenFile(LLFilePicker::FFLOAD_RAW)) { - llwarns << "No file" << llendl; + LL_WARNS() << "No file" << LL_ENDL; return; } std::string filepath = picker.getFirstFile(); @@ -2058,7 +2058,7 @@ void LLPanelEstateInfo::updateChild(LLUICtrl* child_ctrl) bool LLPanelEstateInfo::estateUpdate(LLMessageSystem* msg) { - llinfos << "LLPanelEstateInfo::estateUpdate()" << llendl; + LL_INFOS() << "LLPanelEstateInfo::estateUpdate()" << LL_ENDL; return false; } @@ -2158,7 +2158,7 @@ void LLPanelEstateInfo::refreshFromEstate() BOOL LLPanelEstateInfo::sendUpdate() { - llinfos << "LLPanelEsateInfo::sendUpdate()" << llendl; + LL_INFOS() << "LLPanelEsateInfo::sendUpdate()" << LL_ENDL; LLNotification::Params params("ChangeLindenEstate"); params.functor.function(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2)); @@ -2253,7 +2253,7 @@ class LLEstateChangeInfoResponder : public LLHTTPClient::Responder // if we get a normal response, handle it here virtual void result(const LLSD& content) { - LL_INFOS("Windlight") << "Successfully committed estate info" << llendl; + LL_INFOS("Windlight") << "Successfully committed estate info" << LL_ENDL; // refresh the panel from the database LLPanelEstateInfo* panel = dynamic_cast<LLPanelEstateInfo*>(mpPanel.get()); @@ -2264,8 +2264,8 @@ class LLEstateChangeInfoResponder : public LLHTTPClient::Responder // if we get an error response virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llinfos << "LLEstateChangeInfoResponder::error [status:" - << status << "]: " << content << llendl; + LL_INFOS() << "LLEstateChangeInfoResponder::error [status:" + << status << "]: " << content << LL_ENDL; } private: LLHandle<LLPanel> mpPanel; @@ -2300,7 +2300,7 @@ void LLPanelEstateInfo::clearAccessLists() // static void LLPanelEstateInfo::onClickMessageEstate(void* userdata) { - llinfos << "LLPanelEstateInfo::onClickMessageEstate" << llendl; + LL_INFOS() << "LLPanelEstateInfo::onClickMessageEstate" << LL_ENDL; LLNotificationsUtil::add("MessageEstate", LLSD(), LLSD(), boost::bind(&LLPanelEstateInfo::onMessageCommit, (LLPanelEstateInfo*)userdata, _1, _2)); } @@ -2310,7 +2310,7 @@ bool LLPanelEstateInfo::onMessageCommit(const LLSD& notification, const LLSD& re std::string text = response["message"].asString(); if(option != 0) return false; if(text.empty()) return false; - llinfos << "Message to everyone: " << text << llendl; + LL_INFOS() << "Message to everyone: " << text << LL_ENDL; strings_t strings; //integers_t integers; std::string name; @@ -2387,7 +2387,7 @@ bool LLPanelEstateCovenant::refreshFromRegion(LLViewerRegion* region) // virtual bool LLPanelEstateCovenant::estateUpdate(LLMessageSystem* msg) { - llinfos << "LLPanelEstateCovenant::estateUpdate()" << llendl; + LL_INFOS() << "LLPanelEstateCovenant::estateUpdate()" << LL_ENDL; return true; } @@ -2521,7 +2521,7 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { - llinfos << "LLPanelEstateCovenant::onLoadComplete()" << llendl; + LL_INFOS() << "LLPanelEstateCovenant::onLoadComplete()" << LL_ENDL; LLPanelEstateCovenant* panelp = (LLPanelEstateCovenant*)user_data; if( panelp ) { @@ -2540,7 +2540,7 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, { if( !panelp->mEditor->importBuffer( &buffer[0], file_length+1 ) ) { - llwarns << "Problem importing estate covenant." << llendl; + LL_WARNS() << "Problem importing estate covenant." << LL_ENDL; LLNotificationsUtil::add("ProblemImportingEstateCovenant"); } else @@ -2556,8 +2556,6 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, } else { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { @@ -2572,7 +2570,7 @@ void LLPanelEstateCovenant::onLoadComplete(LLVFS *vfs, LLNotificationsUtil::add("UnableToLoadNotecardAsset"); } - llwarns << "Problem loading notecard: " << status << llendl; + LL_WARNS() << "Problem loading notecard: " << status << LL_ENDL; } panelp->mAssetStatus = ASSET_LOADED; panelp->setCovenantID(asset_uuid); @@ -2694,7 +2692,7 @@ bool LLDispatchEstateUpdateInfo::operator()( const LLUUID& invoice, const sparam_t& strings) { - lldebugs << "Received estate update" << llendl; + LL_DEBUGS() << "Received estate update" << LL_ENDL; // Update estate info model. // This will call LLPanelEstateInfo::refreshFromEstate(). @@ -2736,22 +2734,22 @@ bool LLDispatchSetEstateAccess::operator()( if (num_allowed_agents > 0 && !(access_flags & ESTATE_ACCESS_ALLOWED_AGENTS)) { - llwarns << "non-zero count for allowed agents, but no corresponding flag" << llendl; + LL_WARNS() << "non-zero count for allowed agents, but no corresponding flag" << LL_ENDL; } if (num_allowed_groups > 0 && !(access_flags & ESTATE_ACCESS_ALLOWED_GROUPS)) { - llwarns << "non-zero count for allowed groups, but no corresponding flag" << llendl; + LL_WARNS() << "non-zero count for allowed groups, but no corresponding flag" << LL_ENDL; } if (num_banned_agents > 0 && !(access_flags & ESTATE_ACCESS_BANNED_AGENTS)) { - llwarns << "non-zero count for banned agents, but no corresponding flag" << llendl; + LL_WARNS() << "non-zero count for banned agents, but no corresponding flag" << LL_ENDL; } if (num_estate_managers > 0 && !(access_flags & ESTATE_ACCESS_MANAGERS)) { - llwarns << "non-zero count for managers, but no corresponding flag" << llendl; + LL_WARNS() << "non-zero count for managers, but no corresponding flag" << LL_ENDL; } // grab the UUID's out of the string fields @@ -2934,7 +2932,7 @@ void LLPanelEnvironmentInfo::onOpen(const LLSD& key) } // virtual -void LLPanelEnvironmentInfo::handleVisibilityChange(BOOL new_visibility) +void LLPanelEnvironmentInfo::onVisibilityChange(BOOL new_visibility) { // If hiding (user switched to another tab or closed the floater), // display user's preferred environment. @@ -3059,7 +3057,7 @@ void LLPanelEnvironmentInfo::fixEstateSun() LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); if (estate_info.getUseFixedSun()) { - llinfos << "Switching estate to global sun" << llendl; + LL_INFOS() << "Switching estate to global sun" << LL_ENDL; estate_info.setUseFixedSun(false); estate_info.sendEstateInfo(); } @@ -3200,7 +3198,7 @@ bool LLPanelEnvironmentInfo::getSelectedWaterParams(LLSD& water_params) LLWaterParamSet param_set; if (!LLWaterParamManager::instance().getParamSet(water_key.name, param_set)) { - llwarns << "Error getting water preset: " << water_key.name << llendl; + LL_WARNS() << "Error getting water preset: " << water_key.name << LL_ENDL; return false; } @@ -3219,7 +3217,7 @@ bool LLPanelEnvironmentInfo::getSelectedSkyParams(LLSD& sky_params, std::string& LLWLParamSet param_set; if (!LLWLParamManager::instance().getParamSet(preset, param_set)) { - llwarns << "Error getting sky params: " << preset.toLLSD() << llendl; + LL_WARNS() << "Error getting sky params: " << preset.toLLSD() << LL_ENDL; return false; } @@ -3244,7 +3242,7 @@ bool LLPanelEnvironmentInfo::getSelectedDayCycleParams(LLSD& day_cycle, LLSD& sk { if (!LLDayCycleManager::instance().getPreset(dc.name, day_cycle)) { - llwarns << "Error getting day cycle " << dc.name << llendl; + LL_WARNS() << "Error getting day cycle " << dc.name << LL_ENDL; return false; } @@ -3411,7 +3409,7 @@ void LLPanelEnvironmentInfo::onBtnApply() new_region_settings.saveParams(day_cycle, sky_map, water_params, 0.0f); if (!LLEnvManagerNew::instance().sendRegionSettings(new_region_settings)) { - llwarns << "Error applying region environment settings" << llendl; + LL_WARNS() << "Error applying region environment settings" << LL_ENDL; return; } diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index bf174f37006076fb41b5c9c8020788d2495019e8..5bc4273d5f81ca68f83f13d8689ed2f7119e10c6 100755 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -403,7 +403,7 @@ class LLPanelEnvironmentInfo : public LLPanelRegionInfo /*virtual*/ void onOpen(const LLSD& key); // LLView - /*virtual*/ void handleVisibilityChange(BOOL new_visibility); + /*virtual*/ void onVisibilityChange(BOOL new_visibility); // LLPanelRegionInfo /*virtual*/ bool refreshFromRegion(LLViewerRegion* region); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 35b63c54803fde1765942cd98b507c7cf9962daa..825159703cf4ff870d093b9f3df78fdc53dddb68 100755 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -460,7 +460,7 @@ void LLFloaterReporter::showFromMenu(EReportType report_type) { if (COMPLAINT_REPORT != report_type) { - llwarns << "Unknown LLViewerReporter type : " << report_type << llendl; + LL_WARNS() << "Unknown LLViewerReporter type : " << report_type << LL_ENDL; return; } @@ -746,7 +746,7 @@ void LLFloaterReporter::takeScreenshot() LLPointer<LLImageRaw> raw = new LLImageRaw; if( !gViewerWindow->rawSnapshot(raw, IMAGE_WIDTH, IMAGE_HEIGHT, TRUE, FALSE, TRUE, FALSE)) { - llwarns << "Unable to take screenshot" << llendl; + LL_WARNS() << "Unable to take screenshot" << LL_ENDL; return; } LLPointer<LLImageJ2C> upload_data = LLViewerTextureList::convertToUploadFile(raw); @@ -765,7 +765,7 @@ void LLFloaterReporter::takeScreenshot() } else { - llwarns << "Unknown LLFloaterReporter type" << llendl; + LL_WARNS() << "Unknown LLFloaterReporter type" << LL_ENDL; } mResourceDatap->mAssetInfo.mCreatorID = gAgentID; mResourceDatap->mAssetInfo.setName("screenshot_name"); @@ -784,7 +784,7 @@ void LLFloaterReporter::takeScreenshot() image_in_list->createGLTexture(0, raw, 0, TRUE, LLGLTexture::OTHER); // the texture picker then uses that texture - LLTexturePicker* texture = getChild<LLTextureCtrl>("screenshot"); + LLTextureCtrl* texture = getChild<LLTextureCtrl>("screenshot"); if (texture) { texture->setImageAssetID(mResourceDatap->mAssetInfo.mUuid); @@ -796,11 +796,11 @@ void LLFloaterReporter::takeScreenshot() void LLFloaterReporter::uploadImage() { - llinfos << "*** Uploading: " << llendl; - llinfos << "Type: " << LLAssetType::lookup(mResourceDatap->mAssetInfo.mType) << llendl; - llinfos << "UUID: " << mResourceDatap->mAssetInfo.mUuid << llendl; - llinfos << "Name: " << mResourceDatap->mAssetInfo.getName() << llendl; - llinfos << "Desc: " << mResourceDatap->mAssetInfo.getDescription() << llendl; + LL_INFOS() << "*** Uploading: " << LL_ENDL; + LL_INFOS() << "Type: " << LLAssetType::lookup(mResourceDatap->mAssetInfo.mType) << LL_ENDL; + LL_INFOS() << "UUID: " << mResourceDatap->mAssetInfo.mUuid << LL_ENDL; + LL_INFOS() << "Name: " << mResourceDatap->mAssetInfo.getName() << LL_ENDL; + LL_INFOS() << "Desc: " << mResourceDatap->mAssetInfo.getDescription() << LL_ENDL; gAssetStorage->storeAssetData(mResourceDatap->mAssetInfo.mTransactionID, mResourceDatap->mAssetInfo.mType, @@ -824,20 +824,20 @@ void LLFloaterReporter::uploadDoneCallback(const LLUUID &uuid, void *user_data, std::string err_msg("There was a problem uploading a report screenshot"); err_msg += " due to the following reason: " + args["REASON"].asString(); - llwarns << err_msg << llendl; + LL_WARNS() << err_msg << LL_ENDL; return; } if (data->mPreferredLocation != LLResourceData::INVALID_LOCATION) { - llwarns << "Unknown report type : " << data->mPreferredLocation << llendl; + LL_WARNS() << "Unknown report type : " << data->mPreferredLocation << LL_ENDL; } LLFloaterReporter *self = LLFloaterReg::findTypedInstance<LLFloaterReporter>("reporter"); if (self) { self->mScreenID = uuid; - llinfos << "Got screen shot " << uuid << llendl; + LL_INFOS() << "Got screen shot " << uuid << LL_ENDL; self->sendReportViaLegacy(self->gatherReport()); self->closeFloater(); } diff --git a/indra/newview/llfloatersceneloadstats.cpp b/indra/newview/llfloatersceneloadstats.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8aa93eae96c0f6daa4b076474fed44ff77018552 --- /dev/null +++ b/indra/newview/llfloatersceneloadstats.cpp @@ -0,0 +1,40 @@ +/** + * @file llfloatersceneloadstats.cpp + * @author Richard Nelson + * @brief debug floater for measuring various scene load statistics + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2013, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloatersceneloadstats.h" + + +LLFloaterSceneLoadStats::LLFloaterSceneLoadStats( const LLSD& key ) +: LLFloater(key) +{} + +BOOL LLFloaterSceneLoadStats::postBuild() +{ + return TRUE; +} diff --git a/indra/llcommon/lloptioninterface.h b/indra/newview/llfloatersceneloadstats.h old mode 100755 new mode 100644 similarity index 64% rename from indra/llcommon/lloptioninterface.h rename to indra/newview/llfloatersceneloadstats.h index 93b465db32134eba19bb87079c4a62d0c13fb4e7..aa414bf5448165447226d7318f5cfa22184fd829 --- a/indra/llcommon/lloptioninterface.h +++ b/indra/newview/llfloatersceneloadstats.h @@ -1,10 +1,10 @@ /** - * @file lloptioninterface.h - * @brief + * @file llfloatersceneloadstats.h + * @brief debug floater for measuring various scene load statistics * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2013, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,17 +24,20 @@ * $/LicenseInfo$ */ -#ifndef LL_LLOPTIONINTERFACE_H -#define LL_LLOPTIONINTERFACE_H +#ifndef LL_FLOATERSCENELOADSTATS_H +#define LL_FLOATERSCENELOADSTATS_H -#include "linden_common.h" +#include "llfloater.h" -class LLSD; -class LLOptionInterface +class LLFloaterSceneLoadStats : public LLFloater { + friend class LLFloaterReg; +private: + LLFloaterSceneLoadStats(const LLSD& key); + public: - virtual ~LLOptionInterface() = 0; - virtual LLSD getOption(const std::string& name) const = 0; + BOOL postBuild(); + }; -#endif +#endif // LL_FLOATERSCENELOADSTATS_H diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 13cb3c2eb00256ad87432ae0710d8a23a71ff251..2ed7bb842df5a397d92147ab331382d1350d5af9 100755 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -58,7 +58,7 @@ // debug switches, won't work in release #ifndef LL_RELEASE_FOR_DOWNLOAD -// dump responder replies to llinfos for debugging +// dump responder replies to LL_INFOS() for debugging //#define DUMP_REPLIES_TO_LLINFOS #ifdef DUMP_REPLIES_TO_LLINFOS @@ -106,7 +106,7 @@ BOOL LLFloaterScriptLimits::postBuild() if(!mTab) { - llwarns << "Error! couldn't get scriptlimits_panels, aborting Script Information setup" << llendl; + LL_WARNS() << "Error! couldn't get scriptlimits_panels, aborting Script Information setup" << LL_ENDL; return FALSE; } @@ -195,7 +195,7 @@ void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content) OSMessageBox(nice_llsd.str(), "main cap response:", 0); - llinfos << "main cap response:" << content << llendl; + LL_INFOS() << "main cap response:" << content << LL_ENDL; #endif @@ -210,7 +210,7 @@ void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content) LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits"); if(!instance) { - llwarns << "Failed to get llfloaterscriptlimits instance" << llendl; + LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL; } } @@ -223,7 +223,7 @@ void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content) void fetchScriptLimitsRegionInfoResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "fetchScriptLimitsRegionInfoResponder error [status:" << status << "]: " << content << llendl; + LL_WARNS() << "fetchScriptLimitsRegionInfoResponder error [status:" << status << "]: " << content << LL_ENDL; } void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref) @@ -277,14 +277,14 @@ void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref) OSMessageBox(nice_llsd.str(), "summary response:", 0); - llwarns << "summary response:" << *content << llendl; + LL_WARNS() << "summary response:" << *content << LL_ENDL; #endif LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits"); if(!instance) { - llwarns << "Failed to get llfloaterscriptlimits instance" << llendl; + LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL; } else { @@ -310,7 +310,7 @@ void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref) void fetchScriptLimitsRegionSummaryResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "fetchScriptLimitsRegionSummaryResponder error [status:" << status << "]: " << content << llendl; + LL_WARNS() << "fetchScriptLimitsRegionSummaryResponder error [status:" << status << "]: " << content << LL_ENDL; } void fetchScriptLimitsRegionDetailsResponder::result(const LLSD& content_ref) @@ -385,7 +385,7 @@ result (map) OSMessageBox(nice_llsd.str(), "details response:", 0); - llinfos << "details response:" << content << llendl; + LL_INFOS() << "details response:" << content << LL_ENDL; #endif @@ -393,7 +393,7 @@ result (map) if(!instance) { - llwarns << "Failed to get llfloaterscriptlimits instance" << llendl; + LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL; } else { @@ -407,19 +407,19 @@ result (map) } else { - llwarns << "Failed to get scriptlimits memory panel" << llendl; + LL_WARNS() << "Failed to get scriptlimits memory panel" << LL_ENDL; } } else { - llwarns << "Failed to get scriptlimits_panels" << llendl; + LL_WARNS() << "Failed to get scriptlimits_panels" << LL_ENDL; } } } void fetchScriptLimitsRegionDetailsResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "fetchScriptLimitsRegionDetailsResponder error [status:" << status << "]: " << content << llendl; + LL_WARNS() << "fetchScriptLimitsRegionDetailsResponder error [status:" << status << "]: " << content << LL_ENDL; } void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref) @@ -473,7 +473,7 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref) OSMessageBox(nice_llsd.str(), "attachment response:", 0); - llinfos << "attachment response:" << content << llendl; + LL_INFOS() << "attachment response:" << content << LL_ENDL; #endif @@ -481,7 +481,7 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref) if(!instance) { - llwarns << "Failed to get llfloaterscriptlimits instance" << llendl; + LL_WARNS() << "Failed to get llfloaterscriptlimits instance" << LL_ENDL; } else { @@ -503,19 +503,19 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref) } else { - llwarns << "Failed to get script_limits_my_avatar_panel" << llendl; + LL_WARNS() << "Failed to get script_limits_my_avatar_panel" << LL_ENDL; } } else { - llwarns << "Failed to get scriptlimits_panels" << llendl; + LL_WARNS() << "Failed to get scriptlimits_panels" << LL_ENDL; } } } void fetchScriptLimitsAttachmentInfoResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "fetchScriptLimitsAttachmentInfoResponder error [status:" << status << "]: " << content << llendl; + LL_WARNS() << "fetchScriptLimitsAttachmentInfoResponder error [status:" << status << "]: " << content << LL_ENDL; } ///---------------------------------------------------------------------------- @@ -588,7 +588,7 @@ void LLPanelScriptLimitsRegionMemory::setParcelID(const LLUUID& parcel_id) // virtual void LLPanelScriptLimitsRegionMemory::setErrorStatus(U32 status, const std::string& reason) { - llwarns << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<llendl; + LL_WARNS() << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<LL_ENDL; } // callback from the name cache with an owner name to add to the list @@ -627,7 +627,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) if(!list) { - llwarns << "Error getting the scripts_list control" << llendl; + LL_WARNS() << "Error getting the scripts_list control" << LL_ENDL; return; } @@ -800,7 +800,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content) } else { - llwarns << "summary doesn't contain memory info" << llendl; + LL_WARNS() << "summary doesn't contain memory info" << LL_ENDL; return; } @@ -818,7 +818,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionSummary(LLSD content) } else { - llwarns << "summary doesn't contain urls info" << llendl; + LL_WARNS() << "summary doesn't contain urls info" << LL_ENDL; return; } @@ -922,9 +922,9 @@ BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() } else { - llwarns << "Can't get parcel info for script information request" << region_id + LL_WARNS() << "Can't get parcel info for script information request" << region_id << ". Region: " << region->getName() - << " does not support RemoteParcelRequest" << llendl; + << " does not support RemoteParcelRequest" << LL_ENDL; std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError"); getChild<LLUICtrl>("loading_text")->setValue(LLSD(msg_waiting)); @@ -990,7 +990,7 @@ void LLPanelScriptLimitsRegionMemory::onClickRefresh(void* userdata) } else { - llwarns << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << llendl; + LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << LL_ENDL; return; } } @@ -1036,7 +1036,7 @@ void LLPanelScriptLimitsRegionMemory::onClickHighlight(void* userdata) } else { - llwarns << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << llendl; + LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << LL_ENDL; return; } } @@ -1141,7 +1141,7 @@ void LLPanelScriptLimitsRegionMemory::onClickReturn(void* userdata) } else { - llwarns << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << llendl; + LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after highlight button clicked" << LL_ENDL; return; } } @@ -1273,7 +1273,7 @@ void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content) } else { - llwarns << "attachment details don't contain memory summary info" << llendl; + LL_WARNS() << "attachment details don't contain memory summary info" << LL_ENDL; return; } @@ -1291,7 +1291,7 @@ void LLPanelScriptLimitsAttachment::setAttachmentSummary(LLSD content) } else { - llwarns << "attachment details don't contain urls summary info" << llendl; + LL_WARNS() << "attachment details don't contain urls summary info" << LL_ENDL; return; } @@ -1343,7 +1343,7 @@ void LLPanelScriptLimitsAttachment::onClickRefresh(void* userdata) } else { - llwarns << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << llendl; + LL_WARNS() << "could not find LLPanelScriptLimitsRegionMemory instance after refresh button clicked" << LL_ENDL; return; } } diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 07f5220ab7f8419cc50d5b0723c1d7f7e63a97dc..fb202b4c406189156a8a0a86de2316aec649156e 100755 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -194,8 +194,8 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) { - llwarns << "Could not find all desired controls by name" - << llendl; + LL_WARNS() << "Could not find all desired controls by name" + << LL_ENDL; return; } diff --git a/indra/newview/llfloatersidepanelcontainer.h b/indra/newview/llfloatersidepanelcontainer.h index 65ec8f604e65b4446f74783655dba90f5b0c6cc2..13b17e8867ada71ce2f9632a3baec91d8df26e70 100755 --- a/indra/newview/llfloatersidepanelcontainer.h +++ b/indra/newview/llfloatersidepanelcontainer.h @@ -74,7 +74,7 @@ class LLFloaterSidePanelContainer : public LLFloater T* panel = dynamic_cast<T*>(getPanel(floater_name, panel_name)); if (!panel) { - llwarns << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << llendl; + LL_WARNS() << "Child named \"" << panel_name << "\" of type " << typeid(T*).name() << " not found" << LL_ENDL; } return panel; } diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index d9835292a1866e2093e9d547c46bf0ce3f5ade75..3d5b297fbeb703566c2d1fd1c4f655662e46e963 100755 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -374,13 +374,13 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) if (width_ctrl->getValue().asInteger() == 0) { S32 w = gViewerWindow->getWindowWidthRaw(); - lldebugs << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << llendl; + LL_DEBUGS() << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << LL_ENDL; width_ctrl->setValue(w); } if (height_ctrl->getValue().asInteger() == 0) { S32 h = gViewerWindow->getWindowHeightRaw(); - lldebugs << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << llendl; + LL_DEBUGS() << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << LL_ENDL; height_ctrl->setValue(h); } @@ -415,7 +415,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); // *TODO: Separate maximum size for Web images from postcards - lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; + LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL; LLLocale locale(LLLocale::USER_LOCALE); std::string bytes_string; @@ -479,7 +479,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) info["have-snapshot"] = got_snap; current_panel->updateControls(info); } - lldebugs << "finished updating controls" << llendl; + LL_DEBUGS() << "finished updating controls" << LL_ENDL; } // static @@ -526,7 +526,7 @@ void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, if (previewp) { BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot"); - lldebugs << "updating " << (autosnap ? "snapshot" : "thumbnail") << llendl; + LL_DEBUGS() << "updating " << (autosnap ? "snapshot" : "thumbnail") << LL_ENDL; previewp->updateSnapshot(autosnap, update_thumbnail, autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); } } @@ -539,7 +539,7 @@ void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data) if (previewp && view) { view->impl.setStatus(Impl::STATUS_READY); - lldebugs << "updating snapshot" << llendl; + LL_DEBUGS() << "updating snapshot" << LL_ENDL; previewp->updateSnapshot(TRUE); } } @@ -616,7 +616,7 @@ void LLFloaterSnapshot::Impl::applyKeepAspectCheck(LLFloaterSnapshot* view, BOOL previewp->getSize(w, h) ; updateSpinners(view, previewp, w, h, TRUE); // may change w and h - lldebugs << "updating thumbnail" << llendl; + LL_DEBUGS() << "updating thumbnail" << LL_ENDL; previewp->setSize(w, h) ; previewp->updateSnapshot(FALSE, TRUE); checkAutoSnapshot(previewp, TRUE); @@ -752,7 +752,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL if (width == 0 || height == 0) { // take resolution from current window size - lldebugs << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; + LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL; previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); } else if (width == -1 || height == -1) @@ -762,7 +762,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL LLPanelSnapshot* spanel = getActivePanel(view); if (spanel) { - lldebugs << "Loading typed res from panel " << spanel->getName() << llendl; + LL_DEBUGS() << "Loading typed res from panel " << spanel->getName() << LL_ENDL; new_width = spanel->getTypedPreviewWidth(); new_height = spanel->getTypedPreviewHeight(); @@ -775,8 +775,8 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL } else { - lldebugs << "No custom res chosen, setting preview res from window: " - << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; + LL_DEBUGS() << "No custom res chosen, setting preview res from window: " + << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL; new_width = gViewerWindow->getWindowWidthRaw(); new_height = gViewerWindow->getWindowHeightRaw(); } @@ -787,7 +787,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL else { // use the resolution from the selected pre-canned drop-down choice - lldebugs << "Setting preview res selected from combo: " << width << "x" << height << llendl; + LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL; previewp->setSize(width, height); } @@ -815,11 +815,11 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL // hide old preview as the aspect ratio could be wrong checkAutoSnapshot(previewp, FALSE); - lldebugs << "updating thumbnail" << llendl; + LL_DEBUGS() << "updating thumbnail" << LL_ENDL; getPreviewView(view)->updateSnapshot(FALSE, TRUE); if(do_update) { - lldebugs << "Will update controls" << llendl; + LL_DEBUGS() << "Will update controls" << LL_ENDL; updateControls(view); setNeedRefresh(view, true); } @@ -862,7 +862,7 @@ void LLFloaterSnapshot::Impl::onImageFormatChange(LLFloaterSnapshot* view) if (view) { gSavedSettings.setS32("SnapshotFormat", getImageFormat(view)); - lldebugs << "image format changed, updating snapshot" << llendl; + LL_DEBUGS() << "image format changed, updating snapshot" << LL_ENDL; getPreviewView(view)->updateSnapshot(TRUE); updateControls(view); setNeedRefresh(view, false); // we're refreshing @@ -945,7 +945,7 @@ void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32 { bool need_refresh = false; - lldebugs << "applyCustomResolution(" << w << ", " << h << ")" << llendl; + LL_DEBUGS() << "applyCustomResolution(" << w << ", " << h << ")" << LL_ENDL; if (!view) return; LLSnapshotLivePreview* previewp = getPreviewView(view); @@ -963,7 +963,7 @@ void LLFloaterSnapshot::Impl::applyCustomResolution(LLFloaterSnapshot* view, S32 previewp->setSize(w,h); checkAutoSnapshot(previewp, FALSE); - lldebugs << "applied custom resolution, updating thumbnail" << llendl; + LL_DEBUGS() << "applied custom resolution, updating thumbnail" << LL_ENDL; previewp->updateSnapshot(FALSE, TRUE); comboSetCustom(view, "profile_size_combo"); comboSetCustom(view, "postcard_size_combo"); @@ -1175,7 +1175,7 @@ void LLFloaterSnapshot::onOpen(const LLSD& key) LLSnapshotLivePreview* preview = LLFloaterSnapshot::Impl::getPreviewView(this); if(preview) { - lldebugs << "opened, updating snapshot" << llendl; + LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL; preview->updateSnapshot(TRUE); } focusFirstItem(FALSE); @@ -1259,7 +1259,7 @@ void LLFloaterSnapshot::update() return; BOOL changed = FALSE; - lldebugs << "npreviews: " << LLSnapshotLivePreview::sList.size() << llendl; + LL_DEBUGS() << "npreviews: " << LLSnapshotLivePreview::sList.size() << LL_ENDL; for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); iter != LLSnapshotLivePreview::sList.end(); ++iter) { @@ -1268,7 +1268,7 @@ void LLFloaterSnapshot::update() if (inst && changed) { - lldebugs << "changed" << llendl; + LL_DEBUGS() << "changed" << LL_ENDL; inst->impl.updateControls(inst); } } @@ -1288,7 +1288,7 @@ LLFloaterSnapshot* LLFloaterSnapshot::findInstance() // static void LLFloaterSnapshot::saveTexture() { - lldebugs << "saveTexture" << llendl; + LL_DEBUGS() << "saveTexture" << LL_ENDL; // FIXME: duplicated code LLFloaterSnapshot* instance = findInstance(); @@ -1310,7 +1310,7 @@ void LLFloaterSnapshot::saveTexture() // static BOOL LLFloaterSnapshot::saveLocal() { - lldebugs << "saveLocal" << llendl; + LL_DEBUGS() << "saveLocal" << LL_ENDL; // FIXME: duplicated code LLFloaterSnapshot* instance = findInstance(); if (!instance) @@ -1411,7 +1411,7 @@ LLPointer<LLImageFormatted> LLFloaterSnapshot::getImageData() LLPointer<LLImageFormatted> img = previewp->getFormattedImage(); if (!img.get()) { - llwarns << "Empty snapshot image data" << llendl; + LL_WARNS() << "Empty snapshot image data" << LL_ENDL; llassert(img.get() != NULL); } diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index e8c6b179cfa24ddf29074aee7005169ecca67e31..ea3d72e116e962f2e26dcdbe5fcb4a57a7d1a15b 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -186,7 +186,7 @@ LLSocialPhotoPanel::~LLSocialPhotoPanel() BOOL LLSocialPhotoPanel::postBuild() { - setVisibleCallback(boost::bind(&LLSocialPhotoPanel::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLSocialPhotoPanel::onVisibilityChanged, this, _2)); mSnapshotPanel = getChild<LLUICtrl>("snapshot_panel"); mResolutionComboBox = getChild<LLUICtrl>("resolution_combobox"); @@ -259,7 +259,7 @@ LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() return previewp; } -void LLSocialPhotoPanel::onVisibilityChange(const LLSD& new_visibility) +void LLSocialPhotoPanel::onVisibilityChanged(const LLSD& new_visibility) { bool visible = new_visibility.asBoolean(); if (visible) @@ -269,7 +269,7 @@ void LLSocialPhotoPanel::onVisibilityChange(const LLSD& new_visibility) LLSnapshotLivePreview* preview = getPreviewView(); if(preview) { - lldebugs << "opened, updating snapshot" << llendl; + LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL; preview->updateSnapshot(TRUE); } } @@ -297,7 +297,7 @@ void LLSocialPhotoPanel::onClickNewSnapshot() if (previewp) { //setStatus(Impl::STATUS_READY); - lldebugs << "updating snapshot" << llendl; + LL_DEBUGS() << "updating snapshot" << LL_ENDL; previewp->updateSnapshot(TRUE); } } @@ -368,7 +368,7 @@ void LLSocialPhotoPanel::updateControls() LLSnapshotLivePreview::ESnapshotType shot_type = (previewp ? previewp->getSnapshotType() : LLSnapshotLivePreview::SNAPSHOT_POSTCARD); // *TODO: Separate maximum size for Web images from postcards - lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; + LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL; LLLocale locale(LLLocale::USER_LOCALE); std::string bytes_string; @@ -408,13 +408,13 @@ void LLSocialPhotoPanel::updateResolution(BOOL do_update) if (width == 0 || height == 0) { // take resolution from current window size - lldebugs << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; + LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL; previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); } else { // use the resolution from the selected pre-canned drop-down choice - lldebugs << "Setting preview res selected from combo: " << width << "x" << height << llendl; + LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL; previewp->setSize(width, height); } @@ -427,12 +427,12 @@ void LLSocialPhotoPanel::updateResolution(BOOL do_update) previewp->setSize(width, height); // hide old preview as the aspect ratio could be wrong - lldebugs << "updating thumbnail" << llendl; + LL_DEBUGS() << "updating thumbnail" << LL_ENDL; previewp->updateSnapshot(FALSE, TRUE); if(do_update) { - lldebugs << "Will update controls" << llendl; + LL_DEBUGS() << "Will update controls" << LL_ENDL; updateControls(); LLSocialPhotoPanel::onClickNewSnapshot(); } @@ -626,7 +626,7 @@ mDisconnectButton(NULL) mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLSocialAccountPanel::onConnect, this)); mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLSocialAccountPanel::onDisconnect, this)); - setVisibleCallback(boost::bind(&LLSocialAccountPanel::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLSocialAccountPanel::onVisibilityChanged, this, _2)); } BOOL LLSocialAccountPanel::postBuild() @@ -655,7 +655,7 @@ void LLSocialAccountPanel::draw() LLPanel::draw(); } -void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) +void LLSocialAccountPanel::onVisibilityChanged(const LLSD& new_visibility) { bool visible = new_visibility.asBoolean(); diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h index 309f015ce972704f47795b3bab4a4b6f46cc8639..585b265d9f17ed83eff87f00362441e304d3c450 100644 --- a/indra/newview/llfloatersocial.h +++ b/indra/newview/llfloatersocial.h @@ -63,7 +63,7 @@ class LLSocialPhotoPanel : public LLPanel void draw(); LLSnapshotLivePreview* getPreviewView(); - void onVisibilityChange(const LLSD& new_visibility); + void onVisibilityChanged(const LLSD& new_visibility); void onClickNewSnapshot(); void onSend(); bool onFacebookConnectStateChange(const LLSD& data); @@ -122,7 +122,7 @@ class LLSocialAccountPanel : public LLPanel void draw(); private: - void onVisibilityChange(const LLSD& new_visibility); + void onVisibilityChanged(const LLSD& new_visibility); bool onFacebookConnectStateChange(const LLSD& data); bool onFacebookConnectInfoChange(); void onConnect(); diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 7b25291da7df632bda40d86d9f18768c2d859ed0..afbd7ba5e27cfaebb3b99483c594c8f295982f09 100755 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -266,7 +266,7 @@ BOOL LLFloaterTools::postBuild() found->setClickedCallback(boost::bind(&LLFloaterTools::setObjectType, toolData[t])); mButtons.push_back( found ); }else{ - llwarns << "Tool button not found! DOA Pending." << llendl; + LL_WARNS() << "Tool button not found! DOA Pending." << LL_ENDL; } } mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection"); @@ -500,7 +500,7 @@ void LLFloaterTools::refresh() } else { - llwarns << "Failed to get selected object" << llendl; + LL_WARNS() << "Failed to get selected object" << LL_ENDL; } } @@ -1095,7 +1095,7 @@ void LLFloaterTools::setTool(const LLSD& user_data) else if (control_name == "Land" ) LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool *) LLToolSelectLand::getInstance()); else - llwarns<<" no parameter name "<<control_name<<" found!! No Tool selected!!"<< llendl; + LL_WARNS()<<" no parameter name "<<control_name<<" found!! No Tool selected!!"<< LL_ENDL; } void LLFloaterTools::onFocusReceived() diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h index 6edc46cf7990887381d8006e4dc238eabba591d6..28d2aa58e2344f9ed1f10f4fbbbaaf99b204e932 100755 --- a/indra/newview/llfloatertopobjects.h +++ b/indra/newview/llfloatertopobjects.h @@ -31,6 +31,22 @@ class LLUICtrl; +// Bits for simulator performance query flags +enum LAND_STAT_FLAGS +{ + STAT_FILTER_BY_PARCEL = 0x00000001, + STAT_FILTER_BY_OWNER = 0x00000002, + STAT_FILTER_BY_OBJECT = 0x00000004, + STAT_FILTER_BY_PARCEL_NAME = 0x00000008, + STAT_REQUEST_LAST_ENTRY = 0x80000000, +}; + +enum LAND_STAT_REPORT_TYPE +{ + STAT_REPORT_TOP_SCRIPTS = 0, + STAT_REPORT_TOP_COLLIDERS +}; + class LLFloaterTopObjects : public LLFloater { friend class LLFloaterReg; diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp index 33f2c352398ee31e7546632001c6ad2809583658..965d29b09cac78136617eb263469a5ce9f6e54b5 100755 --- a/indra/newview/llfloatertranslationsettings.cpp +++ b/indra/newview/llfloatertranslationsettings.cpp @@ -59,7 +59,7 @@ class EnteredKeyVerifier : public LLTranslate::KeyVerificationReceiver if (!floater) { - llwarns << "Cannot find translation settings floater" << llendl; + LL_WARNS() << "Cannot find translation settings floater" << LL_ENDL; return; } diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index 0106a1615d3b31aee80b08e693b41e0af2825fa6..96a70d934544bc6e57b173601520192dfc12077a 100755 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -607,7 +607,7 @@ void LLFloaterUIPreview::onClose(bool app_quitting) // *TODO: this is currently unlocalized. Add to alerts/notifications.xml, someday, maybe. void LLFloaterUIPreview::popupAndPrintWarning(const std::string& warning) { - llwarns << warning << llendl; + LL_WARNS() << warning << LL_ENDL; LLSD args; args["MESSAGE"] = warning; LLNotificationsUtil::add("GenericAlert", args); @@ -960,7 +960,7 @@ void LLFloaterUIPreview::onClickEditFloater() std::string file_name = mFileList->getSelectedItemLabel(1); // get the file name of the currently-selected floater if (file_name.empty()) // if no item is selected { - llwarns << "No file selected" << llendl; + LL_WARNS() << "No file selected" << LL_ENDL; return; // ignore click } file_path = getLocalizedDirectory() + file_name; @@ -1268,8 +1268,8 @@ void LLFloaterUIPreview::highlightChangedElements() // if we still didn't find it... if(NULL == element) { - llinfos << "Unable to find element in XuiDelta file named \"" << *iter << "\" in file \"" << mLiveFile->mFileName << - "\". The element may no longer exist, the path may be incorrect, or it may not be a non-displayable element (not an LLView) such as a \"string\" type." << llendl; + LL_INFOS() << "Unable to find element in XuiDelta file named \"" << *iter << "\" in file \"" << mLiveFile->mFileName << + "\". The element may no longer exist, the path may be incorrect, or it may not be a non-displayable element (not an LLView) such as a \"string\" type." << LL_ENDL; failed = TRUE; break; } diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index 68dbb5ae33efde12774542082a9aaed21548d18d..a3a78b5d8bd234b2d1067887ee03b90d94f50639 100755 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -56,7 +56,7 @@ LLFloaterWebContent::_Params::_Params() LLFloaterWebContent::LLFloaterWebContent( const Params& params ) : LLFloater( params ), - LLInstanceTracker<LLFloaterWebContent, std::string>(params.id()), + LLInstanceTracker<LLFloaterWebContent, std::string, LLInstanceTrackerReplaceOnCollision>(params.id()), mWebBrowser(NULL), mAddressCombo(NULL), mSecureLockIcon(NULL), @@ -192,7 +192,7 @@ void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height) width + getRect().getWidth() - browser_rect.getWidth(), height + getRect().getHeight() - browser_rect.getHeight()); - lldebugs << "geometry change: " << geom << llendl; + LL_DEBUGS() << "geometry change: " << geom << LL_ENDL; LLRect new_rect; getParent()->screenRectToLocal(geom, &new_rect); @@ -202,7 +202,7 @@ void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height) // static void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p) { - lldebugs << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << llendl; + LL_DEBUGS() << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << LL_ENDL; if (!p.id.isProvided()) { @@ -221,11 +221,11 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p) // and close the least recently opened one if this will put us over the limit. LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class); - lldebugs << "total instance count is " << instances.size() << llendl; + LL_DEBUGS() << "total instance count is " << instances.size() << LL_ENDL; for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++) { - lldebugs << " " << (*iter)->getKey()["target"] << llendl; + LL_DEBUGS() << " " << (*iter)->getKey()["target"] << LL_ENDL; } if(instances.size() >= (size_t)browser_window_limit) @@ -374,8 +374,8 @@ void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent { if (mCurrentURL.find("facebook.com/dialog/oauth") == std::string::npos) // HACK to fix ACME-1317 - Cho { - geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight()); - } + geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight()); + } } else if(event == MEDIA_EVENT_STATUS_TEXT_CHANGED ) { diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h index f22940cd0720237af67b15bef892315fc92f3745..ad56eec8590633366bb69ac8d4edfc6dee565ae1 100755 --- a/indra/newview/llfloaterwebcontent.h +++ b/indra/newview/llfloaterwebcontent.h @@ -40,11 +40,11 @@ class LLIconCtrl; class LLFloaterWebContent : public LLFloater, public LLViewerMediaObserver, - public LLInstanceTracker<LLFloaterWebContent, std::string> + public LLInstanceTracker<LLFloaterWebContent, std::string, LLInstanceTrackerReplaceOnCollision> { public: - typedef LLInstanceTracker<LLFloaterWebContent, std::string> instance_tracker_t; + typedef LLInstanceTracker<LLFloaterWebContent, std::string, LLInstanceTrackerReplaceOnCollision> instance_tracker_t; LOG_CLASS(LLFloaterWebContent); struct _Params : public LLInitParam::Block<_Params> diff --git a/indra/newview/llfloaterwebprofile.cpp b/indra/newview/llfloaterwebprofile.cpp index c41f6f148f317b50cb55542b8aadcbd47dce976a..a46f1d8af220c7ab7561a44a4c8214fd54f4f90d 100755 --- a/indra/newview/llfloaterwebprofile.cpp +++ b/indra/newview/llfloaterwebprofile.cpp @@ -47,11 +47,11 @@ void LLFloaterWebProfile::onOpen(const LLSD& key) // virtual void LLFloaterWebProfile::handleReshape(const LLRect& new_rect, bool by_user) { - lldebugs << "handleReshape: " << new_rect << llendl; + LL_DEBUGS() << "handleReshape: " << new_rect << LL_ENDL; if (by_user && !isMinimized()) { - lldebugs << "Storing new rect" << llendl; + LL_DEBUGS() << "Storing new rect" << LL_ENDL; gSavedSettings.setRect("WebProfileFloaterRect", new_rect); } @@ -68,7 +68,7 @@ LLFloater* LLFloaterWebProfile::create(const LLSD& key) void LLFloaterWebProfile::applyPreferredRect() { const LLRect preferred_rect = gSavedSettings.getRect("WebProfileFloaterRect"); - lldebugs << "Applying preferred rect: " << preferred_rect << llendl; + LL_DEBUGS() << "Applying preferred rect: " << preferred_rect << LL_ENDL; // Don't override position that may have been set by floater stacking code. LLRect new_rect = getRect(); diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index cb637c71624839c9449d8604afcfb4fab9576a7c..ff66bdedb051b2c014f2a13b21645e4053ed3034 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -570,9 +570,9 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) buildLandmarkIDLists(); BOOL found = FALSE; S32 idx; - for (idx = 0; idx < mLandmarkItemIDList.count(); idx++) + for (idx = 0; idx < mLandmarkItemIDList.size(); idx++) { - if ( mLandmarkItemIDList.get(idx) == landmark_item_id) + if ( mLandmarkItemIDList.at(idx) == landmark_item_id) { found = TRUE; break; @@ -581,13 +581,13 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) if (found && iface->setCurrentByID( landmark_item_id ) ) { - LLUUID asset_id = mLandmarkAssetIDList.get( idx ); + LLUUID asset_id = mLandmarkAssetIDList.at( idx ); std::string name; LLComboBox* combo = getChild<LLComboBox>( "landmark combo"); if (combo) name = combo->getSimple(); mTrackedStatus = LLTracker::TRACKING_LANDMARK; - LLTracker::trackLandmark(mLandmarkAssetIDList.get( idx ), // assetID - mLandmarkItemIDList.get( idx ), // itemID + LLTracker::trackLandmark(mLandmarkAssetIDList.at( idx ), // assetID + mLandmarkItemIDList.at( idx ), // itemID name); // name if( asset_id != sHomeID ) @@ -911,15 +911,15 @@ void LLFloaterWorldMap::buildLandmarkIDLists() list->operateOnSelection(LLCtrlListInterface::OP_DELETE); } - mLandmarkItemIDList.reset(); - mLandmarkAssetIDList.reset(); + mLandmarkItemIDList.clear(); + mLandmarkAssetIDList.clear(); // Get all of the current landmarks - mLandmarkAssetIDList.put( LLUUID::null ); - mLandmarkItemIDList.put( LLUUID::null ); + mLandmarkAssetIDList.push_back( LLUUID::null ); + mLandmarkItemIDList.push_back( LLUUID::null ); - mLandmarkAssetIDList.put( sHomeID ); - mLandmarkItemIDList.put( sHomeID ); + mLandmarkAssetIDList.push_back( sHomeID ); + mLandmarkItemIDList.push_back( sHomeID ); LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; @@ -932,15 +932,18 @@ void LLFloaterWorldMap::buildLandmarkIDLists() std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers()); - S32 count = items.count(); + mLandmarkAssetIDList.reserve(mLandmarkAssetIDList.size() + items.size()); + mLandmarkItemIDList.reserve(mLandmarkItemIDList.size() + items.size()); + + S32 count = items.size(); for(S32 i = 0; i < count; ++i) { - LLInventoryItem* item = items.get(i); + LLInventoryItem* item = items.at(i); list->addSimpleElement(item->getName(), ADD_BOTTOM, item->getUUID()); - mLandmarkAssetIDList.put( item->getAssetUUID() ); - mLandmarkItemIDList.put( item->getUUID() ); + mLandmarkAssetIDList.push_back( item->getAssetUUID() ); + mLandmarkItemIDList.push_back( item->getUUID() ); } list->selectFirstItem(); diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index e3b83b2579855a4f712f13e40b552a04301ef002..84ca5a7a71e2d1a36b41679ad9cd10e3eb5e6a54 100755 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -32,7 +32,6 @@ #ifndef LL_LLFLOATERWORLDMAP_H #define LL_LLFLOATERWORLDMAP_H -#include "lldarray.h" #include "llfloater.h" #include "llhudtext.h" #include "llmapimagetype.h" @@ -166,8 +165,8 @@ class LLFloaterWorldMap : public LLFloater // enable/disable teleport destination coordinates void enableTeleportCoordsDisplay( bool enabled ); - LLDynamicArray<LLUUID> mLandmarkAssetIDList; - LLDynamicArray<LLUUID> mLandmarkItemIDList; + std::vector<LLUUID> mLandmarkAssetIDList; + std::vector<LLUUID> mLandmarkItemIDList; static const LLUUID sHomeID; diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index aac3a41b9eedf1849a76f052b7d8832100138ca2..7339398fa507025b455f9e001872048e18e297ad 100755 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -34,7 +34,7 @@ // // class LLFolderViewModelInventory // -static LLFastTimer::DeclareTimer FTM_INVENTORY_SORT("Sort"); +static LLTrace::BlockTimerStatHandle FTM_INVENTORY_SORT("Inventory Sort"); bool LLFolderViewModelInventory::startDrag(std::vector<LLFolderViewModelItem*>& items) { @@ -63,7 +63,7 @@ bool LLFolderViewModelInventory::startDrag(std::vector<LLFolderViewModelItem*>& void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) { - LLFastTimer _(FTM_INVENTORY_SORT); + LL_RECORD_BLOCK_TIME(FTM_INVENTORY_SORT); if (!needsSort(folder->getViewModelItem())) return; diff --git a/indra/newview/llfollowcam.cpp b/indra/newview/llfollowcam.cpp index 47612fe25c0d077e4dfdd1781de36fe801e83610..612afc0d18fdeb8142499f3155072aa3af394bfc 100755 --- a/indra/newview/llfollowcam.cpp +++ b/indra/newview/llfollowcam.cpp @@ -327,11 +327,11 @@ void LLFollowCam::update() F32 force = focusOffsetDistance - focusThresholdNormalizedByDistance; */ - F32 focusLagLerp = LLCriticalDamp::getInterpolant( mFocusLag ); + F32 focusLagLerp = LLSmoothInterpolation::getInterpolant( mFocusLag ); focus_pt_agent = lerp( focus_pt_agent, whereFocusWantsToBe, focusLagLerp ); mSimulatedFocusGlobal = gAgent.getPosGlobalFromAgent(focus_pt_agent); } - mRelativeFocus = lerp(mRelativeFocus, (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation, LLCriticalDamp::getInterpolant(0.05f)); + mRelativeFocus = lerp(mRelativeFocus, (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation, LLSmoothInterpolation::getInterpolant(0.05f)); }// if focus is not locked --------------------------------------------- @@ -414,7 +414,7 @@ void LLFollowCam::update() //------------------------------------------------------------------------------------------------- if ( distanceFromPositionToIdealPosition > mPositionThreshold ) { - F32 positionPullLerp = LLCriticalDamp::getInterpolant( mPositionLag ); + F32 positionPullLerp = LLSmoothInterpolation::getInterpolant( mPositionLag ); simulated_pos_agent = lerp( simulated_pos_agent, whereCameraPositionWantsToBe, positionPullLerp ); } @@ -434,7 +434,7 @@ void LLFollowCam::update() updateBehindnessConstraint(gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal), simulated_pos_agent); mSimulatedPositionGlobal = gAgent.getPosGlobalFromAgent(simulated_pos_agent); - mRelativePos = lerp(mRelativePos, (simulated_pos_agent - mSubjectPosition) * ~mSubjectRotation, LLCriticalDamp::getInterpolant(0.05f)); + mRelativePos = lerp(mRelativePos, (simulated_pos_agent - mSubjectPosition) * ~mSubjectRotation, LLSmoothInterpolation::getInterpolant(0.05f)); } // if position is not locked ----------------------------------------------------------- @@ -489,7 +489,7 @@ BOOL LLFollowCam::updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_pos if ( cameraOffsetAngle > mBehindnessMaxAngle ) { - F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLCriticalDamp::getInterpolant(mBehindnessLag); + F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLSmoothInterpolation::getInterpolant(mBehindnessLag); cam_position = focus + horizontalSubjectBack * (slerp(fraction, camera_offset_rotation, LLQuaternion::DEFAULT)); cam_position.mV[VZ] = cameraZ; // clamp z value back to what it was before we started messing with it constraint_active = TRUE; @@ -876,12 +876,12 @@ bool LLFollowCamMgr::isScriptedCameraSource(const LLUUID& source) void LLFollowCamMgr::dump() { S32 param_count = 0; - llinfos << "Scripted camera active stack" << llendl; + LL_INFOS() << "Scripted camera active stack" << LL_ENDL; for (param_stack_t::iterator param_it = sParamStack.begin(); param_it != sParamStack.end(); ++param_it) { - llinfos << param_count++ << + LL_INFOS() << param_count++ << " rot_limit: " << (*param_it)->getBehindnessAngle() << " rot_lag: " << (*param_it)->getBehindnessLag() << " distance: " << (*param_it)->getDistance() << @@ -894,7 +894,7 @@ void LLFollowCamMgr::dump() " pos: " << (*param_it)->getPosition() << " pos_lag: " << (*param_it)->getPositionLag() << " pos_lock: " << ((*param_it)->getPositionLocked() ? "Y" : "N") << - " pos_thresh: " << (*param_it)->getPositionThreshold() << llendl; + " pos_thresh: " << (*param_it)->getPositionThreshold() << LL_ENDL; } } diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 16ed3f990c7cc13a4ff2b1604db0e64489b4982d..6566ef5dca21732437d3f43d0721e2589b5871fe 100755 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -67,10 +67,10 @@ inline const std::string get_friend_all_subfolder_name() void move_from_to_arrays(LLInventoryModel::cat_array_t& from, LLInventoryModel::cat_array_t& to) { - while (from.count() > 0) + while (from.size() > 0) { - to.put(from.get(0)); - from.remove(0); + to.push_back(from.at(0)); + from.erase(from.begin()); } } @@ -82,7 +82,7 @@ const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollect gInventory.collectDescendentsIf(parentFolderUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH, matchFunctor); - S32 cats_count = cats.count(); + S32 cats_count = cats.size(); if (cats_count > 1) { @@ -92,7 +92,7 @@ const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollect << LL_ENDL; } - return (cats_count >= 1) ? cats.get(0)->getUUID() : LLUUID::null; + return (cats_count >= 1) ? cats.at(0)->getUUID() : LLUUID::null; } /** @@ -172,14 +172,14 @@ LLFriendCardsManager::~LLFriendCardsManager() void LLFriendCardsManager::putAvatarData(const LLUUID& avatarID) { - llinfos << "Store avatar data, avatarID: " << avatarID << llendl; + LL_INFOS() << "Store avatar data, avatarID: " << avatarID << LL_ENDL; std::pair< avatar_uuid_set_t::iterator, bool > pr; pr = mBuddyIDSet.insert(avatarID); if (pr.second == false) { - llwarns << "Trying to add avatar UUID for the stored avatar: " + LL_WARNS() << "Trying to add avatar UUID for the stored avatar: " << avatarID - << llendl; + << LL_ENDL; } } @@ -189,7 +189,7 @@ const LLUUID LLFriendCardsManager::extractAvatarID(const LLUUID& avatarID) avatar_uuid_set_t::iterator it = mBuddyIDSet.find(avatarID); if (mBuddyIDSet.end() == it) { - llwarns << "Call method for non-existent avatar name in the map: " << avatarID << llendl; + LL_WARNS() << "Call method for non-existent avatar name in the map: " << avatarID << LL_ENDL; } else { @@ -207,7 +207,7 @@ bool LLFriendCardsManager::isItemInAnyFriendsList(const LLViewerInventoryItem* i LLInventoryModel::item_array_t items; findMatchedFriendCards(item->getCreatorUUID(), items); - return items.count() > 0; + return items.size() > 0; } @@ -242,9 +242,9 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje { LLUUID creator_id = item->getCreatorUUID(); LLViewerInventoryItem* cur_item = NULL; - for ( S32 i = items->count() - 1; i >= 0; --i ) + for ( S32 i = items->size() - 1; i >= 0; --i ) { - cur_item = items->get(i); + cur_item = items->at(i); if ( creator_id == cur_item->getCreatorUUID() ) { result = true; @@ -259,9 +259,9 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje // Note: UUID's of compared items also may be not equal. std::string obj_name = obj->getName(); LLViewerInventoryItem* cur_item = NULL; - for ( S32 i = items->count() - 1; i >= 0; --i ) + for ( S32 i = items->size() - 1; i >= 0; --i ) { - cur_item = items->get(i); + cur_item = items->at(i); if ( obj->getType() != cur_item->getType() ) continue; if ( obj_name == cur_item->getName() ) @@ -279,9 +279,9 @@ bool LLFriendCardsManager::isObjDirectDescendentOfCategory(const LLInventoryObje // then return true. Note: UUID's of compared items also may be not equal. std::string obj_name = obj->getName(); LLViewerInventoryCategory* cur_cat = NULL; - for ( S32 i = cats->count() - 1; i >= 0; --i ) + for ( S32 i = cats->size() - 1; i >= 0; --i ) { - cur_cat = cats->get(i); + cur_cat = cats->at(i); if ( obj->getType() != cur_cat->getType() ) continue; if ( obj_name == cur_cat->getName() ) @@ -381,10 +381,10 @@ void LLFriendCardsManager::findMatchedFriendCards(const LLUUID& avatarID, LLInve LLInventoryModel::cat_array_t subFolders; subFolders.push_back(friendFolder); - while (subFolders.count() > 0) + while (subFolders.size() > 0) { - LLViewerInventoryCategory* cat = subFolders.get(0); - subFolders.remove(0); + LLViewerInventoryCategory* cat = subFolders.at(0); + subFolders.erase(subFolders.begin()); gInventory.collectDescendentsIf(cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH, matchFunctor); @@ -431,7 +431,7 @@ void LLFriendCardsManager::ensureFriendsFolderExists() { LLViewerInventoryCategory* cat = gInventory.getCategory(calling_cards_folder_ID); std::string cat_name = cat ? cat->getName() : "unknown"; - llwarns << "Failed to find \"" << cat_name << "\" category descendents in Category Tree." << llendl; + LL_WARNS() << "Failed to find \"" << cat_name << "\" category descendents in Category Tree." << LL_ENDL; } friends_folder_ID = gInventory.createNewCategory(calling_cards_folder_ID, @@ -462,7 +462,7 @@ void LLFriendCardsManager::ensureFriendsAllFolderExists() { LLViewerInventoryCategory* cat = gInventory.getCategory(friends_folder_ID); std::string cat_name = cat ? cat->getName() : "unknown"; - llwarns << "Failed to find \"" << cat_name << "\" category descendents in Category Tree." << llendl; + LL_WARNS() << "Failed to find \"" << cat_name << "\" category descendents in Category Tree." << LL_ENDL; } friends_all_folder_ID = gInventory.createNewCategory(friends_folder_ID, @@ -507,7 +507,7 @@ void LLFriendCardsManager::syncFriendsFolder() // 2. Add missing Friend Cards for friends LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin(); - llinfos << "try to build friends, count: " << all_buddies.size() << llendl; + LL_INFOS() << "try to build friends, count: " << all_buddies.size() << LL_ENDL; for(; buddy_it != all_buddies.end(); ++buddy_it) { const LLUUID& buddy_id = (*buddy_it).first; @@ -535,26 +535,26 @@ void LLFriendCardsManager::addFriendCardToInventory(const LLUUID& avatarID) LLAvatarNameCache::get(avatarID, &av_name); const std::string& name = av_name.getAccountName(); - lldebugs << "Processing buddy name: " << name + LL_DEBUGS() << "Processing buddy name: " << name << ", id: " << avatarID - << llendl; + << LL_ENDL; if (shouldBeAdded && findFriendCardInventoryUUIDImpl(avatarID).notNull()) { shouldBeAdded = false; - lldebugs << "is found in Inventory: " << name << llendl; + LL_DEBUGS() << "is found in Inventory: " << name << LL_ENDL; } if (shouldBeAdded && isAvatarDataStored(avatarID)) { shouldBeAdded = false; - lldebugs << "is found in sentRequests: " << name << llendl; + LL_DEBUGS() << "is found in sentRequests: " << name << LL_ENDL; } if (shouldBeAdded) { putAvatarData(avatarID); - lldebugs << "Sent create_inventory_item for " << avatarID << ", " << name << llendl; + LL_DEBUGS() << "Sent create_inventory_item for " << avatarID << ", " << name << LL_ENDL; // TODO: mantipov: Is CreateFriendCardCallback really needed? Probably not LLPointer<LLInventoryCallback> cb = new CreateFriendCardCallback; diff --git a/indra/newview/llgesturelistener.cpp b/indra/newview/llgesturelistener.cpp index 2fff5066813bbae397f90b1c15ea18e38a1f17e3..6fd749d83ee9dad7f20b7f8bf64587c5880d80f2 100755 --- a/indra/newview/llgesturelistener.cpp +++ b/indra/newview/llgesturelistener.cpp @@ -101,12 +101,12 @@ void LLGestureListener::isGesturePlaying(const LLSD& event_data) const } else { - llwarns << "isGesturePlaying did not find a gesture object for " << gesture_id << llendl; + LL_WARNS() << "isGesturePlaying did not find a gesture object for " << gesture_id << LL_ENDL; } } else { - llwarns << "isGesturePlaying didn't have 'id' value passed in" << llendl; + LL_WARNS() << "isGesturePlaying didn't have 'id' value passed in" << LL_ENDL; } LLSD reply = LLSD::emptyMap(); @@ -148,12 +148,12 @@ void LLGestureListener::startOrStopGesture(LLSD const & event_data, bool start) } else { - llwarns << "startOrStopGesture did not find a gesture object for " << gesture_id << llendl; + LL_WARNS() << "startOrStopGesture did not find a gesture object for " << gesture_id << LL_ENDL; } } else { - llwarns << "startOrStopGesture didn't have 'id' value passed in" << llendl; + LL_WARNS() << "startOrStopGesture didn't have 'id' value passed in" << LL_ENDL; } } diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 2ae13b1b2f6921b74dbef5869189a0f78ea4f5fb..ffddeeb129e850fea5a77de769c9024581b74492 100755 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -257,19 +257,19 @@ void LLGestureMgr::activateGestureWithAsset(const LLUUID& item_id, if( !gAssetStorage ) { - llwarns << "LLGestureMgr::activateGestureWithAsset without valid gAssetStorage" << llendl; + LL_WARNS() << "LLGestureMgr::activateGestureWithAsset without valid gAssetStorage" << LL_ENDL; return; } // If gesture is already active, nothing to do. if (isGestureActive(item_id)) { - llwarns << "Tried to loadGesture twice " << item_id << llendl; + LL_WARNS() << "Tried to loadGesture twice " << item_id << LL_ENDL; return; } // if (asset_id.isNull()) // { -// llwarns << "loadGesture() - gesture has no asset" << llendl; +// LL_WARNS() << "loadGesture() - gesture has no asset" << LL_ENDL; // return; // } @@ -305,7 +305,7 @@ void LLGestureMgr::deactivateGesture(const LLUUID& item_id) item_map_t::iterator it = mActive.find(base_item_id); if (it == mActive.end()) { - llwarns << "deactivateGesture for inactive gesture " << item_id << llendl; + LL_WARNS() << "deactivateGesture for inactive gesture " << item_id << LL_ENDL; return; } @@ -469,7 +469,7 @@ void LLGestureMgr::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_ges item_map_t::iterator it = mActive.find(base_item_id); if (it == mActive.end()) { - llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl; + LL_WARNS() << "replaceGesture for inactive gesture " << base_item_id << LL_ENDL; return; } @@ -511,7 +511,7 @@ void LLGestureMgr::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset item_map_t::iterator it = LLGestureMgr::instance().mActive.find(base_item_id); if (it == mActive.end()) { - llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl; + LL_WARNS() << "replaceGesture for inactive gesture " << base_item_id << LL_ENDL; return; } @@ -586,7 +586,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture) } default: { - llwarns << "Unknown gesture step type: " << step->getType() << llendl; + LL_WARNS() << "Unknown gesture step type: " << step->getType() << LL_ENDL; } } } @@ -907,8 +907,8 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) else if (gesture->mWaitTimer.getElapsedTimeF32() > MAX_WAIT_ANIM_SECS) { // we've waited too long for an animation - llinfos << "Waited too long for animations to stop, continuing gesture." - << llendl; + LL_INFOS() << "Waited too long for animations to stop, continuing gesture." + << LL_ENDL; gesture->mWaitingAnimations = FALSE; gesture->mCurrentStep++; } @@ -1129,7 +1129,7 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs, } else { - llwarns << "Unable to load gesture" << llendl; + LL_WARNS() << "Unable to load gesture" << LL_ENDL; self.mActive.erase(item_id); @@ -1139,8 +1139,6 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs, } else { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { @@ -1151,7 +1149,7 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs, LLDelayedGestureError::gestureFailedToLoad( item_id ); } - llwarns << "Problem loading gesture: " << status << llendl; + LL_WARNS() << "Problem loading gesture: " << status << LL_ENDL; LLGestureMgr::instance().mActive.erase(item_id); } @@ -1187,7 +1185,7 @@ void LLGestureMgr::onAssetLoadComplete(LLVFS *vfs, } default: { - llwarns << "Unexpected asset type: " << type << llendl; + LL_WARNS() << "Unexpected asset type: " << type << LL_ENDL; // We don't want to return from this callback without // an animation or sound callback being fired @@ -1242,7 +1240,7 @@ bool LLGestureMgr::hasLoadingAssets(LLMultiGesture* gesture) } default: { - llwarns << "Unknown gesture step type: " << step->getType() << llendl; + LL_WARNS() << "Unknown gesture step type: " << step->getType() << LL_ENDL; } } } @@ -1324,7 +1322,7 @@ void LLGestureMgr::removeObserver(LLGestureManagerObserver* observer) // from the list. void LLGestureMgr::notifyObservers() { - lldebugs << "LLGestureMgr::notifyObservers" << llendl; + LL_DEBUGS() << "LLGestureMgr::notifyObservers" << LL_ENDL; for(std::vector<LLGestureManagerObserver*>::iterator iter = mObservers.begin(); iter != mObservers.end(); diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp index 0dd84b6073f6555cdd8e8cdefb72e959e618c64f..813d2081ce46811333d8ee4e22de58d66e579b9f 100755 --- a/indra/newview/llgiveinventory.cpp +++ b/indra/newview/llgiveinventory.cpp @@ -192,7 +192,7 @@ bool LLGiveInventory::doGiveInventoryItem(const LLUUID& to_agent, { bool res = true; - llinfos << "LLGiveInventory::giveInventory()" << llendl; + LL_INFOS() << "LLGiveInventory::giveInventory()" << LL_ENDL; if (!isInventoryGiveAcceptable(item)) { return false; @@ -230,8 +230,8 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent, { return false; } - llinfos << "LLGiveInventory::giveInventoryCategory() - " - << cat->getUUID() << llendl; + LL_INFOS() << "LLGiveInventory::giveInventoryCategory() - " + << cat->getUUID() << LL_ENDL; if (!isAgentAvatarValid()) { @@ -248,11 +248,11 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent, items, LLInventoryModel::EXCLUDE_TRASH, giveable); - S32 count = cats.count(); + S32 count = cats.size(); bool complete = true; for(S32 i = 0; i < count; ++i) { - if (!gInventory.isCategoryComplete(cats.get(i)->getUUID())) + if (!gInventory.isCategoryComplete(cats.at(i)->getUUID())) { complete = false; break; @@ -263,7 +263,7 @@ bool LLGiveInventory::doGiveInventoryCategory(const LLUUID& to_agent, LLNotificationsUtil::add("IncompleteInventory"); give_successful = false; } - count = items.count() + cats.count(); + count = items.size() + cats.size(); if (count > MAX_ITEMS) { LLNotificationsUtil::add("TooManyItems"); @@ -447,10 +447,10 @@ bool LLGiveInventory::handleCopyProtectedCategory(const LLSD& notification, cons items, LLInventoryModel::EXCLUDE_TRASH, remove); - S32 count = items.count(); + S32 count = items.size(); for(S32 i = 0; i < count; ++i) { - gInventory.deleteObject(items.get(i)->getUUID()); + gInventory.deleteObject(items.at(i)->getUUID()); } gInventory.notifyObservers(); @@ -484,8 +484,8 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, { return false; } - llinfos << "LLGiveInventory::commitGiveInventoryCategory() - " - << cat->getUUID() << llendl; + LL_INFOS() << "LLGiveInventory::commitGiveInventoryCategory() - " + << cat->getUUID() << LL_ENDL; // add buddy to recent people list LLRecentPeople::instance().add(to_agent); @@ -504,7 +504,7 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, // MAX ITEMS is based on (sizeof(uuid)+2) * count must be < // MTUBYTES or 18 * count < 1200 => count < 1200/18 => // 66. I've cut it down a bit from there to give some pad. - S32 count = items.count() + cats.count(); + S32 count = items.size() + cats.size(); if (count > MAX_ITEMS) { LLNotificationsUtil::add("TooManyItems"); @@ -530,21 +530,21 @@ bool LLGiveInventory::commitGiveInventoryCategory(const LLUUID& to_agent, memcpy(pos, &(cat->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ pos += UUID_BYTES; S32 i; - count = cats.count(); + count = cats.size(); for(i = 0; i < count; ++i) { memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */ pos += sizeof(U8); - memcpy(pos, &(cats.get(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ + memcpy(pos, &(cats.at(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ pos += UUID_BYTES; } - count = items.count(); + count = items.size(); for(i = 0; i < count; ++i) { - type = (U8)items.get(i)->getType(); + type = (U8)items.at(i)->getType(); memcpy(pos, &type, sizeof(U8)); /* Flawfinder: ignore */ pos += sizeof(U8); - memcpy(pos, &(items.get(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ + memcpy(pos, &(items.at(i)->getUUID()), UUID_BYTES); /* Flawfinder: ignore */ pos += UUID_BYTES; } pack_instant_message( diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index cf550e5eff389b35b756c2a7843d4ae00b8e30f4..c386030329db1f06470b74730f62868ec88db7d6 100755 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -991,7 +991,7 @@ void gpu_benchmark() F32 gbps = results[results.size()/2]; - llinfos << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to CPU timers" << llendl; + LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to CPU timers" << LL_ENDL; F32 ms = gBenchmarkProgram.mTimeElapsed/1000000.f; F32 seconds = ms/1000.f; @@ -1002,11 +1002,11 @@ void gpu_benchmark() if (gGLManager.mHasTimerQuery) { - llinfos << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to ARB_timer_query" << llendl; + LL_INFOS() << "Memory bandwidth is " << llformat("%.3f", gbps) << "GB/sec according to ARB_timer_query" << LL_ENDL; } else { - llinfos << "ARB_timer_query unavailable." << llendl; + LL_INFOS() << "ARB_timer_query unavailable." << LL_ENDL; } } diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index 302d21c2e42b16f24ca1b1ed628c412026b87280..f514729aa1ed19de00f82abe9da064a357d7f920 100755 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -126,7 +126,7 @@ class LLFetchGroupMemberData : public LLGroupMgrObserver mRequestProcessed(false), LLGroupMgrObserver(group_id) { - llinfos << "Sending new group member request for group_id: "<< group_id << llendl; + LL_INFOS() << "Sending new group member request for group_id: "<< group_id << LL_ENDL; LLGroupMgr* mgr = LLGroupMgr::getInstance(); // register ourselves as an observer mgr->addObserver(this); @@ -140,8 +140,8 @@ class LLFetchGroupMemberData : public LLGroupMgrObserver if (!mRequestProcessed) { // Request is pending - llwarns << "Destroying pending group member request for group_id: " - << mGroupId << llendl; + LL_WARNS() << "Destroying pending group member request for group_id: " + << mGroupId << LL_ENDL; } // Remove ourselves as an observer LLGroupMgr::getInstance()->removeObserver(this); @@ -154,11 +154,11 @@ class LLFetchGroupMemberData : public LLGroupMgrObserver LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupId); if (!gdatap) { - llwarns << "LLGroupMgr::getInstance()->getGroupData() was NULL" << llendl; + LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData() was NULL" << LL_ENDL; } else if (!gdatap->isMemberDataComplete()) { - llwarns << "LLGroupMgr::getInstance()->getGroupData()->isMemberDataComplete() was FALSE" << llendl; + LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData()->isMemberDataComplete() was FALSE" << LL_ENDL; } else { @@ -204,14 +204,14 @@ void LLGroupActions::startCall(const LLUUID& group_id) if (!gAgent.getGroupData(group_id, gdata)) { - llwarns << "Error getting group data" << llendl; + LL_WARNS() << "Error getting group data" << LL_ENDL; return; } LLUUID session_id = gIMMgr->addSession(gdata.mName, IM_SESSION_GROUP_START, group_id, true); if (session_id == LLUUID::null) { - llwarns << "Error adding session" << llendl; + LL_WARNS() << "Error adding session" << LL_ENDL; return; } @@ -257,8 +257,8 @@ void LLGroupActions::join(const LLUUID& group_id) } else { - llwarns << "LLGroupMgr::getInstance()->getGroupData(" << group_id - << ") was NULL" << llendl; + LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData(" << group_id + << ") was NULL" << LL_ENDL; } } diff --git a/indra/newview/llgroupiconctrl.cpp b/indra/newview/llgroupiconctrl.cpp index 2d0fc26c2a140e69a6210e55cd3a0470f9b6c4b1..6abf9ea637675cae1bafd8a927812e579ea22df9 100755 --- a/indra/newview/llgroupiconctrl.cpp +++ b/indra/newview/llgroupiconctrl.cpp @@ -30,33 +30,21 @@ #include "llagent.h" #include "llviewertexture.h" -/* -#include "llavatarconstants.h" -#include "llcallingcard.h" // for LLAvatarTracker -#include "llavataractions.h" -#include "llmenugl.h" -#include "lluictrlfactory.h" - -#include "llcachename.h" -#include "llagentdata.h" -#include "llfloaterimsession.h" -*/ static LLDefaultChildRegistry::Register<LLGroupIconCtrl> g_i("group_icon"); LLGroupIconCtrl::Params::Params() -: group_id("group_id") -, draw_tooltip("draw_tooltip", true) -, default_icon_name("default_icon_name") -{ -} +: group_id("group_id"), + draw_tooltip("draw_tooltip", true), + default_icon_name("default_icon_name") +{} LLGroupIconCtrl::LLGroupIconCtrl(const LLGroupIconCtrl::Params& p) -: LLIconCtrl(p) -, mGroupId(LLUUID::null) -, mDrawTooltip(p.draw_tooltip) -, mDefaultIconName(p.default_icon_name) +: LLIconCtrl(p), + mGroupId(LLUUID::null), + mDrawTooltip(p.draw_tooltip), + mDefaultIconName(p.default_icon_name) { mPriority = LLViewerFetchedTexture::BOOST_ICON; diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp index aba3d74d878152478e2354ab87a9cb479682f8a1..b1b7a87ae8612965ca4b9685574c3cc983d7fbb0 100755 --- a/indra/newview/llgrouplist.cpp +++ b/indra/newview/llgrouplist.cpp @@ -163,7 +163,7 @@ static bool findInsensitive(std::string haystack, const std::string& needle_uppe void LLGroupList::refresh() { const LLUUID& highlight_id = gAgent.getGroupID(); - S32 count = gAgent.mGroups.count(); + S32 count = gAgent.mGroups.size(); LLUUID id; bool have_filter = !mNameFilter.empty(); @@ -171,8 +171,8 @@ void LLGroupList::refresh() for(S32 i = 0; i < count; ++i) { - id = gAgent.mGroups.get(i).mID; - const LLGroupData& group_data = gAgent.mGroups.get(i); + id = gAgent.mGroups.at(i).mID; + const LLGroupData& group_data = gAgent.mGroups.at(i); if (have_filter && !findInsensitive(group_data.mName, mNameFilter)) continue; addNewItem(id, group_data.mName, group_data.mInsigniaID, ADD_BOTTOM); diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 9c0b486cc518f2445ac3ec09603a2ea927769f96..b2ad737a1d70fcd4bdd8f1222f4287116f2cdb6b 100755 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -41,6 +41,7 @@ #include "llui.h" #include "message.h" #include "roles_constants.h" +#include "llhttpclient.h" #include "lltransactiontypes.h" #include "llstatusbar.h" #include "lleconomy.h" @@ -50,6 +51,7 @@ #include "llnotificationsutil.h" #include "lluictrlfactory.h" #include "lltrans.h" +#include "llviewerregion.h" #include <boost/regex.hpp> #if LL_MSVC @@ -328,7 +330,7 @@ void LLGroupMgrGroupData::setRoleData(const LLUUID& role_id, LLRoleData role_dat } else { - llwarns << "Change being made to non-existant role " << role_id << llendl; + LL_WARNS() << "Change being made to non-existant role " << role_id << LL_ENDL; } } @@ -342,7 +344,7 @@ void LLGroupMgrGroupData::createRole(const LLUUID& role_id, LLRoleData role_data { if (mRoleChanges.find(role_id) != mRoleChanges.end()) { - llwarns << "create role for existing role! " << role_id << llendl; + LL_WARNS() << "create role for existing role! " << role_id << LL_ENDL; } else { @@ -379,7 +381,7 @@ void LLGroupMgrGroupData::addRolePower(const LLUUID &role_id, U64 power) } else { - llwarns << "addRolePower: no role data found for " << role_id << llendl; + LL_WARNS() << "addRolePower: no role data found for " << role_id << LL_ENDL; } } @@ -393,7 +395,7 @@ void LLGroupMgrGroupData::removeRolePower(const LLUUID &role_id, U64 power) } else { - llwarns << "removeRolePower: no role data found for " << role_id << llendl; + LL_WARNS() << "removeRolePower: no role data found for " << role_id << LL_ENDL; } } @@ -406,7 +408,7 @@ U64 LLGroupMgrGroupData::getRolePowers(const LLUUID& role_id) } else { - llwarns << "getRolePowers: no role data found for " << role_id << llendl; + LL_WARNS() << "getRolePowers: no role data found for " << role_id << LL_ENDL; return GP_NO_POWERS; } } @@ -490,8 +492,8 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, if (ri == mRoles.end() || mi == mMembers.end() ) { - if (ri == mRoles.end()) llwarns << "LLGroupMgrGroupData::changeRoleMember couldn't find role " << role_id << llendl; - if (mi == mMembers.end()) llwarns << "LLGroupMgrGroupData::changeRoleMember couldn't find member " << member_id << llendl; + if (ri == mRoles.end()) LL_WARNS() << "LLGroupMgrGroupData::changeRoleMember couldn't find role " << role_id << LL_ENDL; + if (mi == mMembers.end()) LL_WARNS() << "LLGroupMgrGroupData::changeRoleMember couldn't find member " << member_id << LL_ENDL; return false; } @@ -500,13 +502,13 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, if (!grd || !gmd) { - llwarns << "LLGroupMgrGroupData::changeRoleMember couldn't get member or role data." << llendl; + LL_WARNS() << "LLGroupMgrGroupData::changeRoleMember couldn't get member or role data." << LL_ENDL; return false; } if (RMC_ADD == rmc) { - llinfos << " adding member to role." << llendl; + LL_INFOS() << " adding member to role." << LL_ENDL; grd->addMember(member_id); gmd->addRole(role_id,grd); @@ -516,7 +518,7 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, } else if (RMC_REMOVE == rmc) { - llinfos << " removing member from role." << llendl; + LL_INFOS() << " removing member from role." << LL_ENDL; grd->removeMember(member_id); gmd->removeRole(role_id); @@ -535,9 +537,9 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, if (it->second.mChange == rmc) { // Already recorded this change? Weird. - llinfos << "Received duplicate change for " + LL_INFOS() << "Received duplicate change for " << " role: " << role_id << " member " << member_id - << " change " << (rmc == RMC_ADD ? "ADD" : "REMOVE") << llendl; + << " change " << (rmc == RMC_ADD ? "ADD" : "REMOVE") << LL_ENDL; } else { @@ -545,7 +547,7 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, // If that changes this will need more logic if (rmc == RMC_NONE) { - llwarns << "changeRoleMember: existing entry with 'RMC_NONE' change! This shouldn't happen." << llendl; + LL_WARNS() << "changeRoleMember: existing entry with 'RMC_NONE' change! This shouldn't happen." << LL_ENDL; LLRoleMemberChange rc(role_id,member_id,rmc); mRoleMemberChanges[role_member] = rc; } @@ -868,12 +870,12 @@ static void formatDateString(std::string &date_string) // static void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) { - lldebugs << "LLGroupMgr::processGroupMembersReply" << llendl; + LL_DEBUGS() << "LLGroupMgr::processGroupMembersReply" << LL_ENDL; LLUUID agent_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); if (gAgent.getID() != agent_id) { - llwarns << "Got group members reply for another agent!" << llendl; + LL_WARNS() << "Got group members reply for another agent!" << LL_ENDL; return; } @@ -886,7 +888,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap || (group_datap->mMemberRequestID != request_id)) { - llwarns << "processGroupMembersReply: Received incorrect (stale?) group or request id" << llendl; + LL_WARNS() << "processGroupMembersReply: Received incorrect (stale?) group or request id" << LL_ENDL; return; } @@ -924,7 +926,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) formatDateString(online_status); // reformat for sorting, e.g. 12/25/2008 -> 2008/12/25 } - //llinfos << "Member " << member_id << " has powers " << std::hex << agent_powers << std::dec << llendl; + //LL_INFOS() << "Member " << member_id << " has powers " << std::hex << agent_powers << std::dec << LL_ENDL; LLGroupMemberData* newdata = new LLGroupMemberData(member_id, contribution, agent_powers, @@ -935,14 +937,14 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) LLGroupMgrGroupData::member_list_t::iterator mit = group_datap->mMembers.find(member_id); if (mit != group_datap->mMembers.end()) { - llinfos << " *** Received duplicate member data for agent " << member_id << llendl; + LL_INFOS() << " *** Received duplicate member data for agent " << member_id << LL_ENDL; } #endif group_datap->mMembers[member_id] = newdata; } else { - llinfos << "Received null group member data." << llendl; + LL_INFOS() << "Received null group member data." << LL_ENDL; } } @@ -974,12 +976,12 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) //static void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) { - lldebugs << "LLGroupMgr::processGroupPropertiesReply" << llendl; + LL_DEBUGS() << "LLGroupMgr::processGroupPropertiesReply" << LL_ENDL; LLUUID agent_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); if (gAgent.getID() != agent_id) { - llwarns << "Got group properties reply for another agent!" << llendl; + LL_WARNS() << "Got group properties reply for another agent!" << LL_ENDL; return; } @@ -1041,12 +1043,12 @@ void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) // static void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) { - lldebugs << "LLGroupMgr::processGroupRoleDataReply" << llendl; + LL_DEBUGS() << "LLGroupMgr::processGroupRoleDataReply" << LL_ENDL; LLUUID agent_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); if (gAgent.getID() != agent_id) { - llwarns << "Got group role data reply for another agent!" << llendl; + LL_WARNS() << "Got group role data reply for another agent!" << LL_ENDL; return; } @@ -1059,7 +1061,7 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap || (group_datap->mRoleDataRequestID != request_id)) { - llwarns << "processGroupPropertiesReply: Received incorrect (stale?) group or request id" << llendl; + LL_WARNS() << "processGroupPropertiesReply: Received incorrect (stale?) group or request id" << LL_ENDL; return; } @@ -1102,7 +1104,7 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) - lldebugs << "Adding role data: " << name << " {" << role_id << "}" << llendl; + LL_DEBUGS() << "Adding role data: " << name << " {" << role_id << "}" << LL_ENDL; LLGroupRoleData* rd = new LLGroupRoleData(role_id,name,title,desc,powers,member_count); group_datap->mRoles[role_id] = rd; } @@ -1126,12 +1128,12 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) // static void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) { - lldebugs << "LLGroupMgr::processGroupRoleMembersReply" << llendl; + LL_DEBUGS() << "LLGroupMgr::processGroupRoleMembersReply" << LL_ENDL; LLUUID agent_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); if (gAgent.getID() != agent_id) { - llwarns << "Got group role members reply for another agent!" << llendl; + LL_WARNS() << "Got group role members reply for another agent!" << LL_ENDL; return; } @@ -1147,7 +1149,7 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap || (group_datap->mRoleMembersRequestID != request_id)) { - llwarns << "processGroupRoleMembersReply: Received incorrect (stale?) group or request id" << llendl; + LL_WARNS() << "processGroupRoleMembersReply: Received incorrect (stale?) group or request id" << LL_ENDL; return; } @@ -1187,14 +1189,14 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) if (rd && md) { - lldebugs << "Adding role-member pair: " << role_id << ", " << member_id << llendl; + LL_DEBUGS() << "Adding role-member pair: " << role_id << ", " << member_id << LL_ENDL; rd->addMember(member_id); md->addRole(role_id,rd); } else { - if (!rd) llwarns << "Received role data for unknown role " << role_id << " in group " << group_id << llendl; - if (!md) llwarns << "Received role data for unknown member " << member_id << " in group " << group_id << llendl; + if (!rd) LL_WARNS() << "Received role data for unknown role " << role_id << " in group " << group_id << LL_ENDL; + if (!md) LL_WARNS() << "Received role data for unknown member " << member_id << " in group " << group_id << LL_ENDL; } } } @@ -1208,7 +1210,7 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) LLGroupRoleData* everyone = group_datap->mRoles[LLUUID::null]; if (!everyone) { - llwarns << "Everyone role not found!" << llendl; + LL_WARNS() << "Everyone role not found!" << LL_ENDL; } else { @@ -1234,12 +1236,12 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) // static void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) { - lldebugs << "LLGroupMgr::processGroupTitlesReply" << llendl; + LL_DEBUGS() << "LLGroupMgr::processGroupTitlesReply" << LL_ENDL; LLUUID agent_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); if (gAgent.getID() != agent_id) { - llwarns << "Got group properties reply for another agent!" << llendl; + LL_WARNS() << "Got group properties reply for another agent!" << LL_ENDL; return; } @@ -1251,7 +1253,7 @@ void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap || (group_datap->mTitlesRequestID != request_id)) { - llwarns << "processGroupTitlesReply: Received incorrect (stale?) group" << llendl; + LL_WARNS() << "processGroupTitlesReply: Received incorrect (stale?) group" << LL_ENDL; return; } @@ -1267,7 +1269,7 @@ void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) if (!title.mTitle.empty()) { - lldebugs << "LLGroupMgr adding title: " << title.mTitle << ", " << title.mRoleID << ", " << (title.mSelected ? 'Y' : 'N') << llendl; + LL_DEBUGS() << "LLGroupMgr adding title: " << title.mTitle << ", " << title.mRoleID << ", " << (title.mSelected ? 'Y' : 'N') << LL_ENDL; group_datap->mTitles.push_back(title); } } @@ -1279,7 +1281,7 @@ void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) // static void LLGroupMgr::processEjectGroupMemberReply(LLMessageSystem* msg, void ** data) { - lldebugs << "processEjectGroupMemberReply" << llendl; + LL_DEBUGS() << "processEjectGroupMemberReply" << LL_ENDL; LLUUID group_id; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); BOOL success; @@ -1295,7 +1297,7 @@ void LLGroupMgr::processEjectGroupMemberReply(LLMessageSystem* msg, void ** data // static void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data) { - lldebugs << "processJoinGroupReply" << llendl; + LL_DEBUGS() << "processJoinGroupReply" << LL_ENDL; LLUUID group_id; BOOL success; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); @@ -1315,7 +1317,7 @@ void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data) // static void LLGroupMgr::processLeaveGroupReply(LLMessageSystem* msg, void ** data) { - lldebugs << "processLeaveGroupReply" << llendl; + LL_DEBUGS() << "processLeaveGroupReply" << LL_ENDL; LLUUID group_id; BOOL success; msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); @@ -1477,7 +1479,7 @@ void LLGroupMgr::addGroup(LLGroupMgrGroupData* group_datap) void LLGroupMgr::sendGroupPropertiesRequest(const LLUUID& group_id) { - lldebugs << "LLGroupMgr::sendGroupPropertiesRequest" << llendl; + LL_DEBUGS() << "LLGroupMgr::sendGroupPropertiesRequest" << LL_ENDL; // This will happen when we get the reply //LLGroupMgrGroupData* group_datap = createGroupData(group_id); @@ -1493,7 +1495,7 @@ void LLGroupMgr::sendGroupPropertiesRequest(const LLUUID& group_id) void LLGroupMgr::sendGroupMembersRequest(const LLUUID& group_id) { - lldebugs << "LLGroupMgr::sendGroupMembersRequest" << llendl; + LL_DEBUGS() << "LLGroupMgr::sendGroupMembersRequest" << LL_ENDL; LLGroupMgrGroupData* group_datap = createGroupData(group_id); if (group_datap->mMemberRequestID.isNull()) { @@ -1515,7 +1517,7 @@ void LLGroupMgr::sendGroupMembersRequest(const LLUUID& group_id) void LLGroupMgr::sendGroupRoleDataRequest(const LLUUID& group_id) { - lldebugs << "LLGroupMgr::sendGroupRoleDataRequest" << llendl; + LL_DEBUGS() << "LLGroupMgr::sendGroupRoleDataRequest" << LL_ENDL; LLGroupMgrGroupData* group_datap = createGroupData(group_id); if (group_datap->mRoleDataRequestID.isNull()) { @@ -1536,7 +1538,7 @@ void LLGroupMgr::sendGroupRoleDataRequest(const LLUUID& group_id) void LLGroupMgr::sendGroupRoleMembersRequest(const LLUUID& group_id) { - lldebugs << "LLGroupMgr::sendGroupRoleMembersRequest" << llendl; + LL_DEBUGS() << "LLGroupMgr::sendGroupRoleMembersRequest" << LL_ENDL; LLGroupMgrGroupData* group_datap = createGroupData(group_id); if (group_datap->mRoleMembersRequestID.isNull()) @@ -1546,9 +1548,9 @@ void LLGroupMgr::sendGroupRoleMembersRequest(const LLUUID& group_id) || !group_datap->isRoleDataComplete()) { // *TODO: KLW FIXME: Should we start a member or role data request? - llinfos << " Pending: " << (group_datap->mPendingRoleMemberRequest ? "Y" : "N") + LL_INFOS() << " Pending: " << (group_datap->mPendingRoleMemberRequest ? "Y" : "N") << " MemberDataComplete: " << (group_datap->mMemberDataComplete ? "Y" : "N") - << " RoleDataComplete: " << (group_datap->mRoleDataComplete ? "Y" : "N") << llendl; + << " RoleDataComplete: " << (group_datap->mRoleDataComplete ? "Y" : "N") << LL_ENDL; group_datap->mPendingRoleMemberRequest = TRUE; return; } @@ -1570,7 +1572,7 @@ void LLGroupMgr::sendGroupRoleMembersRequest(const LLUUID& group_id) void LLGroupMgr::sendGroupTitlesRequest(const LLUUID& group_id) { - lldebugs << "LLGroupMgr::sendGroupTitlesRequest" << llendl; + LL_DEBUGS() << "LLGroupMgr::sendGroupTitlesRequest" << LL_ENDL; LLGroupMgrGroupData* group_datap = createGroupData(group_id); group_datap->mTitles.clear(); @@ -1589,7 +1591,7 @@ void LLGroupMgr::sendGroupTitlesRequest(const LLUUID& group_id) void LLGroupMgr::sendGroupTitleUpdate(const LLUUID& group_id, const LLUUID& title_role_id) { - lldebugs << "LLGroupMgr::sendGroupTitleUpdate" << llendl; + LL_DEBUGS() << "LLGroupMgr::sendGroupTitleUpdate" << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessage("GroupTitleUpdate"); @@ -1648,7 +1650,7 @@ void LLGroupMgr::sendCreateGroupRequest(const std::string& name, void LLGroupMgr::sendUpdateGroupInfo(const LLUUID& group_id) { - lldebugs << "LLGroupMgr::sendUpdateGroupInfo" << llendl; + LL_DEBUGS() << "LLGroupMgr::sendUpdateGroupInfo" << LL_ENDL; LLGroupMgrGroupData* group_datap = createGroupData(group_id); LLMessageSystem* msg = gMessageSystem; @@ -1677,7 +1679,7 @@ void LLGroupMgr::sendUpdateGroupInfo(const LLUUID& group_id) void LLGroupMgr::sendGroupRoleMemberChanges(const LLUUID& group_id) { - lldebugs << "LLGroupMgr::sendGroupRoleMemberChanges" << llendl; + LL_DEBUGS() << "LLGroupMgr::sendGroupRoleMemberChanges" << LL_ENDL; LLGroupMgrGroupData* group_datap = createGroupData(group_id); if (group_datap->mRoleMemberChanges.empty()) return; @@ -2031,7 +2033,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) void LLGroupMgr::sendGroupRoleChanges(const LLUUID& group_id) { - lldebugs << "LLGroupMgr::sendGroupRoleChanges" << llendl; + LL_DEBUGS() << "LLGroupMgr::sendGroupRoleChanges" << LL_ENDL; LLGroupMgrGroupData* group_datap = getGroupData(group_id); if (group_datap && group_datap->pendingRoleChanges()) @@ -2046,7 +2048,7 @@ void LLGroupMgr::sendGroupRoleChanges(const LLUUID& group_id) void LLGroupMgr::cancelGroupRoleChanges(const LLUUID& group_id) { - lldebugs << "LLGroupMgr::cancelGroupRoleChanges" << llendl; + LL_DEBUGS() << "LLGroupMgr::cancelGroupRoleChanges" << LL_ENDL; LLGroupMgrGroupData* group_datap = getGroupData(group_id); if (group_datap) group_datap->cancelRoleChanges(); @@ -2061,7 +2063,7 @@ bool LLGroupMgr::parseRoleActions(const std::string& xml_filename) if (!success || !root || !root->hasName( "role_actions" )) { - llerrs << "Problem reading UI role_actions file: " << xml_filename << llendl; + LL_ERRS() << "Problem reading UI role_actions file: " << xml_filename << LL_ENDL; return false; } @@ -2080,12 +2082,12 @@ bool LLGroupMgr::parseRoleActions(const std::string& xml_filename) std::string action_set_name; if (action_set->getAttributeString("name", action_set_name)) { - lldebugs << "Loading action set " << action_set_name << llendl; + LL_DEBUGS() << "Loading action set " << action_set_name << LL_ENDL; role_action_data->mName = action_set_name; } else { - llwarns << "Unable to parse action set with no name" << llendl; + LL_WARNS() << "Unable to parse action set with no name" << LL_ENDL; delete role_action_set; delete role_action_data; continue; @@ -2121,12 +2123,12 @@ bool LLGroupMgr::parseRoleActions(const std::string& xml_filename) std::string action_name; if (action->getAttributeString("name", action_name)) { - lldebugs << "Loading action " << action_name << llendl; + LL_DEBUGS() << "Loading action " << action_name << LL_ENDL; role_action->mName = action_name; } else { - llwarns << "Unable to parse action with no name" << llendl; + LL_WARNS() << "Unable to parse action with no name" << LL_ENDL; delete role_action; continue; } diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 17505513953cb59fc664d4680a8a6d1f926092f2..9b62ecac48d0289f88cb0c7a5b9585ec9d89947b 100755 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -35,6 +35,17 @@ class LLMessageSystem; + +enum LLGroupChange +{ + GC_PROPERTIES, + GC_MEMBER_DATA, + GC_ROLE_DATA, + GC_ROLE_MEMBER_DATA, + GC_TITLES, + GC_ALL +}; + class LLGroupMgrObserver { public: diff --git a/indra/newview/llhomelocationresponder.cpp b/indra/newview/llhomelocationresponder.cpp index 37428c4a44b5769885613c4ffc247f0c3b63b5a4..eefa8bd42a18398df1ad11dfb2b2deff13213291 100755 --- a/indra/newview/llhomelocationresponder.cpp +++ b/indra/newview/llhomelocationresponder.cpp @@ -90,7 +90,7 @@ void LLHomeLocationResponder::result( const LLSD& content ) if( ! error ) { - llinfos << "setting home position" << llendl; + LL_INFOS() << "setting home position" << LL_ENDL; LLViewerRegion *viewer_region = gAgent.getRegion(); gAgent.setHomePosRegion( viewer_region->getHandle(), agent_pos ); @@ -99,5 +99,5 @@ void LLHomeLocationResponder::result( const LLSD& content ) void LLHomeLocationResponder::errorWithContent( U32 status, const std::string& reason, const LLSD& content ) { - llwarns << "LLHomeLocationResponder error [status:" << status << "]: " << content << llendl; + LL_WARNS() << "LLHomeLocationResponder error [status:" << status << "]: " << content << LL_ENDL; } diff --git a/indra/newview/llhudeffect.cpp b/indra/newview/llhudeffect.cpp index 159ec6c803aac658ce32d7d1d1ebff878becaa22..eff5587610f9deb8ae3cfa9587e7ae221039d588 100755 --- a/indra/newview/llhudeffect.cpp +++ b/indra/newview/llhudeffect.cpp @@ -71,7 +71,7 @@ void LLHUDEffect::unpackData(LLMessageSystem *mesgsys, S32 blocknum) void LLHUDEffect::render() { - llerrs << "Never call this!" << llendl; + LL_ERRS() << "Never call this!" << LL_ENDL; } void LLHUDEffect::setID(const LLUUID &id) diff --git a/indra/newview/llhudeffectbeam.cpp b/indra/newview/llhudeffectbeam.cpp index 8abad3d292f41dd9d3f6e5967a0c3d369ba3b7e6..54e683e048371e9c834346c09cbf8b42b4d35445 100755 --- a/indra/newview/llhudeffectbeam.cpp +++ b/indra/newview/llhudeffectbeam.cpp @@ -78,7 +78,7 @@ void LLHUDEffectBeam::packData(LLMessageSystem *mesgsys) { if (!mSourceObject) { - llwarns << "Missing source object!" << llendl; + LL_WARNS() << "Missing source object!" << LL_ENDL; } // Pack the default data @@ -115,7 +115,7 @@ void LLHUDEffectBeam::packData(LLMessageSystem *mesgsys) void LLHUDEffectBeam::unpackData(LLMessageSystem *mesgsys, S32 blocknum) { - llerrs << "Got beam!" << llendl; + LL_ERRS() << "Got beam!" << LL_ENDL; BOOL use_target_object; LLVector3d new_target; U8 packed_data[41]; @@ -126,7 +126,7 @@ void LLHUDEffectBeam::unpackData(LLMessageSystem *mesgsys, S32 blocknum) S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData); if (size != 41) { - llwarns << "Beam effect with bad size " << size << llendl; + LL_WARNS() << "Beam effect with bad size " << size << LL_ENDL; return; } mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, 41, blocknum); @@ -172,7 +172,7 @@ void LLHUDEffectBeam::setSourceObject(LLViewerObject *objp) { if (objp->isDead()) { - llwarns << "HUDEffectBeam: Source object is dead!" << llendl; + LL_WARNS() << "HUDEffectBeam: Source object is dead!" << LL_ENDL; mSourceObject = NULL; return; } @@ -210,7 +210,7 @@ void LLHUDEffectBeam::setTargetObject(LLViewerObject *objp) { if (mTargetObject->isDead()) { - llwarns << "HUDEffectBeam: Target object is dead!" << llendl; + LL_WARNS() << "HUDEffectBeam: Target object is dead!" << LL_ENDL; } mTargetObject = objp; diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index 9dde65ceb6bde7e29301a30405f3c722892de6a0..f3a48625a467999a3f8554cdac0385d779b57acb 100755 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -204,7 +204,7 @@ static BOOL loadAttentions() //------------------------------------------------------------------------- if( !root->hasName( "linden_attentions" ) ) { - llwarns << "Invalid linden_attentions file header: " << filename << llendl; + LL_WARNS() << "Invalid linden_attentions file header: " << filename << LL_ENDL; return FALSE; } @@ -212,7 +212,7 @@ static BOOL loadAttentions() static LLStdStringHandle version_string = LLXmlTree::addAttributeString("version"); if( !root->getFastAttributeString( version_string, version ) || (version != "1.0") ) { - llwarns << "Invalid linden_attentions file version: " << version << llendl; + LL_WARNS() << "Invalid linden_attentions file version: " << version << LL_ENDL; return FALSE; } @@ -322,7 +322,7 @@ void LLHUDEffectLookAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData); if (size != PKT_SIZE) { - llwarns << "LookAt effect with bad size " << size << llendl; + LL_WARNS() << "LookAt effect with bad size " << size << LL_ENDL; return; } mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, PKT_SIZE, blocknum); @@ -336,7 +336,7 @@ void LLHUDEffectLookAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) } else { - //llwarns << "Could not find source avatar for lookat effect" << llendl; + //LL_WARNS() << "Could not find source avatar for lookat effect" << LL_ENDL; return; } @@ -356,7 +356,7 @@ void LLHUDEffectLookAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) } else { - //llwarns << "Could not find target object for lookat effect" << llendl; + //LL_WARNS() << "Could not find target object for lookat effect" << LL_ENDL; } U8 lookAtTypeUnpacked = 0; @@ -400,7 +400,7 @@ BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *objec if (target_type >= LOOKAT_NUM_TARGETS) { - llwarns << "Bad target_type " << (int)target_type << " - ignoring." << llendl; + LL_WARNS() << "Bad target_type " << (int)target_type << " - ignoring." << LL_ENDL; return FALSE; } diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index 114a633821c93b9867061769aa33d36166ccff1f..44c8db19c0308f90f52ac3fac4c9abe9ebd9e302 100755 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -159,7 +159,7 @@ void LLHUDEffectPointAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData); if (size != PKT_SIZE) { - llwarns << "PointAt effect with bad size " << size << llendl; + LL_WARNS() << "PointAt effect with bad size " << size << LL_ENDL; return; } mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, PKT_SIZE, blocknum); @@ -176,7 +176,7 @@ void LLHUDEffectPointAt::unpackData(LLMessageSystem *mesgsys, S32 blocknum) } else { - //llwarns << "Could not find source avatar for pointat effect" << llendl; + //LL_WARNS() << "Could not find source avatar for pointat effect" << LL_ENDL; return; } @@ -228,7 +228,7 @@ BOOL LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *ob if (target_type >= POINTAT_NUM_TARGETS) { - llwarns << "Bad target_type " << (int)target_type << " - ignoring." << llendl; + LL_WARNS() << "Bad target_type " << (int)target_type << " - ignoring." << LL_ENDL; return FALSE; } @@ -252,7 +252,7 @@ BOOL LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *ob mLastSentOffsetGlobal = position; setDuration(POINTAT_TIMEOUTS[target_type]); setNeedsSendToSim(TRUE); -// llinfos << "Sending pointat data" << llendl; +// LL_INFOS() << "Sending pointat data" << LL_ENDL; } if (target_type == POINTAT_TARGET_CLEAR) diff --git a/indra/newview/llhudeffecttrail.cpp b/indra/newview/llhudeffecttrail.cpp index 39b526c1b5a652fc4ed9e6a8b78720dda872db62..877121903474e392dd5e4f44cb870a79b5460089 100755 --- a/indra/newview/llhudeffecttrail.cpp +++ b/indra/newview/llhudeffecttrail.cpp @@ -85,7 +85,7 @@ void LLHUDEffectSpiral::packData(LLMessageSystem *mesgsys) { if (!mSourceObject) { - //llwarns << "Missing object in trail pack!" << llendl; + //LL_WARNS() << "Missing object in trail pack!" << LL_ENDL; } LLHUDEffect::packData(mesgsys); @@ -117,7 +117,7 @@ void LLHUDEffectSpiral::unpackData(LLMessageSystem *mesgsys, S32 blocknum) size_t size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData); if (size != EFFECT_SIZE) { - llwarns << "Spiral effect with bad size " << size << llendl; + LL_WARNS() << "Spiral effect with bad size " << size << LL_ENDL; return; } mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, diff --git a/indra/newview/llhudicon.h b/indra/newview/llhudicon.h index 557252ab0bf392aed09ec86661260de0e6b75c0d..e00a985ddc0b96f7f98033a6077987271ec6ecc5 100755 --- a/indra/newview/llhudicon.h +++ b/indra/newview/llhudicon.h @@ -28,7 +28,6 @@ #define LL_LLHUDICON_H #include "llpointer.h" -#include "lldarrayptr.h" #include "llhudobject.h" #include "v4color.h" @@ -39,11 +38,8 @@ #include "llfontgl.h" #include <set> #include <vector> -#include "lldarray.h" // Renders a 2D icon billboard floating at the location specified. -class LLDrawable; -class LLViewerObject; class LLViewerTexture; class LLHUDIcon : public LLHUDObject diff --git a/indra/newview/llhudmanager.cpp b/indra/newview/llhudmanager.cpp index 8f14b53db0a14bcc37bfccac9fa5b918502469e5..1f9b0f47b147a8e1fdd46955b81a29ba3bfa7bd7 100755 --- a/indra/newview/llhudmanager.cpp +++ b/indra/newview/llhudmanager.cpp @@ -54,13 +54,13 @@ LLHUDManager::~LLHUDManager() { } -static LLFastTimer::DeclareTimer FTM_HUD_EFFECTS("Hud Effects"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_HUD_EFFECTS("Update Hud Effects"); void LLHUDManager::updateEffects() { - LLFastTimer ftm(FTM_HUD_EFFECTS); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_HUD_EFFECTS); S32 i; - for (i = 0; i < mHUDEffects.count(); i++) + for (i = 0; i < mHUDEffects.size(); i++) { LLHUDEffect *hep = mHUDEffects[i]; if (hep->isDead()) @@ -74,17 +74,17 @@ void LLHUDManager::updateEffects() void LLHUDManager::sendEffects() { S32 i; - for (i = 0; i < mHUDEffects.count(); i++) + for (i = 0; i < mHUDEffects.size(); i++) { LLHUDEffect *hep = mHUDEffects[i]; if (hep->isDead()) { - llwarns << "Trying to send dead effect!" << llendl; + LL_WARNS() << "Trying to send dead effect!" << LL_ENDL; continue; } if (hep->mType < LLHUDObject::LL_HUD_EFFECT_BEAM) { - llwarns << "Trying to send effect of type " << hep->mType << " which isn't really an effect and shouldn't be in this list!" << llendl; + LL_WARNS() << "Trying to send effect of type " << hep->mType << " which isn't really an effect and shouldn't be in this list!" << LL_ENDL; continue; } if (hep->getNeedsSendToSim() && hep->getOriginatedHere()) @@ -105,18 +105,18 @@ void LLHUDManager::sendEffects() //static void LLHUDManager::shutdownClass() { - getInstance()->mHUDEffects.reset(); + getInstance()->mHUDEffects.clear(); } void LLHUDManager::cleanupEffects() { S32 i = 0; - while (i < mHUDEffects.count()) + while (i < mHUDEffects.size()) { if (mHUDEffects[i]->isDead()) { - mHUDEffects.remove(i); + mHUDEffects.erase(mHUDEffects.begin() + i); } else { @@ -140,7 +140,7 @@ LLHUDEffect *LLHUDManager::createViewerEffect(const U8 type, BOOL send_to_sim, B hep->setNeedsSendToSim(send_to_sim); hep->setOriginatedHere(originated_here); - mHUDEffects.put(hep); + mHUDEffects.push_back(hep); return hep; } @@ -159,20 +159,20 @@ void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_dat effectp = NULL; LLHUDEffect::getIDType(mesgsys, k, effect_id, effect_type); S32 i; - for (i = 0; i < LLHUDManager::getInstance()->mHUDEffects.count(); i++) + for (i = 0; i < LLHUDManager::getInstance()->mHUDEffects.size(); i++) { LLHUDEffect *cur_effectp = LLHUDManager::getInstance()->mHUDEffects[i]; if (!cur_effectp) { - llwarns << "Null effect in effect manager, skipping" << llendl; - LLHUDManager::getInstance()->mHUDEffects.remove(i); + LL_WARNS() << "Null effect in effect manager, skipping" << LL_ENDL; + LLHUDManager::getInstance()->mHUDEffects.erase(LLHUDManager::getInstance()->mHUDEffects.begin() + i); i--; continue; } if (cur_effectp->isDead()) { - // llwarns << "Dead effect in effect manager, removing" << llendl; - LLHUDManager::getInstance()->mHUDEffects.remove(i); + // LL_WARNS() << "Dead effect in effect manager, removing" << LL_ENDL; + LLHUDManager::getInstance()->mHUDEffects.erase(LLHUDManager::getInstance()->mHUDEffects.begin() + i); i--; continue; } @@ -180,7 +180,7 @@ void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_dat { if (cur_effectp->getType() != effect_type) { - llwarns << "Viewer effect update doesn't match old type!" << llendl; + LL_WARNS() << "Viewer effect update doesn't match old type!" << LL_ENDL; } effectp = cur_effectp; break; @@ -201,10 +201,10 @@ void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_dat } else { - llwarns << "Received viewer effect of type " << effect_type << " which isn't really an effect!" << llendl; + LL_WARNS() << "Received viewer effect of type " << effect_type << " which isn't really an effect!" << LL_ENDL; } } - //llinfos << "Got viewer effect: " << effect_id << llendl; + //LL_INFOS() << "Got viewer effect: " << effect_id << LL_ENDL; } diff --git a/indra/newview/llhudmanager.h b/indra/newview/llhudmanager.h index 09e79acbfc25fd600c350e2880e523e1736ca01a..9c5d49decd0aff979431310167fdacb95fcc520e 100755 --- a/indra/newview/llhudmanager.h +++ b/indra/newview/llhudmanager.h @@ -30,13 +30,8 @@ // Responsible for managing all HUD elements. #include "llhudobject.h" -#include "lldarrayptr.h" -class LLViewerObject; class LLHUDEffect; -//Ventrella 9/16/05 -class LLHUDAnimalControls; -// End Ventrella class LLMessageSystem; class LLHUDManager : public LLSingleton<LLHUDManager> @@ -59,7 +54,7 @@ class LLHUDManager : public LLSingleton<LLHUDManager> static LLColor4 sChildColor; protected: - LLDynamicArrayPtr<LLPointer<LLHUDEffect> > mHUDEffects; + std::vector<LLPointer<LLHUDEffect> > mHUDEffects; }; #endif // LL_LLHUDMANAGER_H diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index c3b49f739aa183d0aa881ba8701dfb1305172077..31d832e5244f6cbcb918621ebf593f8d930ba6c4 100755 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -30,6 +30,7 @@ #include "llhudnametag.h" #include "llrender.h" +#include "lltracerecording.h" #include "llagent.h" #include "llviewercontrol.h" @@ -537,7 +538,7 @@ void LLHUDNameTag::updateVisibility() if (!mSourceObject) { - //llwarns << "LLHUDNameTag::updateScreenPos -- mSourceObject is NULL!" << llendl; + //LL_WARNS() << "LLHUDNameTag::updateScreenPos -- mSourceObject is NULL!" << LL_ENDL; mVisible = TRUE; sVisibleTextObjects.push_back(LLPointer<LLHUDNameTag> (this)); return; @@ -745,8 +746,8 @@ void LLHUDNameTag::updateAll() current_screen_area += (F32)(textp->mSoftScreenRect.getWidth() * textp->mSoftScreenRect.getHeight()); } - LLStat* camera_vel_stat = LLViewerCamera::getInstance()->getVelocityStat(); - F32 camera_vel = camera_vel_stat->getCurrent(); + LLTrace::CountStatHandle<>* camera_vel_stat = LLViewerCamera::getVelocityStat(); + F32 camera_vel = LLTrace::get_frame_recording().getLastRecording().getPerSec(*camera_vel_stat); if (camera_vel > MAX_STABLE_CAMERA_VELOCITY) { return; @@ -814,7 +815,7 @@ void LLHUDNameTag::updateAll() VisibleTextObjectIterator this_object_it; for (this_object_it = sVisibleTextObjects.begin(); this_object_it != sVisibleTextObjects.end(); ++this_object_it) { - (*this_object_it)->mPositionOffset = lerp((*this_object_it)->mPositionOffset, (*this_object_it)->mTargetPositionOffset, LLCriticalDamp::getInterpolant(POSITION_DAMPING_TC)); + (*this_object_it)->mPositionOffset = lerp((*this_object_it)->mPositionOffset, (*this_object_it)->mTargetPositionOffset, LLSmoothInterpolation::getInterpolant(POSITION_DAMPING_TC)); } } diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp index 95d57d08d853c1d2c79f39c00c858b1065d83b0c..45fa09e1a1c35cfcb17249d0e650306cb5fb02b1 100755 --- a/indra/newview/llhudobject.cpp +++ b/indra/newview/llhudobject.cpp @@ -123,7 +123,7 @@ void LLHUDObject::cleanupHUDObjects() (*object_it)->markDead(); if ((*object_it)->getNumRefs() > 1) { - llinfos << "LLHUDObject " << (LLHUDObject *)(*object_it) << " type " << (S32)(*object_it)->getType() << " has " << (*object_it)->getNumRefs() << " refs!" << llendl; + LL_INFOS() << "LLHUDObject " << (LLHUDObject *)(*object_it) << " type " << (S32)(*object_it)->getType() << " has " << (*object_it)->getNumRefs() << " refs!" << LL_ENDL; } } sHUDObjects.clear(); @@ -146,7 +146,7 @@ LLHUDObject *LLHUDObject::addHUDObject(const U8 type) hud_objectp = new LLHUDNameTag(type); break; default: - llwarns << "Unknown type of hud object:" << (U32) type << llendl; + LL_WARNS() << "Unknown type of hud object:" << (U32) type << LL_ENDL; } if (hud_objectp) { @@ -242,7 +242,7 @@ LLHUDEffect *LLHUDObject::addHUDEffect(const U8 type) hud_objectp = new LLHUDEffectBlob(type); break; default: - llwarns << "Unknown type of hud effect:" << (U32) type << llendl; + LL_WARNS() << "Unknown type of hud effect:" << (U32) type << LL_ENDL; } if (hud_objectp) @@ -252,12 +252,12 @@ LLHUDEffect *LLHUDObject::addHUDEffect(const U8 type) return hud_objectp; } -static LLFastTimer::DeclareTimer FTM_HUD_UPDATE("Update Hud"); +static LLTrace::BlockTimerStatHandle FTM_HUD_UPDATE("Update Hud"); // static void LLHUDObject::updateAll() { - LLFastTimer ftm(FTM_HUD_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_HUD_UPDATE); LLHUDText::updateAll(); LLHUDIcon::updateAll(); LLHUDNameTag::updateAll(); diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 3c6bcd982995b9a19fb34ce228bb7241f5d6d259..f648d7baae16627a061a03d55912469cccf20ee9 100755 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -346,7 +346,7 @@ void LLHUDText::updateVisibility() if (!mSourceObject) { - //llwarns << "LLHUDText::updateScreenPos -- mSourceObject is NULL!" << llendl; + //LL_WARNS() << "LLHUDText::updateScreenPos -- mSourceObject is NULL!" << LL_ENDL; mVisible = TRUE; if (mOnHUDAttachment) { diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 59272d721fb6509b19f2a6210b288194357c8026..34ccab0302f879ccca93b47a0e27f7f5aa0453c4 100755 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -159,7 +159,7 @@ LLFloaterIMPanel::LLFloaterIMPanel(const std::string& session_label, mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID); break; default: - llwarns << "Unknown session type" << llendl; + LL_WARNS() << "Unknown session type" << LL_ENDL; xml_filename = "floater_instant_message.xml"; break; } @@ -396,8 +396,8 @@ class LLSessionInviteResponder : public LLHTTPClient::Responder void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llwarns << "Error inviting all agents to session [status:" - << statusNum << "]: " << content << llendl; + LL_WARNS() << "Error inviting all agents to session [status:" + << statusNum << "]: " << content << LL_ENDL; //throw something back to the viewer here? } @@ -417,7 +417,7 @@ BOOL LLFloaterIMPanel::inviteToSession(const std::vector<LLUUID>& ids) if( isInviteAllowed() && (count > 0) ) { - llinfos << "LLFloaterIMPanel::inviteToSession() - inviting participants" << llendl; + LL_INFOS() << "LLFloaterIMPanel::inviteToSession() - inviting participants" << LL_ENDL; std::string url = region->getCapability("ChatSessionRequest"); @@ -439,9 +439,9 @@ BOOL LLFloaterIMPanel::inviteToSession(const std::vector<LLUUID>& ids) } else { - llinfos << "LLFloaterIMPanel::inviteToSession -" + LL_INFOS() << "LLFloaterIMPanel::inviteToSession -" << " no need to invite agents for " - << mDialog << llendl; + << mDialog << LL_ENDL; // successful add, because everyone that needed to get added // was added. } @@ -778,7 +778,7 @@ void LLFloaterIMPanel::sendMsg() && (mDialog == IM_NOTHING_SPECIAL) && mOtherParticipantUUID.isNull()) { - llinfos << "Cannot send IM to everyone unless you're a god." << llendl; + LL_INFOS() << "Cannot send IM to everyone unless you're a god." << LL_ENDL; return; } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 70ffdc14ff78cdf795c98b03946c2dd728f9cf9e..af93778c102aca2a2a9488396ce6be78deb03b98 100755 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -68,6 +68,7 @@ #include "llviewerparcelmgr.h" #include "llconversationlog.h" #include "message.h" +#include "llviewerregion.h" const static std::string ADHOC_NAME_SUFFIX(" Conference"); @@ -254,7 +255,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg) // 0. nothing - exit if (("noaction" == user_preferences || ON_TOP_AND_ITEM_IS_SELECTED == conversations_floater_status) - && session_floater->isMessagePaneExpanded()) + && session_floater->isMessagePaneExpanded()) { return; } @@ -784,7 +785,7 @@ bool LLIMModel::LLIMSession::isOtherParticipantAvaline() return !mOtherParticipantIsAvatar; } -LLUUID LLIMModel::LLIMSession::generateOutgouigAdHocHash() const +LLUUID LLIMModel::LLIMSession::generateOutgoingAdHocHash() const { LLUUID hash = LLUUID::null; @@ -919,13 +920,13 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co { if (name.empty()) { - llwarns << "Attempt to create a new session with empty name; id = " << session_id << llendl; + LL_WARNS() << "Attempt to create a new session with empty name; id = " << session_id << LL_ENDL; return false; } if (findIMSession(session_id)) { - llwarns << "IM Session " << session_id << " already exists" << llendl; + LL_WARNS() << "IM Session " << session_id << " already exists" << LL_ENDL; return false; } @@ -971,7 +972,7 @@ void LLIMModel::getMessagesSilently(const LLUUID& session_id, std::list<LLSD>& m LLIMSession* session = findIMSession(session_id); if (!session) { - llwarns << "session " << session_id << "does not exist " << llendl; + LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL; return; } @@ -993,7 +994,7 @@ void LLIMModel::sendNoUnreadMessages(const LLUUID& session_id) LLIMSession* session = findIMSession(session_id); if (!session) { - llwarns << "session " << session_id << "does not exist " << llendl; + LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL; return; } @@ -1013,7 +1014,7 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, if (!session) { - llwarns << "session " << session_id << "does not exist " << llendl; + LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL; return false; } @@ -1088,7 +1089,7 @@ LLIMModel::LLIMSession* LLIMModel::addMessageSilently(const LLUUID& session_id, if (!session) { - llwarns << "session " << session_id << "does not exist " << llendl; + LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL; return NULL; } @@ -1125,7 +1126,7 @@ const std::string LLIMModel::getName(const LLUUID& session_id) const if (!session) { - llwarns << "session " << session_id << "does not exist " << llendl; + LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL; return LLTrans::getString("no_session_message"); } @@ -1137,7 +1138,7 @@ const S32 LLIMModel::getNumUnread(const LLUUID& session_id) const LLIMSession* session = findIMSession(session_id); if (!session) { - llwarns << "session " << session_id << "does not exist " << llendl; + LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL; return -1; } @@ -1149,7 +1150,7 @@ const LLUUID& LLIMModel::getOtherParticipantID(const LLUUID& session_id) const LLIMSession* session = findIMSession(session_id); if (!session) { - llwarns << "session " << session_id << " does not exist " << llendl; + LL_WARNS() << "session " << session_id << " does not exist " << LL_ENDL; return LLUUID::null; } @@ -1161,7 +1162,7 @@ EInstantMessage LLIMModel::getType(const LLUUID& session_id) const LLIMSession* session = findIMSession(session_id); if (!session) { - llwarns << "session " << session_id << "does not exist " << llendl; + LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL; return IM_COUNT; } @@ -1173,7 +1174,7 @@ LLVoiceChannel* LLIMModel::getVoiceChannel( const LLUUID& session_id ) const LLIMSession* session = findIMSession(session_id); if (!session) { - llwarns << "session " << session_id << "does not exist " << llendl; + LL_WARNS() << "session " << session_id << "does not exist " << LL_ENDL; return NULL; } @@ -1185,7 +1186,7 @@ LLIMSpeakerMgr* LLIMModel::getSpeakerManager( const LLUUID& session_id ) const LLIMSession* session = findIMSession(session_id); if (!session) { - llwarns << "session " << session_id << " does not exist " << llendl; + LL_WARNS() << "session " << session_id << " does not exist " << LL_ENDL; return NULL; } @@ -1197,7 +1198,7 @@ const std::string& LLIMModel::getHistoryFileName(const LLUUID& session_id) const LLIMSession* session = findIMSession(session_id); if (!session) { - llwarns << "session " << session_id << " does not exist " << llendl; + LL_WARNS() << "session " << session_id << " does not exist " << LL_ENDL; return LLStringUtil::null; } @@ -1484,8 +1485,8 @@ class LLStartConferenceChatResponder : public LLHTTPClient::Responder mAgents); } - llwarns << "LLStartConferenceChatResponder error [status:" - << statusNum << "]: " << content << llendl; + LL_WARNS() << "LLStartConferenceChatResponder error [status:" + << statusNum << "]: " << content << LL_ENDL; //else throw an error back to the client? //in theory we should have just have these error strings @@ -1633,9 +1634,9 @@ class LLViewerChatterBoxInvitationAcceptResponder : } void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) - { - llwarns << "LLViewerChatterBoxInvitationAcceptResponder error [status:" - << statusNum << "]: " << content << llendl; + { + LL_WARNS() << "LLViewerChatterBoxInvitationAcceptResponder error [status:" + << statusNum << "]: " << content << LL_ENDL; //throw something back to the viewer here? if ( gIMMgr ) { @@ -1697,7 +1698,7 @@ LLUUID LLIMMgr::computeSessionID( if (gAgent.isInGroup(session_id) && (session_id != other_participant_id)) { - llwarns << "Group session id different from group id: IM type = " << dialog << ", session id = " << session_id << ", group id = " << other_participant_id << llendl; + LL_WARNS() << "Group session id different from group id: IM type = " << dialog << ", session id = " << session_id << ", group id = " << other_participant_id << LL_ENDL; } return session_id; } @@ -2443,7 +2444,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload std::string correct_session_name = session_name; if (session_name.empty()) { - llwarns << "Received an empty session name from a server" << llendl; + LL_WARNS() << "Received an empty session name from a server" << LL_ENDL; switch(type){ case IM_SESSION_CONFERENCE_START: @@ -2465,10 +2466,10 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload correct_session_name.append(ADHOC_NAME_SUFFIX); } } - llinfos << "Corrected session name is " << correct_session_name << llendl; + LL_INFOS() << "Corrected session name is " << correct_session_name << LL_ENDL; break; default: - llwarning("Received an empty session name from a server and failed to generate a new proper session name", 0); + LL_WARNS() << "Received an empty session name from a server and failed to generate a new proper session name" << LL_ENDL; break; } } @@ -2719,10 +2720,10 @@ void LLIMMgr::addMessage( // code, but the session has to be established inside the server before it can be left. if (LLMuteList::getInstance()->isMuted(other_participant_id) && !from_linden) { - llwarns << "Leaving IM session from initiating muted resident " << from << llendl; + LL_WARNS() << "Leaving IM session from initiating muted resident " << from << LL_ENDL; if(!gIMMgr->leaveSession(new_session_id)) { - llinfos << "Session " << new_session_id << " does not exist." << llendl; + LL_INFOS() << "Session " << new_session_id << " does not exist." << LL_ENDL; } return; } @@ -2857,8 +2858,8 @@ LLUUID LLIMMgr::addSession( EInstantMessage dialog, const LLUUID& other_participant_id, bool voice) { - LLDynamicArray<LLUUID> ids; - ids.put(other_participant_id); + std::vector<LLUUID> ids; + ids.push_back(other_participant_id); LLUUID session_id = addSession(name, dialog, other_participant_id, ids, voice); return session_id; } @@ -2869,17 +2870,17 @@ LLUUID LLIMMgr::addSession( const std::string& name, EInstantMessage dialog, const LLUUID& other_participant_id, - const LLDynamicArray<LLUUID>& ids, bool voice, + const std::vector<LLUUID>& ids, bool voice, const LLUUID& floater_id) { - if (0 == ids.getLength()) + if (ids.empty()) { return LLUUID::null; } if (name.empty()) { - llwarning("Session name cannot be null!", 0); + LL_WARNS() << "Session name cannot be null!" << LL_ENDL; return LLUUID::null; } @@ -2927,7 +2928,7 @@ LLUUID LLIMMgr::addSession( //we don't need to show notes about online/offline, mute/unmute users' statuses for existing sessions if (!new_session) return session_id; - llinfos << "LLIMMgr::addSession, new session added, name = " << name << ", session id = " << session_id << llendl; + LL_INFOS() << "LLIMMgr::addSession, new session added, name = " << name << ", session id = " << session_id << LL_ENDL; //Per Plan's suggestion commented "explicit offline status warning" out to make Dessie happier (see EXT-3609) //*TODO After February 2010 remove this commented out line if no one will be missing that warning @@ -2964,7 +2965,7 @@ void LLIMMgr::removeSession(const LLUUID& session_id) LLIMModel::getInstance()->clearSession(session_id); - llinfos << "LLIMMgr::removeSession, session removed, session id = " << session_id << llendl; + LL_INFOS() << "LLIMMgr::removeSession, session removed, session id = " << session_id << LL_ENDL; notifyObserverSessionRemoved(session_id); } @@ -3029,7 +3030,7 @@ void LLIMMgr::inviteToSession( { if (voice_invite && "VoiceInviteQuestionDefault" == question_type) { - llinfos << "Rejecting voice call from initiating muted resident " << caller_name << llendl; + LL_INFOS() << "Rejecting voice call from initiating muted resident " << caller_name << LL_ENDL; LLIncomingCallDialog::processCallResponse(1, payload); } return; @@ -3319,9 +3320,9 @@ bool LLIMMgr::isNonFriendSessionNotified(const LLUUID& session_id) void LLIMMgr::noteOfflineUsers( const LLUUID& session_id, - const LLDynamicArray<LLUUID>& ids) + const std::vector<LLUUID>& ids) { - S32 count = ids.count(); + S32 count = ids.size(); if(count == 0) { const std::string& only_user = LLTrans::getString("only_user_message"); @@ -3334,11 +3335,11 @@ void LLIMMgr::noteOfflineUsers( LLIMModel& im_model = LLIMModel::instance(); for(S32 i = 0; i < count; ++i) { - info = at.getBuddyInfo(ids.get(i)); + info = at.getBuddyInfo(ids.at(i)); LLAvatarName av_name; if (info && !info->isOnline() - && LLAvatarNameCache::get(ids.get(i), &av_name)) + && LLAvatarNameCache::get(ids.at(i), &av_name)) { LLUIString offline = LLTrans::getString("offline_message"); // Use display name only because this user is your friend @@ -3350,7 +3351,7 @@ void LLIMMgr::noteOfflineUsers( } void LLIMMgr::noteMutedUsers(const LLUUID& session_id, - const LLDynamicArray<LLUUID>& ids) + const std::vector<LLUUID>& ids) { // Don't do this if we don't have a mute list. LLMuteList *ml = LLMuteList::getInstance(); @@ -3359,14 +3360,14 @@ void LLIMMgr::noteMutedUsers(const LLUUID& session_id, return; } - S32 count = ids.count(); + S32 count = ids.size(); if(count > 0) { LLIMModel* im_model = LLIMModel::getInstance(); for(S32 i = 0; i < count; ++i) { - if( ml->isMuted(ids.get(i)) ) + if( ml->isMuted(ids.at(i)) ) { LLUIString muted = LLTrans::getString("muted_message"); diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index da6039a3ae339e291499462b3c35343c4ddeb4d0..1426bada956ab8f84003986c85e74771de76326a 100755 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -34,12 +34,10 @@ #include "lllogchat.h" #include "llvoicechannel.h" - class LLAvatarName; class LLFriendObserver; class LLCallDialogManager; class LLIMSpeakerMgr; - /** * Timeout Timer for outgoing Ad-Hoc/Group IM sessions which being initialized by the server */ @@ -95,7 +93,7 @@ class LLIMModel : public LLSingleton<LLIMModel> bool isGroupSessionType() const { return mSessionType == GROUP_SESSION;} bool isAvalineSessionType() const { return mSessionType == AVALINE_SESSION;} - LLUUID generateOutgouigAdHocHash() const; + LLUUID generateOutgoingAdHocHash() const; //*TODO make private /** ad-hoc sessions involve sophisticated chat history file naming schemes */ @@ -355,7 +353,7 @@ class LLIMMgr : public LLSingleton<LLIMMgr> LLUUID addSession(const std::string& name, EInstantMessage dialog, const LLUUID& other_participant_id, - const LLDynamicArray<LLUUID>& ids, bool voice = false, + const std::vector<LLUUID>& ids, bool voice = false, const LLUUID& floater_id = LLUUID::null); /** @@ -458,8 +456,8 @@ class LLIMMgr : public LLSingleton<LLIMMgr> // prints a simple message if they are not online. Used to help // reduce 'hello' messages to the linden employees unlucky enough // to have their calling card in the default inventory. - void noteOfflineUsers(const LLUUID& session_id, const LLDynamicArray<LLUUID>& ids); - void noteMutedUsers(const LLUUID& session_id, const LLDynamicArray<LLUUID>& ids); + void noteOfflineUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids); + void noteMutedUsers(const LLUUID& session_id, const std::vector<LLUUID>& ids); void processIMTypingCore(const LLIMInfo* im_info, BOOL typing); @@ -557,7 +555,7 @@ class LLIncomingCallDialog : public LLCallDialog mAvatarNameCacheConnection.disconnect(); } } - + /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); diff --git a/indra/newview/llinspect.cpp b/indra/newview/llinspect.cpp index 14382e82d7f793096100d886b2c04f39aa60264b..e6cb068613c8bb1e1d6cd253d16e332fd39c0f81 100755 --- a/indra/newview/llinspect.cpp +++ b/indra/newview/llinspect.cpp @@ -59,7 +59,7 @@ void LLInspect::draw() } else if (mCloseTimer.getStarted()) { - F32 alpha = clamp_rescale(mCloseTimer.getElapsedTimeF32(), 0.f, FADE_TIME, 1.f, 0.f); + F32 alpha = clamp_rescale(mCloseTimer.getElapsedTimeF32(), 0.f, FADE_TIME(), 1.f, 0.f); LLViewDrawContext context(alpha); LLFloater::draw(); if (mCloseTimer.getElapsedTimeF32() > FADE_TIME) diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 9c6db3676f56baf328126c966e249388848c52e2..b75140238edd3628d71b68b2e2ea06d04152b566 100755 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -295,7 +295,7 @@ void LLInspectAvatar::processAvatarData(LLAvatarData* data) /* prep# virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) - llwarns << "MuteVoiceResponder error [status:" << status << "]: " << content << llendl; + LL_WARNS() << "MuteVoiceResponder error [status:" << status << "]: " << content << LL_ENDL; */ void LLInspectAvatar::updateVolumeSlider() diff --git a/indra/newview/llinspecttoast.cpp b/indra/newview/llinspecttoast.cpp index f4fe5dec01437692ba104e5fc0855e32e455944a..0bc7bd188d486461a3e30c8ece018b95222c835d 100755 --- a/indra/newview/llinspecttoast.cpp +++ b/indra/newview/llinspecttoast.cpp @@ -63,7 +63,7 @@ LLInspectToast::LLInspectToast(const LLSD& notification_id) : mScreenChannel = dynamic_cast<LLScreenChannel*>(channel); if(NULL == mScreenChannel) { - llwarns << "Could not get requested screen channel." << llendl; + LL_WARNS() << "Could not get requested screen channel." << LL_ENDL; return; } @@ -83,7 +83,7 @@ void LLInspectToast::onOpen(const LLSD& notification_id) LLToast* toast = mScreenChannel->getToastByNotificationID(notification_id); if (toast == NULL) { - llwarns << "Could not get requested toast from screen channel." << llendl; + LL_WARNS() << "Could not get requested toast from screen channel." << LL_ENDL; return; } mConnection = toast->setOnToastDestroyedCallback(boost::bind(&LLInspectToast::onToastDestroy, this, _1)); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 44943d8722b0635bf034bd3e4c0864077d41107c..c538fb6c6892565cdd9a4bfa23e4cbe13f79040e 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -70,6 +70,7 @@ #include "llviewermenu.h" #include "llviewermessage.h" #include "llviewerobjectlist.h" +#include "llviewerregion.h" #include "llviewerwindow.h" #include "llvoavatarself.h" #include "llwearablelist.h" @@ -328,7 +329,7 @@ void LLInvFVBridge::removeBatch(std::vector<LLFolderViewModelItem*>& batch) if (cat) { gInventory.collectDescendents( cat->getUUID(), descendent_categories, descendent_items, FALSE ); - for (j=0; j<descendent_items.count(); j++) + for (j=0; j<descendent_items.size(); j++) { if(LLAssetType::AT_GESTURE == descendent_items[j]->getType()) { @@ -490,12 +491,12 @@ BOOL LLInvFVBridge::isClipboardPasteable() const } // In normal mode, we need to check each element of the clipboard to know if we can paste or not - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.count(); + S32 count = objects.size(); for(S32 i = 0; i < count; i++) { - const LLUUID &item_id = objects.get(i); + const LLUUID &item_id = objects.at(i); // Folders are pastable if all items in there are copyable const LLInventoryCategory *cat = model->getCategory(item_id); @@ -530,12 +531,12 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const return FALSE; } - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.count(); + S32 count = objects.size(); for(S32 i = 0; i < count; i++) { - const LLInventoryItem *item = model->getItem(objects.get(i)); + const LLInventoryItem *item = model->getItem(objects.at(i)); if (item) { if (!LLAssetType::lookupCanLink(item->getActualType())) @@ -543,7 +544,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const return FALSE; } } - const LLViewerInventoryCategory *cat = model->getCategory(objects.get(i)); + const LLViewerInventoryCategory *cat = model->getCategory(objects.at(i)); if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { return FALSE; @@ -733,7 +734,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLInvFVBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLInvFVBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; if(isItemInTrash()) @@ -861,7 +862,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const } *id = obj->getUUID(); - //object_ids.put(obj->getUUID()); + //object_ids.push_back(obj->getUUID()); if (*type == DAD_CATEGORY) { @@ -1032,7 +1033,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_TEXTURE: if(!(inv_type == LLInventoryType::IT_TEXTURE || inv_type == LLInventoryType::IT_SNAPSHOT)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLTextureBridge(inventory, root, uuid, inv_type); break; @@ -1040,7 +1041,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_SOUND: if(!(inv_type == LLInventoryType::IT_SOUND)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLSoundBridge(inventory, root, uuid); break; @@ -1048,7 +1049,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_LANDMARK: if(!(inv_type == LLInventoryType::IT_LANDMARK)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLLandmarkBridge(inventory, root, uuid, flags); break; @@ -1056,7 +1057,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_CALLINGCARD: if(!(inv_type == LLInventoryType::IT_CALLINGCARD)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLCallingCardBridge(inventory, root, uuid); break; @@ -1064,7 +1065,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_SCRIPT: if(!(inv_type == LLInventoryType::IT_LSL)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLItemBridge(inventory, root, uuid); break; @@ -1072,7 +1073,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_OBJECT: if(!(inv_type == LLInventoryType::IT_OBJECT || inv_type == LLInventoryType::IT_ATTACHMENT)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLObjectBridge(inventory, root, uuid, inv_type, flags); break; @@ -1080,7 +1081,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_NOTECARD: if(!(inv_type == LLInventoryType::IT_NOTECARD)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLNotecardBridge(inventory, root, uuid); break; @@ -1088,7 +1089,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_ANIMATION: if(!(inv_type == LLInventoryType::IT_ANIMATION)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLAnimationBridge(inventory, root, uuid); break; @@ -1096,7 +1097,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_GESTURE: if(!(inv_type == LLInventoryType::IT_GESTURE)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLGestureBridge(inventory, root, uuid); break; @@ -1104,7 +1105,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_LSL_TEXT: if(!(inv_type == LLInventoryType::IT_LSL)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLLSLTextBridge(inventory, root, uuid); break; @@ -1113,7 +1114,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_BODYPART: if(!(inv_type == LLInventoryType::IT_WEARABLE)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, (LLWearableType::EType)flags); break; @@ -1134,19 +1135,19 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, case LLAssetType::AT_MESH: if(!(inv_type == LLInventoryType::IT_MESH)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLMeshBridge(inventory, root, uuid); break; case LLAssetType::AT_IMAGE_TGA: case LLAssetType::AT_IMAGE_JPEG: - //llwarns << LLAssetType::lookup(asset_type) << " asset type is unhandled for uuid " << uuid << llendl; + //LL_WARNS() << LLAssetType::lookup(asset_type) << " asset type is unhandled for uuid " << uuid << LL_ENDL; break; default: - llinfos << "Unhandled asset type (llassetstorage.h): " - << (S32)asset_type << " (" << LLAssetType::lookup(asset_type) << ")" << llendl; + LL_INFOS() << "Unhandled asset type (llassetstorage.h): " + << (S32)asset_type << " (" << LLAssetType::lookup(asset_type) << ")" << LL_ENDL; break; } @@ -1427,7 +1428,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) } else if (isMarketplaceCopyAction(action)) { - llinfos << "Copy item to marketplace action!" << llendl; + LL_INFOS() << "Copy item to marketplace action!" << LL_ENDL; LLInventoryItem* itemp = model->getItem(mUUID); if (!itemp) return; @@ -1626,7 +1627,7 @@ LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const if (get_is_item_worn(mUUID)) { - // llinfos << "BOLD" << llendl; + // LL_INFOS() << "BOLD" << LL_ENDL; font |= LLFontGL::BOLD; } else if(item && item->getIsLinkType()) @@ -2080,15 +2081,15 @@ BOOL LLFolderBridge::isClipboardPasteable() const return FALSE; } - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); const LLViewerInventoryCategory *current_cat = getCategory(); // Search for the direct descendent of current Friends subfolder among all pasted items, // and return false if is found. - for(S32 i = objects.count() - 1; i >= 0; --i) + for(S32 i = objects.size() - 1; i >= 0; --i) { - const LLUUID &obj_id = objects.get(i); + const LLUUID &obj_id = objects.at(i); if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) ) { return FALSE; @@ -2118,12 +2119,12 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const { const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat ); const LLUUID ¤t_cat_id = current_cat->getUUID(); - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - S32 count = objects.count(); + S32 count = objects.size(); for(S32 i = 0; i < count; i++) { - const LLUUID &obj_id = objects.get(i); + const LLUUID &obj_id = objects.at(i); const LLInventoryCategory *cat = model->getCategory(obj_id); if (cat) { @@ -2197,9 +2198,9 @@ int get_folder_levels(LLInventoryCategory* inv_cat) int max_child_levels = 0; - for (S32 i=0; i < cats->count(); ++i) + for (S32 i=0; i < cats->size(); ++i) { - LLInventoryCategory* category = cats->get(i); + LLInventoryCategory* category = cats->at(i); max_child_levels = llmax(max_child_levels, get_folder_levels(category)); } @@ -2227,7 +2228,7 @@ int get_folder_path_length(const LLUUID& ancestor_id, const LLUUID& descendant_i category = gInventory.getCategory(parent_id); } - llwarns << "get_folder_path_length() couldn't trace a path from the descendant to the ancestor" << llendl; + LL_WARNS() << "get_folder_path_length() couldn't trace a path from the descendant to the ancestor" << LL_ENDL; return -1; } @@ -2309,7 +2310,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (is_movable) { model->collectDescendents(cat_id, descendent_categories, descendent_items, FALSE); - for (S32 i=0; i < descendent_categories.count(); ++i) + for (S32 i=0; i < descendent_categories.size(); ++i) { LLInventoryCategory* category = descendent_categories[i]; if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) @@ -2322,7 +2323,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } if (is_movable && move_is_into_trash) { - for (S32 i=0; i < descendent_items.count(); ++i) + for (S32 i=0; i < descendent_items.size(); ++i) { LLInventoryItem* item = descendent_items[i]; if (get_is_item_worn(item->getUUID())) @@ -2334,7 +2335,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } if (is_movable && move_is_into_landmarks) { - for (S32 i=0; i < descendent_items.count(); ++i) + for (S32 i=0; i < descendent_items.size(); ++i) { LLViewerInventoryItem* item = descendent_items[i]; @@ -2358,7 +2359,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } else { - int dragged_folder_count = descendent_categories.count(); + int dragged_folder_count = descendent_categories.size(); int existing_item_count = 0; int existing_folder_count = 0; @@ -2397,8 +2398,8 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, model->collectDescendents(master_folder->getUUID(), existing_categories, existing_items, FALSE); - existing_folder_count += existing_categories.count(); - existing_item_count += existing_items.count(); + existing_folder_count += existing_categories.size(); + existing_item_count += existing_items.size(); } else { @@ -2408,7 +2409,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } const int nested_folder_count = existing_folder_count + dragged_folder_count; - const int nested_item_count = existing_item_count + descendent_items.count(); + const int nested_item_count = existing_item_count + descendent_items.size(); if (nested_folder_count > gSavedSettings.getU32("InventoryOutboxMaxFolderCount")) { @@ -2423,7 +2424,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, if (is_movable == TRUE) { - for (S32 i=0; i < descendent_items.count(); ++i) + for (S32 i=0; i < descendent_items.size(); ++i) { LLInventoryItem* item = descendent_items[i]; if (!can_move_to_outbox(item, tooltip_msg)) @@ -2479,7 +2480,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, // Look for any gestures and deactivate them if (move_is_into_trash) { - for (S32 i=0; i < descendent_items.count(); i++) + for (S32 i=0; i < descendent_items.size(); i++) { LLInventoryItem* item = descendent_items[i]; if (item->getType() == LLAssetType::AT_GESTURE @@ -2618,7 +2619,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, LLViewerObject* object = gObjectList.findObject(object_id); if(!object) { - llinfos << "Object not found for drop." << llendl; + LL_INFOS() << "Object not found for drop." << LL_ENDL; return FALSE; } @@ -2629,7 +2630,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, if (inventory_objects.empty()) { - llinfos << "Object contents not found for drop." << llendl; + LL_INFOS() << "Object contents not found for drop." << LL_ENDL; return FALSE; } @@ -2645,7 +2646,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id, LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(it->get()); if (!item) { - llwarns << "Invalid inventory item for drop" << llendl; + LL_WARNS() << "Invalid inventory item for drop" << LL_ENDL; continue; } @@ -2713,7 +2714,7 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) // Bail out immediately if no descendents if( mComplete.empty() ) { - llwarns << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << llendl; + LL_WARNS() << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << LL_ENDL; if (clear_observer) { gInventory.removeObserver(this); @@ -2743,13 +2744,13 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) S32 item_count(0); if( item_array ) { - item_count = item_array->count(); + item_count = item_array->size(); } S32 cat_count(0); if( cat_array ) { - cat_count = cat_array->count(); + cat_count = cat_array->size(); } // Move to next if current folder empty @@ -2767,7 +2768,7 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) { for (S32 i = 0; i < item_count; ++i) { - ids.push_back(item_array->get(i)->getUUID()); + ids.push_back(item_array->at(i)->getUUID()); } outfit = new LLRightClickInventoryFetchObserver(ids); } @@ -2776,7 +2777,7 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) { for (S32 i = 0; i < cat_count; ++i) { - ids.push_back(cat_array->get(i)->getUUID()); + ids.push_back(cat_array->at(i)->getUUID()); } categories = new LLRightClickInventoryFetchDescendentsObserver(ids); } @@ -2871,8 +2872,8 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) LLViewerInventoryCategory* category = gInventory.getCategory(mCatID); if (NULL == category) { - llwarns << "gInventory.getCategory(" << mCatID - << ") was NULL" << llendl; + LL_WARNS() << "gInventory.getCategory(" << mCatID + << ") was NULL" << LL_ENDL; } else { @@ -2978,7 +2979,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) #endif else if (isMarketplaceCopyAction(action)) { - llinfos << "Copy folder to marketplace action!" << llendl; + LL_INFOS() << "Copy folder to marketplace action!" << LL_ENDL; LLInventoryCategory * cat = gInventory.getCategory(mUUID); if (!cat) return; @@ -2989,7 +2990,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) #if ENABLE_MERCHANT_SEND_TO_MARKETPLACE_CONTEXT_MENU else if (isMarketplaceSendAction(action)) { - llinfos << "Send to marketplace action!" << llendl; + LL_INFOS() << "Send to marketplace action!" << LL_ENDL; LLInventoryCategory * cat = gInventory.getCategory(mUUID); if (!cat) return; @@ -3001,7 +3002,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) void LLFolderBridge::openItem() { - lldebugs << "LLFolderBridge::openItem()" << llendl; + LL_DEBUGS() << "LLFolderBridge::openItem()" << LL_ENDL; LLInventoryModel* model = getInventoryModel(); if(!model) return; if(mUUID.isNull()) return; @@ -3185,7 +3186,7 @@ void LLFolderBridge::pasteFromClipboard() const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id); - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); if (move_is_into_outbox) @@ -3198,7 +3199,7 @@ void LLFolderBridge::pasteFromClipboard() BOOL can_list = TRUE; - for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin(); + for (std::vector<LLUUID>::const_iterator iter = objects.begin(); (iter != objects.end()) && (can_list == TRUE); ++iter) { @@ -3229,7 +3230,7 @@ void LLFolderBridge::pasteFromClipboard() const LLUUID parent_id(mUUID); - for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin(); + for (std::vector<LLUUID>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) { @@ -3321,9 +3322,9 @@ void LLFolderBridge::pasteLinkFromClipboard() const LLUUID parent_id(mUUID); - LLDynamicArray<LLUUID> objects; + std::vector<LLUUID> objects; LLClipboard::instance().pasteFromClipboard(objects); - for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin(); + for (std::vector<LLUUID>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) { @@ -3384,7 +3385,7 @@ BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInv item_array, LLInventoryModel::EXCLUDE_TRASH, is_type); - return ((item_array.count() > 0) ? TRUE : FALSE ); + return ((item_array.size() > 0) ? TRUE : FALSE ); } void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items, menuentry_vec_t& disabled_items) @@ -3636,7 +3637,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - lldebugs << "LLFolderBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLFolderBridge::buildContextMenu()" << LL_ENDL; LLInventoryModel* model = getInventoryModel(); if(!model) return; @@ -3665,7 +3666,7 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, { LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; - //llinfos << "LLFolderBridge::dragOrDrop()" << llendl; + //LL_INFOS() << "LLFolderBridge::dragOrDrop()" << LL_ENDL; BOOL accept = FALSE; switch(cargo_type) { @@ -3714,7 +3715,7 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, case DAD_NONE: break; default: - llwarns << "Unhandled cargo type for drag&drop " << cargo_type << llendl; + LL_WARNS() << "Unhandled cargo type for drag&drop " << cargo_type << LL_ENDL; break; } return accept; @@ -4076,7 +4077,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, gInventory.collectDescendents(master_folder->getUUID(), existing_categories, existing_items, FALSE); - existing_item_count += existing_items.count(); + existing_item_count += existing_items.size(); } if (existing_item_count > gSavedSettings.getU32("InventoryOutboxMaxItemCount")) @@ -4184,7 +4185,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, object = gObjectList.findObject(inv_item->getParentUUID()); if (!object) { - llinfos << "Object not found for drop." << llendl; + LL_INFOS() << "Object not found for drop." << LL_ENDL; return FALSE; } @@ -4350,7 +4351,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, } else { - llwarns << "unhandled drag source" << llendl; + LL_WARNS() << "unhandled drag source" << LL_ENDL; } return accept; } @@ -4373,8 +4374,8 @@ bool check_category(LLInventoryModel* model, LLInventoryModel::item_array_t descendent_items; model->collectDescendents(cat_id, descendent_categories, descendent_items, TRUE); - S32 num_descendent_categories = descendent_categories.count(); - S32 num_descendent_items = descendent_items.count(); + S32 num_descendent_categories = descendent_categories.size(); + S32 num_descendent_items = descendent_items.size(); if (num_descendent_categories + num_descendent_items == 0) { @@ -4455,7 +4456,7 @@ bool LLTextureBridge::canSaveTexture(void) void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLTextureBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLTextureBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; if(isItemInTrash()) @@ -4525,7 +4526,7 @@ void LLSoundBridge::openSoundPreview(void* which) void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLSoundBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLSoundBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -4586,7 +4587,7 @@ void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - lldebugs << "LLLandmarkBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLLandmarkBridge::buildContextMenu()" << LL_ENDL; if(isOutboxFolder()) { addOutboxContextMenuOptions(flags, items, disabled_items); @@ -4829,7 +4830,7 @@ void LLCallingCardBridge::openItem() void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLCallingCardBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLCallingCardBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -5097,7 +5098,7 @@ BOOL LLGestureBridge::removeItem() void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLGestureBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLGestureBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; if(isItemInTrash()) @@ -5157,7 +5158,7 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) menuentry_vec_t items; menuentry_vec_t disabled_items; - lldebugs << "LLAnimationBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLAnimationBridge::buildContextMenu()" << LL_ENDL; if(isOutboxFolder()) { items.push_back(std::string("Delete")); @@ -5340,7 +5341,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach (gAgentAvatarp->attachmentWasRequested(item_id) || gAgentAvatarp->isWearingAttachment(item_id))) { - llwarns << "duplicate attachment request, ignoring" << llendl; + LL_WARNS() << "duplicate attachment request, ignoring" << LL_ENDL; return; } gAgentAvatarp->addAttachmentRequest(item_id); @@ -5652,7 +5653,7 @@ void LLWearableBridge::openItem() void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLWearableBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLWearableBridge::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; if(isItemInTrash()) @@ -5816,7 +5817,7 @@ void LLWearableBridge::onWearOnAvatarArrived( LLViewerWearable* wearable, void* } else { - llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; + LL_INFOS() << "By the time wearable asset arrived, its inv item already pointed to a different asset." << LL_ENDL; } } } @@ -5843,7 +5844,7 @@ void LLWearableBridge::onWearAddOnAvatarArrived( LLViewerWearable* wearable, voi } else { - llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; + LL_INFOS() << "By the time wearable asset arrived, its inv item already pointed to a different asset." << LL_ENDL; } } } @@ -5887,7 +5888,7 @@ BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data) void LLWearableBridge::removeFromAvatar() { - llwarns << "safe to remove?" << llendl; + LL_WARNS() << "safe to remove?" << LL_ENDL; if (get_is_item_worn(mUUID)) { LLAppearanceMgr::instance().removeItemFromAvatar(mUUID); @@ -5905,7 +5906,7 @@ std::string LLLinkItemBridge::sPrefix("Link: "); void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { // *TODO: Translate - lldebugs << "LLLink::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLLink::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; @@ -5945,7 +5946,7 @@ void LLMeshBridge::openItem() void LLMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLMeshBridge::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLMeshBridge::buildContextMenu()" << LL_ENDL; std::vector<std::string> items; std::vector<std::string> disabled_items; @@ -6002,7 +6003,7 @@ LLUIImagePtr LLLinkFolderBridge::getIcon() const void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { // *TODO: Translate - lldebugs << "LLLink::buildContextMenu()" << llendl; + LL_DEBUGS() << "LLLink::buildContextMenu()" << LL_ENDL; menuentry_vec_t items; menuentry_vec_t disabled_items; diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index b666331a2c2a436a822fbdb55e71dc7242d92d34..000eee3317e5f735386045a0769cde13eeadeb5b 100755 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -42,7 +42,7 @@ #include "llclipboard.h" #include "lltrans.h" -LLFastTimer::DeclareTimer FT_FILTER_CLIPBOARD("Filter Clipboard"); +LLTrace::BlockTimerStatHandle FT_FILTER_CLIPBOARD("Filter Clipboard"); LLInventoryFilter::FilterOps::FilterOps(const Params& p) : mFilterObjectTypes(p.object_types), @@ -113,7 +113,7 @@ bool LLInventoryFilter::checkFolder(const LLFolderViewModelItem* item) const const LLFolderViewModelItemInventory* listener = dynamic_cast<const LLFolderViewModelItemInventory*>(item); if (!listener) { - llerrs << "Folder view event listener not found." << llendl; + LL_ERRS() << "Folder view event listener not found." << LL_ENDL; return false; } @@ -310,7 +310,7 @@ bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const { if (LLClipboard::instance().isCutMode()) { - LLFastTimer ft(FT_FILTER_CLIPBOARD); + LL_RECORD_BLOCK_TIME(FT_FILTER_CLIPBOARD); LLUUID current_id = object_id; LLInventoryObject *current_object = gInventory.getObject(object_id); while (current_id.notNull() && current_object) @@ -738,7 +738,7 @@ void LLInventoryFilter::setModified(EFilterModified behavior) mFirstSuccessGeneration = mCurrentGeneration; break; default: - llerrs << "Bad filter behavior specified" << llendl; + LL_ERRS() << "Bad filter behavior specified" << LL_ENDL; } } @@ -1086,7 +1086,7 @@ bool LLInventoryFilter::FilterOps::DateRange::validateBlock( bool emit_errors { if (emit_errors) { - llwarns << "max_date should be greater or equal to min_date" << llendl; + LL_WARNS() << "max_date should be greater or equal to min_date" << LL_ENDL; } valid = false; } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index f1a4889f5ac141728fb2b565b31383207ede20c2..f16b9330be2150b3c9e165854543e5522ac59bb1 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -436,7 +436,7 @@ void show_item_original(const LLUUID& item_uuid) LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory"); if (!floater_inventory) { - llwarns << "Could not find My Inventory floater" << llendl; + LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL; return; } @@ -928,7 +928,7 @@ bool LLFindNonRemovableObjects::operator()(LLInventoryCategory* cat, LLInventory return !get_is_category_removable(&gInventory, cat->getUUID()); } - llwarns << "Not a category and not an item?" << llendl; + LL_WARNS() << "Not a category and not an item?" << LL_ENDL; return false; } diff --git a/indra/newview/llinventoryicon.cpp b/indra/newview/llinventoryicon.cpp index 02a2475cfd44831532a232886c173baa6bdd3992..b7c4ec6f8b8132caeddfb5b2dd66bb11c047d26c 100755 --- a/indra/newview/llinventoryicon.cpp +++ b/indra/newview/llinventoryicon.cpp @@ -32,6 +32,7 @@ #include "lldictionary.h" #include "llinventorydefines.h" #include "llui.h" +#include "lluiimage.h" #include "llwearabletype.h" struct IconEntry : public LLDictionaryEntry @@ -49,6 +50,8 @@ class LLIconDictionary : public LLSingleton<LLIconDictionary>, LLIconDictionary(); }; +typedef LLPointer<LLUIImage> LLUIImagePtr; + LLIconDictionary::LLIconDictionary() { addEntry(LLInventoryType::ICONNAME_TEXTURE, new IconEntry("Inv_Texture")); diff --git a/indra/newview/llinventoryicon.h b/indra/newview/llinventoryicon.h index 2197c53bb8395c500ec97705f7cc1f01673c4a53..bc09e32087dd0de9fcd9574d04ba3c2939f8f438 100755 --- a/indra/newview/llinventoryicon.h +++ b/indra/newview/llinventoryicon.h @@ -30,7 +30,6 @@ #include "llassettype.h" #include "llinventorytype.h" -#include "lluiimage.h" class LLInventoryIcon { @@ -41,11 +40,11 @@ class LLInventoryIcon BOOL item_is_multi = FALSE); static const std::string& getIconName(LLInventoryType::EIconName idx); - static LLUIImagePtr getIcon(LLAssetType::EType asset_type, + static LLPointer<class LLUIImage> getIcon(LLAssetType::EType asset_type, LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE, U32 misc_flag = 0, // different meanings depending on item type BOOL item_is_multi = FALSE); - static LLUIImagePtr getIcon(LLInventoryType::EIconName idx); + static LLPointer<class LLUIImage> getIcon(LLInventoryType::EIconName idx); protected: static LLInventoryType::EIconName assignWearableIcon(U32 misc_flag); diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp index 348d7ebcec1a3817309693519192e61b18592555..36e1cc97d1c6c582baaff39164cf56bba7420114 100755 --- a/indra/newview/llinventoryitemslist.cpp +++ b/indra/newview/llinventoryitemslist.cpp @@ -133,11 +133,11 @@ void LLInventoryItemsList::idle(void* user_data) } } -LLFastTimer::DeclareTimer FTM_INVENTORY_ITEMS_REFRESH("Inventory List Refresh"); +LLTrace::BlockTimerStatHandle FTM_INVENTORY_ITEMS_REFRESH("Inventory List Refresh"); void LLInventoryItemsList::refresh() { - LLFastTimer _(FTM_INVENTORY_ITEMS_REFRESH); + LL_RECORD_BLOCK_TIME(FTM_INVENTORY_ITEMS_REFRESH); static const unsigned ADD_LIMIT = 20; uuid_vec_t added_items; @@ -208,7 +208,7 @@ void LLInventoryItemsList::addNewItem(LLViewerInventoryItem* item, bool rearrang { if (!item) { - llwarns << "No inventory item. Couldn't create flat list item." << llendl; + LL_WARNS() << "No inventory item. Couldn't create flat list item." << LL_ENDL; llassert(item != NULL); } @@ -219,7 +219,7 @@ void LLInventoryItemsList::addNewItem(LLViewerInventoryItem* item, bool rearrang bool is_item_added = addItem(list_item, item->getUUID(), ADD_BOTTOM, rearrange); if (!is_item_added) { - llwarns << "Couldn't add flat list item." << llendl; + LL_WARNS() << "Couldn't add flat list item." << LL_ENDL; llassert(is_item_added); } } diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h index b183a2052d7a301fecd8a24d79b3243c91b72588..1aa230df9934645bee644bbc301a960a64d0dde8 100755 --- a/indra/newview/llinventoryitemslist.h +++ b/indra/newview/llinventoryitemslist.h @@ -29,8 +29,6 @@ #ifndef LL_LLINVENTORYITEMSLIST_H #define LL_LLINVENTORYITEMSLIST_H -#include "lldarray.h" - // newview #include "llflatlistview.h" @@ -46,7 +44,7 @@ class LLInventoryItemsList : public LLFlatListViewEx virtual ~LLInventoryItemsList(); - void refreshList(const LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array); + void refreshList(const std::vector<LLPointer<LLViewerInventoryItem> > item_array); boost::signals2::connection setRefreshCompleteCallback(const commit_signal_t::slot_type& cb); diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index ed7fd3cd3473e0619af5c4c59e57b016777034be..7db1f29797f3da3838c414f4d339a4c7d8be1c4c 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -112,7 +112,7 @@ bool LLCanCache::operator()(LLInventoryCategory* cat, LLInventoryItem* item) S32 descendents_actual = 0; if(cats && items) { - descendents_actual = cats->count() + items->count(); + descendents_actual = cats->size() + items->size(); } if(descendents_server == descendents_actual) { @@ -448,12 +448,12 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe cats = get_ptr_in_map(mParentChildCategoryTree, root_id); if(cats) { - S32 count = cats->count(); + S32 count = cats->size(); for(S32 i = 0; i < count; ++i) { - if (cats->get(i)->getPreferredType() == preferred_type) + if(cats->at(i)->getPreferredType() == preferred_type) { - rv = cats->get(i)->getUUID(); + rv = cats->at(i)->getUUID(); break; } } @@ -485,12 +485,12 @@ const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::ETyp cats = get_ptr_in_map(mParentChildCategoryTree, root_id); if(cats) { - S32 count = cats->count(); + S32 count = cats->size(); for(S32 i = 0; i < count; ++i) { - if(cats->get(i)->getPreferredType() == preferred_type) + if(cats->at(i)->getPreferredType() == preferred_type) { - rv = cats->get(i)->getUUID(); + rv = cats->at(i)->getUUID(); break; } } @@ -572,13 +572,13 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, LLUUID id; if(!isInventoryUsable()) { - llwarns << "Inventory is broken." << llendl; + LL_WARNS() << "Inventory is broken." << LL_ENDL; return id; } if(LLFolderType::lookup(preferred_type) == LLFolderType::badLookup()) { - lldebugs << "Attempt to create undefined category." << llendl; + LL_DEBUGS() << "Attempt to create undefined category." << LL_ENDL; return id; } @@ -690,13 +690,13 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, cat_array_t* cat_array = get_ptr_in_map(mParentChildCategoryTree, id); if(cat_array) { - S32 count = cat_array->count(); + S32 count = cat_array->size(); for(S32 i = 0; i < count; ++i) { - LLViewerInventoryCategory* cat = cat_array->get(i); + LLViewerInventoryCategory* cat = cat_array->at(i); if(add(cat,NULL)) { - cats.put(cat); + cats.push_back(cat); } collectDescendentsIf(cat->getUUID(), cats, items, include_trash, add); } @@ -710,10 +710,10 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, // Note: if making it fully recursive, need more checking against infinite loops. if (follow_folder_links && item_array) { - S32 count = item_array->count(); + S32 count = item_array->size(); for(S32 i = 0; i < count; ++i) { - item = item_array->get(i); + item = item_array->at(i); if (item && item->getActualType() == LLAssetType::AT_LINK_FOLDER) { LLViewerInventoryCategory *linked_cat = item->getLinkedCategory(); @@ -727,7 +727,7 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, // BAP should this be added here? May not // matter if it's only being used in current // outfit traversal. - cats.put(LLPointer<LLViewerInventoryCategory>(linked_cat)); + cats.push_back(LLPointer<LLViewerInventoryCategory>(linked_cat)); } collectDescendentsIf(linked_cat->getUUID(), cats, items, include_trash, add, FALSE); } @@ -738,13 +738,13 @@ void LLInventoryModel::collectDescendentsIf(const LLUUID& id, // Move onto items if(item_array) { - S32 count = item_array->count(); + S32 count = item_array->size(); for(S32 i = 0; i < count; ++i) { - item = item_array->get(i); + item = item_array->at(i); if(add(NULL, item)) { - items.put(item); + items.push_back(item); } } } @@ -840,7 +840,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) if(!isInventoryUsable()) { - llwarns << "Inventory is broken." << llendl; + LL_WARNS() << "Inventory is broken." << LL_ENDL; return mask; } @@ -852,7 +852,7 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) } #endif - LLViewerInventoryItem* old_item = getItem(item->getUUID()); + LLPointer<LLViewerInventoryItem> old_item = getItem(item->getUUID()); LLPointer<LLViewerInventoryItem> new_item; if(old_item) { @@ -868,12 +868,12 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) item_array = get_ptr_in_map(mParentChildItemTree, old_parent_id); if(item_array) { - item_array->removeObj(old_item); + vector_replace_with_last(*item_array, old_item); } item_array = get_ptr_in_map(mParentChildItemTree, new_parent_id); if(item_array) { - item_array->put(old_item); + item_array->push_back(old_item); } mask |= LLInventoryObserver::STRUCTURE; } @@ -899,11 +899,11 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) { // *FIX: bit of a hack to call update server from here... new_item->updateServer(TRUE); - item_array->put(new_item); + item_array->push_back(new_item); } else { - llwarns << "Couldn't find parent-child item tree for " << new_item->getName() << llendl; + LL_WARNS() << "Couldn't find parent-child item tree for " << new_item->getName() << LL_ENDL; } } else @@ -927,13 +927,13 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) item_array_t* item_array = get_ptr_in_map(mParentChildItemTree, parent_id); if(item_array) { - item_array->put(new_item); + item_array->push_back(new_item); } else { // Whoops! No such parent, make one. - llinfos << "Lost item: " << new_item->getUUID() << " - " - << new_item->getName() << llendl; + LL_INFOS() << "Lost item: " << new_item->getUUID() << " - " + << new_item->getName() << LL_ENDL; parent_id = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); new_item->setParent(parent_id); item_array = get_ptr_in_map(mParentChildItemTree, parent_id); @@ -942,11 +942,11 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item) // *FIX: bit of a hack to call update server from // here... new_item->updateServer(TRUE); - item_array->put(new_item); + item_array->push_back(new_item); } else { - llwarns << "Lost and found Not there!!" << llendl; + LL_WARNS() << "Lost and found Not there!!" << LL_ENDL; } } } @@ -1020,11 +1020,11 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) if(!isInventoryUsable()) { - llwarns << "Inventory is broken." << llendl; + LL_WARNS() << "Inventory is broken." << LL_ENDL; return; } - LLViewerInventoryCategory* old_cat = getCategory(cat->getUUID()); + LLPointer<LLViewerInventoryCategory> old_cat = getCategory(cat->getUUID()); if(old_cat) { // We already have an old category, modify it's values @@ -1038,12 +1038,12 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) cat_array = getUnlockedCatArray(old_parent_id); if(cat_array) { - cat_array->removeObj(old_cat); + vector_replace_with_last(*cat_array, old_cat); } cat_array = getUnlockedCatArray(new_parent_id); if(cat_array) { - cat_array->put(old_cat); + cat_array->push_back(old_cat); } mask |= LLInventoryObserver::STRUCTURE; mask |= LLInventoryObserver::INTERNAL; @@ -1067,7 +1067,7 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) cat_array = getUnlockedCatArray(cat->getParentUUID()); if(cat_array) { - cat_array->put(new_cat); + cat_array->push_back(new_cat); } // make space in the tree for this category's children. @@ -1083,40 +1083,40 @@ void LLInventoryModel::updateCategory(const LLViewerInventoryCategory* cat) void LLInventoryModel::moveObject(const LLUUID& object_id, const LLUUID& cat_id) { - lldebugs << "LLInventoryModel::moveObject()" << llendl; + LL_DEBUGS() << "LLInventoryModel::moveObject()" << LL_ENDL; if(!isInventoryUsable()) { - llwarns << "Inventory is broken." << llendl; + LL_WARNS() << "Inventory is broken." << LL_ENDL; return; } if((object_id == cat_id) || !is_in_map(mCategoryMap, cat_id)) { - llwarns << "Could not move inventory object " << object_id << " to " - << cat_id << llendl; + LL_WARNS() << "Could not move inventory object " << object_id << " to " + << cat_id << LL_ENDL; return; } - LLViewerInventoryCategory* cat = getCategory(object_id); + LLPointer<LLViewerInventoryCategory> cat = getCategory(object_id); if(cat && (cat->getParentUUID() != cat_id)) { cat_array_t* cat_array; cat_array = getUnlockedCatArray(cat->getParentUUID()); - if(cat_array) cat_array->removeObj(cat); + if(cat_array) vector_replace_with_last(*cat_array, cat); cat_array = getUnlockedCatArray(cat_id); cat->setParent(cat_id); - if(cat_array) cat_array->put(cat); + if(cat_array) cat_array->push_back(cat); addChangedMask(LLInventoryObserver::STRUCTURE, object_id); return; } - LLViewerInventoryItem* item = getItem(object_id); + LLPointer<LLViewerInventoryItem> item = getItem(object_id); if(item && (item->getParentUUID() != cat_id)) { item_array_t* item_array; item_array = getUnlockedItemArray(item->getParentUUID()); - if(item_array) item_array->removeObj(item); + if(item_array) vector_replace_with_last(*item_array, item); item_array = getUnlockedItemArray(cat_id); item->setParent(cat_id); - if(item_array) item_array->put(item); + if(item_array) item_array->push_back(item); addChangedMask(LLInventoryObserver::STRUCTURE, object_id); return; } @@ -1185,15 +1185,15 @@ void LLInventoryModel::changeCategoryParent(LLViewerInventoryCategory* cat, // Delete a particular inventory object by ID. void LLInventoryModel::deleteObject(const LLUUID& id) { - lldebugs << "LLInventoryModel::deleteObject()" << llendl; + LL_DEBUGS() << "LLInventoryModel::deleteObject()" << LL_ENDL; LLPointer<LLInventoryObject> obj = getObject(id); if (!obj) { - llwarns << "Deleting non-existent object [ id: " << id << " ] " << llendl; + LL_WARNS() << "Deleting non-existent object [ id: " << id << " ] " << LL_ENDL; return; } - lldebugs << "Deleting inventory object " << id << llendl; + LL_DEBUGS() << "Deleting inventory object " << id << LL_ENDL; mLastItem = NULL; LLUUID parent_id = obj->getParentUUID(); mCategoryMap.erase(id); @@ -1202,14 +1202,14 @@ void LLInventoryModel::deleteObject(const LLUUID& id) item_array_t* item_list = getUnlockedItemArray(parent_id); if(item_list) { - LLViewerInventoryItem* item = (LLViewerInventoryItem*)((LLInventoryObject*)obj); - item_list->removeObj(item); + LLPointer<LLViewerInventoryItem> item = (LLViewerInventoryItem*)((LLInventoryObject*)obj); + vector_replace_with_last(*item_list, item); } cat_array_t* cat_list = getUnlockedCatArray(parent_id); if(cat_list) { - LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)((LLInventoryObject*)obj); - cat_list->removeObj(cat); + LLPointer<LLViewerInventoryCategory> cat = (LLViewerInventoryCategory*)((LLInventoryObject*)obj); + vector_replace_with_last(*cat_list, cat); } item_list = getUnlockedItemArray(id); if(item_list) @@ -1232,7 +1232,7 @@ void LLInventoryModel::deleteObject(const LLUUID& id) // Delete a particular inventory item by ID, and remove it from the server. void LLInventoryModel::purgeObject(const LLUUID &id) { - lldebugs << "LLInventoryModel::purgeObject() [ id: " << id << " ] " << llendl; + LL_DEBUGS() << "LLInventoryModel::purgeObject() [ id: " << id << " ] " << LL_ENDL; LLPointer<LLInventoryObject> obj = getObject(id); if(obj) { @@ -1274,8 +1274,8 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) if (LLClipboard::instance().hasContents() && LLClipboard::instance().isCutMode()) { // Something on the clipboard is in "cut mode" and needs to be preserved - llinfos << "LLInventoryModel::purgeDescendentsOf " << cat->getName() - << " iterate and purge non hidden items" << llendl; + LL_INFOS() << "LLInventoryModel::purgeDescendentsOf " << cat->getName() + << " iterate and purge non hidden items" << LL_ENDL; cat_array_t* categories; item_array_t* items; // Get the list of direct descendants in that category passed as argument @@ -1304,8 +1304,8 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) { // Fast purge // do the cache accounting - llinfos << "LLInventoryModel::purgeDescendentsOf " << cat->getName() - << llendl; + LL_INFOS() << "LLInventoryModel::purgeDescendentsOf " << cat->getName() + << LL_ENDL; S32 descendents = cat->getDescendentCount(); if(descendents > 0) { @@ -1335,7 +1335,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) categories, items, INCLUDE_TRASH); - S32 count = items.count(); + S32 count = items.size(); item_map_t::iterator item_map_end = mItemMap.end(); cat_map_t::iterator cat_map_end = mCategoryMap.end(); @@ -1343,7 +1343,7 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) for(S32 i = 0; i < count; ++i) { - uu_id = items.get(i)->getUUID(); + uu_id = items.at(i)->getUUID(); // This check prevents the deletion of a previously deleted item. // This is necessary because deletion is not done in a hierarchical @@ -1355,10 +1355,10 @@ void LLInventoryModel::purgeDescendentsOf(const LLUUID& id) } } - count = categories.count(); + count = categories.size(); for(S32 i = 0; i < count; ++i) { - uu_id = categories.get(i)->getUUID(); + uu_id = categories.at(i)->getUUID(); if (mCategoryMap.find(uu_id) != cat_map_end) { deleteObject(uu_id); @@ -1402,7 +1402,7 @@ void LLInventoryModel::notifyObservers() // Within notifyObservers, something called notifyObservers // again. This type of recursion is unsafe because it causes items to be // processed twice, and this can easily lead to infinite loops. - llwarns << "Call was made to notifyObservers within notifyObservers!" << llendl; + LL_WARNS() << "Call was made to notifyObservers within notifyObservers!" << LL_ENDL; return; } @@ -1431,7 +1431,7 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent) // Something marked an item for change within a call to notifyObservers // (which is in the process of processing the list of items marked for change). // This means the change may fail to be processed. - llwarns << "Adding changed mask within notify observers! Change will likely be lost." << llendl; + LL_WARNS() << "Adding changed mask within notify observers! Change will likely be lost." << LL_ENDL; } mModifyMask |= mask; @@ -1457,8 +1457,8 @@ void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content) agent_id = content["agent_id"].asUUID(); if(agent_id != gAgent.getID()) { - llwarns << "Got a inventory update for the wrong agent: " << agent_id - << llendl; + LL_WARNS() << "Got a inventory update for the wrong agent: " << agent_id + << LL_ENDL; return; }*/ item_array_t items; @@ -1471,8 +1471,8 @@ void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content) LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; titem->unpackMessage(content["items"][i]); - lldebugs << "LLInventoryModel::messageUpdateCore() item id:" - << titem->getUUID() << llendl; + LL_DEBUGS() << "LLInventoryModel::messageUpdateCore() item id:" + << titem->getUUID() << LL_ENDL; items.push_back(titem); // examine update for changes. LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID()); @@ -1511,7 +1511,7 @@ void LLInventoryModel::fetchInventoryResponder::result(const LLSD& content) //If we get back an error (not found, etc...), handle it here void LLInventoryModel::fetchInventoryResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "fetchInventory error [status:" << status << "]: " << content << llendl; + LL_WARNS() << "fetchInventory error [status:" << status << "]: " << content << LL_ENDL; gInventory.notifyObservers(); } @@ -1519,14 +1519,14 @@ bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) const { if(folder_id.isNull()) { - llwarns << "Calling fetch descendents on NULL folder id!" << llendl; + LL_WARNS() << "Calling fetch descendents on NULL folder id!" << LL_ENDL; return false; } LLViewerInventoryCategory* cat = getCategory(folder_id); if(!cat) { - llwarns << "Asked to fetch descendents of non-existent folder: " - << folder_id << llendl; + LL_WARNS() << "Asked to fetch descendents of non-existent folder: " + << folder_id << LL_ENDL; return false; } //S32 known_descendents = 0; @@ -1534,11 +1534,11 @@ bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id) const //item_array_t* items = get_ptr_in_map(mParentChildItemTree, folder_id); //if(categories) //{ - // known_descendents += categories->count(); + // known_descendents += categories->size(); //} //if(items) //{ - // known_descendents += items->count(); + // known_descendents += items->size(); //} return cat->fetch(); } @@ -1547,12 +1547,12 @@ void LLInventoryModel::cache( const LLUUID& parent_folder_id, const LLUUID& agent_id) { - lldebugs << "Caching " << parent_folder_id << " for " << agent_id - << llendl; + LL_DEBUGS() << "Caching " << parent_folder_id << " for " << agent_id + << LL_ENDL; LLViewerInventoryCategory* root_cat = getCategory(parent_folder_id); if(!root_cat) return; cat_array_t categories; - categories.put(root_cat); + categories.push_back(root_cat); item_array_t items; LLCanCache can_cache(this); @@ -1573,19 +1573,19 @@ void LLInventoryModel::cache( gzip_filename.append(".gz"); if(gzip_file(inventory_filename, gzip_filename)) { - lldebugs << "Successfully compressed " << inventory_filename << llendl; + LL_DEBUGS() << "Successfully compressed " << inventory_filename << LL_ENDL; LLFile::remove(inventory_filename); } else { - llwarns << "Unable to compress " << inventory_filename << llendl; + LL_WARNS() << "Unable to compress " << inventory_filename << LL_ENDL; } } void LLInventoryModel::addCategory(LLViewerInventoryCategory* category) { - //llinfos << "LLInventoryModel::addCategory()" << llendl; + //LL_INFOS() << "LLInventoryModel::addCategory()" << LL_ENDL; if(category) { // We aren't displaying the Meshes folder @@ -1614,7 +1614,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) if ((item->getType() == LLAssetType::AT_NONE) || LLAssetType::lookup(item->getType()) == LLAssetType::badLookup()) { - llwarns << "Got bad asset type for item [ name: " << item->getName() << " type: " << item->getType() << " inv-type: " << item->getInventoryType() << " ], ignoring." << llendl; + LL_WARNS() << "Got bad asset type for item [ name: " << item->getName() << " type: " << item->getType() << " inv-type: " << item->getInventoryType() << " ], ignoring." << LL_ENDL; return; } @@ -1622,7 +1622,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) // The item will show up as a broken link. if (item->getIsBrokenLink()) { - llinfos << "Adding broken link [ name: " << item->getName() << " itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << llendl; + LL_INFOS() << "Adding broken link [ name: " << item->getName() << " itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << LL_ENDL; } mItemMap[item->getUUID()] = item; @@ -1632,7 +1632,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) // Empty the entire contents void LLInventoryModel::empty() { -// llinfos << "LLInventoryModel::empty()" << llendl; +// LL_INFOS() << "LLInventoryModel::empty()" << LL_ENDL; std::for_each( mParentChildCategoryTree.begin(), mParentChildCategoryTree.end(), @@ -1665,7 +1665,7 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const S32 descendents_actual = 0; if(cats && items) { - descendents_actual = cats->count() + items->count(); + descendents_actual = cats->size() + items->size(); } if(descendents_server == descendents_actual) { @@ -1673,9 +1673,9 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const descendents_actual += update.mDescendentDelta; cat->setDescendentCount(descendents_actual); cat->setVersion(++version); - lldebugs << "accounted: '" << cat->getName() << "' " + LL_DEBUGS() << "accounted: '" << cat->getName() << "' " << version << " with " << descendents_actual - << " descendents." << llendl; + << " descendents." << LL_ENDL; } } if(!accounted) @@ -1683,13 +1683,13 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const // Error condition, this means that the category did not register that // it got new descendents (perhaps because it is still being loaded) // which means its descendent count will be wrong. - llwarns << "Accounting failed for '" << cat->getName() << "' version:" - << version << llendl; + LL_WARNS() << "Accounting failed for '" << cat->getName() << "' version:" + << version << LL_ENDL; } } else { - llwarns << "No category found for update " << update.mCategoryID << llendl; + LL_WARNS() << "No category found for update " << update.mCategoryID << LL_ENDL; } } @@ -1729,18 +1729,18 @@ void LLInventoryModel::incrementCategoryVersion(const LLUUID& category_id) if(LLViewerInventoryCategory::VERSION_UNKNOWN != version) { cat->setVersion(version + 1); - llinfos << "IncrementVersion: " << cat->getName() << " " - << cat->getVersion() << llendl; + LL_INFOS() << "IncrementVersion: " << cat->getName() << " " + << cat->getVersion() << LL_ENDL; } else { - llinfos << "Attempt to increment version when unknown: " - << category_id << llendl; + LL_INFOS() << "Attempt to increment version when unknown: " + << category_id << LL_ENDL; } } else { - llinfos << "Attempt to increment category: " << category_id << llendl; + LL_INFOS() << "Attempt to increment category: " << category_id << LL_ENDL; } } void LLInventoryModel::incrementCategorySetVersion( @@ -1780,12 +1780,12 @@ LLInventoryModel::EHasChildren LLInventoryModel::categoryHasChildren( // Shouldn't have to run this, but who knows. parent_cat_map_t::const_iterator cat_it = mParentChildCategoryTree.find(cat->getUUID()); - if (cat_it != mParentChildCategoryTree.end() && cat_it->second->count() > 0) + if (cat_it != mParentChildCategoryTree.end() && cat_it->second->size() > 0) { return CHILDREN_YES; } parent_item_map_t::const_iterator item_it = mParentChildItemTree.find(cat->getUUID()); - if (item_it != mParentChildItemTree.end() && item_it->second->count() > 0) + if (item_it != mParentChildItemTree.end() && item_it->second->size() > 0) { return CHILDREN_YES; } @@ -1805,7 +1805,7 @@ bool LLInventoryModel::isCategoryComplete(const LLUUID& cat_id) const S32 descendents_actual = 0; if(cats && items) { - descendents_actual = cats->count() + items->count(); + descendents_actual = cats->size() + items->size(); } if(descendents_server == descendents_actual) { @@ -1819,7 +1819,7 @@ bool LLInventoryModel::loadSkeleton( const LLSD& options, const LLUUID& owner_id) { - lldebugs << "importing inventory skeleton for " << owner_id << llendl; + LL_DEBUGS() << "importing inventory skeleton for " << owner_id << LL_ENDL; typedef std::set<LLPointer<LLViewerInventoryCategory>, InventoryIDPtrLess> cat_set_t; cat_set_t temp_cats; @@ -1856,7 +1856,7 @@ bool LLInventoryModel::loadSkeleton( } else { - llwarns << "Unable to import near " << name.asString() << llendl; + LL_WARNS() << "Unable to import near " << name.asString() << LL_ENDL; rv = false; } } @@ -1893,7 +1893,7 @@ bool LLInventoryModel::loadSkeleton( } else { - llinfos << "Unable to gunzip " << gzip_filename << llendl; + LL_INFOS() << "Unable to gunzip " << gzip_filename << LL_ENDL; } } bool is_cache_obsolete = false; @@ -1903,7 +1903,7 @@ bool LLInventoryModel::loadSkeleton( // found to generate a set of categories we should add. We // will go through each category loaded and if the version // does not match, invalidate the version. - S32 count = categories.count(); + S32 count = categories.size(); cat_set_t::iterator not_cached = temp_cats.end(); std::set<LLUUID> cached_ids; for(S32 i = 0; i < count; ++i) @@ -1974,10 +1974,10 @@ bool LLInventoryModel::loadSkeleton( if (item->getIsBrokenLink()) { //bad_link_count++; - lldebugs << "Attempted to add cached link item without baseobj present ( name: " + LL_DEBUGS() << "Attempted to add cached link item without baseobj present ( name: " << item->getName() << " itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() - << " ). Ignoring and invalidating " << cat->getName() << " . " << llendl; + << " ). Ignoring and invalidating " << cat->getName() << " . " << LL_ENDL; possible_broken_links.push_back(item); continue; } @@ -2004,7 +2004,7 @@ bool LLInventoryModel::loadSkeleton( { bad_link_count++; invalid_categories.insert(cit->second); - //llinfos << "link still broken: " << item->getName() << " in folder " << cat->getName() << llendl; + //LL_INFOS() << "link still broken: " << item->getName() << " in folder " << cat->getName() << LL_ENDL; } else { @@ -2016,11 +2016,11 @@ bool LLInventoryModel::loadSkeleton( } } - llinfos << "Attempted to add " << bad_link_count + LL_INFOS() << "Attempted to add " << bad_link_count << " cached link items without baseobj present. " << good_link_count << " link items were successfully added. " << recovered_link_count << " links added in recovery. " - << "The corresponding categories were invalidated." << llendl; + << "The corresponding categories were invalidated." << LL_ENDL; } } @@ -2044,9 +2044,9 @@ bool LLInventoryModel::loadSkeleton( { LLViewerInventoryCategory* cat = (*invalid_cat_it).get(); cat->setVersion(NO_VERSION); - LL_DEBUGS("Inventory") << "Invalidating category name: " << cat->getName() << " UUID: " << cat->getUUID() << " due to invalid descendents cache" << llendl; + LL_DEBUGS("Inventory") << "Invalidating category name: " << cat->getName() << " UUID: " << cat->getUUID() << " due to invalid descendents cache" << LL_ENDL; } - LL_INFOS("Inventory") << "Invalidated " << invalid_categories.size() << " categories due to invalid descendents cache" << llendl; + LL_INFOS("Inventory") << "Invalidated " << invalid_categories.size() << " categories due to invalid descendents cache" << LL_ENDL; // At this point, we need to set the known descendents for each // category which successfully cached so that we do not @@ -2078,15 +2078,15 @@ bool LLInventoryModel::loadSkeleton( if(is_cache_obsolete) { // If out of date, remove the gzipped file too. - llwarns << "Inv cache out of date, removing" << llendl; + LL_WARNS() << "Inv cache out of date, removing" << LL_ENDL; LLFile::remove(gzip_filename); } categories.clear(); // will unref and delete entries } - llinfos << "Successfully loaded " << cached_category_count + LL_INFOS() << "Successfully loaded " << cached_category_count << " categories and " << cached_item_count << " items from cache." - << llendl; + << LL_ENDL; return rv; } @@ -2096,7 +2096,7 @@ bool LLInventoryModel::loadSkeleton( // should be sufficient for our needs. void LLInventoryModel::buildParentChildMap() { - llinfos << "LLInventoryModel::buildParentChildMap()" << llendl; + LL_INFOS() << "LLInventoryModel::buildParentChildMap()" << LL_ENDL; // *NOTE: I am skipping the logic around folder version // synchronization here because it seems if a folder is lost, we @@ -2113,7 +2113,7 @@ void LLInventoryModel::buildParentChildMap() for(cat_map_t::iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit) { LLViewerInventoryCategory* cat = cit->second; - cats.put(cat); + cats.push_back(cat); if (mParentChildCategoryTree.count(cat->getUUID()) == 0) { llassert_always(mCategoryLock[cat->getUUID()] == false); @@ -2141,16 +2141,16 @@ void LLInventoryModel::buildParentChildMap() // Now we have a structure with all of the categories that we can // iterate over and insert into the correct place in the child // category tree. - S32 count = cats.count(); + S32 count = cats.size(); S32 i; S32 lost = 0; for(i = 0; i < count; ++i) { - LLViewerInventoryCategory* cat = cats.get(i); + LLViewerInventoryCategory* cat = cats.at(i); catsp = getUnlockedCatArray(cat->getParentUUID()); if(catsp) { - catsp->put(cat); + catsp->push_back(cat); } else { @@ -2160,8 +2160,8 @@ void LLInventoryModel::buildParentChildMap() // implement it, we would need a set or map of uuid pairs // which would be (folder_id, new_parent_id) to be sent up // to the server. - llinfos << "Lost categroy: " << cat->getUUID() << " - " - << cat->getName() << llendl; + LL_INFOS() << "Lost categroy: " << cat->getUUID() << " - " + << cat->getName() << LL_ENDL; ++lost; // plop it into the lost & found. LLFolderType::EType pref = cat->getPreferredType(); @@ -2183,17 +2183,17 @@ void LLInventoryModel::buildParentChildMap() catsp = getUnlockedCatArray(cat->getParentUUID()); if(catsp) { - catsp->put(cat); + catsp->push_back(cat); } else { - llwarns << "Lost and found Not there!!" << llendl; + LL_WARNS() << "Lost and found Not there!!" << LL_ENDL; } } } if(lost) { - llwarns << "Found " << lost << " lost categories." << llendl; + LL_WARNS() << "Found " << lost << " lost categories." << LL_ENDL; } const BOOL COF_exists = (findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, FALSE) != LLUUID::null); @@ -2210,25 +2210,25 @@ void LLInventoryModel::buildParentChildMap() for(item_map_t::iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit) { item = (*iit).second; - items.put(item); + items.push_back(item); } } - count = items.count(); + count = items.size(); lost = 0; uuid_vec_t lost_item_ids; for(i = 0; i < count; ++i) { LLPointer<LLViewerInventoryItem> item; - item = items.get(i); + item = items.at(i); itemsp = getUnlockedItemArray(item->getParentUUID()); if(itemsp) { - itemsp->put(item); + itemsp->push_back(item); } else { - llinfos << "Lost item: " << item->getUUID() << " - " - << item->getName() << llendl; + LL_INFOS() << "Lost item: " << item->getUUID() << " - " + << item->getName() << LL_ENDL; ++lost; // plop it into the lost & found. // @@ -2240,17 +2240,17 @@ void LLInventoryModel::buildParentChildMap() itemsp = getUnlockedItemArray(item->getParentUUID()); if(itemsp) { - itemsp->put(item); + itemsp->push_back(item); } else { - llwarns << "Lost and found Not there!!" << llendl; + LL_WARNS() << "Lost and found Not there!!" << LL_ENDL; } } } if(lost) { - llwarns << "Found " << lost << " lost items." << llendl; + LL_WARNS() << "Found " << lost << " lost items." << LL_ENDL; LLMessageSystem* msg = gMessageSystem; BOOL start_new_message = TRUE; const LLUUID lnf = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); @@ -2319,7 +2319,7 @@ void LLInventoryModel::buildParentChildMap() // The inv tree is built. mIsAgentInvUsable = true; - llinfos << "Inventory initialized, notifying observers" << llendl; + LL_INFOS() << "Inventory initialized, notifying observers" << LL_ENDL; addChangedMask(LLInventoryObserver::ALL, LLUUID::null); notifyObservers(); } @@ -2366,14 +2366,14 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, { if(filename.empty()) { - llerrs << "Filename is Null!" << llendl; + LL_ERRS() << "Filename is Null!" << LL_ENDL; return false; } - llinfos << "LLInventoryModel::loadFromFile(" << filename << ")" << llendl; + LL_INFOS() << "LLInventoryModel::loadFromFile(" << filename << ")" << LL_ENDL; LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ if(!file) { - llinfos << "unable to load inventory from: " << filename << llendl; + LL_INFOS() << "unable to load inventory from: " << filename << LL_ENDL; return false; } // *NOTE: This buffer size is hard coded into scanf() below. @@ -2408,11 +2408,11 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, LLPointer<LLViewerInventoryCategory> inv_cat = new LLViewerInventoryCategory(LLUUID::null); if(inv_cat->importFileLocal(file)) { - categories.put(inv_cat); + categories.push_back(inv_cat); } else { - llwarns << "loadInventoryFromFile(). Ignoring invalid inventory category: " << inv_cat->getName() << llendl; + LL_WARNS() << "loadInventoryFromFile(). Ignoring invalid inventory category: " << inv_cat->getName() << LL_ENDL; //delete inv_cat; // automatic when inv_cat is reassigned or destroyed } } @@ -2430,25 +2430,25 @@ bool LLInventoryModel::loadFromFile(const std::string& filename, if(inv_item->getUUID().isNull()) { //delete inv_item; // automatic when inv_cat is reassigned or destroyed - llwarns << "Ignoring inventory with null item id: " - << inv_item->getName() << llendl; + LL_WARNS() << "Ignoring inventory with null item id: " + << inv_item->getName() << LL_ENDL; } else { - items.put(inv_item); + items.push_back(inv_item); } } else { - llwarns << "loadInventoryFromFile(). Ignoring invalid inventory item: " << inv_item->getName() << llendl; + LL_WARNS() << "loadInventoryFromFile(). Ignoring invalid inventory item: " << inv_item->getName() << LL_ENDL; //delete inv_item; // automatic when inv_cat is reassigned or destroyed } } else { - llwarns << "Unknown token in inventory file '" << keyword << "'" - << llendl; + LL_WARNS() << "Unknown token in inventory file '" << keyword << "'" + << LL_ENDL; } } fclose(file); @@ -2464,19 +2464,19 @@ bool LLInventoryModel::saveToFile(const std::string& filename, { if(filename.empty()) { - llerrs << "Filename is Null!" << llendl; + LL_ERRS() << "Filename is Null!" << LL_ENDL; return false; } - llinfos << "LLInventoryModel::saveToFile(" << filename << ")" << llendl; + LL_INFOS() << "LLInventoryModel::saveToFile(" << filename << ")" << LL_ENDL; LLFILE* file = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ if(!file) { - llwarns << "unable to save inventory to: " << filename << llendl; + LL_WARNS() << "unable to save inventory to: " << filename << LL_ENDL; return false; } fprintf(file, "\tinv_cache_version\t%d\n",sCurrentInvCacheVersion); - S32 count = categories.count(); + S32 count = categories.size(); S32 i; for(i = 0; i < count; ++i) { @@ -2487,7 +2487,7 @@ bool LLInventoryModel::saveToFile(const std::string& filename, } } - count = items.count(); + count = items.size(); for(i = 0; i < count; ++i) { items[i]->exportFile(file); @@ -2576,8 +2576,8 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { - llwarns << "Got a inventory update for the wrong agent: " << agent_id - << llendl; + LL_WARNS() << "Got a inventory update for the wrong agent: " << agent_id + << LL_ENDL; return false; } item_array_t items; @@ -2589,8 +2589,8 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account) { LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; titem->unpackMessage(msg, _PREHASH_InventoryData, i); - lldebugs << "LLInventoryModel::messageUpdateCore() item id:" - << titem->getUUID() << llendl; + LL_DEBUGS() << "LLInventoryModel::messageUpdateCore() item id:" + << titem->getUUID() << LL_ENDL; items.push_back(titem); // examine update for changes. LLViewerInventoryItem* itemp = gInventory.getItem(titem->getUUID()); @@ -2637,17 +2637,17 @@ void LLInventoryModel::removeInventoryItem(LLUUID agent_id, LLMessageSystem* msg { LLUUID item_id; S32 count = msg->getNumberOfBlocksFast(msg_label); - lldebugs << "Message has " << count << " item blocks" << llendl; + LL_DEBUGS() << "Message has " << count << " item blocks" << LL_ENDL; uuid_vec_t item_ids; update_map_t update; for(S32 i = 0; i < count; ++i) { msg->getUUIDFast(msg_label, _PREHASH_ItemID, item_id, i); - lldebugs << "Checking for item-to-be-removed " << item_id << llendl; + LL_DEBUGS() << "Checking for item-to-be-removed " << item_id << LL_ENDL; LLViewerInventoryItem* itemp = gInventory.getItem(item_id); if(itemp) { - lldebugs << "Item will be removed " << item_id << llendl; + LL_DEBUGS() << "Item will be removed " << item_id << LL_ENDL; // we only bother with the delete and account if we found // the item - this is usually a back-up for permissions, // so frequently the item will already be gone. @@ -2658,7 +2658,7 @@ void LLInventoryModel::removeInventoryItem(LLUUID agent_id, LLMessageSystem* msg gInventory.accountForUpdate(update); for(uuid_vec_t::iterator it = item_ids.begin(); it != item_ids.end(); ++it) { - lldebugs << "Calling deleteObject " << *it << llendl; + LL_DEBUGS() << "Calling deleteObject " << *it << LL_ENDL; gInventory.deleteObject(*it); } } @@ -2666,13 +2666,13 @@ void LLInventoryModel::removeInventoryItem(LLUUID agent_id, LLMessageSystem* msg // static void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) { - lldebugs << "LLInventoryModel::processRemoveInventoryItem()" << llendl; + LL_DEBUGS() << "LLInventoryModel::processRemoveInventoryItem()" << LL_ENDL; LLUUID agent_id, item_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { - llwarns << "Got a RemoveInventoryItem for the wrong agent." - << llendl; + LL_WARNS() << "Got a RemoveInventoryItem for the wrong agent." + << LL_ENDL; return; } LLInventoryModel::removeInventoryItem(agent_id, msg, _PREHASH_InventoryData); @@ -2683,14 +2683,14 @@ void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**) void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, void**) { - lldebugs << "LLInventoryModel::processUpdateInventoryFolder()" << llendl; + LL_DEBUGS() << "LLInventoryModel::processUpdateInventoryFolder()" << LL_ENDL; LLUUID agent_id, folder_id, parent_id; //char name[DB_INV_ITEM_NAME_BUF_SIZE]; msg->getUUIDFast(_PREHASH_FolderData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { - llwarns << "Got an UpdateInventoryFolder for the wrong agent." - << llendl; + LL_WARNS() << "Got an UpdateInventoryFolder for the wrong agent." + << LL_ENDL; return; } LLPointer<LLViewerInventoryCategory> lastfolder; // hack @@ -2768,14 +2768,14 @@ void LLInventoryModel::removeInventoryFolder(LLUUID agent_id, void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, void**) { - lldebugs << "LLInventoryModel::processRemoveInventoryFolder()" << llendl; + LL_DEBUGS() << "LLInventoryModel::processRemoveInventoryFolder()" << LL_ENDL; LLUUID agent_id, session_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id); if(agent_id != gAgent.getID()) { - llwarns << "Got a RemoveInventoryFolder for the wrong agent." - << llendl; + LL_WARNS() << "Got a RemoveInventoryFolder for the wrong agent." + << LL_ENDL; return; } LLInventoryModel::removeInventoryFolder( agent_id, msg ); @@ -2786,14 +2786,14 @@ void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg, void LLInventoryModel::processRemoveInventoryObjects(LLMessageSystem* msg, void**) { - lldebugs << "LLInventoryModel::processRemoveInventoryObjects()" << llendl; + LL_DEBUGS() << "LLInventoryModel::processRemoveInventoryObjects()" << LL_ENDL; LLUUID agent_id, session_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id); if(agent_id != gAgent.getID()) { - llwarns << "Got a RemoveInventoryObjects for the wrong agent." - << llendl; + LL_WARNS() << "Got a RemoveInventoryObjects for the wrong agent." + << LL_ENDL; return; } LLInventoryModel::removeInventoryFolder( agent_id, msg ); @@ -2809,8 +2809,8 @@ void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg, msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { - llwarns << "Got a SaveAssetIntoInventory message for the wrong agent." - << llendl; + LL_WARNS() << "Got a SaveAssetIntoInventory message for the wrong agent." + << LL_ENDL; return; } @@ -2820,8 +2820,8 @@ void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg, // The viewer ignores the asset id because this message is only // used for attachments/objects, so the asset id is not used in // the viewer anyway. - lldebugs << "LLInventoryModel::processSaveAssetIntoInventory itemID=" - << item_id << llendl; + LL_DEBUGS() << "LLInventoryModel::processSaveAssetIntoInventory itemID=" + << item_id << LL_ENDL; LLViewerInventoryItem* item = gInventory.getItem( item_id ); if( item ) { @@ -2832,8 +2832,8 @@ void LLInventoryModel::processSaveAssetIntoInventory(LLMessageSystem* msg, } else { - llinfos << "LLInventoryModel::processSaveAssetIntoInventory item" - " not found: " << item_id << llendl; + LL_INFOS() << "LLInventoryModel::processSaveAssetIntoInventory item" + " not found: " << item_id << LL_ENDL; } if(gViewerWindow) { @@ -2856,13 +2856,13 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { - llwarns << "Got a BulkUpdateInventory for the wrong agent." << llendl; + LL_WARNS() << "Got a BulkUpdateInventory for the wrong agent." << LL_ENDL; return; } LLUUID tid; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_TransactionID, tid); #ifndef LL_RELEASE_FOR_DOWNLOAD - llinfos << "Bulk inventory: " << tid << llendl; + LL_INFOS() << "Bulk inventory: " << tid << LL_ENDL; #endif update_map_t update; @@ -2874,9 +2874,9 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) { LLPointer<LLViewerInventoryCategory> tfolder = new LLViewerInventoryCategory(gAgent.getID()); tfolder->unpackMessage(msg, _PREHASH_FolderData, i); - llinfos << "unpacked folder '" << tfolder->getName() << "' (" + LL_INFOS() << "unpacked folder '" << tfolder->getName() << "' (" << tfolder->getUUID() << ") in " << tfolder->getParentUUID() - << llendl; + << LL_ENDL; if(tfolder->getUUID().notNull()) { folders.push_back(tfolder); @@ -2916,8 +2916,8 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**) { LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem; titem->unpackMessage(msg, _PREHASH_ItemData, i); - llinfos << "unpacked item '" << titem->getName() << "' in " - << titem->getParentUUID() << llendl; + LL_INFOS() << "unpacked item '" << titem->getName() << "' in " + << titem->getParentUUID() << LL_ENDL; U32 callback_id; msg->getU32Fast(_PREHASH_ItemData, _PREHASH_CallbackID, callback_id); if(titem->getUUID().notNull() ) // && callback_id.notNull() ) @@ -3023,7 +3023,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { - llwarns << "Got a UpdateInventoryItem for the wrong agent." << llendl; + LL_WARNS() << "Got a UpdateInventoryItem for the wrong agent." << LL_ENDL; return; } LLUUID parent_id; @@ -3052,7 +3052,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) // If the item has already been added (e.g. from link prefetch), then it doesn't need to be re-added. if (gInventory.getItem(titem->getUUID())) { - lldebugs << "Skipping prefetched item [ Name: " << titem->getName() << " | Type: " << titem->getActualType() << " | ItemUUID: " << titem->getUUID() << " ] " << llendl; + LL_DEBUGS() << "Skipping prefetched item [ Name: " << titem->getName() << " | Type: " << titem->getActualType() << " | ItemUUID: " << titem->getUUID() << " ] " << LL_ENDL; continue; } gInventory.updateItem(titem); @@ -3074,13 +3074,13 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) // static void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) { - lldebugs << "LLInventoryModel::processMoveInventoryItem()" << llendl; + LL_DEBUGS() << "LLInventoryModel::processMoveInventoryItem()" << LL_ENDL; LLUUID agent_id; msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { - llwarns << "Got a MoveInventoryItem message for the wrong agent." - << llendl; + LL_WARNS() << "Got a MoveInventoryItem message for the wrong agent." + << LL_ENDL; return; } @@ -3099,8 +3099,8 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_FolderID, folder_id, i); msg->getString("InventoryData", "NewName", new_name, i); - lldebugs << "moving item " << item_id << " to folder " - << folder_id << llendl; + LL_DEBUGS() << "moving item " << item_id << " to folder " + << folder_id << LL_ENDL; update_list_t update; LLCategoryUpdate old_folder(item->getParentUUID(), -1); update.push_back(old_folder); @@ -3118,7 +3118,7 @@ void LLInventoryModel::processMoveInventoryItem(LLMessageSystem* msg, void**) } else { - llinfos << "LLInventoryModel::processMoveInventoryItem item not found: " << item_id << llendl; + LL_INFOS() << "LLInventoryModel::processMoveInventoryItem item not found: " << item_id << LL_ENDL; } } if(anything_changed) @@ -3274,7 +3274,7 @@ BOOL LLInventoryModel::getIsFirstTimeInViewer2() // Do not call this before parentchild map is built. if (!gInventory.mIsAgentInvUsable) { - llwarns << "Parent Child Map not yet built; guessing as first time in viewer2." << llendl; + LL_WARNS() << "Parent Child Map not yet built; guessing as first time in viewer2." << LL_ENDL; return TRUE; } @@ -3409,37 +3409,37 @@ void LLInventoryModel::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, // *NOTE: DEBUG functionality void LLInventoryModel::dumpInventory() const { - llinfos << "\nBegin Inventory Dump\n**********************:" << llendl; - llinfos << "mCategory[] contains " << mCategoryMap.size() << " items." << llendl; + LL_INFOS() << "\nBegin Inventory Dump\n**********************:" << LL_ENDL; + LL_INFOS() << "mCategory[] contains " << mCategoryMap.size() << " items." << LL_ENDL; for(cat_map_t::const_iterator cit = mCategoryMap.begin(); cit != mCategoryMap.end(); ++cit) { const LLViewerInventoryCategory* cat = cit->second; if(cat) { - llinfos << " " << cat->getUUID() << " '" << cat->getName() << "' " + LL_INFOS() << " " << cat->getUUID() << " '" << cat->getName() << "' " << cat->getVersion() << " " << cat->getDescendentCount() - << llendl; + << LL_ENDL; } else { - llinfos << " NULL!" << llendl; + LL_INFOS() << " NULL!" << LL_ENDL; } } - llinfos << "mItemMap[] contains " << mItemMap.size() << " items." << llendl; + LL_INFOS() << "mItemMap[] contains " << mItemMap.size() << " items." << LL_ENDL; for(item_map_t::const_iterator iit = mItemMap.begin(); iit != mItemMap.end(); ++iit) { const LLViewerInventoryItem* item = iit->second; if(item) { - llinfos << " " << item->getUUID() << " " - << item->getName() << llendl; + LL_INFOS() << " " << item->getUUID() << " " + << item->getName() << LL_ENDL; } else { - llinfos << " NULL!" << llendl; + LL_INFOS() << " NULL!" << LL_ENDL; } } - llinfos << "\n**********************\nEnd Inventory Dump" << llendl; + LL_INFOS() << "\n**********************\nEnd Inventory Dump" << LL_ENDL; } ///---------------------------------------------------------------------------- diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 544ca5e5dcc59e4f0b5673c36e06c611354bfcdb..7dd7ac8e9af67520a4cb77bd347c17b692646fe6 100755 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -29,9 +29,8 @@ #include "llassettype.h" #include "llfoldertype.h" -#include "lldarray.h" #include "llframetimer.h" -#include "llhttpclient.h" +#include "llcurl.h" #include "lluuid.h" #include "llpermissionsflags.h" #include "llstring.h" @@ -75,11 +74,11 @@ class LLInventoryModel CHILDREN_MAYBE }; - typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t; - typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t; + typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t; + typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t; typedef std::set<LLUUID> changed_items_t; - class fetchInventoryResponder : public LLHTTPClient::Responder + class fetchInventoryResponder : public LLCurl::Responder { public: fetchInventoryResponder(const LLSD& request_sd) : mRequestSD(request_sd) {}; diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index d88e0c3192ea2f3081f62c4558d2a8d7b52b1966..a8fda4fcf84f4d1d9adaafb70b24169d0aece078 100755 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -200,7 +200,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() // No more categories to fetch, stop fetch process. if (mFetchQueue.empty()) { - llinfos << "Inventory fetch completed" << llendl; + LL_INFOS() << "Inventory fetch completed" << LL_ENDL; setAllFoldersFetched(); mBackgroundFetchActive = false; @@ -216,7 +216,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() // Double timeouts on failure. mMinTimeBetweenFetches = llmin(mMinTimeBetweenFetches * 2.f, 10.f); mMaxTimeBetweenFetches = llmin(mMaxTimeBetweenFetches * 2.f, 120.f); - lldebugs << "Inventory fetch times grown to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl; + LL_DEBUGS() << "Inventory fetch times grown to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << LL_ENDL; // fetch is no longer considered "timely" although we will wait for full time-out. mTimelyFetchPending = FALSE; } @@ -289,7 +289,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch() // Shrink timeouts based on success. mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f); mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f); - lldebugs << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl; + LL_DEBUGS() << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << LL_ENDL; } mTimelyFetchPending = FALSE; @@ -417,8 +417,8 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) //if(agent_id != gAgent.getID()) //This should never happen. //{ - // llwarns << "Got a UpdateInventoryItem for the wrong agent." - // << llendl; + // LL_WARNS() << "Got a UpdateInventoryItem for the wrong agent." + // << LL_ENDL; // break; //} @@ -512,8 +512,8 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) LLSD folder_sd = *folder_it; // These folders failed on the dataserver. We probably don't want to retry them. - llinfos << "Folder " << folder_sd["folder_id"].asString() - << "Error: " << folder_sd["error"].asString() << llendl; + LL_INFOS() << "Folder " << folder_sd["folder_id"].asString() + << "Error: " << folder_sd["error"].asString() << LL_ENDL; } } @@ -521,7 +521,7 @@ void LLInventoryModelFetchDescendentsResponder::result(const LLSD& content) if (fetcher->isBulkFetchProcessingComplete()) { - llinfos << "Inventory fetch completed" << llendl; + LL_INFOS() << "Inventory fetch completed" << LL_ENDL; fetcher->setAllFoldersFetched(); } @@ -533,8 +533,8 @@ void LLInventoryModelFetchDescendentsResponder::errorWithContent(U32 status, con { LLInventoryModelBackgroundFetch *fetcher = LLInventoryModelBackgroundFetch::getInstance(); - llinfos << "LLInventoryModelFetchDescendentsResponder::error [status:" - << status << "]: " << content << llendl; + LL_INFOS() << "LLInventoryModelFetchDescendentsResponder::error [status:" + << status << "]: " << content << LL_ENDL; fetcher->incrFetchCount(-1); diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 16427f2016dc2db13ce13ceeb9ec5745bd7fb780..2cbf9bb8b62b91f479c41724580f7e155993e123 100755 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -149,10 +149,10 @@ LLInventoryFetchItemsObserver::LLInventoryFetchItemsObserver(const uuid_vec_t& i void LLInventoryFetchItemsObserver::changed(U32 mask) { - lldebugs << this << " remaining incomplete " << mIncomplete.size() + LL_DEBUGS() << this << " remaining incomplete " << mIncomplete.size() << " complete " << mComplete.size() << " wait period " << mFetchingPeriod.getRemainingTimeF32() - << llendl; + << LL_ENDL; // scan through the incomplete items and move or erase them as // appropriate. @@ -176,7 +176,7 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) if (timeout_expired) { // Just concede that this item hasn't arrived in reasonable time and continue on. - llwarns << "Fetcher timed out when fetching inventory item UUID: " << item_id << LL_ENDL; + LL_WARNS() << "Fetcher timed out when fetching inventory item UUID: " << item_id << LL_ENDL; it = mIncomplete.erase(it); } else @@ -191,12 +191,12 @@ void LLInventoryFetchItemsObserver::changed(U32 mask) if (mIncomplete.empty()) { - lldebugs << this << " done at remaining incomplete " - << mIncomplete.size() << " complete " << mComplete.size() << llendl; + LL_DEBUGS() << this << " done at remaining incomplete " + << mIncomplete.size() << " complete " << mComplete.size() << LL_ENDL; done(); } - //llinfos << "LLInventoryFetchItemsObserver::changed() mComplete size " << mComplete.size() << llendl; - //llinfos << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << llendl; + //LL_INFOS() << "LLInventoryFetchItemsObserver::changed() mComplete size " << mComplete.size() << LL_ENDL; + //LL_INFOS() << "LLInventoryFetchItemsObserver::changed() mIncomplete size " << mIncomplete.size() << LL_ENDL; } void fetch_items_from_llsd(const LLSD& items_llsd) @@ -224,12 +224,12 @@ void fetch_items_from_llsd(const LLSD& items_llsd) { if (!gAgent.getRegion()) { - llwarns << "Agent's region is null" << llendl; + LL_WARNS() << "Agent's region is null" << LL_ENDL; break; } if (0 == body[i]["items"].size()) { - lldebugs << "Skipping body with no items to fetch" << llendl; + LL_DEBUGS() << "Skipping body with no items to fetch" << LL_ENDL; continue; } @@ -391,14 +391,14 @@ BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven gInventory.getDirectDescendentsOf(cat->getUUID(), cats, items); if (!cats || !items) { - llwarns << "Category '" << cat->getName() << "' descendents corrupted, fetch failed." << llendl; + LL_WARNS() << "Category '" << cat->getName() << "' descendents corrupted, fetch failed." << LL_ENDL; // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean // that the cat just doesn't have any items or subfolders). // Unrecoverable, so just return done so that this observer can be cleared // from memory. return TRUE; } - const S32 current_num_known_descendents = cats->count() + items->count(); + const S32 current_num_known_descendents = cats->size() + items->size(); // Got the number of descendents that we were expecting, so we're done. if (current_num_known_descendents == expected_num_descendents) @@ -411,7 +411,7 @@ BOOL LLInventoryFetchDescendentsObserver::isCategoryComplete(const LLViewerInven // count and thus the category thinks it has fewer descendents than it actually has. if (current_num_known_descendents >= expected_num_descendents) { - llwarns << "Category '" << cat->getName() << "' expected descendentcount:" << expected_num_descendents << " descendents but got descendentcount:" << current_num_known_descendents << llendl; + LL_WARNS() << "Category '" << cat->getName() << "' expected descendentcount:" << expected_num_descendents << " descendents but got descendentcount:" << current_num_known_descendents << LL_ENDL; const_cast<LLViewerInventoryCategory *>(cat)->setDescendentCount(current_num_known_descendents); return TRUE; } @@ -723,7 +723,7 @@ void LLInventoryCategoriesObserver::changed(U32 mask) gInventory.getDirectDescendentsOf(cat_id, cats, items); if (!cats || !items) { - llwarns << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << llendl; + LL_WARNS() << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << LL_ENDL; // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean // that the cat just doesn't have any items or subfolders). // Unrecoverable, so just skip this category. @@ -733,7 +733,7 @@ void LLInventoryCategoriesObserver::changed(U32 mask) continue; } - const S32 current_num_known_descendents = cats->count() + items->count(); + const S32 current_num_known_descendents = cats->size() + items->size(); bool cat_changed = false; @@ -794,7 +794,7 @@ bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t gInventory.getDirectDescendentsOf(cat_id, cats, items); if (!cats || !items) { - llwarns << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << llendl; + LL_WARNS() << "Category '" << category->getName() << "' descendents corrupted, fetch failed." << LL_ENDL; // NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean // that the cat just doesn't have any items or subfolders). // Unrecoverable, so just return "false" meaning that the category can't be observed. @@ -804,7 +804,7 @@ bool LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t } else { - current_num_known_descendents = cats->count() + items->count(); + current_num_known_descendents = cats->size() + items->size(); } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 2528de5cccd72defcb03d0907860cafdf1cb9c2b..e74e58015a7c87b9fbd924ae08fca7ad8e21bf2c 100755 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -416,10 +416,10 @@ LLInventoryFilter::EFolderShow LLInventoryPanel::getShowFolderState() } // Called when something changed in the global model (new item, item coming through the wire, rename, move, etc...) (CHUI-849) +static LLTrace::BlockTimerStatHandle FTM_REFRESH("Inventory Refresh"); void LLInventoryPanel::modelChanged(U32 mask) { - static LLFastTimer::DeclareTimer FTM_REFRESH("Inventory Refresh"); - LLFastTimer t2(FTM_REFRESH); + LL_RECORD_BLOCK_TIME(FTM_REFRESH); if (!mViewsInitialized) return; @@ -606,7 +606,7 @@ LLUUID LLInventoryPanel::getRootFolderID() root_id = gInventory.findCategoryUUIDForType(preferred_type, false); if (root_id.isNull()) { - llwarns << "Could not find folder of type " << preferred_type << llendl; + LL_WARNS() << "Could not find folder of type " << preferred_type << LL_ENDL; root_id.generateNewID(); } } @@ -686,7 +686,7 @@ void LLInventoryPanel::idle(void* user_data) } else { - llwarns << "Inventory : Deleted folder root detected on panel" << llendl; + LL_WARNS() << "Inventory : Deleted folder root detected on panel" << LL_ENDL; panel->clearFolderRoot(); } } @@ -782,9 +782,9 @@ LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id) if (objectp->getType() <= LLAssetType::AT_NONE || objectp->getType() >= LLAssetType::AT_COUNT) { - llwarns << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : " + LL_WARNS() << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : " << ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID() - << llendl; + << LL_ENDL; return NULL; } @@ -1049,7 +1049,7 @@ bool LLInventoryPanel::beginIMSession() std::string name; - LLDynamicArray<LLUUID> members; + std::vector<LLUUID> members; EInstantMessage type = IM_SESSION_CONFERENCE_START; std::set<LLFolderViewItem*>::const_iterator iter; @@ -1077,7 +1077,7 @@ bool LLInventoryPanel::beginIMSession() item_array, LLInventoryModel::EXCLUDE_TRASH, is_buddy); - S32 count = item_array.count(); + S32 count = item_array.size(); if(count > 0) { //*TODO by what to replace that? @@ -1088,10 +1088,10 @@ bool LLInventoryPanel::beginIMSession() LLUUID id; for(S32 i = 0; i < count; ++i) { - id = item_array.get(i)->getCreatorUUID(); + id = item_array.at(i)->getCreatorUUID(); if(at.isBuddyOnline(id)) { - members.put(id); + members.push_back(id); } } } @@ -1111,7 +1111,7 @@ bool LLInventoryPanel::beginIMSession() if(at.isBuddyOnline(id)) { - members.put(id); + members.push_back(id); } } } //if IT_CALLINGCARD @@ -1186,7 +1186,7 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory"); if (!floater_inventory) { - llwarns << "Could not find My Inventory floater" << llendl; + LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL; return FALSE; } @@ -1320,10 +1320,10 @@ void LLInventoryPanel::removeItemID(const LLUUID& id) } } -LLFastTimer::DeclareTimer FTM_GET_ITEM_BY_ID("Get FolderViewItem by ID"); +LLTrace::BlockTimerStatHandle FTM_GET_ITEM_BY_ID("Get FolderViewItem by ID"); LLFolderViewItem* LLInventoryPanel::getItemByID(const LLUUID& id) { - LLFastTimer _(FTM_GET_ITEM_BY_ID); + LL_RECORD_BLOCK_TIME(FTM_GET_ITEM_BY_ID); std::map<LLUUID, LLFolderViewItem*>::iterator map_it; map_it = mItemMap.find(id); diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index c0ce5136940332353832a10bd971c784ec9b72ae..91c3efd8f0db25163f7d3fb22e78ebc63a2229f7 100755 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -29,7 +29,6 @@ #define LL_LLINVENTORYPANEL_H #include "llassetstorage.h" -#include "lldarray.h" #include "llfolderviewitem.h" #include "llfolderviewmodelinventory.h" #include "llfloater.h" diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 3d1f186bba1cbbe85d1ae7d0a8af4c3ced3c83fb..d38f90015e80f082a9614e20064447a5484c40b9 100755 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -121,7 +121,7 @@ void LLJoystick::updateSlop() break; default: - llerrs << "LLJoystick::LLJoystick() - bad switch case" << llendl; + LL_ERRS() << "LLJoystick::LLJoystick() - bad switch case" << LL_ENDL; break; } @@ -132,7 +132,7 @@ bool LLJoystick::pointInCircle(S32 x, S32 y) const { if(this->getLocalRect().getHeight() != this->getLocalRect().getWidth()) { - llwarns << "Joystick shape is not square"<<llendl; + LL_WARNS() << "Joystick shape is not square"<<LL_ENDL; return true; } //center is x and y coordinates of center of joystick circle, and also its radius @@ -143,7 +143,7 @@ bool LLJoystick::pointInCircle(S32 x, S32 y) const BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask) { - //llinfos << "joystick mouse down " << x << ", " << y << llendl; + //LL_INFOS() << "joystick mouse down " << x << ", " << y << LL_ENDL; bool handles = false; if(pointInCircle(x, y)) @@ -160,7 +160,7 @@ BOOL LLJoystick::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLJoystick::handleMouseUp(S32 x, S32 y, MASK mask) { - // llinfos << "joystick mouse up " << x << ", " << y << llendl; + // LL_INFOS() << "joystick mouse up " << x << ", " << y << LL_ENDL; if( hasMouseCapture() ) { @@ -271,7 +271,7 @@ void LLJoystickAgentTurn::onHeldDown() F32 time = getElapsedHeldDownTime(); updateSlop(); - //llinfos << "move forward/backward (and/or turn)" << llendl; + //LL_INFOS() << "move forward/backward (and/or turn)" << LL_ENDL; S32 dx = mLastMouse.mX - mFirstMouse.mX + mInitialOffset.mX; S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY; @@ -353,7 +353,7 @@ void LLJoystickAgentSlide::onMouseUp() void LLJoystickAgentSlide::onHeldDown() { - //llinfos << "slide left/right (and/or move forward/backward)" << llendl; + //LL_INFOS() << "slide left/right (and/or move forward/backward)" << LL_ENDL; updateSlop(); @@ -504,7 +504,7 @@ F32 LLJoystickCameraRotate::getOrbitRate() if( time < NUDGE_TIME ) { F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME; - //llinfos << rate << llendl; + //LL_INFOS() << rate << LL_ENDL; return rate; } else diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index 6625a194fb7e1d0f4e0faf5ce5b12b8b3ee15d9f..f893daaeb2a752edf9398a788f21b334054e6ac9 100755 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -233,7 +233,7 @@ bool LLLandmarkActions::canCreateLandmarkHere() LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if(!agent_parcel) { - llwarns << "No agent region" << llendl; + LL_WARNS() << "No agent region" << LL_ENDL; return false; } if (agent_parcel->getAllowLandmark() @@ -252,13 +252,13 @@ void LLLandmarkActions::createLandmarkHere( { if(!gAgent.getRegion()) { - llwarns << "No agent region" << llendl; + LL_WARNS() << "No agent region" << LL_ENDL; return; } LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!agent_parcel) { - llwarns << "No agent parcel" << llendl; + LL_WARNS() << "No agent parcel" << LL_ENDL; return; } if (!canCreateLandmarkHere()) diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp index a92df8250eb9eee7cb65c73eeb974e55f3b8f9ef..c58540914e1a4aad0f32a302cec8acc50c92b2b4 100755 --- a/indra/newview/lllandmarklist.cpp +++ b/indra/newview/lllandmarklist.cpp @@ -142,8 +142,7 @@ void LLLandmarkList::processGetAssetReply( } else { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - // SJB: No use case for a notification here. Use lldebugs instead + // SJB: No use case for a notification here. Use LL_DEBUGS() instead if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ) { LL_WARNS("Landmarks") << "Missing Landmark" << LL_ENDL; @@ -176,7 +175,7 @@ void LLLandmarkList::onRegionHandle(const LLUUID& landmark_id) if (!landmark) { - llwarns << "Got region handle but the landmark not found." << llendl; + LL_WARNS() << "Got region handle but the landmark not found." << LL_ENDL; return; } @@ -185,7 +184,7 @@ void LLLandmarkList::onRegionHandle(const LLUUID& landmark_id) LLVector3d pos; if (!landmark->getGlobalPos(pos)) { - llwarns << "Got region handle but the landmark global position is still unknown." << llendl; + LL_WARNS() << "Got region handle but the landmark global position is still unknown." << LL_ENDL; return; } @@ -198,7 +197,7 @@ void LLLandmarkList::makeCallbacks(const LLUUID& landmark_id) if (!landmark) { - llwarns << "Landmark to make callbacks for not found." << llendl; + LL_WARNS() << "Landmark to make callbacks for not found." << LL_ENDL; } // make all the callbacks here. diff --git a/indra/newview/lllistcontextmenu.cpp b/indra/newview/lllistcontextmenu.cpp index 6421ab42bfe605d066341aff757e8da2b0260ef6..a624c9fb879506f218fb839225d1a00cb8748df0 100755 --- a/indra/newview/lllistcontextmenu.cpp +++ b/indra/newview/lllistcontextmenu.cpp @@ -80,7 +80,7 @@ void LLListContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 menup = createMenu(); if (!menup) { - llwarns << "Context menu creation failed" << llendl; + LL_WARNS() << "Context menu creation failed" << LL_ENDL; return; } diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 2d9385390b45bbd893d4a815b2712f035d6f2fdf..194847553021b561e811369af0ecb8eb3afe32bd 100755 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -48,6 +48,7 @@ /* misc headers */ #include "llscrolllistctrl.h" #include "llfilepicker.h" +#include "lllocaltextureobject.h" #include "llviewertexturelist.h" #include "llviewerobjectlist.h" #include "llviewerobject.h" @@ -110,8 +111,8 @@ LLLocalBitmap::LLLocalBitmap(std::string filename) } else { - llwarns << "File of no valid extension given, local bitmap creation aborted." << "\n" - << "Filename: " << mFilename << llendl; + LL_WARNS() << "File of no valid extension given, local bitmap creation aborted." << "\n" + << "Filename: " << mFilename << LL_ENDL; return; // no valid extension. } @@ -230,10 +231,10 @@ bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate) } else { - llwarns << "During the update process the following file was found" << "\n" + LL_WARNS() << "During the update process the following file was found" << "\n" << "but could not be opened or decoded for " << LL_LOCAL_UPDATE_RETRIES << " attempts." << "\n" << "Filename: " << mFilename << "\n" - << "Disabling further update attempts for this file." << llendl; + << "Disabling further update attempts for this file." << LL_ENDL; LLSD notif_args; notif_args["FNAME"] = mFilename; @@ -249,9 +250,9 @@ bool LLLocalBitmap::updateSelf(EUpdateType optional_firstupdate) else { - llwarns << "During the update process, the following file was not found." << "\n" + LL_WARNS() << "During the update process, the following file was not found." << "\n" << "Filename: " << mFilename << "\n" - << "Disabling further update attempts for this file." << llendl; + << "Disabling further update attempts for this file." << LL_ENDL; LLSD notif_args; notif_args["FNAME"] = mFilename; @@ -317,13 +318,13 @@ bool LLLocalBitmap::decodeBitmap(LLPointer<LLImageRaw> rawimg) default: { - // separating this into -several- llwarns calls because in the extremely unlikely case that this happens + // separating this into -several- LL_WARNS() calls because in the extremely unlikely case that this happens // accessing mFilename and any other object properties might very well crash the viewer. // getting here should be impossible, or there's been a pretty serious bug. - llwarns << "During a decode attempt, the following local bitmap had no properly assigned extension." << llendl; - llwarns << "Filename: " << mFilename << llendl; - llwarns << "Disabling further update attempts for this file." << llendl; + LL_WARNS() << "During a decode attempt, the following local bitmap had no properly assigned extension." << LL_ENDL; + LL_WARNS() << "Filename: " << mFilename << LL_ENDL; + LL_WARNS() << "Disabling further update attempts for this file." << LL_ENDL; mLinkStatus = LS_BROKEN; } } @@ -336,8 +337,8 @@ void LLLocalBitmap::replaceIDs(LLUUID old_id, LLUUID new_id) // checking for misuse. if (old_id == new_id) { - llinfos << "An attempt was made to replace a texture with itself. (matching UUIDs)" << "\n" - << "Texture UUID: " << old_id.asString() << llendl; + LL_INFOS() << "An attempt was made to replace a texture with itself. (matching UUIDs)" << "\n" + << "Texture UUID: " << old_id.asString() << LL_ENDL; return; } @@ -378,7 +379,7 @@ std::vector<LLViewerObject*> LLLocalBitmap::prepUpdateObjects(LLUUID old_id, U32 { std::vector<LLViewerObject*> obj_list; LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id); - + for(U32 face_iterator = 0; face_iterator < old_texture->getNumFaces(channel); face_iterator++) { // getting an object from a face @@ -451,7 +452,7 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel) switch(channel) { case LLRender::DIFFUSE_MAP: - { + { object->setTETexture(face_iter, new_id); update_tex = true; break; @@ -768,11 +769,11 @@ LLAvatarAppearanceDefines::ETextureIndex LLLocalBitmap::getTexIndex( default: { - llwarns << "Unknown wearable type: " << (int)type << "\n" + LL_WARNS() << "Unknown wearable type: " << (int)type << "\n" << "Baked Texture Index: " << (int)baked_texind << "\n" << "Filename: " << mFilename << "\n" << "TrackingID: " << mTrackingID << "\n" - << "InworldID: " << mWorldID << llendl; + << "InworldID: " << mWorldID << LL_ENDL; } } @@ -844,8 +845,8 @@ bool LLLocalBitmapMgr::addUnit() } else { - llwarns << "Attempted to add invalid or unreadable image file, attempt cancelled.\n" - << "Filename: " << filename << llendl; + LL_WARNS() << "Attempted to add invalid or unreadable image file, attempt cancelled.\n" + << "Filename: " << filename << LL_ENDL; LLSD notif_args; notif_args["FNAME"] = filename; diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h index 2ee84bf46e72970d7283df83ba6b4096860f839f..47c077dcab47798f215a9ef02f2eb18f238054ae 100755 --- a/indra/newview/lllocalbitmaps.h +++ b/indra/newview/lllocalbitmaps.h @@ -30,11 +30,11 @@ #include "llavatarappearancedefines.h" #include "lleventtimer.h" -#include "llimage.h" #include "llpointer.h" #include "llwearabletype.h" class LLScrollListCtrl; +class LLImageRaw; class LLViewerObject; class LLLocalBitmap diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp index 5138c5e62092857448bb30c94ee5fdd4fedd732b..680b35b55080ff5cb5356f77c59c20ef54cf431b 100755 --- a/indra/newview/lllocationhistory.cpp +++ b/indra/newview/lllocationhistory.cpp @@ -107,11 +107,11 @@ bool LLLocationHistory::getMatchingItems(const std::string& substring, location_ void LLLocationHistory::dump() const { - llinfos << "Location history dump:" << llendl; + LL_INFOS() << "Location history dump:" << LL_ENDL; int i = 0; for (location_list_t::const_iterator it = mItems.begin(); it != mItems.end(); ++it, ++i) { - llinfos << "#" << std::setw(2) << std::setfill('0') << i << ": " << it->getLocation() << llendl; + LL_INFOS() << "#" << std::setw(2) << std::setfill('0') << i << ": " << it->getLocation() << LL_ENDL; } } @@ -122,7 +122,7 @@ void LLLocationHistory::save() const if (resolved_filename.empty()) { - llinfos << "can't get path to location history filename - probably not logged in yet." << llendl; + LL_INFOS() << "can't get path to location history filename - probably not logged in yet." << LL_ENDL; return; } @@ -130,7 +130,7 @@ void LLLocationHistory::save() const llofstream file (resolved_filename); if (!file.is_open()) { - llwarns << "can't open location history file \"" << mFilename << "\" for writing" << llendl; + LL_WARNS() << "can't open location history file \"" << mFilename << "\" for writing" << LL_ENDL; return; } @@ -144,7 +144,7 @@ void LLLocationHistory::save() const void LLLocationHistory::load() { - llinfos << "Loading location history." << llendl; + LL_INFOS() << "Loading location history." << LL_ENDL; // build filename for each user std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename); @@ -152,7 +152,7 @@ void LLLocationHistory::load() if (!file.is_open()) { - llwarns << "can't load location history from file \"" << mFilename << "\"" << llendl; + LL_WARNS() << "can't load location history from file \"" << mFilename << "\"" << LL_ENDL; return; } @@ -166,7 +166,7 @@ void LLLocationHistory::load() std::istringstream iss(line); if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE) { - llinfos<< "Parsing saved teleport history failed" << llendl; + LL_INFOS()<< "Parsing saved teleport history failed" << LL_ENDL; break; } diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index dbdff11f112498c1247d0777d21ec77b92043183..af194aaa1d3eb07a43cea58e6e8d21626c5de59e 100755 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -384,7 +384,7 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) mLocationContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_navbar.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); if (!mLocationContextMenu) { - llwarns << "Error loading navigation bar context menu" << llendl; + LL_WARNS() << "Error loading navigation bar context menu" << LL_ENDL; } getTextEntry()->setRightMouseUpCallback(boost::bind(&LLLocationInputCtrl::onTextEditorRightClicked,this,_2,_3,_4)); @@ -777,7 +777,7 @@ void LLLocationInputCtrl::refreshLocation() (mTextEntry && mTextEntry->hasFocus()) || (mAddLandmarkBtn->hasFocus())) { - llwarns << "Location input should not be refreshed when having focus" << llendl; + LL_WARNS() << "Location input should not be refreshed when having focus" << LL_ENDL; return; } diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index d0ecf80706ada5abfdcae41a4b0da4396d8ba9ac..06e517a8612144f6ce0d11bd91eb9cf31304b755 100755 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -297,7 +297,7 @@ void LLLogChat::saveHistory(const std::string& filename, if (tmp_filename.empty()) { std::string warn = "Chat history filename [" + filename + "] is empty!"; - llwarning(warn, 666); + LL_WARNS() << warn << LL_ENDL; llassert(tmp_filename.size()); return; } @@ -305,7 +305,7 @@ void LLLogChat::saveHistory(const std::string& filename, llofstream file (LLLogChat::makeLogFileName(filename), std::ios_base::app); if (!file.is_open()) { - llwarns << "Couldn't open chat history log! - " + filename << llendl; + LL_WARNS() << "Couldn't open chat history log! - " + filename << LL_ENDL; return; } @@ -811,7 +811,7 @@ void LLChatLogFormatter::format(const LLSD& im, std::ostream& ostr) const { if (!im.isMap()) { - llwarning("invalid LLSD type of an instant message", 0); + LL_WARNS() << "invalid LLSD type of an instant message" << LL_ENDL; return; } @@ -951,11 +951,9 @@ LLDeleteHistoryThread::LLDeleteHistoryThread(std::list<LLSD>* messages, LLLoadHi mLoadThread(loadThread) { } - LLDeleteHistoryThread::~LLDeleteHistoryThread() { } - void LLDeleteHistoryThread::run() { if (mLoadThread != NULL) diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index 81f75ef6265575b407c27229f2a25f428a172129..ca597599dddcb729f3b3aeee43150b7efbf856c9 100755 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -26,6 +26,7 @@ #ifndef LL_LLLOGCHAT_H #define LL_LLLOGCHAT_H +#include "llthread.h" class LLChat; diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index f681c127474933238fa6100e10a4484a38c0e178..df59283bc406877863c7660f71a00a66d8574328 100755 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -202,7 +202,7 @@ MandatoryUpdateMachine::MandatoryUpdateMachine(LLLoginInstance & loginInstance, void MandatoryUpdateMachine::start(void) { - llinfos << "starting mandatory update machine" << llendl; + LL_INFOS() << "starting mandatory update machine" << LL_ENDL; if(mUpdaterService.isChecking()) { switch(mUpdaterService.getState()) { @@ -268,7 +268,7 @@ MandatoryUpdateMachine::CheckingForUpdate::CheckingForUpdate(MandatoryUpdateMach void MandatoryUpdateMachine::CheckingForUpdate::enter(void) { - llinfos << "entering checking for update" << llendl; + LL_INFOS() << "entering checking for update" << LL_ENDL; mProgressView = gViewerWindow->getProgressView(); mProgressView->setMessage("Looking for update..."); @@ -327,7 +327,7 @@ MandatoryUpdateMachine::Error::Error(MandatoryUpdateMachine & machine): void MandatoryUpdateMachine::Error::enter(void) { - llinfos << "entering error" << llendl; + LL_INFOS() << "entering error" << LL_ENDL; LLNotificationsUtil::add("FailedRequiredUpdateInstall", LLSD(), LLSD(), boost::bind(&MandatoryUpdateMachine::Error::onButtonClicked, this, _1, _2)); } @@ -358,7 +358,7 @@ MandatoryUpdateMachine::ReadyToInstall::ReadyToInstall(MandatoryUpdateMachine & void MandatoryUpdateMachine::ReadyToInstall::enter(void) { - llinfos << "entering ready to install" << llendl; + LL_INFOS() << "entering ready to install" << LL_ENDL; // Open update ready dialog. } @@ -383,7 +383,7 @@ MandatoryUpdateMachine::StartingUpdaterService::StartingUpdaterService(Mandatory void MandatoryUpdateMachine::StartingUpdaterService::enter(void) { - llinfos << "entering start update service" << llendl; + LL_INFOS() << "entering start update service" << LL_ENDL; LLNotificationsUtil::add("UpdaterServiceNotRunning", LLSD(), LLSD(), boost::bind(&MandatoryUpdateMachine::StartingUpdaterService::onButtonClicked, this, _1, _2)); } @@ -420,7 +420,7 @@ MandatoryUpdateMachine::WaitingForDownload::WaitingForDownload(MandatoryUpdateMa void MandatoryUpdateMachine::WaitingForDownload::enter(void) { - llinfos << "entering waiting for download" << llendl; + LL_INFOS() << "entering waiting for download" << LL_ENDL; mProgressView = gViewerWindow->getProgressView(); mProgressView->setMessage("Downloading update..."); std::ostringstream stream; @@ -589,7 +589,7 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia unsigned char hashed_unique_id_string[MD5HEX_STR_SIZE]; if ( ! llHashedUniqueID(hashed_unique_id_string) ) { - llwarns << "Not providing a unique id in request params" << llendl; + LL_WARNS() << "Not providing a unique id in request params" << LL_ENDL; } request_params["start"] = construct_start_string(); request_params["skipoptional"] = mSkipOptionalUpdate; @@ -621,7 +621,7 @@ bool LLLoginInstance::handleLoginEvent(const LLSD& event) if(!(event.has("state") && event.has("change") && event.has("progress"))) { - llerrs << "Unknown message from LLLogin: " << event << llendl; + LL_ERRS() << "Unknown message from LLLogin: " << event << LL_ENDL; } mLoginState = event["state"].asString(); @@ -656,7 +656,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) // to reconnect or to end the attempt in failure. if(reason_response == "tos") { - llinfos << "LLLoginInstance::handleLoginFailure ToS" << llendl; + LL_INFOS() << "LLLoginInstance::handleLoginFailure ToS" << LL_ENDL; LLSD data(LLSD::emptyMap()); data["message"] = message_response; @@ -671,7 +671,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) } else if(reason_response == "critical") { - llinfos << "LLLoginInstance::handleLoginFailure Crit" << llendl; + LL_INFOS() << "LLLoginInstance::handleLoginFailure Crit" << LL_ENDL; LLSD data(LLSD::emptyMap()); data["message"] = message_response; @@ -696,27 +696,27 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) } else if(reason_response == "update" || gSavedSettings.getBOOL("ForceMandatoryUpdate")) { - llinfos << "LLLoginInstance::handleLoginFailure update" << llendl; + LL_INFOS() << "LLLoginInstance::handleLoginFailure update" << LL_ENDL; gSavedSettings.setBOOL("ForceMandatoryUpdate", FALSE); updateApp(true, message_response); } else if(reason_response == "optional") { - llinfos << "LLLoginInstance::handleLoginFailure optional" << llendl; + LL_INFOS() << "LLLoginInstance::handleLoginFailure optional" << LL_ENDL; updateApp(false, message_response); } else { - llinfos << "LLLoginInstance::handleLoginFailure attemptComplete" << llendl; + LL_INFOS() << "LLLoginInstance::handleLoginFailure attemptComplete" << LL_ENDL; attemptComplete(); } } void LLLoginInstance::handleLoginSuccess(const LLSD& event) { - llinfos << "LLLoginInstance::handleLoginSuccess" << llendl; + LL_INFOS() << "LLLoginInstance::handleLoginSuccess" << LL_ENDL; if(gSavedSettings.getBOOL("ForceMandatoryUpdate")) { @@ -740,7 +740,7 @@ void LLLoginInstance::handleDisconnect(const LLSD& event) { // placeholder - llinfos << "LLLoginInstance::handleDisconnect placeholder " << llendl; + LL_INFOS() << "LLLoginInstance::handleDisconnect placeholder " << LL_ENDL; } void LLLoginInstance::handleIndeterminate(const LLSD& event) @@ -754,7 +754,7 @@ void LLLoginInstance::handleIndeterminate(const LLSD& event) LLSD message = event.get("data").get("message"); if(message.isDefined()) { - llinfos << "LLLoginInstance::handleIndeterminate " << message.asString() << llendl; + LL_INFOS() << "LLLoginInstance::handleIndeterminate " << message.asString() << LL_ENDL; LLSD progress_update; progress_update["desc"] = message; @@ -766,7 +766,7 @@ bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key) { if(accepted) { - llinfos << "LLLoginInstance::handleTOSResponse: accepted" << llendl; + LL_INFOS() << "LLLoginInstance::handleTOSResponse: accepted" << LL_ENDL; // Set the request data to true and retry login. mRequestData["params"][key] = true; @@ -774,7 +774,7 @@ bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key) } else { - llinfos << "LLLoginInstance::handleTOSResponse: attemptComplete" << llendl; + LL_INFOS() << "LLLoginInstance::handleTOSResponse: attemptComplete" << LL_ENDL; attemptComplete(); } diff --git a/indra/newview/llmainlooprepeater.cpp b/indra/newview/llmainlooprepeater.cpp index 5c020e6d982eb7060b857a800f36b4d050f87f25..db8d2e4edeaba9ac979d2931bf419f0b4674d8bc 100755 --- a/indra/newview/llmainlooprepeater.cpp +++ b/indra/newview/llmainlooprepeater.cpp @@ -81,7 +81,7 @@ bool LLMainLoopRepeater::onMessage(LLSD const & event) try { mQueue->pushFront(event); } catch(LLThreadSafeQueueError & e) { - llwarns << "could not repeat message (" << e.what() << ")" << + LL_WARNS() << "could not repeat message (" << e.what() << ")" << event.asString() << LL_ENDL; } return false; diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index a7d6cb5eac0ae4e35b201b07162952d903585965..bbcdcb126d0abeace5d7af5aab742cd8da121d43 100755 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -226,11 +226,11 @@ BOOL LLManip::handleHover(S32 x, S32 y, MASK mask) setMouseCapture( FALSE ); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManip (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManip (active)" << LL_ENDL; } else { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManip (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManip (inactive)" << LL_ENDL; } gViewerWindow->setCursor(UI_CURSOR_ARROW); return TRUE; diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 4cbdfde8689b59c9b1919d3ac12ee3ebc2398691..8185cbb1a36ea92896449a08cf9c489e253f9acf 100755 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -240,7 +240,7 @@ void LLManipRotate::render() if (mManipPart == LL_ROT_Z) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.pushMatrix(); { // selected part @@ -251,7 +251,7 @@ void LLManipRotate::render() } else if (mManipPart == LL_ROT_Y) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.pushMatrix(); { gGL.rotatef( 90.f, 1.f, 0.f, 0.f ); @@ -262,7 +262,7 @@ void LLManipRotate::render() } else if (mManipPart == LL_ROT_X) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.pushMatrix(); { gGL.rotatef( 90.f, 0.f, 1.f, 0.f ); @@ -273,13 +273,13 @@ void LLManipRotate::render() } else if (mManipPart == LL_ROT_ROLL) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } else if (mManipPart == LL_NO_PART) { if (mHighlightedPart == LL_NO_PART) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } LLGLEnable cull_face(GL_CULL_FACE); @@ -294,7 +294,7 @@ void LLManipRotate::render() { if (mHighlightedPart == LL_ROT_Z) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]); // hovering over part gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f ), LLColor4( 0.f, 0.f, 1.f, 0.5f ), CIRCLE_STEPS, i); @@ -312,7 +312,7 @@ void LLManipRotate::render() gGL.rotatef( 90.f, 1.f, 0.f, 0.f ); if (mHighlightedPart == LL_ROT_Y) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]); // hovering over part gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f ), LLColor4( 0.f, 1.f, 0.f, 0.5f ), CIRCLE_STEPS, i); @@ -330,7 +330,7 @@ void LLManipRotate::render() gGL.rotatef( 90.f, 0.f, 1.f, 0.f ); if (mHighlightedPart == LL_ROT_X) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]); // hovering over part @@ -346,7 +346,7 @@ void LLManipRotate::render() if (mHighlightedPart == LL_ROT_ROLL) { - mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } } @@ -519,12 +519,12 @@ BOOL LLManipRotate::handleHover(S32 x, S32 y, MASK mask) drag(x, y); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipRotate (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManipRotate (active)" << LL_ENDL; } else { highlightManipulators(x, y); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipRotate (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManipRotate (inactive)" << LL_ENDL; } gViewerWindow->setCursor(UI_CURSOR_TOOLROTATE); @@ -1272,9 +1272,9 @@ LLVector3 LLManipRotate::getConstraintAxis() else { #ifndef LL_RELEASE_FOR_DOWNLOAD - llerrs << "Got bogus hit part in LLManipRotate::getConstraintAxis():" << mManipPart << llendl; + LL_ERRS() << "Got bogus hit part in LLManipRotate::getConstraintAxis():" << mManipPart << LL_ENDL; #else - llwarns << "Got bogus hit part in LLManipRotate::getConstraintAxis():" << mManipPart << llendl; + LL_WARNS() << "Got bogus hit part in LLManipRotate::getConstraintAxis():" << mManipPart << LL_ENDL; #endif axis.mV[0] = 1.f; } diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 087f617bbb4ac1431ee46b5979644cf03eca5089..8c531e476d935e753111ec56cf8708bdd86ccfe6 100755 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -413,7 +413,7 @@ BOOL LLManipScale::handleHover(S32 x, S32 y, MASK mask) { drag( x, y ); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipScale (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManipScale (active)" << LL_ENDL; } else { @@ -524,7 +524,7 @@ void LLManipScale::highlightManipulators(S32 x, S32 y) { mHighlightedPart = manipulator->mManipID; - //llinfos << "Tried: " << mHighlightedPart << llendl; + //LL_INFOS() << "Tried: " << mHighlightedPart << LL_ENDL; break; } } @@ -535,15 +535,15 @@ void LLManipScale::highlightManipulators(S32 x, S32 y) { if (mHighlightedPart == MANIPULATOR_IDS[i]) { - mManipulatorScales[i] = lerp(mManipulatorScales[i], SELECTED_MANIPULATOR_SCALE, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales[i] = lerp(mManipulatorScales[i], SELECTED_MANIPULATOR_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } else { - mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); + mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); } } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipScale (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManipScale (inactive)" << LL_ENDL; } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 06bf2944172ca8ba125d8b65b8e02169c65571bf..da8235ee5fd31d2c8600bf3af1242c81edf9061d 100755 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -355,7 +355,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) if (!selectNode) { // didn't find the object in our selection...oh well - llwarns << "Trying to translate an unselected object" << llendl; + LL_WARNS() << "Trying to translate an unselected object" << LL_ENDL; return TRUE; } @@ -363,7 +363,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) if (!selected_object) { // somehow we lost the object! - llwarns << "Translate manip lost the object, no selected object" << llendl; + LL_WARNS() << "Translate manip lost the object, no selected object" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); return TRUE; } @@ -384,7 +384,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(select_center_agent, mouse_pos)) { // mouse_pos may be nonsense - llwarns << "Failed to project object center to screen" << llendl; + LL_WARNS() << "Failed to project object center to screen" << LL_ENDL; } else if (gSavedSettings.getBOOL("SnapToMouseCursor")) { @@ -412,7 +412,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) // Bail out if mouse not down. if( !hasMouseCapture() ) { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (inactive)" << LL_ENDL; // Always show cursor // gViewerWindow->setCursor(UI_CURSOR_ARROW); gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); @@ -448,7 +448,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) // rotation above. if( x == mLastHoverMouseX && y == mLastHoverMouseY && !rotated) { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (mouse unmoved)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (mouse unmoved)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); return TRUE; } @@ -461,7 +461,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) { if (abs(mMouseDownX - x) < MOUSE_DRAG_SLOP && abs(mMouseDownY - y) < MOUSE_DRAG_SLOP ) { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (mouse inside slop)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (mouse inside slop)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); return TRUE; } @@ -478,7 +478,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) // When we make the copy, we don't want to do any other processing. // If so, the object will also be moved, and the copy will be offset. - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (made copy)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (made copy)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); } } @@ -495,7 +495,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) if (!selectNode) { // somehow we lost the object! - llwarns << "Translate manip lost the object, no selectNode" << llendl; + LL_WARNS() << "Translate manip lost the object, no selectNode" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); return TRUE; } @@ -504,7 +504,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) if (!object) { // somehow we lost the object! - llwarns << "Translate manip lost the object, no object in selectNode" << llendl; + LL_WARNS() << "Translate manip lost the object, no object in selectNode" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); return TRUE; } @@ -531,7 +531,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) if (relative_move.magVecSquared() > max_drag_distance * max_drag_distance) { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (too far)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (too far)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_NOLOCKED); return TRUE; } @@ -776,7 +776,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) gAgentCamera.clearFocusObject(); dialog_refresh_all(); // ??? is this necessary? - lldebugst(LLERR_USER_INPUT) << "hover handled by LLManipTranslate (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLManipTranslate (active)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLTRANSLATE); return TRUE; } @@ -1905,18 +1905,18 @@ void LLManipTranslate::renderTranslationHandles() { if (index == mManipPart - LL_X_ARROW || index == mHighlightedPart - LL_X_ARROW) { - mArrowScales.mV[index] = lerp(mArrowScales.mV[index], SELECTED_ARROW_SCALE, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); - mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mArrowScales.mV[index] = lerp(mArrowScales.mV[index], SELECTED_ARROW_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); } else if (index == mManipPart - LL_YZ_PLANE || index == mHighlightedPart - LL_YZ_PLANE) { - mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); - mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], SELECTED_ARROW_SCALE, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], SELECTED_ARROW_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); } else { - mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); - mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); + mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); } } @@ -2251,7 +2251,7 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_ axis.mV[0] = 1.0f; break; default: - llerrs << "renderArrow called with bad arrow " << which_arrow << llendl; + LL_ERRS() << "renderArrow called with bad arrow " << which_arrow << LL_ENDL; break; } diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 05c9d768100d83bd814fbb7bbead608036e7e2bc..7907e700c410176f40e12f5c03773d4de9b87c99 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -133,10 +133,10 @@ namespace LLMarketplaceImport if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { - llinfos << " SLM POST status: " << status << llendl; - llinfos << " SLM POST reason: " << reason << llendl; - llinfos << " SLM POST content: " << content.asString() << llendl; - llinfos << " SLM POST timer: " << slmPostTimer.getElapsedTimeF32() << llendl; + LL_INFOS() << " SLM POST status: " << status << LL_ENDL; + LL_INFOS() << " SLM POST reason: " << reason << LL_ENDL; + LL_INFOS() << " SLM POST content: " << content.asString() << LL_ENDL; + LL_INFOS() << " SLM POST timer: " << slmPostTimer.getElapsedTimeF32() << LL_ENDL; } // MAINT-2301 : we determined we can safely ignore that error in that context @@ -144,7 +144,7 @@ namespace LLMarketplaceImport { if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { - llinfos << " SLM POST : Ignoring time out status and treating it as success" << llendl; + LL_INFOS() << " SLM POST : Ignoring time out status and treating it as success" << LL_ENDL; } status = MarketplaceErrorCodes::IMPORT_DONE; } @@ -153,7 +153,7 @@ namespace LLMarketplaceImport { if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { - llinfos << " SLM POST clearing marketplace cookie due to client or server error" << llendl; + LL_INFOS() << " SLM POST clearing marketplace cookie due to client or server error" << LL_ENDL; } sMarketplaceCookie.clear(); } @@ -186,10 +186,10 @@ namespace LLMarketplaceImport if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { - llinfos << " SLM GET status: " << status << llendl; - llinfos << " SLM GET reason: " << reason << llendl; - llinfos << " SLM GET content: " << content.asString() << llendl; - llinfos << " SLM GET timer: " << slmGetTimer.getElapsedTimeF32() << llendl; + LL_INFOS() << " SLM GET status: " << status << LL_ENDL; + LL_INFOS() << " SLM GET reason: " << reason << LL_ENDL; + LL_INFOS() << " SLM GET content: " << content.asString() << LL_ENDL; + LL_INFOS() << " SLM GET timer: " << slmGetTimer.getElapsedTimeF32() << LL_ENDL; } // MAINT-2452 : Do not clear the cookie on IMPORT_DONE_WITH_ERRORS : Happens when trying to import objects with wrong permissions @@ -200,13 +200,13 @@ namespace LLMarketplaceImport { if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { - llinfos << " SLM GET clearing marketplace cookie due to client or server error" << llendl; + LL_INFOS() << " SLM GET clearing marketplace cookie due to client or server error" << LL_ENDL; } sMarketplaceCookie.clear(); } else if (gSavedSettings.getBOOL("InventoryOutboxLogging") && (status >= MarketplaceErrorCodes::IMPORT_BAD_REQUEST)) { - llinfos << " SLM GET : Got error status = " << status << ", but marketplace cookie not cleared." << llendl; + LL_INFOS() << " SLM GET : Got error status = " << status << ", but marketplace cookie not cleared." << LL_ENDL; } sImportInProgress = (status == MarketplaceErrorCodes::IMPORT_PROCESSING); @@ -268,12 +268,12 @@ namespace LLMarketplaceImport if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { - llinfos << " SLM GET: establishMarketplaceSessionCookie, LLHTTPClient::get, url = " << url << llendl; + LL_INFOS() << " SLM GET: establishMarketplaceSessionCookie, LLHTTPClient::get, url = " << url << LL_ENDL; LLSD headers = LLViewerMedia::getHeaders(); std::stringstream str; LLSDSerialize::toPrettyXML(headers, str); - llinfos << " SLM GET: headers " << llendl; - llinfos << str.str() << llendl; + LL_INFOS() << " SLM GET: headers " << LL_ENDL; + LL_INFOS() << str.str() << LL_ENDL; } slmGetTimer.start(); @@ -304,11 +304,11 @@ namespace LLMarketplaceImport if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { - llinfos << " SLM GET: pollStatus, LLHTTPClient::get, url = " << url << llendl; + LL_INFOS() << " SLM GET: pollStatus, LLHTTPClient::get, url = " << url << LL_ENDL; std::stringstream str; LLSDSerialize::toPrettyXML(headers, str); - llinfos << " SLM GET: headers " << llendl; - llinfos << str.str() << llendl; + LL_INFOS() << " SLM GET: headers " << LL_ENDL; + LL_INFOS() << str.str() << LL_ENDL; } slmGetTimer.start(); @@ -342,11 +342,11 @@ namespace LLMarketplaceImport if (gSavedSettings.getBOOL("InventoryOutboxLogging")) { - llinfos << " SLM POST: triggerImport, LLHTTPClient::post, url = " << url << llendl; + LL_INFOS() << " SLM POST: triggerImport, LLHTTPClient::post, url = " << url << LL_ENDL; std::stringstream str; LLSDSerialize::toPrettyXML(headers, str); - llinfos << " SLM POST: headers " << llendl; - llinfos << str.str() << llendl; + LL_INFOS() << " SLM POST: headers " << LL_ENDL; + LL_INFOS() << str.str() << LL_ENDL; } slmPostTimer.start(); diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 14d3d4e7a8cfaaa513c70e277d45a81d01418403..df6a42db4d84ad032ea1e4b2fa8a444b1452ba84 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -527,11 +527,11 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content) } } -static LLFastTimer::DeclareTimer FTM_MATERIALS_IDLE("Materials"); +static LLTrace::BlockTimerStatHandle FTM_MATERIALS_IDLE("Idle Materials"); void LLMaterialMgr::onIdle(void*) { - LLFastTimer t(FTM_MATERIALS_IDLE); + LL_RECORD_BLOCK_TIME(FTM_MATERIALS_IDLE); LLMaterialMgr* instancep = LLMaterialMgr::getInstance(); diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 2075aeed63210d69a80e552a4f3361dc026b0eb3..323445afa6d8432eb019e75f29fbd6444df3e0d7 100755 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -392,7 +392,7 @@ BOOL LLMediaCtrl::postBuild () mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( "menu_media_ctrl.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); - setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChanged, this, _2)); return TRUE; } @@ -422,9 +422,9 @@ BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask ) //////////////////////////////////////////////////////////////////////////////// // -void LLMediaCtrl::handleVisibilityChange ( BOOL new_visibility ) +void LLMediaCtrl::onVisibilityChange ( BOOL new_visibility ) { - llinfos << "visibility changed to " << (new_visibility?"true":"false") << llendl; + LL_INFOS() << "visibility changed to " << (new_visibility?"true":"false") << LL_ENDL; if(mMediaSource) { mMediaSource->setVisible( new_visibility ); @@ -450,7 +450,7 @@ BOOL LLMediaCtrl::handleUnicodeCharHere(llwchar uni_char) //////////////////////////////////////////////////////////////////////////////// // -void LLMediaCtrl::onVisibilityChange ( const LLSD& new_visibility ) +void LLMediaCtrl::onVisibilityChanged ( const LLSD& new_visibility ) { // set state of frequent updates automatically if visibility changes if ( new_visibility.asBoolean() ) @@ -548,7 +548,7 @@ void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type) (LLStringUtil::compareInsensitive(url_in.substr(0, protocol2.length()), protocol2) == 0)) { // TODO: Print out/log this attempt? - // llinfos << "Rejecting attempt to load restricted website :" << urlIn << llendl; + // LL_INFOS() << "Rejecting attempt to load restricted website :" << urlIn << LL_ENDL; return; } @@ -569,7 +569,7 @@ void LLMediaCtrl::navigateToLocalPage( const std::string& subdir, const std::str if (expanded_filename.empty()) { - llwarns << "File " << filename << "not found" << llendl; + LL_WARNS() << "File " << filename << "not found" << LL_ENDL; return; } if (ensureMediaSourceExists()) @@ -677,7 +677,7 @@ bool LLMediaCtrl::ensureMediaSourceExists() } else { - llwarns << "media source create failed " << llendl; + LL_WARNS() << "media source create failed " << LL_ENDL; // return; } } diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 6c38c1fb568b5690fb9210bc1200b7e7d4a14fe2..5978a7a344e2e5eb8c73c4b5a5ffc22c6cc4beb0 100755 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -150,7 +150,7 @@ class LLMediaCtrl : // over-rides virtual BOOL handleKeyHere( KEY key, MASK mask); - virtual void handleVisibilityChange ( BOOL new_visibility ); + virtual void onVisibilityChange ( BOOL new_visibility ); virtual BOOL handleUnicodeCharHere(llwchar uni_char); virtual void reshape( S32 width, S32 height, BOOL called_from_parent = TRUE); virtual void draw(); @@ -172,7 +172,7 @@ class LLMediaCtrl : void convertInputCoords(S32& x, S32& y); private: - void onVisibilityChange ( const LLSD& new_visibility ); + void onVisibilityChanged ( const LLSD& new_visibility ); void onPopup(const LLSD& notification, const LLSD& response); const S32 mTextureDepthBytes; diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 5afd2cb329e76786a643d03fe338c88130b6b938..08d2d03b9bdeae1ae9e1d467bb225e68a2ef8ae2 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -27,8 +27,7 @@ #include "llviewerprecompiledheaders.h" -#include "apr_pools.h" -#include "apr_dso.h" +#include "llapr.h" #include "llhttpstatuscodes.h" #include "llmeshrepository.h" @@ -310,18 +309,8 @@ // under the 'Mesh Fetch' timer which will be either top-level // or under 'Render' time. -#ifndef LL_MESH_FASTTIMER_ENABLE -#define LL_MESH_FASTTIMER_ENABLE 1 -#endif -#if LL_MESH_FASTTIMER_ENABLE static LLFastTimer::DeclareTimer FTM_MESH_FETCH("Mesh Fetch"); -#define MESH_FASTTIMER_DEFBLOCK LLFastTimer meshtimer(FTM_MESH_FETCH) -#else -#define MESH_FASTTIMER_DEFBLOCK -#endif // LL_MESH_FASTTIMER_ENABLE - - // Random failure testing for development/QA. // // Set the MESH_*_FAILED macros to either 'false' or to @@ -391,10 +380,10 @@ U32 LLMeshRepository::sCacheBytesWritten = 0; U32 LLMeshRepository::sCacheReads = 0; U32 LLMeshRepository::sCacheWrites = 0; U32 LLMeshRepository::sMaxLockHoldoffs = 0; - + LLDeadmanTimer LLMeshRepository::sQuiescentTimer(15.0, false); // true -> gather cpu metrics - + static S32 dump_num = 0; std::string make_dump_name(std::string prefix, S32 num) { @@ -546,8 +535,8 @@ class LLMeshHandlerBase : public LLCore::HttpHandler virtual void processFailure(LLCore::HttpStatus status) = 0; public: - LLVolumeParams mMeshParams; - bool mProcessed; + LLVolumeParams mMeshParams; + bool mProcessed; LLCore::HttpHandle mHttpHandle; }; @@ -580,23 +569,23 @@ class LLMeshHeaderHandler : public LLMeshHandlerBase // // Thread: repo class LLMeshLODHandler : public LLMeshHandlerBase -{ + { public: LLMeshLODHandler(const LLVolumeParams & mesh_params, S32 lod, U32 offset, U32 requested_bytes) : LLMeshHandlerBase(), mLOD(lod), mRequestedBytes(requested_bytes), mOffset(offset) - { + { mMeshParams = mesh_params; LLMeshRepoThread::incActiveLODRequests(); - } + } virtual ~LLMeshLODHandler(); - + protected: LLMeshLODHandler(const LLMeshLODHandler &); // Not defined void operator=(const LLMeshLODHandler &); // Not defined - + public: virtual void processData(LLCore::BufferArray * body, U8 * data, S32 data_size); virtual void processFailure(LLCore::HttpStatus status); @@ -612,7 +601,7 @@ class LLMeshLODHandler : public LLMeshHandlerBase // // Thread: repo class LLMeshSkinInfoHandler : public LLMeshHandlerBase -{ + { public: LLMeshSkinInfoHandler(const LLUUID& id, U32 offset, U32 size) : LLMeshHandlerBase(), @@ -625,7 +614,7 @@ class LLMeshSkinInfoHandler : public LLMeshHandlerBase protected: LLMeshSkinInfoHandler(const LLMeshSkinInfoHandler &); // Not defined void operator=(const LLMeshSkinInfoHandler &); // Not defined - + public: virtual void processData(LLCore::BufferArray * body, U8 * data, S32 data_size); virtual void processFailure(LLCore::HttpStatus status); @@ -641,7 +630,7 @@ class LLMeshSkinInfoHandler : public LLMeshHandlerBase // // Thread: repo class LLMeshDecompositionHandler : public LLMeshHandlerBase -{ + { public: LLMeshDecompositionHandler(const LLUUID& id, U32 offset, U32 size) : LLMeshHandlerBase(), @@ -654,7 +643,7 @@ class LLMeshDecompositionHandler : public LLMeshHandlerBase protected: LLMeshDecompositionHandler(const LLMeshDecompositionHandler &); // Not defined void operator=(const LLMeshDecompositionHandler &); // Not defined - + public: virtual void processData(LLCore::BufferArray * body, U8 * data, S32 data_size); virtual void processFailure(LLCore::HttpStatus status); @@ -670,7 +659,7 @@ class LLMeshDecompositionHandler : public LLMeshHandlerBase // // Thread: repo class LLMeshPhysicsShapeHandler : public LLMeshHandlerBase -{ + { public: LLMeshPhysicsShapeHandler(const LLUUID& id, U32 offset, U32 size) : LLMeshHandlerBase(), @@ -683,15 +672,15 @@ class LLMeshPhysicsShapeHandler : public LLMeshHandlerBase protected: LLMeshPhysicsShapeHandler(const LLMeshPhysicsShapeHandler &); // Not defined void operator=(const LLMeshPhysicsShapeHandler &); // Not defined - + public: virtual void processData(LLCore::BufferArray * body, U8 * data, S32 data_size); virtual void processFailure(LLCore::HttpStatus status); public: - LLUUID mMeshID; - U32 mRequestedBytes; - U32 mOffset; + LLUUID mMeshID; + U32 mRequestedBytes; + U32 mOffset; }; @@ -717,8 +706,8 @@ void log_upload_error(LLCore::HttpStatus status, const LLSD& content, LL_WARNS(LOG_MESH) << "error: " << err << LL_ENDL; LL_WARNS(LOG_MESH) << " mesh upload failed, stage '" << stage << "', error '" << err["error"].asString() - << "', message '" << err["message"].asString() - << "', id '" << err["identifier"].asString() + << "', message '" << err["message"].asString() + << "', id '" << err["identifier"].asString() << "'" << LL_ENDL; if (err.has("errors")) { @@ -759,7 +748,7 @@ LLMeshRepoThread::LLMeshRepoThread() mHttpLargePolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID), mHttpPriority(0), mGetMeshVersion(2) -{ + { mMutex = new LLMutex(NULL); mHeaderMutex = new LLMutex(NULL); mSignal = new LLCondition(NULL); @@ -775,11 +764,11 @@ LLMeshRepoThread::LLMeshRepoThread() mHttpPolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicy(LLAppCoreHttp::AP_MESH2); mHttpLegacyPolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicy(LLAppCoreHttp::AP_MESH1); mHttpLargePolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicy(LLAppCoreHttp::AP_LARGE_MESH); -} - + } + LLMeshRepoThread::~LLMeshRepoThread() -{ + { LL_INFOS(LOG_MESH) << "Small GETs issued: " << LLMeshRepository::sHTTPRequestCount << ", Large GETs issued: " << LLMeshRepository::sHTTPLargeRequestCount << ", Max Lock Holdoffs: " << LLMeshRepository::sMaxLockHoldoffs @@ -790,23 +779,23 @@ LLMeshRepoThread::~LLMeshRepoThread() ++iter) { delete *iter; - } + } mHttpRequestSet.clear(); if (mHttpHeaders) - { + { mHttpHeaders->release(); mHttpHeaders = NULL; - } + } if (mHttpOptions) - { + { mHttpOptions->release(); mHttpOptions = NULL; - } + } if (mHttpLargeOptions) - { +{ mHttpLargeOptions->release(); mHttpLargeOptions = NULL; - } +} delete mHttpRequest; mHttpRequest = NULL; delete mMutex; @@ -846,53 +835,53 @@ void LLMeshRepoThread::run() { break; } - + if (! mHttpRequestSet.empty()) { // Dispatch all HttpHandler notifications mHttpRequest->update(0L); - } + } sRequestWaterLevel = mHttpRequestSet.size(); // Stats data update - - // NOTE: order of queue processing intentionally favors LOD requests over header requests + // NOTE: order of queue processing intentionally favors LOD requests over header requests + while (!mLODReqQ.empty() && mHttpRequestSet.size() < sRequestHighWater) - { - if (! mMutex) { + if (! mMutex) + { break; } - mMutex->lock(); - LODRequest req = mLODReqQ.front(); - mLODReqQ.pop(); - LLMeshRepository::sLODProcessing--; - mMutex->unlock(); + mMutex->lock(); + LODRequest req = mLODReqQ.front(); + mLODReqQ.pop(); + LLMeshRepository::sLODProcessing--; + mMutex->unlock(); if (!fetchMeshLOD(req.mMeshParams, req.mLOD)) // failed, resubmit - { - mMutex->lock(); - mLODReqQ.push(req) ; + { + mMutex->lock(); + mLODReqQ.push(req); ++LLMeshRepository::sLODProcessing; - mMutex->unlock(); - } - } + mMutex->unlock(); + } + } while (!mHeaderReqQ.empty() && mHttpRequestSet.size() < sRequestHighWater) - { - if (! mMutex) { + if (! mMutex) + { break; } - mMutex->lock(); - HeaderRequest req = mHeaderReqQ.front(); - mHeaderReqQ.pop(); - mMutex->unlock(); + mMutex->lock(); + HeaderRequest req = mHeaderReqQ.front(); + mHeaderReqQ.pop(); + mMutex->unlock(); if (!fetchMeshHeader(req.mMeshParams))//failed, resubmit - { - mMutex->lock(); - mHeaderReqQ.push(req) ; - mMutex->unlock(); - } - } + { + mMutex->lock(); + mHeaderReqQ.push(req) ; + mMutex->unlock(); + } + } // For the final three request lists, similar goal to above but // slightly different queue structures. Stay off the mutex when @@ -918,7 +907,7 @@ void LLMeshRepoThread::run() mSkinRequests.erase(iter); mMutex->unlock(); - if (! fetchMeshSkinInfo(mesh_id)) + if (!fetchMeshSkinInfo(mesh_id)) { incomplete.insert(mesh_id); } @@ -947,7 +936,7 @@ void LLMeshRepoThread::run() mDecompositionRequests.erase(iter); mMutex->unlock(); - if (! fetchMeshDecomposition(mesh_id)) + if (!fetchMeshDecomposition(mesh_id)) { incomplete.insert(mesh_id); } @@ -973,7 +962,7 @@ void LLMeshRepoThread::run() mPhysicsShapeRequests.erase(iter); mMutex->unlock(); - if (! fetchMeshPhysicsShape(mesh_id)) + if (!fetchMeshPhysicsShape(mesh_id)) { incomplete.insert(mesh_id); } @@ -988,7 +977,7 @@ void LLMeshRepoThread::run() } } mMutex->unlock(); - } + } // For dev purposes only. A dynamic change could make this false // and that shouldn't assert. @@ -1055,7 +1044,7 @@ void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod) if (pending != mPendingLOD.end()) { //append this lod request to existing header request pending->second.push_back(lod); - llassert(pending->second.size() <= LLModel::NUM_LODS) + llassert(pending->second.size() <= LLModel::NUM_LODS); } else { //if no header request is pending, fetch header @@ -1196,7 +1185,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) } ++LLMeshRepository::sMeshRequestCount; - bool ret = true; + bool ret = true ; U32 header_size = mMeshHeaderSize[mesh_id]; if (header_size > 0) @@ -1244,7 +1233,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) constructUrl(mesh_id, &http_url, &cap_version); if (!http_url.empty()) - { + { LLMeshSkinInfoHandler * handler = new LLMeshSkinInfoHandler(mesh_id, offset, size); LLCore::HttpHandle handle = getByteRange(http_url, cap_version, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) @@ -1291,7 +1280,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) ++LLMeshRepository::sMeshRequestCount; U32 header_size = mMeshHeaderSize[mesh_id]; - bool ret = true; + bool ret = true ; if (header_size > 0) { @@ -1337,9 +1326,9 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) int cap_version(2); std::string http_url; constructUrl(mesh_id, &http_url, &cap_version); - + if (!http_url.empty()) - { + { LLMeshDecompositionHandler * handler = new LLMeshDecompositionHandler(mesh_id, offset, size); LLCore::HttpHandle handle = getByteRange(http_url, cap_version, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) @@ -1385,7 +1374,7 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) ++LLMeshRepository::sMeshRequestCount; U32 header_size = mMeshHeaderSize[mesh_id]; - bool ret = true; + bool ret = true ; if (header_size > 0) { @@ -1430,9 +1419,9 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) int cap_version(2); std::string http_url; constructUrl(mesh_id, &http_url, &cap_version); - + if (!http_url.empty()) - { + { LLMeshPhysicsShapeHandler * handler = new LLMeshPhysicsShapeHandler(mesh_id, offset, size); LLCore::HttpHandle handle = getByteRange(http_url, cap_version, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) @@ -1521,11 +1510,11 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params) } //either cache entry doesn't exist or is corrupt, request header from simulator - bool retval = true; + bool retval = true ; int cap_version(2); std::string http_url; constructUrl(mesh_params.getSculptID(), &http_url, &cap_version); - + if (!http_url.empty()) { //grab first 4KB if we're going to bother with a fetch. Cache will prevent future fetches if a full mesh fits @@ -1613,9 +1602,9 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod) int cap_version(2); std::string http_url; constructUrl(mesh_id, &http_url, &cap_version); - + if (!http_url.empty()) - { + { LLMeshLODHandler * handler = new LLMeshLODHandler(mesh_params, lod, offset, size); LLCore::HttpHandle handle = getByteRange(http_url, cap_version, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) @@ -1865,7 +1854,7 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, bool upload_skin, bool upload_joints, const std::string & upload_url, bool do_upload, LLHandle<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> upload_observer) - : LLThread("mesh upload"), +: LLThread("mesh upload"), LLCore::HttpHandler(), mDiscarded(false), mDoUpload(do_upload), @@ -1887,7 +1876,7 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, mOrigin += gAgent.getAtAxis() * scale.magVec(); - mMeshUploadTimeOut = gSavedSettings.getS32("MeshUploadTimeOut"); + mMeshUploadTimeOut = gSavedSettings.getS32("MeshUploadTimeOut") ; mHttpRequest = new LLCore::HttpRequest; mHttpOptions = new LLCore::HttpOptions; @@ -1955,14 +1944,14 @@ void LLMeshUploadThread::preStart() void LLMeshUploadThread::discard() { - LLMutexLock lock(mMutex); + LLMutexLock lock(mMutex) ; mDiscarded = true; } bool LLMeshUploadThread::isDiscarded() const { - LLMutexLock lock(mMutex); - return mDiscarded; + LLMutexLock lock(mMutex) ; + return mDiscarded ; } void LLMeshUploadThread::run() @@ -2213,7 +2202,7 @@ void LLMeshUploadThread::generateHulls() } } - if (has_valid_requests) + if(has_valid_requests) { // *NOTE: Interesting livelock condition on shutdown. If there // is an upload request in generateHulls() when shutdown starts, @@ -2245,7 +2234,7 @@ void LLMeshUploadThread::doWholeModelUpload() mModelData = LLSD::emptyMap(); wholeModelToLLSD(mModelData, true); LLSD body = mModelData["asset_resources"]; - dump_llsd_to_file(body, make_dump_name("whole_model_body_", dump_num)); + dump_llsd_to_file(body,make_dump_name("whole_model_body_",dump_num)); LLCore::BufferArray * ba = new LLCore::BufferArray; LLCore::BufferArrayStream bas(ba); @@ -2276,7 +2265,7 @@ void LLMeshUploadThread::doWholeModelUpload() mHttpRequest->update(0); while (! LLApp::isQuitting() && ! finished() && ! isDiscarded()) - { + { ms_sleep(sleep_time); sleep_time = llmin(250U, sleep_time + sleep_time); mHttpRequest->update(0); @@ -2292,7 +2281,7 @@ void LLMeshUploadThread::doWholeModelUpload() } } } -} + } void LLMeshUploadThread::requestWholeModelFee() { @@ -2323,11 +2312,11 @@ void LLMeshUploadThread::requestWholeModelFee() LL_WARNS(LOG_MESH) << "Couldn't issue request for model fee. Reason: " << mHttpStatus.toString() << " (" << mHttpStatus.toTerseString() << ")" << LL_ENDL; - } + } else { U32 sleep_time(10); - + mHttpRequest->update(0); while (! LLApp::isQuitting() && ! finished() && ! isDiscarded()) { @@ -2340,7 +2329,7 @@ void LLMeshUploadThread::requestWholeModelFee() LL_DEBUGS(LOG_MESH) << "Mesh fee query operation discarded." << LL_ENDL; } } -} + } // Does completion duty for both fee queries and actual uploads. @@ -2393,12 +2382,12 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp { LLCore::BufferArrayStream bas(ba); LLSDSerialize::fromXML(body, bas); - } +} } dump_llsd_to_file(body, make_dump_name("whole_model_upload_response_", dump_num)); if (body["state"].asString() == "complete") - { +{ // requested "mesh" asset type isn't actually the type // of the resultant object, fix it up here. mModelData["asset_type"] = "object"; @@ -2426,7 +2415,7 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp // model fee case LLWholeModelFeeObserver* observer(mFeeObserverHandle.get()); mWholeModelUploadURL.clear(); - + if (! status) { LL_WARNS(LOG_MESH) << "Fee request failed. Reason: " << reason @@ -2451,18 +2440,18 @@ void LLMeshUploadThread::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResp body = llsd_from_file("fake_upload_error.xml"); } else - { + { LLCore::BufferArray * ba(response->getBody()); if (ba && ba->size()) - { + { LLCore::BufferArrayStream bas(ba); LLSDSerialize::fromXML(body, bas); - } - } + } + } dump_llsd_to_file(body, make_dump_name("whole_model_fee_response_", dump_num)); - + if (body["state"].asString() == "upload") - { + { mWholeModelUploadURL = body["uploader"].asString(); if (observer) @@ -2531,7 +2520,7 @@ void LLMeshRepoThread::notifyLoadedMeshes() LODRequest req = mUnavailableQ.front(); mUnavailableQ.pop(); mMutex->unlock(); - + update_metrics = true; gMeshRepo.notifyMeshUnavailable(req.mMeshParams, req.mLOD); } @@ -2548,18 +2537,18 @@ void LLMeshRepoThread::notifyLoadedMeshes() skin_info_q.swap(mSkinInfoQ); } if (! mDecompositionQ.empty()) - { + { decomp_q.swap(mDecompositionQ); - } + } mMutex->unlock(); // Process the elements free of the lock while (! skin_info_q.empty()) - { + { gMeshRepo.notifySkinInfoReceived(skin_info_q.front()); skin_info_q.pop_front(); - } + } while (! decomp_q.empty()) { @@ -2656,7 +2645,7 @@ void LLMeshRepository::cacheOutgoingMesh(LLMeshUploadData& data, LLSD& header) void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response) { mProcessed = true; - + unsigned int retries(0U); response->getRetries(NULL, &retries); LLMeshRepository::sHTTPRetryCount += retries; @@ -2688,18 +2677,18 @@ void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespo LL_WARNS_ONCE(LOG_MESH) << "Non-206 successful status received for fetch: " << status.toTerseString() << LL_ENDL; } - + LLCore::BufferArray * body(response->getBody()); S32 data_size(body ? body->size() : 0); U8 * data(NULL); - if (data_size > 0) - { + if (data_size > 0) + { // *TODO: Try to get rid of data copying and add interfaces // that support BufferArray directly. Introduce a two-phase // handler, optional first that takes a body, fallback second // that requires a temporary allocation and data copy. - data = new U8[data_size]; + data = new U8[data_size]; body->read(0, (char *) data, data_size); LLMeshRepository::sBytesReceived += data_size; } @@ -2744,7 +2733,7 @@ void LLMeshHeaderHandler::processFailure(LLCore::HttpStatus status) { gMeshRepo.mThread->mUnavailableQ.push(LLMeshRepoThread::LODRequest(mMeshParams, i)); } -} + } void LLMeshHeaderHandler::processData(LLCore::BufferArray * body, U8 * data, S32 data_size) { @@ -2761,12 +2750,12 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * body, U8 * data, S32 // Can't get the header so none of the LODs will be available LLMutexLock lock(gMeshRepo.mThread->mMutex); for (int i(0); i < 4; ++i) - { + { gMeshRepo.mThread->mUnavailableQ.push(LLMeshRepoThread::LODRequest(mMeshParams, i)); - } } + } else if (data && data_size > 0) - { + { // header was successfully retrieved from sim, cache in vfs LLSD header = gMeshRepo.mThread->mMeshHeader[mesh_id]; @@ -2779,12 +2768,12 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * body, U8 * data, S32 S32 lod_bytes = 0; for (U32 i = 0; i < LLModel::LOD_PHYSICS; ++i) - { + { // figure out how many bytes we'll need to reserve in the file const std::string & lod_name = header_lod[i]; lod_bytes = llmax(lod_bytes, header[lod_name]["offset"].asInteger()+header[lod_name]["size"].asInteger()); - } - + } + // just in case skin info or decomposition is at the end of the file (which it shouldn't be) lod_bytes = llmax(lod_bytes, header["skin"]["offset"].asInteger() + header["skin"]["size"].asInteger()); lod_bytes = llmax(lod_bytes, header["physics_convex"]["offset"].asInteger() + header["physics_convex"]["size"].asInteger()); @@ -2792,37 +2781,37 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * body, U8 * data, S32 S32 header_bytes = (S32) gMeshRepo.mThread->mMeshHeaderSize[mesh_id]; S32 bytes = lod_bytes + header_bytes; - + // It's possible for the remote asset to have more data than is needed for the local cache // only allocate as much space in the VFS as is needed for the local cache data_size = llmin(data_size, bytes); LLVFile file(gVFS, mesh_id, LLAssetType::AT_MESH, LLVFile::WRITE); if (file.getMaxSize() >= bytes || file.setMaxSize(bytes)) - { + { LLMeshRepository::sCacheBytesWritten += data_size; ++LLMeshRepository::sCacheWrites; file.write(data, data_size); - + // zero out the rest of the file U8 block[MESH_HEADER_SIZE]; memset(block, 0, sizeof(block)); - + while (bytes-file.tell() > sizeof(block)) - { + { file.write(block, sizeof(block)); - } + } S32 remaining = bytes-file.tell(); if (remaining > 0) - { + { file.write(block, remaining); } } } } -} + } LLMeshLODHandler::~LLMeshLODHandler() { @@ -2834,8 +2823,8 @@ LLMeshLODHandler::~LLMeshLODHandler() gMeshRepo.mThread->lockAndLoadMeshLOD(mMeshParams, mLOD); } LLMeshRepoThread::decActiveLODRequests(); + } } -} void LLMeshLODHandler::processFailure(LLCore::HttpStatus status) { @@ -2849,10 +2838,10 @@ void LLMeshLODHandler::processFailure(LLCore::HttpStatus status) } void LLMeshLODHandler::processData(LLCore::BufferArray * body, U8 * data, S32 data_size) -{ + { if ((! MESH_LOD_PROCESS_FAILED) && gMeshRepo.mThread->lodReceived(mMeshParams, mLOD, data, data_size)) { - // good fetch from sim, write to VFS for caching + //good fetch from sim, write to VFS for caching LLVFile file(gVFS, mMeshParams.getSculptID(), LLAssetType::AT_MESH, LLVFile::WRITE); S32 offset = mOffset; @@ -2865,7 +2854,7 @@ void LLMeshLODHandler::processData(LLCore::BufferArray * body, U8 * data, S32 da LLMeshRepository::sCacheBytesWritten += size; ++LLMeshRepository::sCacheWrites; } - } + } else { LL_WARNS(LOG_MESH) << "Error during mesh LOD processing. ID: " << mMeshParams.getSculptID() @@ -2877,12 +2866,12 @@ void LLMeshLODHandler::processData(LLCore::BufferArray * body, U8 * data, S32 da } LLMeshSkinInfoHandler::~LLMeshSkinInfoHandler() -{ + { llassert(mProcessed); -} + } void LLMeshSkinInfoHandler::processFailure(LLCore::HttpStatus status) -{ + { LL_WARNS(LOG_MESH) << "Error during mesh skin info handling. ID: " << mMeshID << ", Reason: " << status.toString() << " (" << status.toTerseString() << "). Not retrying." @@ -2890,13 +2879,13 @@ void LLMeshSkinInfoHandler::processFailure(LLCore::HttpStatus status) // *TODO: Mark mesh unavailable on error. For now, simply leave // request unfulfilled rather than retry forever. -} + } void LLMeshSkinInfoHandler::processData(LLCore::BufferArray * body, U8 * data, S32 data_size) -{ + { if ((! MESH_SKIN_INFO_PROCESS_FAILED) && gMeshRepo.mThread->skinInfoReceived(mMeshID, data, data_size)) { - // good fetch from sim, write to VFS for caching + //good fetch from sim, write to VFS for caching LLVFile file(gVFS, mMeshID, LLAssetType::AT_MESH, LLVFile::WRITE); S32 offset = mOffset; @@ -2925,14 +2914,14 @@ LLMeshDecompositionHandler::~LLMeshDecompositionHandler() } void LLMeshDecompositionHandler::processFailure(LLCore::HttpStatus status) -{ + { LL_WARNS(LOG_MESH) << "Error during mesh decomposition handling. ID: " << mMeshID << ", Reason: " << status.toString() << " (" << status.toTerseString() << "). Not retrying." << LL_ENDL; // *TODO: Mark mesh unavailable on error. For now, simply leave // request unfulfilled rather than retry forever. -} + } void LLMeshDecompositionHandler::processData(LLCore::BufferArray * body, U8 * data, S32 data_size) { @@ -2951,34 +2940,34 @@ void LLMeshDecompositionHandler::processData(LLCore::BufferArray * body, U8 * da file.seek(offset); file.write(data, size); } - } - else - { + } + else + { LL_WARNS(LOG_MESH) << "Error during mesh decomposition processing. ID: " << mMeshID << ", Unknown reason. Not retrying." << LL_ENDL; // *TODO: Mark mesh unavailable on error + } } -} LLMeshPhysicsShapeHandler::~LLMeshPhysicsShapeHandler() -{ + { llassert(mProcessed); -} + } void LLMeshPhysicsShapeHandler::processFailure(LLCore::HttpStatus status) -{ + { LL_WARNS(LOG_MESH) << "Error during mesh physics shape handling. ID: " << mMeshID << ", Reason: " << status.toString() << " (" << status.toTerseString() << "). Not retrying." << LL_ENDL; // *TODO: Mark mesh unavailable on error -} + } void LLMeshPhysicsShapeHandler::processData(LLCore::BufferArray * body, U8 * data, S32 data_size) -{ + { if ((! MESH_PHYS_SHAPE_PROCESS_FAILED) && gMeshRepo.mThread->physicsShapeReceived(mMeshID, data, data_size)) - { + { // good fetch from sim, write to VFS for caching LLVFile file(gVFS, mMeshID, LLAssetType::AT_MESH, LLVFile::WRITE); @@ -2986,13 +2975,13 @@ void LLMeshPhysicsShapeHandler::processData(LLCore::BufferArray * body, U8 * dat S32 size = mRequestedBytes; if (file.getSize() >= offset+size) - { + { LLMeshRepository::sCacheBytesWritten += size; ++LLMeshRepository::sCacheWrites; file.seek(offset); file.write(data, size); + } } - } else { LL_WARNS(LOG_MESH) << "Error during mesh physics shape processing. ID: " << mMeshID @@ -3104,7 +3093,7 @@ S32 LLMeshRepository::update() S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_params, S32 detail, S32 last_lod) { - MESH_FASTTIMER_DEFBLOCK; + LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); // Manage time-to-load metrics for mesh download operations. metricsProgress(1); @@ -3187,12 +3176,12 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para void LLMeshRepository::notifyLoadedMeshes() { //called from main thread - MESH_FASTTIMER_DEFBLOCK; + LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); if (1 == mGetMeshVersion) { // Legacy GetMesh operation with high connection concurrency - LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("MeshMaxConcurrentRequests"); + LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("MeshMaxConcurrentRequests"); LLMeshRepoThread::sRequestHighWater = llclamp(2 * S32(LLMeshRepoThread::sMaxConcurrentRequests), REQUEST_HIGH_WATER_MIN, REQUEST_HIGH_WATER_MAX); @@ -3212,7 +3201,7 @@ void LLMeshRepository::notifyLoadedMeshes() REQUEST2_LOW_WATER_MIN, REQUEST2_LOW_WATER_MAX); } - + //clean up completed upload threads for (std::vector<LLMeshUploadThread*>::iterator iter = mUploads.begin(); iter != mUploads.end(); ) { @@ -3289,7 +3278,7 @@ void LLMeshRepository::notifyLoadedMeshes() //call completed callbacks on finished decompositions mDecompThread->notifyCompleted(); - + // For major operations, attempt to get the required locks // without blocking and punt if they're not available. The // longest run of holdoffs is kept in sMaxLockHoldoffs just @@ -3305,18 +3294,18 @@ void LLMeshRepository::notifyLoadedMeshes() // If we can't get the locks, skip and pick this up later. ++hold_offs; sMaxLockHoldoffs = llmax(sMaxLockHoldoffs, hold_offs); - return; - } + return; + } hold_offs = 0; - + if (gAgent.getRegion()) { // Update capability urls - static std::string region_name("never name a region this"); - - if (gAgent.getRegion()->getName() != region_name && gAgent.getRegion()->capabilitiesReceived()) - { - region_name = gAgent.getRegion()->getName(); + static std::string region_name("never name a region this"); + + if (gAgent.getRegion()->getName() != region_name && gAgent.getRegion()->capabilitiesReceived()) + { + region_name = gAgent.getRegion()->getName(); const bool use_v1(gSavedSettings.getBOOL("MeshUseGetMesh1")); const std::string mesh1(gAgent.getRegion()->getCapability("GetMesh")); const std::string mesh2(gAgent.getRegion()->getCapability("GetMesh2")); @@ -3327,9 +3316,9 @@ void LLMeshRepository::notifyLoadedMeshes() << ", GetMesh: " << mesh1 << ", using version: " << mGetMeshVersion << LL_ENDL; - } } - + } + //popup queued error messages from background threads while (!mUploadErrorQ.empty()) { @@ -3343,46 +3332,46 @@ void LLMeshRepository::notifyLoadedMeshes() S32 push_count = LLMeshRepoThread::sRequestHighWater - active_count; if (mPendingRequests.size() > push_count) - { + { // More requests than the high-water limit allows so // sort and forward the most important. - //calculate "score" for pending requests + //calculate "score" for pending requests - //create score map - std::map<LLUUID, F32> score_map; + //create score map + std::map<LLUUID, F32> score_map; - for (U32 i = 0; i < 4; ++i) + for (U32 i = 0; i < 4; ++i) + { + for (mesh_load_map::iterator iter = mLoadingMeshes[i].begin(); iter != mLoadingMeshes[i].end(); ++iter) { - for (mesh_load_map::iterator iter = mLoadingMeshes[i].begin(); iter != mLoadingMeshes[i].end(); ++iter) + F32 max_score = 0.f; + for (std::set<LLUUID>::iterator obj_iter = iter->second.begin(); obj_iter != iter->second.end(); ++obj_iter) { - F32 max_score = 0.f; - for (std::set<LLUUID>::iterator obj_iter = iter->second.begin(); obj_iter != iter->second.end(); ++obj_iter) - { - LLViewerObject* object = gObjectList.findObject(*obj_iter); + LLViewerObject* object = gObjectList.findObject(*obj_iter); - if (object) + if (object) + { + LLDrawable* drawable = object->mDrawable; + if (drawable) { - LLDrawable* drawable = object->mDrawable; - if (drawable) - { - F32 cur_score = drawable->getRadius()/llmax(drawable->mDistanceWRTCamera, 1.f); - max_score = llmax(max_score, cur_score); - } + F32 cur_score = drawable->getRadius()/llmax(drawable->mDistanceWRTCamera, 1.f); + max_score = llmax(max_score, cur_score); } } - - score_map[iter->first.getSculptID()] = max_score; } + + score_map[iter->first.getSculptID()] = max_score; } + } - //set "score" for pending requests - for (std::vector<LLMeshRepoThread::LODRequest>::iterator iter = mPendingRequests.begin(); iter != mPendingRequests.end(); ++iter) - { - iter->mScore = score_map[iter->mMeshParams.getSculptID()]; - } + //set "score" for pending requests + for (std::vector<LLMeshRepoThread::LODRequest>::iterator iter = mPendingRequests.begin(); iter != mPendingRequests.end(); ++iter) + { + iter->mScore = score_map[iter->mMeshParams.getSculptID()]; + } - //sort by "score" + //sort by "score" std::partial_sort(mPendingRequests.begin(), mPendingRequests.begin() + push_count, mPendingRequests.end(), LLMeshRepoThread::CompareScoreGreater()); } @@ -3540,7 +3529,7 @@ S32 LLMeshRepository::getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lo const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, const LLVOVolume* requesting_obj) { - MESH_FASTTIMER_DEFBLOCK; + LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); if (mesh_id.notNull()) { @@ -3568,7 +3557,7 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, const void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id) { - MESH_FASTTIMER_DEFBLOCK; + LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); if (mesh_id.notNull()) { @@ -3598,7 +3587,7 @@ void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id) LLModel::Decomposition* LLMeshRepository::getDecomposition(const LLUUID& mesh_id) { - MESH_FASTTIMER_DEFBLOCK; + LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); LLModel::Decomposition* ret = NULL; @@ -3662,7 +3651,7 @@ bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id) LLSD& LLMeshRepository::getMeshHeader(const LLUUID& mesh_id) { - MESH_FASTTIMER_DEFBLOCK; + LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); return mThread->getMeshHeader(mesh_id); } @@ -3685,7 +3674,7 @@ LLSD& LLMeshRepoThread::getMeshHeader(const LLUUID& mesh_id) void LLMeshRepository::uploadModel(std::vector<LLModelInstance>& data, LLVector3& scale, bool upload_textures, - bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload, + bool upload_skin, bool upload_joints, std::string upload_url, bool do_upload, LLHandle<LLWholeModelFeeObserver> fee_observer, LLHandle<LLWholeModelUploadObserver> upload_observer) { LLMeshUploadThread* thread = new LLMeshUploadThread(data, scale, upload_textures, upload_skin, upload_joints, upload_url, @@ -4184,7 +4173,7 @@ void LLPhysicsDecomp::doDecompositionSingleHull() setMeshData(mesh, true); LLCDResult ret = decomp->buildSingleHull() ; - if (ret) + if(ret) { LL_WARNS(LOG_MESH) << "Could not execute decomposition stage when attempting to create single hull." << LL_ENDL; make_box(mCurRequest); diff --git a/indra/newview/llmimetypes.cpp b/indra/newview/llmimetypes.cpp index e689e39b26d99994c5a007f8332bdbfe225a52ab..790a18406817320c2ea24ddd5d3802d2bac54d96 100755 --- a/indra/newview/llmimetypes.cpp +++ b/indra/newview/llmimetypes.cpp @@ -55,8 +55,8 @@ bool LLMIMETypes::parseMIMETypes(const std::string& xml_filename) bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, root); if ( ! success || root.isNull() || ! root->hasName( "mimetypes" ) ) { - llwarns << "Unable to read MIME type file: " - << xml_filename << llendl; + LL_WARNS() << "Unable to read MIME type file: " + << xml_filename << LL_ENDL; return false; } diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 8bddf49fb5379c92b9e33b61c6a4a7a8e42250e7..fe562baf96172876d1856c832839d42ea12c310a 100755 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -549,7 +549,7 @@ void LLPanelStandStopFlying::clearStandStopFlyingMode(EStandStopFlyingMode mode) panel->mStopFlyingButton->setVisible(FALSE); break; default: - llerrs << "Unexpected EStandStopFlyingMode is passed: " << mode << llendl; + LL_ERRS() << "Unexpected EStandStopFlyingMode is passed: " << mode << LL_ENDL; } } @@ -614,7 +614,7 @@ void LLPanelStandStopFlying::reparent(LLFloaterMove* move_view) LLPanel* parent = dynamic_cast<LLPanel*>(getParent()); if (!parent) { - llwarns << "Stand/stop flying panel parent is unset, already attached?: " << mAttached << ", new parent: " << (move_view == NULL ? "NULL" : "Move Floater") << llendl; + LL_WARNS() << "Stand/stop flying panel parent is unset, already attached?: " << mAttached << ", new parent: " << (move_view == NULL ? "NULL" : "Move Floater") << LL_ENDL; return; } @@ -636,7 +636,7 @@ void LLPanelStandStopFlying::reparent(LLFloaterMove* move_view) { if (!mOriginalParent.get()) { - llwarns << "Original parent of the stand / stop flying panel not found" << llendl; + LL_WARNS() << "Original parent of the stand / stop flying panel not found" << LL_ENDL; return; } @@ -664,7 +664,7 @@ LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel() panel->setVisible(FALSE); //LLUI::getRootView()->addChild(panel); - llinfos << "Build LLPanelStandStopFlying panel" << llendl; + LL_INFOS() << "Build LLPanelStandStopFlying panel" << LL_ENDL; panel->updatePosition(); return panel; diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 0720d443f8f812735798f5073a41645693745288..65ac11092c5d8bd3fa6f0c6e31742ee862f9ab0e 100755 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -234,21 +234,21 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) // Can't mute empty string by name if (mute.mName.empty()) { - llwarns << "Trying to mute empty string by-name" << llendl; + LL_WARNS() << "Trying to mute empty string by-name" << LL_ENDL; return FALSE; } // Null mutes must have uuid null if (mute.mID.notNull()) { - llwarns << "Trying to add by-name mute with non-null id" << llendl; + LL_WARNS() << "Trying to add by-name mute with non-null id" << LL_ENDL; return FALSE; } std::pair<string_set_t::iterator, bool> result = mLegacyMutes.insert(mute.mName); if (result.second) { - llinfos << "Muting by name " << mute.mName << llendl; + LL_INFOS() << "Muting by name " << mute.mName << LL_ENDL; updateAdd(mute); notifyObservers(); notifyObserversDetailed(mute); @@ -297,7 +297,7 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) std::pair<mute_set_t::iterator, bool> result = mMutes.insert(localmute); if (result.second) { - llinfos << "Muting " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << llendl; + LL_INFOS() << "Muting " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << LL_ENDL; updateAdd(localmute); notifyObservers(); notifyObserversDetailed(localmute); @@ -387,14 +387,14 @@ BOOL LLMuteList::remove(const LLMute& mute, U32 flags) { // The entry was actually removed. Notify the server. updateRemove(localmute); - llinfos << "Unmuting " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << llendl; + LL_INFOS() << "Unmuting " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << LL_ENDL; } else { // Flags were updated, the mute entry needs to be retransmitted to the server and re-added to the list. mMutes.insert(localmute); updateAdd(localmute); - llinfos << "Updating mute entry " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << llendl; + LL_INFOS() << "Updating mute entry " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << LL_ENDL; } // Must be after erase. @@ -531,14 +531,14 @@ BOOL LLMuteList::loadFromFile(const std::string& filename) { if(!filename.size()) { - llwarns << "Mute List Filename is Empty!" << llendl; + LL_WARNS() << "Mute List Filename is Empty!" << LL_ENDL; return FALSE; } LLFILE* fp = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ if (!fp) { - llwarns << "Couldn't open mute list " << filename << llendl; + LL_WARNS() << "Couldn't open mute list " << filename << LL_ENDL; return FALSE; } @@ -581,14 +581,14 @@ BOOL LLMuteList::saveToFile(const std::string& filename) { if(!filename.size()) { - llwarns << "Mute List Filename is Empty!" << llendl; + LL_WARNS() << "Mute List Filename is Empty!" << LL_ENDL; return FALSE; } LLFILE* fp = LLFile::fopen(filename, "wb"); /*Flawfinder: ignore*/ if (!fp) { - llwarns << "Couldn't open mute list " << filename << llendl; + LL_WARNS() << "Couldn't open mute list " << filename << LL_ENDL; return FALSE; } // legacy mutes have null uuid @@ -691,12 +691,12 @@ void LLMuteList::cache(const LLUUID& agent_id) void LLMuteList::processMuteListUpdate(LLMessageSystem* msg, void**) { - llinfos << "LLMuteList::processMuteListUpdate()" << llendl; + LL_INFOS() << "LLMuteList::processMuteListUpdate()" << LL_ENDL; LLUUID agent_id; msg->getUUIDFast(_PREHASH_MuteData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { - llwarns << "Got an mute list update for the wrong agent." << llendl; + LL_WARNS() << "Got an mute list update for the wrong agent." << LL_ENDL; return; } std::string unclean_filename; @@ -716,7 +716,7 @@ void LLMuteList::processMuteListUpdate(LLMessageSystem* msg, void**) void LLMuteList::processUseCachedMuteList(LLMessageSystem* msg, void**) { - llinfos << "LLMuteList::processUseCachedMuteList()" << llendl; + LL_INFOS() << "LLMuteList::processUseCachedMuteList()" << LL_ENDL; std::string agent_id_string; gAgent.getID().toString(agent_id_string); @@ -727,7 +727,7 @@ void LLMuteList::processUseCachedMuteList(LLMessageSystem* msg, void**) void LLMuteList::onFileMuteList(void** user_data, S32 error_code, LLExtStat ext_status) { - llinfos << "LLMuteList::processMuteListFile()" << llendl; + LL_INFOS() << "LLMuteList::processMuteListFile()" << LL_ENDL; std::string* local_filename_and_path = (std::string*)user_data; if(local_filename_and_path && !local_filename_and_path->empty() && (error_code == 0)) diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 7ddd04fed0a616a8616af8e2cefc449b1c8d0a81..b2a3a9f645541c397f962399858e797d862272cd 100755 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -72,7 +72,7 @@ LLNameListCtrl::LLNameListCtrl(const LLNameListCtrl::Params& p) LLScrollListItem* LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos, BOOL enabled, const std::string& suffix) { - //llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl; + //LL_INFOS() << "LLNameListCtrl::addNameItem " << agent_id << LL_ENDL; NameItem item; item.value = agent_id; @@ -125,7 +125,7 @@ BOOL LLNameListCtrl::handleDragAndDrop( } handled = TRUE; - lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLNameListCtrl " << getName() << llendl; + LL_DEBUGS("UserInput") << "dragAndDrop handled by LLNameListCtrl " << getName() << LL_ENDL; return handled; } @@ -178,7 +178,7 @@ void LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index ) } else { - llwarns << "highlighted name list item is NULL" << llendl; + LL_WARNS() << "highlighted name list item is NULL" << LL_ENDL; } } if(target_index != -1) @@ -192,7 +192,7 @@ void LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index ) } else { - llwarns << "target name item is NULL" << llendl; + LL_WARNS() << "target name item is NULL" << LL_ENDL; } } } diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 95caa2731adc1d349836e76dd07cfa7f9bffe620..8c4849d28d8bdaaf760f1d4fa3913fbf689fff04 100755 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -600,7 +600,7 @@ void LLNavigationBar::onRegionNameResponse( LLVector3d region_pos = from_region_handle(region_handle); LLVector3d global_pos = region_pos + (LLVector3d) local_coords; - llinfos << "Teleporting to: " << LLSLURL(region_name, global_pos).getSLURLString() << llendl; + LL_INFOS() << "Teleporting to: " << LLSLURL(region_name, global_pos).getSLURLString() << LL_ENDL; gAgent.teleportViaLocation(global_pos); } else if (gSavedSettings.getBOOL("SearchFromAddressBar")) @@ -614,7 +614,7 @@ void LLNavigationBar::showTeleportHistoryMenu(LLUICtrl* btn_ctrl) // Don't show the popup if teleport history is empty. if (LLTeleportHistory::getInstance()->isEmpty()) { - lldebugs << "Teleport history is empty, will not show the menu." << llendl; + LL_DEBUGS() << "Teleport history is empty, will not show the menu." << LL_ENDL; return; } diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 08b5eaedbbe9d5d899324b90a8ab3fc00de98081..1685a18e26277de3994fa762a53386770745d61e 100755 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -162,7 +162,7 @@ void LLNetMap::draw() static LLUICachedControl<bool> auto_center("MiniMapAutoCenter", true); if (auto_center) { - mCurPan = lerp(mCurPan, mTargetPan, LLCriticalDamp::getInterpolant(0.1f)); + mCurPan = lerp(mCurPan, mTargetPan, LLSmoothInterpolation::getInterpolant(0.1f)); } // Prepare a scissor region diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index ef4d7356166546ffb31b6639e053f291b6e08821..a078889d46569a576ecec0e343585c229cc20d52 100755 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -135,7 +135,7 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi if (from_id.isNull()) { // Normal behavior for system generated messages, don't spam. - // llwarns << " from_id for notification " << notification->getName() << " is null " << llendl; + // LL_WARNS() << " from_id for notification " << notification->getName() << " is null " << LL_ENDL; return; } @@ -158,9 +158,9 @@ void LLHandlerUtil::logGroupNoticeToIMGroup( LLGroupData groupData; if (!gAgent.getGroupData(payload["group_id"].asUUID(), groupData)) { - llwarns + LL_WARNS() << "Group notice for unknown group: " - << payload["group_id"].asUUID() << llendl; + << payload["group_id"].asUUID() << LL_ENDL; return; } diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index ff8bfafb791da2fd4a87f61f0032e27e580d00ec..883221382ced24f2e81310e4815ed5c025953c77 100755 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -90,7 +90,7 @@ const outfit_accordion_tab_params& get_accordion_tab_params() } else { - llwarns << "Failed to read xml of Outfit's Accordion Tab from outfit_accordion_tab.xml" << llendl; + LL_WARNS() << "Failed to read xml of Outfit's Accordion Tab from outfit_accordion_tab.xml" << LL_ENDL; } } @@ -204,7 +204,7 @@ class LLOutfitListGearMenu LLWearableType::EType type = LLWearableType::typeNameToType(data.asString()); if (type == LLWearableType::WT_NONE) { - llwarns << "Invalid wearable type" << llendl; + LL_WARNS() << "Invalid wearable type" << LL_ENDL; return; } diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 679b1bdcda6ebbdeac2f9b44116ddfc14e47ee59..5d1b582d1f338f0fd4ee387a2b855cd152bb0187 100755 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -29,7 +29,6 @@ #include "llagent.h" #include "llavataractions.h" -#include "llavatarconstants.h" // AVATAR_ONLINE #include "llcallingcard.h" #include "llcombobox.h" #include "lldateutil.h" // ageFromDate() @@ -98,7 +97,7 @@ LLDropTarget::~LLDropTarget() void LLDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) { - llinfos << "LLDropTarget::doDrop()" << llendl; + LL_INFOS() << "LLDropTarget::doDrop()" << LL_ENDL; } BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index 9665314e7535c9ab0a04e5c876c9899ca0406f6a..81ed2963e607f87bb9ef98086b04e1db98d54826 100755 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -90,7 +90,7 @@ BOOL LLPanelBlockedList::postBuild() mBlockedList->sortByType(); break; default: - llwarns << "Unrecognized sort order for blocked list" << llendl; + LL_WARNS() << "Unrecognized sort order for blocked list" << LL_ENDL; break; } diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 862e4be203a5dea41b621fc98acf92b814b7bd2d..62966e3a4ec1159168fdf40ff83ed9217179c77f 100755 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -52,6 +52,7 @@ #include "llfloaterworldmap.h" #include "llviewergenericmessage.h" // send_generic_message #include "llviewerregion.h" +#include "llviewertexture.h" #include "lltrans.h" #include "llscrollcontainer.h" #include "llstatusbar.h" @@ -102,8 +103,8 @@ class LLClassifiedClickMessageResponder : public LLHTTPClient::Responder const std::string& reason, const LLSD& content) { - llwarns << "Sending click message failed (" << status << "): [" << reason << "]" << llendl; - llwarns << "Content: [" << content << "]" << llendl; + LL_WARNS() << "Sending click message failed (" << status << "): [" << reason << "]" << LL_ENDL; + LL_WARNS() << "Content: [" << content << "]" << LL_ENDL; } }; @@ -219,7 +220,7 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key) setSnapshotId(key["classified_snapshot_id"]); setFromSearch(key["from_search"]); - llinfos << "Opening classified [" << getClassifiedName() << "] (" << getClassifiedId() << ")" << llendl; + LL_INFOS() << "Opening classified [" << getClassifiedName() << "] (" << getClassifiedId() << ")" << LL_ENDL; LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); @@ -230,7 +231,7 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key) std::string url = gAgent.getRegion()->getCapability("SearchStatRequest"); if (!url.empty()) { - llinfos << "Classified stat request via capability" << llendl; + LL_INFOS() << "Classified stat request via capability" << LL_ENDL; LLSD body; body["classified_id"] = getClassifiedId(); LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(getClassifiedId())); @@ -388,9 +389,9 @@ void LLPanelClassifiedInfo::setClickThrough( S32 profile, bool from_new_table) { - llinfos << "Click-through data for classified " << classified_id << " arrived: [" + LL_INFOS() << "Click-through data for classified " << classified_id << " arrived: [" << teleport << ", " << map << ", " << profile << "] (" - << (from_new_table ? "new" : "old") << ")" << llendl; + << (from_new_table ? "new" : "old") << ")" << LL_ENDL; for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter) { @@ -407,7 +408,7 @@ void LLPanelClassifiedInfo::setClickThrough( continue; } - llinfos << "Updating classified info panel" << llendl; + LL_INFOS() << "Updating classified info panel" << LL_ENDL; // We need to check to see if the data came from the new stat_table // or the old classified table. We also need to cache the data from @@ -436,10 +437,10 @@ void LLPanelClassifiedInfo::setClickThrough( // *HACK: remove this when there is enough room for click stats in the info panel self->getChildView("click_through_text")->setToolTip(ct_str.getString()); - llinfos << "teleport: " << llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld) + LL_INFOS() << "teleport: " << llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld) << ", map: " << llformat("%d", self->mMapClicksNew + self->mMapClicksOld) << ", profile: " << llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld) - << llendl; + << LL_ENDL; } } @@ -549,8 +550,8 @@ void LLPanelClassifiedInfo::sendClickMessage( body["region_name"] = sim_name; std::string url = gAgent.getRegion()->getCapability("SearchStatTracking"); - llinfos << "Sending click msg via capability (url=" << url << ")" << llendl; - llinfos << "body: [" << body << "]" << llendl; + LL_INFOS() << "Sending click msg via capability (url=" << url << ")" << LL_ENDL; + LL_INFOS() << "body: [" << body << "]" << LL_ENDL; LLHTTPClient::post(url, body, new LLClassifiedClickMessageResponder()); } diff --git a/indra/newview/llpanelcontents.h b/indra/newview/llpanelcontents.h index 62ccb64a4cd619d7e73194ce839466c251f1d849..ad62e13bc282360a8bceb3428aadbb8cf37abe5b 100755 --- a/indra/newview/llpanelcontents.h +++ b/indra/newview/llpanelcontents.h @@ -31,7 +31,6 @@ #include "llpanel.h" #include "llinventory.h" #include "lluuid.h" -#include "llmap.h" #include "llviewerobject.h" #include "llvoinventorylistener.h" diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 0621cc8fad1e7e1e76bc1a6f84418016f1a66128..daa7df682b699a9c58eb447aed6e542ccd5fdfa3 100755 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -30,6 +30,7 @@ #include "llpanel.h" #include "llviewerwearable.h" #include "lluictrl.h" +#include "lllocaltextureobject.h" #include "llscrollingpanellist.h" #include "llvisualparam.h" #include "lltoolmorph.h" @@ -453,7 +454,7 @@ get_pickers_indexes<LLColorSwatchCtrl> (const LLEditWearableDictionary::Wearable { if (!wearable_entry) { - llwarns << "could not get LLColorSwatchCtrl indexes for null wearable entry." << llendl; + LL_WARNS() << "could not get LLColorSwatchCtrl indexes for null wearable entry." << LL_ENDL; return null_texture_vec; } return wearable_entry->mColorSwatchCtrls; @@ -466,7 +467,7 @@ get_pickers_indexes<LLTextureCtrl> (const LLEditWearableDictionary::WearableEntr { if (!wearable_entry) { - llwarns << "could not get LLTextureCtrl indexes for null wearable entry." << llendl; + LL_WARNS() << "could not get LLTextureCtrl indexes for null wearable entry." << LL_ENDL; return null_texture_vec; } return wearable_entry->mTextureCtrls; @@ -496,7 +497,7 @@ find_picker_ctrl_entry_if(LLWearableType::EType type, const Predicate pred) = LLEditWearableDictionary::getInstance()->getWearable(type); if (!wearable_entry) { - llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl; + LL_WARNS() << "could not get wearable dictionary entry for wearable of type: " << type << LL_ENDL; return NULL; } const texture_vec_t& indexes = get_pickers_indexes<CtrlType>(wearable_entry); @@ -510,7 +511,7 @@ find_picker_ctrl_entry_if(LLWearableType::EType type, const Predicate pred) = get_picker_entry<CtrlType>(te); if (!entry) { - llwarns << "could not get picker dictionary entry (" << te << ") for wearable of type: " << type << llendl; + LL_WARNS() << "could not get picker dictionary entry (" << te << ") for wearable of type: " << type << LL_ENDL; continue; } if (pred(entry)) @@ -527,14 +528,14 @@ for_each_picker_ctrl_entry(LLPanel* panel, LLWearableType::EType type, function_ { if (!panel) { - llwarns << "the panel wasn't passed for wearable of type: " << type << llendl; + LL_WARNS() << "the panel wasn't passed for wearable of type: " << type << LL_ENDL; return; } const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type); if (!wearable_entry) { - llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl; + LL_WARNS() << "could not get wearable dictionary entry for wearable of type: " << type << LL_ENDL; return; } const texture_vec_t& indexes = get_pickers_indexes<CtrlType>(wearable_entry); @@ -548,7 +549,7 @@ for_each_picker_ctrl_entry(LLPanel* panel, LLWearableType::EType type, function_ = get_picker_entry<CtrlType>(te); if (!entry) { - llwarns << "could not get picker dictionary entry (" << te << ") for wearable of type: " << type << llendl; + LL_WARNS() << "could not get picker dictionary entry (" << te << ") for wearable of type: " << type << LL_ENDL; continue; } fun (panel, entry); @@ -700,12 +701,12 @@ void LLPanelEditWearable::setWearablePanelVisibilityChangeCallback(LLPanel* body } else { - llwarns << "accordion_ctrl is NULL" << llendl; + LL_WARNS() << "accordion_ctrl is NULL" << LL_ENDL; } } else { - llwarns << "bodypart_panel is NULL" << llendl; + LL_WARNS() << "bodypart_panel is NULL" << LL_ENDL; } } @@ -776,7 +777,7 @@ BOOL LLPanelEditWearable::postBuild() const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type); if (!wearable_entry) { - llwarns << "could not get wearable dictionary entry for wearable of type: " << type << llendl; + LL_WARNS() << "could not get wearable dictionary entry for wearable of type: " << type << LL_ENDL; continue; } U8 num_subparts = wearable_entry->mSubparts.size(); @@ -789,7 +790,7 @@ BOOL LLPanelEditWearable::postBuild() if (!subpart_entry) { - llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl; + LL_WARNS() << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << LL_ENDL; continue; } @@ -799,7 +800,7 @@ BOOL LLPanelEditWearable::postBuild() if (!tab) { - llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl; + LL_WARNS() << "could not get llaccordionctrltab from UI with name: " << accordion_tab << LL_ENDL; continue; } @@ -959,7 +960,7 @@ void LLPanelEditWearable::onTexturePickerCommit(const LLUICtrl* ctrl) const LLTextureCtrl* texture_ctrl = dynamic_cast<const LLTextureCtrl*>(ctrl); if (!texture_ctrl) { - llwarns << "got commit signal from not LLTextureCtrl." << llendl; + LL_WARNS() << "got commit signal from not LLTextureCtrl." << LL_ENDL; return; } @@ -987,7 +988,7 @@ void LLPanelEditWearable::onTexturePickerCommit(const LLUICtrl* ctrl) } else { - llwarns << "could not get texture picker dictionary entry for wearable of type: " << type << llendl; + LL_WARNS() << "could not get texture picker dictionary entry for wearable of type: " << type << LL_ENDL; } } } @@ -1013,7 +1014,7 @@ void LLPanelEditWearable::onColorSwatchCommit(const LLUICtrl* ctrl) } else { - llwarns << "could not get color swatch dictionary entry for wearable of type: " << type << llendl; + LL_WARNS() << "could not get color swatch dictionary entry for wearable of type: " << type << LL_ENDL; } } } @@ -1070,7 +1071,7 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID()); if (links.size()>0) { - link_item = links.get(0).get(); + link_item = links.at(0).get(); if (link_item && link_item->getIsLinkType()) { description = link_item->getActualDescription(); @@ -1141,7 +1142,7 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, BOOL show, BO const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(type); if (!wearable_entry) { - llwarns << "called LLPanelEditWearable::showWearable with an invalid wearable type! (" << type << ")" << llendl; + LL_WARNS() << "called LLPanelEditWearable::showWearable with an invalid wearable type! (" << type << ")" << LL_ENDL; return; } @@ -1179,7 +1180,7 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, BOOL show, BO if (!subpart_entry) { - llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl; + LL_WARNS() << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << LL_ENDL; continue; } @@ -1191,13 +1192,13 @@ void LLPanelEditWearable::showWearable(LLViewerWearable* wearable, BOOL show, BO if (!panel_list) { - llwarns << "could not get scrolling panel list: " << scrolling_panel << llendl; + LL_WARNS() << "could not get scrolling panel list: " << scrolling_panel << LL_ENDL; continue; } if (!tab) { - llwarns << "could not get llaccordionctrltab from UI with name: " << accordion_tab << llendl; + LL_WARNS() << "could not get llaccordionctrltab from UI with name: " << accordion_tab << LL_ENDL; continue; } @@ -1271,13 +1272,13 @@ void LLPanelEditWearable::changeCamera(U8 subpart) const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mWearablePtr->getType()); if (!wearable_entry) { - llinfos << "could not get wearable dictionary entry for wearable type: " << mWearablePtr->getType() << llendl; + LL_INFOS() << "could not get wearable dictionary entry for wearable type: " << mWearablePtr->getType() << LL_ENDL; return; } if (subpart >= wearable_entry->mSubparts.size()) { - llinfos << "accordion tab expanded for invalid subpart. Wearable type: " << mWearablePtr->getType() << " subpart num: " << subpart << llendl; + LL_INFOS() << "accordion tab expanded for invalid subpart. Wearable type: " << mWearablePtr->getType() << " subpart num: " << subpart << LL_ENDL; return; } @@ -1286,7 +1287,7 @@ void LLPanelEditWearable::changeCamera(U8 subpart) if (!subpart_entry) { - llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl; + LL_WARNS() << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << LL_ENDL; return; } @@ -1375,7 +1376,7 @@ void LLPanelEditWearable::updateScrollingPanelUI() if (!panel_list) { - llwarns << "could not get scrolling panel list: " << scrolling_panel << llendl; + LL_WARNS() << "could not get scrolling panel list: " << scrolling_panel << LL_ENDL; continue; } @@ -1571,7 +1572,7 @@ void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LL if (!checkbox_ctrl) return; if (!getWearable()) return; - llinfos << "onInvisibilityCommit, self " << this << " checkbox_ctrl " << checkbox_ctrl << llendl; + LL_INFOS() << "onInvisibilityCommit, self " << this << " checkbox_ctrl " << checkbox_ctrl << LL_ENDL; bool new_invis_state = checkbox_ctrl->get(); if (new_invis_state) diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 3869219da699da27c0ea9febacc912ac920ffaaa..e3be1312e45bafdc19db4b7d7eff04493a998cdd 100755 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -337,7 +337,7 @@ void LLPanelFace::sendBump(U32 bumpiness) { LLTextureCtrl* bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); if (bumpiness < BUMPY_TEXTURE) - { +{ LL_DEBUGS("Materials") << "clearing bumptexture control" << LL_ENDL; bumpytexture_ctrl->clear(); bumpytexture_ctrl->setImageAssetID(LLUUID()); @@ -358,7 +358,7 @@ void LLPanelFace::sendBump(U32 bumpiness) // LLSelectedTEMaterial::setNormalID(this, current_normal_map); - LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); + LLSelectMgr::getInstance()->selectionSetBumpmap( bump ); } void LLPanelFace::sendTexGen() @@ -374,7 +374,7 @@ void LLPanelFace::sendShiny(U32 shininess) LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); if (shininess < SHINY_TEXTURE) - { +{ texture_ctrl->clear(); texture_ctrl->setImageAssetID(LLUUID()); } @@ -661,7 +661,7 @@ void LLPanelFace::updateUI() // only turn on auto-adjust button if there is a media renderer and the media is loaded getChildView("button align")->setEnabled(editable); - + LLComboBox* combobox_matmedia = getChild<LLComboBox>("combobox matmedia"); if (combobox_matmedia) { @@ -672,7 +672,7 @@ void LLPanelFace::updateUI() } else { - llwarns << "failed getChild for 'combobox matmedia'" << llendl; + LL_WARNS() << "failed getChild for 'combobox matmedia'" << LL_ENDL; } getChildView("combobox matmedia")->setEnabled(editable); @@ -696,15 +696,15 @@ void LLPanelFace::updateUI() bool identical_diffuse = false; bool identical_norm = false; bool identical_spec = false; - - LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); + + LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("texture control"); LLTextureCtrl* shinytexture_ctrl = getChild<LLTextureCtrl>("shinytexture control"); LLTextureCtrl* bumpytexture_ctrl = getChild<LLTextureCtrl>("bumpytexture control"); LLUUID id; LLUUID normmap_id; LLUUID specmap_id; - + // Color swatch { getChildView("color label")->setEnabled(editable); @@ -715,7 +715,7 @@ void LLPanelFace::updateUI() bool identical_color = false; if(mColorSwatch) - { + { LLSelectedTE::getColor(color, identical_color); mColorSwatch->setOriginal(color); @@ -747,7 +747,7 @@ void LLPanelFace::updateUI() LLCtrlSelectionInterface* combobox_shininess = childGetSelectionInterface("combobox shininess"); if (combobox_shininess) - { + { combobox_shininess->selectNthItem((S32)shiny); } @@ -760,15 +760,15 @@ void LLPanelFace::updateUI() getChildView("label environment")->setEnabled(editable); getChildView("environment")->setEnabled(editable); getChildView("label shinycolor")->setEnabled(editable); - + getChild<LLUICtrl>("combobox shininess")->setTentative(!identical_spec); getChild<LLUICtrl>("glossiness")->setTentative(!identical_spec); getChild<LLUICtrl>("environment")->setTentative(!identical_spec); getChild<LLUICtrl>("shinycolorswatch")->setTentative(!identical_spec); - + LLColorSwatchCtrl* mShinyColorSwatch = getChild<LLColorSwatchCtrl>("shinycolorswatch"); if(mShinyColorSwatch) - { + { mShinyColorSwatch->setValid(editable); mShinyColorSwatch->setEnabled( editable ); mShinyColorSwatch->setCanApplyImmediately( editable ); @@ -776,7 +776,7 @@ void LLPanelFace::updateUI() U8 bumpy = 0; // Bumpy - { + { bool identical_bumpy = false; LLSelectedTE::getBumpmap(bumpy,identical_bumpy); @@ -786,18 +786,18 @@ void LLPanelFace::updateUI() bumpy = norm_map_id.isNull() ? bumpy : BUMPY_TEXTURE; if (combobox_bumpiness) - { + { combobox_bumpiness->selectNthItem((S32)bumpy); - } + } else - { - llwarns << "failed childGetSelectionInterface for 'combobox bumpiness'" << llendl; - } + { + LL_WARNS() << "failed childGetSelectionInterface for 'combobox bumpiness'" << LL_ENDL; + } getChildView("combobox bumpiness")->setEnabled(editable); getChild<LLUICtrl>("combobox bumpiness")->setTentative(!identical_bumpy); getChildView("label bumpiness")->setEnabled(editable); - } + } // Texture { @@ -824,10 +824,10 @@ void LLPanelFace::updateUI() case GL_RGB: break; default: { - llwarns << "Unexpected tex format in LLPanelFace...resorting to no alpha" << llendl; - } + LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; + } break; - } + } if(LLViewerMedia::textureHasMedia(id)) { @@ -860,13 +860,13 @@ void LLPanelFace::updateUI() } else { - llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; + LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL; } updateAlphaControls(); - if(texture_ctrl) - { + if(texture_ctrl) + { if (identical_diffuse) { texture_ctrl->setTentative( FALSE ); @@ -878,22 +878,22 @@ void LLPanelFace::updateUI() getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); } else if (id.isNull()) - { - // None selected - texture_ctrl->setTentative( FALSE ); - texture_ctrl->setEnabled( FALSE ); - texture_ctrl->setImageAssetID( LLUUID::null ); + { + // None selected + texture_ctrl->setTentative( FALSE ); + texture_ctrl->setEnabled( FALSE ); + texture_ctrl->setImageAssetID( LLUUID::null ); getChildView("combobox alphamode")->setEnabled( FALSE ); getChildView("label alphamode")->setEnabled( FALSE ); getChildView("maskcutoff")->setEnabled( FALSE); getChildView("label maskcutoff")->setEnabled( FALSE ); - } - else - { - // Tentative: multiple selected with different textures - texture_ctrl->setTentative( TRUE ); - texture_ctrl->setEnabled( editable ); - texture_ctrl->setImageAssetID( id ); + } + else + { + // Tentative: multiple selected with different textures + texture_ctrl->setTentative( TRUE ); + texture_ctrl->setEnabled( editable ); + texture_ctrl->setImageAssetID( id ); getChildView("combobox alphamode")->setEnabled(editable && mIsAlpha && transparency <= 0.f); getChildView("label alphamode")->setEnabled(editable && mIsAlpha); getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); @@ -908,20 +908,20 @@ void LLPanelFace::updateUI() shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); shinytexture_ctrl->setImageAssetID( specmap_id ); - } + } else if (specmap_id.isNull()) { shinytexture_ctrl->setTentative( FALSE ); shinytexture_ctrl->setEnabled( editable ); shinytexture_ctrl->setImageAssetID( LLUUID::null ); - } + } else { shinytexture_ctrl->setTentative( TRUE ); shinytexture_ctrl->setEnabled( editable ); shinytexture_ctrl->setImageAssetID( specmap_id ); - } - } + } + } if (bumpytexture_ctrl) { @@ -952,7 +952,7 @@ void LLPanelFace::updateUI() { LLCheckBoxCtrl* cb_planar_align = getChild<LLCheckBoxCtrl>("checkbox planar align"); align_planar = (cb_planar_align && cb_planar_align->get()); - + bool enabled = (editable && isIdenticalPlanarTexgen()); childSetValue("checkbox planar align", align_planar && enabled); childSetEnabled("checkbox planar align", enabled); @@ -1145,7 +1145,7 @@ void LLPanelFace::updateUI() F32 diff_rot_deg = diff_rotation * RAD_TO_DEG; F32 norm_rot_deg = norm_rotation * RAD_TO_DEG; F32 spec_rot_deg = spec_rotation * RAD_TO_DEG; - + getChildView("TexRot")->setEnabled(editable); getChildView("shinyRot")->setEnabled(editable && specmap_id.notNull()); getChildView("bumpyRot")->setEnabled(editable && normmap_id.notNull()); @@ -1166,10 +1166,10 @@ void LLPanelFace::updateUI() getChild<LLUICtrl>("glow")->setValue(glow); getChild<LLUICtrl>("glow")->setTentative(!identical_glow); getChildView("glow")->setEnabled(editable); - getChildView("glow label")->setEnabled(editable); + getChildView("glow label")->setEnabled(editable); } - { + { LLCtrlSelectionInterface* combobox_texgen = childGetSelectionInterface("combobox texgen"); if (combobox_texgen) { @@ -1177,9 +1177,9 @@ void LLPanelFace::updateUI() combobox_texgen->selectNthItem(((S32)selected_texgen) >> 1); } else - { - llwarns << "failed childGetSelectionInterface for 'combobox texgen'" << llendl; - } + { + LL_WARNS() << "failed childGetSelectionInterface for 'combobox texgen'" << LL_ENDL; + } getChildView("combobox texgen")->setEnabled(editable); getChild<LLUICtrl>("combobox texgen")->setTentative(!identical); @@ -1195,7 +1195,7 @@ void LLPanelFace::updateUI() { getChild<LLUICtrl>("rpt")->setValue(getString("string repeats per face")); } - } + } { U8 fullbright_flag = 0; @@ -1207,8 +1207,7 @@ void LLPanelFace::updateUI() getChildView("checkbox fullbright")->setEnabled(editable); getChild<LLUICtrl>("checkbox fullbright")->setTentative(!identical_fullbright); } - - + // Repeats per meter { F32 repeats_diff = 1.f; @@ -1225,7 +1224,7 @@ void LLPanelFace::updateUI() LLComboBox* mComboTexGen = getChild<LLComboBox>("combobox texgen"); if (mComboTexGen) - { + { S32 index = mComboTexGen ? mComboTexGen->getCurrentIndex() : 0; BOOL enabled = editable && (index != 1); BOOL identical_repeats = true; @@ -1236,26 +1235,26 @@ void LLPanelFace::updateUI() LLSelectMgr::getInstance()->setTextureChannel(LLRender::eTexIndex(material_type)); switch (material_type) - { + { default: case MATTYPE_DIFFUSE: - { + { enabled = editable && !id.isNull(); identical_repeats = identical_diff_repeats; repeats = repeats_diff; - } + } break; case MATTYPE_SPECULAR: - { + { enabled = (editable && ((shiny == SHINY_TEXTURE) && !specmap_id.isNull())); identical_repeats = identical_spec_repeats; repeats = repeats_spec; - } + } break; case MATTYPE_NORMAL: - { + { enabled = (editable && ((bumpy == BUMPY_TEXTURE) && !normmap_id.isNull())); identical_repeats = identical_norm_repeats; repeats = repeats_norm; @@ -1295,14 +1294,14 @@ void LLPanelFace::updateUI() if (!mIsAlpha) { // ... unless there is no alpha channel in the texture, in which case alpha mode MUST ebe none alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE; - } + } combobox_alphamode->selectNthItem(alpha_mode); - } - else - { - llwarns << "failed childGetSelectionInterface for 'combobox alphamode'" << llendl; - } + } + else + { + LL_WARNS() << "failed childGetSelectionInterface for 'combobox alphamode'" << LL_ENDL; + } getChild<LLUICtrl>("maskcutoff")->setValue(material->getAlphaMaskCutoff()); updateAlphaControls(); @@ -1314,15 +1313,15 @@ void LLPanelFace::updateUI() texture_ctrl->setImageAssetID(material->getSpecularID()); if (!material->getSpecularID().isNull() && (shiny == SHINY_TEXTURE)) - { + { material->getSpecularOffset(offset_x,offset_y); material->getSpecularRepeat(repeat_x,repeat_y); if (identical_planar_texgen) - { + { repeat_x *= 2.0f; repeat_y *= 2.0f; - } + } rot = material->getSpecularRotation(); getChild<LLUICtrl>("shinyScaleU")->setValue(repeat_x); @@ -1334,7 +1333,7 @@ void LLPanelFace::updateUI() getChild<LLUICtrl>("environment")->setValue(material->getEnvironmentIntensity()); updateShinyControls(!material->getSpecularID().isNull(), true); - } + } // Assert desired colorswatch color to match material AFTER updateShinyControls // to avoid getting overwritten with the default on some UI state changes. @@ -1359,7 +1358,7 @@ void LLPanelFace::updateUI() repeat_x *= 2.0f; repeat_y *= 2.0f; } - + rot = material->getNormalRotation(); getChild<LLUICtrl>("bumpyScaleU")->setValue(repeat_x); getChild<LLUICtrl>("bumpyScaleV")->setValue(repeat_y); @@ -1399,7 +1398,7 @@ void LLPanelFace::updateUI() if(mColorSwatch) { mColorSwatch->setEnabled( FALSE ); - mColorSwatch->setFallbackImageName("locked_image.j2c" ); + mColorSwatch->setFallbackImage(LLUI::getUIImage("locked_image.j2c") ); mColorSwatch->setValid(FALSE); } getChildView("color trans")->setEnabled(FALSE); @@ -1411,7 +1410,7 @@ void LLPanelFace::updateUI() getChildView("button align")->setEnabled(FALSE); //getChildView("has media")->setEnabled(FALSE); //getChildView("media info set")->setEnabled(FALSE); - + updateVisibility(); // Set variable values for numeric expressions @@ -1769,7 +1768,7 @@ BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item) void LLPanelFace::onCommitTexture( const LLSD& data ) { - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); + add(LLStatViewer::EDIT_TEXTURE, 1); sendTexture(); } @@ -1805,7 +1804,7 @@ void LLPanelFace::onSelectTexture(const LLSD& data) case GL_RGB: break; default: { - llwarns << "Unexpected tex format in LLPanelFace...resorting to no alpha" << llendl; + LL_WARNS() << "Unexpected tex format in LLPanelFace...resorting to no alpha" << LL_ENDL; } break; } @@ -2024,8 +2023,8 @@ void LLPanelFace::onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata) { case MATTYPE_DIFFUSE: { - LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); - } + LLSelectMgr::getInstance()->selectionTexScaleAutofit( repeats_per_meter ); +} break; case MATTYPE_NORMAL: diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index b68488122580c63c1481ca47860b25da128bc549..e32f039921ef2efad490c5e515d075707b89d1b7 100755 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -485,7 +485,7 @@ class LLPanelFace : public LLPanel { public: - static void getFace(LLFace*& face_to_return, bool& identical_face); + static void getFace(class LLFace*& face_to_return, bool& identical_face); static void getImageFormat(LLGLenum& image_format_to_return, bool& identical_face); static void getTexId(LLUUID& id, bool& identical); static void getObjectScaleS(F32& scale_s, bool& identical); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index c872a15af7fadcc7128ff5e9229c6305bf915a4d..f4aab6bd4e64df6cc2f46ad233c53e9e258fcf1c 100755 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -293,7 +293,7 @@ void LLPanelGroup::onBtnGroupChatClicked(void* user_data) void LLPanelGroup::onBtnJoin() { - lldebugs << "joining group: " << mID << llendl; + LL_DEBUGS() << "joining group: " << mID << LL_ENDL; LLGroupActions::join(mID); } @@ -331,8 +331,9 @@ void LLPanelGroup::update(LLGroupChange gc) if(gdatap) { std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName; - childSetValue("group_name", group_name); - childSetToolTip("group_name",group_name); + LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name"); + group_name_ctrl->setValue(group_name); + group_name_ctrl->setToolTip(group_name); LLGroupData agent_gdatap; bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlike(); @@ -378,8 +379,9 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id) if(gdatap) { std::string group_name = gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName; - childSetValue("group_name", group_name); - childSetToolTip("group_name",group_name); + LLUICtrl* group_name_ctrl = getChild<LLUICtrl>("group_name"); + group_name_ctrl->setValue(group_name); + group_name_ctrl->setToolTip(group_name); } LLButton* button_apply = findChild<LLButton>("btn_apply"); diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index eaf33c71086a83d6ee20fb788c4be27dc997b1cf..7ffaa05919f0980ccb7293f30b449cb95e197443 100755 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -266,7 +266,7 @@ void LLPanelGroupGeneral::onClickInfo(void *userdata) if ( !self ) return; - lldebugs << "open group info: " << self->mGroupID << llendl; + LL_DEBUGS() << "open group info: " << self->mGroupID << LL_ENDL; LLGroupActions::show(self->mGroupID); @@ -318,7 +318,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) if (has_power_in_group || mGroupID.isNull()) { - llinfos << "LLPanelGroupGeneral::apply" << llendl; + LL_INFOS() << "LLPanelGroupGeneral::apply" << LL_ENDL; // Check to make sure mature has been set if(mComboMature && @@ -624,7 +624,7 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) { mEditCharter->setText(gdatap->mCharter); } - + resetDirty(); } @@ -703,7 +703,7 @@ void LLPanelGroupGeneral::reset() mEditCharter->setText(empty_str); mGroupNameEditor->setText(empty_str); } - + { mComboMature->setEnabled(true); mComboMature->setVisible( !gAgent.isTeen() ); diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index a9a3c686a65d50f0997a199da27f7d57324b1641..dd13e8abf4b48b36a68f9574a5241ddc618e2dca 100755 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -492,7 +492,7 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids) } else { - llwarns << "llPanelGroupInvite: Selected avatar has no name: " << dest->getID() << llendl; + LL_WARNS() << "llPanelGroupInvite: Selected avatar has no name: " << dest->getID() << LL_ENDL; names.push_back("(Unknown)"); } } diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 17707557bb2cae8304c8ce32f6a2e9355386bef4..106f6c25f18e75eec829a78c87dba46bc49f1bba 100755 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -131,7 +131,7 @@ class LLGroupMoneyTabEventHandler - static LLMap<LLUUID, LLGroupMoneyTabEventHandler*> sInstanceIDs; + static std::map<LLUUID, LLGroupMoneyTabEventHandler*> sInstanceIDs; static std::map<LLPanel*, LLGroupMoneyTabEventHandler*> sTabsToHandlers; protected: LLGroupMoneyTabEventHandlerImpl* mImplementationp; @@ -324,7 +324,7 @@ bool LLPanelGroupLandMoney::impl::applyContribution() if(!gAgent.setGroupContribution(mPanel.mGroupID, new_contribution)) { // should never happen... - llwarns << "Unable to set contribution." << llendl; + LL_WARNS() << "Unable to set contribution." << LL_ENDL; return false; } } @@ -476,7 +476,7 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg) if ( msg->getSizeFast(_PREHASH_QueryData, i, _PREHASH_ProductSKU) > 0 ) { msg->getStringFast( _PREHASH_QueryData, _PREHASH_ProductSKU, land_sku, i); - llinfos << "Land sku: " << land_sku << llendl; + LL_INFOS() << "Land sku: " << land_sku << LL_ENDL; land_type = LLProductInfoRequestManager::instance().getDescriptionForSku(land_sku); } else @@ -534,7 +534,7 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg) //static -LLMap<LLUUID, LLPanelGroupLandMoney*> LLPanelGroupLandMoney::sGroupIDs; +std::map<LLUUID, LLPanelGroupLandMoney*> LLPanelGroupLandMoney::sGroupIDs; LLPanelGroupLandMoney::LLPanelGroupLandMoney() : LLPanelGroupTab() @@ -547,13 +547,13 @@ LLPanelGroupLandMoney::LLPanelGroupLandMoney() : //will then only be working for the last panel for a given group id :( //FIXME - add to setGroupID() - //LLPanelGroupLandMoney::sGroupIDs.addData(group_id, this); + //LLPanelGroupLandMoney::sGroupIDs.insert(group_id, this); } LLPanelGroupLandMoney::~LLPanelGroupLandMoney() { delete mImplementationp; - LLPanelGroupLandMoney::sGroupIDs.removeData(mGroupID); + LLPanelGroupLandMoney::sGroupIDs.erase(mGroupID); } void LLPanelGroupLandMoney::activate() @@ -821,15 +821,15 @@ void LLPanelGroupLandMoney::processPlacesReply(LLMessageSystem* msg, void**) LLUUID group_id; msg->getUUID("AgentData", "QueryID", group_id); - LLPanelGroupLandMoney* selfp = sGroupIDs.getIfThere(group_id); - if(!selfp) + group_id_map_t::iterator found_it = sGroupIDs.find(group_id); + if(found_it == sGroupIDs.end()) { - llinfos << "Group Panel Land L$ " << group_id << " no longer in existence." - << llendl; + LL_INFOS() << "Group Panel Land L$ " << group_id << " no longer in existence." + << LL_ENDL; return; } - selfp->mImplementationp->processGroupLand(msg); + found_it->second->mImplementationp->processGroupLand(msg); } @@ -885,7 +885,7 @@ void LLGroupMoneyTabEventHandlerImpl::updateButtons() //** LLGroupMoneyTabEventHandler Functions ** //******************************************* -LLMap<LLUUID, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sInstanceIDs; +std::map<LLUUID, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sInstanceIDs; std::map<LLPanel*, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sTabsToHandlers; LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_buttonp, @@ -922,13 +922,13 @@ LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_butto tab_containerp->setCommitCallback(boost::bind(&LLGroupMoneyTabEventHandler::onClickTab, this)); } - sInstanceIDs.addData(mImplementationp->mPanelID, this); + sInstanceIDs.insert(std::make_pair(mImplementationp->mPanelID, this)); sTabsToHandlers[panelp] = this; } LLGroupMoneyTabEventHandler::~LLGroupMoneyTabEventHandler() { - sInstanceIDs.removeData(mImplementationp->mPanelID); + sInstanceIDs.erase(mImplementationp->mPanelID); sTabsToHandlers.erase(mImplementationp->mTabPanelp); delete mImplementationp; @@ -1045,7 +1045,7 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg, msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id ); if (mImplementationp->getGroupID() != group_id) { - llwarns << "Group Account details not for this group!" << llendl; + LL_WARNS() << "Group Account details not for this group!" << LL_ENDL; return; } @@ -1068,8 +1068,8 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg, if ( interval_days != mImplementationp->mIntervalLength || current_interval != mImplementationp->mCurrentInterval ) { - llinfos << "Out of date details packet " << interval_days << " " - << current_interval << llendl; + LL_INFOS() << "Out of date details packet " << interval_days << " " + << current_interval << LL_ENDL; return; } @@ -1116,16 +1116,16 @@ void LLPanelGroupLandMoney::processGroupAccountDetailsReply(LLMessageSystem* msg msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); if (gAgent.getID() != agent_id) { - llwarns << "Got group L$ history reply for another agent!" << llendl; + LL_WARNS() << "Got group L$ history reply for another agent!" << LL_ENDL; return; } LLUUID request_id; msg->getUUIDFast(_PREHASH_MoneyData, _PREHASH_RequestID, request_id ); - LLGroupMoneyTabEventHandler* selfp = LLGroupMoneyTabEventHandler::sInstanceIDs.getIfThere(request_id); + LLGroupMoneyTabEventHandler* selfp = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id); if (!selfp) { - llwarns << "GroupAccountDetails recieved for non-existent group panel." << llendl; + LL_WARNS() << "GroupAccountDetails received for non-existent group panel." << LL_ENDL; return; } @@ -1186,7 +1186,7 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg, msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id ); if (mImplementationp->getGroupID() != group_id) { - llwarns << "Group Account Transactions not for this group!" << llendl; + LL_WARNS() << "Group Account Transactions not for this group!" << LL_ENDL; return; } @@ -1203,8 +1203,8 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg, if (interval_days != mImplementationp->mIntervalLength || current_interval != mImplementationp->mCurrentInterval) { - llinfos << "Out of date details packet " << interval_days << " " - << current_interval << llendl; + LL_INFOS() << "Out of date details packet " << interval_days << " " + << current_interval << LL_ENDL; return; } @@ -1293,7 +1293,7 @@ void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); if (gAgent.getID() != agent_id) { - llwarns << "Got group L$ history reply for another agent!" << llendl; + LL_WARNS() << "Got group L$ history reply for another agent!" << LL_ENDL; return; } @@ -1302,10 +1302,10 @@ void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem LLGroupMoneyTabEventHandler* self; - self = LLGroupMoneyTabEventHandler::sInstanceIDs.getIfThere(request_id); + self = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id); if (!self) { - llwarns << "GroupAccountTransactions recieved for non-existent group panel." << llendl; + LL_WARNS() << "GroupAccountTransactions recieved for non-existent group panel." << LL_ENDL; return; } @@ -1364,7 +1364,7 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_GroupID, group_id ); if (mImplementationp->getGroupID() != group_id) { - llwarns << "Group Account Summary received not for this group!" << llendl; + LL_WARNS() << "Group Account Summary received not for this group!" << LL_ENDL; return; } @@ -1415,8 +1415,8 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg, if (interval_days != mImplementationp->mIntervalLength || current_interval != mImplementationp->mCurrentInterval) { - llinfos << "Out of date summary packet " << interval_days << " " - << current_interval << llendl; + LL_INFOS() << "Out of date summary packet " << interval_days << " " + << current_interval << LL_ENDL; return; } @@ -1473,7 +1473,7 @@ void LLPanelGroupLandMoney::processGroupAccountSummaryReply(LLMessageSystem* msg msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); if (gAgent.getID() != agent_id) { - llwarns << "Got group L$ history reply for another agent!" << llendl; + LL_WARNS() << "Got group L$ history reply for another agent!" << LL_ENDL; return; } @@ -1482,10 +1482,10 @@ void LLPanelGroupLandMoney::processGroupAccountSummaryReply(LLMessageSystem* msg LLGroupMoneyTabEventHandler* self; - self = LLGroupMoneyTabEventHandler::sInstanceIDs.getIfThere(request_id); + self = get_ptr_in_map(LLGroupMoneyTabEventHandler::sInstanceIDs, request_id); if (!self) { - llwarns << "GroupAccountSummary recieved for non-existent group L$ planning tab." << llendl; + LL_WARNS() << "GroupAccountSummary recieved for non-existent group L$ planning tab." << LL_ENDL; return; } @@ -1494,9 +1494,9 @@ void LLPanelGroupLandMoney::processGroupAccountSummaryReply(LLMessageSystem* msg void LLPanelGroupLandMoney::setGroupID(const LLUUID& id) { - LLPanelGroupLandMoney::sGroupIDs.removeData(mGroupID); + LLPanelGroupLandMoney::sGroupIDs.erase(mGroupID); LLPanelGroupTab::setGroupID(id); - LLPanelGroupLandMoney::sGroupIDs.addData(mGroupID, this); + LLPanelGroupLandMoney::sGroupIDs.insert(std::make_pair(mGroupID, this)); bool can_view = gAgent.isInGroup(mGroupID); diff --git a/indra/newview/llpanelgrouplandmoney.h b/indra/newview/llpanelgrouplandmoney.h index ac3518ee19002ca6a82ba3da3e74f7d49e172aa9..3cec6065e709526b11db000e8e7a5a00d45a4dbe 100755 --- a/indra/newview/llpanelgrouplandmoney.h +++ b/indra/newview/llpanelgrouplandmoney.h @@ -28,7 +28,7 @@ #define LL_PANEL_GROUP_LAND_MONEY_H #include "llpanelgroup.h" -#include "llmap.h" +#include <map> #include "lluuid.h" class LLPanelGroupLandMoney : public LLPanelGroupTab @@ -47,7 +47,8 @@ class LLPanelGroupLandMoney : public LLPanelGroupTab static void processPlacesReply(LLMessageSystem* msg, void**); - static LLMap<LLUUID, LLPanelGroupLandMoney*> sGroupIDs; + typedef std::map<LLUUID, LLPanelGroupLandMoney*> group_id_map_t; + static group_id_map_t sGroupIDs; static void processGroupAccountDetailsReply(LLMessageSystem* msg, void** data); static void processGroupAccountTransactionsReply(LLMessageSystem* msg, void** data); diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index 0dfb8fef53fad5d27dbbebc423a84f4a64d0f21f..54728885c1aaf6cea6207b93d7e9e3c787ecbfe3 100755 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -117,7 +117,7 @@ LLGroupDropTarget::LLGroupDropTarget(const LLGroupDropTarget::Params& p) void LLGroupDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) { - llinfos << "LLGroupDropTarget::doDrop()" << llendl; + LL_INFOS() << "LLGroupDropTarget::doDrop()" << LL_ENDL; } BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, @@ -439,7 +439,7 @@ void LLPanelGroupNotices::refreshNotices() { onClickRefreshNotices(this); /* - lldebugs << "LLPanelGroupNotices::onClickGetPastNotices" << llendl; + LL_DEBUGS() << "LLPanelGroupNotices::onClickGetPastNotices" << LL_ENDL; mNoticesList->deleteAllItems(); @@ -457,7 +457,7 @@ void LLPanelGroupNotices::refreshNotices() void LLPanelGroupNotices::onClickRefreshNotices(void* data) { - lldebugs << "LLPanelGroupNotices::onClickGetPastNotices" << llendl; + LL_DEBUGS() << "LLPanelGroupNotices::onClickGetPastNotices" << LL_ENDL; LLPanelGroupNotices* self = (LLPanelGroupNotices*)data; self->mNoticesList->deleteAllItems(); @@ -484,16 +484,16 @@ void LLPanelGroupNotices::processGroupNoticesListReply(LLMessageSystem* msg, voi std::map<LLUUID,LLPanelGroupNotices*>::iterator it = sInstances.find(group_id); if (it == sInstances.end()) { - llinfos << "Group Panel Notices " << group_id << " no longer in existence." - << llendl; + LL_INFOS() << "Group Panel Notices " << group_id << " no longer in existence." + << LL_ENDL; return; } LLPanelGroupNotices* selfp = it->second; if(!selfp) { - llinfos << "Group Panel Notices " << group_id << " no longer in existence." - << llendl; + LL_INFOS() << "Group Panel Notices " << group_id << " no longer in existence." + << LL_ENDL; return; } @@ -595,7 +595,7 @@ void LLPanelGroupNotices::onSelectNotice(LLUICtrl* ctrl, void* data) msg->addUUID("GroupNoticeID",item->getUUID()); gAgent.sendReliableMessage(); - lldebugs << "Item " << item->getUUID() << " selected." << llendl; + LL_DEBUGS() << "Item " << item->getUUID() << " selected." << LL_ENDL; } void LLPanelGroupNotices::showNotice(const std::string& subject, diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index c30c932c415c64c15b2e9e6aee67f3d93125bc2a..61fa4ea95924850eb80581c90b1d228d2b9590e6 100755 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -72,8 +72,8 @@ bool agentCanAddToRole(const LLUUID& group_id, LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!gdatap) { - llwarns << "agentCanAddToRole " - << "-- No group data!" << llendl; + LL_WARNS() << "agentCanAddToRole " + << "-- No group data!" << LL_ENDL; return false; } @@ -126,7 +126,7 @@ LLPanelGroupRoles::~LLPanelGroupRoles() BOOL LLPanelGroupRoles::postBuild() { - lldebugs << "LLPanelGroupRoles::postBuild()" << llendl; + LL_DEBUGS() << "LLPanelGroupRoles::postBuild()" << LL_ENDL; mSubTabContainer = getChild<LLTabContainer>("roles_tab_container"); @@ -139,7 +139,7 @@ BOOL LLPanelGroupRoles::postBuild() LLPanelGroupSubTab* subtabp = dynamic_cast<LLPanelGroupSubTab*>(panel); if (!subtabp) { - llwarns << "Invalid subtab panel: " << panel->getName() << llendl; + LL_WARNS() << "Invalid subtab panel: " << panel->getName() << LL_ENDL; return FALSE; } @@ -342,7 +342,7 @@ void LLPanelGroupRoles::update(LLGroupChange gc) } else { - llwarns << "LLPanelGroupRoles::update() -- No subtab to update!" << llendl; + LL_WARNS() << "LLPanelGroupRoles::update() -- No subtab to update!" << LL_ENDL; } } @@ -538,7 +538,7 @@ void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl, { if (LLGroupMgr::getInstance()->mRoleActionSets.empty()) { - llwarns << "Can't build action list - no actions found." << llendl; + LL_WARNS() << "Can't build action list - no actions found." << LL_ENDL; return; } @@ -567,7 +567,7 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl, BOOL filter, BOOL is_owner_role) { - lldebugs << "Building role list for: " << action_set->mActionSetData->mName << llendl; + LL_DEBUGS() << "Building role list for: " << action_set->mActionSetData->mName << LL_ENDL; // See if the allow mask matches anything in this category. if (show_all || (allowed_by_some & action_set->mActionSetData->mPowerBit)) { @@ -860,7 +860,7 @@ void LLPanelGroupMembersSubTab::onMemberSelect(LLUICtrl* ctrl, void* user_data) void LLPanelGroupMembersSubTab::handleMemberSelect() { - lldebugs << "LLPanelGroupMembersSubTab::handleMemberSelect" << llendl; + LL_DEBUGS() << "LLPanelGroupMembersSubTab::handleMemberSelect" << LL_ENDL; mAssignedRolesList->deleteAllItems(); mAllowedActionsList->deleteAllItems(); @@ -868,8 +868,8 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - llwarns << "LLPanelGroupMembersSubTab::handleMemberSelect() " - << "-- No group data!" << llendl; + LL_WARNS() << "LLPanelGroupMembersSubTab::handleMemberSelect() " + << "-- No group data!" << LL_ENDL; return; } @@ -1041,7 +1041,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect() else { // This could happen if changes are not synced right on sub-panel change. - llwarns << "No group role data for " << iter->second << llendl; + LL_WARNS() << "No group role data for " << iter->second << LL_ENDL; } } mAssignedRolesList->setEnabled(TRUE); @@ -1335,7 +1335,7 @@ bool LLPanelGroupMembersSubTab::apply(std::string& mesg) LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - llwarns << "Unable to get group data for group " << mGroupID << llendl; + LL_WARNS() << "Unable to get group data for group " << mGroupID << LL_ENDL; mesg.assign("Unable to save member data. Try again later."); return false; @@ -1361,7 +1361,7 @@ bool LLPanelGroupMembersSubTab::apply(std::string& mesg) } else { - llwarns << "Unable to get role information for the owner role in group " << mGroupID << llendl; + LL_WARNS() << "Unable to get role information for the owner role in group " << mGroupID << LL_ENDL; mesg.assign("Unable to retried specific group information. Try again later"); return false; @@ -1397,7 +1397,7 @@ void LLPanelGroupMembersSubTab::applyMemberChanges() LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - llwarns << "Unable to get group data for group " << mGroupID << llendl; + LL_WARNS() << "Unable to get group data for group " << mGroupID << LL_ENDL; return; } @@ -1461,21 +1461,21 @@ U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& ag LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - llwarns << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No group data!" << llendl; + LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No group data!" << LL_ENDL; return GP_NO_POWERS; } LLGroupMgrGroupData::member_list_t::iterator iter = gdatap->mMembers.find(agent_id); if ( iter == gdatap->mMembers.end() ) { - llwarns << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No member data for member with UUID " << agent_id << llendl; + LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- No member data for member with UUID " << agent_id << LL_ENDL; return GP_NO_POWERS; } LLGroupMemberData* member_data = (*iter).second; if (!member_data) { - llwarns << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- Null member data for member with UUID " << agent_id << llendl; + LL_WARNS() << "LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges() -- Null member data for member with UUID " << agent_id << LL_ENDL; return GP_NO_POWERS; } @@ -1581,7 +1581,7 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - llwarns << "LLPanelGroupMembersSubTab::update() -- No group data!" << llendl; + LL_WARNS() << "LLPanelGroupMembersSubTab::update() -- No group data!" << LL_ENDL; return; } @@ -1677,7 +1677,7 @@ void LLPanelGroupMembersSubTab::updateMembers() LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - llwarns << "LLPanelGroupMembersSubTab::updateMembers() -- No group data!" << llendl; + LL_WARNS() << "LLPanelGroupMembersSubTab::updateMembers() -- No group data!" << LL_ENDL; return; } @@ -1803,7 +1803,7 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root) if (!mRolesList || !mAssignedMembersList || !mAllowedActionsList || !mRoleName || !mRoleTitle || !mRoleDescription || !mMemberVisibleCheck) { - llwarns << "ARG! element not found." << llendl; + LL_WARNS() << "ARG! element not found." << LL_ENDL; return FALSE; } @@ -1867,14 +1867,14 @@ void LLPanelGroupRolesSubTab::activate() void LLPanelGroupRolesSubTab::deactivate() { - lldebugs << "LLPanelGroupRolesSubTab::deactivate()" << llendl; + LL_DEBUGS() << "LLPanelGroupRolesSubTab::deactivate()" << LL_ENDL; LLPanelGroupSubTab::deactivate(); } bool LLPanelGroupRolesSubTab::needsApply(std::string& mesg) { - lldebugs << "LLPanelGroupRolesSubTab::needsApply()" << llendl; + LL_DEBUGS() << "LLPanelGroupRolesSubTab::needsApply()" << LL_ENDL; LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); @@ -1884,7 +1884,7 @@ bool LLPanelGroupRolesSubTab::needsApply(std::string& mesg) bool LLPanelGroupRolesSubTab::apply(std::string& mesg) { - lldebugs << "LLPanelGroupRolesSubTab::apply()" << llendl; + LL_DEBUGS() << "LLPanelGroupRolesSubTab::apply()" << LL_ENDL; saveRoleChanges(true); @@ -1947,7 +1947,7 @@ bool LLPanelGroupRolesSubTab::matchesSearchFilter(std::string rolename, std::str void LLPanelGroupRolesSubTab::update(LLGroupChange gc) { - lldebugs << "LLPanelGroupRolesSubTab::update()" << llendl; + LL_DEBUGS() << "LLPanelGroupRolesSubTab::update()" << LL_ENDL; if (mGroupID.isNull()) return; @@ -1992,7 +1992,7 @@ void LLPanelGroupRolesSubTab::update(LLGroupChange gc) } else { - llwarns << "LLPanelGroupRolesSubTab::update() No role data for role " << (*rit).first << llendl; + LL_WARNS() << "LLPanelGroupRolesSubTab::update() No role data for role " << (*rit).first << LL_ENDL; } } @@ -2053,7 +2053,7 @@ void LLPanelGroupRolesSubTab::onRoleSelect(LLUICtrl* ctrl, void* user_data) void LLPanelGroupRolesSubTab::handleRoleSelect() { BOOL can_delete = TRUE; - lldebugs << "LLPanelGroupRolesSubTab::handleRoleSelect()" << llendl; + LL_DEBUGS() << "LLPanelGroupRolesSubTab::handleRoleSelect()" << LL_ENDL; mAssignedMembersList->deleteAllItems(); mAllowedActionsList->deleteAllItems(); @@ -2061,8 +2061,8 @@ void LLPanelGroupRolesSubTab::handleRoleSelect() LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - llwarns << "LLPanelGroupRolesSubTab::handleRoleSelect() " - << "-- No group data!" << llendl; + LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() " + << "-- No group data!" << LL_ENDL; return; } @@ -2150,8 +2150,8 @@ void LLPanelGroupRolesSubTab::buildMembersList() LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - llwarns << "LLPanelGroupRolesSubTab::handleRoleSelect() " - << "-- No group data!" << llendl; + LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() " + << "-- No group data!" << LL_ENDL; return; } @@ -2200,13 +2200,13 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force) if (!check) return; - lldebugs << "LLPanelGroupRolesSubTab::handleActionSelect()" << llendl; + LL_DEBUGS() << "LLPanelGroupRolesSubTab::handleActionSelect()" << LL_ENDL; LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - llwarns << "LLPanelGroupRolesSubTab::handleRoleSelect() " - << "-- No group data!" << llendl; + LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() " + << "-- No group data!" << LL_ENDL; return; } @@ -2252,8 +2252,8 @@ void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force) } else { - llwarns << "Unable to look up role information for role id: " - << role_id << llendl; + LL_WARNS() << "Unable to look up role information for role id: " + << role_id << LL_ENDL; } } else @@ -2326,13 +2326,13 @@ void LLPanelGroupRolesSubTab::onMemberVisibilityChange(LLUICtrl* ctrl, void* use void LLPanelGroupRolesSubTab::handleMemberVisibilityChange(bool value) { - lldebugs << "LLPanelGroupRolesSubTab::handleMemberVisibilityChange()" << llendl; + LL_DEBUGS() << "LLPanelGroupRolesSubTab::handleMemberVisibilityChange()" << LL_ENDL; LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if (!gdatap) { - llwarns << "LLPanelGroupRolesSubTab::handleRoleSelect() " - << "-- No group data!" << llendl; + LL_WARNS() << "LLPanelGroupRolesSubTab::handleRoleSelect() " + << "-- No group data!" << LL_ENDL; return; } @@ -2519,27 +2519,27 @@ void LLPanelGroupActionsSubTab::activate() void LLPanelGroupActionsSubTab::deactivate() { - lldebugs << "LLPanelGroupActionsSubTab::deactivate()" << llendl; + LL_DEBUGS() << "LLPanelGroupActionsSubTab::deactivate()" << LL_ENDL; LLPanelGroupSubTab::deactivate(); } bool LLPanelGroupActionsSubTab::needsApply(std::string& mesg) { - lldebugs << "LLPanelGroupActionsSubTab::needsApply()" << llendl; + LL_DEBUGS() << "LLPanelGroupActionsSubTab::needsApply()" << LL_ENDL; return false; } bool LLPanelGroupActionsSubTab::apply(std::string& mesg) { - lldebugs << "LLPanelGroupActionsSubTab::apply()" << llendl; + LL_DEBUGS() << "LLPanelGroupActionsSubTab::apply()" << LL_ENDL; return true; } void LLPanelGroupActionsSubTab::update(LLGroupChange gc) { - lldebugs << "LLPanelGroupActionsSubTab::update()" << llendl; + LL_DEBUGS() << "LLPanelGroupActionsSubTab::update()" << LL_ENDL; if (mGroupID.isNull()) return; diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp index 5321ebc7773d5d8d825885840d38f06f57ab3522..9b21fbf6b718cdf2cc48b9fae79ac20ea646e283 100755 --- a/indra/newview/llpanelland.cpp +++ b/indra/newview/llpanelland.cpp @@ -187,7 +187,7 @@ void LLPanelLandInfo::refresh() } else { - lldebugs << "Invalid selection for joining land" << llendl; + LL_DEBUGS() << "Invalid selection for joining land" << LL_ENDL; getChildView("button join land")->setEnabled(FALSE); } diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp index 934f8ed8c751a8d129cd3b8372f634b5821c2b9d..63ddc05037a47ff2fd852ec3b4cbfc7df98368bf 100755 --- a/indra/newview/llpanellandmarkinfo.cpp +++ b/indra/newview/llpanellandmarkinfo.cpp @@ -435,7 +435,7 @@ void LLPanelLandmarkInfo::populateFoldersList() const LLViewerInventoryCategory* lmcat = gInventory.getCategory(landmarks_id); if (!lmcat) { - llwarns << "Cannot find the landmarks folder" << llendl; + LL_WARNS() << "Cannot find the landmarks folder" << LL_ENDL; } else { @@ -446,9 +446,9 @@ void LLPanelLandmarkInfo::populateFoldersList() typedef std::vector<folder_pair_t> folder_vec_t; folder_vec_t folders; // Sort the folders by their full name. - for (S32 i = 0; i < cats.count(); i++) + for (S32 i = 0; i < cats.size(); i++) { - const LLViewerInventoryCategory* cat = cats.get(i); + const LLViewerInventoryCategory* cat = cats.at(i); std::string cat_full_name = getFullFolderName(cat); folders.push_back(folder_pair_t(cat->getUUID(), cat_full_name)); } @@ -483,10 +483,10 @@ static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats) LLViewerInventoryCategory* favorites_cat = gInventory.getCategory(favorites_id); if (!favorites_cat) { - llwarns << "Cannot find the favorites folder" << llendl; + LL_WARNS() << "Cannot find the favorites folder" << LL_ENDL; } else { - cats.put(favorites_cat); + cats.push_back(favorites_cat); } } diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index a22d9c06fac73ba8b755a3083d09b3c55d6aa3a5..343f2b413f79e1d04d2d67cfdd788413b928f04c 100755 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -264,7 +264,7 @@ void LLLandmarksPanel::onShowOnMap() { if (NULL == mCurrentSelectedList) { - llwarns << "There are no selected list. No actions are performed." << llendl; + LL_WARNS() << "There are no selected list. No actions are performed." << LL_ENDL; return; } @@ -421,7 +421,7 @@ bool LLLandmarksPanel::isReceivedFolderSelected() const // *TODO: it should be filled with logic when EXT-976 is done. - llwarns << "Not implemented yet until EXT-976 is done." << llendl; + LL_WARNS() << "Not implemented yet until EXT-976 is done." << LL_ENDL; return false; } @@ -529,7 +529,7 @@ void LLLandmarksPanel::setParcelID(const LLUUID& parcel_id) // virtual void LLLandmarksPanel::setErrorStatus(U32 status, const std::string& reason) { - llwarns << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<llendl; + LL_WARNS() << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<LL_ENDL; } @@ -1047,7 +1047,7 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const } else { - llwarns << "Unprocessed command has come: " << command_name << llendl; + LL_WARNS() << "Unprocessed command has come: " << command_name << LL_ENDL; } return true; @@ -1206,7 +1206,7 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold } else { - llwarns << "Unprocessed command has come: " << command_name << llendl; + LL_WARNS() << "Unprocessed command has come: " << command_name << LL_ENDL; } } @@ -1364,9 +1364,9 @@ void LLLandmarksPanel::doCreatePick(LLLandmark* landmark) } else { - llwarns << "Can't create pick for landmark for region" << region_id + LL_WARNS() << "Can't create pick for landmark for region" << region_id << ". Region: " << region->getName() - << " does not support RemoteParcelRequest" << llendl; + << " does not support RemoteParcelRequest" << LL_ENDL; } } diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 911ecaad9dbdc0a3c0dbc22cb7d49ccc7e33b380..e2b4d098e9fd0b092a9ac86c12362d23cc51c697 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -33,7 +33,6 @@ #include "llfloaterreg.h" #include "llfontgl.h" #include "llmd5.h" -#include "llsecondlifeurls.h" #include "v4color.h" #include "llappviewer.h" @@ -112,16 +111,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); - // instance management - if (LLPanelLogin::sInstance) - { - LL_WARNS("AppInit") << "Duplicate instance of login view deleted" << LL_ENDL; - // Don't leave bad pointer in gFocusMgr - gFocusMgr.setDefaultKeyboardFocus(NULL); - - delete LLPanelLogin::sInstance; - } - mPasswordModified = FALSE; LLPanelLogin::sInstance = this; @@ -277,12 +266,12 @@ void LLPanelLogin::addFavoritesToStartLocation() S32 res = LLStringUtil::compareInsensitive(user_defined_name, iter->first); if (res != 0) { - lldebugs << "Skipping favorites for " << iter->first << llendl; + LL_DEBUGS() << "Skipping favorites for " << iter->first << LL_ENDL; continue; } combo->addSeparator(); - lldebugs << "Loading favorites for " << iter->first << llendl; + LL_DEBUGS() << "Loading favorites for " << iter->first << LL_ENDL; LLSD user_llsd = iter->second; for (LLSD::array_const_iterator iter1 = user_llsd.beginArray(); iter1 != user_llsd.endArray(); ++iter1) @@ -443,6 +432,16 @@ void LLPanelLogin::show(const LLRect &rect, void (*callback)(S32 option, void* user_data), void* callback_data) { + // instance management + if (LLPanelLogin::sInstance) + { + LL_WARNS("AppInit") << "Duplicate instance of login view deleted" << LL_ENDL; + // Don't leave bad pointer in gFocusMgr + gFocusMgr.setDefaultKeyboardFocus(NULL); + + delete LLPanelLogin::sInstance; + } + new LLPanelLogin(rect, callback, callback_data); if( !gFocusMgr.getKeyboardFocus() ) @@ -461,7 +460,7 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential, { if (!sInstance) { - llwarns << "Attempted fillFields with no login view shown" << llendl; + LL_WARNS() << "Attempted fillFields with no login view shown" << LL_ENDL; return; } LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL; @@ -519,7 +518,7 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential, { if (!sInstance) { - llwarns << "Attempted getFields with no login view shown" << llendl; + LL_WARNS() << "Attempted getFields with no login view shown" << LL_ENDL; return; } @@ -540,13 +539,13 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential, LLStringUtil::trim(username); std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString(); - LL_INFOS2("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL; + LL_INFOS("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL; // determine if the username is a first/last form or not. size_t separator_index = username.find_first_of(' '); if (separator_index == username.npos && !LLGridManager::getInstance()->isSystemGrid()) { - LL_INFOS2("Credentials", "Authentication") << "account: " << username << LL_ENDL; + LL_INFOS("Credentials", "Authentication") << "account: " << username << LL_ENDL; // single username, so this is a 'clear' identifier identifier["type"] = CRED_IDENTIFIER_TYPE_ACCOUNT; identifier["account_name"] = username; @@ -581,7 +580,7 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential, if (last.find_first_of(' ') == last.npos) { - LL_INFOS2("Credentials", "Authentication") << "agent: " << username << LL_ENDL; + LL_INFOS("Credentials", "Authentication") << "agent: " << username << LL_ENDL; // traditional firstname / lastname identifier["type"] = CRED_IDENTIFIER_TYPE_AGENT; identifier["first_name"] = first; @@ -609,7 +608,7 @@ BOOL LLPanelLogin::areCredentialFieldsDirty() { if (!sInstance) { - llwarns << "Attempted getServer with no login view shown" << llendl; + LL_WARNS() << "Attempted getServer with no login view shown" << LL_ENDL; } else { diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 68c22c12fd1ee838fcb01d9dd19fc733e5870b8c..b02298090ad9f35b1b5a5bd21fb237fe18abd73d 100755 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -158,7 +158,7 @@ BOOL LLPanelMainInventory::postBuild() // Now load the stored settings from disk, if available. std::ostringstream filterSaveName; filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME); - llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName.str() << llendl; + LL_INFOS() << "LLPanelMainInventory::init: reading from " << filterSaveName.str() << LL_ENDL; llifstream file(filterSaveName.str()); LLSD savedFilterState; if (file.is_open()) @@ -244,7 +244,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) llofstream filtersFile(filterSaveName.str()); if(!LLSDSerialize::toPrettyXML(filterRoot, filtersFile)) { - llwarns << "Could not write to filters save file " << filterSaveName << llendl; + LL_WARNS() << "Could not write to filters save file " << filterSaveName << LL_ENDL; } else filtersFile.close(); @@ -609,7 +609,7 @@ void LLPanelMainInventory::onFocusReceived() LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); if (!sidepanel_inventory) { - llwarns << "Could not find Inventory Panel in My Inventory floater" << llendl; + LL_WARNS() << "Could not find Inventory Panel in My Inventory floater" << LL_ENDL; return; } diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index da938712d7ad07bfaf572780f060d5c76faf174e..2f65bedc2bde8b9c557aed5928441d90a6c81c81 100755 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -164,7 +164,7 @@ void LLInboxFolderViewFolder::computeFreshness() #if DEBUGGING_FRESHNESS if (mFresh) { - llinfos << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion_utc << llendl; + LL_INFOS() << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion_utc << LL_ENDL; } #endif } @@ -242,7 +242,7 @@ void LLInboxFolderViewItem::computeFreshness() #if DEBUGGING_FRESHNESS if (mFresh) { - llinfos << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion_utc << llendl; + LL_INFOS() << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << last_expansion_utc << LL_ENDL; } #endif } diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp index 7a408e736f53e0e1040fe57cf70e0d38e6072d38..cedd3025fc479dddd9ca630e6eae49027166ae13 100755 --- a/indra/newview/llpanelme.cpp +++ b/indra/newview/llpanelme.cpp @@ -30,7 +30,6 @@ // Viewer includes #include "llpanelprofile.h" -#include "llavatarconstants.h" #include "llagent.h" #include "llagentcamera.h" #include "llagentwearables.h" diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index edcf0d045214742a07074548f06b82f76cade774..1cdd1b664e1ef4b3d71b4dacd63d2c40e9b2641e 100755 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -202,7 +202,7 @@ void LLPanelNearByMedia::onTopLost() /*virtual*/ -void LLPanelNearByMedia::handleVisibilityChange ( BOOL new_visibility ) +void LLPanelNearByMedia::onVisibilityChange ( BOOL new_visibility ) { if (new_visibility) { diff --git a/indra/newview/llpanelnearbymedia.h b/indra/newview/llpanelnearbymedia.h index c3634de9b47eec37311078efdd8db35377c372b6..a9c1b190cfb1ae0c6f7cde07c0d7648bd087ad30 100755 --- a/indra/newview/llpanelnearbymedia.h +++ b/indra/newview/llpanelnearbymedia.h @@ -48,7 +48,7 @@ class LLPanelNearByMedia : public LLPanel /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); /*virtual*/ void onTopLost(); - /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); + /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 25ef9a3d6a7f280efb1e2452c5e60382b0afbb0e..9123252f4c9f62bbd9bba9e6534a304418634abd 100755 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -625,7 +625,7 @@ void LLPanelObject::getState( ) } else { - llinfos << "Unknown path " << (S32) path << " profile " << (S32) profile << " in getState" << llendl; + LL_INFOS() << "Unknown path " << (S32) path << " profile " << (S32) profile << " in getState" << LL_ENDL; selected_item = MI_BOX; } @@ -1175,11 +1175,11 @@ void LLPanelObject::sendIsPhysical() LLSelectMgr::getInstance()->selectionUpdatePhysics(value); mIsPhysical = value; - llinfos << "update physics sent" << llendl; + LL_INFOS() << "update physics sent" << LL_ENDL; } else { - llinfos << "update physics not changed" << llendl; + LL_INFOS() << "update physics not changed" << LL_ENDL; } } @@ -1191,11 +1191,11 @@ void LLPanelObject::sendIsTemporary() LLSelectMgr::getInstance()->selectionUpdateTemporary(value); mIsTemporary = value; - llinfos << "update temporary sent" << llendl; + LL_INFOS() << "update temporary sent" << LL_ENDL; } else { - llinfos << "update temporary not changed" << llendl; + LL_INFOS() << "update temporary not changed" << LL_ENDL; } } @@ -1208,11 +1208,11 @@ void LLPanelObject::sendIsPhantom() LLSelectMgr::getInstance()->selectionUpdatePhantom(value); mIsPhantom = value; - llinfos << "update phantom sent" << llendl; + LL_INFOS() << "update phantom sent" << LL_ENDL; } else { - llinfos << "update phantom not changed" << llendl; + LL_INFOS() << "update phantom not changed" << LL_ENDL; } } @@ -1322,8 +1322,8 @@ void LLPanelObject::getVolumeParams(LLVolumeParams& volume_params) break; default: - llwarns << "Unknown base type " << selected_type - << " in getVolumeParams()" << llendl; + LL_WARNS() << "Unknown base type " << selected_type + << " in getVolumeParams()" << LL_ENDL; // assume a box selected_type = MI_BOX; profile = LL_PCODE_PROFILE_SQUARE; @@ -1640,11 +1640,11 @@ void LLPanelObject::sendScale(BOOL btn_down) } LLSelectMgr::getInstance()->adjustTexturesByScale(TRUE, !dont_stretch_textures); -// llinfos << "scale sent" << llendl; +// LL_INFOS() << "scale sent" << LL_ENDL; } else { -// llinfos << "scale not changed" << llendl; +// LL_INFOS() << "scale not changed" << LL_ENDL; } } diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 6c9616511ff4e51cb0f3b0549ff1622583235b9a..665b9ab294137787389e0a8e49cd71101779d236 100755 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -210,7 +210,7 @@ struct LLBuyInvItemData void LLTaskInvFVBridge::buyItem() { - llinfos << "LLTaskInvFVBridge::buyItem()" << llendl; + LL_INFOS() << "LLTaskInvFVBridge::buyItem()" << LL_ENDL; LLInventoryItem* item = findItem(); if(!item || !item->getSaleInfo().isForSale()) return; LLBuyInvItemData* inv = new LLBuyInvItemData(mPanel->getTaskUUID(), @@ -225,7 +225,7 @@ void LLTaskInvFVBridge::buyItem() if( ( obj = gObjectList.findObject( mPanel->getTaskUUID() ) ) && obj->isAttachment() ) { LLNotificationsUtil::add("Cannot_Purchase_an_Attachment"); - llinfos << "Attempt to purchase an attachment" << llendl; + LL_INFOS() << "Attempt to purchase an attachment" << LL_ENDL; delete inv; } else @@ -372,7 +372,7 @@ LLUIImagePtr LLTaskInvFVBridge::getIcon() const void LLTaskInvFVBridge::openItem() { // no-op. - lldebugs << "LLTaskInvFVBridge::openItem()" << llendl; + LL_DEBUGS() << "LLTaskInvFVBridge::openItem()" << LL_ENDL; } BOOL LLTaskInvFVBridge::isItemRenameable() const @@ -562,7 +562,7 @@ void LLTaskInvFVBridge::pasteLinkFromClipboard() BOOL LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { - //llinfos << "LLTaskInvFVBridge::startDrag()" << llendl; + //LL_INFOS() << "LLTaskInvFVBridge::startDrag()" << LL_ENDL; if(mPanel) { LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); @@ -603,7 +603,7 @@ BOOL LLTaskInvFVBridge::dragOrDrop(MASK mask, BOOL drop, void* cargo_data, std::string& tooltip_msg) { - //llinfos << "LLTaskInvFVBridge::dragOrDrop()" << llendl; + //LL_INFOS() << "LLTaskInvFVBridge::dragOrDrop()" << LL_ENDL; return FALSE; } @@ -616,7 +616,7 @@ void LLTaskInvFVBridge::performAction(LLInventoryModel* model, std::string actio S32 price = getPrice(); if (-1 == price) { - llwarns << "label_buy_task_bridged_item: Invalid price" << llendl; + LL_WARNS() << "label_buy_task_bridged_item: Invalid price" << LL_ENDL; } else { @@ -665,7 +665,7 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) S32 price = getPrice(); if (-1 == price) { - llwarns << "label_buy_task_bridged_item: Invalid price" << llendl; + LL_WARNS() << "label_buy_task_bridged_item: Invalid price" << LL_ENDL; } else { @@ -799,7 +799,7 @@ void LLTaskCategoryBridge::openItem() BOOL LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { - //llinfos << "LLTaskInvFVBridge::startDrag()" << llendl; + //LL_INFOS() << "LLTaskInvFVBridge::startDrag()" << LL_ENDL; if(mPanel && mUUID.notNull()) { LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); @@ -822,7 +822,7 @@ BOOL LLTaskCategoryBridge::dragOrDrop(MASK mask, BOOL drop, void* cargo_data, std::string& tooltip_msg) { - //llinfos << "LLTaskCategoryBridge::dragOrDrop()" << llendl; + //LL_INFOS() << "LLTaskCategoryBridge::dragOrDrop()" << LL_ENDL; BOOL accept = FALSE; LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); if(object) @@ -901,7 +901,7 @@ class LLTaskTextureBridge : public LLTaskInvFVBridge void LLTaskTextureBridge::openItem() { - llinfos << "LLTaskTextureBridge::openItem()" << llendl; + LL_INFOS() << "LLTaskTextureBridge::openItem()" << LL_ENDL; LLPreviewTexture* preview = LLFloaterReg::showTypedInstance<LLPreviewTexture>("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); if(preview) { @@ -978,7 +978,7 @@ void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) S32 price = getPrice(); if (-1 == price) { - llwarns << "label_buy_task_bridged_item: Invalid price" << llendl; + LL_WARNS() << "label_buy_task_bridged_item: Invalid price" << LL_ENDL; } else { @@ -1095,7 +1095,7 @@ class LLTaskLSLBridge : public LLTaskScriptBridge void LLTaskLSLBridge::openItem() { - llinfos << "LLTaskLSLBridge::openItem() " << mUUID << llendl; + LL_INFOS() << "LLTaskLSLBridge::openItem() " << mUUID << LL_ENDL; LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); if(!object || object->isInventoryPending()) { @@ -1336,7 +1336,7 @@ void LLTaskMeshBridge::buildContextMenu(LLMenuGL& menu, U32 flags) S32 price = getPrice(); if (-1 == price) { - llwarns << "label_buy_task_bridged_item: Invalid price" << llendl; + LL_WARNS() << "label_buy_task_bridged_item: Invalid price" << LL_ENDL; } else { @@ -1417,7 +1417,7 @@ LLTaskInvFVBridge* LLTaskInvFVBridge::createObjectBridge(LLPanelObjectInventory* break; case LLAssetType::AT_SCRIPT: // OLD SCRIPTS DEPRECATED - JC - llwarns << "Old script" << llendl; + LL_WARNS() << "Old script" << LL_ENDL; //new_bridge = new LLTaskOldScriptBridge(panel, // object_id, // object_name); @@ -1466,8 +1466,8 @@ LLTaskInvFVBridge* LLTaskInvFVBridge::createObjectBridge(LLPanelObjectInventory* object_name); break; default: - llinfos << "Unhandled inventory type (llassetstorage.h): " - << (S32)type << llendl; + LL_INFOS() << "Unhandled inventory type (llassetstorage.h): " + << (S32)type << LL_ENDL; break; } return new_bridge; @@ -1509,7 +1509,7 @@ LLPanelObjectInventory::~LLPanelObjectInventory() { if (!gIdleCallbacks.deleteFunction(idle, this)) { - llwarns << "LLPanelObjectInventory::~LLPanelObjectInventory() failed to delete callback" << llendl; + LL_WARNS() << "LLPanelObjectInventory::~LLPanelObjectInventory() failed to delete callback" << LL_ENDL; } } @@ -1604,9 +1604,9 @@ void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object, { if(!object) return; - //llinfos << "invetnory arrived: \n" + //LL_INFOS() << "invetnory arrived: \n" // << " panel UUID: " << panel->mTaskUUID << "\n" - // << " task UUID: " << object->mID << llendl; + // << " task UUID: " << object->mID << LL_ENDL; if(mTaskUUID == object->mID) { mInventoryNeedsUpdate = TRUE; @@ -1630,9 +1630,9 @@ void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object, void LLPanelObjectInventory::updateInventory() { - //llinfos << "inventory arrived: \n" + //LL_INFOS() << "inventory arrived: \n" // << " panel UUID: " << panel->mTaskUUID << "\n" - // << " task UUID: " << object->mID << llendl; + // << " task UUID: " << object->mID << LL_ENDL; // We're still interested in this task's inventory. std::vector<LLUUID> selected_item_ids; std::set<LLFolderViewItem*> selected_items; @@ -1754,7 +1754,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); // Find all in the first pass - LLDynamicArray<obj_folder_pair*> child_categories; + std::vector<obj_folder_pair*> child_categories; LLTaskInvFVBridge* bridge; LLFolderViewItem* view; @@ -1781,7 +1781,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li p.font_color = item_color; p.font_highlight_color = item_color; view = LLUICtrlFactory::create<LLFolderViewFolder>(p); - child_categories.put(new obj_folder_pair(obj, + child_categories.push_back(new obj_folder_pair(obj, (LLFolderViewFolder*)view)); } else @@ -1803,7 +1803,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li } // now, for each category, do the second pass - for(S32 i = 0; i < child_categories.count(); i++) + for(S32 i = 0; i < child_categories.size(); i++) { createViewsForCategory(inventory, child_categories[i]->first, child_categories[i]->second ); @@ -1813,7 +1813,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li void LLPanelObjectInventory::refresh() { - //llinfos << "LLPanelObjectInventory::refresh()" << llendl; + //LL_INFOS() << "LLPanelObjectInventory::refresh()" << LL_ENDL; BOOL has_inventory = FALSE; const BOOL non_root_ok = TRUE; LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, non_root_ok); @@ -1867,7 +1867,7 @@ void LLPanelObjectInventory::refresh() clearContents(); } mInventoryViewModel.setTaskID(mTaskUUID); - //llinfos << "LLPanelObjectInventory::refresh() " << mTaskUUID << llendl; + //LL_INFOS() << "LLPanelObjectInventory::refresh() " << mTaskUUID << LL_ENDL; } void LLPanelObjectInventory::removeSelectedItem() diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index f75d76da94dbcd91d47fec0ab6c8e4df01a4f228..e48aa889378b96bf51092dbcb9d6e73fd0cf4392 100755 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -169,14 +169,14 @@ class LLPanelOutfitEditGearMenu return menu; } - + private: static void onCreate(const LLSD& param) { LLWearableType::EType type = LLWearableType::typeNameToType(param.asString()); if (type == LLWearableType::WT_NONE) { - llwarns << "Invalid wearable type" << llendl; + LL_WARNS() << "Invalid wearable type" << LL_ENDL; return; } @@ -263,7 +263,7 @@ class LLAddWearablesGearMenu : public LLInitClass<LLAddWearablesGearMenu> } else { - llwarns << "Unrecognized sort order action" << llendl; + LL_WARNS() << "Unrecognized sort order action" << LL_ENDL; return; } @@ -306,7 +306,7 @@ class LLAddWearablesGearMenu : public LLInitClass<LLAddWearablesGearMenu> // If inventory panel is not sorted by date then it is sorted by name. return LLWearableItemsList::E_SORT_BY_MOST_RECENT & ~sort_order; } - llwarns << "Unrecognized inventory panel sort order" << llendl; + LL_WARNS() << "Unrecognized inventory panel sort order" << LL_ENDL; } else { @@ -324,7 +324,7 @@ class LLAddWearablesGearMenu : public LLInitClass<LLAddWearablesGearMenu> { return LLWearableItemsList::E_SORT_BY_TYPE_NAME == sort_order; } - llwarns << "Unrecognized wearable list sort order" << llendl; + LL_WARNS() << "Unrecognized wearable list sort order" << LL_ENDL; } return false; } @@ -481,7 +481,7 @@ BOOL LLPanelOutfitEdit::postBuild() childSetCommitCallback("shop_btn_1", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL); childSetCommitCallback("shop_btn_2", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL); - setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChanged, this, _2)); mWearablesGearMenuBtn = getChild<LLMenuButton>("wearables_gear_menu_btn"); mGearMenuBtn = getChild<LLMenuButton>("gear_menu_btn"); @@ -767,7 +767,7 @@ void LLPanelOutfitEdit::onPlusBtnClicked(void) } } -void LLPanelOutfitEdit::onVisibilityChange(const LLSD &in_visible_chain) +void LLPanelOutfitEdit::onVisibilityChanged(const LLSD &in_visible_chain) { showAddWearablesPanel(false); mWearableItemsList->resetSelection(); @@ -842,7 +842,7 @@ void LLPanelOutfitEdit::onShopButtonClicked() } else { - llwarns << "Agent avatar is invalid" << llendl; + LL_WARNS() << "Agent avatar is invalid" << LL_ENDL; // the second argument is not important in this case: generic market place will be opened url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE); @@ -1154,7 +1154,7 @@ BOOL LLPanelOutfitEdit::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, { if (cargo_data == NULL) { - llwarns << "cargo_data is NULL" << llendl; + LL_WARNS() << "cargo_data is NULL" << LL_ENDL; return TRUE; } @@ -1260,7 +1260,7 @@ void LLPanelOutfitEdit::resetAccordionState() } else { - llwarns << "mCOFWearables is NULL" << llendl; + LL_WARNS() << "mCOFWearables is NULL" << LL_ENDL; } } diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 5d4b8d46444e773a30a913934b5874f6dbae304b..30870daf406297f220ab4e335fd9acf8e5feb9ac 100755 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -145,7 +145,7 @@ class LLPanelOutfitEdit : public LLPanel void updatePlusButton(); void onPlusBtnClicked(void); - void onVisibilityChange(const LLSD &in_visible_chain); + void onVisibilityChanged(const LLSD &in_visible_chain); void applyFolderViewFilter(EFolderViewItemType type); void applyListViewFilter(EListViewItemType type); diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index e0132d20fbf11915da8aad689499e615a5cc9da9..3c72607678dce44b389f8fd307e0413ef30da5d8 100755 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -242,18 +242,12 @@ void LLPanelOutfitsInventory::updateListCommands() bool wear_visible = !isCOFPanelActive(); bool make_outfit_enabled = isActionEnabled("save_outfit"); + LLButton* wear_btn = mListCommands->getChild<LLButton>("wear_btn"); mMyOutfitsPanel->childSetEnabled("trash_btn", trash_enabled); - mListCommands->childSetEnabled("wear_btn", wear_enabled); - mListCommands->childSetVisible("wear_btn", wear_visible); + wear_btn->setEnabled(wear_enabled); + wear_btn->setVisible(wear_visible); mSaveComboBtn->setMenuItemEnabled("save_outfit", make_outfit_enabled); - if (mMyOutfitsPanel->hasItemSelected()) - { - mListCommands->childSetToolTip("wear_btn", getString("wear_items_tooltip")); - } - else - { - mListCommands->childSetToolTip("wear_btn", getString("wear_outfit_tooltip")); - } + wear_btn->setToolTip(getString(mMyOutfitsPanel->hasItemSelected() ? "wear_items_tooltip" : "wear_outfit_tooltip")); } void LLPanelOutfitsInventory::onTrashButtonClick() diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index f5542ee7a6cd38f1a5ebc2cbd6d088b0d8d3f22e..9d9fb4040ddbf25071196e78aba3c733b49a2c88 100755 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -394,7 +394,7 @@ class LLFriendListUpdater : public LLAvatarListUpdater, public LLFriendObserver } /*virtual*/ void changed(U32 mask) { - lldebugs << "Inventory changed: " << mask << llendl; + LL_DEBUGS() << "Inventory changed: " << mask << LL_ENDL; static bool synchronize_friends_folders = true; if (synchronize_friends_folders) @@ -410,9 +410,9 @@ class LLFriendListUpdater : public LLAvatarListUpdater, public LLFriendObserver // That means LLInventoryObserver::STRUCTURE is present in MASK instead of LLInventoryObserver::REMOVE if ((CALLINGCARD_ADDED & mask) == CALLINGCARD_ADDED) { - lldebugs << "Calling card added: count: " << gInventory.getChangedIDs().size() + LL_DEBUGS() << "Calling card added: count: " << gInventory.getChangedIDs().size() << ", first Inventory ID: "<< (*gInventory.getChangedIDs().begin()) - << llendl; + << LL_ENDL; bool friendFound = false; std::set<LLUUID> changedIDs = gInventory.getChangedIDs(); @@ -427,7 +427,7 @@ class LLFriendListUpdater : public LLAvatarListUpdater, public LLFriendObserver if (friendFound) { - lldebugs << "friend found, panel should be updated" << llendl; + LL_DEBUGS() << "friend found, panel should be updated" << LL_ENDL; mUpdater->changed(LLFriendObserver::ADD); } } @@ -556,7 +556,7 @@ void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LL { if(!avatar_list) { - llerrs << "Bad parameter" << llendl; + LL_ERRS() << "Bad parameter" << LL_ENDL; return; } @@ -668,7 +668,7 @@ BOOL LLPanelPeople::postBuild() } else { - llwarns << "People->Groups list menu not found" << llendl; + LL_WARNS() << "People->Groups list menu not found" << LL_ENDL; } LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>("tab_all"); @@ -753,12 +753,12 @@ void LLPanelPeople::updateFriendList() if (buddies_uuids.size() > 0) { - lldebugs << "Friends added to the list: " << buddies_uuids.size() << llendl; + LL_DEBUGS() << "Friends added to the list: " << buddies_uuids.size() << LL_ENDL; all_friendsp = buddies_uuids; } else { - lldebugs << "No friends found" << llendl; + LL_DEBUGS() << "No friends found" << LL_ENDL; } LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin(); @@ -902,8 +902,8 @@ void LLPanelPeople::updateButtons() LLPanel* groups_panel = mTabContainer->getCurrentPanel(); groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected - groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); - groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[REMAINING]", llformat("%d",(gMaxAgentGroups-gAgent.mGroups.count()))); + groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); + groups_panel->getChild<LLUICtrl>("groupcount")->setTextArg("[REMAINING]", llformat("%d",(gMaxAgentGroups-gAgent.mGroups.size()))); } else { @@ -1037,7 +1037,7 @@ void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save list->sort(); break; default: - llwarns << "Unrecognized people sort order for " << list->getName() << llendl; + LL_WARNS() << "Unrecognized people sort order for " << list->getName() << LL_ENDL; return; } @@ -1435,7 +1435,7 @@ bool LLPanelPeople::notifyChildren(const LLSD& info) LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); if (!container) { - llwarns << "Cannot find People panel container" << llendl; + LL_WARNS() << "Cannot find People panel container" << LL_ENDL; return true; } @@ -1457,7 +1457,7 @@ void LLPanelPeople::showAccordion(const std::string name, bool show) { if(name.empty()) { - llwarns << "No name provided" << llendl; + LL_WARNS() << "No name provided" << LL_ENDL; return; } @@ -1510,7 +1510,7 @@ void LLPanelPeople::setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapse { if(!acc_tab) { - llwarns << "Invalid parameter" << llendl; + LL_WARNS() << "Invalid parameter" << LL_ENDL; return; } @@ -1528,7 +1528,7 @@ bool LLPanelPeople::isAccordionCollapsedByUser(LLUICtrl* acc_tab) { if(!acc_tab) { - llwarns << "Invalid parameter" << llendl; + LL_WARNS() << "Invalid parameter" << LL_ENDL; return false; } diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index c7141f36eeaec2c4a8e0e03de711b57c2f97fddc..34dc3d9ab785d5672b38e98c26964b5e3864650b 100755 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -39,6 +39,7 @@ class LLFilterEditor; class LLGroupList; class LLMenuButton; class LLTabContainer; +class LLNetMap; class LLPanelPeople : public LLPanel diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 131e8e9359122b1a9d0a701a2d4654590845d2b7..58055d98c665d3a62c76297f57e3d9bf77928df8 100755 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -913,7 +913,6 @@ bool callback_deed_to_group(const LLSD& notification, const LLSD& response) if(group_id.notNull() && groups_identical && (gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED))) { LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE); -// LLViewerStats::getInstance()->incStat(LLViewerStats::ST_RELEASE_COUNT); } } return false; @@ -964,28 +963,28 @@ void LLPanelPermissions::onCommitEveryoneCopy(LLUICtrl *ctrl, void *data) // static void LLPanelPermissions::onCommitNextOwnerModify(LLUICtrl* ctrl, void* data) { - //llinfos << "LLPanelPermissions::onCommitNextOwnerModify" << llendl; + //LL_INFOS() << "LLPanelPermissions::onCommitNextOwnerModify" << LL_ENDL; onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_MODIFY); } // static void LLPanelPermissions::onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data) { - //llinfos << "LLPanelPermissions::onCommitNextOwnerCopy" << llendl; + //LL_INFOS() << "LLPanelPermissions::onCommitNextOwnerCopy" << LL_ENDL; onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_COPY); } // static void LLPanelPermissions::onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data) { - //llinfos << "LLPanelPermissions::onCommitNextOwnerTransfer" << llendl; + //LL_INFOS() << "LLPanelPermissions::onCommitNextOwnerTransfer" << LL_ENDL; onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_TRANSFER); } // static void LLPanelPermissions::onCommitName(LLUICtrl*, void* data) { - //llinfos << "LLPanelPermissions::onCommitName()" << llendl; + //LL_INFOS() << "LLPanelPermissions::onCommitName()" << LL_ENDL; LLPanelPermissions* self = (LLPanelPermissions*)data; LLLineEditor* tb = self->getChild<LLLineEditor>("Object Name"); if(tb) @@ -999,7 +998,7 @@ void LLPanelPermissions::onCommitName(LLUICtrl*, void* data) // static void LLPanelPermissions::onCommitDesc(LLUICtrl*, void* data) { - //llinfos << "LLPanelPermissions::onCommitDesc()" << llendl; + //LL_INFOS() << "LLPanelPermissions::onCommitDesc()" << LL_ENDL; LLPanelPermissions* self = (LLPanelPermissions*)data; LLLineEditor* le = self->getChild<LLLineEditor>("Object Description"); if(le) @@ -1024,7 +1023,7 @@ void LLPanelPermissions::onCommitSaleType(LLUICtrl*, void* data) void LLPanelPermissions::setAllSaleInfo() { - llinfos << "LLPanelPermissions::setAllSaleInfo()" << llendl; + LL_INFOS() << "LLPanelPermissions::setAllSaleInfo()" << LL_ENDL; LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_NOT; LLCheckBoxCtrl *checkPurchase = getChild<LLCheckBoxCtrl>("checkbox for sale"); diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index f0617266dbd6ffd9fddc8694f635c5f6faec8e8d..d73a5b402e2359f9c82bdc3fe4c157ce5a8fc6ae 100755 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -30,7 +30,6 @@ #include "llagent.h" #include "llagentpicksinfo.h" -#include "llavatarconstants.h" #include "llcommandhandler.h" #include "lldispatcher.h" #include "llflatlistview.h" @@ -123,7 +122,7 @@ class LLPickHandler : public LLCommandHandler, } else { - llwarns << "unknown verb " << verb << llendl; + LL_WARNS() << "unknown verb " << verb << LL_ENDL; return false; } } @@ -174,7 +173,7 @@ class LLPickHandler : public LLCommandHandler, } else { - llwarns << "Can't edit a pick you did not create" << llendl; + LL_WARNS() << "Can't edit a pick you did not create" << LL_ENDL; } // remove our observer now that we're done @@ -281,7 +280,7 @@ class LLClassifiedHandler : { if (c_info->creator_id == gAgent.getID()) { - llwarns << "edit in progress" << llendl; + LL_WARNS() << "edit in progress" << LL_ENDL; // open the new classified panel on the Me > Picks sidetray LLSD params; params["id"] = gAgent.getID(); @@ -292,7 +291,7 @@ class LLClassifiedHandler : } else { - llwarns << "Can't edit a classified you did not create" << llendl; + LL_WARNS() << "Can't edit a classified you did not create" << LL_ENDL; } } } @@ -677,7 +676,7 @@ void LLPanelPicks::onListCommit(const LLFlatListView* f_list) } else { - llwarns << "Unknown list" << llendl; + LL_WARNS() << "Unknown list" << LL_ENDL; } updateButtons(); @@ -937,7 +936,7 @@ void LLPanelPicks::openClassifiedInfo(const LLSD ¶ms) void LLPanelPicks::openClassifiedEdit(const LLSD& params) { LLUUID classified_id = params["classified_id"].asUUID();; - llinfos << "opening classified " << classified_id << " for edit" << llendl; + LL_INFOS() << "opening classified " << classified_id << " for edit" << LL_ENDL; editClassified(classified_id); } @@ -1169,7 +1168,7 @@ void LLPanelPicks::editClassified(const LLUUID& classified_id) LLClassifiedItem* c_item = findClassifiedById(classified_id); if (!c_item) { - llwarns << "item not found for classified_id " << classified_id << llendl; + LL_WARNS() << "item not found for classified_id " << classified_id << LL_ENDL; return; } diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp index 14b5d9af47c435a8326ef2be09b7093991842d1b..e501486ecbaf7725c1061d9f6ee4cf1cad99c5c3 100755 --- a/indra/newview/llpanelplaceprofile.cpp +++ b/indra/newview/llpanelplaceprofile.cpp @@ -302,9 +302,9 @@ void LLPanelPlaceProfile::processParcelInfo(const LLParcelData& parcel_data) } // virtual -void LLPanelPlaceProfile::handleVisibilityChange(BOOL new_visibility) +void LLPanelPlaceProfile::onVisibilityChange(BOOL new_visibility) { - LLPanel::handleVisibilityChange(new_visibility); + LLPanel::onVisibilityChange(new_visibility); LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance(); if (!parcel_mgr) diff --git a/indra/newview/llpanelplaceprofile.h b/indra/newview/llpanelplaceprofile.h index f4c614588179cf48ae6ee4e0299774f980ac09e9..01adfd49403c09b2b3f36fae18d0223c080a4b8e 100755 --- a/indra/newview/llpanelplaceprofile.h +++ b/indra/newview/llpanelplaceprofile.h @@ -38,7 +38,7 @@ class LLPanelPlaceProfile : public LLPanelPlaceInfo public: LLPanelPlaceProfile(); /*virtual*/ ~LLPanelPlaceProfile(); - + /*virtual*/ BOOL postBuild(); /*virtual*/ void resetLocation(); @@ -47,7 +47,7 @@ class LLPanelPlaceProfile : public LLPanelPlaceInfo /*virtual*/ void processParcelInfo(const LLParcelData& parcel_data); - /*virtual*/ void handleVisibilityChange(BOOL new_visibility); + /*virtual*/ void onVisibilityChange(BOOL new_visibility); // Displays information about the currently selected parcel // without sending a request to the server. diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 499b9ab62e15db1be86679f2c1eca3f6595acc1e..c05b379fd8bd1cfcf6ca0fefb9db4c77d784a2d6 100755 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -219,8 +219,8 @@ class LLPlacesRemoteParcelInfoObserver : public LLRemoteParcelInfoObserver } /*virtual*/ void setErrorStatus(U32 status, const std::string& reason) { - llerrs << "Can't complete remote parcel request. Http Status: " - << status << ". Reason : " << reason << llendl; + LL_ERRS() << "Can't complete remote parcel request. Http Status: " + << status << ". Reason : " << reason << LL_ENDL; } private: @@ -308,13 +308,13 @@ BOOL LLPanelPlaces::postBuild() mPlaceMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_place.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); if (!mPlaceMenu) { - llwarns << "Error loading Place menu" << llendl; + LL_WARNS() << "Error loading Place menu" << LL_ENDL; } mLandmarkMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_landmark.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); if (!mLandmarkMenu) { - llwarns << "Error loading Landmark menu" << llendl; + LL_WARNS() << "Error loading Landmark menu" << LL_ENDL; } mTabContainer = getChild<LLTabContainer>("Places Tabs"); @@ -614,7 +614,7 @@ void LLPanelPlaces::onTeleportButtonClicked() { if (mItem.isNull()) { - llwarns << "NULL landmark item" << llendl; + LL_WARNS() << "NULL landmark item" << LL_ENDL; llassert(mItem.notNull()); return; } @@ -902,7 +902,7 @@ void LLPanelPlaces::onOverflowMenuItemClicked(const LLSD& param) favorites_id, std::string(), LLPointer<LLInventoryCallback>(NULL)); - llinfos << "Copied inventory item #" << mItem->getUUID() << " to favorites." << llendl; + LL_INFOS() << "Copied inventory item #" << mItem->getUUID() << " to favorites." << LL_ENDL; } } } @@ -998,9 +998,9 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible) } // virtual -void LLPanelPlaces::handleVisibilityChange(BOOL new_visibility) +void LLPanelPlaces::onVisibilityChange(BOOL new_visibility) { - LLPanel::handleVisibilityChange(new_visibility); + LLPanel::onVisibilityChange(new_visibility); if (!new_visibility && mPlaceInfoType == AGENT_INFO_TYPE) { diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h index 85bdc2c4e1fcbc6b582efb506cbde868a37ffa91..b6019ca32ee0cffcee1d64caa17dc4976ce97c98 100755 --- a/indra/newview/llpanelplaces.h +++ b/indra/newview/llpanelplaces.h @@ -102,7 +102,7 @@ class LLPanelPlaces : public LLPanel void togglePickPanel(BOOL visible); void togglePlaceInfoPanel(BOOL visible); - /*virtual*/ void handleVisibilityChange(BOOL new_visibility); + /*virtual*/ void onVisibilityChange(BOOL new_visibility); void updateVerbs(); diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 9504f22a1d59e20aae8b60f0fff29e9de9c845eb..7c0e448a9918da164491bbebfdc0300116b177ec 100755 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -830,7 +830,7 @@ bool LLPanelPrimMediaControls::isMouseOver() if(hit_child && hit_child->getVisible()) { // This was useful for debugging both coordinate translation and view hieararchy problems... - // llinfos << "mouse coords: " << x << ", " << y << " hit child " << hit_child->getName() << llendl; + // LL_INFOS() << "mouse coords: " << x << ", " << y << " hit child " << hit_child->getName() << LL_ENDL; // This will be a direct child of the LLLayoutStack, which should be a layout_panel. // These may not shown/hidden by the logic in updateShape(), so we need to do another hit test on the children of the layout panel, @@ -841,7 +841,7 @@ bool LLPanelPrimMediaControls::isMouseOver() if(hit_child_2 && hit_child_2->getVisible()) { // This was useful for debugging both coordinate translation and view hieararchy problems... - // llinfos << " mouse coords: " << x << ", " << y << " hit child 2 " << hit_child_2->getName() << llendl; + // LL_INFOS() << " mouse coords: " << x << ", " << y << " hit child 2 " << hit_child_2->getName() << LL_ENDL; result = true; } } diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 5acc98904ba6b4589ec49599c8cbf6d087dd0a5d..f91c4110c0a7c9e1228f1801baa2a729f7376942 100755 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -38,6 +38,7 @@ #include "llviewernetwork.h" #include "llmutelist.h" #include "llpanelblockedlist.h" +#include "llweb.h" static const std::string PANEL_PICKS = "panel_picks"; @@ -71,7 +72,7 @@ class LLProfileHandler : public LLCommandHandler { if (params.size() < 1) return false; std::string agent_name = params[0]; - llinfos << "Profile, agent_name " << agent_name << llendl; + LL_INFOS() << "Profile, agent_name " << agent_name << LL_ENDL; std::string url = getProfileURL(agent_name); LLWeb::loadURLInternal(url); @@ -231,7 +232,7 @@ bool LLPanelProfile::ChildStack::pop() { if (mStack.size() == 0) { - llwarns << "Empty stack" << llendl; + LL_WARNS() << "Empty stack" << LL_ENDL; llassert(mStack.size() == 0); return false; } @@ -270,7 +271,7 @@ void LLPanelProfile::ChildStack::postParentReshape() for (view_list_t::const_iterator list_it = vlist.begin(); list_it != vlist.end(); ++list_it) { LLView* viewp = *list_it; - lldebugs << "removing " << viewp->getName() << llendl; + LL_DEBUGS() << "removing " << viewp->getName() << LL_ENDL; mParent->removeChild(viewp); } } @@ -279,7 +280,7 @@ void LLPanelProfile::ChildStack::postParentReshape() void LLPanelProfile::ChildStack::dump() { unsigned lvl = 0; - lldebugs << "child stack dump:" << llendl; + LL_DEBUGS() << "child stack dump:" << LL_ENDL; for (stack_t::const_iterator stack_it = mStack.begin(); stack_it != mStack.end(); ++stack_it, ++lvl) { std::ostringstream dbg_line; @@ -289,7 +290,7 @@ void LLPanelProfile::ChildStack::dump() { dbg_line << " " << (*list_it)->getName(); } - lldebugs << dbg_line.str() << llendl; + LL_DEBUGS() << dbg_line.str() << LL_ENDL; } } @@ -434,7 +435,7 @@ void LLPanelProfile::closePanel(LLPanel* panel) } else { - llwarns << "No underlying panel to focus." << llendl; + LL_WARNS() << "No underlying panel to focus." << LL_ENDL; } } } diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index 2f29e758c6bb7aa676ee882ae4ed3794a5780447..5924448671c6cb1b008e24c39e1e3280133474f1 100755 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -114,7 +114,7 @@ LLSideTrayPanelContainer* LLPanelSnapshot::getParentContainer() LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); if (!parent) { - llwarns << "Cannot find panel container" << llendl; + LL_WARNS() << "Cannot find panel container" << LL_ENDL; return NULL; } diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 455c1c9e5fa08264d209c9ab3cea7afdcdab93d0..21f95f38c0e9798effe2042d171a4ff45304ee97 100755 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -90,7 +90,7 @@ void LLPanelSnapshotOptions::openPanel(const std::string& panel_name) LLSideTrayPanelContainer* parent = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); if (!parent) { - llwarns << "Cannot find panel container" << llendl; + LL_WARNS() << "Cannot find panel container" << LL_ENDL; return; } diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp index aa109e9a512fffb936a3fec90625a20f8437cb63..95c443b82697daa7b0be2fe22a2b7a8ec0b4d4d1 100755 --- a/indra/newview/llpanelsnapshotpostcard.cpp +++ b/indra/newview/llpanelsnapshotpostcard.cpp @@ -236,7 +236,7 @@ void LLPanelSnapshotPostcard::onTabButtonPress(S32 btn_idx) other_btn->toggleState(); //other_btn->setEnabled(TRUE); - lldebugs << "Button #" << btn_idx << " (" << clicked_btn->getName() << ") clicked" << llendl; + LL_DEBUGS() << "Button #" << btn_idx << " (" << clicked_btn->getName() << ") clicked" << LL_ENDL; } void LLPanelSnapshotPostcard::onSend() diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 9c380f63bdbb4e09658659e07dad82642f257800..8fddd9523f8b12e794e46021637f09d52044168c 100755 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -421,7 +421,7 @@ BOOL LLTeleportHistoryPanel::postBuild() // All accordion tabs are collapsed initially setAccordionCollapsedByUser(tab, true); - mItemContainers.put(tab); + mItemContainers.push_back(tab); LLFlatListView* fl = getFlatListViewFromTab(tab); if (fl) @@ -437,14 +437,14 @@ BOOL LLTeleportHistoryPanel::postBuild() // Open first 2 accordion tabs if (mItemContainers.size() > 1) { - LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 1); + LLAccordionCtrlTab* tab = mItemContainers.at(mItemContainers.size() - 1); tab->setDisplayChildren(true); setAccordionCollapsedByUser(tab, false); } if (mItemContainers.size() > 2) { - LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 2); + LLAccordionCtrlTab* tab = mItemContainers.at(mItemContainers.size() - 2); tab->setDisplayChildren(true); setAccordionCollapsedByUser(tab, false); } @@ -688,7 +688,7 @@ void LLTeleportHistoryPanel::refresh() tab_idx = mItemContainers.size() - 1 - tab_idx; if (tab_idx >= 0) { - LLAccordionCtrlTab* tab = mItemContainers.get(tab_idx); + LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx); tab->setVisible(true); // Expand all accordion tabs when filtering @@ -722,7 +722,7 @@ void LLTeleportHistoryPanel::refresh() mCurrentItem, filter_string); if ( !curr_flat_view->addItem(item, LLUUID::null, ADD_BOTTOM, false) ) - llerrs << "Couldn't add flat item to teleport history." << llendl; + LL_ERRS() << "Couldn't add flat item to teleport history." << LL_ENDL; if (mLastSelectedItemIndex == mCurrentItem) curr_flat_view->selectItem(item, true); } @@ -735,7 +735,7 @@ void LLTeleportHistoryPanel::refresh() for (S32 n = mItemContainers.size() - 1; n >= 0; --n) { - LLAccordionCtrlTab* tab = mItemContainers.get(n); + LLAccordionCtrlTab* tab = mItemContainers.at(n); LLFlatListView* fv = getFlatListViewFromTab(tab); if (fv) { @@ -797,7 +797,7 @@ void LLTeleportHistoryPanel::replaceItem(S32 removed_index) // to point to the right item in LLTeleportHistoryStorage for (S32 tab_idx = mItemContainers.size() - 1; tab_idx >= 0; --tab_idx) { - LLAccordionCtrlTab* tab = mItemContainers.get(tab_idx); + LLAccordionCtrlTab* tab = mItemContainers.at(tab_idx); if (!tab->getVisible()) continue; @@ -851,7 +851,7 @@ void LLTeleportHistoryPanel::showTeleportHistory() for (S32 n = mItemContainers.size() - 1; n >= 0; --n) { - LLAccordionCtrlTab* tab = mItemContainers.get(n); + LLAccordionCtrlTab* tab = mItemContainers.at(n); if (tab) { tab->setVisible(false); @@ -878,7 +878,7 @@ void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected) for (S32 n = 0; n < tabs_cnt; n++) { - LLAccordionCtrlTab* tab = mItemContainers.get(n); + LLAccordionCtrlTab* tab = mItemContainers.at(n); if (!tab->getVisible()) continue; @@ -963,7 +963,7 @@ void LLTeleportHistoryPanel::onExpandAllFolders() for (S32 n = 0; n < tabs_cnt; n++) { - mItemContainers.get(n)->setDisplayChildren(true); + mItemContainers.at(n)->setDisplayChildren(true); } mHistoryAccordion->arrange(); } @@ -974,7 +974,7 @@ void LLTeleportHistoryPanel::onCollapseAllFolders() for (S32 n = 0; n < tabs_cnt; n++) { - mItemContainers.get(n)->setDisplayChildren(false); + mItemContainers.at(n)->setDisplayChildren(false); } mHistoryAccordion->arrange(); @@ -1029,7 +1029,7 @@ bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const for (S32 n = 0; n < tabs_cnt; n++) { - LLAccordionCtrlTab* tab = mItemContainers.get(n); + LLAccordionCtrlTab* tab = mItemContainers.at(n); if (!tab->getVisible()) continue; diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h index 47b607a2f46c27e89b6de42607d8edd1dcce8d9d..b88861c5c632cb3cd50da65a5cb11015b55a0ec5 100755 --- a/indra/newview/llpanelteleporthistory.h +++ b/indra/newview/llpanelteleporthistory.h @@ -112,7 +112,7 @@ class LLTeleportHistoryPanel : public LLPanelPlacesTab bool mDirty; S32 mCurrentItem; - typedef LLDynamicArray<LLAccordionCtrlTab*> item_containers_t; + typedef std::vector<LLAccordionCtrlTab*> item_containers_t; item_containers_t mItemContainers; ContextMenu mContextMenu; diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp index 0d09f0bbfcad06aae7e9f0f01a1b7aace450eeef..109013498ee71b17d8a4510383003113ae365939 100755 --- a/indra/newview/llpaneltopinfobar.cpp +++ b/indra/newview/llpaneltopinfobar.cpp @@ -169,7 +169,7 @@ BOOL LLPanelTopInfoBar::postBuild() mParcelMgrConnection = gAgent.addParcelChangedCallback( boost::bind(&LLPanelTopInfoBar::onAgentParcelChange, this)); - setVisibleCallback(boost::bind(&LLPanelTopInfoBar::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLPanelTopInfoBar::onVisibilityChanged, this, _2)); return TRUE; } @@ -186,7 +186,7 @@ void LLPanelTopInfoBar::onNavBarShowParcelPropertiesCtrlChanged() // when panel is shown, all minimized floaters should be shifted downwards to prevent overlapping of // PanelTopInfoBar. See EXT-7951. -void LLPanelTopInfoBar::onVisibilityChange(const LLSD& show) +void LLPanelTopInfoBar::onVisibilityChanged(const LLSD& show) { // this height is used as a vertical offset for ALREADY MINIMIZED floaters // when PanelTopInfoBar visibility changes diff --git a/indra/newview/llpaneltopinfobar.h b/indra/newview/llpaneltopinfobar.h index d58d95be900eca41553706369f8fa8de843880ab..f37bd9c048823990ffab34a7c02823ff958d5ca9 100755 --- a/indra/newview/llpaneltopinfobar.h +++ b/indra/newview/llpaneltopinfobar.h @@ -57,7 +57,7 @@ class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>, /** * Called when the top info bar gets shown or hidden */ - void onVisibilityChange(const LLSD& show); + void onVisibilityChanged(const LLSD& show); boost::signals2::connection setResizeCallback( const resize_signal_t::slot_type& cb ); diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp index 6f0a1624a793c5312a8f39ad32c10617883f494a..3946d6a63b6875899ad29055a71b497b8613bbf9 100755 --- a/indra/newview/llpanelvoicedevicesettings.cpp +++ b/indra/newview/llpanelvoicedevicesettings.cpp @@ -85,7 +85,7 @@ BOOL LLPanelVoiceDeviceSettings::postBuild() } // virtual -void LLPanelVoiceDeviceSettings::handleVisibilityChange ( BOOL new_visibility ) +void LLPanelVoiceDeviceSettings::onVisibilityChange ( BOOL new_visibility ) { if (new_visibility) { diff --git a/indra/newview/llpanelvoicedevicesettings.h b/indra/newview/llpanelvoicedevicesettings.h index ba3bcad0dc2c486af8fbc83840df51b23bd23a8c..83464f476ae86d15abe75068f0816a90f828b138 100755 --- a/indra/newview/llpanelvoicedevicesettings.h +++ b/indra/newview/llpanelvoicedevicesettings.h @@ -44,7 +44,7 @@ class LLPanelVoiceDeviceSettings : public LLPanel void initialize(); void cleanup(); - /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); + /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); void setUseTuningMode(bool use) { mUseTuningMode = use; }; diff --git a/indra/newview/llpanelvoiceeffect.cpp b/indra/newview/llpanelvoiceeffect.cpp index 7da553801a1ea4d05930b6d797dbf62fc6713d07..a3f0e25ef0fd6cf07a7a57d9665f02a0571c13cd 100755 --- a/indra/newview/llpanelvoiceeffect.cpp +++ b/indra/newview/llpanelvoiceeffect.cpp @@ -35,6 +35,7 @@ #include "lltrans.h" #include "lltransientfloatermgr.h" #include "llvoiceclient.h" +#include "llweb.h" static LLPanelInjector<LLPanelVoiceEffect> t_panel_voice_effect("panel_voice_effect"); diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index a1d60b5b16907350eec4501817bb8f9211123240..f1f87e212dd2c8fbb29c9568dc638dbc2314f5fc 100755 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -620,7 +620,7 @@ void LLPanelVolume::sendIsLight() BOOL value = getChild<LLUICtrl>("Light Checkbox Ctrl")->getValue(); volobjp->setIsLight(value); - llinfos << "update light sent" << llendl; + LL_INFOS() << "update light sent" << LL_ENDL; } void LLPanelVolume::sendIsFlexible() @@ -652,7 +652,7 @@ void LLPanelVolume::sendIsFlexible() LLSelectMgr::getInstance()->selectionUpdatePhantom(volobjp->flagPhantom()); } - llinfos << "update flexible sent" << llendl; + LL_INFOS() << "update flexible sent" << LL_ENDL; } void LLPanelVolume::sendPhysicsShapeType(LLUICtrl* ctrl, void* userdata) diff --git a/indra/newview/llpanelvolumepulldown.cpp b/indra/newview/llpanelvolumepulldown.cpp index aea7b33d7f8f182ff254b74e4b59f14f04386f45..cb00f742ccfc607e8c2b9ccef0e7ade92ba90646 100755 --- a/indra/newview/llpanelvolumepulldown.cpp +++ b/indra/newview/llpanelvolumepulldown.cpp @@ -87,7 +87,7 @@ void LLPanelVolumePulldown::onMouseLeave(S32 x, S32 y, MASK mask) } /*virtual*/ -void LLPanelVolumePulldown::handleVisibilityChange ( BOOL new_visibility ) +void LLPanelVolumePulldown::onVisibilityChange ( BOOL new_visibility ) { if (new_visibility) { diff --git a/indra/newview/llpanelvolumepulldown.h b/indra/newview/llpanelvolumepulldown.h index 0d86e6bd28a6c2940e61650f7e2f373d807cf358..b843fab75623fc38beadf68e3920aa45dcbc7655 100755 --- a/indra/newview/llpanelvolumepulldown.h +++ b/indra/newview/llpanelvolumepulldown.h @@ -42,7 +42,7 @@ class LLPanelVolumePulldown : public LLPanel /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); /*virtual*/ void onTopLost(); - /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); + /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); /*virtual*/ BOOL postBuild(); private: diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp index edb624e3aad90df8319fd163b3dff2d6a2538718..75e0ed37415c48dc014237fbec9fc04860b60042 100755 --- a/indra/newview/llpanelwearing.cpp +++ b/indra/newview/llpanelwearing.cpp @@ -118,7 +118,7 @@ class LLWearingContextMenu : public LLListContextMenu if (!item) { - llwarns << "Invalid item" << llendl; + LL_WARNS() << "Invalid item" << LL_ENDL; continue; } diff --git a/indra/newview/llpatchvertexarray.cpp b/indra/newview/llpatchvertexarray.cpp index dece2928c05db1d143b2a768d255d1bf01a99f09..6e3e3754884b8f302854e6af845c4204a2e5cf06 100755 --- a/indra/newview/llpatchvertexarray.cpp +++ b/indra/newview/llpatchvertexarray.cpp @@ -128,7 +128,7 @@ void LLPatchVertexArray::create(U32 surface_width, U32 patch_width, F32 meters_p { // init() and some other things all want to deref these // pointers, so this is serious. - llerrs << "mRenderLevelp or mRenderStridep was NULL; we'd crash soon." << llendl; + LL_ERRS() << "mRenderLevelp or mRenderStridep was NULL; we'd crash soon." << LL_ENDL; return; } diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index c277359133285f460f0000c587b14118ff9dd854..ae5b3b4e7680669239f2f836d16d4bf25b9b8b54 100755 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -736,8 +736,8 @@ std::string LLPathfindingManager::getCapabilityURLForRegion(LLViewerRegion *pReg if (capabilityURL.empty()) { - llwarns << "cannot find capability '" << pCapabilityName << "' for current region '" - << ((pRegion != NULL) ? pRegion->getName() : "<null>") << "'" << llendl; + LL_WARNS() << "cannot find capability '" << pCapabilityName << "' for current region '" + << ((pRegion != NULL) ? pRegion->getName() : "<null>") << "'" << LL_ENDL; } return capabilityURL; @@ -804,7 +804,7 @@ void NavMeshStatusResponder::result(const LLSD &pContent) void NavMeshStatusResponder::errorWithContent(U32 pStatus, const std::string& pReason, const LLSD& pContent) { - llwarns << "NavMeshStatusResponder error [status:" << pStatus << "]: " << pContent << llendl; + LL_WARNS() << "NavMeshStatusResponder error [status:" << pStatus << "]: " << pContent << LL_ENDL; LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID); LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion, mIsGetStatusOnly); } @@ -859,7 +859,7 @@ void AgentStateResponder::result(const LLSD &pContent) void AgentStateResponder::errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent) { - llwarns << "AgentStateResponder error [status:" << pStatus << "]: " << pContent << llendl; + LL_WARNS() << "AgentStateResponder error [status:" << pStatus << "]: " << pContent << LL_ENDL; LLPathfindingManager::getInstance()->handleAgentState(FALSE); } @@ -885,7 +885,7 @@ void NavMeshRebakeResponder::result(const LLSD &pContent) void NavMeshRebakeResponder::errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent) { - llwarns << "NavMeshRebakeResponder error [status:" << pStatus << "]: " << pContent << llendl; + LL_WARNS() << "NavMeshRebakeResponder error [status:" << pStatus << "]: " << pContent << LL_ENDL; mRebakeNavMeshCallback(false); } @@ -921,8 +921,8 @@ void LinksetsResponder::handleObjectLinksetsResult(const LLSD &pContent) void LinksetsResponder::handleObjectLinksetsError(U32 pStatus, const std::string &pReason, const LLSD& pContent, const std::string &pURL) { - llwarns << "LinksetsResponder object linksets error with request to URL '" << pURL << "' [status:" - << pStatus << "]: " << pContent << llendl; + LL_WARNS() << "LinksetsResponder object linksets error with request to URL '" << pURL << "' [status:" + << pStatus << "]: " << pContent << LL_ENDL; mObjectMessagingState = kReceivedError; if (mTerrainMessagingState != kWaiting) { @@ -944,8 +944,8 @@ void LinksetsResponder::handleTerrainLinksetsResult(const LLSD &pContent) void LinksetsResponder::handleTerrainLinksetsError(U32 pStatus, const std::string &pReason, const LLSD& pContent, const std::string &pURL) { - llwarns << "LinksetsResponder terrain linksets error with request to URL '" << pURL << "' [status:" - << pStatus << "]: " << pContent << llendl; + LL_WARNS() << "LinksetsResponder terrain linksets error with request to URL '" << pURL << "' [status:" + << pStatus << "]: " << pContent << LL_ENDL; mTerrainMessagingState = kReceivedError; if (mObjectMessagingState != kWaiting) { @@ -1049,7 +1049,7 @@ void CharactersResponder::result(const LLSD &pContent) void CharactersResponder::errorWithContent(U32 pStatus, const std::string &pReason, const LLSD& pContent) { - llwarns << "CharactersResponder error [status:" << pStatus << "]: " << pContent << llendl; + LL_WARNS() << "CharactersResponder error [status:" << pStatus << "]: " << pContent << LL_ENDL; LLPathfindingObjectListPtr characterListPtr = LLPathfindingObjectListPtr(new LLPathfindingCharacterList()); mCharactersCallback(mRequestId, LLPathfindingManager::kRequestError, characterListPtr); diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 0c23e5ac923785ae99a64625f321ad6b4af2bf1e..40f5d8c23e10b578097f5f31cd697d75b8fc48bf 100755 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -129,7 +129,7 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes llassert(embeddedNavMeshVersion == pNavMeshVersion); // stinson 03/13/2012 : does this ever occur? if (embeddedNavMeshVersion != pNavMeshVersion) { - llwarns << "Mismatch between expected and embedded navmesh versions occurred" << llendl; + LL_WARNS() << "Mismatch between expected and embedded navmesh versions occurred" << LL_ENDL; pNavMeshVersion = embeddedNavMeshVersion; } } @@ -148,7 +148,7 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ; if ( !valid ) { - llwarns << "Unable to decompress the navmesh llsd." << llendl; + LL_WARNS() << "Unable to decompress the navmesh llsd." << LL_ENDL; status = kNavMeshRequestError; } else @@ -165,7 +165,7 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes } else { - llwarns << "No mesh data received" << llendl; + LL_WARNS() << "No mesh data received" << LL_ENDL; status = kNavMeshRequestError; } setRequestStatus(status); @@ -186,8 +186,8 @@ void LLPathfindingNavMesh::handleNavMeshError() void LLPathfindingNavMesh::handleNavMeshError(U32 pStatus, const std::string &pReason, const LLSD& pContent, const std::string &pURL, U32 pNavMeshVersion) { - llwarns << "LLPathfindingNavMesh error with request to URL '" << pURL << "' [status:" - << pStatus << "]: " << pContent << llendl; + LL_WARNS() << "LLPathfindingNavMesh error with request to URL '" << pURL << "' [status:" + << pStatus << "]: " << pContent << LL_ENDL; if (mNavMeshStatus.getVersion() == pNavMeshVersion) { handleNavMeshError(); diff --git a/indra/newview/llpersistentnotificationstorage.cpp b/indra/newview/llpersistentnotificationstorage.cpp index 4f7d071d663ae3a7ae6e0bea118bf674d86044d4..8658921dc47d53bd95587306b863cec9c3f54b8b 100755 --- a/indra/newview/llpersistentnotificationstorage.cpp +++ b/indra/newview/llpersistentnotificationstorage.cpp @@ -47,11 +47,11 @@ LLPersistentNotificationStorage::~LLPersistentNotificationStorage() { } -static LLFastTimer::DeclareTimer FTM_SAVE_NOTIFICATIONS("Save Notifications"); +static LLTrace::BlockTimerStatHandle FTM_SAVE_NOTIFICATIONS("Save Notifications"); void LLPersistentNotificationStorage::saveNotifications() { - LLFastTimer _(FTM_SAVE_NOTIFICATIONS); + LL_RECORD_BLOCK_TIME(FTM_SAVE_NOTIFICATIONS); boost::intrusive_ptr<LLPersistentNotificationChannel> history_channel = boost::dynamic_pointer_cast<LLPersistentNotificationChannel>(LLNotifications::instance().getChannel("Persistent")); if (!history_channel) @@ -79,9 +79,9 @@ void LLPersistentNotificationStorage::saveNotifications() data.append(notification->asLLSD(true)); if (data.size() >= gSavedSettings.getS32("MaxPersistentNotifications")) { - llwarns << "Too many persistent notifications." + LL_WARNS() << "Too many persistent notifications." << " Saved " << gSavedSettings.getS32("MaxPersistentNotifications") << " of " << history_channel->size() - << " persistent notifications." << llendl; + << " persistent notifications." << LL_ENDL; break; } @@ -90,11 +90,11 @@ void LLPersistentNotificationStorage::saveNotifications() writeNotifications(output); } -static LLFastTimer::DeclareTimer FTM_LOAD_NOTIFICATIONS("Load Notifications"); +static LLTrace::BlockTimerStatHandle FTM_LOAD_NOTIFICATIONS("Load Notifications"); void LLPersistentNotificationStorage::loadNotifications() { - LLFastTimer _(FTM_LOAD_NOTIFICATIONS); + LL_RECORD_BLOCK_TIME(FTM_LOAD_NOTIFICATIONS); LL_INFOS("LLPersistentNotificationStorage") << "start loading notifications" << LL_ENDL; @@ -146,8 +146,8 @@ void LLPersistentNotificationStorage::loadNotifications() ++processed_notifications; if (processed_notifications >= gSavedSettings.getS32("MaxPersistentNotifications")) { - llwarns << "Too many persistent notifications." - << " Processed " << gSavedSettings.getS32("MaxPersistentNotifications") << " of " << data.size() << " persistent notifications." << llendl; + LL_WARNS() << "Too many persistent notifications." + << " Processed " << gSavedSettings.getS32("MaxPersistentNotifications") << " of " << data.size() << " persistent notifications." << LL_ENDL; break; } } diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index 18b85cc9c3bc4796bbddd69b4902c72a1be5741d..05ef436bd976180ab0816cf394e1cff09e10434e 100755 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -224,7 +224,7 @@ BOOL LLPhysicsMotion::initialize() mParamDriver = (LLViewerVisualParam*)mCharacter->getVisualParam(mParamDriverName.c_str()); if (mParamDriver == NULL) { - llinfos << "Failure reading in [ " << mParamDriverName << " ]" << llendl; + LL_INFOS() << "Failure reading in [ " << mParamDriverName << " ]" << LL_ENDL; return FALSE; } diff --git a/indra/newview/llphysicsshapebuilderutil.h b/indra/newview/llphysicsshapebuilderutil.h index 7dedfb05e223b774741b658619e3960164eb036d..bd5b7d799cc7994855649f12bb469bd1536782d9 100755 --- a/indra/newview/llphysicsshapebuilderutil.h +++ b/indra/newview/llphysicsshapebuilderutil.h @@ -41,6 +41,8 @@ #define SHAPE_BUILDER_IMPLICIT_THRESHOLD_TWIST 0.09f #define SHAPE_BUILDER_IMPLICIT_THRESHOLD_SHEAR 0.05f +const F32 COLLISION_TOLERANCE = 0.1f; + const F32 SHAPE_BUILDER_ENTRY_SNAP_SCALE_BIN_SIZE = 0.15f; const F32 SHAPE_BUILDER_ENTRY_SNAP_PARAMETER_BIN_SIZE = 0.010f; const F32 SHAPE_BUILDER_CONVEXIFICATION_SIZE = 2.f * COLLISION_TOLERANCE; diff --git a/indra/newview/llplacesfolderview.cpp b/indra/newview/llplacesfolderview.cpp index 1cb013adc6aa080aadd26e503ce3f3d35f312ee0..fe89c1e3149d29c60c05686e5f08d0f2eddb1440 100755 --- a/indra/newview/llplacesfolderview.cpp +++ b/indra/newview/llplacesfolderview.cpp @@ -60,7 +60,7 @@ BOOL LLPlacesFolderView::handleRightMouseDown(S32 x, S32 y, MASK mask) } else { - llwarns << "Requested menu handle for non-setup inventory type: " << inventory_type << llendl; + LL_WARNS() << "Requested menu handle for non-setup inventory type: " << inventory_type << LL_ENDL; } } diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp index ebd9604c5b3155f0f471d904fd3022cf06cfab03..a498d27d2ba247c6f31570282fbc8bf6bc1bfcde 100755 --- a/indra/newview/llplacesinventorybridge.cpp +++ b/indra/newview/llplacesinventorybridge.cpp @@ -162,7 +162,7 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge( case LLAssetType::AT_LANDMARK: if(!(inv_type == LLInventoryType::IT_LANDMARK)) { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl; + LL_WARNS() << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << LL_ENDL; } new_listener = new LLPlacesLandmarkBridge(inv_type, inventory, root, uuid, flags); break; diff --git a/indra/newview/llpostcard.cpp b/indra/newview/llpostcard.cpp index aebe636f5994e093fcacd4d2b1316641daf02e01..649bb2fb2c1ba5af7b81e0dfb38c4611d0325282 100755 --- a/indra/newview/llpostcard.cpp +++ b/indra/newview/llpostcard.cpp @@ -48,7 +48,7 @@ static void postcard_upload_callback(const LLUUID& asset_id, void *user_data, S3 if (result) { // TODO: display the error messages in UI - llwarns << "Failed to send postcard: " << LLAssetStorage::getErrorString(result) << llendl; + LL_WARNS() << "Failed to send postcard: " << LLAssetStorage::getErrorString(result) << LL_ENDL; LLPostCard::reportPostResult(false); } else @@ -97,14 +97,14 @@ class LLPostcardSendResponder : public LLAssetUploadResponder /*virtual*/ void uploadComplete(const LLSD& content) { - llinfos << "Postcard sent" << llendl; - LL_DEBUGS("Snapshots") << "content: " << content << llendl; + LL_INFOS() << "Postcard sent" << LL_ENDL; + LL_DEBUGS("Snapshots") << "content: " << content << LL_ENDL; LLPostCard::reportPostResult(true); } /*virtual*/ void uploadFailure(const LLSD& content) { - llwarns << "Sending postcard failed: " << content << llendl; + LL_WARNS() << "Sending postcard failed: " << content << LL_ENDL; LLPostCard::reportPostResult(false); } }; @@ -128,17 +128,17 @@ void LLPostCard::send(LLPointer<LLImageFormatted> image, const LLSD& postcard_da std::string url = gAgent.getRegion()->getCapability("SendPostcard"); if (!url.empty()) { - llinfos << "Sending postcard via capability" << llendl; + LL_INFOS() << "Sending postcard via capability" << LL_ENDL; // the capability already encodes: agent ID, region ID - LL_DEBUGS("Snapshots") << "url: " << url << llendl; - LL_DEBUGS("Snapshots") << "body: " << postcard_data << llendl; - LL_DEBUGS("Snapshots") << "data size: " << image->getDataSize() << llendl; + LL_DEBUGS("Snapshots") << "url: " << url << LL_ENDL; + LL_DEBUGS("Snapshots") << "body: " << postcard_data << LL_ENDL; + LL_DEBUGS("Snapshots") << "data size: " << image->getDataSize() << LL_ENDL; LLHTTPClient::post(url, postcard_data, new LLPostcardSendResponder(postcard_data, asset_id, LLAssetType::AT_IMAGE_JPEG)); } else { - llinfos << "Sending postcard" << llendl; + LL_INFOS() << "Sending postcard" << LL_ENDL; LLSD* data = new LLSD(postcard_data); (*data)["asset-id"] = asset_id; gAssetStorage->storeAssetData(transaction_id, LLAssetType::AT_IMAGE_JPEG, diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index 04934b13f107569c6ce9f64e4cffef237998eb73..b379ef7bdbfccc04e0633e971ad44f5e1707fed0 100755 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -25,7 +25,6 @@ */ #include "llviewerprecompiledheaders.h" -#include "stdenums.h" #include "llpreview.h" @@ -135,10 +134,10 @@ void LLPreview::onCommit() if (!item->isFinished()) { // We are attempting to save an item that was never loaded - llwarns << "LLPreview::onCommit() called with mIsComplete == FALSE" + LL_WARNS() << "LLPreview::onCommit() called with mIsComplete == FALSE" << " Type: " << item->getType() << " ID: " << item->getUUID() - << llendl; + << LL_ENDL; return; } diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index f47928b1314896c7eabdd84c5d985ea727aa6393..c378738b05bcedabf9742ea0ebda871b5930742e 100755 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -253,7 +253,7 @@ void LLPreviewGesture::onUpdateSucceeded() refresh(); } -void LLPreviewGesture::onVisibilityChange ( const LLSD& new_visibility ) +void LLPreviewGesture::onVisibilityChanged ( const LLSD& new_visibility ) { if (new_visibility.asBoolean()) { @@ -333,7 +333,7 @@ LLPreviewGesture::~LLPreviewGesture() BOOL LLPreviewGesture::postBuild() { - setVisibleCallback(boost::bind(&LLPreviewGesture::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLPreviewGesture::onVisibilityChanged, this, _2)); LLLineEditor* edit; LLComboBox* combo; @@ -546,10 +546,10 @@ void LLPreviewGesture::addAnimations() // Copy into something we can sort std::vector<LLInventoryItem*> animations; - S32 count = items.count(); + S32 count = items.size(); for(i = 0; i < count; ++i) { - animations.push_back( items.get(i) ); + animations.push_back( items.at(i) ); } // Do the sort @@ -592,10 +592,10 @@ void LLPreviewGesture::addSounds() std::vector<LLInventoryItem*> sounds; S32 i; - S32 count = items.count(); + S32 count = items.size(); for(i = 0; i < count; ++i) { - sounds.push_back( items.get(i) ); + sounds.push_back( items.at(i) ); } // Do the sort @@ -873,7 +873,7 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs, } else { - llwarns << "Unable to load gesture" << llendl; + LL_WARNS() << "Unable to load gesture" << LL_ENDL; } delete gesture; @@ -883,8 +883,6 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs, } else { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { @@ -895,7 +893,7 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs, LLDelayedGestureError::gestureFailedToLoad( *item_idp ); } - llwarns << "Problem loading gesture: " << status << llendl; + LL_WARNS() << "Problem loading gesture: " << status << LL_ENDL; self->mAssetStatus = PREVIEW_ASSET_ERROR; } } @@ -1021,7 +1019,7 @@ void LLPreviewGesture::saveIfNeeded() { if (!gAssetStorage) { - llwarns << "Can't save gesture, no asset storage system." << llendl; + LL_WARNS() << "Can't save gesture, no asset storage system." << LL_ENDL; return; } @@ -1168,8 +1166,8 @@ void LLPreviewGesture::onSaveComplete(const LLUUID& asset_uuid, void* user_data, } else { - llwarns << "Inventory item for gesture " << info->mItemUUID - << " is no longer in agent inventory." << llendl; + LL_WARNS() << "Inventory item for gesture " << info->mItemUUID + << " is no longer in agent inventory." << LL_ENDL; } } else @@ -1204,7 +1202,7 @@ void LLPreviewGesture::onSaveComplete(const LLUUID& asset_uuid, void* user_data, } else { - llwarns << "Problem saving gesture: " << status << llendl; + LL_WARNS() << "Problem saving gesture: " << status << LL_ENDL; LLSD args; args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); LLNotificationsUtil::add("GestureSaveFailedReason", args); @@ -1535,7 +1533,7 @@ void LLPreviewGesture::onClickAdd(void* data) if( library_item_index >= STEP_EOF ) { - llerrs << "Unknown step type: " << library_text << llendl; + LL_ERRS() << "Unknown step type: " << library_text << LL_ENDL; return; } @@ -1565,7 +1563,7 @@ LLScrollListItem* LLPreviewGesture::addStep( const EStepType step_type ) step = new LLGestureStepWait(); break; default: - llerrs << "Unknown step type: " << (S32)step_type << llendl; + LL_ERRS() << "Unknown step type: " << (S32)step_type << LL_ENDL; return NULL; } diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h index fd4fcf9d8fcfb2b0281e7c0f5668087c1dec5c6a..7ce5706a0d9c36e4f825d4ff1e7077375908ae0f 100755 --- a/indra/newview/llpreviewgesture.h +++ b/indra/newview/llpreviewgesture.h @@ -102,7 +102,7 @@ class LLPreviewGesture : public LLPreview // "Sound", "Chat", or "Wait" LLScrollListItem* addStep(const enum EStepType step_type); - void onVisibilityChange ( const LLSD& new_visibility ); + void onVisibilityChanged ( const LLSD& new_visibility ); static std::string getLabel(std::vector<std::string> labels); static void updateLabel(LLScrollListItem* item); diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index 3a9360fd23dbab67252ce95890ef83fb87fe83da..c4858e241e1c005d762ee19af7f93f92341ec17e 100755 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -185,7 +185,7 @@ void LLPreviewNotecard::refreshFromInventory(const LLUUID& new_item_id) mItemUUID = new_item_id; setKey(LLSD(new_item_id)); } - lldebugs << "LLPreviewNotecard::refreshFromInventory()" << llendl; + LL_DEBUGS() << "LLPreviewNotecard::refreshFromInventory()" << LL_ENDL; loadAsset(); } @@ -240,7 +240,7 @@ void LLPreviewNotecard::loadAsset() else { // The object that we're trying to look at disappeared, bail. - llwarns << "Can't find object " << mObjectUUID << " associated with notecard." << llendl; + LL_WARNS() << "Can't find object " << mObjectUUID << " associated with notecard." << LL_ENDL; mAssetID.setNull(); editor->setText(getString("no_object")); editor->makePristine(); @@ -295,7 +295,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { - llinfos << "LLPreviewNotecard::onLoadComplete()" << llendl; + LL_INFOS() << "LLPreviewNotecard::onLoadComplete()" << LL_ENDL; LLUUID* item_id = (LLUUID*)user_data; LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", LLSD(*item_id)); @@ -320,7 +320,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, { if( !previewEditor->importBuffer( &buffer[0], file_length+1 ) ) { - llwarns << "Problem importing notecard" << llendl; + LL_WARNS() << "Problem importing notecard" << LL_ENDL; } } else @@ -339,8 +339,6 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, } else { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { @@ -355,7 +353,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, LLNotificationsUtil::add("UnableToLoadNotecard"); } - llwarns << "Problem loading notecard: " << status << llendl; + LL_WARNS() << "Problem loading notecard: " << status << LL_ENDL; preview->mAssetStatus = PREVIEW_ASSET_ERROR; } } @@ -365,7 +363,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs, // static void LLPreviewNotecard::onClickSave(void* user_data) { - //llinfos << "LLPreviewNotecard::onBtnSave()" << llendl; + //LL_INFOS() << "LLPreviewNotecard::onBtnSave()" << LL_ENDL; LLPreviewNotecard* preview = (LLPreviewNotecard*)user_data; if(preview) { @@ -404,7 +402,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) if(!editor) { - llwarns << "Cannot get handle to the notecard editor." << llendl; + LL_WARNS() << "Cannot get handle to the notecard editor." << LL_ENDL; return false; } @@ -437,7 +435,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) const LLViewerRegion* region = gAgent.getRegion(); if (!region) { - llwarns << "Not connected to a region, cannot save notecard." << llendl; + LL_WARNS() << "Not connected to a region, cannot save notecard." << LL_ENDL; return false; } std::string agent_url = region->getCapability("UpdateNotecardAgentInventory"); @@ -450,8 +448,8 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) setEnabled(FALSE); LLSD body; body["item_id"] = mItemUUID; - llinfos << "Saving notecard " << mItemUUID - << " into agent inventory via " << agent_url << llendl; + LL_INFOS() << "Saving notecard " << mItemUUID + << " into agent inventory via " << agent_url << LL_ENDL; LLHTTPClient::post(agent_url, body, new LLUpdateAgentInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD)); } @@ -463,8 +461,8 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) LLSD body; body["task_id"] = mObjectUUID; body["item_id"] = mItemUUID; - llinfos << "Saving notecard " << mItemUUID << " into task " - << mObjectUUID << " via " << task_url << llendl; + LL_INFOS() << "Saving notecard " << mItemUUID << " into task " + << mObjectUUID << " via " << task_url << LL_ENDL; LLHTTPClient::post(task_url, body, new LLUpdateTaskInventoryResponder(body, asset_id, LLAssetType::AT_NOTECARD)); } @@ -479,7 +477,7 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) } else // !gAssetStorage { - llwarns << "Not connected to an asset storage system." << llendl; + LL_WARNS() << "Not connected to an asset storage system." << LL_ENDL; return false; } } @@ -520,8 +518,8 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data } else { - llwarns << "Inventory item for script " << info->mItemUUID - << " is no longer in agent inventory." << llendl; + LL_WARNS() << "Inventory item for script " << info->mItemUUID + << " is no longer in agent inventory." << LL_ENDL; } } else @@ -564,7 +562,7 @@ void LLPreviewNotecard::onSaveComplete(const LLUUID& asset_uuid, void* user_data } else { - llwarns << "Problem saving notecard: " << status << llendl; + LL_WARNS() << "Problem saving notecard: " << status << LL_ENDL; LLSD args; args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); LLNotificationsUtil::add("SaveNotecardFailReason", args); diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 26c46d543ca683ce38fdb009c95919d4d8aa285c..e694045f9a60dadbf4a4e0d805b353bf383d575e 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -564,14 +564,14 @@ bool LLScriptEdCore::loadScriptText(const std::string& filename) { if (filename.empty()) { - llwarns << "Empty file name" << llendl; + LL_WARNS() << "Empty file name" << LL_ENDL; return false; } LLFILE* file = LLFile::fopen(filename, "rb"); /*Flawfinder: ignore*/ if (!file) { - llwarns << "Error opening " << filename << llendl; + LL_WARNS() << "Error opening " << filename << LL_ENDL; return false; } @@ -583,7 +583,7 @@ bool LLScriptEdCore::loadScriptText(const std::string& filename) size_t nread = fread(buffer, 1, file_length, file); if (nread < file_length) { - llwarns << "Short read" << llendl; + LL_WARNS() << "Short read" << LL_ENDL; } buffer[nread] = '\0'; fclose(file); @@ -599,7 +599,7 @@ bool LLScriptEdCore::writeToFile(const std::string& filename) LLFILE* fp = LLFile::fopen(filename, "wb"); if (!fp) { - llwarns << "Unable to write to " << filename << llendl; + LL_WARNS() << "Unable to write to " << filename << LL_ENDL; LLSD row; row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?"; @@ -979,7 +979,7 @@ void LLScriptEdCore::onBtnInsertFunction(LLUICtrl *ui, void* userdata) void LLScriptEdCore::doSave( BOOL close_after_save ) { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_LSL_SAVE_COUNT ); + add(LLStatViewer::LSL_SAVES, 1); if( mSaveCallback ) { @@ -1054,8 +1054,8 @@ void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data) LLStringUtil::replaceChar(line, ',',' '); LLStringUtil::replaceChar(line, ')',' '); sscanf(line.c_str(), "%d %d", &row, &column); - //llinfos << "LLScriptEdCore::onErrorList() - " << row << ", " - //<< column << llendl; + //LL_INFOS() << "LLScriptEdCore::onErrorList() - " << row << ", " + //<< column << LL_ENDL; self->mEditor->setCursor(row, column); self->mEditor->setFocus(TRUE); } @@ -1102,15 +1102,15 @@ struct LLEntryAndEdCore void LLScriptEdCore::deleteBridges() { - S32 count = mBridges.count(); + S32 count = mBridges.size(); LLEntryAndEdCore* eandc; for(S32 i = 0; i < count; i++) { - eandc = mBridges.get(i); + eandc = mBridges.at(i); delete eandc; mBridges[i] = NULL; } - mBridges.reset(); + mBridges.clear(); } // virtual @@ -1183,8 +1183,7 @@ void LLScriptEdCore::onBtnLoadFromFile( void* data ) void LLScriptEdCore::onBtnSaveToFile( void* userdata ) { - - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_LSL_SAVE_COUNT ); + add(LLStatViewer::LSL_SAVES, 1); LLScriptEdCore* self = (LLScriptEdCore*) userdata; @@ -1323,7 +1322,7 @@ BOOL LLPreviewLSL::postBuild() // virtual void LLPreviewLSL::callbackLSLCompileSucceeded() { - llinfos << "LSL Bytecode saved" << llendl; + LL_INFOS() << "LSL Bytecode saved" << LL_ENDL; mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful")); mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete")); closeIfNeeded(); @@ -1332,7 +1331,7 @@ void LLPreviewLSL::callbackLSLCompileSucceeded() // virtual void LLPreviewLSL::callbackLSLCompileFailed(const LLSD& compile_errors) { - llinfos << "Compile failed!" << llendl; + LL_INFOS() << "Compile failed!" << LL_ENDL; for(LLSD::array_const_iterator line = compile_errors.beginArray(); line < compile_errors.endArray(); @@ -1447,7 +1446,7 @@ void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save) // fails, go ahead and save the text anyway. void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) { - // llinfos << "LLPreviewLSL::saveIfNeeded()" << llendl; + // LL_INFOS() << "LLPreviewLSL::saveIfNeeded()" << LL_ENDL; if(!mScriptEd->hasChanged()) { return; @@ -1493,7 +1492,7 @@ void LLPreviewLSL::uploadAssetViaCaps(const std::string& url, const std::string& filename, const LLUUID& item_id) { - llinfos << "Update Agent Inventory via capability" << llendl; + LL_INFOS() << "Update Agent Inventory via capability" << LL_ENDL; LLSD body; body["item_id"] = item_id; body["target"] = "lsl2"; @@ -1526,7 +1525,7 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, asset_id.asString().c_str(), gAgent.isGodlike())) { - llinfos << "Compile failed!" << llendl; + LL_INFOS() << "Compile failed!" << LL_ENDL; //char command[256]; //sprintf(command, "type %s\n", err_filename.c_str()); //system(command); @@ -1564,7 +1563,7 @@ void LLPreviewLSL::uploadAssetLegacy(const std::string& filename, } else { - llinfos << "Compile worked!" << llendl; + LL_INFOS() << "Compile worked!" << LL_ENDL; if(gAssetStorage) { getWindow()->incBusyCount(); @@ -1606,8 +1605,8 @@ void LLPreviewLSL::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 } else { - llwarns << "Inventory item for script " << info->mItemUUID - << " is no longer in agent inventory." << llendl; + LL_WARNS() << "Inventory item for script " << info->mItemUUID + << " is no longer in agent inventory." << LL_ENDL; } // Find our window and close it if requested. @@ -1626,7 +1625,7 @@ void LLPreviewLSL::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32 } else { - llwarns << "Problem saving script: " << status << llendl; + LL_WARNS() << "Problem saving script: " << status << LL_ENDL; LLSD args; args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); LLNotificationsUtil::add("SaveScriptFailReason", args); @@ -1664,7 +1663,7 @@ void LLPreviewLSL::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_d } else { - llwarns << "Problem saving LSL Bytecode (Preview)" << llendl; + LL_WARNS() << "Problem saving LSL Bytecode (Preview)" << LL_ENDL; LLSD args; args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); LLNotificationsUtil::add("SaveBytecodeFailReason", args); @@ -1676,8 +1675,8 @@ void LLPreviewLSL::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_d void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { - lldebugs << "LLPreviewLSL::onLoadComplete: got uuid " << asset_uuid - << llendl; + LL_DEBUGS() << "LLPreviewLSL::onLoadComplete: got uuid " << asset_uuid + << LL_ENDL; LLUUID* item_uuid = (LLUUID*)user_data; LLPreviewLSL* preview = LLFloaterReg::findTypedInstance<LLPreviewLSL>("preview_script", *item_uuid); if( preview ) @@ -1707,8 +1706,6 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset } else { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { @@ -1724,7 +1721,7 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset } preview->mAssetStatus = PREVIEW_ASSET_ERROR; - llwarns << "Problem loading script: " << status << llendl; + LL_WARNS() << "Problem loading script: " << status << LL_ENDL; } } delete item_uuid; @@ -1791,7 +1788,7 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id, const LLUUID& item_id, bool is_script_running) { - lldebugs << "LSL Bytecode saved" << llendl; + LL_DEBUGS() << "LSL Bytecode saved" << LL_ENDL; mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessful")); mScriptEd->mErrorList->setCommentText(LLTrans::getString("SaveComplete")); closeIfNeeded(); @@ -1800,7 +1797,7 @@ void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id, // virtual void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors) { - lldebugs << "Compile failed!" << llendl; + LL_DEBUGS() << "Compile failed!" << LL_ENDL; for(LLSD::array_const_iterator line = compile_errors.beginArray(); line < compile_errors.endArray(); line++) @@ -1819,7 +1816,7 @@ void LLLiveLSLEditor::callbackLSLCompileFailed(const LLSD& compile_errors) void LLLiveLSLEditor::loadAsset() { - //llinfos << "LLLiveLSLEditor::loadAsset()" << llendl; + //LL_INFOS() << "LLLiveLSLEditor::loadAsset()" << LL_ENDL; if(!mIsNew) { LLViewerObject* object = gObjectList.findObject(mObjectUUID); @@ -1831,7 +1828,7 @@ void LLLiveLSLEditor::loadAsset() || gAgent.isGodlike())) { mItem = new LLViewerInventoryItem(item); - //llinfos << "asset id " << mItem->getAssetUUID() << llendl; + //LL_INFOS() << "asset id " << mItem->getAssetUUID() << LL_ENDL; } if(!gAgent.isGodlike() @@ -1923,8 +1920,8 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status) { - lldebugs << "LLLiveLSLEditor::onLoadComplete: got uuid " << asset_id - << llendl; + LL_DEBUGS() << "LLLiveLSLEditor::onLoadComplete: got uuid " << asset_id + << LL_ENDL; LLUUID* xored_id = (LLUUID*)user_data; LLLiveLSLEditor* instance = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", *xored_id); @@ -1939,8 +1936,6 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id, } else { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { @@ -1971,7 +1966,7 @@ void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType if (file.getLastBytesRead() != file_length || file_length <= 0) { - llwarns << "Error reading " << uuid << ":" << type << llendl; + LL_WARNS() << "Error reading " << uuid << ":" << type << LL_ENDL; } buffer[file_length] = '\0'; @@ -2194,7 +2189,7 @@ void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url, const LLUUID& item_id, BOOL is_running) { - llinfos << "Update Task Inventory via capability " << url << llendl; + LL_INFOS() << "Update Task Inventory via capability " << url << LL_ENDL; LLSD body; body["task_id"] = task_id; body["item_id"] = item_id; @@ -2233,7 +2228,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, gAgent.isGodlike())) { // load the error file into the error scrolllist - llinfos << "Compile failed!" << llendl; + LL_INFOS() << "Compile failed!" << LL_ENDL; if(NULL != (fp = LLFile::fopen(err_filename, "r"))) { char buffer[MAX_STRING]; /*Flawfinder: ignore*/ @@ -2271,12 +2266,12 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename, } else { - llinfos << "Compile worked!" << llendl; + LL_INFOS() << "Compile worked!" << LL_ENDL; mScriptEd->mErrorList->setCommentText(LLTrans::getString("CompileSuccessfulSaving")); if(gAssetStorage) { - llinfos << "LLLiveLSLEditor::saveAsset " - << mItem->getAssetUUID() << llendl; + LL_INFOS() << "LLLiveLSLEditor::saveAsset " + << mItem->getAssetUUID() << LL_ENDL; getWindow()->incBusyCount(); mPendingUploads++; LLLiveLSLSaveData* data = NULL; @@ -2309,7 +2304,7 @@ void LLLiveLSLEditor::onSaveTextComplete(const LLUUID& asset_uuid, void* user_da if (status) { - llwarns << "Unable to save text for a script." << llendl; + LL_WARNS() << "Unable to save text for a script." << LL_ENDL; LLSD args; args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); LLNotificationsUtil::add("CompileQueueSaveText", args); @@ -2340,7 +2335,7 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use return; if(0 ==status) { - llinfos << "LSL Bytecode saved" << llendl; + LL_INFOS() << "LSL Bytecode saved" << LL_ENDL; LLLiveLSLEditor* self = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", data->mItem->getUUID()); // ^ data->mSaveObjectID if (self) { @@ -2366,8 +2361,8 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use } else { - llinfos << "Problem saving LSL Bytecode (Live Editor)" << llendl; - llwarns << "Unable to save a compiled script." << llendl; + LL_INFOS() << "Problem saving LSL Bytecode (Live Editor)" << LL_ENDL; + LL_WARNS() << "Unable to save a compiled script." << LL_ENDL; LLSD args; args["REASON"] = std::string(LLAssetStorage::getErrorString(status)); diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 9fb0a4fb63b9a838d88385a0f000c0a310bae84a..cb53d1df07e9e6790b0d3a9002b005faaea91c67 100755 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -27,7 +27,6 @@ #ifndef LL_LLPREVIEWSCRIPT_H #define LL_LLPREVIEWSCRIPT_H -#include "lldarray.h" #include "llpreview.h" #include "lltabcontainer.h" #include "llinventory.h" @@ -141,7 +140,7 @@ class LLScriptEdCore : public LLPanel BOOL mForceClose; LLPanel* mCodePanel; LLScrollListCtrl* mErrorList; - LLDynamicArray<LLEntryAndEdCore*> mBridges; + std::vector<LLEntryAndEdCore*> mBridges; LLHandle<LLFloater> mLiveHelpHandle; LLKeywordToken* mLastHelpToken; LLFrameTimer mLiveHelpTimer; diff --git a/indra/newview/llproductinforequest.cpp b/indra/newview/llproductinforequest.cpp index 1390000fc506eb1bbba570224824e0283f52fe64..e85194d173f45112db92015cbd76ccab1b293647 100755 --- a/indra/newview/llproductinforequest.cpp +++ b/indra/newview/llproductinforequest.cpp @@ -45,8 +45,8 @@ class LLProductInfoRequestResponder : public LLHTTPClient::Responder //If we get back an error (not found, etc...), handle it here virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "LLProductInfoRequest error [status:" - << status << ":] " << content << llendl; + LL_WARNS() << "LLProductInfoRequest error [status:" + << status << ":] " << content << LL_ENDL; } }; @@ -76,7 +76,7 @@ std::string LLProductInfoRequestManager::getDescriptionForSku(const std::string& it != mSkuDescriptions.endArray(); ++it) { - // llwarns << (*it)["sku"].asString() << " = " << (*it)["description"].asString() << llendl; + // LL_WARNS() << (*it)["sku"].asString() << " = " << (*it)["description"].asString() << LL_ENDL; if ((*it)["sku"].asString() == sku) { return (*it)["description"].asString(); diff --git a/indra/newview/llregioninfomodel.cpp b/indra/newview/llregioninfomodel.cpp index 590e24648238644d0a5db6c7c3cdee467daa218a..25c576468b6395301bc69f40ebe50221233a337a 100755 --- a/indra/newview/llregioninfomodel.cpp +++ b/indra/newview/llregioninfomodel.cpp @@ -192,11 +192,11 @@ void LLRegionInfoModel::sendEstateOwnerMessage( if (!cur_region) { - llwarns << "Agent region not set" << llendl; + LL_WARNS() << "Agent region not set" << LL_ENDL; return; } - llinfos << "Sending estate request '" << request << "'" << llendl; + LL_INFOS() << "Sending estate request '" << request << "'" << LL_ENDL; msg->newMessage("EstateOwnerMessage"); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -217,7 +217,7 @@ void LLRegionInfoModel::sendEstateOwnerMessage( std::vector<std::string>::const_iterator end = strings.end(); for (unsigned i = 0; it != end; ++it, ++i) { - lldebugs << "- [" << i << "] " << (*it) << llendl; + LL_DEBUGS() << "- [" << i << "] " << (*it) << LL_ENDL; msg->nextBlock("ParamList"); msg->addString("Parameter", *it); } diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp index 500dec7ee5841878bfbddb2857f9a590c6b847b9..13120fdf45c888eaa551fe4d9cc1f97ecbb5710d 100755 --- a/indra/newview/llremoteparcelrequest.cpp +++ b/indra/newview/llremoteparcelrequest.cpp @@ -64,8 +64,8 @@ void LLRemoteParcelRequestResponder::result(const LLSD& content) //virtual void LLRemoteParcelRequestResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "LLRemoteParcelRequest error [status:" - << status << "]: " << content << llendl; + LL_WARNS() << "LLRemoteParcelRequest error [status:" + << status << "]: " << content << LL_ENDL; // Panel inspecting the information may be closed and destroyed // before this response is received. diff --git a/indra/newview/llremoteparcelrequest.h b/indra/newview/llremoteparcelrequest.h index b87056573b1bfea0ea4753f9a220b57b83b11763..e4b8791f7c7d8b331e33fdd3e0177c701ed4e355 100755 --- a/indra/newview/llremoteparcelrequest.h +++ b/indra/newview/llremoteparcelrequest.h @@ -30,7 +30,8 @@ #define LL_LLREMOTEPARCELREQUEST_H #include "llhttpclient.h" -#include "llpanel.h" +#include "llhandle.h" +#include "llsingleton.h" class LLMessageSystem; class LLRemoteParcelInfoObserver; diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7f705e44d2e6f4f64a116aabfad2f4b9ac23aa3f --- /dev/null +++ b/indra/newview/llscenemonitor.cpp @@ -0,0 +1,763 @@ +/** + * @file llscenemonitor.cpp + * @brief monitor the scene loading process. + * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llrendertarget.h" +#include "llscenemonitor.h" +#include "llviewerwindow.h" +#include "llviewerdisplay.h" +#include "llviewercontrol.h" +#include "llviewershadermgr.h" +#include "llui.h" +#include "llstartup.h" +#include "llappviewer.h" +#include "llwindow.h" +#include "llpointer.h" +#include "llspatialpartition.h" +#include "llagent.h" +#include "pipeline.h" +#include "llviewerpartsim.h" + +LLSceneMonitorView* gSceneMonitorView = NULL; + +// +//The procedures of monitoring when the scene finishes loading visually, +//i.e., no pixel differences among frames, are: +//1, freeze all dynamic objects and avatars; +//2, (?) disable all sky and water; +//3, capture frames periodically, by calling "capture()"; +//4, compute pixel differences between two latest captured frames, by calling "compare()", results are stored at mDiff; +//5, compute the number of pixels in mDiff above some tolerance threshold in GPU, by calling "calcDiffAggregate()"; +//6, use gl occlusion query to fetch the result from GPU, by calling "fetchQueryResult()"; +//END. +// + +LLSceneMonitor::LLSceneMonitor() : + mEnabled(false), + mDiff(NULL), + mDiffResult(0.f), + mDiffTolerance(0.1f), + mDiffState(WAITING_FOR_NEXT_DIFF), + mDebugViewerVisible(false), + mQueryObject(0), + mDiffPixelRatio(0.5f) +{ + mFrames[0] = NULL; + mFrames[1] = NULL; +} + +LLSceneMonitor::~LLSceneMonitor() +{ + mDiffState = VIEWER_QUITTING; + reset(); + + mDitheringTexture = NULL; +} + +void LLSceneMonitor::reset() +{ + delete mFrames[0]; + delete mFrames[1]; + delete mDiff; + + mFrames[0] = NULL; + mFrames[1] = NULL; + mDiff = NULL; + + mMonitorRecording.reset(); + mSceneLoadRecording.reset(); + mRecordingTimer.reset(); + + unfreezeScene(); + + if(mQueryObject > 0) + { + LLOcclusionCullingGroup::releaseOcclusionQueryObjectName(mQueryObject); + mQueryObject = 0; + } +} + +void LLSceneMonitor::generateDitheringTexture(S32 width, S32 height) +{ +#if 1 + //4 * 4 matrix + mDitherMatrixWidth = 4; + S32 dither_matrix[4][4] = + { + {1, 9, 3, 11}, + {13, 5, 15, 7}, + {4, 12, 2, 10}, + {16, 8, 14, 6} + }; + + mDitherScale = 255.f / 17; +#else + //8 * 8 matrix + mDitherMatrixWidth = 16; + S32 dither_matrix[16][16] = + { + {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64}, + {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32}, + {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56}, + {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24}, + {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62}, + {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30}, + {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54}, + {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22}, + {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64}, + {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32}, + {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56}, + {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24}, + {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62}, + {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30}, + {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54}, + {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22} + }; + + mDitherScale = 255.f / 65; +#endif + + LLPointer<LLImageRaw> image_raw = new LLImageRaw(mDitherMatrixWidth, mDitherMatrixWidth, 3); + U8* data = image_raw->getData(); + for (S32 i = 0; i < mDitherMatrixWidth; i++) + { + for (S32 j = 0; j < mDitherMatrixWidth; j++) + { + U8 val = dither_matrix[i][j]; + *data++ = val; + *data++ = val; + *data++ = val; + } + } + + mDitheringTexture = LLViewerTextureManager::getLocalTexture(image_raw.get(), FALSE) ; + mDitheringTexture->setAddressMode(LLTexUnit::TAM_WRAP); + mDitheringTexture->setFilteringOption(LLTexUnit::TFO_POINT); + + mDitherScaleS = (F32)width / mDitherMatrixWidth; + mDitherScaleT = (F32)height / mDitherMatrixWidth; +} + +void LLSceneMonitor::setDebugViewerVisible(bool visible) +{ + mDebugViewerVisible = visible; +} + +LLRenderTarget& LLSceneMonitor::getCaptureTarget() +{ + LLRenderTarget* cur_target = NULL; + + S32 width = gViewerWindow->getWorldViewWidthRaw(); + S32 height = gViewerWindow->getWorldViewHeightRaw(); + + if(!mFrames[0]) + { + mFrames[0] = new LLRenderTarget(); + mFrames[0]->allocate(width, height, GL_RGB, false, false, LLTexUnit::TT_TEXTURE, true); + gGL.getTexUnit(0)->bind(mFrames[0]); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + cur_target = mFrames[0]; + } + else if(!mFrames[1]) + { + mFrames[1] = new LLRenderTarget(); + mFrames[1]->allocate(width, height, GL_RGB, false, false, LLTexUnit::TT_TEXTURE, true); + gGL.getTexUnit(0)->bind(mFrames[1]); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + cur_target = mFrames[1]; + } + else //swap + { + cur_target = mFrames[0]; + mFrames[0] = mFrames[1]; + mFrames[1] = cur_target; + } + + if(cur_target->getWidth() != width || cur_target->getHeight() != height) //size changed + { + cur_target->resize(width, height); + } + + // we're promising the target exists + return *cur_target; +} + +void LLSceneMonitor::freezeAvatar(LLCharacter* avatarp) +{ + if(mEnabled) + { + mAvatarPauseHandles.push_back(avatarp->requestPause()); + } +} + +void LLSceneMonitor::freezeScene() +{ + if(!mEnabled) + { + return; + } + + //freeze all avatars + for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + freezeAvatar((LLCharacter*)(*iter)); + } + + // freeze everything else + gSavedSettings.setBOOL("FreezeTime", TRUE); + + //disable sky, water and clouds + gPipeline.clearRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); + + //disable particle system + LLViewerPartSim::getInstance()->enable(false); +} + +void LLSceneMonitor::unfreezeScene() +{ + //thaw all avatars + mAvatarPauseHandles.clear(); + + if(mDiffState == VIEWER_QUITTING) + { + return; + } + + // thaw everything else + gSavedSettings.setBOOL("FreezeTime", FALSE); + + //enable sky, water and clouds + gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); + + //enable particle system + LLViewerPartSim::getInstance()->enable(true); +} + +void LLSceneMonitor::capture() +{ + static U32 last_capture_frame = 0; + static LLCachedControl<bool> monitor_enabled(gSavedSettings, "SceneLoadingMonitorEnabled"); + static LLCachedControl<F32> scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime"); + static bool force_capture = true; + + bool enabled = LLGLSLShader::sNoFixedFunction && (monitor_enabled || mDebugViewerVisible); + if(mEnabled != enabled) + { + if(mEnabled) + { + mEnabled = enabled; + unfreezeScene(); + reset(); + force_capture = true; + } + else + { + mEnabled = enabled; + reset(); + freezeScene(); + } + } + + if (mEnabled + && (mMonitorRecording.getSum(*LLViewerCamera::getVelocityStat()) > 0.1f + || mMonitorRecording.getSum(*LLViewerCamera::getAngularVelocityStat()) > 0.05f)) + { + reset(); + freezeScene(); + force_capture = true; + } + + if(mEnabled + && (mRecordingTimer.getElapsedTimeF32() > scene_load_sample_time() + || force_capture) + && last_capture_frame != gFrameCount) + { + force_capture = false; + + mSceneLoadRecording.resume(); + mMonitorRecording.resume(); + + last_capture_frame = gFrameCount; + + LLRenderTarget& cur_target = getCaptureTarget(); + + U32 old_FBO = LLRenderTarget::sCurFBO; + + gGL.getTexUnit(0)->bind(&cur_target); + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); //point to the main frame buffer. + + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, cur_target.getWidth(), cur_target.getHeight()); //copy the content + + glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, old_FBO); + + mDiffState = NEED_DIFF; + } +} + +bool LLSceneMonitor::needsUpdate() const +{ + return mDiffState == NEED_DIFF; +} + +static LLTrace::BlockTimerStatHandle FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE("Generate Scene Load Dither Texture"); +static LLTrace::BlockTimerStatHandle FTM_SCENE_LOAD_IMAGE_DIFF("Scene Load Image Diff"); + +static LLStaticHashedString sDitherScale("dither_scale"); +static LLStaticHashedString sDitherScaleS("dither_scale_s"); +static LLStaticHashedString sDitherScaleT("dither_scale_t"); + +void LLSceneMonitor::compare() +{ +#ifdef LL_WINDOWS + if(mDiffState != NEED_DIFF) + { + return; + } + + if(!mFrames[0] || !mFrames[1]) + { + return; + } + if(mFrames[0]->getWidth() != mFrames[1]->getWidth() || mFrames[0]->getHeight() != mFrames[1]->getHeight()) + { //size does not match + return; + } + + LL_RECORD_BLOCK_TIME(FTM_SCENE_LOAD_IMAGE_DIFF); + mDiffState = EXECUTE_DIFF; + + S32 width = gViewerWindow->getWindowWidthRaw(); + S32 height = gViewerWindow->getWindowHeightRaw(); + if(!mDiff) + { + LL_RECORD_BLOCK_TIME(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); + mDiff = new LLRenderTarget(); + mDiff->allocate(width, height, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true); + + generateDitheringTexture(width, height); + } + else if(mDiff->getWidth() != width || mDiff->getHeight() != height) + { + LL_RECORD_BLOCK_TIME(FTM_GENERATE_SCENE_LOAD_DITHER_TEXTURE); + mDiff->resize(width, height); + generateDitheringTexture(width, height); + } + + mDiff->bindTarget(); + mDiff->clear(); + + gTwoTextureCompareProgram.bind(); + + gTwoTextureCompareProgram.uniform1f(sDitherScale, mDitherScale); + gTwoTextureCompareProgram.uniform1f(sDitherScaleS, mDitherScaleS); + gTwoTextureCompareProgram.uniform1f(sDitherScaleT, mDitherScaleT); + + gGL.getTexUnit(0)->activate(); + gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->bind(mFrames[0]); + gGL.getTexUnit(0)->activate(); + + gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->bind(mFrames[1]); + gGL.getTexUnit(1)->activate(); + + gGL.getTexUnit(2)->activate(); + gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->bind(mDitheringTexture); + gGL.getTexUnit(2)->activate(); + + gl_rect_2d_simple_tex(width, height); + + mDiff->flush(); + + gTwoTextureCompareProgram.unbind(); + + gGL.getTexUnit(0)->disable(); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(1)->disable(); + gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->disable(); + gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); + + if (!mDebugViewerVisible) + { + calcDiffAggregate(); + } +#endif +} + +static LLStaticHashedString sTolerance("tolerance"); + +//calculate Diff aggregate information in GPU, and enable gl occlusion query to capture it. +void LLSceneMonitor::calcDiffAggregate() +{ +#ifdef LL_WINDOWS + + LL_RECORD_BLOCK_TIME(FTM_SCENE_LOAD_IMAGE_DIFF); + + if(mDiffState != EXECUTE_DIFF && !mDebugViewerVisible) + { + return; + } + + if(!mQueryObject) + { + mQueryObject = LLOcclusionCullingGroup::getNewOcclusionQueryObjectName(); + } + + LLGLDepthTest depth(true, false, GL_ALWAYS); + if(!mDebugViewerVisible) + { + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + } + + LLGLSLShader* cur_shader = NULL; + + cur_shader = LLGLSLShader::sCurBoundShaderPtr; + gOneTextureFilterProgram.bind(); + gOneTextureFilterProgram.uniform1f(sTolerance, mDiffTolerance); + + if(mDiffState == EXECUTE_DIFF) + { + glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mQueryObject); + } + + gl_draw_scaled_target(0, 0, S32(mDiff->getWidth() * mDiffPixelRatio), S32(mDiff->getHeight() * mDiffPixelRatio), mDiff); + + if(mDiffState == EXECUTE_DIFF) + { + glEndQueryARB(GL_SAMPLES_PASSED_ARB); + mDiffState = WAIT_ON_RESULT; + } + + gOneTextureFilterProgram.unbind(); + + if(cur_shader != NULL) + { + cur_shader->bind(); + } + + if(!mDebugViewerVisible) + { + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + } +#endif +} + +static LLTrace::EventStatHandle<> sFramePixelDiff("FramePixelDifference"); +void LLSceneMonitor::fetchQueryResult() +{ + LL_RECORD_BLOCK_TIME(FTM_SCENE_LOAD_IMAGE_DIFF); + + // also throttle timing here, to avoid going below sample time due to phasing with frame capture + static LLCachedControl<F32> scene_load_sample_time_control(gSavedSettings, "SceneLoadingMonitorSampleTime"); + F32Seconds scene_load_sample_time = (F32Seconds)scene_load_sample_time_control(); + + if(mDiffState == WAIT_ON_RESULT + && !LLAppViewer::instance()->quitRequested()) + { + mDiffState = WAITING_FOR_NEXT_DIFF; + + GLuint available = 0; + glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available); + if(available) + { + GLuint count = 0; + glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count); + + mDiffResult = sqrtf(count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio)); //0.5 -> (front face + back face) + + LL_DEBUGS("SceneMonitor") << "Frame difference: " << mDiffResult << LL_ENDL; + record(sFramePixelDiff, mDiffResult); + + static LLCachedControl<F32> diff_threshold(gSavedSettings,"SceneLoadingMonitorPixelDiffThreshold"); + F32Seconds elapsed_time = mRecordingTimer.getElapsedTimeF32(); + + if (elapsed_time > scene_load_sample_time) + { + if(mDiffResult > diff_threshold()) + { + mSceneLoadRecording.extend(); + llassert_always(mSceneLoadRecording.getResults().getLastRecording().getDuration() > scene_load_sample_time); + } + else + { + mSceneLoadRecording.nextPeriod(); + } + mRecordingTimer.reset(); + } + } + } +} + +//dump results to a file _scene_xmonitor_results.csv +void LLSceneMonitor::dumpToFile(std::string file_name) +{ using namespace LLTrace; + + if (!hasResults()) return; + + LL_INFOS("SceneMonitor") << "Saving scene load stats to " << file_name << LL_ENDL; + + std::ofstream os(file_name.c_str()); + + os << std::setprecision(10); + + PeriodicRecording& scene_load_recording = mSceneLoadRecording.getResults(); + const U32 frame_count = scene_load_recording.getNumRecordedPeriods(); + + F64Seconds frame_time; + + os << "Stat"; + for (S32 frame = 1; frame <= frame_count; frame++) + { + frame_time += scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); + os << ", " << frame_time.value(); + } + os << '\n'; + + os << "Sample period(s)"; + for (S32 frame = 1; frame <= frame_count; frame++) + { + frame_time = scene_load_recording.getPrevRecording(frame_count - frame).getDuration(); + os << ", " << frame_time.value(); + } + os << '\n'; + + + typedef StatType<CountAccumulator> trace_count; + for (trace_count::instance_iter it = trace_count::beginInstances(), end_it = trace_count::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << std::setprecision(10); + + row << it->getName(); + + const char* unit_label = it->getUnitLabel(); + if(unit_label[0]) + { + row << "(" << unit_label << ")"; + } + + S32 samples = 0; + + for (S32 frame = 1; frame <= frame_count; frame++) + { + Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); + samples += recording.getSampleCount(*it); + row << ", " << recording.getSum(*it); + } + + row << '\n'; + + if (samples > 0) + { + os << row.str(); + } + } + + typedef StatType<EventAccumulator> trace_event; + + for (trace_event::instance_iter it = trace_event::beginInstances(), end_it = trace_event::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << std::setprecision(10); + row << it->getName(); + + const char* unit_label = it->getUnitLabel(); + if(unit_label[0]) + { + row << "(" << unit_label << ")"; + } + + S32 samples = 0; + + for (S32 frame = 1; frame <= frame_count; frame++) + { + Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); + samples += recording.getSampleCount(*it); + F64 mean = recording.getMean(*it); + if (llisnan(mean)) + { + row << ", n/a"; + } + else + { + row << ", " << mean; + } + } + + row << '\n'; + + if (samples > 0) + { + os << row.str(); + } + } + + typedef StatType<SampleAccumulator> trace_sample; + + for (trace_sample::instance_iter it = trace_sample::beginInstances(), end_it = trace_sample::endInstances(); + it != end_it; + ++it) + { + std::ostringstream row; + row << std::setprecision(10); + row << it->getName(); + + const char* unit_label = it->getUnitLabel(); + if(unit_label[0]) + { + row << "(" << unit_label << ")"; + } + + S32 samples = 0; + + for (S32 frame = 1; frame <= frame_count; frame++) + { + Recording& recording = scene_load_recording.getPrevRecording(frame_count - frame); + samples += recording.getSampleCount(*it); + F64 mean = recording.getMean(*it); + if (llisnan(mean)) + { + row << ", n/a"; + } + else + { + row << ", " << mean; + } + } + + row << '\n'; + + if (samples > 0) + { + os << row.str(); + } + } + + typedef StatType<MemAccumulator> trace_mem; + for (trace_mem::instance_iter it = trace_mem::beginInstances(), end_it = trace_mem::endInstances(); + it != end_it; + ++it) + { + os << it->getName() << "(KiB)"; + + for (S32 frame = 1; frame <= frame_count; frame++) + { + os << ", " << scene_load_recording.getPrevRecording(frame_count - frame).getMax(*it).valueInUnits<LLUnits::Kilobytes>(); + } + + os << '\n'; + } + + os.flush(); + os.close(); +} + +//------------------------------------------------------------------------------------------------------------- +//definition of class LLSceneMonitorView +//------------------------------------------------------------------------------------------------------------- +LLSceneMonitorView::LLSceneMonitorView(const LLRect& rect) + : LLFloater(LLSD()) +{ + setRect(rect); + setVisible(FALSE); + + setCanMinimize(false); + setCanClose(true); +} + +void LLSceneMonitorView::onClose(bool app_quitting) +{ + setVisible(false); +} + +void LLSceneMonitorView::onVisibilityChange(BOOL visible) +{ + visible = visible && LLGLSLShader::sNoFixedFunction; + LLSceneMonitor::getInstance()->setDebugViewerVisible(visible); +} + +void LLSceneMonitorView::draw() +{ + const LLRenderTarget* target = LLSceneMonitor::getInstance()->getDiffTarget(); + if(!target) + { + return; + } + + F32 ratio = LLSceneMonitor::getInstance()->getDiffPixelRatio(); + S32 height = (S32)(target->getHeight() * ratio); + S32 width = (S32)(target->getWidth() * ratio); + + LLRect new_rect; + new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); + setRect(new_rect); + + //draw background + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + + LLSceneMonitor::getInstance()->calcDiffAggregate(); + + //show some texts + LLColor4 color = LLColor4::white; + S32 line_height = LLFontGL::getFontMonospace()->getLineHeight(); + + S32 lines = 0; + std::string num_str = llformat("Frame difference: %.6f", LLSceneMonitor::getInstance()->getDiffResult()); + LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; + + num_str = llformat("Pixel tolerance: (R+G+B) < %.4f", LLSceneMonitor::getInstance()->getDiffTolerance()); + LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; + + num_str = llformat("Sampling time: %.3f seconds", gSavedSettings.getF32("SceneLoadingMonitorSampleTime")); + LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; + + num_str = llformat("Scene Loading time: %.3f seconds", (F32)LLSceneMonitor::getInstance()->getRecording()->getResults().getDuration().value()); + LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; + + LLView::draw(); +} + diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h new file mode 100644 index 0000000000000000000000000000000000000000..e9ceb2aa2ab0fc33894b70bca30c303746c93fe5 --- /dev/null +++ b/indra/newview/llscenemonitor.h @@ -0,0 +1,124 @@ +/** + * @file llscenemonitor.h + * @brief monitor the process of scene loading + * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLSCENE_MONITOR_H +#define LL_LLSCENE_MONITOR_H + +#include "llsingleton.h" +#include "llmath.h" +#include "llfloater.h" +#include "llcharacter.h" +#include "lltracerecording.h" + +class LLCharacter; +class LLRenderTarget; +class LLViewerTexture; + +class LLSceneMonitor : public LLSingleton<LLSceneMonitor> +{ + LOG_CLASS(LLSceneMonitor); +public: + LLSceneMonitor(); + ~LLSceneMonitor(); + + void freezeAvatar(LLCharacter* avatarp); + void setDebugViewerVisible(bool visible); + + void capture(); //capture the main frame buffer + void compare(); //compare the stored two buffers. + void fetchQueryResult(); + void calcDiffAggregate(); + void setDiffTolerance(F32 tol) {mDiffTolerance = tol;} + + const LLRenderTarget* getDiffTarget() const {return mDiff;} + F32 getDiffTolerance() const {return mDiffTolerance;} + F32 getDiffResult() const { return mDiffResult;} + F32 getDiffPixelRatio() const { return mDiffPixelRatio;} + bool isEnabled()const {return mEnabled;} + bool needsUpdate() const; + + const LLTrace::ExtendablePeriodicRecording* getRecording() const {return &mSceneLoadRecording;} + void dumpToFile(std::string file_name); + bool hasResults() const { return mSceneLoadRecording.getResults().getDuration() != S32Seconds(0);} + +private: + void freezeScene(); + void unfreezeScene(); + void reset(); + LLRenderTarget& getCaptureTarget(); + void generateDitheringTexture(S32 width, S32 height); + +private: + bool mEnabled, + mDebugViewerVisible; + + enum EDiffState + { + WAITING_FOR_NEXT_DIFF, + NEED_DIFF, + EXECUTE_DIFF, + WAIT_ON_RESULT, + VIEWER_QUITTING + } mDiffState; + + LLRenderTarget* mFrames[2]; + LLRenderTarget* mDiff; + + GLuint mQueryObject; //used for glQuery + F32 mDiffResult, //aggregate results of mDiff. + mDiffTolerance, //pixels are filtered out when R+G+B < mDiffTolerance + mDiffPixelRatio; //ratio of pixels used for comparison against the original mDiff size along one dimension + + LLPointer<LLViewerTexture> mDitheringTexture; + S32 mDitherMatrixWidth; + F32 mDitherScale, + mDitherScaleS, + mDitherScaleT; + + std::vector<LLAnimPauseRequest> mAvatarPauseHandles; + + LLTimer mRecordingTimer; + LLTrace::ExtendablePeriodicRecording mSceneLoadRecording; + LLTrace::Recording mMonitorRecording; +}; + +class LLSceneMonitorView : public LLFloater +{ +public: + LLSceneMonitorView(const LLRect& rect); + + virtual void draw(); + + virtual void onVisibilityChange(BOOL visible); + +protected: + virtual void onClose(bool app_quitting=false); +}; + +extern LLSceneMonitorView* gSceneMonitorView; + +#endif + diff --git a/indra/newview/llsceneview.cpp b/indra/newview/llsceneview.cpp index cbd8bee9d5733e7706b5273a890cdf2a747663d2..32f327b7620cbb66ae7f673c76860054fb8c0d54 100755 --- a/indra/newview/llsceneview.cpp +++ b/indra/newview/llsceneview.cpp @@ -51,7 +51,7 @@ LLSceneView::LLSceneView(const LLRect& rect) setCanClose(true); } -void LLSceneView::onClickCloseBtn(bool) +void LLSceneView::onClose(bool) { setVisible(false); } diff --git a/indra/newview/llsceneview.h b/indra/newview/llsceneview.h index 1fceecb9e1a9efe975ff3574588c5f8805bfb6c9..6d839bcf0816ddf720f2d5819ca77f178044d289 100755 --- a/indra/newview/llsceneview.h +++ b/indra/newview/llsceneview.h @@ -38,7 +38,7 @@ class LLSceneView : public LLFloater virtual void draw(); protected: - virtual void onClickCloseBtn(bool app_qutting = false); + virtual void onClose(bool app_qutting = false); }; diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 168a941ec379fe10092caa913a4c5bfbafafe202..6a840f3f4004bc6b5f18c73131ccb03a987b4051 100755 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -49,10 +49,10 @@ using namespace LLNotificationsUI; bool LLScreenChannel::mWasStartUpToastShown = false; -LLFastTimer::DeclareTimer FTM_GET_CHANNEL_RECT("Calculate Notification Channel Region"); +LLTrace::BlockTimerStatHandle FTM_GET_CHANNEL_RECT("Calculate Notification Channel Region"); LLRect LLScreenChannelBase::getChannelRect() { - LLFastTimer _(FTM_GET_CHANNEL_RECT); + LL_RECORD_BLOCK_TIME(FTM_GET_CHANNEL_RECT); if (mFloaterSnapRegion == NULL) { @@ -599,7 +599,7 @@ void LLScreenChannel::showToastsBottom() LLToast* toast = (it-1)->getToast(); if (!toast) { - llwarns << "Attempt to display a deleted toast." << llendl; + LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL; return; } @@ -610,7 +610,7 @@ void LLScreenChannel::showToastsBottom() LLToast* toast = it->getToast(); if(!toast) { - llwarns << "Attempt to display a deleted toast." << llendl; + LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL; return; } @@ -698,7 +698,7 @@ void LLScreenChannel::showToastsCentre() LLToast* toast = mToastList[0].getToast(); if (!toast) { - llwarns << "Attempt to display a deleted toast." << llendl; + LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL; return; } @@ -711,7 +711,7 @@ void LLScreenChannel::showToastsCentre() LLToast* toast = it->getToast(); if (!toast) { - llwarns << "Attempt to display a deleted toast." << llendl; + LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL; return; } @@ -747,7 +747,7 @@ void LLScreenChannel::showToastsTop() LLToast* toast = (it-1)->getToast(); if (!toast) { - llwarns << "Attempt to display a deleted toast." << llendl; + LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL; return; } @@ -758,7 +758,7 @@ void LLScreenChannel::showToastsTop() LLToast* toast = it->getToast(); if (!toast) { - llwarns << "Attempt to display a deleted toast." << llendl; + LL_WARNS() << "Attempt to display a deleted toast." << LL_ENDL; return; } @@ -954,7 +954,7 @@ void LLScreenChannel::hideToastsFromScreen() } else { - llwarns << "Attempt to hide a deleted toast." << llendl; + LL_WARNS() << "Attempt to hide a deleted toast." << LL_ENDL; } } } @@ -972,7 +972,7 @@ void LLScreenChannel::hideToast(const LLUUID& notification_id) } else { - llwarns << "Attempt to hide a deleted toast." << llendl; + LL_WARNS() << "Attempt to hide a deleted toast." << LL_ENDL; } } } diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 0e0da6bdc7221d67d06758a617da707d6ff5da4a..590a1c2647dfd8df9573b531359a3f5df67acae1 100755 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -234,7 +234,7 @@ void LLScriptFloater::onMouseDown() // Remove new message icon if (NULL == chicletp) { - llerror("Dock chiclet for LLScriptFloater doesn't exist", 0); + LL_ERRS() << "Dock chiclet for LLScriptFloater doesn't exist" << LL_ENDL; } else { @@ -306,7 +306,7 @@ void LLScriptFloater::dockToChiclet(bool dock) LLChiclet * chicletp = chiclet_panelp->findChiclet<LLChiclet>(getNotificationId()); if (NULL == chicletp) { - llwarns << "Dock chiclet for LLScriptFloater doesn't exist" << llendl; + LL_WARNS() << "Dock chiclet for LLScriptFloater doesn't exist" << LL_ENDL; return; } @@ -350,7 +350,7 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) { if(notification_id.isNull()) { - llwarns << "Invalid notification ID" << llendl; + LL_WARNS() << "Invalid notification ID" << LL_ENDL; return; } @@ -434,7 +434,7 @@ void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id) { if(notification_id.isNull()) { - llwarns << "Invalid notification ID" << llendl; + LL_WARNS() << "Invalid notification ID" << LL_ENDL; return; } @@ -505,7 +505,7 @@ LLScriptFloaterManager::EObjectType LLScriptFloaterManager::getObjectType(const { if(notification_id.isNull()) { - llwarns << "Invalid notification ID" << llendl; + LL_WARNS() << "Invalid notification ID" << LL_ENDL; return OBJ_UNKNOWN; } @@ -518,7 +518,7 @@ LLScriptFloaterManager::EObjectType LLScriptFloaterManager::getObjectType(const return it->second; } - llwarns << "Unknown object type" << llendl; + LL_WARNS() << "Unknown object type" << LL_ENDL; return OBJ_UNKNOWN; } @@ -529,7 +529,7 @@ std::string LLScriptFloaterManager::getObjectName(const LLUUID& notification_id) LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id); if(!notification) { - llwarns << "Invalid notification" << llendl; + LL_WARNS() << "Invalid notification" << LL_ENDL; return LLStringUtil::null; } @@ -586,7 +586,7 @@ void LLScriptFloaterManager::saveFloaterPosition(const LLUUID& object_id, const } else { - llwarns << "Invalid object id" << llendl; + LL_WARNS() << "Invalid object id" << LL_ENDL; } } diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h index db578483209b23ae6d202e9fd889c71c9eaea1f3..c01d318f56d5750a22bf81b568fa9e6ab8dc48fb 100755 --- a/indra/newview/llsecapi.h +++ b/indra/newview/llsecapi.h @@ -28,8 +28,10 @@ #ifndef LLSECAPI_H #define LLSECAPI_H #include <vector> +#include "llwin32headerslean.h" #include <openssl/x509.h> #include <ostream> +#include "llpointer.h" #ifdef LL_WINDOWS #pragma warning(disable:4250) diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp index c4d5450e2bd90bd40c812645b24df057f3bb297a..fc9d9f0842b7766260fd30891d7163420afd78b8 100755 --- a/indra/newview/llsechandler_basic.cpp +++ b/indra/newview/llsechandler_basic.cpp @@ -1220,7 +1220,7 @@ void LLSecAPIBasicHandler::init() // grab the application CA.pem file that contains the well-known certs shipped // with the product std::string ca_file_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem"); - llinfos << "app path " << ca_file_path << llendl; + LL_INFOS() << "app path " << ca_file_path << LL_ENDL; LLPointer<LLBasicCertificateStore> app_ca_store = new LLBasicCertificateStore(ca_file_path); // push the applicate CA files into the store, therefore adding any new CA certs that @@ -1372,7 +1372,7 @@ void LLSecAPIBasicHandler::_writeProtectedData() // EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData() // Decided throwing an exception here was overkill until we figure out why this happens //throw LLProtectedDataException("Error writing Protected Data Store"); - llinfos << "LLProtectedDataException(Error writing Protected Data Store)" << llendl; + LL_INFOS() << "LLProtectedDataException(Error writing Protected Data Store)" << LL_ENDL; } // move the temporary file to the specified file location. @@ -1385,7 +1385,7 @@ void LLSecAPIBasicHandler::_writeProtectedData() // EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData() // Decided throwing an exception here was overkill until we figure out why this happens //throw LLProtectedDataException("Could not overwrite protected data store"); - llinfos << "LLProtectedDataException(Could not overwrite protected data store)" << llendl; + LL_INFOS() << "LLProtectedDataException(Could not overwrite protected data store)" << LL_ENDL; } } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index c83b459279c5d04ae2ceb03ba76ea9f2982a8254..eb3a4c37d99d7f43a4af2fa421f76d19b34a92da 100755 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -10,7 +10,7 @@ * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -104,6 +104,9 @@ const F32 SILHOUETTE_UPDATE_THRESHOLD_SQUARED = 0.02f; const S32 MAX_ACTION_QUEUE_SIZE = 20; const S32 MAX_SILS_PER_FRAME = 50; const S32 MAX_OBJECTS_PER_PACKET = 254; +// For linked sets +const S32 MAX_CHILDREN_PER_TASK = 255; +const S32 MAX_CHILDREN_PER_PHYSICAL_TASK = 32; // // Globals @@ -323,7 +326,7 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectOnly(LLViewerObject* object, S3 return NULL; } - // llinfos << "Adding object to selected object list" << llendl; + // LL_INFOS() << "Adding object to selected object list" << LL_ENDL; // Place it in the list and tag it. // This will refresh dialogs. @@ -889,7 +892,7 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab } else { - llerrs << "LLSelectMgr::add face " << face << " out-of-range" << llendl; + LL_ERRS() << "LLSelectMgr::add face " << face << " out-of-range" << LL_ENDL; return; } @@ -940,6 +943,10 @@ LLObjectSelectionHandle LLSelectMgr::setHoverObject(LLViewerObject *objectp, S32 iter != objects.end(); ++iter) { LLViewerObject* cur_objectp = *iter; + if(!cur_objectp || cur_objectp->isDead()) + { + continue; + } LLSelectNode* nodep = new LLSelectNode(cur_objectp, FALSE); nodep->selectTE(face, TRUE); mHoverObjects->addNodeAtEnd(nodep); @@ -1333,7 +1340,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) } else { - llerrs << "LLSelectMgr::remove - tried to remove TE " << te << " that wasn't selected" << llendl; + LL_ERRS() << "LLSelectMgr::remove - tried to remove TE " << te << " that wasn't selected" << LL_ENDL; return; } @@ -1356,7 +1363,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) else { // ...out of range face - llerrs << "LLSelectMgr::remove - TE " << te << " out of range" << llendl; + LL_ERRS() << "LLSelectMgr::remove - TE " << te << " out of range" << LL_ENDL; } updateSelectionCenter(); @@ -1455,26 +1462,26 @@ void LLSelectMgr::demoteSelectionToIndividuals() //----------------------------------------------------------------------------- void LLSelectMgr::dump() { - llinfos << "Selection Manager: " << mSelectedObjects->getNumNodes() << " items" << llendl; + LL_INFOS() << "Selection Manager: " << mSelectedObjects->getNumNodes() << " items" << LL_ENDL; - llinfos << "TE mode " << mTEMode << llendl; + LL_INFOS() << "TE mode " << mTEMode << LL_ENDL; S32 count = 0; for (LLObjectSelection::iterator iter = getSelection()->begin(); iter != getSelection()->end(); iter++ ) { LLViewerObject* objectp = (*iter)->getObject(); - llinfos << "Object " << count << " type " << LLPrimitive::pCodeToString(objectp->getPCode()) << llendl; - llinfos << " hasLSL " << objectp->flagScripted() << llendl; - llinfos << " hasTouch " << objectp->flagHandleTouch() << llendl; - llinfos << " hasMoney " << objectp->flagTakesMoney() << llendl; - llinfos << " getposition " << objectp->getPosition() << llendl; - llinfos << " getpositionAgent " << objectp->getPositionAgent() << llendl; - llinfos << " getpositionRegion " << objectp->getPositionRegion() << llendl; - llinfos << " getpositionGlobal " << objectp->getPositionGlobal() << llendl; + LL_INFOS() << "Object " << count << " type " << LLPrimitive::pCodeToString(objectp->getPCode()) << LL_ENDL; + LL_INFOS() << " hasLSL " << objectp->flagScripted() << LL_ENDL; + LL_INFOS() << " hasTouch " << objectp->flagHandleTouch() << LL_ENDL; + LL_INFOS() << " hasMoney " << objectp->flagTakesMoney() << LL_ENDL; + LL_INFOS() << " getposition " << objectp->getPosition() << LL_ENDL; + LL_INFOS() << " getpositionAgent " << objectp->getPositionAgent() << LL_ENDL; + LL_INFOS() << " getpositionRegion " << objectp->getPositionRegion() << LL_ENDL; + LL_INFOS() << " getpositionGlobal " << objectp->getPositionGlobal() << LL_ENDL; LLDrawable* drawablep = objectp->mDrawable; - llinfos << " " << (drawablep&& drawablep->isVisible() ? "visible" : "invisible") << llendl; - llinfos << " " << (drawablep&& drawablep->isState(LLDrawable::FORCE_INVISIBLE) ? "force_invisible" : "") << llendl; + LL_INFOS() << " " << (drawablep&& drawablep->isVisible() ? "visible" : "invisible") << LL_ENDL; + LL_INFOS() << " " << (drawablep&& drawablep->isState(LLDrawable::FORCE_INVISIBLE) ? "force_invisible" : "") << LL_ENDL; count++; } @@ -1490,14 +1497,14 @@ void LLSelectMgr::dump() { if (node->isTESelected(te)) { - llinfos << "Object " << objectp << " te " << te << llendl; + LL_INFOS() << "Object " << objectp << " te " << te << LL_ENDL; } } } - llinfos << mHighlightedObjects->getNumNodes() << " objects currently highlighted." << llendl; + LL_INFOS() << mHighlightedObjects->getNumNodes() << " objects currently highlighted." << LL_ENDL; - llinfos << "Center global " << mSelectionCenterGlobal << llendl; + LL_INFOS() << "Center global " << mSelectionCenterGlobal << LL_ENDL; } //----------------------------------------------------------------------------- @@ -1557,7 +1564,7 @@ void LLObjectSelection::applyNoCopyTextureToTEs(LLViewerInventoryItem* item) } // apply texture for the selected faces - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); + add(LLStatViewer::EDIT_TEXTURE, 1); object->setTEImage(te, image); dialog_refresh_all(); @@ -1580,8 +1587,8 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid) && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()) && (mSelectedObjects->getNumNodes() > 1) ) { - llwarns << "Attempted to apply no-copy texture to multiple objects" - << llendl; + LL_WARNS() << "Attempted to apply no-copy texture to multiple objects" + << LL_ENDL; return; } @@ -3510,7 +3517,7 @@ bool LLSelectMgr::confirmDelete(const LLSD& notification, const LLSD& response, S32 option = LLNotification::getSelectedOption(notification, response); if (!handle->getObjectCount()) { - llwarns << "Nothing to delete!" << llendl; + LL_WARNS() << "Nothing to delete!" << LL_ENDL; return false; } @@ -3541,9 +3548,7 @@ bool LLSelectMgr::confirmDelete(const LLSD& notification, const LLSD& response, gAgentCamera.setLookAt(LOOKAT_TARGET_CLEAR); // Keep track of how many objects have been deleted. - F64 obj_delete_count = LLViewerStats::getInstance()->getStat(LLViewerStats::ST_OBJECT_DELETE_COUNT); - obj_delete_count += LLSelectMgr::getInstance()->mSelectedObjects->getObjectCount(); - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_OBJECT_DELETE_COUNT, obj_delete_count ); + add(LLStatViewer::DELETE_OBJECT, LLSelectMgr::getInstance()->mSelectedObjects->getObjectCount()); } break; case 1: @@ -3950,7 +3955,7 @@ void LLSelectMgr::packMultipleUpdate(LLSelectNode* node, void *user_data) } if (type & UPD_SCALE) { - //llinfos << "Sending object scale " << object->getScale() << llendl; + //LL_INFOS() << "Sending object scale " << object->getScale() << LL_ENDL; htonmemcpy(&data[offset], &(object->getScale().mV), MVT_LLVector3, 12); offset += 12; } @@ -4088,7 +4093,7 @@ void LLSelectMgr::packPermissionsHead(void* user_data) /* void LLSelectMgr::sendSelect() { - llerrs << "Not implemented" << llendl; + LL_ERRS() << "Not implemented" << LL_ENDL; } */ @@ -4202,9 +4207,9 @@ void LLSelectMgr::deselectAllIfTooFar() { if (mDebugSelectMgr) { - llinfos << "Selection manager: auto-deselecting, select_dist = " << (F32) sqrt(select_dist_sq) << llendl; - llinfos << "agent pos global = " << gAgent.getPositionGlobal() << llendl; - llinfos << "selection pos global = " << selectionCenter << llendl; + LL_INFOS() << "Selection manager: auto-deselecting, select_dist = " << (F32) sqrt(select_dist_sq) << LL_ENDL; + LL_INFOS() << "agent pos global = " << gAgent.getPositionGlobal() << LL_ENDL; + LL_INFOS() << "selection pos global = " << selectionCenter << LL_ENDL; } deselectAll(); @@ -4916,7 +4921,7 @@ void LLSelectMgr::sendListToRegions(const std::string& message_name, break; default: - llerrs << "Bad send type " << send_type << " passed to SendListToRegions()" << llendl; + LL_ERRS() << "Bad send type " << send_type << " passed to SendListToRegions()" << LL_ENDL; } // bail if nothing selected @@ -4990,7 +4995,7 @@ void LLSelectMgr::sendListToRegions(const std::string& message_name, gMessageSystem->clearMessage(); } - // llinfos << "sendListToRegions " << message_name << " obj " << objects_sent << " pkt " << packets_sent << llendl; + // LL_INFOS() << "sendListToRegions " << message_name << " obj " << objects_sent << " pkt " << packets_sent << LL_ENDL; } @@ -5107,7 +5112,7 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data if (!node) { - llwarns << "Couldn't find object " << id << " selected." << llendl; + LL_WARNS() << "Couldn't find object " << id << " selected." << LL_ENDL; } else { @@ -5913,7 +5918,7 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query) LLPrimitive::getTESTAxes(i, &s_axis, &t_axis); tep->getScale(&diffuse_s,&diffuse_t); - + if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR) { v.mV[s_axis] = diffuse_s*scale.mV[s_axis]; @@ -5925,7 +5930,7 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query) v.mV[s_axis] = diffuse_s/scale.mV[s_axis]; v.mV[t_axis] = diffuse_t/scale.mV[t_axis]; mTextureScaleRatios.push_back(v); - } + } } } } @@ -6369,7 +6374,7 @@ S32 get_family_count(LLViewerObject *parent) { if (!parent) { - llwarns << "Trying to get_family_count on null parent!" << llendl; + LL_WARNS() << "Trying to get_family_count on null parent!" << LL_ENDL; } S32 count = 1; // for this object LLViewerObject::const_child_list_t& child_list = parent->getChildren(); @@ -6380,11 +6385,11 @@ S32 get_family_count(LLViewerObject *parent) if (!child) { - llwarns << "Family object has NULL child! Show Doug." << llendl; + LL_WARNS() << "Family object has NULL child! Show Doug." << LL_ENDL; } else if (child->isDead()) { - llwarns << "Family object has dead child object. Show Doug." << llendl; + LL_WARNS() << "Family object has dead child object. Show Doug." << LL_ENDL; } else { diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index d4b736640c0947cbb2125d60d584dbe8599d8e08..a68328167a3a2cccd2a2679abe13689ad900da6c 100755 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -56,6 +56,33 @@ class LLColor4; class LLVector3; class LLSelectNode; +const U8 UPD_NONE = 0x00; +const U8 UPD_POSITION = 0x01; +const U8 UPD_ROTATION = 0x02; +const U8 UPD_SCALE = 0x04; +const U8 UPD_LINKED_SETS = 0x08; +const U8 UPD_UNIFORM = 0x10; // used with UPD_SCALE + +// This is used by the DeRezObject message to determine where to put +// derezed tasks. +enum EDeRezDestination +{ + DRD_SAVE_INTO_AGENT_INVENTORY = 0, + DRD_ACQUIRE_TO_AGENT_INVENTORY = 1, // try to leave copy in world + DRD_SAVE_INTO_TASK_INVENTORY = 2, + DRD_ATTACHMENT = 3, + DRD_TAKE_INTO_AGENT_INVENTORY = 4, // delete from world + DRD_FORCE_TO_GOD_INVENTORY = 5, // force take copy + DRD_TRASH = 6, + DRD_ATTACHMENT_TO_INV = 7, + DRD_ATTACHMENT_EXISTS = 8, + DRD_RETURN_TO_OWNER = 9, // back to owner's inventory + DRD_RETURN_TO_LAST_OWNER = 10, // deeded object back to last owner's inventory + + DRD_COUNT = 11 +}; + + const S32 SELECT_ALL_TES = -1; const S32 SELECT_MAX_TES = 32; diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index ec6a1d9bdc156e77231f29d1a89bed30767a547d..c938a478f7268e0af0cdaa7adfa77ec76eeb2214 100755 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -142,7 +142,7 @@ BOOL LLSidepanelAppearance::postBuild() mCurrOutfitPanel = getChild<LLPanel>("panel_currentlook"); - setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); + setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChanged,this,_2)); return TRUE; } @@ -181,7 +181,7 @@ void LLSidepanelAppearance::onOpen(const LLSD& key) mOpened = true; } -void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) +void LLSidepanelAppearance::onVisibilityChanged(const LLSD &new_visibility) { LLSD visibility; visibility["visible"] = new_visibility.asBoolean(); @@ -201,7 +201,7 @@ void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); if (!wearable_ptr) { - llwarns << "Visibility change to invalid wearable" << llendl; + LL_WARNS() << "Visibility change to invalid wearable" << LL_ENDL; return; } // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar @@ -231,7 +231,7 @@ void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) { gAgentCamera.changeCameraToDefault(); gAgentCamera.resetView(); - } + } } } diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index b0a6b9cf916da7107891a817d2132f965c4afc17..cde05a8d9b326558ab9fc9b9f52a3225e0720450 100755 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -47,7 +47,7 @@ class LLSidepanelAppearance : public LLPanel virtual ~LLSidepanelAppearance(); /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onOpen(const LLSD& key); void refreshCurrentOutfitName(const std::string& name = ""); @@ -68,7 +68,7 @@ class LLSidepanelAppearance : public LLPanel private: void onFilterEdit(const std::string& search_string); - void onVisibilityChange ( const LLSD& new_visibility ); + void onVisibilityChanged ( const LLSD& new_visibility ); void onOpenOutfitButtonClicked(); void onEditAppearanceButtonClicked(); diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index d7ea8d572c4fdba7daab43c7b1a5adb30c94d5ab..2556714792e27278202db2eaa4023b53e6e61c6e 100755 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -160,7 +160,7 @@ BOOL LLSidepanelInventory::postBuild() { // UI elements from inventory panel { - mInventoryPanel = getChild<LLPanel>("sidepanel__inventory_panel"); + mInventoryPanel = getChild<LLPanel>("sidepanel_inventory_panel"); mInfoBtn = mInventoryPanel->getChild<LLButton>("info_btn"); mInfoBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onInfoButtonClicked, this)); @@ -309,7 +309,7 @@ void LLSidepanelInventory::observeInboxModifications(const LLUUID& inboxID) if (inboxID.isNull()) { - llwarns << "Attempting to track modifications to non-existent inbox" << llendl; + LL_WARNS() << "Attempting to track modifications to non-existent inbox" << LL_ENDL; return; } diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index e52b2f25597f0a45ff682c5e19bb78d6560aa826..1d20b7bed50a1362b45ba82f4ff3180b1d863a0f 100755 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -678,7 +678,7 @@ void LLSidepanelItemInfo::startObjectInventoryObserver() if (mObjectID.isNull()) { - llwarns << "Empty object id passed to inventory observer" << llendl; + LL_WARNS() << "Empty object id passed to inventory observer" << LL_ENDL; return; } @@ -721,7 +721,7 @@ void LLSidepanelItemInfo::onClickOwner() // static void LLSidepanelItemInfo::onCommitName() { - //llinfos << "LLSidepanelItemInfo::onCommitName()" << llendl; + //LL_INFOS() << "LLSidepanelItemInfo::onCommitName()" << LL_ENDL; LLViewerInventoryItem* item = findItem(); if(!item) { @@ -757,7 +757,7 @@ void LLSidepanelItemInfo::onCommitName() void LLSidepanelItemInfo::onCommitDescription() { - //llinfos << "LLSidepanelItemInfo::onCommitDescription()" << llendl; + //LL_INFOS() << "LLSidepanelItemInfo::onCommitDescription()" << LL_ENDL; LLViewerInventoryItem* item = findItem(); if(!item) return; @@ -795,7 +795,7 @@ void LLSidepanelItemInfo::onCommitDescription() // static void LLSidepanelItemInfo::onCommitPermissions() { - //llinfos << "LLSidepanelItemInfo::onCommitPermissions()" << llendl; + //LL_INFOS() << "LLSidepanelItemInfo::onCommitPermissions()" << LL_ENDL; LLViewerInventoryItem* item = findItem(); if(!item) return; LLPermissions perm(item->getPermissions()); @@ -892,14 +892,14 @@ void LLSidepanelItemInfo::onCommitPermissions() // static void LLSidepanelItemInfo::onCommitSaleInfo() { - //llinfos << "LLSidepanelItemInfo::onCommitSaleInfo()" << llendl; + //LL_INFOS() << "LLSidepanelItemInfo::onCommitSaleInfo()" << LL_ENDL; updateSaleInfo(); } // static void LLSidepanelItemInfo::onCommitSaleType() { - //llinfos << "LLSidepanelItemInfo::onCommitSaleType()" << llendl; + //LL_INFOS() << "LLSidepanelItemInfo::onCommitSaleType()" << LL_ENDL; updateSaleInfo(); } diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp index 44280989297e61addbc1678ec835bf914f09bc9a..636654ad2369d0b6b63ecc4ba20d1481d9bc5845 100755 --- a/indra/newview/llsidepaneltaskinfo.cpp +++ b/indra/newview/llsidepaneltaskinfo.cpp @@ -162,7 +162,7 @@ BOOL LLSidepanelTaskInfo::postBuild() return TRUE; } -/*virtual*/ void LLSidepanelTaskInfo::handleVisibilityChange ( BOOL visible ) +/*virtual*/ void LLSidepanelTaskInfo::onVisibilityChange ( BOOL visible ) { if (visible) { @@ -945,7 +945,6 @@ static bool callback_deed_to_group(const LLSD& notification, const LLSD& respons if (group_id.notNull() && groups_identical && (gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED))) { LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE); -// LLViewerStats::getInstance()->incStat(LLViewerStats::ST_RELEASE_COUNT); } } return FALSE; @@ -996,28 +995,28 @@ void LLSidepanelTaskInfo::onCommitEveryoneCopy(LLUICtrl *ctrl, void *data) // static void LLSidepanelTaskInfo::onCommitNextOwnerModify(LLUICtrl* ctrl, void* data) { - //llinfos << "LLSidepanelTaskInfo::onCommitNextOwnerModify" << llendl; + //LL_INFOS() << "LLSidepanelTaskInfo::onCommitNextOwnerModify" << LL_ENDL; onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_MODIFY); } // static void LLSidepanelTaskInfo::onCommitNextOwnerCopy(LLUICtrl* ctrl, void* data) { - //llinfos << "LLSidepanelTaskInfo::onCommitNextOwnerCopy" << llendl; + //LL_INFOS() << "LLSidepanelTaskInfo::onCommitNextOwnerCopy" << LL_ENDL; onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_COPY); } // static void LLSidepanelTaskInfo::onCommitNextOwnerTransfer(LLUICtrl* ctrl, void* data) { - //llinfos << "LLSidepanelTaskInfo::onCommitNextOwnerTransfer" << llendl; + //LL_INFOS() << "LLSidepanelTaskInfo::onCommitNextOwnerTransfer" << LL_ENDL; onCommitPerm(ctrl, data, PERM_NEXT_OWNER, PERM_TRANSFER); } // static void LLSidepanelTaskInfo::onCommitName(LLUICtrl*, void* data) { - //llinfos << "LLSidepanelTaskInfo::onCommitName()" << llendl; + //LL_INFOS() << "LLSidepanelTaskInfo::onCommitName()" << LL_ENDL; LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data; LLLineEditor* tb = self->getChild<LLLineEditor>("Object Name"); if(tb) @@ -1031,7 +1030,7 @@ void LLSidepanelTaskInfo::onCommitName(LLUICtrl*, void* data) // static void LLSidepanelTaskInfo::onCommitDesc(LLUICtrl*, void* data) { - //llinfos << "LLSidepanelTaskInfo::onCommitDesc()" << llendl; + //LL_INFOS() << "LLSidepanelTaskInfo::onCommitDesc()" << LL_ENDL; LLSidepanelTaskInfo* self = (LLSidepanelTaskInfo*)data; LLLineEditor* le = self->getChild<LLLineEditor>("Object Description"); if(le) diff --git a/indra/newview/llsidepaneltaskinfo.h b/indra/newview/llsidepaneltaskinfo.h index 05edcda5ed0bff322478443f081cb03ac9b4cbb6..a1479ef0e7c862a7666d038f378e6b4767a78d9b 100755 --- a/indra/newview/llsidepaneltaskinfo.h +++ b/indra/newview/llsidepaneltaskinfo.h @@ -50,7 +50,7 @@ class LLSidepanelTaskInfo : public LLSidepanelInventorySubpanel virtual ~LLSidepanelTaskInfo(); /*virtual*/ BOOL postBuild(); - /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); + /*virtual*/ void onVisibilityChange ( BOOL new_visibility ); void setObjectSelection(LLObjectSelectionHandle selection); diff --git a/indra/newview/llsimplestat.h b/indra/newview/llsimplestat.h deleted file mode 100755 index 9d7780c4f935e8c89c08384839896ed4fd581838..0000000000000000000000000000000000000000 --- a/indra/newview/llsimplestat.h +++ /dev/null @@ -1,152 +0,0 @@ -/** - * @file llsimplestat.h - * @brief Runtime statistics accumulation. - * - * $LicenseInfo:firstyear=2010&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_SIMPLESTAT_H -#define LL_SIMPLESTAT_H - -// History -// -// The original source for this code is the server repositories' -// llcommon/llstat.h file. This particular code was added after the -// viewer/server code schism but before the effort to convert common -// code to libraries was complete. Rather than add to merge issues, -// the needed code was cut'n'pasted into this new header as it isn't -// too awful a burden. Post-modularization, we can look at removing -// this redundancy. - - -/** - * @class LLSimpleStatCounter - * @brief Just counts events. - * - * Really not needed but have a pattern in mind in the future. - * Interface limits what can be done at that's just fine. - * - * *TODO: Update/transfer unit tests - * Unit tests: indra/test/llcommon_llstat_tut.cpp - */ -class LLSimpleStatCounter -{ -public: - inline LLSimpleStatCounter() { reset(); } - // Default destructor and assignment operator are valid - - inline void reset() { mCount = 0; } - - inline void merge(const LLSimpleStatCounter & src) - { mCount += src.mCount; } - - inline U32 operator++() { return ++mCount; } - - inline U32 getCount() const { return mCount; } - -protected: - U32 mCount; -}; - - -/** - * @class LLSimpleStatMMM - * @brief Templated collector of min, max and mean data for stats. - * - * Fed a stream of data samples, keeps a running account of the - * min, max and mean seen since construction or the last reset() - * call. A freshly-constructed or reset instance returns counts - * and values of zero. - * - * Overflows and underflows (integer, inf or -inf) and NaN's - * are the caller's problem. As is loss of precision when - * the running sum's exponent (when parameterized by a floating - * point of some type) differs from a given data sample's. - * - * Unit tests: indra/test/llcommon_llstat_tut.cpp - */ -template <typename VALUE_T = F32> -class LLSimpleStatMMM -{ -public: - typedef VALUE_T Value; - -public: - LLSimpleStatMMM() { reset(); } - // Default destructor and assignment operator are valid - - /** - * Resets the object returning all counts and derived - * values back to zero. - */ - void reset() - { - mCount = 0; - mMin = Value(0); - mMax = Value(0); - mTotal = Value(0); - } - - void record(Value v) - { - if (mCount) - { - mMin = llmin(mMin, v); - mMax = llmax(mMax, v); - } - else - { - mMin = v; - mMax = v; - } - mTotal += v; - ++mCount; - } - - void merge(const LLSimpleStatMMM<VALUE_T> & src) - { - if (! mCount) - { - *this = src; - } - else if (src.mCount) - { - mMin = llmin(mMin, src.mMin); - mMax = llmax(mMax, src.mMax); - mCount += src.mCount; - mTotal += src.mTotal; - } - } - - inline U32 getCount() const { return mCount; } - inline Value getMin() const { return mMin; } - inline Value getMax() const { return mMax; } - inline Value getMean() const { return mCount ? mTotal / mCount : mTotal; } - -protected: - U32 mCount; - Value mMin; - Value mMax; - Value mTotal; -}; - -#endif // LL_SIMPLESTAT_H diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index ea8225a3ac12c2d27d30854c2a50acd025cfd93f..d8ad071ba6304b6bc69844410283c3302c99ed9e 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -163,7 +163,7 @@ F32 LLSnapshotLivePreview::getImageAspect() void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail, F32 delay) { // Invalidate current image. - lldebugs << "updateSnapshot: mSnapshotUpToDate = " << getSnapshotUpToDate() << llendl; + LL_DEBUGS() << "updateSnapshot: mSnapshotUpToDate = " << getSnapshotUpToDate() << LL_ENDL; if (getSnapshotUpToDate()) { S32 old_image_index = mCurImageIndex; @@ -337,7 +337,7 @@ void LLSnapshotLivePreview::draw() } else if (mShineAnimTimer.getStarted()) { - lldebugs << "Drawing shining animation" << llendl; + LL_DEBUGS() << "Drawing shining animation" << LL_ENDL; F32 shine_interp = llmin(1.f, mShineAnimTimer.getElapsedTimeF32() / SHINE_TIME); // draw "shine" effect @@ -414,7 +414,7 @@ void LLSnapshotLivePreview::draw() S32 old_image_index = (mCurImageIndex + 1) % 2; if (mViewerImage[old_image_index].notNull() && mFallAnimTimer.getElapsedTimeF32() < FALL_TIME) { - lldebugs << "Drawing fall animation" << llendl; + LL_DEBUGS() << "Drawing fall animation" << LL_ENDL; F32 fall_interp = mFallAnimTimer.getElapsedTimeF32() / FALL_TIME; F32 alpha = clamp_rescale(fall_interp, 0.f, 1.f, 0.8f, 0.4f); LLColor4 image_color(1.f, 1.f, 1.f, alpha); @@ -458,7 +458,7 @@ void LLSnapshotLivePreview::reshape(S32 width, S32 height, BOOL called_from_pare LLView::reshape(width, height, called_from_parent); if (old_rect.getWidth() != width || old_rect.getHeight() != height) { - lldebugs << "window reshaped, updating thumbnail" << llendl; + LL_DEBUGS() << "window reshaped, updating thumbnail" << LL_ENDL; updateSnapshot(FALSE, TRUE); } } @@ -591,7 +591,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; if (previewp->getWidth() == 0 || previewp->getHeight() == 0) { - llwarns << "Incorrect dimensions: " << previewp->getWidth() << "x" << previewp->getHeight() << llendl; + LL_WARNS() << "Incorrect dimensions: " << previewp->getWidth() << "x" << previewp->getHeight() << LL_ENDL; return FALSE; } @@ -605,7 +605,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mCameraRot = new_camera_rot; // request a new snapshot whenever the camera moves, with a time delay BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot"); - lldebugs << "camera moved, updating thumbnail" << llendl; + LL_DEBUGS() << "camera moved, updating thumbnail" << LL_ENDL; previewp->updateSnapshot( autosnap, // whether a new snapshot is needed or merely invalidate the existing one FALSE, // or if 1st arg is false, whether to produce a new thumbnail image. @@ -624,7 +624,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) // time to produce a snapshot previewp->setThumbnailImageSize(); - lldebugs << "producing snapshot" << llendl; + LL_DEBUGS() << "producing snapshot" << LL_ENDL; if (!previewp->mPreviewImage) { previewp->mPreviewImage = new LLImageRaw; @@ -660,7 +660,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) if(previewp->getSnapshotType() == SNAPSHOT_TEXTURE) { - lldebugs << "Encoding new image of format J2C" << llendl; + LL_DEBUGS() << "Encoding new image of format J2C" << LL_ENDL; LLPointer<LLImageJ2C> formatted = new LLImageJ2C; LLPointer<LLImageRaw> scaled = new LLImageRaw( previewp->mPreviewImage->getData(), @@ -682,7 +682,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) previewp->mFormattedImage = NULL; // now create the new one of the appropriate format. LLFloaterSnapshot::ESnapshotFormat format = previewp->getSnapshotFormat(); - lldebugs << "Encoding new image of format " << format << llendl; + LL_DEBUGS() << "Encoding new image of format " << format << LL_ENDL; switch(format) { @@ -762,7 +762,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) { previewp->generateThumbnailImage() ; } - lldebugs << "done creating snapshot" << llendl; + LL_DEBUGS() << "done creating snapshot" << LL_ENDL; LLFloaterSnapshot::postUpdate(); LLFloaterSocial::postUpdate(); @@ -771,7 +771,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) void LLSnapshotLivePreview::setSize(S32 w, S32 h) { - lldebugs << "setSize(" << w << ", " << h << ")" << llendl; + LL_DEBUGS() << "setSize(" << w << ", " << h << ")" << LL_ENDL; setWidth(w); setHeight(h); } @@ -784,7 +784,7 @@ void LLSnapshotLivePreview::getSize(S32& w, S32& h) const void LLSnapshotLivePreview::saveTexture() { - lldebugs << "saving texture: " << mPreviewImage->getWidth() << "x" << mPreviewImage->getHeight() << llendl; + LL_DEBUGS() << "saving texture: " << mPreviewImage->getWidth() << "x" << mPreviewImage->getHeight() << LL_ENDL; // gen a new uuid for this asset LLTransactionID tid; tid.generate(); @@ -797,7 +797,7 @@ void LLSnapshotLivePreview::saveTexture() mPreviewImage->getComponents()); scaled->biasedScaleToPowerOfTwo(MAX_TEXTURE_SIZE); - lldebugs << "scaled texture to " << scaled->getWidth() << "x" << scaled->getHeight() << llendl; + LL_DEBUGS() << "scaled texture to " << scaled->getWidth() << "x" << scaled->getHeight() << LL_ENDL; if (formatted->encode(scaled, 0.0f)) { @@ -826,10 +826,10 @@ void LLSnapshotLivePreview::saveTexture() else { LLNotificationsUtil::add("ErrorEncodingSnapshot"); - llwarns << "Error encoding snapshot" << llendl; + LL_WARNS() << "Error encoding snapshot" << LL_ENDL; } - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_SNAPSHOT_COUNT ); + add(LLStatViewer::SNAPSHOT, 1); mDataSize = 0; } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 2c83f6d0b707f1f0ecd5f9e455cfb89d1adc54cd..7b894d8d98559e8baf440e1cd13f8d1d06840794 100755 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -51,32 +51,16 @@ #include "llvoavatar.h" #include "llvolumemgr.h" #include "lltextureatlas.h" -#include "llglslshader.h" #include "llviewershadermgr.h" -static LLFastTimer::DeclareTimer FTM_FRUSTUM_CULL("Frustum Culling"); -static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound Partition"); - -const F32 SG_OCCLUSION_FUDGE = 0.25f; -#define SG_DISCARD_TOLERANCE 0.01f - -#if LL_OCTREE_PARANOIA_CHECK -#define assert_octree_valid(x) x->validate() -#define assert_states_valid(x) ((LLSpatialGroup*) x->mSpatialPartition->mOctree->getListener(0))->checkStates() -#else -#define assert_octree_valid(x) -#define assert_states_valid(x) -#endif +static LLTrace::BlockTimerStatHandle FTM_FRUSTUM_CULL("Frustum Culling"); +static LLTrace::BlockTimerStatHandle FTM_CULL_REBOUND("Cull Rebound Partition"); extern bool gShiftFrame; static U32 sZombieGroups = 0; U32 LLSpatialGroup::sNodeCount = 0; -#define LL_TRACK_PENDING_OCCLUSION_QUERIES 0 - -std::set<GLuint> LLSpatialGroup::sPendingQueries; - U32 gOctreeMaxCapacity; BOOL LLSpatialGroup::sNoDelete = FALSE; @@ -84,35 +68,7 @@ BOOL LLSpatialGroup::sNoDelete = FALSE; static F32 sLastMaxTexPriority = 1.f; static F32 sCurMaxTexPriority = 1.f; -class LLOcclusionQueryPool : public LLGLNamePool -{ -public: - LLOcclusionQueryPool() - { - - } - -protected: - - virtual GLuint allocateName() - { - GLuint ret = 0; - - glGenQueriesARB(1, &ret); - - return ret; - } - - virtual void releaseName(GLuint name) - { -#if LL_TRACK_PENDING_OCCLUSION_QUERIES - LLSpatialGroup::sPendingQueries.erase(name); -#endif - glDeleteQueriesARB(1, &name); - } -}; - -static LLOcclusionQueryPool sQueryPool; +BOOL LLSpatialPartition::sTeleportRequested = FALSE; //static counter for frame to switch LOD on @@ -121,190 +77,11 @@ void sg_assert(BOOL expr) #if LL_OCTREE_PARANOIA_CHECK if (!expr) { - llerrs << "Octree invalid!" << llendl; + LL_ERRS() << "Octree invalid!" << LL_ENDL; } #endif } -S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad) -{ - return AABBSphereIntersectR2(min, max, origin, rad*rad); -} - -S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &r) -{ - F32 d = 0.f; - F32 t; - - if ((min-origin).magVecSquared() < r && - (max-origin).magVecSquared() < r) - { - return 2; - } - - for (U32 i = 0; i < 3; i++) - { - if (origin.mV[i] < min.mV[i]) - { - t = min.mV[i] - origin.mV[i]; - d += t*t; - } - else if (origin.mV[i] > max.mV[i]) - { - t = origin.mV[i] - max.mV[i]; - d += t*t; - } - - if (d > r) - { - return 0; - } - } - - return 1; -} - - -S32 AABBSphereIntersect(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &rad) -{ - return AABBSphereIntersectR2(min, max, origin, rad*rad); -} - -S32 AABBSphereIntersectR2(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &r) -{ - F32 d = 0.f; - F32 t; - - LLVector4a origina; - origina.load3(origin.mV); - - LLVector4a v; - v.setSub(min, origina); - - if (v.dot3(v) < r) - { - v.setSub(max, origina); - if (v.dot3(v) < r) - { - return 2; - } - } - - - for (U32 i = 0; i < 3; i++) - { - if (origin.mV[i] < min[i]) - { - t = min[i] - origin.mV[i]; - d += t*t; - } - else if (origin.mV[i] > max[i]) - { - t = origin.mV[i] - max[i]; - d += t*t; - } - - if (d > r) - { - return 0; - } - } - - return 1; -} - - -typedef enum -{ - b000 = 0x00, - b001 = 0x01, - b010 = 0x02, - b011 = 0x03, - b100 = 0x04, - b101 = 0x05, - b110 = 0x06, - b111 = 0x07, -} eLoveTheBits; - -//contact Runitai Linden for a copy of the SL object used to write this table -//basically, you give the table a bitmask of the look-at vector to a node and it -//gives you a triangle fan index array -static U16 sOcclusionIndices[] = -{ - //000 - b111, b110, b010, b011, b001, b101, b100, b110, - //001 - b011, b010, b000, b001, b101, b111, b110, b010, - //010 - b101, b100, b110, b111, b011, b001, b000, b100, - //011 - b001, b000, b100, b101, b111, b011, b010, b000, - //100 - b110, b000, b010, b011, b111, b101, b100, b000, - //101 - b010, b100, b000, b001, b011, b111, b110, b100, - //110 - b100, b010, b110, b111, b101, b001, b000, b010, - //111 - b000, b110, b100, b101, b001, b011, b010, b110, -}; - -U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center) -{ - LLVector4a origin; - origin.load3(camera->getOrigin().mV); - - S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7; - - return cypher*8; -} - -U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center) -{ - LLVector4a origin; - origin.load3(camera->getOrigin().mV); - - S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7; - - return (U8*) (sOcclusionIndices+cypher*8); -} - -//create a vertex buffer for efficiently rendering cubes -LLVertexBuffer* ll_create_cube_vb(U32 type_mask, U32 usage) -{ - LLVertexBuffer* ret = new LLVertexBuffer(type_mask, usage); - - ret->allocateBuffer(8, 64, true); - - LLStrider<LLVector3> pos; - LLStrider<U16> idx; - - ret->getVertexStrider(pos); - ret->getIndexStrider(idx); - - pos[0] = LLVector3(-1,-1,-1); - pos[1] = LLVector3(-1,-1, 1); - pos[2] = LLVector3(-1, 1,-1); - pos[3] = LLVector3(-1, 1, 1); - pos[4] = LLVector3( 1,-1,-1); - pos[5] = LLVector3( 1,-1, 1); - pos[6] = LLVector3( 1, 1,-1); - pos[7] = LLVector3( 1, 1, 1); - - for (U32 i = 0; i < 64; i++) - { - idx[i] = sOcclusionIndices[i]; - } - - ret->flush(); - - return ret; -} - -static LLFastTimer::DeclareTimer FTM_BUILD_OCCLUSION("Build Occlusion"); - -BOOL earlyFail(LLCamera* camera, LLSpatialGroup* group); - //returns: // 0 if sphere and AABB are not intersecting // 1 if they are @@ -338,7 +115,7 @@ LLSpatialGroup::~LLSpatialGroup() { /*if (sNoDelete) { - llerrs << "Illegal deletion of LLSpatialGroup!" << llendl; + LL_ERRS() << "Illegal deletion of LLSpatialGroup!" << LL_ENDL; }*/ if (gDebugGL) @@ -346,24 +123,13 @@ LLSpatialGroup::~LLSpatialGroup() gPipeline.checkReferences(this); } - if (isState(DEAD)) + if (hasState(DEAD)) { sZombieGroups--; } sNodeCount--; - if (gGLManager.mHasOcclusionQuery) - { - for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; ++i) - { - if (mOcclusionQuery[i]) - { - sQueryPool.release(mOcclusionQuery[i]); - } - } - } - clearDrawMap(); clearAtlasList() ; } @@ -497,22 +263,7 @@ void LLSpatialGroup::clearDrawMap() BOOL LLSpatialGroup::isHUDGroup() { - return mSpatialPartition && mSpatialPartition->isHUDPartition() ; -} - -BOOL LLSpatialGroup::isRecentlyVisible() const -{ - return (LLDrawable::getCurrentFrame() - mVisible[LLViewerCamera::sCurCameraID]) < LLDrawable::getMinVisFrameRange() ; -} - -BOOL LLSpatialGroup::isVisible() const -{ - return mVisible[LLViewerCamera::sCurCameraID] >= LLDrawable::getCurrentFrame() ? TRUE : FALSE; -} - -void LLSpatialGroup::setVisible() -{ - mVisible[LLViewerCamera::sCurCameraID] = LLDrawable::getCurrentFrame(); + return getSpatialPartition() && getSpatialPartition()->isHUDPartition() ; } void LLSpatialGroup::validate() @@ -536,7 +287,7 @@ void LLSpatialGroup::validate() sg_assert(drawable->getSpatialGroup() == this); if (drawable->getSpatialBridge()) { - sg_assert(drawable->getSpatialBridge() == mSpatialPartition->asBridge()); + sg_assert(drawable->getSpatialBridge() == getSpatialPartition()->asBridge()); } /*if (drawable->isSpatialBridge()) @@ -544,7 +295,7 @@ void LLSpatialGroup::validate() LLSpatialPartition* part = drawable->asPartition(); if (!part) { - llerrs << "Drawable reports it is a spatial bridge but not a partition." << llendl; + LL_ERRS() << "Drawable reports it is a spatial bridge but not a partition." << LL_ENDL; } LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); group->validate(); @@ -576,14 +327,6 @@ void LLSpatialGroup::validate() #endif } -void LLSpatialGroup::checkStates() -{ -#if LL_OCTREE_PARANOIA_CHECK - //LLOctreeStateCheck checker; - //checker.traverse(mOctreeNode); -#endif -} - void LLSpatialGroup::validateDrawMap() { #if LL_OCTREE_PARANOIA_CHECK @@ -607,7 +350,7 @@ BOOL LLSpatialGroup::updateInGroup(LLDrawable *drawablep, BOOL immediate) OctreeNode* parent = mOctreeNode->getOctParent(); if (mOctreeNode->isInside(drawablep->getPositionGroup()) && - (mOctreeNode->contains(drawablep) || + (mOctreeNode->contains(drawablep->getEntry()) || (drawablep->getBinRadius() > mOctreeNode->getSize()[0] && parent && parent->getElementCount() >= gOctreeMaxCapacity))) { @@ -621,15 +364,14 @@ BOOL LLSpatialGroup::updateInGroup(LLDrawable *drawablep, BOOL immediate) } -BOOL LLSpatialGroup::addObject(LLDrawable *drawablep, BOOL add_all, BOOL from_octree) +BOOL LLSpatialGroup::addObject(LLDrawable *drawablep) { - if (!from_octree) + if(!drawablep) { - mOctreeNode->insert(drawablep); + return FALSE; } - else { - drawablep->setSpatialGroup(this); + drawablep->setGroup(this); setState(OBJECT_DIRTY | GEOM_DIRTY); setOcclusionState(LLSpatialGroup::DISCARD_QUERY, LLSpatialGroup::STATE_MODE_ALL_CAMERAS); gPipeline.markRebuild(this, TRUE); @@ -650,9 +392,9 @@ void LLSpatialGroup::rebuildGeom() { if (!isDead()) { - mSpatialPartition->rebuildGeom(this); + getSpatialPartition()->rebuildGeom(this); - if (isState(LLSpatialGroup::MESH_DIRTY)) + if (hasState(LLSpatialGroup::MESH_DIRTY)) { gPipeline.markMeshDirty(this); } @@ -663,18 +405,18 @@ void LLSpatialGroup::rebuildMesh() { if (!isDead()) { - mSpatialPartition->rebuildMesh(this); + getSpatialPartition()->rebuildMesh(this); } } -static LLFastTimer::DeclareTimer FTM_REBUILD_VBO("VBO Rebuilt"); -static LLFastTimer::DeclareTimer FTM_ADD_GEOMETRY_COUNT("Add Geometry"); -static LLFastTimer::DeclareTimer FTM_CREATE_VB("Create VB"); -static LLFastTimer::DeclareTimer FTM_GET_GEOMETRY("Get Geometry"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_VBO("VBO Rebuilt"); +static LLTrace::BlockTimerStatHandle FTM_ADD_GEOMETRY_COUNT("Add Geometry"); +static LLTrace::BlockTimerStatHandle FTM_CREATE_VB("Create VB"); +static LLTrace::BlockTimerStatHandle FTM_GET_GEOMETRY("Get Geometry"); void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group) { - if (group->isDead() || !group->isState(LLSpatialGroup::GEOM_DIRTY)) + if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY)) { return; } @@ -685,7 +427,7 @@ void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group) group->mLastUpdateViewAngle = group->mViewAngle; } - LLFastTimer ftm(FTM_REBUILD_VBO); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_VBO); group->clearDrawMap(); @@ -694,14 +436,14 @@ void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group) U32 vertex_count = 0; { - LLFastTimer t(FTM_ADD_GEOMETRY_COUNT); + LL_RECORD_BLOCK_TIME(FTM_ADD_GEOMETRY_COUNT); addGeometryCount(group, vertex_count, index_count); } if (vertex_count > 0 && index_count > 0) { //create vertex buffer containing volume geometry for this node { - LLFastTimer t(FTM_CREATE_VB); + LL_RECORD_BLOCK_TIME(FTM_CREATE_VB); group->mBuilt = 1.f; if (group->mVertexBuffer.isNull() || !group->mVertexBuffer->isWriteable() || @@ -719,7 +461,7 @@ void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group) } { - LLFastTimer t(FTM_GET_GEOMETRY); + LL_RECORD_BLOCK_TIME(FTM_GET_GEOMETRY); getGeometry(group); } } @@ -739,137 +481,26 @@ void LLSpatialPartition::rebuildMesh(LLSpatialGroup* group) } -BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut) -{ - const OctreeNode* node = mOctreeNode; - - if (node->isEmpty()) - { //don't do anything if there are no objects - if (empty && mOctreeNode->getParent()) - { //only root is allowed to be empty - OCT_ERRS << "Empty leaf found in octree." << llendl; - } - return FALSE; - } - - LLVector4a& newMin = mObjectExtents[0]; - LLVector4a& newMax = mObjectExtents[1]; - - if (isState(OBJECT_DIRTY)) - { //calculate new bounding box - clearState(OBJECT_DIRTY); - - //initialize bounding box to first element - OctreeNode::const_element_iter i = node->getDataBegin(); - LLDrawable* drawablep = *i; - const LLVector4a* minMax = drawablep->getSpatialExtents(); - - newMin = minMax[0]; - newMax = minMax[1]; - - for (++i; i != node->getDataEnd(); ++i) - { - drawablep = *i; - minMax = drawablep->getSpatialExtents(); - - update_min_max(newMin, newMax, minMax[0]); - update_min_max(newMin, newMax, minMax[1]); - - //bin up the object - /*for (U32 i = 0; i < 3; i++) - { - if (minMax[0].mV[i] < newMin.mV[i]) - { - newMin.mV[i] = minMax[0].mV[i]; - } - if (minMax[1].mV[i] > newMax.mV[i]) - { - newMax.mV[i] = minMax[1].mV[i]; - } - }*/ - } - - mObjectBounds[0].setAdd(newMin, newMax); - mObjectBounds[0].mul(0.5f); - mObjectBounds[1].setSub(newMax, newMin); - mObjectBounds[1].mul(0.5f); - } - - if (empty) - { - minOut = newMin; - maxOut = newMax; - } - else - { - minOut.setMin(minOut, newMin); - maxOut.setMax(maxOut, newMax); - } - - return TRUE; -} - -void LLSpatialGroup::unbound() -{ - if (isState(DIRTY)) - { - return; - } - - setState(DIRTY); - - //all the parent nodes need to rebound this child - if (mOctreeNode) - { - OctreeNode* parent = (OctreeNode*) mOctreeNode->getParent(); - while (parent != NULL) - { - LLSpatialGroup* group = (LLSpatialGroup*) parent->getListener(0); - if (group->isState(DIRTY)) - { - return; - } - - group->setState(DIRTY); - parent = (OctreeNode*) parent->getParent(); - } - } -} - LLSpatialGroup* LLSpatialGroup::getParent() { - if (isDead()) - { - return NULL; + return (LLSpatialGroup*)LLViewerOctreeGroup::getParent(); } - if(!mOctreeNode) +BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree) { - return NULL; - } - OctreeNode* parent = mOctreeNode->getOctParent(); - - if (parent) + if(!drawablep) { - return (LLSpatialGroup*) parent->getListener(0); + return FALSE; } - return NULL; -} - -BOOL LLSpatialGroup::removeObject(LLDrawable *drawablep, BOOL from_octree) -{ unbound(); if (mOctreeNode && !from_octree) { - if (!mOctreeNode->remove(drawablep)) - { - OCT_ERRS << "Could not remove drawable from spatial group" << llendl; - } + drawablep->setGroup(NULL); } else { - drawablep->setSpatialGroup(NULL); + drawablep->setGroup(NULL); setState(GEOM_DIRTY); gPipeline.markRebuild(this, TRUE); @@ -906,22 +537,22 @@ void LLSpatialGroup::shift(const LLVector4a &offset) mObjectExtents[0].add(offset); mObjectExtents[1].add(offset); - if (!mSpatialPartition->mRenderByGroup && - mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_TREE && - mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_TERRAIN && - mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_BRIDGE) + if (!getSpatialPartition()->mRenderByGroup && + getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_TREE && + getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_TERRAIN && + getSpatialPartition()->mPartitionType != LLViewerRegion::PARTITION_BRIDGE) { setState(GEOM_DIRTY); gPipeline.markRebuild(this, TRUE); } } -class LLSpatialSetState : public LLSpatialGroup::OctreeTraveler +class LLSpatialSetState : public OctreeTraveler { public: U32 mState; LLSpatialSetState(U32 state) : mState(state) { } - virtual void visit(const LLSpatialGroup::OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->setState(mState); } + virtual void visit(const OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->setState(mState); } }; class LLSpatialSetStateDiff : public LLSpatialSetState @@ -929,24 +560,17 @@ class LLSpatialSetStateDiff : public LLSpatialSetState public: LLSpatialSetStateDiff(U32 state) : LLSpatialSetState(state) { } - virtual void traverse(const LLSpatialGroup::OctreeNode* n) + virtual void traverse(const OctreeNode* n) { LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0); - if (!group->isState(mState)) + if (!group->hasState(mState)) { - LLSpatialGroup::OctreeTraveler::traverse(n); + OctreeTraveler::traverse(n); } } }; -void LLSpatialGroup::setState(U32 state) -{ - mState |= state; - - llassert(state <= LLSpatialGroup::STATE_MASK); -} - void LLSpatialGroup::setState(U32 state, S32 mode) { llassert(state <= LLSpatialGroup::STATE_MASK); @@ -970,12 +594,12 @@ void LLSpatialGroup::setState(U32 state, S32 mode) } } -class LLSpatialClearState : public LLSpatialGroup::OctreeTraveler +class LLSpatialClearState : public OctreeTraveler { public: U32 mState; LLSpatialClearState(U32 state) : mState(state) { } - virtual void visit(const LLSpatialGroup::OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->clearState(mState); } + virtual void visit(const OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->clearState(mState); } }; class LLSpatialClearStateDiff : public LLSpatialClearState @@ -983,24 +607,17 @@ class LLSpatialClearStateDiff : public LLSpatialClearState public: LLSpatialClearStateDiff(U32 state) : LLSpatialClearState(state) { } - virtual void traverse(const LLSpatialGroup::OctreeNode* n) + virtual void traverse(const OctreeNode* n) { LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0); - if (group->isState(mState)) + if (group->hasState(mState)) { - LLSpatialGroup::OctreeTraveler::traverse(n); + OctreeTraveler::traverse(n); } } }; -void LLSpatialGroup::clearState(U32 state) -{ - llassert(state <= LLSpatialGroup::STATE_MASK); - - mState &= ~state; -} - void LLSpatialGroup::clearState(U32 state, S32 mode) { llassert(state <= LLSpatialGroup::STATE_MASK); @@ -1024,144 +641,15 @@ void LLSpatialGroup::clearState(U32 state, S32 mode) } } -BOOL LLSpatialGroup::isState(U32 state) const -{ - llassert(state <= LLSpatialGroup::STATE_MASK); - - return mState & state ? TRUE : FALSE; -} - -//===================================== -// Occlusion State Set/Clear -//===================================== -class LLSpatialSetOcclusionState : public LLSpatialGroup::OctreeTraveler -{ -public: - U32 mState; - LLSpatialSetOcclusionState(U32 state) : mState(state) { } - virtual void visit(const LLSpatialGroup::OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->setOcclusionState(mState); } -}; - -class LLSpatialSetOcclusionStateDiff : public LLSpatialSetOcclusionState -{ -public: - LLSpatialSetOcclusionStateDiff(U32 state) : LLSpatialSetOcclusionState(state) { } - - virtual void traverse(const LLSpatialGroup::OctreeNode* n) - { - LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0); - - if (!group->isOcclusionState(mState)) - { - LLSpatialGroup::OctreeTraveler::traverse(n); - } - } -}; - - -void LLSpatialGroup::setOcclusionState(U32 state, S32 mode) -{ - if (mode > STATE_MODE_SINGLE) - { - if (mode == STATE_MODE_DIFF) - { - LLSpatialSetOcclusionStateDiff setter(state); - setter.traverse(mOctreeNode); - } - else if (mode == STATE_MODE_BRANCH) - { - LLSpatialSetOcclusionState setter(state); - setter.traverse(mOctreeNode); - } - else - { - for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) - { - mOcclusionState[i] |= state; - - if ((state & DISCARD_QUERY) && mOcclusionQuery[i]) - { - sQueryPool.release(mOcclusionQuery[i]); - mOcclusionQuery[i] = 0; - } - } - } - } - else - { - mOcclusionState[LLViewerCamera::sCurCameraID] |= state; - if ((state & DISCARD_QUERY) && mOcclusionQuery[LLViewerCamera::sCurCameraID]) - { - sQueryPool.release(mOcclusionQuery[LLViewerCamera::sCurCameraID]); - mOcclusionQuery[LLViewerCamera::sCurCameraID] = 0; - } - } -} - -class LLSpatialClearOcclusionState : public LLSpatialGroup::OctreeTraveler -{ -public: - U32 mState; - - LLSpatialClearOcclusionState(U32 state) : mState(state) { } - virtual void visit(const LLSpatialGroup::OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->clearOcclusionState(mState); } -}; - -class LLSpatialClearOcclusionStateDiff : public LLSpatialClearOcclusionState -{ -public: - LLSpatialClearOcclusionStateDiff(U32 state) : LLSpatialClearOcclusionState(state) { } - - virtual void traverse(const LLSpatialGroup::OctreeNode* n) - { - LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0); - - if (group->isOcclusionState(mState)) - { - LLSpatialGroup::OctreeTraveler::traverse(n); - } - } -}; - -void LLSpatialGroup::clearOcclusionState(U32 state, S32 mode) -{ - if (mode > STATE_MODE_SINGLE) - { - if (mode == STATE_MODE_DIFF) - { - LLSpatialClearOcclusionStateDiff clearer(state); - clearer.traverse(mOctreeNode); - } - else if (mode == STATE_MODE_BRANCH) - { - LLSpatialClearOcclusionState clearer(state); - clearer.traverse(mOctreeNode); - } - else - { - for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) - { - mOcclusionState[i] &= ~state; - } - } - } - else - { - mOcclusionState[LLViewerCamera::sCurCameraID] &= ~state; - } -} //====================================== // Octree Listener Implementation //====================================== -LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) : +LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) : LLOcclusionCullingGroup(node, part), mObjectBoxSize(1.f), - mState(0), mGeometryBytes(0), mSurfaceArea(0.f), mBuilt(0.f), - mOctreeNode(node), - mSpatialPartition(part), mVertexBuffer(NULL), mBufferUsage(part->mBufferUsage), mDistance(0.f), @@ -1179,32 +667,11 @@ LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) : mViewAngle.splat(0.f); mLastUpdateViewAngle.splat(-1.f); - mExtents[0] = mExtents[1] = mObjectBounds[0] = mObjectBounds[0] = mObjectBounds[1] = - mObjectExtents[0] = mObjectExtents[1] = mViewAngle; sg_assert(mOctreeNode->getListenerCount() == 0); - mOctreeNode->addListener(this); setState(SG_INITIAL_STATE_MASK); gPipeline.markRebuild(this, TRUE); - mBounds[0] = node->getCenter(); - mBounds[1] = node->getSize(); - - part->mLODSeed = (part->mLODSeed+1)%part->mLODPeriod; - mLODHash = part->mLODSeed; - - OctreeNode* oct_parent = node->getOctParent(); - - LLSpatialGroup* parent = oct_parent ? (LLSpatialGroup*) oct_parent->getListener(0) : NULL; - - for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) - { - mOcclusionQuery[i] = 0; - mOcclusionIssued[i] = 0; - mOcclusionState[i] = parent ? SG_STATE_INHERIT_MASK & parent->mOcclusionState[i] : 0; - mVisible[i] = 0; - } - mRadius = 1; mPixelArea = 1024.f; } @@ -1213,7 +680,7 @@ void LLSpatialGroup::updateDistance(LLCamera &camera) { if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) { - llwarns << "Attempted to update distance for camera other than world camera!" << llendl; + LL_WARNS() << "Attempted to update distance for camera other than world camera!" << LL_ENDL; return; } @@ -1223,17 +690,17 @@ void LLSpatialGroup::updateDistance(LLCamera &camera) } #if !LL_RELEASE_FOR_DOWNLOAD - if (isState(LLSpatialGroup::OBJECT_DIRTY)) + if (hasState(LLSpatialGroup::OBJECT_DIRTY)) { - llerrs << "Spatial group dirty on distance update." << llendl; + LL_ERRS() << "Spatial group dirty on distance update." << LL_ENDL; } #endif if (!isEmpty()) { - mRadius = mSpatialPartition->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() : + mRadius = getSpatialPartition()->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() : (F32) mOctreeNode->getSize().getLength3().getF32(); - mDistance = mSpatialPartition->calcDistance(this, camera); - mPixelArea = mSpatialPartition->calcPixelArea(this, camera); + mDistance = getSpatialPartition()->calcDistance(this, camera); + mPixelArea = getSpatialPartition()->calcPixelArea(this, camera); } } @@ -1254,9 +721,9 @@ F32 LLSpatialPartition::calcDistance(LLSpatialGroup* group, LLCamera& camera) dist = eye.getLength3().getF32(); eye.normalize3fast(); - if (!group->isState(LLSpatialGroup::ALPHA_DIRTY)) + if (!group->hasState(LLSpatialGroup::ALPHA_DIRTY)) { - if (!group->mSpatialPartition->isBridge()) + if (!group->getSpatialPartition()->isBridge()) { LLVector4a view_angle = eye; @@ -1324,23 +791,18 @@ F32 LLSpatialGroup::getUpdateUrgency() const } } -BOOL LLSpatialGroup::needsUpdate() -{ - return (LLDrawable::getCurrentFrame()%mSpatialPartition->mLODPeriod == mLODHash) ? TRUE : FALSE; -} - BOOL LLSpatialGroup::changeLOD() { - if (isState(ALPHA_DIRTY | OBJECT_DIRTY)) + if (hasState(ALPHA_DIRTY | OBJECT_DIRTY)) { ///a rebuild is going to happen, update distance and LoD return TRUE; } - if (mSpatialPartition->mSlopRatio > 0.f) + if (getSpatialPartition()->mSlopRatio > 0.f) { F32 ratio = (mDistance - mLastUpdateDistance)/(llmax(mLastUpdateDistance, mRadius)); - if (fabsf(ratio) >= mSpatialPartition->mSlopRatio) + if (fabsf(ratio) >= getSpatialPartition()->mSlopRatio) { return TRUE; } @@ -1359,405 +821,110 @@ BOOL LLSpatialGroup::changeLOD() return FALSE; } -void LLSpatialGroup::handleInsertion(const TreeNode* node, LLDrawable* drawablep) +void LLSpatialGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry* entry) { - addObject(drawablep, FALSE, TRUE); + addObject((LLDrawable*)entry->getDrawable()); unbound(); setState(OBJECT_DIRTY); } -void LLSpatialGroup::handleRemoval(const TreeNode* node, LLDrawable* drawable) +void LLSpatialGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntry* entry) { - removeObject(drawable, TRUE); - setState(OBJECT_DIRTY); + removeObject((LLDrawable*)entry->getDrawable(), TRUE); + LLViewerOctreeGroup::handleRemoval(node, entry); } void LLSpatialGroup::handleDestruction(const TreeNode* node) { - setState(DEAD); - - for (element_iter i = getDataBegin(); i != getDataEnd(); ++i) - { - LLDrawable* drawable = *i; - if (drawable->getSpatialGroup() == this) - { - drawable->setSpatialGroup(NULL); - } - } - - //clean up avatar attachment stats - LLSpatialBridge* bridge = mSpatialPartition->asBridge(); - if (bridge) - { - if (bridge->mAvatar.notNull()) - { - bridge->mAvatar->mAttachmentGeometryBytes -= mGeometryBytes; - bridge->mAvatar->mAttachmentGeometryBytes = llmax(bridge->mAvatar->mAttachmentGeometryBytes, 0); - bridge->mAvatar->mAttachmentSurfaceArea -= mSurfaceArea; - bridge->mAvatar->mAttachmentSurfaceArea = llmax(bridge->mAvatar->mAttachmentSurfaceArea, 0.f); - } - } - - clearDrawMap(); - mVertexBuffer = NULL; - mBufferMap.clear(); - sZombieGroups++; - mOctreeNode = NULL; -} - -void LLSpatialGroup::handleStateChange(const TreeNode* node) -{ - //drop bounding box upon state change - if (mOctreeNode != node) + if(isDead()) { - mOctreeNode = (OctreeNode*) node; + return; } - unbound(); -} + setState(DEAD); -void LLSpatialGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child) -{ - if (child->getListenerCount() == 0) - { - new LLSpatialGroup(child, mSpatialPartition); - } - else + for (element_iter i = getDataBegin(); i != getDataEnd(); ++i) { - OCT_ERRS << "LLSpatialGroup redundancy detected." << llendl; - } - - unbound(); - - assert_states_valid(this); -} - -void LLSpatialGroup::handleChildRemoval(const OctreeNode* parent, const OctreeNode* child) -{ - unbound(); -} - -void LLSpatialGroup::destroyGL(bool keep_occlusion) -{ - setState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::IMAGE_DIRTY); - - if (!keep_occlusion) - { //going to need a rebuild - gPipeline.markRebuild(this, TRUE); - } - - mLastUpdateTime = gFrameTimeSeconds; - mVertexBuffer = NULL; - mBufferMap.clear(); + LLViewerOctreeEntry* entry = *i; - clearDrawMap(); - - if (!keep_occlusion) - { - for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) + if (entry->getGroup() == this) { - if (mOcclusionQuery[i]) + if(entry->hasDrawable()) { - sQueryPool.release(mOcclusionQuery[i]); - mOcclusionQuery[i] = 0; + ((LLDrawable*)entry->getDrawable())->setGroup(NULL); } } } - - - for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i) + + //clean up avatar attachment stats + LLSpatialBridge* bridge = getSpatialPartition()->asBridge(); + if (bridge) { - LLDrawable* drawable = *i; - for (S32 j = 0; j < drawable->getNumFaces(); j++) + if (bridge->mAvatar.notNull()) { - LLFace* facep = drawable->getFace(j); - if (facep) - { - facep->clearVertexBuffer(); - } + bridge->mAvatar->mAttachmentGeometryBytes -= mGeometryBytes; + bridge->mAvatar->mAttachmentGeometryBytes = llmax(bridge->mAvatar->mAttachmentGeometryBytes, 0); + bridge->mAvatar->mAttachmentSurfaceArea -= mSurfaceArea; + bridge->mAvatar->mAttachmentSurfaceArea = llmax(bridge->mAvatar->mAttachmentSurfaceArea, 0.f); } } + + clearDrawMap(); + mVertexBuffer = NULL; + mBufferMap.clear(); + sZombieGroups++; + mOctreeNode = NULL; } -BOOL LLSpatialGroup::rebound() +void LLSpatialGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child) { - if (!isState(DIRTY)) - { //return TRUE if we're not empty - return TRUE; - } - - if (mOctreeNode->getChildCount() == 1 && mOctreeNode->getElementCount() == 0) + if (child->getListenerCount() == 0) { - LLSpatialGroup* group = (LLSpatialGroup*) mOctreeNode->getChild(0)->getListener(0); - - //rebound single child - group->rebound(); - - //copy single child's bounding box - mBounds[0] = group->mBounds[0]; - mBounds[1] = group->mBounds[1]; - mExtents[0] = group->mExtents[0]; - mExtents[1] = group->mExtents[1]; - - //treat this node as a "chute" to a deeper level of the tree - group->setState(SKIP_FRUSTUM_CHECK); - } - else if (mOctreeNode->isLeaf()) - { //copy object bounding box if this is a leaf - boundObjects(TRUE, mExtents[0], mExtents[1]); - mBounds[0] = mObjectBounds[0]; - mBounds[1] = mObjectBounds[1]; + new LLSpatialGroup(child, getSpatialPartition()); } else { - LLVector4a& newMin = mExtents[0]; - LLVector4a& newMax = mExtents[1]; - - //get bounding box of first child - LLSpatialGroup* group = (LLSpatialGroup*) mOctreeNode->getChild(0)->getListener(0); - group->clearState(SKIP_FRUSTUM_CHECK); - group->rebound(); - - //initialize to first child - newMin = group->mExtents[0]; - newMax = group->mExtents[1]; - - //rebound remaining children, expanding bounding box to encompass children - for (U32 i = 1; i < mOctreeNode->getChildCount(); i++) - { - group = (LLSpatialGroup*) mOctreeNode->getChild(i)->getListener(0); - group->clearState(SKIP_FRUSTUM_CHECK); - group->rebound(); - const LLVector4a& max = group->mExtents[1]; - const LLVector4a& min = group->mExtents[0]; - - newMax.setMax(newMax, max); - newMin.setMin(newMin, min); - } - - boundObjects(FALSE, newMin, newMax); - - mBounds[0].setAdd(newMin, newMax); - mBounds[0].mul(0.5f); - mBounds[1].setSub(newMax, newMin); - mBounds[1].mul(0.5f); + OCT_ERRS << "LLSpatialGroup redundancy detected." << LL_ENDL; } - - clearState(DIRTY); - return TRUE; -} + unbound(); -static LLFastTimer::DeclareTimer FTM_OCCLUSION_READBACK("Readback Occlusion"); -static LLFastTimer::DeclareTimer FTM_OCCLUSION_WAIT("Occlusion Wait"); + assert_states_valid(this); +} -void LLSpatialGroup::checkOcclusion() +void LLSpatialGroup::destroyGL(bool keep_occlusion) { - if (LLPipeline::sUseOcclusion > 1) - { - LLFastTimer t(FTM_OCCLUSION_READBACK); - LLSpatialGroup* parent = getParent(); - if (parent && parent->isOcclusionState(LLSpatialGroup::OCCLUDED)) - { //if the parent has been marked as occluded, the child is implicitly occluded - clearOcclusionState(QUERY_PENDING | DISCARD_QUERY); - } - else if (isOcclusionState(QUERY_PENDING)) - { //otherwise, if a query is pending, read it back - - GLuint available = 0; - if (mOcclusionQuery[LLViewerCamera::sCurCameraID]) - { - glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available); - - static LLCachedControl<bool> wait_for_query(gSavedSettings, "RenderSynchronousOcclusion", true); + setState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::IMAGE_DIRTY); - if (wait_for_query && mOcclusionIssued[LLViewerCamera::sCurCameraID] < gFrameCount) - { //query was issued last frame, wait until it's available - S32 max_loop = 1024; - LLFastTimer t(FTM_OCCLUSION_WAIT); - while (!available && max_loop-- > 0) - { - F32 max_time = llmin(gFrameIntervalSeconds*10.f, 1.f); - //do some usefu work while we wait - LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread - LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread - LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread - - glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available); - } - } - } - else - { - available = 1; - } + if (!keep_occlusion) + { //going to need a rebuild + gPipeline.markRebuild(this, TRUE); + } - if (available) - { //result is available, read it back, otherwise wait until next frame - GLuint res = 1; - if (!isOcclusionState(DISCARD_QUERY) && mOcclusionQuery[LLViewerCamera::sCurCameraID]) - { - glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_ARB, &res); -#if LL_TRACK_PENDING_OCCLUSION_QUERIES - sPendingQueries.erase(mOcclusionQuery[LLViewerCamera::sCurCameraID]); -#endif - } - else if (mOcclusionQuery[LLViewerCamera::sCurCameraID]) - { //delete the query to avoid holding onto hundreds of pending queries - sQueryPool.release(mOcclusionQuery[LLViewerCamera::sCurCameraID]); - mOcclusionQuery[LLViewerCamera::sCurCameraID] = 0; - } - - if (isOcclusionState(DISCARD_QUERY)) - { - res = 2; - } + mLastUpdateTime = gFrameTimeSeconds; + mVertexBuffer = NULL; + mBufferMap.clear(); - if (res > 0) - { - assert_states_valid(this); - clearOcclusionState(LLSpatialGroup::OCCLUDED, LLSpatialGroup::STATE_MODE_DIFF); - assert_states_valid(this); - } - else - { - assert_states_valid(this); - - setOcclusionState(LLSpatialGroup::OCCLUDED, LLSpatialGroup::STATE_MODE_DIFF); - - assert_states_valid(this); - } + clearDrawMap(); - clearOcclusionState(QUERY_PENDING | DISCARD_QUERY); - } - } - else if (mSpatialPartition->isOcclusionEnabled() && isOcclusionState(LLSpatialGroup::OCCLUDED)) - { //check occlusion has been issued for occluded node that has not had a query issued - assert_states_valid(this); - clearOcclusionState(LLSpatialGroup::OCCLUDED, LLSpatialGroup::STATE_MODE_DIFF); - assert_states_valid(this); - } + if (!keep_occlusion) + { + releaseOcclusionQueryObjectNames(); } -} -static LLFastTimer::DeclareTimer FTM_PUSH_OCCLUSION_VERTS("Push Occlusion"); -static LLFastTimer::DeclareTimer FTM_SET_OCCLUSION_STATE("Occlusion State"); -static LLFastTimer::DeclareTimer FTM_OCCLUSION_EARLY_FAIL("Occlusion Early Fail"); -static LLFastTimer::DeclareTimer FTM_OCCLUSION_ALLOCATE("Allocate"); -static LLFastTimer::DeclareTimer FTM_OCCLUSION_BUILD("Build"); -static LLFastTimer::DeclareTimer FTM_OCCLUSION_BEGIN_QUERY("Begin Query"); -static LLFastTimer::DeclareTimer FTM_OCCLUSION_END_QUERY("End Query"); -static LLFastTimer::DeclareTimer FTM_OCCLUSION_SET_BUFFER("Set Buffer"); -static LLFastTimer::DeclareTimer FTM_OCCLUSION_DRAW_WATER("Draw Water"); -static LLFastTimer::DeclareTimer FTM_OCCLUSION_DRAW("Draw"); - - -void LLSpatialGroup::doOcclusion(LLCamera* camera) -{ - if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1) + for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i) { - // Don't cull hole/edge water, unless we have the GL_ARB_depth_clamp extension - if (earlyFail(camera, this)) + LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable(); + if(!drawable) { - LLFastTimer t(FTM_OCCLUSION_EARLY_FAIL); - setOcclusionState(LLSpatialGroup::DISCARD_QUERY); - assert_states_valid(this); - clearOcclusionState(LLSpatialGroup::OCCLUDED, LLSpatialGroup::STATE_MODE_DIFF); - assert_states_valid(this); + continue; } - else + for (S32 j = 0; j < drawable->getNumFaces(); j++) { - if (!isOcclusionState(QUERY_PENDING) || isOcclusionState(DISCARD_QUERY)) + LLFace* facep = drawable->getFace(j); + if (facep) { - { //no query pending, or previous query to be discarded - LLFastTimer t(FTM_RENDER_OCCLUSION); - - if (!mOcclusionQuery[LLViewerCamera::sCurCameraID]) - { - LLFastTimer t(FTM_OCCLUSION_ALLOCATE); - mOcclusionQuery[LLViewerCamera::sCurCameraID] = sQueryPool.allocate(); - } - - // Depth clamp all water to avoid it being culled as a result of being - // behind the far clip plane, and in the case of edge water to avoid - // it being culled while still visible. - bool const use_depth_clamp = gGLManager.mHasDepthClamp && - (mSpatialPartition->mDrawableType == LLDrawPool::POOL_WATER || - mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER); - - LLGLEnable clamp(use_depth_clamp ? GL_DEPTH_CLAMP : 0); - -#if !LL_DARWIN - U32 mode = gGLManager.mHasOcclusionQuery2 ? GL_ANY_SAMPLES_PASSED : GL_SAMPLES_PASSED_ARB; -#else - U32 mode = GL_SAMPLES_PASSED_ARB; -#endif - -#if LL_TRACK_PENDING_OCCLUSION_QUERIES - sPendingQueries.insert(mOcclusionQuery[LLViewerCamera::sCurCameraID]); -#endif - - { - LLFastTimer t(FTM_PUSH_OCCLUSION_VERTS); - - //store which frame this query was issued on - mOcclusionIssued[LLViewerCamera::sCurCameraID] = gFrameCount; - - { - LLFastTimer t(FTM_OCCLUSION_BEGIN_QUERY); - glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]); - } - - LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - llassert(shader); - - shader->uniform3fv(LLShaderMgr::BOX_CENTER, 1, mBounds[0].getF32ptr()); - shader->uniform3f(LLShaderMgr::BOX_SIZE, mBounds[1][0]+SG_OCCLUSION_FUDGE, - mBounds[1][1]+SG_OCCLUSION_FUDGE, - mBounds[1][2]+SG_OCCLUSION_FUDGE); - - if (!use_depth_clamp && mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER) - { - LLFastTimer t(FTM_OCCLUSION_DRAW_WATER); - - LLGLSquashToFarClip squash(glh_get_current_projection(), 1); - if (camera->getOrigin().isExactlyZero()) - { //origin is invalid, draw entire box - gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0); - gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8); - } - else - { - gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, mBounds[0])); - } - } - else - { - LLFastTimer t(FTM_OCCLUSION_DRAW); - if (camera->getOrigin().isExactlyZero()) - { //origin is invalid, draw entire box - gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0); - gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8); - } - else - { - gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, mBounds[0])); - } - } - - - { - LLFastTimer t(FTM_OCCLUSION_END_QUERY); - glEndQueryARB(mode); - } - } - } - - { - LLFastTimer t(FTM_SET_OCCLUSION_STATE); - setOcclusionState(LLSpatialGroup::QUERY_PENDING); - clearOcclusionState(LLSpatialGroup::DISCARD_QUERY); - } + facep->clearVertexBuffer(); } } } @@ -1765,37 +932,25 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera) //============================================== -LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 buffer_usage) +LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 buffer_usage, LLViewerRegion* regionp) : mRenderByGroup(render_by_group), mBridge(NULL) { - mOcclusionEnabled = TRUE; - mDrawableType = 0; + mRegionp = regionp; mPartitionType = LLViewerRegion::PARTITION_NONE; - mLODSeed = 0; - mLODPeriod = 1; mVertexDataMask = data_mask; mBufferUsage = buffer_usage; mDepthMask = FALSE; mSlopRatio = 0.25f; mInfiniteFarClip = FALSE; - LLVector4a center, size; - center.splat(0.f); - size.splat(1.f); - - mOctree = new LLSpatialGroup::OctreeRoot(center,size, - NULL); new LLSpatialGroup(mOctree, this); } LLSpatialPartition::~LLSpatialPartition() { - delete mOctree; - mOctree = NULL; } - LLSpatialGroup *LLSpatialPartition::put(LLDrawable *drawablep, BOOL was_visible) { drawablep->updateSpatialExtents(); @@ -1803,11 +958,15 @@ LLSpatialGroup *LLSpatialPartition::put(LLDrawable *drawablep, BOOL was_visible) //keep drawable from being garbage collected LLPointer<LLDrawable> ptr = drawablep; + if(!drawablep->getGroup()) + { assert_octree_valid(mOctree); - mOctree->insert(drawablep); + mOctree->insert(drawablep->getEntry()); assert_octree_valid(mOctree); + } LLSpatialGroup* group = drawablep->getSpatialGroup(); + llassert(group != NULL); if (group && was_visible && group->isOcclusionState(LLSpatialGroup::QUERY_PENDING)) { @@ -1821,15 +980,13 @@ BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp) { if (!curp->removeObject(drawablep)) { - OCT_ERRS << "Failed to remove drawable from octree!" << llendl; + OCT_ERRS << "Failed to remove drawable from octree!" << LL_ENDL; } else { - drawablep->setSpatialGroup(NULL); + drawablep->setGroup(NULL); } - drawablep->setSpatialGroup(NULL); - assert_octree_valid(mOctree); return TRUE; @@ -1841,24 +998,24 @@ void LLSpatialPartition::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL // who was seeing crashing here. (See VWR-424 reported by Bunny Mayne) if (!drawablep) { - OCT_ERRS << "LLSpatialPartition::move was passed a bad drawable." << llendl; + OCT_ERRS << "LLSpatialPartition::move was passed a bad drawable." << LL_ENDL; return; } BOOL was_visible = curp ? curp->isVisible() : FALSE; - if (curp && curp->mSpatialPartition != this) + if (curp && curp->getSpatialPartition() != this) { //keep drawable from being garbage collected LLPointer<LLDrawable> ptr = drawablep; - if (curp->mSpatialPartition->remove(drawablep, curp)) + if (curp->getSpatialPartition()->remove(drawablep, curp)) { put(drawablep, was_visible); return; } else { - OCT_ERRS << "Drawable lost between spatial partitions on outbound transition." << llendl; + OCT_ERRS << "Drawable lost between spatial partitions on outbound transition." << LL_ENDL; } } @@ -1873,19 +1030,19 @@ void LLSpatialPartition::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL LLPointer<LLDrawable> ptr = drawablep; if (curp && !remove(drawablep, curp)) { - OCT_ERRS << "Move couldn't find existing spatial group!" << llendl; + OCT_ERRS << "Move couldn't find existing spatial group!" << LL_ENDL; } put(drawablep, was_visible); } -class LLSpatialShift : public LLSpatialGroup::OctreeTraveler +class LLSpatialShift : public OctreeTraveler { public: const LLVector4a& mOffset; LLSpatialShift(const LLVector4a& offset) : mOffset(offset) { } - virtual void visit(const LLSpatialGroup::OctreeNode* branch) + virtual void visit(const OctreeNode* branch) { ((LLSpatialGroup*) branch->getListener(0))->shift(mOffset); } @@ -1897,17 +1054,17 @@ void LLSpatialPartition::shift(const LLVector4a &offset) shifter.traverse(mOctree); } -class LLOctreeCull : public LLSpatialGroup::OctreeTraveler +class LLOctreeCull : public LLViewerOctreeCull { public: - LLOctreeCull(LLCamera* camera) - : mCamera(camera), mRes(0) { } + LLOctreeCull(LLCamera* camera) : LLViewerOctreeCull(camera) {} - virtual bool earlyFail(LLSpatialGroup* group) + virtual bool earlyFail(LLViewerOctreeGroup* base_group) { + LLSpatialGroup* group = (LLSpatialGroup*)base_group; group->checkOcclusion(); - if (group->mOctreeNode->getParent() && //never occlusion cull the root node + if (group->getOctreeNode()->getParent() && //never occlusion cull the root node LLPipeline::sUseOcclusion && //ignore occlusion if disabled group->isOcclusionState(LLSpatialGroup::OCCLUDED)) { @@ -1918,100 +1075,36 @@ class LLOctreeCull : public LLSpatialGroup::OctreeTraveler return false; } - virtual void traverse(const LLSpatialGroup::OctreeNode* n) - { - LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0); - - if (earlyFail(group)) - { - return; - } - - if (mRes == 2 || - (mRes && group->isState(LLSpatialGroup::SKIP_FRUSTUM_CHECK))) - { //fully in, just add everything - LLSpatialGroup::OctreeTraveler::traverse(n); - } - else - { - mRes = frustumCheck(group); - - if (mRes) - { //at least partially in, run on down - LLSpatialGroup::OctreeTraveler::traverse(n); - } - - mRes = 0; - } - } - - virtual S32 frustumCheck(const LLSpatialGroup* group) + virtual S32 frustumCheck(const LLViewerOctreeGroup* group) { - S32 res = mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1]); + S32 res = AABBInFrustumNoFarClipGroupBounds(group); if (res != 0) { - res = llmin(res, AABBSphereIntersect(group->mExtents[0], group->mExtents[1], mCamera->getOrigin(), mCamera->mFrustumCornerDist)); + res = llmin(res, AABBSphereIntersectGroupExtents(group)); } return res; } - virtual S32 frustumCheckObjects(const LLSpatialGroup* group) + virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) { - S32 res = mCamera->AABBInFrustumNoFarClip(group->mObjectBounds[0], group->mObjectBounds[1]); + S32 res = AABBInFrustumNoFarClipObjectBounds(group); if (res != 0) { - res = llmin(res, AABBSphereIntersect(group->mObjectExtents[0], group->mObjectExtents[1], mCamera->getOrigin(), mCamera->mFrustumCornerDist)); + res = llmin(res, AABBSphereIntersectObjectExtents(group)); } return res; } - virtual bool checkObjects(const LLSpatialGroup::OctreeNode* branch, const LLSpatialGroup* group) - { - if (branch->getElementCount() == 0) //no elements - { - return false; - } - else if (branch->getChildCount() == 0) //leaf state, already checked tightest bounding box - { - return true; - } - else if (mRes == 1 && !frustumCheckObjects(group)) //no objects in frustum - { - return false; - } - - return true; - } - - virtual void preprocess(LLSpatialGroup* group) - { - - } - - virtual void processGroup(LLSpatialGroup* group) + virtual void processGroup(LLViewerOctreeGroup* base_group) { + LLSpatialGroup* group = (LLSpatialGroup*)base_group; if (group->needsUpdate() || - group->mVisible[LLViewerCamera::sCurCameraID] < LLDrawable::getCurrentFrame() - 1) + group->getVisible(LLViewerCamera::sCurCameraID) < LLDrawable::getCurrentFrame() - 1) { group->doOcclusion(mCamera); } gPipeline.markNotCulled(group, *mCamera); } - - virtual void visit(const LLSpatialGroup::OctreeNode* branch) - { - LLSpatialGroup* group = (LLSpatialGroup*) branch->getListener(0); - - preprocess(group); - - if (checkObjects(branch, group)) - { - processGroup(group); - } - } - - LLCamera *mCamera; - S32 mRes; }; class LLOctreeCullNoFarClip : public LLOctreeCull @@ -2020,14 +1113,14 @@ class LLOctreeCullNoFarClip : public LLOctreeCull LLOctreeCullNoFarClip(LLCamera* camera) : LLOctreeCull(camera) { } - virtual S32 frustumCheck(const LLSpatialGroup* group) + virtual S32 frustumCheck(const LLViewerOctreeGroup* group) { - return mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1]); + return AABBInFrustumNoFarClipGroupBounds(group); } - virtual S32 frustumCheckObjects(const LLSpatialGroup* group) + virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) { - S32 res = mCamera->AABBInFrustumNoFarClip(group->mObjectBounds[0], group->mObjectBounds[1]); + S32 res = AABBInFrustumNoFarClipObjectBounds(group); return res; } }; @@ -2038,14 +1131,14 @@ class LLOctreeCullShadow : public LLOctreeCull LLOctreeCullShadow(LLCamera* camera) : LLOctreeCull(camera) { } - virtual S32 frustumCheck(const LLSpatialGroup* group) + virtual S32 frustumCheck(const LLViewerOctreeGroup* group) { - return mCamera->AABBInFrustum(group->mBounds[0], group->mBounds[1]); + return AABBInFrustumGroupBounds(group); } - virtual S32 frustumCheckObjects(const LLSpatialGroup* group) + virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) { - return mCamera->AABBInFrustum(group->mObjectBounds[0], group->mObjectBounds[1]); + return AABBInFrustumObjectBounds(group); } }; @@ -2055,9 +1148,11 @@ class LLOctreeCullVisExtents: public LLOctreeCullShadow LLOctreeCullVisExtents(LLCamera* camera, LLVector4a& min, LLVector4a& max) : LLOctreeCullShadow(camera), mMin(min), mMax(max), mEmpty(TRUE) { } - virtual bool earlyFail(LLSpatialGroup* group) + virtual bool earlyFail(LLViewerOctreeGroup* base_group) { - if (group->mOctreeNode->getParent() && //never occlusion cull the root node + LLSpatialGroup* group = (LLSpatialGroup*)base_group; + + if (group->getOctreeNode()->getParent() && //never occlusion cull the root node LLPipeline::sUseOcclusion && //ignore occlusion if disabled group->isOcclusionState(LLSpatialGroup::OCCLUDED)) { @@ -2067,7 +1162,7 @@ class LLOctreeCullVisExtents: public LLOctreeCullShadow return false; } - virtual void traverse(const LLSpatialGroup::OctreeNode* n) + virtual void traverse(const OctreeNode* n) { LLSpatialGroup* group = (LLSpatialGroup*) n->getListener(0); @@ -2076,10 +1171,10 @@ class LLOctreeCullVisExtents: public LLOctreeCullShadow return; } - if ((mRes && group->isState(LLSpatialGroup::SKIP_FRUSTUM_CHECK)) || + if ((mRes && group->hasState(LLSpatialGroup::SKIP_FRUSTUM_CHECK)) || mRes == 2) { //don't need to do frustum check - LLSpatialGroup::OctreeTraveler::traverse(n); + OctreeTraveler::traverse(n); } else { @@ -2087,31 +1182,35 @@ class LLOctreeCullVisExtents: public LLOctreeCullShadow if (mRes) { //at least partially in, run on down - LLSpatialGroup::OctreeTraveler::traverse(n); + OctreeTraveler::traverse(n); } mRes = 0; } } - virtual void processGroup(LLSpatialGroup* group) + virtual void processGroup(LLViewerOctreeGroup* base_group) { - llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->isEmpty()) + LLSpatialGroup* group = (LLSpatialGroup*)base_group; + + llassert(!group->hasState(LLSpatialGroup::DIRTY) && !group->isEmpty()); if (mRes < 2) { - if (mCamera->AABBInFrustum(group->mObjectBounds[0], group->mObjectBounds[1]) > 0) + if (AABBInFrustumObjectBounds(group) > 0) { mEmpty = FALSE; - update_min_max(mMin, mMax, group->mObjectExtents[0]); - update_min_max(mMin, mMax, group->mObjectExtents[1]); + const LLVector4a* exts = group->getObjectExtents(); + update_min_max(mMin, mMax, exts[0]); + update_min_max(mMin, mMax, exts[1]); } } else { mEmpty = FALSE; - update_min_max(mMin, mMax, group->mExtents[0]); - update_min_max(mMin, mMax, group->mExtents[1]); + const LLVector4a* exts = group->getExtents(); + update_min_max(mMin, mMax, exts[0]); + update_min_max(mMin, mMax, exts[1]); } } @@ -2126,10 +1225,12 @@ class LLOctreeCullDetectVisible: public LLOctreeCullShadow LLOctreeCullDetectVisible(LLCamera* camera) : LLOctreeCullShadow(camera), mResult(FALSE) { } - virtual bool earlyFail(LLSpatialGroup* group) + virtual bool earlyFail(LLViewerOctreeGroup* base_group) { + LLSpatialGroup* group = (LLSpatialGroup*)base_group; + if (mResult || //already found a node, don't check any more - (group->mOctreeNode->getParent() && //never occlusion cull the root node + (group->getOctreeNode()->getParent() && //never occlusion cull the root node LLPipeline::sUseOcclusion && //ignore occlusion if disabled group->isOcclusionState(LLSpatialGroup::OCCLUDED))) { @@ -2139,9 +1240,9 @@ class LLOctreeCullDetectVisible: public LLOctreeCullShadow return false; } - virtual void processGroup(LLSpatialGroup* group) + virtual void processGroup(LLViewerOctreeGroup* base_group) { - if (group->isVisible()) + if (base_group->isVisible()) { mResult = TRUE; } @@ -2156,17 +1257,21 @@ class LLOctreeSelect : public LLOctreeCull LLOctreeSelect(LLCamera* camera, std::vector<LLDrawable*>* results) : LLOctreeCull(camera), mResults(results) { } - virtual bool earlyFail(LLSpatialGroup* group) { return false; } - virtual void preprocess(LLSpatialGroup* group) { } + virtual bool earlyFail(LLViewerOctreeGroup* group) { return false; } + virtual void preprocess(LLViewerOctreeGroup* group) { } - virtual void processGroup(LLSpatialGroup* group) + virtual void processGroup(LLViewerOctreeGroup* base_group) { - LLSpatialGroup::OctreeNode* branch = group->mOctreeNode; + LLSpatialGroup* group = (LLSpatialGroup*)base_group; + OctreeNode* branch = group->getOctreeNode(); - for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) + for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) { - LLDrawable* drawable = *i; - + LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable(); + if(!drawable) + { + continue; + } if (!drawable->isDead()) { if (drawable->isSpatialBridge()) @@ -2291,18 +1396,24 @@ void drawBoxOutline(const LLVector4a& pos, const LLVector4a& size) drawBoxOutline(reinterpret_cast<const LLVector3&>(pos), reinterpret_cast<const LLVector3&>(size)); } -class LLOctreeDirty : public LLOctreeTraveler<LLDrawable> +class LLOctreeDirty : public OctreeTraveler { public: - virtual void visit(const LLOctreeNode<LLDrawable>* state) + LLOctreeDirty(bool no_rebuild) : mNoRebuild(no_rebuild){} + + virtual void visit(const OctreeNode* state) { LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0); group->destroyGL(); for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { - LLDrawable* drawable = *i; - if (drawable->getVObj().notNull() && !group->mSpatialPartition->mRenderByGroup) + LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable(); + if(!drawable) + { + continue; + } + if (!mNoRebuild && drawable->getVObj().notNull() && !group->getSpatialPartition()->mRenderByGroup) { gPipeline.markRebuild(drawable, LLDrawable::REBUILD_ALL, TRUE); } @@ -2314,6 +1425,9 @@ class LLOctreeDirty : public LLOctreeTraveler<LLDrawable> traverse(bridge->mOctree); } } + +private: + BOOL mNoRebuild; }; void LLSpatialPartition::restoreGL() @@ -2322,15 +1436,10 @@ void LLSpatialPartition::restoreGL() void LLSpatialPartition::resetVertexBuffers() { - LLOctreeDirty dirty; + LLOctreeDirty dirty(sTeleportRequested); dirty.traverse(mOctree); } -BOOL LLSpatialPartition::isOcclusionEnabled() -{ - return mOcclusionEnabled || LLPipeline::sUseOcclusion > 2; -} - BOOL LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax) { LLVector4a visMina, visMaxa; @@ -2338,7 +1447,7 @@ BOOL LLSpatialPartition::getVisibleExtents(LLCamera& camera, LLVector3& visMin, visMaxa.load3(visMax.mV); { - LLFastTimer ftm(FTM_CULL_REBOUND); + LL_RECORD_BLOCK_TIME(FTM_CULL_REBOUND); LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0); group->rebound(); } @@ -2364,7 +1473,7 @@ S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* result ((LLSpatialGroup*)mOctree->getListener(0))->checkStates(); #endif { - LLFastTimer ftm(FTM_CULL_REBOUND); + LL_RECORD_BLOCK_TIME(FTM_CULL_REBOUND); LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0); group->rebound(); } @@ -2373,27 +1482,42 @@ S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* result ((LLSpatialGroup*)mOctree->getListener(0))->validate(); #endif - - if (for_select) - { LLOctreeSelect selecter(&camera, results); selecter.traverse(mOctree); + + return 0; + } + +S32 LLSpatialPartition::cull(LLCamera &camera, bool do_occlusion) +{ +#if LL_OCTREE_PARANOIA_CHECK + ((LLSpatialGroup*)mOctree->getListener(0))->checkStates(); +#endif + { + LL_RECORD_BLOCK_TIME(FTM_CULL_REBOUND); + LLSpatialGroup* group = (LLSpatialGroup*) mOctree->getListener(0); + group->rebound(); } - else if (LLPipeline::sShadowRender) + +#if LL_OCTREE_PARANOIA_CHECK + ((LLSpatialGroup*)mOctree->getListener(0))->validate(); +#endif + + if (LLPipeline::sShadowRender) { - LLFastTimer ftm(FTM_FRUSTUM_CULL); + LL_RECORD_BLOCK_TIME(FTM_FRUSTUM_CULL); LLOctreeCullShadow culler(&camera); culler.traverse(mOctree); } else if (mInfiniteFarClip || !LLPipeline::sUseFarClip) { - LLFastTimer ftm(FTM_FRUSTUM_CULL); + LL_RECORD_BLOCK_TIME(FTM_FRUSTUM_CULL); LLOctreeCullNoFarClip culler(&camera); culler.traverse(mOctree); } else { - LLFastTimer ftm(FTM_FRUSTUM_CULL); + LL_RECORD_BLOCK_TIME(FTM_FRUSTUM_CULL); LLOctreeCull culler(&camera); culler.traverse(mOctree); } @@ -2401,50 +1525,6 @@ S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* result return 0; } -BOOL earlyFail(LLCamera* camera, LLSpatialGroup* group) -{ - if (camera->getOrigin().isExactlyZero()) - { - return FALSE; - } - - const F32 vel = SG_OCCLUSION_FUDGE*2.f; - LLVector4a fudge; - fudge.splat(vel); - - const LLVector4a& c = group->mBounds[0]; - LLVector4a r; - r.setAdd(group->mBounds[1], fudge); - - /*if (r.magVecSquared() > 1024.0*1024.0) - { - return TRUE; - }*/ - - LLVector4a e; - e.load3(camera->getOrigin().mV); - - LLVector4a min; - min.setSub(c,r); - LLVector4a max; - max.setAdd(c,r); - - S32 lt = e.lessThan(min).getGatheredBits() & 0x7; - if (lt) - { - return FALSE; - } - - S32 gt = e.greaterThan(max).getGatheredBits() & 0x7; - if (gt) - { - return FALSE; - } - - return TRUE; -} - - void pushVerts(LLDrawInfo* params, U32 mask) { LLRenderPass::applyModelMatrix(*params); @@ -2516,7 +1596,7 @@ void pushBufferVerts(LLVertexBuffer* buffer, U32 mask) void pushBufferVerts(LLSpatialGroup* group, U32 mask, bool push_alpha = true) { - if (group->mSpatialPartition->mRenderByGroup) + if (group->getSpatialPartition()->mRenderByGroup) { if (!group->mDrawMap.empty()) { @@ -2542,7 +1622,8 @@ void pushBufferVerts(LLSpatialGroup* group, U32 mask, bool push_alpha = true) } /*else { - //drawBox(group->mBounds[0], group->mBounds[1]); + //const LLVector4a* bounds = group->getBounds(); + //drawBox(bounds[0], bounds[1]); }*/ } @@ -2587,7 +1668,7 @@ void renderOctree(LLSpatialGroup* group) LLVector4 col; if (group->mBuilt > 0.f) { - group->mBuilt -= 2.f * gFrameIntervalSeconds; + group->mBuilt -= 2.f * gFrameIntervalSeconds.value(); if (group->mBufferUsage == GL_STATIC_DRAW_ARB) { col.setVec(1.0f, 0, 0, group->mBuilt*0.5f); @@ -2606,14 +1687,20 @@ void renderOctree(LLSpatialGroup* group) gGL.diffuseColor4f(1,0,0,group->mBuilt); gGL.flush(); glLineWidth(5.f); - drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); + + const LLVector4a* bounds = group->getObjectBounds(); + drawBoxOutline(bounds[0], bounds[1]); gGL.flush(); glLineWidth(1.f); gGL.flush(); for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { - LLDrawable* drawable = *i; - if (!group->mSpatialPartition->isBridge()) + LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable(); + if(!drawable) + { + continue; + } + if (!group->getSpatialPartition()->isBridge()) { gGL.pushMatrix(); LLVector3 trans = drawable->getRegion()->getOriginAgent(); @@ -2645,7 +1732,7 @@ void renderOctree(LLSpatialGroup* group) } } - if (!group->mSpatialPartition->isBridge()) + if (!group->getSpatialPartition()->isBridge()) { gGL.popMatrix(); } @@ -2657,7 +1744,7 @@ void renderOctree(LLSpatialGroup* group) else { if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->isEmpty() - && group->mSpatialPartition->mRenderByGroup) + && group->getSpatialPartition()->mRenderByGroup) { col.setVec(0.8f, 0.4f, 0.1f, 0.1f); } @@ -2670,9 +1757,10 @@ void renderOctree(LLSpatialGroup* group) gGL.diffuseColor4fv(col.mV); LLVector4a fudge; fudge.splat(0.001f); - LLVector4a size = group->mObjectBounds[1]; - size.mul(1.01f); - size.add(fudge); + + //LLVector4a size = group->mObjectBounds[1]; + //size.mul(1.01f); + //size.add(fudge); //{ // LLGLDepthTest depth(GL_TRUE, GL_FALSE); @@ -2688,10 +1776,12 @@ void renderOctree(LLSpatialGroup* group) //drawBoxOutline(group->mObjectBounds[0], group->mObjectBounds[1]); gGL.diffuseColor4f(0,1,1,1); - drawBoxOutline(group->mBounds[0],group->mBounds[1]); + + const LLVector4a* bounds = group->getBounds(); + drawBoxOutline(bounds[0], bounds[1]); //draw bounding box for draw info - /*if (group->mSpatialPartition->mRenderByGroup) + /*if (group->getSpatialPartition()->mRenderByGroup) { gGL.diffuseColor4f(1.0f, 0.75f, 0.25f, 0.6f); for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i) @@ -2821,7 +1911,7 @@ void renderXRay(LLSpatialGroup* group, LLCamera* camera) for (LLSpatialGroup::element_iter iter = group->getDataBegin(); iter != group->getDataEnd(); ++iter) { - LLDrawable* drawable = *iter; + LLDrawable* drawable = (LLDrawable*)(*iter)->getDrawable(); if (drawable->getVObj().notNull() && drawable->getVObj()->isSelected()) { selected = true; @@ -2832,13 +1922,13 @@ void renderXRay(LLSpatialGroup* group, LLCamera* camera) if (selected) { //store for rendering occlusion volume as overlay - if (!group->mSpatialPartition->isBridge()) + if (!group->getSpatialPartition()->isBridge()) { visible_selected_groups.insert(group); } else { - visible_selected_groups.insert(group->mSpatialPartition->asBridge()->getSpatialGroup()); + visible_selected_groups.insert(group->getSpatialPartition()->asBridge()->getSpatialGroup()); } } } @@ -2889,7 +1979,7 @@ void renderUpdateType(LLDrawable* drawablep) gGL.diffuseColor4f(0,0,1,0.5f); break; default: - llwarns << "Unknown update_type " << vobj->getLastUpdateType() << llendl; + LL_WARNS() << "Unknown update_type " << vobj->getLastUpdateType() << LL_ENDL; break; }; S32 num_faces = drawablep->getNumFaces(); @@ -3539,7 +2629,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) } else { - llerrs << "Unhandled type" << llendl; + LL_ERRS() << "Unhandled type" << LL_ENDL; } gGL.popMatrix(); @@ -3547,9 +2637,13 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) void renderPhysicsShapes(LLSpatialGroup* group) { - for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) + for (OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { - LLDrawable* drawable = *i; + LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable(); + if(!drawable) + { + continue; + } if (drawable->isSpatialBridge()) { @@ -3568,7 +2662,7 @@ void renderPhysicsShapes(LLSpatialGroup* group) LLVOVolume* volume = drawable->getVOVolume(); if (volume && !volume->isAttachment() && volume->getPhysicsShapeType() != LLViewerObject::PHYSICS_SHAPE_NONE ) { - if (!group->mSpatialPartition->isBridge()) + if (!group->getSpatialPartition()->isBridge()) { gGL.pushMatrix(); LLVector3 trans = drawable->getRegion()->getOriginAgent(); @@ -4133,17 +3227,18 @@ void renderAgentTarget(LLVOAvatar* avatar) } } -class LLOctreeRenderNonOccluded : public LLOctreeTraveler<LLDrawable> +class LLOctreeRenderNonOccluded : public OctreeTraveler { public: LLCamera* mCamera; LLOctreeRenderNonOccluded(LLCamera* camera): mCamera(camera) {} - virtual void traverse(const LLSpatialGroup::OctreeNode* node) + virtual void traverse(const OctreeNode* node) { LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); - if (!mCamera || mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1])) + const LLVector4a* bounds = group->getBounds(); + if (!mCamera || mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1])) { node->accept(this); stop_glerror(); @@ -4183,11 +3278,11 @@ class LLOctreeRenderNonOccluded : public LLOctreeTraveler<LLDrawable> } } - virtual void visit(const LLSpatialGroup::OctreeNode* branch) + virtual void visit(const OctreeNode* branch) { LLSpatialGroup* group = (LLSpatialGroup*) branch->getListener(0); - - if (group->isState(LLSpatialGroup::GEOM_DIRTY) || (mCamera && !mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1]))) + const LLVector4a* bounds = group->getBounds(); + if (group->hasState(LLSpatialGroup::GEOM_DIRTY) || (mCamera && !mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1]))) { return; } @@ -4200,18 +3295,18 @@ class LLOctreeRenderNonOccluded : public LLOctreeTraveler<LLDrawable> if (!group->isEmpty()) { gGL.diffuseColor3f(0,0,1); - - llassert(group->mObjectBounds[0].isFinite3()); - llassert(group->mObjectBounds[1].isFinite3()); - - drawBoxOutline(group->mObjectBounds[0], - group->mObjectBounds[1]); + const LLVector4a* obj_bounds = group->getObjectBounds(); + drawBoxOutline(obj_bounds[0], obj_bounds[1]); } } - for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) + for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) { - LLDrawable* drawable = *i; + LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable(); + if(!drawable) + { + continue; + } if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES)) { @@ -4297,11 +3392,11 @@ class LLOctreeRenderNonOccluded : public LLOctreeTraveler<LLDrawable> { if (facep->mDrawInfo->mTextureList.size() <= index) { - llerrs << "Face texture index out of bounds." << llendl; + LL_ERRS() << "Face texture index out of bounds." << LL_ENDL; } else if (facep->mDrawInfo->mTextureList[index] != facep->getTexture()) { - llerrs << "Face texture index incorrect." << llendl; + LL_ERRS() << "Face texture index incorrect." << LL_ENDL; } } } @@ -4333,17 +3428,18 @@ class LLOctreeRenderNonOccluded : public LLOctreeTraveler<LLDrawable> } }; -class LLOctreeRenderXRay : public LLOctreeTraveler<LLDrawable> +class LLOctreeRenderXRay : public OctreeTraveler { public: LLCamera* mCamera; LLOctreeRenderXRay(LLCamera* camera): mCamera(camera) {} - virtual void traverse(const LLSpatialGroup::OctreeNode* node) + virtual void traverse(const OctreeNode* node) { LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); - if (!mCamera || mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1])) + const LLVector4a* bounds = group->getBounds(); + if (!mCamera || mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1])) { node->accept(this); stop_glerror(); @@ -4372,21 +3468,22 @@ class LLOctreeRenderXRay : public LLOctreeTraveler<LLDrawable> } } - virtual void visit(const LLSpatialGroup::OctreeNode* node) {} + virtual void visit(const OctreeNode* node) {} }; -class LLOctreeRenderPhysicsShapes : public LLOctreeTraveler<LLDrawable> +class LLOctreeRenderPhysicsShapes : public OctreeTraveler { public: LLCamera* mCamera; LLOctreeRenderPhysicsShapes(LLCamera* camera): mCamera(camera) {} - virtual void traverse(const LLSpatialGroup::OctreeNode* node) + virtual void traverse(const OctreeNode* node) { LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); - if (!mCamera || mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1])) + const LLVector4a* bounds = group->getBounds(); + if (!mCamera || mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1])) { node->accept(this); stop_glerror(); @@ -4404,23 +3501,24 @@ class LLOctreeRenderPhysicsShapes : public LLOctreeTraveler<LLDrawable> } } - virtual void visit(const LLSpatialGroup::OctreeNode* branch) + virtual void visit(const OctreeNode* branch) { } }; -class LLOctreePushBBoxVerts : public LLOctreeTraveler<LLDrawable> +class LLOctreePushBBoxVerts : public OctreeTraveler { public: LLCamera* mCamera; LLOctreePushBBoxVerts(LLCamera* camera): mCamera(camera) {} - virtual void traverse(const LLSpatialGroup::OctreeNode* node) + virtual void traverse(const OctreeNode* node) { LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); - if (!mCamera || mCamera->AABBInFrustum(group->mBounds[0], group->mBounds[1])) + const LLVector4a* bounds = group->getBounds(); + if (!mCamera || mCamera->AABBInFrustum(bounds[0], bounds[1])) { node->accept(this); @@ -4431,19 +3529,23 @@ class LLOctreePushBBoxVerts : public LLOctreeTraveler<LLDrawable> } } - virtual void visit(const LLSpatialGroup::OctreeNode* branch) + virtual void visit(const OctreeNode* branch) { LLSpatialGroup* group = (LLSpatialGroup*) branch->getListener(0); - if (group->isState(LLSpatialGroup::GEOM_DIRTY) || (mCamera && !mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1]))) + const LLVector4a* bounds = group->getBounds(); + if (group->hasState(LLSpatialGroup::GEOM_DIRTY) || (mCamera && !mCamera->AABBInFrustumNoFarClip(bounds[0], bounds[1]))) { return; } - for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) + for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) { - LLDrawable* drawable = *i; - + LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable(); + if(!drawable) + { + continue; + } renderBoundingBox(drawable, FALSE); } } @@ -4455,7 +3557,7 @@ void LLSpatialPartition::renderIntersectingBBoxes(LLCamera* camera) pusher.traverse(mOctree); } -class LLOctreeStateCheck : public LLOctreeTraveler<LLDrawable> +class LLOctreeStateCheck : public OctreeTraveler { public: U32 mInheritedMask[LLViewerCamera::NUM_CAMERAS]; @@ -4468,7 +3570,7 @@ class LLOctreeStateCheck : public LLOctreeTraveler<LLDrawable> } } - virtual void traverse(const LLSpatialGroup::OctreeNode* node) + virtual void traverse(const OctreeNode* node) { LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); @@ -4495,7 +3597,7 @@ class LLOctreeStateCheck : public LLOctreeTraveler<LLDrawable> } - virtual void visit(const LLOctreeNode<LLDrawable>* state) + virtual void visit(const OctreeNode* state) { LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0); @@ -4503,11 +3605,11 @@ class LLOctreeStateCheck : public LLOctreeTraveler<LLDrawable> { if (mInheritedMask[i] && !(group->mOcclusionState[i] & mInheritedMask[i])) { - llerrs << "Spatial group failed inherited mask test." << llendl; + LL_ERRS() << "Spatial group failed inherited mask test." << LL_ENDL; } } - if (group->isState(LLSpatialGroup::DIRTY)) + if (group->hasState(LLSpatialGroup::DIRTY)) { assert_parent_state(group, LLSpatialGroup::DIRTY); } @@ -4518,9 +3620,9 @@ class LLOctreeStateCheck : public LLOctreeTraveler<LLDrawable> LLSpatialGroup* parent = group->getParent(); while (parent) { - if (!parent->isState(state)) + if (!parent->hasState(state)) { - llerrs << "Spatial group failed parent state check." << llendl; + LL_ERRS() << "Spatial group failed parent state check." << LL_ENDL; } parent = parent->getParent(); } @@ -4654,7 +3756,7 @@ BOOL LLSpatialPartition::isVisible(const LLVector3& v) } LL_ALIGN_PREFIX(16) -class LLOctreeIntersect : public LLSpatialGroup::OctreeTraveler +class LLOctreeIntersect : public LLOctreeTraveler<LLViewerOctreeEntry> { public: LL_ALIGN_16(LLVector4a mStart); @@ -4682,21 +3784,21 @@ class LLOctreeIntersect : public LLSpatialGroup::OctreeTraveler { } - virtual void visit(const LLSpatialGroup::OctreeNode* branch) + virtual void visit(const OctreeNode* branch) { - for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) + for (OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i) { check(*i); } } - virtual LLDrawable* check(const LLSpatialGroup::OctreeNode* node) + virtual LLDrawable* check(const OctreeNode* node) { node->accept(this); for (U32 i = 0; i < node->getChildCount(); i++) { - const LLSpatialGroup::OctreeNode* child = node->getChild(i); + const OctreeNode* child = node->getChild(i); LLVector3 res; LLSpatialGroup* group = (LLSpatialGroup*) child->getListener(0); @@ -4704,17 +3806,18 @@ class LLOctreeIntersect : public LLSpatialGroup::OctreeTraveler LLVector4a size; LLVector4a center; - size = group->mBounds[1]; - center = group->mBounds[0]; + const LLVector4a* bounds = group->getBounds(); + size = bounds[1]; + center = bounds[0]; LLVector4a local_start = mStart; LLVector4a local_end = mEnd; - if (group->mSpatialPartition->isBridge()) + if (group->getSpatialPartition()->isBridge()) { - LLMatrix4 local_matrix = group->mSpatialPartition->asBridge()->mDrawable->getRenderMatrix(); + LLMatrix4 local_matrix = group->getSpatialPartition()->asBridge()->mDrawable->getRenderMatrix(); local_matrix.invert(); - + LLMatrix4a local_matrix4a; local_matrix4a.loadu(local_matrix); @@ -4731,8 +3834,10 @@ class LLOctreeIntersect : public LLSpatialGroup::OctreeTraveler return mHit; } - virtual bool check(LLDrawable* drawable) + virtual bool check(LLViewerOctreeEntry* entry) { + LLDrawable* drawable = (LLDrawable*)entry->getDrawable(); + if (!drawable || !gPipeline.hasRenderType(drawable->getRenderType()) || !drawable->isVisible()) { return false; @@ -4812,7 +3917,7 @@ LLDrawable* LLSpatialPartition::lineSegmentIntersect(const LLVector4a& start, co LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset, LLViewerTexture* texture, LLVertexBuffer* buffer, BOOL fullbright, U8 bump, BOOL particle, F32 part_size) -: +: LLTrace::MemTrackableNonVirtual<LLDrawInfo, 16>("LLDrawInfo"), mVertexBuffer(buffer), mTexture(texture), mTextureMatrix(NULL), @@ -4849,7 +3954,7 @@ LLDrawInfo::~LLDrawInfo() { /*if (LLSpatialGroup::sNoDelete) { - llerrs << "LLDrawInfo deleted illegally!" << llendl; + LL_ERRS() << "LLDrawInfo deleted illegally!" << LL_ENDL; }*/ if (mFace) @@ -5127,10 +4232,8 @@ void LLCullResult::assertDrawMapsEmpty() { if (mRenderMapSize[i] != 0) { - llerrs << "Stale LLDrawInfo's in LLCullResult!" << llendl; + LL_ERRS() << "Stale LLDrawInfo's in LLCullResult!" << LL_ENDL; } } } - - diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index f26defd5e1b899ec2228a006ddc4eef220d19158..a7b99a0f6bafdcc05fde8343f341d1345c4a594a 100755 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -45,48 +45,31 @@ #define SG_STATE_INHERIT_MASK (OCCLUDED) #define SG_INITIAL_STATE_MASK (DIRTY | GEOM_DIRTY) +class LLViewerOctreePartition; class LLSpatialPartition; class LLSpatialBridge; class LLSpatialGroup; class LLTextureAtlas; class LLTextureAtlasSlot; +class LLViewerRegion; -S32 AABBSphereIntersect(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &rad); -S32 AABBSphereIntersectR2(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &radius_squared); - -S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad); -S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared); void pushVerts(LLFace* face, U32 mask); -// get index buffer for binary encoded axis vertex buffer given a box at center being viewed by given camera -U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center); -U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center); - -class LLDrawInfo : public LLRefCount +class LLDrawInfo : public LLRefCount, public LLTrace::MemTrackableNonVirtual<LLDrawInfo, 16> { protected: ~LLDrawInfo(); public: - void* operator new(size_t size) - { - return ll_aligned_malloc(size,64); - } - - void operator delete(void* ptr) - { - ll_aligned_free(ptr); - } - - LLDrawInfo(const LLDrawInfo& rhs) + : LLTrace::MemTrackableNonVirtual<LLDrawInfo, 16>("LLDrawInfo") { *this = rhs; } const LLDrawInfo& operator=(const LLDrawInfo& rhs) { - llerrs << "Illegal operation!" << llendl; + LL_ERRS() << "Illegal operation!" << LL_ENDL; return *this; } @@ -185,7 +168,7 @@ class LLDrawInfo : public LLRefCount } }; - + struct CompareBump { bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs) @@ -208,34 +191,23 @@ class LLDrawInfo : public LLRefCount }; LL_ALIGN_PREFIX(64) -class LLSpatialGroup : public LLOctreeListener<LLDrawable> +class LLSpatialGroup : public LLOcclusionCullingGroup { friend class LLSpatialPartition; friend class LLOctreeStateCheck; public: - LLSpatialGroup(const LLSpatialGroup& rhs) + LLSpatialGroup(const LLSpatialGroup& rhs) : LLOcclusionCullingGroup(rhs) { *this = rhs; } - void* operator new(size_t size) - { - return ll_aligned_malloc_16(size); - } - - void operator delete(void* ptr) - { - ll_aligned_free_16(ptr); - } - const LLSpatialGroup& operator=(const LLSpatialGroup& rhs) { - llerrs << "Illegal operation!" << llendl; + LL_ERRS() << "Illegal operation!" << LL_ENDL; return *this; } - static std::set<GLuint> sPendingQueries; //pending occlusion queries static U32 sNodeCount; static BOOL sNoDelete; //deletion of spatial groups and draw info not allowed if TRUE @@ -247,15 +219,6 @@ class LLSpatialGroup : public LLOctreeListener<LLDrawable> typedef std::map<LLFace*, buffer_list_t> buffer_texture_map_t; typedef std::map<U32, buffer_texture_map_t> buffer_map_t; - typedef LLOctreeListener<LLDrawable> BaseType; - typedef LLOctreeListener<LLDrawable> OctreeListener; - typedef LLTreeNode<LLDrawable> TreeNode; - typedef LLOctreeNode<LLDrawable> OctreeNode; - typedef LLOctreeRoot<LLDrawable> OctreeRoot; - typedef LLOctreeTraveler<LLDrawable> OctreeTraveler; - typedef LLOctreeNode<LLDrawable>::element_iter element_iter; - typedef LLOctreeNode<LLDrawable>::element_list element_list; - struct CompareDistanceGreater { bool operator()(const LLSpatialGroup* const& lhs, const LLSpatialGroup* const& rhs) @@ -282,104 +245,56 @@ class LLSpatialGroup : public LLOctreeListener<LLDrawable> typedef enum { - OCCLUDED = 0x00010000, - QUERY_PENDING = 0x00020000, - ACTIVE_OCCLUSION = 0x00040000, - DISCARD_QUERY = 0x00080000, - EARLY_FAIL = 0x00100000, - } eOcclusionState; - - typedef enum - { - DEAD = 0x00000001, - DIRTY = 0x00000002, - OBJECT_DIRTY = 0x00000004, - GEOM_DIRTY = 0x00000008, - ALPHA_DIRTY = 0x00000010, - SKIP_FRUSTUM_CHECK = 0x00000020, - IN_IMAGE_QUEUE = 0x00000040, - IMAGE_DIRTY = 0x00000080, - MESH_DIRTY = 0x00000100, - NEW_DRAWINFO = 0x00000200, - IN_BUILD_Q1 = 0x00000400, - IN_BUILD_Q2 = 0x00000800, + GEOM_DIRTY = LLViewerOctreeGroup::INVALID_STATE, + ALPHA_DIRTY = (GEOM_DIRTY << 1), + IN_IMAGE_QUEUE = (ALPHA_DIRTY << 1), + IMAGE_DIRTY = (IN_IMAGE_QUEUE << 1), + MESH_DIRTY = (IMAGE_DIRTY << 1), + NEW_DRAWINFO = (MESH_DIRTY << 1), + IN_BUILD_Q1 = (NEW_DRAWINFO << 1), + IN_BUILD_Q2 = (IN_BUILD_Q1 << 1), STATE_MASK = 0x0000FFFF, } eSpatialState; - typedef enum - { - STATE_MODE_SINGLE = 0, //set one node - STATE_MODE_BRANCH, //set entire branch - STATE_MODE_DIFF, //set entire branch as long as current state is different - STATE_MODE_ALL_CAMERAS, //used for occlusion state, set state for all cameras - } eSetStateMode; - LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part); BOOL isHUDGroup() ; - BOOL isDead() { return isState(DEAD); } - BOOL isState(U32 state) const; - BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } - U32 getState() { return mState; } - void setState(U32 state); - void clearState(U32 state); void clearDrawMap(); void validate(); - void checkStates(); void validateDrawMap(); void setState(U32 state, S32 mode); void clearState(U32 state, S32 mode); - - void setOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); - void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); + void clearState(U32 state) {mState &= ~state;} LLSpatialGroup* getParent(); - - BOOL addObject(LLDrawable *drawablep, BOOL add_all = FALSE, BOOL from_octree = FALSE); + BOOL addObject(LLDrawable *drawablep); BOOL removeObject(LLDrawable *drawablep, BOOL from_octree = FALSE); BOOL updateInGroup(LLDrawable *drawablep, BOOL immediate = FALSE); // Update position if it's in the group - BOOL isVisible() const; - BOOL isRecentlyVisible() const; - void setVisible(); void shift(const LLVector4a &offset); - BOOL boundObjects(BOOL empty, LLVector4a& newMin, LLVector4a& newMax); - void unbound(); - BOOL rebound(); - void checkOcclusion(); //read back last occlusion query (if any) - void doOcclusion(LLCamera* camera); //issue occlusion query void destroyGL(bool keep_occlusion = false); void updateDistance(LLCamera& camera); - BOOL needsUpdate(); F32 getUpdateUrgency() const; BOOL changeLOD(); void rebuildGeom(); void rebuildMesh(); + void setState(U32 state) {mState |= state;} void dirtyGeom() { setState(GEOM_DIRTY); } void dirtyMesh() { setState(MESH_DIRTY); } - //octree wrappers to make code more readable - element_list& getData() { return mOctreeNode->getData(); } - element_iter getDataBegin() { return mOctreeNode->getDataBegin(); } - element_iter getDataEnd() { return mOctreeNode->getDataEnd(); } - bool hasElement(LLDrawable* drawablep) { return std::find(mOctreeNode->getDataBegin(), mOctreeNode->getDataEnd(), drawablep) != mOctreeNode->getDataEnd(); } - - U32 getElementCount() const { return mOctreeNode->getElementCount(); } - bool isEmpty() const { return mOctreeNode->isEmpty(); } - void drawObjectBox(LLColor4 col); + LLSpatialPartition* getSpatialPartition() {return (LLSpatialPartition*)mSpatialPartition;} + //LISTENER FUNCTIONS - virtual void handleInsertion(const TreeNode* node, LLDrawable* face); - virtual void handleRemoval(const TreeNode* node, LLDrawable* face); + virtual void handleInsertion(const TreeNode* node, LLViewerOctreeEntry* face); + virtual void handleRemoval(const TreeNode* node, LLViewerOctreeEntry* face); virtual void handleDestruction(const TreeNode* node); - virtual void handleStateChange(const TreeNode* node); virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); - virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child); //------------------- //for atlas use @@ -402,21 +317,6 @@ class LLSpatialGroup : public LLOctreeListener<LLDrawable> public: - typedef enum - { - BOUNDS = 0, - EXTENTS = 2, - OBJECT_BOUNDS = 4, - OBJECT_EXTENTS = 6, - VIEW_ANGLE = 8, - LAST_VIEW_ANGLE = 9, - V4_COUNT = 10 - } eV4Index; - - LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects) - LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children - LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node - LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node LL_ALIGN_16(LLVector4a mViewAngle); LL_ALIGN_16(LLVector4a mLastUpdateViewAngle); @@ -437,11 +337,6 @@ class LLSpatialGroup : public LLOctreeListener<LLDrawable> protected: virtual ~LLSpatialGroup(); - U32 mState; - U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS]; - U32 mOcclusionIssued[LLViewerCamera::NUM_CAMERAS]; - - S32 mLODHash; static S32 sLODSeed; public: @@ -452,16 +347,12 @@ class LLSpatialGroup : public LLOctreeListener<LLDrawable> F32 mSurfaceArea; //used by volumes to track estimated surface area of geometry in this node F32 mBuilt; - OctreeNode* mOctreeNode; - LLSpatialPartition* mSpatialPartition; LLPointer<LLVertexBuffer> mVertexBuffer; - GLuint mOcclusionQuery[LLViewerCamera::NUM_CAMERAS]; U32 mBufferUsage; draw_map_t mDrawMap; - S32 mVisible[LLViewerCamera::NUM_CAMERAS]; F32 mDistance; F32 mDepth; F32 mLastUpdateDistance; @@ -484,10 +375,10 @@ class LLGeometryManager virtual LLVertexBuffer* createVertexBuffer(U32 type_mask, U32 usage); }; -class LLSpatialPartition: public LLGeometryManager +class LLSpatialPartition: public LLViewerOctreePartition, public LLGeometryManager { public: - LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 mBufferUsage); + LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 mBufferUsage, LLViewerRegion* regionp); virtual ~LLSpatialPartition(); LLSpatialGroup *put(LLDrawable *drawablep, BOOL was_visible = FALSE); @@ -514,7 +405,8 @@ class LLSpatialPartition: public LLGeometryManager virtual void rebuildMesh(LLSpatialGroup* group); BOOL visibleObjectsInFrustum(LLCamera& camera); - S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results = NULL, BOOL for_select = FALSE); // Cull on arbitrary frustum + /*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion=false); // Cull on arbitrary frustum + S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results, BOOL for_select); // Cull on arbitrary frustum BOOL isVisible(const LLVector3& v); bool isHUDPartition() ; @@ -527,25 +419,22 @@ class LLSpatialPartition: public LLGeometryManager void renderIntersectingBBoxes(LLCamera* camera); void restoreGL(); void resetVertexBuffers(); - BOOL isOcclusionEnabled(); + BOOL getVisibleExtents(LLCamera& camera, LLVector3& visMin, LLVector3& visMax); public: - LLSpatialGroup::OctreeNode* mOctree; LLSpatialBridge* mBridge; // NULL for non-LLSpatialBridge instances, otherwise, mBridge == this // use a pointer instead of making "isBridge" and "asBridge" virtual so it's safe // to call asBridge() from the destructor - BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed + BOOL mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane U32 mBufferUsage; const BOOL mRenderByGroup; - U32 mLODSeed; - U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed) U32 mVertexDataMask; F32 mSlopRatio; //percentage distance must change before drawables receive LOD update (default is 0.25); BOOL mDepthMask; //if TRUE, objects in this partition will be written to depth during alpha rendering - U32 mDrawableType; - U32 mPartitionType; + + static BOOL sTeleportRequested; //started to issue a teleport request }; // class for creating bridges between spatial partitions @@ -557,7 +446,7 @@ class LLSpatialBridge : public LLDrawable, public LLSpatialPartition public: typedef std::vector<LLPointer<LLSpatialBridge> > bridge_vector_t; - LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask); + LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp); void destroyTree(); @@ -679,7 +568,7 @@ class LLCullResult class LLWaterPartition : public LLSpatialPartition { public: - LLWaterPartition(); + LLWaterPartition(LLViewerRegion* regionp); virtual void getGeometry(LLSpatialGroup* group) { } virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { } }; @@ -688,14 +577,14 @@ class LLWaterPartition : public LLSpatialPartition class LLVoidWaterPartition : public LLWaterPartition { public: - LLVoidWaterPartition(); + LLVoidWaterPartition(LLViewerRegion* regionp); }; //spatial partition for terrain (impelmented in LLVOSurfacePatch.cpp) class LLTerrainPartition : public LLSpatialPartition { public: - LLTerrainPartition(); + LLTerrainPartition(LLViewerRegion* regionp); virtual void getGeometry(LLSpatialGroup* group); virtual LLVertexBuffer* createVertexBuffer(U32 type_mask, U32 usage); }; @@ -704,7 +593,7 @@ class LLTerrainPartition : public LLSpatialPartition class LLTreePartition : public LLSpatialPartition { public: - LLTreePartition(); + LLTreePartition(LLViewerRegion* regionp); virtual void getGeometry(LLSpatialGroup* group) { } virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { } @@ -714,7 +603,7 @@ class LLTreePartition : public LLSpatialPartition class LLParticlePartition : public LLSpatialPartition { public: - LLParticlePartition(); + LLParticlePartition(LLViewerRegion* regionp); virtual void rebuildGeom(LLSpatialGroup* group); virtual void getGeometry(LLSpatialGroup* group); virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count); @@ -726,14 +615,14 @@ class LLParticlePartition : public LLSpatialPartition class LLHUDParticlePartition : public LLParticlePartition { public: - LLHUDParticlePartition(); + LLHUDParticlePartition(LLViewerRegion* regionp); }; //spatial partition for grass (implemented in LLVOGrass.cpp) class LLGrassPartition : public LLSpatialPartition { public: - LLGrassPartition(); + LLGrassPartition(LLViewerRegion* regionp); virtual void getGeometry(LLSpatialGroup* group); virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count); protected: @@ -763,7 +652,7 @@ class LLVolumeGeometryManager: public LLGeometryManager class LLVolumePartition : public LLSpatialPartition, public LLVolumeGeometryManager { public: - LLVolumePartition(); + LLVolumePartition(LLViewerRegion* regionp); virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); } virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); } virtual void rebuildMesh(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildMesh(group); } @@ -774,7 +663,7 @@ class LLVolumePartition : public LLSpatialPartition, public LLVolumeGeometryMana class LLVolumeBridge : public LLSpatialBridge, public LLVolumeGeometryManager { public: - LLVolumeBridge(LLDrawable* drawable); + LLVolumeBridge(LLDrawable* drawable, LLViewerRegion* regionp); virtual void rebuildGeom(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildGeom(group); } virtual void getGeometry(LLSpatialGroup* group) { LLVolumeGeometryManager::getGeometry(group); } virtual void rebuildMesh(LLSpatialGroup* group) { LLVolumeGeometryManager::rebuildMesh(group); } @@ -784,7 +673,7 @@ class LLVolumeBridge : public LLSpatialBridge, public LLVolumeGeometryManager class LLHUDBridge : public LLVolumeBridge { public: - LLHUDBridge(LLDrawable* drawablep); + LLHUDBridge(LLDrawable* drawablep, LLViewerRegion* regionp); virtual void shiftPos(const LLVector4a& vec); virtual F32 calcPixelArea(LLSpatialGroup* group, LLCamera& camera); }; @@ -793,7 +682,7 @@ class LLHUDBridge : public LLVolumeBridge class LLBridgePartition : public LLSpatialPartition { public: - LLBridgePartition(); + LLBridgePartition(LLViewerRegion* regionp); virtual void getGeometry(LLSpatialGroup* group) { } virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { } }; @@ -801,7 +690,7 @@ class LLBridgePartition : public LLSpatialPartition class LLHUDPartition : public LLBridgePartition { public: - LLHUDPartition(); + LLHUDPartition(LLViewerRegion* regionp); virtual void shift(const LLVector4a &offset); }; diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index a4582071e8b3922b4d8fe60d74511496f7b62a37..f25076d47ee59c3b3388c4f06fa58474e3fd8935 100755 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -34,7 +34,9 @@ #include "llgroupmgr.h" #include "llsdutil.h" #include "lluicolortable.h" +#include "llhttpclient.h" #include "llviewerobjectlist.h" +#include "llviewerregion.h" #include "llvoavatar.h" #include "llworld.h" @@ -276,7 +278,7 @@ class ModerationResponder : public LLHTTPClient::Responder virtual void error(U32 status, const std::string& reason) { - llwarns << status << ": " << reason << llendl; + LL_WARNS() << status << ": " << reason << LL_ENDL; if ( gIMMgr ) { @@ -339,7 +341,7 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin speakerp->mStatus = status; mSpeakers.insert(std::make_pair(speakerp->mID, speakerp)); mSpeakersSorted.push_back(speakerp); - LL_DEBUGS("Speakers") << "Added speaker " << id << llendl; + LL_DEBUGS("Speakers") << "Added speaker " << id << LL_ENDL; fireEvent(new LLSpeakerListChangeEvent(this, speakerp->mID), "add"); } else @@ -360,7 +362,7 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin } else { - LL_WARNS("Speakers") << "Speaker " << id << " not found" << llendl; + LL_WARNS("Speakers") << "Speaker " << id << " not found" << LL_ENDL; } } @@ -424,7 +426,7 @@ void LLSpeakerMgr::update(BOOL resort_ok) if (moderator_muted_voice != speakerp->mModeratorMutedVoice) { speakerp->mModeratorMutedVoice = moderator_muted_voice; - LL_DEBUGS("Speakers") << (speakerp->mModeratorMutedVoice? "Muted" : "Umuted") << " speaker " << speaker_id<< llendl; + LL_DEBUGS("Speakers") << (speakerp->mModeratorMutedVoice? "Muted" : "Umuted") << " speaker " << speaker_id<< LL_ENDL; speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp)); } @@ -621,7 +623,7 @@ bool LLSpeakerMgr::removeSpeaker(const LLUUID& speaker_id) } } - LL_DEBUGS("Speakers") << "Removed speaker " << speaker_id << llendl; + LL_DEBUGS("Speakers") << "Removed speaker " << speaker_id << LL_ENDL; fireEvent(new LLSpeakerListChangeEvent(this, speaker_id), "remove"); update(TRUE); @@ -739,7 +741,7 @@ void LLIMSpeakerMgr::setSpeakers(const LLSD& speakers) // Fire event only if moderator changed if ( is_moderator != speakerp->mIsModerator ) { - LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << llendl; + LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << LL_ENDL; fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator"); } } @@ -794,7 +796,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) } else { - llwarns << "bad membership list update " << ll_print_sd(agent_data["transition"]) << llendl; + LL_WARNS() << "bad membership list update " << ll_print_sd(agent_data["transition"]) << LL_ENDL; } } @@ -812,7 +814,7 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) // Fire event only if moderator changed if ( is_moderator != speakerp->mIsModerator ) { - LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << llendl; + LL_DEBUGS("Speakers") << "Speaker " << agent_id << (is_moderator ? "is now" : "no longer is") << " a moderator" << LL_ENDL; fireEvent(new LLSpeakerUpdateModeratorEvent(speakerp), "update_moderator"); } } @@ -847,15 +849,15 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) } else { - llwarns << "bad membership list update " - << agent_transition << llendl; + LL_WARNS() << "bad membership list update " + << agent_transition << LL_ENDL; } } } } /*prep# virtual void errorWithContent(U32 status, const std::string& reason, const LLSD& content) - llwarns << "ModerationResponder error [status:" << status << "]: " << content << llendl; + LL_WARNS() << "ModerationResponder error [status:" << status << "]: " << content << LL_ENDL; */ void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id) { @@ -972,7 +974,7 @@ void LLActiveSpeakerMgr::updateSpeakerList() // always populate from active voice channel if (LLVoiceChannel::getCurrentVoiceChannel() != mVoiceChannel) //MA: seems this is always false { - LL_DEBUGS("Speakers") << "Removed all speakers" << llendl; + LL_DEBUGS("Speakers") << "Removed all speakers" << LL_ENDL; fireEvent(new LLSpeakerListChangeEvent(this, LLUUID::null), "clear"); mSpeakers.clear(); mSpeakersSorted.clear(); @@ -1036,7 +1038,7 @@ void LLLocalSpeakerMgr::updateSpeakerList() if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY) { LLVOAvatar* avatarp = (LLVOAvatar*)gObjectList.findObject(speaker_id); - if (!avatarp || dist_vec_squared(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS_SQUARED) + if (!avatarp || dist_vec_squared(avatarp->getPositionAgent(), gAgent.getPositionAgent()) > CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS) { setSpeakerNotInChannel(speakerp); } diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp index 07e9371124f5ccb36b991d5abe50f10b1020a9c7..78fe7863c8090226f197d9267ea4649e48a01e4f 100755 --- a/indra/newview/llspeakingindicatormanager.cpp +++ b/indra/newview/llspeakingindicatormanager.cpp @@ -279,7 +279,7 @@ void SpeakingIndicatorManager::ensureInstanceDoesNotExist(LLSpeakingIndicator* c // So, using stored deleted pointer leads to crash. See EXT-4782. if (it != mSpeakingIndicators.end()) { - llwarns << "The same instance of indicator has already been registered, removing it: " << it->first << "|"<< speaking_indicator << llendl; + LL_WARNS() << "The same instance of indicator has already been registered, removing it: " << it->first << "|"<< speaking_indicator << LL_ENDL; llassert(it == mSpeakingIndicators.end()); mSpeakingIndicators.erase(it); } diff --git a/indra/newview/llsrv.cpp b/indra/newview/llsrv.cpp index 567c2a01581293ece4b5c7c0979076c853297153..8b9aead165c56aebc2b4e15db27382f728fb321e 100755 --- a/indra/newview/llsrv.cpp +++ b/indra/newview/llsrv.cpp @@ -35,7 +35,7 @@ struct Responder : public LLAres::UriRewriteResponder void rewriteResult(const std::vector<std::string> &uris) { for (size_t i = 0; i < uris.size(); i++) { - llinfos << "[" << i << "] " << uris[i] << llendl; + LL_INFOS() << "[" << i << "] " << uris[i] << LL_ENDL; } mUris = uris; } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 3b52025a23e8caca1e1e9a5adbbaf3205fad3f70..a76b4bbe0946cb196d24de32bbd4c2341ac1cf04 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -75,7 +75,6 @@ #include "llsd.h" #include "llsdserialize.h" #include "llsdutil_math.h" -#include "llsecondlifeurls.h" #include "llstring.h" #include "lluserrelations.h" #include "llversioninfo.h" @@ -84,7 +83,6 @@ #include "llvfs.h" #include "llxorcipher.h" // saved password, MAC address #include "llwindow.h" -#include "imageids.h" #include "message.h" #include "v3math.h" @@ -133,7 +131,6 @@ #include "llpreviewscript.h" #include "llproxy.h" #include "llproductinforequest.h" -#include "llsecondlifeurls.h" #include "llselectmgr.h" #include "llsky.h" #include "llstatview.h" @@ -243,6 +240,7 @@ static LLVector3 gAgentStartLookAt(1.0f, 0.f, 0.f); static std::string gAgentStartLocation = "safe"; static bool mLoginStatePastUI = false; +const S32 DEFAULT_MAX_AGENT_GROUPS = 25; boost::scoped_ptr<LLEventPump> LLStartUp::sStateWatcher(new LLEventStream("StartupState")); boost::scoped_ptr<LLStartupListener> LLStartUp::sListener(new LLStartupListener()); @@ -644,7 +642,7 @@ bool idle_startup() gAudiop = (LLAudioEngine *) new LLAudioEngine_OpenAL(); } #endif - + if (gAudiop) { #if LL_WINDOWS @@ -1192,6 +1190,7 @@ bool idle_startup() // create the default proximal channel LLVoiceChannel::initClass(); LLStartUp::setStartupState( STATE_WORLD_INIT); + LLTrace::get_frame_recording().reset(); } else { @@ -1437,8 +1436,8 @@ bool idle_startup() LL_DEBUGS("AppInit") << "Initializing camera..." << LL_ENDL; gFrameTime = totalTime(); - F32 last_time = gFrameTimeSeconds; - gFrameTimeSeconds = (S64)(gFrameTime - gStartTime)/SEC_TO_MICROSEC; + F32Seconds last_time = gFrameTimeSeconds; + gFrameTimeSeconds = (gFrameTime - gStartTime); gFrameIntervalSeconds = gFrameTimeSeconds - last_time; if (gFrameIntervalSeconds < 0.f) @@ -1515,7 +1514,7 @@ bool idle_startup() gFirstSim, gSavedSettings.getS32("UseCircuitCodeMaxRetries"), FALSE, - gSavedSettings.getF32("UseCircuitCodeTimeout"), + (F32Seconds)gSavedSettings.getF32("UseCircuitCodeTimeout"), use_circuit_callback, NULL); @@ -1683,7 +1682,7 @@ bool idle_startup() LLSD inv_basic = response["inventory-basic"]; if(inv_basic.isDefined()) { - llinfos << "Basic inventory root folder id is " << inv_basic["folder_id"] << llendl; + LL_INFOS() << "Basic inventory root folder id is " << inv_basic["folder_id"] << LL_ENDL; } LLSD buddy_list = response["buddy-list"]; @@ -1778,30 +1777,30 @@ bool idle_startup() gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE,true); // set up callbacks - llinfos << "Registering Callbacks" << llendl; + LL_INFOS() << "Registering Callbacks" << LL_ENDL; LLMessageSystem* msg = gMessageSystem; - llinfos << " Inventory" << llendl; + LL_INFOS() << " Inventory" << LL_ENDL; LLInventoryModel::registerCallbacks(msg); - llinfos << " AvatarTracker" << llendl; + LL_INFOS() << " AvatarTracker" << LL_ENDL; LLAvatarTracker::instance().registerCallbacks(msg); - llinfos << " Landmark" << llendl; + LL_INFOS() << " Landmark" << LL_ENDL; LLLandmark::registerCallbacks(msg); display_startup(); // request mute list - llinfos << "Requesting Mute List" << llendl; + LL_INFOS() << "Requesting Mute List" << LL_ENDL; LLMuteList::getInstance()->requestFromServer(gAgent.getID()); display_startup(); // Get L$ and ownership credit information - llinfos << "Requesting Money Balance" << llendl; + LL_INFOS() << "Requesting Money Balance" << LL_ENDL; LLStatusBar::sendMoneyBalanceRequest(); display_startup(); // request all group information - llinfos << "Requesting Agent Data" << llendl; + LL_INFOS() << "Requesting Agent Data" << LL_ENDL; gAgent.sendAgentDataUpdateRequest(); display_startup(); // Create the inventory views - llinfos << "Creating Inventory Views" << llendl; + LL_INFOS() << "Creating Inventory Views" << LL_ENDL; LLFloaterReg::getInstance("inventory"); display_startup(); LLStartUp::setStartupState( STATE_MISC ); @@ -1939,6 +1938,7 @@ bool idle_startup() LL_DEBUGS("AppInit") << "Initialization complete" << LL_ENDL; + LL_DEBUGS("SceneLoadTiming", "Start") << "Scene Load Started " << LL_ENDL; gRenderStartTime.reset(); gForegroundTime.reset(); @@ -1955,7 +1955,7 @@ bool idle_startup() // thus, do not show this alert. if (!gAgent.isFirstLogin()) { - llinfos << "gAgentStartLocation : " << gAgentStartLocation << llendl; + LL_INFOS() << "gAgentStartLocation : " << gAgentStartLocation << LL_ENDL; LLSLURL start_slurl = LLStartUp::getStartSLURL(); LL_DEBUGS("AppInit") << "start slurl "<<start_slurl.asString()<<LL_ENDL; @@ -1963,10 +1963,9 @@ bool idle_startup() ((start_slurl.getType() == LLSLURL::LAST_LOCATION) && (gAgentStartLocation == "last")) || ((start_slurl.getType() == LLSLURL::HOME_LOCATION) && (gAgentStartLocation == "home"))) { - // Start location is OK - // Disabled code to restore camera location and focus if logging in to default location - static bool samename = false; - if (samename) + if (start_slurl.getType() == LLSLURL::LAST_LOCATION + && gAgentStartLocation == "last" + && gSavedSettings.getBOOL("RestoreCameraPosOnLogin")) { // restore old camera pos gAgentCamera.setFocusOnAvatar(FALSE, FALSE); @@ -2059,8 +2058,9 @@ bool idle_startup() static LLFrameTimer wearables_timer; const F32 wearables_time = wearables_timer.getElapsedTimeF32(); - const F32 MAX_WEARABLES_TIME = 10.f; + static LLCachedControl<F32> max_wearables_time(gSavedSettings, "ClothingLoadingDelay"); + display_startup(); if (!gAgent.isGenderChosen() && isAgentAvatarValid()) { // No point in waiting for clothing, we don't even @@ -2074,50 +2074,39 @@ bool idle_startup() LLNotificationsUtil::add("WelcomeChooseSex", LLSD(), LLSD(), callback_choose_gender); LLStartUp::setStartupState( STATE_CLEANUP ); - return TRUE; } - - display_startup(); - - if (wearables_time > MAX_WEARABLES_TIME) + else if (wearables_time >= max_wearables_time()) { LLNotificationsUtil::add("ClothingLoading"); - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_WEARABLES_TOO_LONG); + record(LLStatViewer::LOADING_WEARABLES_LONG_DELAY, wearables_time); LLStartUp::setStartupState( STATE_CLEANUP ); - return TRUE; } - - if (gAgent.isFirstLogin()) + else if (gAgent.isFirstLogin() + && isAgentAvatarValid() + && gAgentAvatarp->isFullyLoaded()) { // wait for avatar to be completely loaded - if (isAgentAvatarValid() - && gAgentAvatarp->isFullyLoaded()) - { - //llinfos << "avatar fully loaded" << llendl; - LLStartUp::setStartupState( STATE_CLEANUP ); - return TRUE; - } + //LL_INFOS() << "avatar fully loaded" << LL_ENDL; + LLStartUp::setStartupState( STATE_CLEANUP ); + } + // OK to just get the wearables + else if (!gAgent.isFirstLogin() && gAgentWearables.areWearablesLoaded() ) + { + // We have our clothing, proceed. + //LL_INFOS() << "wearables loaded" << LL_ENDL; + LLStartUp::setStartupState( STATE_CLEANUP ); } else { - // OK to just get the wearables - if ( gAgentWearables.areWearablesLoaded() ) - { - // We have our clothing, proceed. - //llinfos << "wearables loaded" << llendl; - LLStartUp::setStartupState( STATE_CLEANUP ); - return TRUE; - } + display_startup(); + update_texture_fetch(); + display_startup(); + set_startup_status(0.9f + 0.1f * wearables_time / max_wearables_time(), + LLTrans::getString("LoginDownloadingClothing").c_str(), + gAgent.mMOTD.c_str()); + display_startup(); } - - display_startup(); - update_texture_fetch(); - display_startup(); - set_startup_status(0.9f + 0.1f * wearables_time / MAX_WEARABLES_TIME, - LLTrans::getString("LoginDownloadingClothing").c_str(), - gAgent.mMOTD.c_str()); - display_startup(); - return TRUE; + //fall through this frame to STATE_CLEANUP } if (STATE_CLEANUP == LLStartUp::getStartupState()) @@ -2179,7 +2168,7 @@ bool idle_startup() // Unmute audio if desired and setup volumes. // This is a not-uncommon crash site, so surround it with - // llinfos output to aid diagnosis. + // LL_INFOS() output to aid diagnosis. LL_INFOS("AppInit") << "Doing first audio_update_volume..." << LL_ENDL; audio_update_volume(); LL_INFOS("AppInit") << "Done first audio_update_volume." << LL_ENDL; @@ -2187,15 +2176,8 @@ bool idle_startup() // reset keyboard focus to sane state of pointing at world gFocusMgr.setKeyboardFocus(NULL); -#if 0 // sjb: enable for auto-enabling timer display - gDebugView->mFastTimerView->setVisible(TRUE); -#endif - LLAppViewer::instance()->handleLoginComplete(); - // reset timers now that we are running "logged in" logic - LLFastTimer::reset(); - LLAgentPicksInfo::getInstance()->requestNumberOfPicks(); display_startup(); @@ -2550,7 +2532,7 @@ bool callback_choose_gender(const LLSD& notification, const LLSD& response) void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, const std::string& gender_name ) { - lldebugs << "starting" << llendl; + LL_DEBUGS() << "starting" << LL_ENDL; // Not going through the processAgentInitialWearables path, so need to set this here. LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true); @@ -2560,18 +2542,18 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, ESex gender; if (gender_name == "male") { - lldebugs << "male" << llendl; + LL_DEBUGS() << "male" << LL_ENDL; gender = SEX_MALE; } else { - lldebugs << "female" << llendl; + LL_DEBUGS() << "female" << LL_ENDL; gender = SEX_FEMALE; } if (!isAgentAvatarValid()) { - llwarns << "Trying to load an initial outfit for an invalid agent avatar" << llendl; + LL_WARNS() << "Trying to load an initial outfit for an invalid agent avatar" << LL_ENDL; return; } @@ -2584,7 +2566,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, outfit_folder_name); if (cat_id.isNull()) { - lldebugs << "standard wearables" << llendl; + LL_DEBUGS() << "standard wearables" << LL_ENDL; gAgentWearables.createStandardWearables(); } else @@ -2600,7 +2582,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, // Need to fetch cof contents before we can wear. callAfterCategoryFetch(LLAppearanceMgr::instance().getCOF(), boost::bind(&LLAppearanceMgr::wearInventoryCategory, LLAppearanceMgr::getInstance(), cat, do_copy, do_append)); - lldebugs << "initial outfit category id: " << cat_id << llendl; + LL_DEBUGS() << "initial outfit category id: " << cat_id << LL_ENDL; } // This is really misnamed -- it means we have started loading @@ -2612,16 +2594,16 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name, void LLStartUp::saveInitialOutfit() { if (sInitialOutfit.empty()) { - lldebugs << "sInitialOutfit is empty" << llendl; + LL_DEBUGS() << "sInitialOutfit is empty" << LL_ENDL; return; } if (sWearablesLoadedCon.connected()) { - lldebugs << "sWearablesLoadedCon is connected, disconnecting" << llendl; + LL_DEBUGS() << "sWearablesLoadedCon is connected, disconnecting" << LL_ENDL; sWearablesLoadedCon.disconnect(); } - lldebugs << "calling makeNewOutfitLinks( \"" << sInitialOutfit << "\" )" << llendl; + LL_DEBUGS() << "calling makeNewOutfitLinks( \"" << sInitialOutfit << "\" )" << LL_ENDL; LLAppearanceMgr::getInstance()->makeNewOutfitLinks(sInitialOutfit,false); } @@ -3160,7 +3142,7 @@ void apply_udp_blacklist(const std::string& csv) } std::string item(csv, start, comma-start); - lldebugs << "udp_blacklist " << item << llendl; + LL_DEBUGS() << "udp_blacklist " << item << LL_ENDL; gMessageSystem->banUdpMessage(item); start = comma + 1; diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index 760e38890b6a74985b11f98ab160ed4bf6c0db5b..e39810713a0945951bc2db4a35226dbabd039219 100755 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -45,6 +45,18 @@ bool login_alert_done(const LLSD& notification, const LLSD& response); extern std::string SCREEN_HOME_FILENAME; extern std::string SCREEN_LAST_FILENAME; +// start location constants +enum EStartLocation +{ + START_LOCATION_ID_LAST, + START_LOCATION_ID_HOME, + START_LOCATION_ID_DIRECT, + START_LOCATION_ID_PARCEL, + START_LOCATION_ID_TELEHUB, + START_LOCATION_ID_URL, + START_LOCATION_ID_COUNT +}; + typedef enum { STATE_FIRST, // Initial startup STATE_BROWSER_INIT, // Initialize web browser for login screen diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index ff69c6e9fd7d1f95b6ca8e7f71ad22f0576db784..047538a32a9f7d27dd38345760fbfb861b5aa6c8 100755 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -37,7 +37,6 @@ #include "llviewercontrol.h" #include "llfloaterbuycurrency.h" #include "llbuycurrencyhtml.h" -#include "llfloaterlagmeter.h" #include "llpanelnearbymedia.h" #include "llpanelvolumepulldown.h" #include "llfloaterregioninfo.h" @@ -73,7 +72,6 @@ #include "lltrans.h" // library includes -#include "imageids.h" #include "llfloaterreg.h" #include "llfontgl.h" #include "llrect.h" @@ -199,10 +197,10 @@ BOOL LLStatusBar::postBuild() sgp.rect(r); sgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); sgp.mouse_opaque(false); + sgp.stat.count_stat_float(&LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED); + sgp.units("Kbps"); + sgp.precision(0); mSGBandwidth = LLUICtrlFactory::create<LLStatGraph>(sgp); - mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); - mSGBandwidth->setUnits("Kbps"); - mSGBandwidth->setPrecision(0); addChild(mSGBandwidth); x -= SIM_STAT_WIDTH + 2; @@ -213,17 +211,20 @@ BOOL LLStatusBar::postBuild() pgp.rect(r); pgp.follows.flags(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); pgp.mouse_opaque(false); + pgp.stat.sample_stat_float(&LLStatViewer::PACKETS_LOST_PERCENT); + pgp.units("%"); + pgp.min(0.f); + pgp.max(5.f); + pgp.precision(1); + pgp.per_sec(false); + LLStatGraph::Thresholds thresholds; + thresholds.threshold.add(LLStatGraph::ThresholdParams().value(0.1).color(LLColor4::green)) + .add(LLStatGraph::ThresholdParams().value(0.25f).color(LLColor4::yellow)) + .add(LLStatGraph::ThresholdParams().value(0.6f).color(LLColor4::red)); + + pgp.thresholds(thresholds); mSGPacketLoss = LLUICtrlFactory::create<LLStatGraph>(pgp); - mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); - mSGPacketLoss->setUnits("%"); - mSGPacketLoss->setMin(0.f); - mSGPacketLoss->setMax(5.f); - mSGPacketLoss->setThreshold(0, 0.5f); - mSGPacketLoss->setThreshold(1, 1.f); - mSGPacketLoss->setThreshold(2, 3.f); - mSGPacketLoss->setPrecision(1); - mSGPacketLoss->mPerSec = FALSE; addChild(mSGPacketLoss); mPanelVolumePulldown = new LLPanelVolumePulldown(); @@ -253,9 +254,9 @@ void LLStatusBar::refresh() F32 bwtotal = gViewerThrottle.getMaxBandwidth() / 1000.f; mSGBandwidth->setMin(0.f); mSGBandwidth->setMax(bwtotal*1.25f); - mSGBandwidth->setThreshold(0, bwtotal*0.75f); - mSGBandwidth->setThreshold(1, bwtotal); - mSGBandwidth->setThreshold(2, bwtotal); + //mSGBandwidth->setThreshold(0, bwtotal*0.75f); + //mSGBandwidth->setThreshold(1, bwtotal); + //mSGBandwidth->setThreshold(2, bwtotal); } // update clock every 10 seconds @@ -390,7 +391,7 @@ void LLStatusBar::sendMoneyBalanceRequest() void LLStatusBar::setHealth(S32 health) { - //llinfos << "Setting health to: " << buffer << llendl; + //LL_INFOS() << "Setting health to: " << buffer << LL_ENDL; if( mHealth > health ) { if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold"))) diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 93c7f54101372724aea6ef9e381aecca56354d08..e75af8db5341e39019fc59b24957032801724a16 100755 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -34,7 +34,7 @@ #include "llpatchvertexarray.h" #include "patch_dct.h" #include "patch_code.h" -#include "bitpack.h" +#include "llbitpack.h" #include "llviewerobjectlist.h" #include "llregionhandle.h" #include "llagent.h" @@ -123,7 +123,7 @@ LLSurface::~LLSurface() LLDrawPoolTerrain *poolp = (LLDrawPoolTerrain*) gPipeline.findPool(LLDrawPool::POOL_TERRAIN, mSTexturep); if (!poolp) { - llwarns << "No pool for terrain on destruction!" << llendl; + LL_WARNS() << "No pool for terrain on destruction!" << LL_ENDL; } else if (poolp->mReferences.empty()) { @@ -140,7 +140,7 @@ LLSurface::~LLSurface() } else { - llerrs << "Terrain pool not empty!" << llendl; + LL_ERRS() << "Terrain pool not empty!" << LL_ENDL; } } @@ -709,7 +709,7 @@ void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL if ((i >= mPatchesPerEdge) || (j >= mPatchesPerEdge)) { - llwarns << "Received invalid terrain packet - patch header patch ID incorrect!" + LL_WARNS() << "Received invalid terrain packet - patch header patch ID incorrect!" << " patches per edge " << mPatchesPerEdge << " i " << i << " j " << j @@ -717,7 +717,7 @@ void LLSurface::decompressDCTPatch(LLBitPack &bitpack, LLGroupHeader *gopp, BOOL << " range " << (S32)ph.range << " quant_wbits " << (S32)ph.quant_wbits << " patchids " << (S32)ph.patchids - << llendl; + << LL_ENDL; LLAppViewer::instance()->badNetworkHandler(); return; } @@ -955,13 +955,13 @@ LLSurfacePatch *LLSurface::resolvePatchRegion(const F32 x, const F32 y) const { if(0 == mNumberOfPatches) { - llwarns << "No patches for current region!" << llendl; + LL_WARNS() << "No patches for current region!" << LL_ENDL; return NULL; } S32 old_index = index; index = llclamp(old_index, 0, (mNumberOfPatches - 1)); - llwarns << "Clamping out of range patch index " << old_index - << " to " << index << llendl; + LL_WARNS() << "Clamping out of range patch index " << old_index + << " to " << index << LL_ENDL; } return &(mPatchList[index]); } @@ -1150,12 +1150,12 @@ LLSurfacePatch *LLSurface::getPatch(const S32 x, const S32 y) const { if ((x < 0) || (x >= mPatchesPerEdge)) { - llerrs << "Asking for patch out of bounds" << llendl; + LL_ERRS() << "Asking for patch out of bounds" << LL_ENDL; return NULL; } if ((y < 0) || (y >= mPatchesPerEdge)) { - llerrs << "Asking for patch out of bounds" << llendl; + LL_ERRS() << "Asking for patch out of bounds" << LL_ENDL; return NULL; } @@ -1194,7 +1194,7 @@ void LLSurface::setWaterHeight(F32 height) } else { - llwarns << "LLSurface::setWaterHeight with no water object!" << llendl; + LL_WARNS() << "LLSurface::setWaterHeight with no water object!" << LL_ENDL; } } diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h index 9d24bf8771b987d8f210af2eef6b88b5fc4a04d9..33a64ae7d5a591bd96ea54c083ccca2031b8d936 100755 --- a/indra/newview/llsurface.h +++ b/indra/newview/llsurface.h @@ -45,7 +45,6 @@ class LLTimer; class LLUUID; class LLAgent; -class LLStat; static const U8 NO_EDGE = 0x00; static const U8 EAST_EDGE = 0x01; diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index a9ba2bce9c4ef2c8429796f0508b719c8545c5f3..2d06b8599c2152de1f1db604ac008852613806c5 100755 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -33,7 +33,6 @@ #include "llsurface.h" #include "pipeline.h" #include "llagent.h" -#include "timing.h" #include "llsky.h" #include "llviewercamera.h" @@ -44,11 +43,11 @@ #include "noise.h" extern bool gShiftFrame; -extern U64 gFrameTime; +extern U64MicrosecondsImplicit gFrameTime; extern LLPipeline gPipeline; -LLSurfacePatch::LLSurfacePatch() : - mHasReceivedData(FALSE), +LLSurfacePatch::LLSurfacePatch() +: mHasReceivedData(FALSE), mSTexUpdate(FALSE), mDirty(FALSE), mDirtyZStats(TRUE), @@ -100,7 +99,7 @@ void LLSurfacePatch::dirty() } else { - llwarns << "No viewer object for this surface patch!" << llendl; + LL_WARNS() << "No viewer object for this surface patch!" << LL_ENDL; } mDirtyZStats = TRUE; diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 626d69aca44387fbf369f05c6fb0c1ef9e881dab..8babb874f82029175ee9f9a382c868c03cce1866 100755 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -107,8 +107,8 @@ void LLSysWellWindow::removeItemByID(const LLUUID& id) } else { - llwarns << "Unable to remove notification from the list, ID: " << id - << llendl; + LL_WARNS() << "Unable to remove notification from the list, ID: " << id + << LL_ENDL; } // hide chiclet window if there are no items left @@ -132,7 +132,7 @@ void LLSysWellWindow::initChannel() mChannel = dynamic_cast<LLNotificationsUI::LLScreenChannel*>(channel); if(NULL == mChannel) { - llwarns << "LLSysWellWindow::initChannel() - could not get a requested screen channel" << llendl; + LL_WARNS() << "LLSysWellWindow::initChannel() - could not get a requested screen channel" << LL_ENDL; } } @@ -360,9 +360,9 @@ void LLNotificationWellWindow::addItem(LLSysWellItem::Params p) } else { - llwarns << "Unable to add Notification into the list, notification ID: " << p.notification_id + LL_WARNS() << "Unable to add Notification into the list, notification ID: " << p.notification_id << ", title: " << p.title - << llendl; + << LL_ENDL; new_item->die(); } @@ -509,7 +509,7 @@ void LLIMWellWindow::addObjectRow(const LLUUID& notification_id, bool new_messag ObjectRowPanel* item = new ObjectRowPanel(notification_id, new_message); if (!mMessageList->addItem(item, notification_id)) { - llwarns << "Unable to add Object Row into the list, notificationID: " << notification_id << llendl; + LL_WARNS() << "Unable to add Object Row into the list, notificationID: " << notification_id << LL_ENDL; item->die(); } reshapeWindow(); @@ -520,7 +520,7 @@ void LLIMWellWindow::removeObjectRow(const LLUUID& notification_id) { if (!mMessageList->removeItemByValue(notification_id)) { - llwarns << "Unable to remove Object Row from the list, notificationID: " << notification_id << llendl; + LL_WARNS() << "Unable to remove Object Row from the list, notificationID: " << notification_id << LL_ENDL; } reshapeWindow(); diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp index 50a088b79979c260f6bfaff291ef8c9b9296ae49..a20d69dd41c392e39589016e24d21e1dded23662 100755 --- a/indra/newview/llteleporthistory.cpp +++ b/indra/newview/llteleporthistory.cpp @@ -77,14 +77,14 @@ void LLTeleportHistory::goToItem(int idx) // Validate specified index. if (idx < 0 || idx >= (int)mItems.size()) { - llwarns << "Invalid teleport history index (" << idx << ") specified" << llendl; + LL_WARNS() << "Invalid teleport history index (" << idx << ") specified" << LL_ENDL; dump(); return; } if (idx == mCurrentItem) { - llwarns << "Will not teleport to the same location." << llendl; + LL_WARNS() << "Will not teleport to the same location." << LL_ENDL; dump(); return; } @@ -156,7 +156,7 @@ void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos) // Update current history item. if (mCurrentItem < 0 || mCurrentItem >= (int) mItems.size()) // sanity check { - llwarns << "Invalid current item. (this should not happen)" << llendl; + LL_WARNS() << "Invalid current item. (this should not happen)" << LL_ENDL; llassert(!"Invalid current teleport history item"); return; } @@ -222,7 +222,7 @@ std::string LLTeleportHistory::getCurrentLocationTitle(bool full, const LLVector void LLTeleportHistory::dump() const { - llinfos << "Teleport history dump (" << mItems.size() << " items):" << llendl; + LL_INFOS() << "Teleport history dump (" << mItems.size() << " items):" << LL_ENDL; for (size_t i=0; i<mItems.size(); i++) { @@ -231,6 +231,6 @@ void LLTeleportHistory::dump() const line << i << ": " << mItems[i].mTitle; line << " REGION_ID: " << mItems[i].mRegionID; line << ", pos: " << mItems[i].mGlobalPos; - llinfos << line.str() << llendl; + LL_INFOS() << line.str() << LL_ENDL; } } diff --git a/indra/newview/llteleporthistorystorage.cpp b/indra/newview/llteleporthistorystorage.cpp index af5a047da4d974c4d77f5e0e78fcefc37977b4fa..f88f88a4fa9ac9d4a761808ec5d63aa324497ee9 100755 --- a/indra/newview/llteleporthistorystorage.cpp +++ b/indra/newview/llteleporthistorystorage.cpp @@ -167,7 +167,7 @@ void LLTeleportHistoryStorage::save() llofstream file (resolvedFilename); if (!file.is_open()) { - llwarns << "can't open teleport history file \"" << mFilename << "\" for writing" << llendl; + LL_WARNS() << "can't open teleport history file \"" << mFilename << "\" for writing" << LL_ENDL; return; } @@ -189,7 +189,7 @@ void LLTeleportHistoryStorage::load() llifstream file(resolved_filename); if (!file.is_open()) { - llwarns << "can't load teleport history from file \"" << mFilename << "\"" << llendl; + LL_WARNS() << "can't load teleport history from file \"" << mFilename << "\"" << LL_ENDL; return; } @@ -205,7 +205,7 @@ void LLTeleportHistoryStorage::load() std::istringstream iss(line); if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE) { - llinfos << "Parsing saved teleport history failed" << llendl; + LL_INFOS() << "Parsing saved teleport history failed" << LL_ENDL; break; } @@ -221,7 +221,7 @@ void LLTeleportHistoryStorage::load() void LLTeleportHistoryStorage::dump() const { - llinfos << "Teleport history storage dump (" << mItems.size() << " items):" << llendl; + LL_INFOS() << "Teleport history storage dump (" << mItems.size() << " items):" << LL_ENDL; for (size_t i=0; i<mItems.size(); i++) { @@ -230,7 +230,7 @@ void LLTeleportHistoryStorage::dump() const line << " global pos: " << mItems[i].mGlobalPos; line << " date: " << mItems[i].mDate; - llinfos << line.str() << llendl; + LL_INFOS() << line.str() << LL_ENDL; } } @@ -244,7 +244,7 @@ void LLTeleportHistoryStorage::goToItem(S32 idx) // Validate specified index. if (idx < 0 || idx >= (S32)mItems.size()) { - llwarns << "Invalid teleport history index (" << idx << ") specified" << llendl; + LL_WARNS() << "Invalid teleport history index (" << idx << ") specified" << LL_ENDL; dump(); return; } diff --git a/indra/newview/lltextureatlas.cpp b/indra/newview/lltextureatlas.cpp index dbbe331954e9d98378b27981d2cf8328ed2ebd22..1c8e4f796e0548226e420ebdf02b50542c781d43 100755 --- a/indra/newview/lltextureatlas.cpp +++ b/indra/newview/lltextureatlas.cpp @@ -63,7 +63,7 @@ LLTextureAtlas::~LLTextureAtlas() { if(mSpatialGroupList.size() > 0) { - llerrs << "Not clean up the spatial groups!" << llendl ; + LL_ERRS() << "Not clean up the spatial groups!" << LL_ENDL ; } releaseUsageBits() ; } @@ -105,7 +105,7 @@ LLGLuint LLTextureAtlas::insertSubTexture(LLImageGL* source_gl_tex, S32 discard_ BOOL res = gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getTexName()); if (!res) { - llerrs << "bindTexture failed" << llendl; + LL_ERRS() << "bindTexture failed" << LL_ENDL; } GLint xoffset = sSlotSize * slot_col ; @@ -342,7 +342,7 @@ BOOL LLTextureAtlas::areUsageBitsMarked(S8 bits_len, U8 mask, S16 col, S16 row) if(ret != ret2) { - llerrs << "bits map corrupted." << llendl ; + LL_ERRS() << "bits map corrupted." << LL_ENDL ; } #endif return ret ;//FALSE ; diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 5bc2e971ebee8be581ba3049511b3334db38a330..ef852bc905e2d400e0ee99ff65d6daca16b2cbe4 100755 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -191,7 +191,7 @@ bool LLTextureCacheLocalFileWorker::doRead() if (mImageFormat == IMG_CODEC_INVALID) { -// llwarns << "Unrecognized file extension " << extension << " for local texture " << mFileName << llendl; +// LL_WARNS() << "Unrecognized file extension " << extension << " for local texture " << mFileName << LL_ENDL; mDataSize = 0; // no data return true; } @@ -232,9 +232,9 @@ bool LLTextureCacheLocalFileWorker::doRead() { if (mBytesRead != mBytesToRead) { -// llwarns << "Error reading file from local cache: " << local_filename +// LL_WARNS() << "Error reading file from local cache: " << local_filename // << " Bytes: " << mDataSize << " Offset: " << mOffset -// << " / " << mDataSize << llendl; +// << " / " << mDataSize << LL_ENDL; mDataSize = 0; // failed FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; @@ -257,9 +257,9 @@ bool LLTextureCacheLocalFileWorker::doRead() if (bytes_read != mDataSize) { -// llwarns << "Error reading file from local cache: " << mFileName +// LL_WARNS() << "Error reading file from local cache: " << mFileName // << " Bytes: " << mDataSize << " Offset: " << mOffset -// << " / " << mDataSize << llendl; +// << " / " << mDataSize << LL_ENDL; mDataSize = 0; FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; @@ -390,16 +390,16 @@ bool LLTextureCacheRemoteWorker::doRead() mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool()); if (bytes_read != mDataSize) { - llwarns << "Error reading file from local cache: " << local_filename + LL_WARNS() << "Error reading file from local cache: " << local_filename << " Bytes: " << mDataSize << " Offset: " << mOffset - << " / " << mDataSize << llendl; + << " / " << mDataSize << LL_ENDL; mDataSize = 0; FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; } else { - //llinfos << "texture " << mID.asString() << " found in local_assets" << llendl; + //LL_INFOS() << "texture " << mID.asString() << " found in local_assets" << LL_ENDL; mImageSize = local_size; mImageLocal = TRUE; } @@ -442,9 +442,9 @@ bool LLTextureCacheRemoteWorker::doRead() mReadData, offset, size, mCache->getLocalAPRFilePool()); if (bytes_read != size) { - llwarns << "LLTextureCacheWorker: " << mID + LL_WARNS() << "LLTextureCacheWorker: " << mID << " incorrect number of bytes read from header: " << bytes_read - << " / " << size << llendl; + << " / " << size << LL_ENDL; FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; mDataSize = -1; // failed @@ -511,9 +511,9 @@ bool LLTextureCacheRemoteWorker::doRead() mCache->getLocalAPRFilePool()); if (bytes_read != file_size) { - llwarns << "LLTextureCacheWorker: " << mID + LL_WARNS() << "LLTextureCacheWorker: " << mID << " incorrect number of bytes read from body: " << bytes_read - << " / " << file_size << llendl; + << " / " << file_size << LL_ENDL; FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; mDataSize = -1; // failed @@ -524,7 +524,7 @@ bool LLTextureCacheRemoteWorker::doRead() { // No body, we're done. mDataSize = llmax(TEXTURE_CACHE_ENTRY_SIZE - mOffset, 0); - lldebugs << "No body file for: " << filename << llendl; + LL_DEBUGS() << "No body file for: " << filename << LL_ENDL; } // Nothing else to do at that point... done = true; @@ -571,10 +571,10 @@ bool LLTextureCacheRemoteWorker::doWrite() // (almost always) write to the fast cache. if (mRawImage->getDataSize()) { - llassert_always(mCache->writeToFastCache(idx, mRawImage, mRawDiscardLevel)); - } + llassert_always(mCache->writeToFastCache(idx, mRawImage, mRawDiscardLevel)); } } + } else { alreadyCached = mCache->updateEntry(idx, entry, mImageSize, mDataSize); // update the existing entry. @@ -582,8 +582,8 @@ bool LLTextureCacheRemoteWorker::doWrite() if (idx < 0) { - llwarns << "LLTextureCacheWorker: " << mID - << " Unable to create header entry for writing!" << llendl; + LL_WARNS() << "LLTextureCacheWorker: " << mID + << " Unable to create header entry for writing!" << LL_ENDL; mDataSize = -1; // failed done = true; } @@ -628,8 +628,8 @@ bool LLTextureCacheRemoteWorker::doWrite() if (bytes_written <= 0) { - llwarns << "LLTextureCacheWorker: " << mID - << " Unable to write header entry!" << llendl; + LL_WARNS() << "LLTextureCacheWorker: " << mID + << " Unable to write header entry!" << LL_ENDL; mDataSize = -1; // failed done = true; } @@ -655,16 +655,16 @@ bool LLTextureCacheRemoteWorker::doWrite() { // build the cache file name from the UUID std::string filename = mCache->getTextureFileName(mID); -// llinfos << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << llendl; +// LL_INFOS() << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << LL_ENDL; S32 bytes_written = LLAPRFile::writeEx( filename, mWriteData + TEXTURE_CACHE_ENTRY_SIZE, 0, file_size, mCache->getLocalAPRFilePool()); if (bytes_written <= 0) { - llwarns << "LLTextureCacheWorker: " << mID + LL_WARNS() << "LLTextureCacheWorker: " << mID << " incorrect number of bytes written to body: " << bytes_written - << " / " << file_size << llendl; + << " / " << file_size << LL_ENDL; mDataSize = -1; // failed done = true; } @@ -922,7 +922,7 @@ void LLTextureCache::setDirNames(ELLPath location) mFastCacheFileName = gDirUtilp->getExpandedFilename(location, textures_dirname, fast_cache_filename); } -void LLTextureCache::purgeCache(ELLPath location) +void LLTextureCache::purgeCache(ELLPath location, bool remove_dir) { LLMutexLock lock(&mHeaderMutex); @@ -948,7 +948,7 @@ void LLTextureCache::purgeCache(ELLPath location) } //remove the current texture cache. - purgeAllTextures(true); + purgeAllTextures(remove_dir); } //is called in the main thread before initCache(...) is called. @@ -1135,7 +1135,7 @@ S32 LLTextureCache::openAndReadEntry(const LLUUID& id, Entry& entry, bool create } if(entry.mImageSize <= entry.mBodySize)//it happens on 64-bit systems, do not know why { - llwarns << "corrupted entry: " << id << " entry image size: " << entry.mImageSize << " entry body size: " << entry.mBodySize << llendl ; + LL_WARNS() << "corrupted entry: " << id << " entry image size: " << entry.mImageSize << " entry body size: " << entry.mBodySize << LL_ENDL ; //erase this entry and the cached texture from the cache. std::string tex_filename = getTextureFileName(id); @@ -1303,13 +1303,13 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries) S32 bytes_read = aprfile->read((void*)(&entry), (S32)sizeof(Entry)); if (bytes_read < sizeof(Entry)) { - llwarns << "Corrupted header entries, failed at " << idx << " / " << num_entries << llendl; + LL_WARNS() << "Corrupted header entries, failed at " << idx << " / " << num_entries << LL_ENDL; closeHeaderEntriesFile(); purgeAllTextures(false); return 0; } entries.push_back(entry); -// llinfos << "ENTRY: " << entry.mTime << " TEX: " << entry.mID << " IDX: " << idx << " Size: " << entry.mImageSize << llendl; +// LL_INFOS() << "ENTRY: " << entry.mTime << " TEX: " << entry.mID << " IDX: " << idx << " Size: " << entry.mImageSize << LL_ENDL; if(entry.mImageSize > entry.mBodySize) { mHeaderIDMap[entry.mID] = idx; @@ -1439,7 +1439,7 @@ void LLTextureCache::readHeaderCache() if (entry.mBodySize > entry.mImageSize) { // Shouldn't happen, failsafe only - llwarns << "Bad entry: " << i << ": " << entry.mID << ": BodySize: " << entry.mBodySize << llendl; + LL_WARNS() << "Bad entry: " << i << ": " << entry.mID << ": BodySize: " << entry.mBodySize << LL_ENDL; purge_list.insert(i); } } @@ -1450,7 +1450,7 @@ void LLTextureCache::readHeaderCache() // Special case: cache size was reduced, need to remove entries // Note: After we prune entries, we will call this again and create the LRU U32 entries_to_purge = (num_entries - empty_entries) - sCacheMaxEntries; - llinfos << "Texture Cache Entries: " << num_entries << " Max: " << sCacheMaxEntries << " Empty: " << empty_entries << " Purging: " << entries_to_purge << llendl; + LL_INFOS() << "Texture Cache Entries: " << num_entries << " Max: " << sCacheMaxEntries << " Empty: " << empty_entries << " Purging: " << entries_to_purge << LL_ENDL; // We can exit the following loop with the given condition, since if we'd reach the end of the lru set we'd have: // purge_list.size() = lru.size() = num_entries - empty_entries = entries_to_purge + sCacheMaxEntries >= entries_to_purge // So, it's certain that iter will never reach lru.end() first. @@ -1467,7 +1467,7 @@ void LLTextureCache::readHeaderCache() for (std::set<lru_data_t>::iterator iter = lru.begin(); iter != lru.end(); ++iter) { mLRU.insert(entries[iter->second].mID); -// llinfos << "LRU: " << iter->first << " : " << iter->second << llendl; +// LL_INFOS() << "LRU: " << iter->first << " : " << iter->second << LL_ENDL; if (--lru_entries <= 0) break; } @@ -1513,7 +1513,7 @@ void LLTextureCache::readHeaderCache() //the header mutex is locked before calling this. void LLTextureCache::clearCorruptedCache() { - llwarns << "the texture cache is corrupted, need to be cleared." << llendl ; + LL_WARNS() << "the texture cache is corrupted, need to be cleared." << LL_ENDL ; closeHeaderEntriesFile();//close possible file handler purgeAllTextures(false) ; //clear the cache. @@ -1543,7 +1543,7 @@ void LLTextureCache::purgeAllTextures(bool purge_directories) for (S32 i=0; i<16; i++) { std::string dirname = mTexturesDirName + delem + subdirs[i]; - llinfos << "Deleting files in directory: " << dirname << llendl; + LL_INFOS() << "Deleting files in directory: " << dirname << LL_ENDL; gDirUtilp->deleteFilesInDir(dirname, mask); if (purge_directories) { @@ -1568,7 +1568,7 @@ void LLTextureCache::purgeAllTextures(bool purge_directories) mHeaderEntriesInfo.mEntries = 0; writeEntriesHeader(); - llinfos << "The entire texture cache is cleared." << llendl ; + LL_INFOS() << "The entire texture cache is cleared." << LL_ENDL ; } void LLTextureCache::purgeTextures(bool validate) @@ -1586,7 +1586,7 @@ void LLTextureCache::purgeTextures(bool validate) LLMutexLock lock(&mHeaderMutex); - llinfos << "TEXTURE CACHE: Purging." << llendl; + LL_INFOS() << "TEXTURE CACHE: Purging." << LL_ENDL; // Read the entries list std::vector<Entry> entries; @@ -1609,11 +1609,11 @@ void LLTextureCache::purgeTextures(bool validate) { S32 idx = iter2->second; time_idx_set.insert(std::make_pair(entries[idx].mTime, idx)); -// llinfos << "TIME: " << entries[idx].mTime << " TEX: " << entries[idx].mID << " IDX: " << idx << " Size: " << entries[idx].mImageSize << llendl; +// LL_INFOS() << "TIME: " << entries[idx].mTime << " TEX: " << entries[idx].mID << " IDX: " << idx << " Size: " << entries[idx].mImageSize << LL_ENDL; } else { - llerrs << "mTexturesSizeMap / mHeaderIDMap corrupted." << llendl ; + LL_ERRS() << "mTexturesSizeMap / mHeaderIDMap corrupted." << LL_ENDL ; } } } @@ -1682,7 +1682,7 @@ void LLTextureCache::purgeTextures(bool validate) << " PURGED: " << purge_count << " ENTRIES: " << num_entries << " CACHE SIZE: " << mTexturesSizeTotal / (1024 * 1024) << " MB" - << llendl; + << LL_ENDL; } ////////////////////////////////////////////////////////////////////////////// @@ -1900,7 +1900,7 @@ bool LLTextureCache::writeToFastCache(S32 id, LLPointer<LLImageRaw> raw, S32 dis //rescale image if needed if (raw.isNull() || !raw->getData()) { - llerrs << "Attempted to write NULL raw image to fastcache" << llendl; + LL_ERRS() << "Attempted to write NULL raw image to fastcache" << LL_ENDL; return false; } @@ -2094,7 +2094,7 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename) bool LLTextureCache::removeFromCache(const LLUUID& id) { - //llwarns << "Removing texture from cache: " << id << llendl; + //LL_WARNS() << "Removing texture from cache: " << id << LL_ENDL; bool ret = false ; if (!mReadOnly) { diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index deaacc49759552f30d9f5e6777b0f833148e1010..6ff4c4456828e9bcfa44c2ac69aafc55c170e6bd 100755 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -104,7 +104,7 @@ class LLTextureCache : public LLWorkerThread /*virtual*/ S32 update(F32 max_time_ms); - void purgeCache(ELLPath location); + void purgeCache(ELLPath location, bool remove_dir = true); void setReadOnly(BOOL read_only) ; S64 initCache(ELLPath location, S64 maxsize, BOOL texture_cache_mismatch); @@ -131,8 +131,8 @@ class LLTextureCache : public LLWorkerThread // debug S32 getNumReads() { return mReaders.size(); } S32 getNumWrites() { return mWriters.size(); } - S64 getUsage() { return mTexturesSizeTotal; } - S64 getMaxUsage() { return sCacheMaxTexturesSize; } + S64Bytes getUsage() { return S64Bytes(mTexturesSizeTotal); } + S64Bytes getMaxUsage() { return S64Bytes(sCacheMaxTexturesSize); } U32 getEntries() { return mHeaderEntriesInfo.mEntries; } U32 getMaxEntries() { return sCacheMaxEntries; }; BOOL isInCache(const LLUUID& id) ; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 99e41cf39aabd3babf93875fa9c2a37fbc2d610e..c12753acb0963054690216f7f3fedfd50a35db49 100755 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -208,7 +208,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( : LLFloater(LLSD()), mOwner( owner ), mImageAssetID( owner->getImageAssetID() ), - mFallbackImage( fallback_image ), + mFallbackImage( fallback_image ), mOriginalImageAssetID(owner->getImageAssetID()), mLabel(label), mTentativeLabel(NULL), @@ -355,7 +355,7 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop( } handled = TRUE; - lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLFloaterTexturePicker " << getName() << llendl; + LL_DEBUGS("UserInput") << "dragAndDrop handled by LLFloaterTexturePicker " << getName() << LL_ENDL; return handled; } @@ -549,11 +549,11 @@ void LLFloaterTexturePicker::draw() if (gFocusMgr.childHasMouseCapture(getDragHandle())) { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); } else { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); + mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); } updateImageStats(); @@ -667,10 +667,10 @@ const LLUUID& LLFloaterTexturePicker::findItemID(const LLUUID& asset_id, BOOL co LLInventoryModel::INCLUDE_TRASH, asset_id_matches); - if (items.count()) + if (items.size()) { // search for copyable version first - for (S32 i = 0; i < items.count(); i++) + for (S32 i = 0; i < items.size(); i++) { LLInventoryItem* itemp = items[i]; LLPermissions item_permissions = itemp->getPermissions(); @@ -1342,9 +1342,9 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id) else { mImageItemID = floaterp->findItemID(floaterp->getAssetID(), FALSE); - lldebugs << "mImageItemID: " << mImageItemID << llendl; + LL_DEBUGS() << "mImageItemID: " << mImageItemID << LL_ENDL; mImageAssetID = floaterp->getAssetID(); - lldebugs << "mImageAssetID: " << mImageAssetID << llendl; + LL_DEBUGS() << "mImageAssetID: " << mImageAssetID << LL_ENDL; } if (op == TEXTURE_SELECT && mOnSelectCallback) @@ -1445,7 +1445,7 @@ BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, } handled = TRUE; - lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLTextureCtrl " << getName() << llendl; + LL_DEBUGS("UserInput") << "dragAndDrop handled by LLTextureCtrl " << getName() << LL_ENDL; return handled; } diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index ad79042ef161a86839c5ca83954f71b2301ea844..15ca7bed928ddb0b2e9fe4bf1de07468e783314b 100755 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -227,8 +227,4 @@ class LLTextureCtrl S32 mLabelWidth; }; -// XUI HACK: When floaters converted, switch this file to lltexturepicker.h/cpp -// and class to LLTexturePicker -#define LLTexturePicker LLTextureCtrl - #endif // LL_LLTEXTURECTRL_H diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp old mode 100644 new mode 100755 index e5f2ca7e5c4540061b8200f5f96bbe3128938888..2acd38b75351ea00cdaf4b9131b56f3d1e4139c3 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -53,6 +53,7 @@ #include "llviewerstatsrecorder.h" #include "llviewerassetstats.h" #include "llworld.h" +#include "llsdparam.h" #include "llsdutil.h" #include "llstartup.h" #include "llsdserialize.h" @@ -64,8 +65,8 @@ #include "bufferstream.h" bool LLTextureFetchDebugger::sDebuggerEnabled = false ; -LLStat LLTextureFetch::sCacheHitRate("texture_cache_hits", 128); -LLStat LLTextureFetch::sCacheReadLatency("texture_cache_read_latency", 128); +LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > LLTextureFetch::sCacheHitRate("texture_cache_hits"); +LLTrace::EventStatHandle<F64Milliseconds > LLTextureFetch::sCacheReadLatency("texture_cache_read_latency"); ////////////////////////////////////////////////////////////////////////////// @@ -503,11 +504,12 @@ class LLTextureFetchWorker : public LLWorkerClass, public LLCore::HttpHandler static const char* sStateDescs[]; e_state mState; void setState(e_state new_state); + e_write_to_cache_state mWriteToCacheState; LLTextureFetch* mFetcher; LLPointer<LLImageFormatted> mFormattedImage; - LLPointer<LLImageRaw> mRawImage; - LLPointer<LLImageRaw> mAuxImage; + LLPointer<LLImageRaw> mRawImage, + mAuxImage; FTType mFTType; LLUUID mID; LLHost mHost; @@ -516,22 +518,22 @@ class LLTextureFetchWorker : public LLWorkerClass, public LLCore::HttpHandler F32 mImagePriority; U32 mWorkPriority; F32 mRequestedPriority; - S32 mDesiredDiscard; - S32 mSimRequestedDiscard; - S32 mRequestedDiscard; - S32 mLoadedDiscard; - S32 mDecodedDiscard; - LLFrameTimer mRequestedTimer; - LLFrameTimer mFetchTimer; + S32 mDesiredDiscard, + mSimRequestedDiscard, + mRequestedDiscard, + mLoadedDiscard, + mDecodedDiscard; + LLFrameTimer mRequestedTimer, + mFetchTimer; LLTimer mCacheReadTimer; F32 mCacheReadTime; - LLTextureCache::handle_t mCacheReadHandle; - LLTextureCache::handle_t mCacheWriteHandle; - S32 mRequestedSize; - S32 mRequestedOffset; - S32 mDesiredSize; - S32 mFileSize; - S32 mCachedSize; + LLTextureCache::handle_t mCacheReadHandle, + mCacheWriteHandle; + S32 mRequestedSize, + mRequestedOffset, + mDesiredSize, + mFileSize, + mCachedSize; e_request_state mSentRequest; handle_t mDecodeHandle; BOOL mLoaded; @@ -541,8 +543,8 @@ class LLTextureFetchWorker : public LLWorkerClass, public LLCore::HttpHandler BOOL mHaveAllData; BOOL mInLocalCache; BOOL mInCache; - bool mCanUseHTTP ; - bool mCanUseNET ; //can get from asset server. + bool mCanUseHTTP, + mCanUseNET ; //can get from asset server. S32 mRetryAttempt; S32 mActiveCount; LLCore::HttpStatus mGetStatus; @@ -552,9 +554,12 @@ class LLTextureFetchWorker : public LLWorkerClass, public LLCore::HttpHandler LLMutex mWorkMutex; struct PacketData { - PacketData(U8* data, S32 size) { mData = data; mSize = size; } + PacketData(U8* data, S32 size) + : mData(data), mSize(size) + {} ~PacketData() { clearData(); } void clearData() { delete[] mData; mData = NULL; } + U8* mData; U32 mSize; }; @@ -568,16 +573,16 @@ class LLTextureFetchWorker : public LLWorkerClass, public LLCore::HttpHandler LLCore::HttpHandle mHttpHandle; // Handle of any active request LLCore::BufferArray * mHttpBufferArray; // Refcounted pointer to response data - int mHttpPolicyClass; + S32 mHttpPolicyClass; bool mHttpActive; // Active request to http library - unsigned int mHttpReplySize; // Actual received data size - unsigned int mHttpReplyOffset; // Actual received data offset + U32 mHttpReplySize, // Actual received data size + mHttpReplyOffset; // Actual received data offset bool mHttpHasResource; // Counts against Fetcher's mHttpSemaphore // State history - U32 mCacheReadCount; - U32 mCacheWriteCount; - U32 mResourceWaitCount; // Requests entering WAIT_HTTP_RESOURCE2 + U32 mCacheReadCount, + mCacheWriteCount, + mResourceWaitCount; // Requests entering WAIT_HTTP_RESOURCE2 }; ////////////////////////////////////////////////////////////////////////////// @@ -895,7 +900,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, calcWorkPriority(); mType = host.isOk() ? LLImageBase::TYPE_AVATAR_BAKE : LLImageBase::TYPE_NORMAL; -// llinfos << "Create: " << mID << " mHost:" << host << " Discard=" << discard << llendl; +// LL_INFOS() << "Create: " << mID << " mHost:" << host << " Discard=" << discard << LL_ENDL; if (!mFetcher->mDebugPause) { U32 work_priority = mWorkPriority | LLWorkerThread::PRIORITY_HIGH; @@ -906,10 +911,10 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, LLTextureFetchWorker::~LLTextureFetchWorker() { -// llinfos << "Destroy: " << mID +// LL_INFOS() << "Destroy: " << mID // << " Decoded=" << mDecodedDiscard // << " Requested=" << mRequestedDiscard -// << " Desired=" << mDesiredDiscard << llendl; +// << " Desired=" << mDesiredDiscard << LL_ENDL; llassert_always(!haveWork()); lockWorkMutex(); // +Mw (should be useless) @@ -941,7 +946,7 @@ LLTextureFetchWorker::~LLTextureFetchWorker() mHttpBufferArray = NULL; } unlockWorkMutex(); // -Mw - mFetcher->removeFromHTTPQueue(mID, 0); + mFetcher->removeFromHTTPQueue(mID, (S32Bytes)0); mFetcher->removeHttpWaiter(mID); mFetcher->updateStateStats(mCacheReadCount, mCacheWriteCount, mResourceWaitCount); } @@ -970,7 +975,7 @@ void LLTextureFetchWorker::setupPacketData() mFirstPacket = (data_size - FIRST_PACKET_SIZE) / MAX_IMG_PACKET_SIZE + 1; if (FIRST_PACKET_SIZE + (mFirstPacket-1) * MAX_IMG_PACKET_SIZE != data_size) { - llwarns << "Bad CACHED TEXTURE size: " << data_size << " removing." << llendl; + LL_WARNS() << "Bad CACHED TEXTURE size: " << data_size << " removing." << LL_ENDL; removeFromCache(); resetFormattedData(); clearPackets(); @@ -1093,14 +1098,14 @@ bool LLTextureFetchWorker::doWork(S32 param) { if (mState == INIT || mState == LOAD_FROM_NETWORK || mState == LOAD_FROM_SIMULATOR) { - LL_DEBUGS("Texture") << mID << " abort: mImagePriority < F_ALMOST_ZERO" << llendl; + LL_DEBUGS("Texture") << mID << " abort: mImagePriority < F_ALMOST_ZERO" << LL_ENDL; return true; // abort } } if(mState > CACHE_POST && !mCanUseNET && !mCanUseHTTP) { //nowhere to get data, abort. - LL_WARNS("Texture") << mID << " abort, nowhere to get data" << llendl; + LL_WARNS("Texture") << mID << " abort, nowhere to get data" << LL_ENDL; return true ; } @@ -1216,7 +1221,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // //This should never happen // - LL_DEBUGS("Texture") << mID << " this should never happen" << llendl; + LL_DEBUGS("Texture") << mID << " this should never happen" << LL_ENDL; return false; } } @@ -1238,7 +1243,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mLoadedDiscard < 0) { LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard - << ", should be >=0" << llendl; + << ", should be >=0" << LL_ENDL; } setState(DECODE_IMAGE); mInCache = TRUE; @@ -1246,7 +1251,7 @@ bool LLTextureFetchWorker::doWork(S32 param) LL_DEBUGS("Texture") << mID << ": Cached. Bytes: " << mFormattedImage->getDataSize() << " Size: " << llformat("%dx%d",mFormattedImage->getWidth(),mFormattedImage->getHeight()) << " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL; - LLTextureFetch::sCacheHitRate.addValue(100.f); + record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(1)); } else { @@ -1264,7 +1269,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } // fall through - LLTextureFetch::sCacheHitRate.addValue(0.f); + record(LLTextureFetch::sCacheHitRate, LLUnits::Ratio::fromValue(0)); } } @@ -1297,7 +1302,7 @@ bool LLTextureFetchWorker::doWork(S32 param) else { // This will happen if not logged in or if a region deoes not have HTTP Texture enabled - //llwarns << "Region not found for host: " << mHost << llendl; + //LL_WARNS() << "Region not found for host: " << mHost << LL_ENDL; mCanUseHTTP = false; } } @@ -1340,7 +1345,7 @@ bool LLTextureFetchWorker::doWork(S32 param) //recordTextureStart(false); //setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); - LL_DEBUGS("Texture") << mID << " does this happen?" << llendl; + LL_DEBUGS("Texture") << mID << " does this happen?" << LL_ENDL; return false; } } @@ -1358,15 +1363,15 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mFormattedImage.isNull() || !mFormattedImage->getDataSize()) { // processSimulatorPackets() failed -// llwarns << "processSimulatorPackets() failed to load buffer" << llendl; - LL_WARNS("Texture") << mID << " processSimulatorPackets() failed to load buffer" << llendl; +// LL_WARNS() << "processSimulatorPackets() failed to load buffer" << LL_ENDL; + LL_WARNS("Texture") << mID << " processSimulatorPackets() failed to load buffer" << LL_ENDL; return true; // failed } setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); if (mLoadedDiscard < 0) { LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard - << ", should be >=0" << llendl; + << ", should be >=0" << LL_ENDL; } setState(DECODE_IMAGE); mWriteToCacheState = SHOULD_WRITE; @@ -1416,7 +1421,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (! mCanUseHTTP) { releaseHttpSemaphore(); - LL_WARNS("Texture") << mID << " abort: SEND_HTTP_REQ but !mCanUseHTTP" << llendl; + LL_WARNS("Texture") << mID << " abort: SEND_HTTP_REQ but !mCanUseHTTP" << LL_ENDL; return true; // abort } @@ -1436,7 +1441,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mLoadedDiscard < 0) { LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard - << ", should be >=0" << llendl; + << ", should be >=0" << LL_ENDL; } setState(DECODE_IMAGE); releaseHttpSemaphore(); @@ -1445,7 +1450,7 @@ bool LLTextureFetchWorker::doWork(S32 param) else { releaseHttpSemaphore(); - LL_WARNS("Texture") << mID << " SEND_HTTP_REQ abort: cur_size " << cur_size << " <=0" << llendl; + LL_WARNS("Texture") << mID << " SEND_HTTP_REQ abort: cur_size " << cur_size << " <=0" << LL_ENDL; return true; // abort. } } @@ -1493,7 +1498,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } if (LLCORE_HTTP_HANDLE_INVALID == mHttpHandle) { - llwarns << "HTTP GET request failed for " << mID << llendl; + LL_WARNS() << "HTTP GET request failed for " << mID << LL_ENDL; resetFormattedData(); releaseHttpSemaphore(); return true; // failed @@ -1523,11 +1528,11 @@ bool LLTextureFetchWorker::doWork(S32 param) { setState(DONE); releaseHttpSemaphore(); - LL_DEBUGS("Texture") << mID << " abort: WAIT_HTTP_REQ not found" << llendl; + LL_DEBUGS("Texture") << mID << " abort: WAIT_HTTP_REQ not found" << LL_ENDL; return true; // failed, means no map tile on the empty region. } - llwarns << "Texture missing from server (404): " << mUrl << llendl; + LL_WARNS() << "Texture missing from server (404): " << mUrl << LL_ENDL; // roll back to try UDP if (mCanUseNET) @@ -1551,10 +1556,10 @@ bool LLTextureFetchWorker::doWork(S32 param) } else { - llinfos << "HTTP GET failed for: " << mUrl + LL_INFOS() << "HTTP GET failed for: " << mUrl << " Status: " << mGetStatus.toTerseString() << " Reason: '" << mGetReason << "'" - << llendl; + << LL_ENDL; } mUrl.clear(); @@ -1566,7 +1571,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mLoadedDiscard < 0) { LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard - << ", should be >=0" << llendl; + << ", should be >=0" << LL_ENDL; } setState(DECODE_IMAGE); releaseHttpSemaphore(); @@ -1577,7 +1582,7 @@ bool LLTextureFetchWorker::doWork(S32 param) resetFormattedData(); setState(DONE); releaseHttpSemaphore(); - LL_WARNS("Texture") << mID << " abort: fail harder" << llendl; + LL_WARNS("Texture") << mID << " abort: fail harder" << LL_ENDL; return true; // failed } @@ -1601,7 +1606,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // abort. setState(DONE); - LL_WARNS("Texture") << mID << " abort: no data received" << llendl; + LL_WARNS("Texture") << mID << " abort: no data received" << LL_ENDL; releaseHttpSemaphore(); return true; } @@ -1670,7 +1675,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mLoadedDiscard < 0) { LL_WARNS("Texture") << mID << " mLoadedDiscard is " << mLoadedDiscard - << ", should be >=0" << llendl; + << ", should be >=0" << LL_ENDL; } setState(DECODE_IMAGE); if (mWriteToCacheState != NOT_WRITE) @@ -1711,26 +1716,26 @@ bool LLTextureFetchWorker::doWork(S32 param) { // We aborted, don't decode setState(DONE); - LL_DEBUGS("Texture") << mID << " DECODE_IMAGE abort: desired discard " << mDesiredDiscard << "<0" << llendl; + LL_DEBUGS("Texture") << mID << " DECODE_IMAGE abort: desired discard " << mDesiredDiscard << "<0" << LL_ENDL; return true; } if (mFormattedImage->getDataSize() <= 0) { - llwarns << "Decode entered with invalid mFormattedImage. ID = " << mID << llendl; + LL_WARNS() << "Decode entered with invalid mFormattedImage. ID = " << mID << LL_ENDL; //abort, don't decode setState(DONE); - LL_DEBUGS("Texture") << mID << " DECODE_IMAGE abort: (mFormattedImage->getDataSize() <= 0)" << llendl; + LL_DEBUGS("Texture") << mID << " DECODE_IMAGE abort: (mFormattedImage->getDataSize() <= 0)" << LL_ENDL; return true; } if (mLoadedDiscard < 0) { - llwarns << "Decode entered with invalid mLoadedDiscard. ID = " << mID << llendl; + LL_WARNS() << "Decode entered with invalid mLoadedDiscard. ID = " << mID << LL_ENDL; //abort, don't decode setState(DONE); - LL_DEBUGS("Texture") << mID << " DECODE_IMAGE abort: mLoadedDiscard < 0" << llendl; + LL_DEBUGS("Texture") << mID << " DECODE_IMAGE abort: mLoadedDiscard < 0" << LL_ENDL; return true; } @@ -1763,7 +1768,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mCachedSize > 0 && !mInLocalCache && mRetryAttempt == 0) { // Cache file should be deleted, try again -// llwarns << mID << ": Decode of cached file failed (removed), retrying" << llendl; +// LL_WARNS() << mID << ": Decode of cached file failed (removed), retrying" << LL_ENDL; llassert_always(mDecodeHandle == 0); mFormattedImage = NULL; ++mRetryAttempt; @@ -1773,7 +1778,7 @@ bool LLTextureFetchWorker::doWork(S32 param) } else { -// llwarns << "UNABLE TO LOAD TEXTURE: " << mID << " RETRIES: " << mRetryAttempt << llendl; +// LL_WARNS() << "UNABLE TO LOAD TEXTURE: " << mID << " RETRIES: " << mRetryAttempt << LL_ENDL; setState(DONE); // failed } } @@ -1855,7 +1860,7 @@ bool LLTextureFetchWorker::doWork(S32 param) setState(INIT); LL_DEBUGS("Texture") << mID << " more data requested, returning to INIT: " << " mDecodedDiscard " << mDecodedDiscard << ">= 0 && mDesiredDiscard " << mDesiredDiscard - << "<" << " mDecodedDiscard " << mDecodedDiscard << llendl; + << "<" << " mDecodedDiscard " << mDecodedDiscard << LL_ENDL; setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); return false; } @@ -1883,12 +1888,11 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe if (log_to_viewer_log || log_to_sim) { - U64 timeNow = LLTimer::getTotalTime(); - mFetcher->mTextureInfo.setRequestStartTime(mID, mMetricsStartTime); + mFetcher->mTextureInfo.setRequestStartTime(mID, mMetricsStartTime.value()); mFetcher->mTextureInfo.setRequestType(mID, LLTextureInfoDetails::REQUEST_TYPE_HTTP); mFetcher->mTextureInfo.setRequestSize(mID, mRequestedSize); mFetcher->mTextureInfo.setRequestOffset(mID, mRequestedOffset); - mFetcher->mTextureInfo.setRequestCompleteTimeAndLog(mID, timeNow); + mFetcher->mTextureInfo.setRequestCompleteTimeAndLog(mID, LLTimer::getTotalTime()); } bool success = true; @@ -1898,22 +1902,22 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe LL_DEBUGS("Texture") << "HTTP COMPLETE: " << mID << " status: " << status.toTerseString() << " '" << status.toString() << "'" - << llendl; + << LL_ENDL; // unsigned int offset(0), length(0), full_length(0); // response->getRange(&offset, &length, &full_length); -// llwarns << "HTTP COMPLETE: " << mID << " handle: " << handle +// LL_WARNS() << "HTTP COMPLETE: " << mID << " handle: " << handle // << " status: " << status.toULong() << " '" << status.toString() << "'" // << " req offset: " << mRequestedOffset << " req length: " << mRequestedSize // << " offset: " << offset << " length: " << length -// << llendl; +// << LL_ENDL; if (! status) { success = false; std::string reason(status.toString()); setGetStatus(status, reason); - llwarns << "CURL GET FAILED, status: " << status.toTerseString() - << " reason: " << reason << llendl; + LL_WARNS() << "CURL GET FAILED, status: " << status.toTerseString() + << " reason: " << reason << LL_ENDL; } else { @@ -1927,7 +1931,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe partial = (par_status == status); } - S32 data_size = callbackHttpGet(response, partial, success); + S32BytesImplicit data_size = callbackHttpGet(response, partial, success); if (log_texture_traffic && data_size > 0) { @@ -2123,13 +2127,13 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, if (mState != WAIT_HTTP_REQ) { - llwarns << "callbackHttpGet for unrequested fetch worker: " << mID - << " req=" << mSentRequest << " state= " << mState << llendl; + LL_WARNS() << "callbackHttpGet for unrequested fetch worker: " << mID + << " req=" << mSentRequest << " state= " << mState << LL_ENDL; return data_size; } if (mLoaded) { - llwarns << "Duplicate callback for " << mID.asString() << llendl; + LL_WARNS() << "Duplicate callback for " << mID.asString() << LL_ENDL; return data_size ; // ignore duplicate callback } if (success) @@ -2194,7 +2198,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(LLCore::HttpResponse * response, else if (data_size > mRequestedSize) { // *TODO: This shouldn't be happening any more (REALLY don't expect this anymore) - llwarns << "data_size = " << data_size << " > requested: " << mRequestedSize << llendl; + LL_WARNS() << "data_size = " << data_size << " > requested: " << mRequestedSize << LL_ENDL; mHaveAllData = TRUE; llassert_always(mDecodeHandle == 0); mFormattedImage = NULL; // discard any previous data we had @@ -2229,7 +2233,7 @@ void LLTextureFetchWorker::callbackCacheRead(bool success, LLImageFormatted* ima LLMutexLock lock(&mWorkMutex); // +Mw if (mState != LOAD_FROM_TEXTURE_CACHE) { -// llwarns << "Read callback for " << mID << " with state = " << mState << llendl; +// LL_WARNS() << "Read callback for " << mID << " with state = " << mState << LL_ENDL; return; } if (success) @@ -2254,7 +2258,7 @@ void LLTextureFetchWorker::callbackCacheWrite(bool success) LLMutexLock lock(&mWorkMutex); // +Mw if (mState != WAIT_ON_WRITE) { -// llwarns << "Write callback for " << mID << " with state = " << mState << llendl; +// LL_WARNS() << "Write callback for " << mID << " with state = " << mState << LL_ENDL; return; } mWritten = TRUE; @@ -2273,7 +2277,7 @@ void LLTextureFetchWorker::callbackDecoded(bool success, LLImageRaw* raw, LLImag } if (mState != DECODE_IMAGE_UPDATE) { -// llwarns << "Decode callback for " << mID << " with state = " << mState << llendl; +// LL_WARNS() << "Decode callback for " << mID << " with state = " << mState << LL_ENDL; mDecodeHandle = 0; return; } @@ -2291,12 +2295,12 @@ void LLTextureFetchWorker::callbackDecoded(bool success, LLImageRaw* raw, LLImag } else { - llwarns << "DECODE FAILED: " << mID << " Discard: " << (S32)mFormattedImage->getDiscardLevel() << llendl; + LL_WARNS() << "DECODE FAILED: " << mID << " Discard: " << (S32)mFormattedImage->getDiscardLevel() << LL_ENDL; removeFromCache(); mDecodedDiscard = -1; // Redundant, here for clarity and paranoia } mDecoded = TRUE; -// llinfos << mID << " : DECODE COMPLETE " << llendl; +// LL_INFOS() << mID << " : DECODE COMPLETE " << LL_ENDL; setPriority(LLWorkerThread::PRIORITY_HIGH | mWorkPriority); mCacheReadTime = mCacheReadTimer.getElapsedTimeF32(); } // -Mw @@ -2329,11 +2333,11 @@ bool LLTextureFetchWorker::writeToCacheComplete() // Threads: Ttf void LLTextureFetchWorker::recordTextureStart(bool is_http) { - if (! mMetricsStartTime) + if (! mMetricsStartTime.value()) { mMetricsStartTime = LLViewerAssetStatsFF::get_timestamp(); } - LLViewerAssetStatsFF::record_enqueue_thread1(LLViewerAssetType::AT_TEXTURE, + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, is_http, LLImageBase::TYPE_AVATAR_BAKE == mType); } @@ -2342,15 +2346,15 @@ void LLTextureFetchWorker::recordTextureStart(bool is_http) // Threads: Ttf void LLTextureFetchWorker::recordTextureDone(bool is_http) { - if (mMetricsStartTime) + if (mMetricsStartTime.value()) { - LLViewerAssetStatsFF::record_response_thread1(LLViewerAssetType::AT_TEXTURE, + LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_TEXTURE, is_http, LLImageBase::TYPE_AVATAR_BAKE == mType, LLViewerAssetStatsFF::get_timestamp() - mMetricsStartTime); - mMetricsStartTime = 0; + mMetricsStartTime = (U32Seconds)0; } - LLViewerAssetStatsFF::record_dequeue_thread1(LLViewerAssetType::AT_TEXTURE, + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, is_http, LLImageBase::TYPE_AVATAR_BAKE == mType); } @@ -2390,7 +2394,7 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image mFetcherLocked(FALSE) { mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); - mTextureInfo.setUpLogging(gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog"), gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"), gSavedSettings.getU32("TextureLoggingThreshold")); + mTextureInfo.setUpLogging(gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog"), gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"), U32Bytes(gSavedSettings.getU32("TextureLoggingThreshold"))); LLTextureFetchDebugger::sDebuggerEnabled = gSavedSettings.getBOOL("TextureFetchDebuggerEnabled"); if(LLTextureFetchDebugger::isEnabled()) @@ -2479,8 +2483,8 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const { if (worker->mHost != host) { - llwarns << "LLTextureFetch::createRequest " << id << " called with multiple hosts: " - << host << " != " << worker->mHost << llendl; + LL_WARNS() << "LLTextureFetch::createRequest " << id << " called with multiple hosts: " + << host << " != " << worker->mHost << LL_ENDL; removeRequest(worker, true); worker = NULL; return false; @@ -2491,7 +2495,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const std::string exten = gDirUtilp->getExtension(url); if (!url.empty() && (!exten.empty() && LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C)) { - LL_DEBUGS("Texture") << "full request for " << id << " exten is not J2C: " << exten << llendl; + LL_DEBUGS("Texture") << "full request for " << id << " exten is not J2C: " << exten << LL_ENDL; // Only do partial requests for J2C at the moment desired_size = MAX_IMAGE_DATA_SIZE; desired_discard = 0; @@ -2558,7 +2562,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const worker->unlockWorkMutex(); // -Mw } - LL_DEBUGS("Texture") << "REQUESTED: " << id << " Discard: " << desired_discard << " size " << desired_size << llendl; + LL_DEBUGS("Texture") << "REQUESTED: " << id << " Discard: " << desired_discard << " size " << desired_size << LL_ENDL; return true; } @@ -2608,11 +2612,11 @@ void LLTextureFetch::addToHTTPQueue(const LLUUID& id) } // -Mfnq // Threads: T* -void LLTextureFetch::removeFromHTTPQueue(const LLUUID& id, S32 received_size) +void LLTextureFetch::removeFromHTTPQueue(const LLUUID& id, S32Bytes received_size) { LLMutexLock lock(&mNetworkQueueMutex); // +Mfnq mHTTPTextureQueue.erase(id); - mHTTPTextureBits += received_size * 8; // Approximate - does not include header bits + mHTTPTextureBits += received_size; // Approximate - does not include header bits } // -Mfnq // NB: If you change deleteRequest() you should probably make @@ -2752,7 +2756,7 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, // Should only happen if we set mDebugPause... if (!mDebugPause) { -// llwarns << "Adding work for inactive worker: " << id << llendl; +// LL_WARNS() << "Adding work for inactive worker: " << id << LL_ENDL; worker->addWork(0, LLWorkerThread::PRIORITY_HIGH | worker->mWorkPriority); } } @@ -2762,10 +2766,10 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, discard_level = worker->mDecodedDiscard; raw = worker->mRawImage; aux = worker->mAuxImage; - F32 cache_read_time = worker->mCacheReadTime; - if (cache_read_time != 0.f) + F32Seconds cache_read_time(worker->mCacheReadTime); + if (cache_read_time != (F32Seconds)0.f) { - sCacheReadLatency.addValue(cache_read_time * 1000.f); + record(sCacheReadLatency, cache_read_time); } res = true; LL_DEBUGS("Texture") << id << ": Request Finished. State: " << worker->mState << " Discard: " << discard_level << LL_ENDL; @@ -2889,10 +2893,10 @@ S32 LLTextureFetch::update(F32 max_time_ms) { mNetworkQueueMutex.lock(); // +Mfnq - mMaxBandwidth = band_width; + mMaxBandwidth = band_width(); - gTextureList.sTextureBits += mHTTPTextureBits; - mHTTPTextureBits = 0; + add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, mHTTPTextureBits); + mHTTPTextureBits = (U32Bits)0; mNetworkQueueMutex.unlock(); // -Mfnq } @@ -2988,7 +2992,7 @@ void LLTextureFetch::threadedUpdate() S32 q = mCurlGetRequest->getQueued(); if (q > 0) { - llinfos << "Queued gets: " << q << llendl; + LL_INFOS() << "Queued gets: " << q << LL_ENDL; info_timer.reset(); } } @@ -3037,7 +3041,7 @@ void LLTextureFetch::sendRequestListToSimulators() (req->mState != LLTextureFetchWorker::LOAD_FROM_SIMULATOR)) { // We already received our URL, remove from the queue - llwarns << "Worker: " << req->mID << " in mNetworkQueue but in wrong state: " << req->mState << llendl; + LL_WARNS() << "Worker: " << req->mID << " in mNetworkQueue but in wrong state: " << req->mState << LL_ENDL; mNetworkQueue.erase(curiter); continue; } @@ -3105,8 +3109,8 @@ void LLTextureFetch::sendRequestListToSimulators() gMessageSystem->addF32Fast(_PREHASH_DownloadPriority, req->mImagePriority); gMessageSystem->addU32Fast(_PREHASH_Packet, packet); gMessageSystem->addU8Fast(_PREHASH_Type, req->mType); -// llinfos << "IMAGE REQUEST: " << req->mID << " Discard: " << req->mDesiredDiscard -// << " Packet: " << packet << " Priority: " << req->mImagePriority << llendl; +// LL_INFOS() << "IMAGE REQUEST: " << req->mID << " Discard: " << req->mDesiredDiscard +// << " Packet: " << packet << " Priority: " << req->mImagePriority << LL_ENDL; static LLCachedControl<bool> log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog", false); static LLCachedControl<bool> log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator", false); @@ -3127,7 +3131,7 @@ void LLTextureFetch::sendRequestListToSimulators() sim_request_count++; if (sim_request_count >= IMAGES_PER_REQUEST) { -// llinfos << "REQUESTING " << sim_request_count << " IMAGES FROM HOST: " << host.getIPString() << llendl; +// LL_INFOS() << "REQUESTING " << sim_request_count << " IMAGES FROM HOST: " << host.getIPString() << LL_ENDL; gMessageSystem->sendSemiReliable(host, NULL, NULL); sim_request_count = 0; @@ -3136,7 +3140,7 @@ void LLTextureFetch::sendRequestListToSimulators() } if (gMessageSystem && sim_request_count > 0 && sim_request_count < IMAGES_PER_REQUEST) { -// llinfos << "REQUESTING " << sim_request_count << " IMAGES FROM HOST: " << host.getIPString() << llendl; +// LL_INFOS() << "REQUESTING " << sim_request_count << " IMAGES FROM HOST: " << host.getIPString() << LL_ENDL; gMessageSystem->sendSemiReliable(host, NULL, NULL); sim_request_count = 0; } @@ -3172,7 +3176,7 @@ void LLTextureFetch::sendRequestListToSimulators() gMessageSystem->addF32Fast(_PREHASH_DownloadPriority, 0); gMessageSystem->addU32Fast(_PREHASH_Packet, 0); gMessageSystem->addU8Fast(_PREHASH_Type, 0); -// llinfos << "CANCELING IMAGE REQUEST: " << (*iter2) << llendl; +// LL_INFOS() << "CANCELING IMAGE REQUEST: " << (*iter2) << LL_ENDL; request_count++; if (request_count >= IMAGES_PER_REQUEST) @@ -3200,12 +3204,12 @@ bool LLTextureFetchWorker::insertPacket(S32 index, U8* data, S32 size) mRequestedTimer.reset(); if (index >= mTotalPackets) { -// llwarns << "Received Image Packet " << index << " > max: " << mTotalPackets << " for image: " << mID << llendl; +// LL_WARNS() << "Received Image Packet " << index << " > max: " << mTotalPackets << " for image: " << mID << LL_ENDL; return false; } if (index > 0 && index < mTotalPackets-1 && size != MAX_IMG_PACKET_SIZE) { -// llwarns << "Received bad sized packet: " << index << ", " << size << " != " << MAX_IMG_PACKET_SIZE << " for image: " << mID << llendl; +// LL_WARNS() << "Received bad sized packet: " << index << ", " << size << " != " << MAX_IMG_PACKET_SIZE << " for image: " << mID << LL_ENDL; return false; } @@ -3215,7 +3219,7 @@ bool LLTextureFetchWorker::insertPacket(S32 index, U8* data, S32 size) } else if (mPackets[index] != NULL) { -// llwarns << "Received duplicate packet: " << index << " for image: " << mID << llendl; +// LL_WARNS() << "Received duplicate packet: " << index << " for image: " << mID << LL_ENDL; return false; } @@ -3247,7 +3251,7 @@ void LLTextureFetchWorker::setState(e_state new_state) "WAIT_ON_WRITE", "DONE" }; - LL_DEBUGS("Texture") << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << llendl; + LL_DEBUGS("Texture") << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << LL_ENDL; mState = new_state; } @@ -3262,26 +3266,26 @@ bool LLTextureFetch::receiveImageHeader(const LLHost& host, const LLUUID& id, U8 if (!worker) { -// llwarns << "Received header for non active worker: " << id << llendl; +// LL_WARNS() << "Received header for non active worker: " << id << LL_ENDL; res = false; } else if (worker->mState != LLTextureFetchWorker::LOAD_FROM_NETWORK || worker->mSentRequest != LLTextureFetchWorker::SENT_SIM) { -// llwarns << "receiveImageHeader for worker: " << id +// LL_WARNS() << "receiveImageHeader for worker: " << id // << " in state: " << LLTextureFetchWorker::sStateDescs[worker->mState] -// << " sent: " << worker->mSentRequest << llendl; +// << " sent: " << worker->mSentRequest << LL_ENDL; res = false; } else if (worker->mLastPacket != -1) { // check to see if we've gotten this packet before -// llwarns << "Received duplicate header for: " << id << llendl; +// LL_WARNS() << "Received duplicate header for: " << id << LL_ENDL; res = false; } else if (!data_size) { -// llwarns << "Img: " << id << ":" << " Empty Image Header" << llendl; +// LL_WARNS() << "Img: " << id << ":" << " Empty Image Header" << LL_ENDL; res = false; } if (!res) @@ -3323,17 +3327,17 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U1 if (!worker) { -// llwarns << "Received packet " << packet_num << " for non active worker: " << id << llendl; +// LL_WARNS() << "Received packet " << packet_num << " for non active worker: " << id << LL_ENDL; res = false; } else if (worker->mLastPacket == -1) { -// llwarns << "Received packet " << packet_num << " before header for: " << id << llendl; +// LL_WARNS() << "Received packet " << packet_num << " before header for: " << id << LL_ENDL; res = false; } else if (!data_size) { -// llwarns << "Img: " << id << ":" << " Empty Image Header" << llendl; +// LL_WARNS() << "Img: " << id << ":" << " Empty Image Header" << LL_ENDL; res = false; } if (!res) @@ -3361,8 +3365,8 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U1 } else { -// llwarns << "receiveImagePacket " << packet_num << "/" << worker->mLastPacket << " for worker: " << id -// << " in state: " << LLTextureFetchWorker::sStateDescs[worker->mState] << llendl; +// LL_WARNS() << "receiveImagePacket " << packet_num << "/" << worker->mLastPacket << " for worker: " << id +// << " in state: " << LLTextureFetchWorker::sStateDescs[worker->mState] << LL_ENDL; removeFromNetworkQueue(worker, true); // failsafe } @@ -3373,7 +3377,7 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U1 if (log_to_viewer_log || log_to_sim) { - U64 timeNow = LLTimer::getTotalTime(); + U64Microseconds timeNow = LLTimer::getTotalTime(); mTextureInfo.setRequestSize(id, worker->mFileSize); mTextureInfo.setRequestCompleteTimeAndLog(id, timeNow); } @@ -3454,33 +3458,33 @@ S32 LLTextureFetch::getFetchState(const LLUUID& id, F32& data_progress_p, F32& r void LLTextureFetch::dump() { - llinfos << "LLTextureFetch REQUESTS:" << llendl; + LL_INFOS() << "LLTextureFetch REQUESTS:" << LL_ENDL; for (request_queue_t::iterator iter = mRequestQueue.begin(); iter != mRequestQueue.end(); ++iter) { LLQueuedThread::QueuedRequest* qreq = *iter; LLWorkerThread::WorkRequest* wreq = (LLWorkerThread::WorkRequest*)qreq; LLTextureFetchWorker* worker = (LLTextureFetchWorker*)wreq->getWorkerClass(); - llinfos << " ID: " << worker->mID + LL_INFOS() << " ID: " << worker->mID << " PRI: " << llformat("0x%08x",wreq->getPriority()) << " STATE: " << worker->sStateDescs[worker->mState] - << llendl; + << LL_ENDL; } - llinfos << "LLTextureFetch ACTIVE_HTTP:" << llendl; + LL_INFOS() << "LLTextureFetch ACTIVE_HTTP:" << LL_ENDL; for (queue_t::const_iterator iter(mHTTPTextureQueue.begin()); mHTTPTextureQueue.end() != iter; ++iter) { - llinfos << " ID: " << (*iter) << llendl; + LL_INFOS() << " ID: " << (*iter) << LL_ENDL; } - llinfos << "LLTextureFetch WAIT_HTTP_RESOURCE:" << llendl; + LL_INFOS() << "LLTextureFetch WAIT_HTTP_RESOURCE:" << LL_ENDL; for (wait_http_res_queue_t::const_iterator iter(mHttpWaitResource.begin()); mHttpWaitResource.end() != iter; ++iter) { - llinfos << " ID: " << (*iter) << llendl; + LL_INFOS() << " ID: " << (*iter) << LL_ENDL; } } @@ -3798,7 +3802,7 @@ AssetReportHandler stats_handler; bool TFReqSetRegion::doWork(LLTextureFetch *) { - LLViewerAssetStatsFF::set_region_thread1(mRegionHandle); + LLViewerAssetStatsFF::set_region(mRegionHandle); return true; } @@ -3823,8 +3827,8 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) static const U32 report_priority(1); static LLCore::HttpHandler * const handler(fetcher->isQAMode() || true ? &stats_handler : NULL); - if (! gViewerAssetStatsThread1) - return true; + //if (! gViewerAssetStatsThread1) + // return true; static volatile bool reporting_started(false); static volatile S32 report_sequence(0); @@ -3834,17 +3838,21 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) // but leave it in 'this'. Destructor will rid us of it. LLViewerAssetStats & main_stats = *mMainStats; - // Merge existing stats into those from main, convert to LLSD - main_stats.merge(*gViewerAssetStatsThread1); - LLSD merged_llsd = main_stats.asLLSD(true); - - // Add some additional meta fields to the content - merged_llsd["session_id"] = mSessionID; - merged_llsd["agent_id"] = mAgentID; - merged_llsd["message"] = "ViewerAssetMetrics"; // Identifies the type of metrics - merged_llsd["sequence"] = report_sequence; // Sequence number - merged_llsd["initial"] = ! reporting_started; // Initial data from viewer - merged_llsd["break"] = LLTextureFetch::svMetricsDataBreak; // Break in data prior to this report + LLViewerAssetStats::AssetStats stats; + main_stats.getStats(stats, true); + //LLSD merged_llsd = main_stats.asLLSD(); + + bool initial_report = !reporting_started; + stats.session_id = mSessionID; + stats.agent_id = mAgentID; + stats.message = "ViewerAssetMetrics"; + stats.sequence = static_cast<bool>(report_sequence); + stats.initial = initial_report; + stats.break_ = static_cast<bool>(LLTextureFetch::svMetricsDataBreak); + + LLSD sd; + LLParamSDParser parser; + parser.writeSD(sd, stats); // Update sequence number if (S32_MAX == ++report_sequence) @@ -3852,13 +3860,14 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) reporting_started = true; // Limit the size of the stats report if necessary. - merged_llsd["truncated"] = truncate_viewer_metrics(10, merged_llsd); + + sd["truncated"] = truncate_viewer_metrics(10, sd); if (! mCapsURL.empty()) { LLCore::BufferArray * ba = new LLCore::BufferArray; LLCore::BufferArrayStream bas(ba); - LLSDSerialize::toXML(merged_llsd, bas); + LLSDSerialize::toXML(sd, bas); fetcher->getHttpRequest().requestPost(fetcher->getPolicyClass(), report_priority, @@ -3878,11 +3887,9 @@ TFReqSendMetrics::doWork(LLTextureFetch * fetcher) // In QA mode, Metrics submode, log the result for ease of testing if (fetcher->isQAMode()) { - LL_INFOS("Textures") << ll_pretty_print_sd(merged_llsd) << LL_ENDL; + LL_INFOS("Textures") << ll_pretty_print_sd(sd) << LL_ENDL; } - gViewerAssetStatsThread1->reset(); - return true; } @@ -4390,14 +4397,14 @@ void LLTextureFetchDebugger::debugHTTP() LLViewerRegion* region = gAgent.getRegion(); if (!region) { - llinfos << "Fetch Debugger : Current region undefined. Cannot fetch textures through HTTP." << llendl; + LL_INFOS() << "Fetch Debugger : Current region undefined. Cannot fetch textures through HTTP." << LL_ENDL; return; } mHTTPUrl = region->getHttpUrl(); if (mHTTPUrl.empty()) { - llinfos << "Fetch Debugger : Current region URL undefined. Cannot fetch textures through HTTP." << llendl; + LL_INFOS() << "Fetch Debugger : Current region URL undefined. Cannot fetch textures through HTTP." << LL_ENDL; return; } @@ -4476,7 +4483,7 @@ S32 LLTextureFetchDebugger::fillCurlQueue() mFetchingHistory[i].mCurlState = FetchEntry::CURL_DONE; } } - //llinfos << "Fetch Debugger : Having " << mNbCurlRequests << " requests through the curl thread." << llendl; + //LL_INFOS() << "Fetch Debugger : Having " << mNbCurlRequests << " requests through the curl thread." << LL_ENDL; return mNbCurlRequests; } @@ -4778,7 +4785,7 @@ void LLTextureFetchDebugger::onCompleted(LLCore::HttpHandle handle, LLCore::Http handle_fetch_map_t::iterator iter(mHandleToFetchIndex.find(handle)); if (mHandleToFetchIndex.end() == iter) { - llinfos << "Fetch Debugger : Couldn't find handle " << handle << " in fetch list." << llendl; + LL_INFOS() << "Fetch Debugger : Couldn't find handle " << handle << " in fetch list." << LL_ENDL; return; } @@ -4786,7 +4793,7 @@ void LLTextureFetchDebugger::onCompleted(LLCore::HttpHandle handle, LLCore::Http mHandleToFetchIndex.erase(iter); if (fetch_ind >= mFetchingHistory.size() || mFetchingHistory[fetch_ind].mHttpHandle != handle) { - llinfos << "Fetch Debugger : Handle and fetch object in disagreement. Punting." << llendl; + LL_INFOS() << "Fetch Debugger : Handle and fetch object in disagreement. Punting." << LL_ENDL; } else { @@ -4836,7 +4843,7 @@ void LLTextureFetchDebugger::callbackHTTP(FetchEntry & fetch, LLCore::HttpRespon S32 data_size = ba ? ba->size() : 0; fetch.mCurlReceivedSize += data_size; - //llinfos << "Fetch Debugger : got results for " << fetch.mID << ", data_size = " << data_size << ", received = " << fetch.mCurlReceivedSize << ", requested = " << fetch.mRequestedSize << ", partial = " << partial << llendl; + //LL_INFOS() << "Fetch Debugger : got results for " << fetch.mID << ", data_size = " << data_size << ", received = " << fetch.mCurlReceivedSize << ", requested = " << fetch.mRequestedSize << ", partial = " << partial << LL_ENDL; if ((fetch.mCurlReceivedSize >= fetch.mRequestedSize) || !partial || (fetch.mRequestedSize == 600)) { U8* d_buffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), data_size); @@ -4862,9 +4869,9 @@ void LLTextureFetchDebugger::callbackHTTP(FetchEntry & fetch, LLCore::HttpRespon } else //failed { - llinfos << "Fetch Debugger : CURL GET FAILED, ID = " << fetch.mID + LL_INFOS() << "Fetch Debugger : CURL GET FAILED, ID = " << fetch.mID << ", status: " << status.toTerseString() - << " reason: " << status.toString() << llendl; + << " reason: " << status.toString() << LL_ENDL; } } diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 3c79a5a24d7ed8eca0a8d1a04d085521a6850e62..d7fb2b4356cb1c2f10a4342c45d4df0e50e28546 100755 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -37,15 +37,15 @@ #include "lltextureinfo.h" #include "llapr.h" #include "llimageworker.h" -#include "llstat.h" #include "llcurl.h" -#include "llstat.h" #include "httprequest.h" #include "httpoptions.h" #include "httpheaders.h" #include "httphandler.h" +#include "lltrace.h" #include "llviewertexture.h" +class LLViewerTexture; class LLTextureFetchWorker; class LLImageDecodeThread; class LLHost; @@ -234,7 +234,7 @@ class LLTextureFetch : public LLWorkerThread // XXX possible delete // Threads: T* - void removeFromHTTPQueue(const LLUUID& id, S32 received_size); + void removeFromHTTPQueue(const LLUUID& id, S32Bytes received_size); // Identical to @deleteRequest but with different arguments // (caller already has the worker pointer). @@ -309,8 +309,8 @@ class LLTextureFetch : public LLWorkerThread LLMutex mQueueMutex; //to protect mRequestMap and mCommands only LLMutex mNetworkQueueMutex; //to protect mNetworkQueue, mHTTPTextureQueue and mCancelQueue. - static LLStat sCacheHitRate; - static LLStat sCacheReadLatency; + static LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > sCacheHitRate; + static LLTrace::EventStatHandle<F64Milliseconds > sCacheReadLatency; LLTextureCache* mTextureCache; LLImageDecodeThread* mImageDecodeThread; @@ -330,7 +330,7 @@ class LLTextureFetch : public LLWorkerThread LLTextureInfo mTextureInfo; // XXX possible delete - U32 mHTTPTextureBits; // Mfnq + U32Bits mHTTPTextureBits; // Mfnq // XXX possible delete //debug use diff --git a/indra/newview/lltextureinfo.cpp b/indra/newview/lltextureinfo.cpp index adfdbc997e288199d5e1394ae06cd09908a039eb..59d692b2876d3050786f2a184bf7cd5084089717 100755 --- a/indra/newview/lltextureinfo.cpp +++ b/indra/newview/lltextureinfo.cpp @@ -29,26 +29,28 @@ #include "lltextureinfo.h" #include "lltexturestats.h" #include "llviewercontrol.h" +#include "lltrace.h" + +static LLTrace::CountStatHandle<S32> sTextureDownloadsStarted("texture_downloads_started", "number of texture downloads initiated"); +static LLTrace::CountStatHandle<S32> sTextureDownloadsCompleted("texture_downloads_completed", "number of texture downloads completed"); +static LLTrace::CountStatHandle<S32Bytes > sTextureDataDownloaded("texture_data_downloaded", "amount of texture data downloaded"); +static LLTrace::CountStatHandle<U32Milliseconds > sTexureDownloadTime("texture_download_time", "amount of time spent fetching textures"); LLTextureInfo::LLTextureInfo() : mLogTextureDownloadsToViewerLog(false), mLogTextureDownloadsToSimulator(false), - mTotalBytes(0), - mTotalMilliseconds(0), - mTextureDownloadsStarted(0), - mTextureDownloadsCompleted(0), mTextureDownloadProtocol("NONE"), - mTextureLogThreshold(100 * 1024), - mCurrentStatsBundleStartTime(0) + mTextureLogThreshold(LLUnits::Kilobytes::fromValue(100)) { mTextures.clear(); + mRecording.start(); } -void LLTextureInfo::setUpLogging(bool writeToViewerLog, bool sendToSim, U32 textureLogThreshold) +void LLTextureInfo::setUpLogging(bool writeToViewerLog, bool sendToSim, U32Bytes textureLogThreshold) { mLogTextureDownloadsToViewerLog = writeToViewerLog; mLogTextureDownloadsToSimulator = sendToSim; - mTextureLogThreshold = textureLogThreshold; + mTextureLogThreshold = U32Bytes(textureLogThreshold); } LLTextureInfo::~LLTextureInfo() @@ -93,8 +95,8 @@ void LLTextureInfo::setRequestStartTime(const LLUUID& id, U64 startTime) { addRequest(id); } - mTextures[id]->mStartTime = startTime; - mTextureDownloadsStarted++; + mTextures[id]->mStartTime = (U64Microseconds)startTime; + add(sTextureDownloadsStarted, 1); } void LLTextureInfo::setRequestSize(const LLUUID& id, U32 size) @@ -103,7 +105,7 @@ void LLTextureInfo::setRequestSize(const LLUUID& id, U32 size) { addRequest(id); } - mTextures[id]->mSize = size; + mTextures[id]->mSize = (U32Bytes)size; } void LLTextureInfo::setRequestOffset(const LLUUID& id, U32 offset) @@ -124,16 +126,19 @@ void LLTextureInfo::setRequestType(const LLUUID& id, LLTextureInfoDetails::LLReq mTextures[id]->mType = type; } -void LLTextureInfo::setRequestCompleteTimeAndLog(const LLUUID& id, U64 completeTime) +void LLTextureInfo::setRequestCompleteTimeAndLog(const LLUUID& id, U64Microseconds completeTime) { if (!has(id)) { addRequest(id); } - mTextures[id]->mCompleteTime = completeTime; + + LLTextureInfoDetails& details = *mTextures[id]; + + details.mCompleteTime = completeTime; std::string protocol = "NONE"; - switch(mTextures[id]->mType) + switch(details.mType) { case LLTextureInfoDetails::REQUEST_TYPE_HTTP: protocol = "HTTP"; @@ -150,24 +155,23 @@ void LLTextureInfo::setRequestCompleteTimeAndLog(const LLUUID& id, U64 completeT if (mLogTextureDownloadsToViewerLog) { - llinfos << "texture=" << id - << " start=" << mTextures[id]->mStartTime - << " end=" << mTextures[id]->mCompleteTime - << " size=" << mTextures[id]->mSize - << " offset=" << mTextures[id]->mOffset - << " length_in_ms=" << (mTextures[id]->mCompleteTime - mTextures[id]->mStartTime) / 1000 - << " protocol=" << protocol - << llendl; + LL_INFOS() << "texture=" << id + << " start=" << details.mStartTime + << " end=" << details.mCompleteTime + << " size=" << details.mSize + << " offset=" << details.mOffset + << " length=" << U32Milliseconds(details.mCompleteTime - details.mStartTime) + << " protocol=" << protocol + << LL_ENDL; } if(mLogTextureDownloadsToSimulator) { - S32 texture_stats_upload_threshold = mTextureLogThreshold; - mTotalBytes += mTextures[id]->mSize; - mTotalMilliseconds += mTextures[id]->mCompleteTime - mTextures[id]->mStartTime; - mTextureDownloadsCompleted++; + add(sTextureDataDownloaded, details.mSize); + add(sTexureDownloadTime, details.mCompleteTime - details.mStartTime); + add(sTextureDownloadsCompleted, 1); mTextureDownloadProtocol = protocol; - if (mTotalBytes >= texture_stats_upload_threshold) + if (mRecording.getSum(sTextureDataDownloaded) >= mTextureLogThreshold) { LLSD texture_data; std::stringstream startTime; @@ -189,39 +193,37 @@ LLSD LLTextureInfo::getAverages() { LLSD averagedTextureData; S32 averageDownloadRate; - if(mTotalMilliseconds == 0) + U32Milliseconds download_time = mRecording.getSum(sTexureDownloadTime); + if(download_time == (U32Milliseconds)0) { averageDownloadRate = 0; } else { - averageDownloadRate = (mTotalBytes * 8) / mTotalMilliseconds; + averageDownloadRate = mRecording.getSum(sTextureDataDownloaded).valueInUnits<LLUnits::Bits>() / download_time.valueInUnits<LLUnits::Seconds>(); } - averagedTextureData["bits_per_second"] = averageDownloadRate; - averagedTextureData["bytes_downloaded"] = mTotalBytes; - averagedTextureData["texture_downloads_started"] = mTextureDownloadsStarted; - averagedTextureData["texture_downloads_completed"] = mTextureDownloadsCompleted; - averagedTextureData["transport"] = mTextureDownloadProtocol; + averagedTextureData["bits_per_second"] = averageDownloadRate; + averagedTextureData["bytes_downloaded"] = mRecording.getSum(sTextureDataDownloaded).valueInUnits<LLUnits::Bytes>(); + averagedTextureData["texture_downloads_started"] = mRecording.getSum(sTextureDownloadsStarted); + averagedTextureData["texture_downloads_completed"] = mRecording.getSum(sTextureDownloadsCompleted); + averagedTextureData["transport"] = mTextureDownloadProtocol; return averagedTextureData; } void LLTextureInfo::resetTextureStatistics() { - mTotalMilliseconds = 0; - mTotalBytes = 0; - mTextureDownloadsStarted = 0; - mTextureDownloadsCompleted = 0; + mRecording.restart(); mTextureDownloadProtocol = "NONE"; mCurrentStatsBundleStartTime = LLTimer::getTotalTime(); } -U32 LLTextureInfo::getRequestStartTime(const LLUUID& id) +U32Microseconds LLTextureInfo::getRequestStartTime(const LLUUID& id) { if (!has(id)) { - return 0; + return U32Microseconds(0); } else { @@ -230,11 +232,11 @@ U32 LLTextureInfo::getRequestStartTime(const LLUUID& id) } } -U32 LLTextureInfo::getRequestSize(const LLUUID& id) +U32Bytes LLTextureInfo::getRequestSize(const LLUUID& id) { if (!has(id)) { - return 0; + return U32Bytes(0); } else { @@ -269,11 +271,11 @@ LLTextureInfoDetails::LLRequestType LLTextureInfo::getRequestType(const LLUUID& } } -U32 LLTextureInfo::getRequestCompleteTime(const LLUUID& id) +U32Microseconds LLTextureInfo::getRequestCompleteTime(const LLUUID& id) { if (!has(id)) { - return 0; + return U32Microseconds(0); } else { diff --git a/indra/newview/lltextureinfo.h b/indra/newview/lltextureinfo.h index 2ccbcc5fd24a87849f215df87bbab7d251e9c22e..176f2cbb7462f9e290bfdf61b53fd6b94eec8f35 100755 --- a/indra/newview/lltextureinfo.h +++ b/indra/newview/lltextureinfo.h @@ -29,6 +29,7 @@ #include "lluuid.h" #include "lltextureinfodetails.h" +#include "lltracerecording.h" #include <map> class LLTextureInfo @@ -37,18 +38,18 @@ class LLTextureInfo LLTextureInfo(); ~LLTextureInfo(); - void setUpLogging(bool writeToViewerLog, bool sendToSim, U32 textureLogThreshold); + void setUpLogging(bool writeToViewerLog, bool sendToSim, U32Bytes textureLogThreshold); bool has(const LLUUID& id); void setRequestStartTime(const LLUUID& id, U64 startTime); void setRequestSize(const LLUUID& id, U32 size); void setRequestOffset(const LLUUID& id, U32 offset); void setRequestType(const LLUUID& id, LLTextureInfoDetails::LLRequestType type); - void setRequestCompleteTimeAndLog(const LLUUID& id, U64 completeTime); - U32 getRequestStartTime(const LLUUID& id); - U32 getRequestSize(const LLUUID& id); + void setRequestCompleteTimeAndLog(const LLUUID& id, U64Microseconds completeTime); + U32Microseconds getRequestStartTime(const LLUUID& id); + U32Bytes getRequestSize(const LLUUID& id); U32 getRequestOffset(const LLUUID& id); LLTextureInfoDetails::LLRequestType getRequestType(const LLUUID& id); - U32 getRequestCompleteTime(const LLUUID& id); + U32Microseconds getRequestCompleteTime(const LLUUID& id); void resetTextureStatistics(); U32 getTextureInfoMapSize(); LLSD getAverages(); @@ -56,19 +57,14 @@ class LLTextureInfo private: void addRequest(const LLUUID& id); - std::map<LLUUID, LLTextureInfoDetails *> mTextures; - - LLSD mAverages; - - bool mLogTextureDownloadsToViewerLog; - bool mLogTextureDownloadsToSimulator; - S32 mTotalBytes; - S32 mTotalMilliseconds; - S32 mTextureDownloadsStarted; - S32 mTextureDownloadsCompleted; - std::string mTextureDownloadProtocol; - U32 mTextureLogThreshold; // in bytes - U64 mCurrentStatsBundleStartTime; + std::map<LLUUID, LLTextureInfoDetails *> mTextures; + LLSD mAverages; + bool mLogTextureDownloadsToViewerLog, + mLogTextureDownloadsToSimulator; + std::string mTextureDownloadProtocol; + U32Bytes mTextureLogThreshold; + U64Microseconds mCurrentStatsBundleStartTime; + LLTrace::Recording mRecording; }; #endif // LL_LLTEXTUREINFO_H diff --git a/indra/newview/lltextureinfodetails.cpp b/indra/newview/lltextureinfodetails.cpp index 0d750db3bf0b4895770aa5a9a35387bda552b4b4..cab16eb9229b6954561089b86f342863f7e6d6ac 100755 --- a/indra/newview/lltextureinfodetails.cpp +++ b/indra/newview/lltextureinfodetails.cpp @@ -28,7 +28,9 @@ #include "lltextureinfodetails.h" -LLTextureInfoDetails::LLTextureInfoDetails() : mStartTime(0), mCompleteTime(0), mSize(0), mType(REQUEST_TYPE_NONE), mOffset(0) +LLTextureInfoDetails::LLTextureInfoDetails() +: mType(REQUEST_TYPE_NONE), + mOffset(0) { } diff --git a/indra/newview/lltextureinfodetails.h b/indra/newview/lltextureinfodetails.h index 4a3cd290849fc20e2ab142dc70a240df92c4e817..a42c3350357d5bdb1e62d2d8c28a3089735c7fd8 100755 --- a/indra/newview/lltextureinfodetails.h +++ b/indra/newview/lltextureinfodetails.h @@ -28,10 +28,10 @@ #define LL_LLTEXTUREINFODETAILS_H #include "lluuid.h" +#include "llunits.h" -class LLTextureInfoDetails +struct LLTextureInfoDetails { -public: enum LLRequestType { REQUEST_TYPE_NONE, @@ -39,11 +39,11 @@ class LLTextureInfoDetails REQUEST_TYPE_UDP }; - U32 mStartTime; - U32 mCompleteTime; - U32 mOffset; - U32 mSize; - LLRequestType mType; + U32Microseconds mStartTime, + mCompleteTime; + U32 mOffset; + U32Bytes mSize; + LLRequestType mType; LLTextureInfoDetails(); }; diff --git a/indra/newview/lltexturestats.cpp b/indra/newview/lltexturestats.cpp index f820ae65df01713ab075b7ff682e3164b0af8f04..ca42d710f8cd5eceb4bc5d26e39b3cbbc72fa192 100755 --- a/indra/newview/lltexturestats.cpp +++ b/indra/newview/lltexturestats.cpp @@ -48,8 +48,7 @@ void send_texture_stats_to_sim(const LLSD &texture_stats) texture_stats_report["stats_data"] = texture_stats; std::string texture_cap_url = gAgent.getRegion()->getCapability("TextureStats"); - LLTextureStatsUploader tsu; - llinfos << "uploading texture stats data to simulator" << llendl; - tsu.uploadStatsToSimulator(texture_cap_url, texture_stats); + LL_INFOS() << "uploading texture stats data to simulator" << LL_ENDL; + LLTextureStatsUploader::uploadStatsToSimulator(texture_cap_url, texture_stats); } diff --git a/indra/newview/lltexturestatsuploader.cpp b/indra/newview/lltexturestatsuploader.cpp index 23ba09cb9119a48fabef77c7e41c4aa232b469ff..c4809bc8e78c06c9ebe9c33a3ed2c3c9c4f3e0e8 100755 --- a/indra/newview/lltexturestatsuploader.cpp +++ b/indra/newview/lltexturestatsuploader.cpp @@ -30,14 +30,8 @@ #include "llhttpclient.h" -LLTextureStatsUploader::LLTextureStatsUploader() -{ -} - -LLTextureStatsUploader::~LLTextureStatsUploader() -{ -} +// static void LLTextureStatsUploader::uploadStatsToSimulator(const std::string texture_cap_url, const LLSD &texture_stats) { if ( texture_cap_url != "" ) @@ -46,10 +40,10 @@ void LLTextureStatsUploader::uploadStatsToSimulator(const std::string texture_ca } else { - llinfos << "Not sending texture stats: " + LL_INFOS() << "Not sending texture stats: " << texture_stats << " as there is no cap url." - << llendl; + << LL_ENDL; } } diff --git a/indra/newview/lltexturestatsuploader.h b/indra/newview/lltexturestatsuploader.h index 6b02aeb84540c1236d3e1165547d859ae8880d2d..ac268c2516baaf7d877e734e723421263083e1c5 100755 --- a/indra/newview/lltexturestatsuploader.h +++ b/indra/newview/lltexturestatsuploader.h @@ -34,9 +34,7 @@ class LLTextureStatsUploader { public: - LLTextureStatsUploader(); - ~LLTextureStatsUploader(); - void uploadStatsToSimulator(const std::string texture_cap_url, const LLSD &texture_stats); + static void uploadStatsToSimulator(const std::string texture_cap_url, const LLSD &texture_stats); }; #endif // LL_LLTEXTURESTATSUPLOADER_H diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 50edbb61a86814c43e82fa6faaa6513e4d30b796..8ee83b5df01ba8de96345add10661822370f1467 100755 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -39,17 +39,19 @@ #include "lltooltip.h" #include "llappviewer.h" +#include "llmeshrepository.h" #include "llselectmgr.h" #include "llviewertexlayer.h" #include "lltexturecache.h" #include "lltexturefetch.h" #include "llviewercontrol.h" #include "llviewerobject.h" +#include "llviewerobjectlist.h" #include "llviewertexture.h" #include "llviewertexturelist.h" #include "llvovolume.h" #include "llviewerstats.h" -#include "llmeshrepository.h" +#include "llworld.h" // For avatar texture view #include "llvoavatarself.h" @@ -349,7 +351,7 @@ void LLTextureBar::draw() // draw the image size at the end { std::string num_str = llformat("%3dx%3d (%2d) %7d", mImagep->getWidth(), mImagep->getHeight(), - mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory() : 0); + mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory().value() : 0); LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color, LLFontGL::LEFT, LLFontGL::TOP); } @@ -506,20 +508,22 @@ class LLGLTexMemBar : public LLView void LLGLTexMemBar::draw() { - S32 bound_mem = BYTES_TO_MEGA_BYTES(LLViewerTexture::sBoundTextureMemoryInBytes); - S32 max_bound_mem = LLViewerTexture::sMaxBoundTextureMemInMegaBytes; - S32 total_mem = BYTES_TO_MEGA_BYTES(LLViewerTexture::sTotalTextureMemoryInBytes); - S32 max_total_mem = LLViewerTexture::sMaxTotalTextureMemInMegaBytes; + S32Megabytes bound_mem = LLViewerTexture::sBoundTextureMemory; + S32Megabytes max_bound_mem = LLViewerTexture::sMaxBoundTextureMem; + S32Megabytes total_mem = LLViewerTexture::sTotalTextureMemory; + S32Megabytes max_total_mem = LLViewerTexture::sMaxTotalTextureMem; F32 discard_bias = LLViewerTexture::sDesiredDiscardBias; - F32 cache_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getUsage()) ; - F32 cache_max_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getMaxUsage()) ; + F32 cache_usage = LLAppViewer::getTextureCache()->getUsage().valueInUnits<LLUnits::Megabytes>(); + F32 cache_max_usage = LLAppViewer::getTextureCache()->getMaxUsage().valueInUnits<LLUnits::Megabytes>(); S32 line_height = LLFontGL::getFontMonospace()->getLineHeight(); S32 v_offset = 0;//(S32)((texture_bar_height + 2.2f) * mTextureView->mNumTextureBars + 2.0f); - F32 total_texture_downloaded = (F32)gTotalTextureBytes / (1024 * 1024); - F32 total_object_downloaded = (F32)gTotalObjectBytes / (1024 * 1024); + F32Bytes total_texture_downloaded = gTotalTextureData; + F32Bytes total_object_downloaded = gTotalObjectData; U32 total_http_requests = LLAppViewer::getTextureFetch()->getTotalNumHTTPRequests(); + U32 total_active_cached_objects = LLWorld::getInstance()->getNumOfActiveCachedObjects(); + U32 total_objects = gObjectList.getNumObjects(); F32 x_right = 0.0; - + //---------------------------------------------------------------------------- LLGLSUIDefault gls_ui; LLColor4 text_color(1.f, 1.f, 1.f, 0.75f); @@ -535,10 +539,10 @@ void LLGLTexMemBar::draw() text_color, LLFontGL::LEFT, LLFontGL::TOP); text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB FBO: %d MB Raw Tot: %d MB Bias: %.2f Cache: %.1f/%.1f MB", - total_mem, - max_total_mem, - bound_mem, - max_bound_mem, + total_mem.value(), + max_total_mem.value(), + bound_mem.value(), + max_bound_mem.value(), LLRenderTarget::sBytesAllocated/(1024*1024), LLImageRaw::sGlobalRawMemory >> 20, discard_bias, @@ -552,9 +556,11 @@ void LLGLTexMemBar::draw() U32 cache_read(0U), cache_write(0U), res_wait(0U); LLAppViewer::getTextureFetch()->getStateStats(&cache_read, &cache_write, &res_wait); - text = llformat("Net Tot Tex: %.1f MB Tot Obj: %.1f MB Tot Htp: %d Cread: %u Cwrite: %u Rwait: %u", - total_texture_downloaded, - total_object_downloaded, + text = llformat("Net Tot Tex: %.1f MB Tot Obj: %.1f MB #Objs/#Cached: %d/%d Tot Htp: %d Cread: %u Cwrite: %u Rwait: %u", + total_texture_downloaded.valueInUnits<LLUnits::Megabytes>(), + total_object_downloaded.valueInUnits<LLUnits::Megabytes>(), + total_objects, + total_active_cached_objects, total_http_requests, cache_read, cache_write, @@ -565,7 +571,7 @@ void LLGLTexMemBar::draw() //---------------------------------------------------------------------------- - text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d RAW:%d HTP:%d DEC:%d CRE:%d ", + text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d RAW:%d HTP:%d DEC:%d CRE:%d", gTextureList.getNumImages(), LLAppViewer::getTextureFetch()->getNumRequests(), LLAppViewer::getTextureFetch()->getNumDeletes(), LLAppViewer::getTextureFetch()->mPacketCount, LLAppViewer::getTextureFetch()->mBadPacketCount, @@ -582,14 +588,14 @@ void LLGLTexMemBar::draw() LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &x_right, FALSE); - F32 bandwidth = LLAppViewer::getTextureFetch()->getTextureBandwidth(); - F32 max_bandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); - color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth * .75f ? LLColor4::yellow : text_color; + F32Kilobits bandwidth(LLAppViewer::getTextureFetch()->getTextureBandwidth()); + F32Kilobits max_bandwidth(gSavedSettings.getF32("ThrottleBandwidthKBPS")); + color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color; color[VALPHA] = text_color[VALPHA]; - text = llformat("BW:%.0f/%.0f", bandwidth, max_bandwidth); - LLFontGL::getFontMonospace()->renderUTF8(text, 0, x_right, v_offset + line_height*3, + text = llformat("BW:%.0f/%.0f",bandwidth.value(), max_bandwidth.value()); + LLFontGL::getFontMonospace()->renderUTF8(text, 0, x_right, v_offset + line_height*2, color, LLFontGL::LEFT, LLFontGL::TOP); - + // Mesh status line text = llformat("Mesh: Reqs(Tot/Htp/Big): %u/%u/%u Rtr/Err: %u/%u Cread/Cwrite: %u/%u Low/At/High: %d/%d/%d", LLMeshRepository::sMeshRequestCount, LLMeshRepository::sHTTPRequestCount, LLMeshRepository::sHTTPLargeRequestCount, @@ -692,7 +698,7 @@ void LLGLTexSizeBar::draw() if(LLImageGL::sCurTexSizeBar == mIndex) { - F32 text_color[] = {1.f, 1.f, 1.f, 0.75f}; + LLColor4 text_color(1.f, 1.f, 1.f, 0.75f); std::string text; text = llformat("%d", mTopLoaded) ; @@ -704,8 +710,8 @@ void LLGLTexSizeBar::draw() text_color, LLFontGL::LEFT, LLFontGL::TOP); } - F32 loaded_color[] = {1.0f, 0.0f, 0.0f, 0.75f}; - F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f}; + LLColor4 loaded_color(1.0f, 0.0f, 0.0f, 0.75f); + LLColor4 bound_color(1.0f, 1.0f, 0.0f, 0.75f); gl_rect_2d(mLeft, mBottom + (S32)(mTopLoaded * mScale), (mLeft + mRight) / 2, mBottom, loaded_color) ; gl_rect_2d((mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale), mRight, mBottom, bound_color) ; } @@ -782,7 +788,7 @@ void LLTextureView::draw() if (mPrintList) { - llinfos << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << llendl; + LL_INFOS() << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << LL_ENDL; } for (LLViewerTextureList::image_priority_list_t::iterator iter = gTextureList.mImageList.begin(); @@ -799,15 +805,15 @@ void LLTextureView::draw() if (mPrintList) { - S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory() : 0 ; - llinfos << imagep->getID() + S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory().value() : 0 ; + LL_INFOS() << imagep->getID() << "\t" << tex_mem << "\t" << imagep->getBoostLevel() << "\t" << imagep->getDecodePriority() << "\t" << imagep->getWidth() << "\t" << imagep->getHeight() << "\t" << cur_discard - << llendl; + << LL_ENDL; } if (imagep->getID() == LLAppViewer::getTextureFetch()->mDebugID) diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index 448fae48de4ef8548e09803d139d0038167c31d7..1b5b44423f14ebe4956353ea49b42a0cb11212f3 100755 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -605,7 +605,7 @@ void LLToast::cleanupToasts() toastp = &(*iter); } - //llinfos << "Cleaning up toast id " << toastp->getNotificationID() << llendl; + //LL_INFOS() << "Cleaning up toast id " << toastp->getNotificationID() << LL_ENDL; // LLToast destructor will remove it from the LLInstanceTracker. if (!toastp) diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp index 6083210080f9496f03c9db5efd037d30e2658bde..8fd0eb593123a50f1d14e307179a873fbc5b4c35 100755 --- a/indra/newview/lltoastalertpanel.cpp +++ b/indra/newview/lltoastalertpanel.cpp @@ -42,7 +42,6 @@ #include "lllineeditor.h" #include "lluictrlfactory.h" #include "llnotifications.h" -#include "llfunctorregistry.h" #include "llrootview.h" #include "lltransientfloatermgr.h" #include "llviewercontrol.h" // for gSavedSettings @@ -175,7 +174,7 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal // Message: create text box using raw string, as text has been structure deliberately // Use size of created text box to generate dialog box size std::string msg = mNotification->getMessage(); - llwarns << "Alert: " << msg << llendl; + LL_WARNS() << "Alert: " << msg << LL_ENDL; LLTextBox::Params params; params.name("Alert message"); params.font(font); @@ -509,7 +508,7 @@ void LLToastAlertPanel::setEditTextArgs(const LLSD& edit_args) } else { - llwarns << "LLToastAlertPanel::setEditTextArgs called on dialog with no line editor" << llendl; + LL_WARNS() << "LLToastAlertPanel::setEditTextArgs called on dialog with no line editor" << LL_ENDL; } } diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index beb45e8179f8e946aac04f45c9ac183468bf8f4c..e00b18dedbe34bfa6525d028fc49f8ce31c69378 100755 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -61,7 +61,7 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notifi LLGroupData groupData; if (!gAgent.getGroupData(payload["group_id"].asUUID(),groupData)) { - llwarns << "Group notice for unknown group: " << payload["group_id"].asUUID() << llendl; + LL_WARNS() << "Group notice for unknown group: " << payload["group_id"].asUUID() << LL_ENDL; } //group icon diff --git a/indra/newview/lltoastgroupnotifypanel.h b/indra/newview/lltoastgroupnotifypanel.h index dfdc6ae55981b4e43fba051de007093176db0b79..431fd32da257b230e77da2503297a5537912f64b 100755 --- a/indra/newview/lltoastgroupnotifypanel.h +++ b/indra/newview/lltoastgroupnotifypanel.h @@ -29,7 +29,6 @@ #include "llfontgl.h" #include "lltoastpanel.h" -#include "lldarray.h" #include "lltimer.h" #include "llviewermessage.h" #include "llnotificationptr.h" diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp index bdbd8f1f835607da69d42d82781535d55ed6db2c..a27105e22d8dcdbb4610775f12b8278c6a7fabbb 100755 --- a/indra/newview/lltoastimpanel.cpp +++ b/indra/newview/lltoastimpanel.cpp @@ -189,7 +189,7 @@ void LLToastIMPanel::spawnGroupIconToolTip() LLGroupData g_data; if(!gAgent.getGroupData(mSessionID, g_data)) { - llwarns << "Error getting group data" << llendl; + LL_WARNS() << "Error getting group data" << LL_ENDL; } LLInspector::Params params; @@ -222,7 +222,7 @@ void LLToastIMPanel::initIcon() LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionID); if(!im_session) { - llwarns << "Invalid IM session" << llendl; + LL_WARNS() << "Invalid IM session" << LL_ENDL; return; } @@ -242,7 +242,7 @@ void LLToastIMPanel::initIcon() mAdhocIcon->setToolTip(im_session->mName); break; default: - llwarns << "Unknown IM session type" << llendl; + LL_WARNS() << "Unknown IM session type" << LL_ENDL; break; } } diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 9824f2dd38c0d3476413882e0305bfa926160370..51935dc03be8e63ce3ac14377dbe44592e2b7e23 100755 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -58,7 +58,7 @@ LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal LLToastNotifyPanel::LLToastNotifyPanel(const LLNotificationPtr& notification, const LLRect& rect, bool show_images) : LLToastPanel(notification), - LLInstanceTracker<LLToastNotifyPanel, LLUUID>(notification->getID()) + LLInstanceTracker<LLToastNotifyPanel, LLUUID, LLInstanceTrackerReplaceOnCollision>(notification->getID()) { init(rect, show_images); } diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h index fe7f1cf8f3a91e2708c4cead95019f584bbd04f9..e4a75acfda09ec9cf7294a474b2a8c96af6b4e02 100755 --- a/indra/newview/lltoastnotifypanel.h +++ b/indra/newview/lltoastnotifypanel.h @@ -47,7 +47,7 @@ class LLNotificationForm; * @deprecated this class will be removed after all toast panel types are * implemented in separate classes. */ -class LLToastNotifyPanel: public LLToastPanel, public LLInstanceTracker<LLToastNotifyPanel, LLUUID> +class LLToastNotifyPanel: public LLToastPanel, public LLInstanceTracker<LLToastNotifyPanel, LLUUID, LLInstanceTrackerReplaceOnCollision> { public: /** diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp index 45fbabad59ecfc2358c5be25f76620077c244ce8..78d9e92b5c68f3e977e1eb9d64d2a7eae18fb7f5 100755 --- a/indra/newview/lltoastscripttextbox.cpp +++ b/indra/newview/lltoastscripttextbox.cpp @@ -109,7 +109,7 @@ void LLToastScriptTextbox::onClickSubmit() } mNotification->respond(response); close(); - llwarns << response << llendl; + LL_WARNS() << response << LL_ENDL; } } diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index 2d8ce95347657a412485416dbdfe91a45e46f0a7..4aad650b680b44aab4bd28e53f1ec9e36e57fa52 100755 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -55,7 +55,7 @@ LLTool::~LLTool() { if( hasMouseCapture() ) { - llwarns << "Tool deleted holding mouse capture. Mouse capture removed." << llendl; + LL_WARNS() << "Tool deleted holding mouse capture. Mouse capture removed." << LL_ENDL; gFocusMgr.removeMouseCaptureWithoutCallback( this ); } } @@ -80,10 +80,10 @@ BOOL LLTool::handleMouseDown(S32 x, S32 y, MASK mask) { if (gDebugClicks) { - llinfos << "LLTool left mouse down" << llendl; + LL_INFOS() << "LLTool left mouse down" << LL_ENDL; } // by default, didn't handle it - // llinfos << "LLTool::handleMouseDown" << llendl; + // LL_INFOS() << "LLTool::handleMouseDown" << LL_ENDL; gAgent.setControlFlags(AGENT_CONTROL_LBUTTON_DOWN); return TRUE; } @@ -92,10 +92,10 @@ BOOL LLTool::handleMouseUp(S32 x, S32 y, MASK mask) { if (gDebugClicks) { - llinfos << "LLTool left mouse up" << llendl; + LL_INFOS() << "LLTool left mouse up" << LL_ENDL; } // by default, didn't handle it - // llinfos << "LLTool::handleMouseUp" << llendl; + // LL_INFOS() << "LLTool::handleMouseUp" << LL_ENDL; gAgent.setControlFlags(AGENT_CONTROL_LBUTTON_UP); return TRUE; } @@ -103,7 +103,7 @@ BOOL LLTool::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLTool::handleHover(S32 x, S32 y, MASK mask) { gViewerWindow->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by a tool" << llendl; + LL_DEBUGS("UserInput") << "hover handled by a tool" << LL_ENDL; // by default, do nothing, say we handled it return TRUE; } @@ -111,13 +111,13 @@ BOOL LLTool::handleHover(S32 x, S32 y, MASK mask) BOOL LLTool::handleScrollWheel(S32 x, S32 y, S32 clicks) { // by default, didn't handle it - // llinfos << "LLTool::handleScrollWheel" << llendl; + // LL_INFOS() << "LLTool::handleScrollWheel" << LL_ENDL; return FALSE; } BOOL LLTool::handleDoubleClick(S32 x,S32 y,MASK mask) { - // llinfos << "LLTool::handleDoubleClick" << llendl; + // LL_INFOS() << "LLTool::handleDoubleClick" << LL_ENDL; // by default, pretend it's a left click return FALSE; } @@ -125,35 +125,35 @@ BOOL LLTool::handleDoubleClick(S32 x,S32 y,MASK mask) BOOL LLTool::handleRightMouseDown(S32 x,S32 y,MASK mask) { // by default, didn't handle it - // llinfos << "LLTool::handleRightMouseDown" << llendl; + // LL_INFOS() << "LLTool::handleRightMouseDown" << LL_ENDL; return FALSE; } BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask) { // by default, didn't handle it - // llinfos << "LLTool::handleRightMouseDown" << llendl; + // LL_INFOS() << "LLTool::handleRightMouseDown" << LL_ENDL; return FALSE; } BOOL LLTool::handleMiddleMouseDown(S32 x,S32 y,MASK mask) { // by default, didn't handle it - // llinfos << "LLTool::handleMiddleMouseDown" << llendl; + // LL_INFOS() << "LLTool::handleMiddleMouseDown" << LL_ENDL; return FALSE; } BOOL LLTool::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { // by default, didn't handle it - // llinfos << "LLTool::handleMiddleMouseUp" << llendl; + // LL_INFOS() << "LLTool::handleMiddleMouseUp" << LL_ENDL; return FALSE; } BOOL LLTool::handleToolTip(S32 x, S32 y, MASK mask) { // by default, didn't handle it - // llinfos << "LLTool::handleToolTip" << llendl; + // LL_INFOS() << "LLTool::handleToolTip" << LL_ENDL; return FALSE; } diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp index 36d4654393482a44f4ffde13f90529f158bbe559..fd950864aa9c9fb340b09b0ad3bb134dc91e7634 100755 --- a/indra/newview/lltoolbarview.cpp +++ b/indra/newview/lltoolbarview.cpp @@ -203,7 +203,7 @@ bool LLToolBarView::addCommandInternal(const LLCommandId& command, LLToolBar* to } else { - llwarns << "Toolbars creation : the command with id " << command.uuid().asString() << " cannot be found in the command manager" << llendl; + LL_WARNS() << "Toolbars creation : the command with id " << command.uuid().asString() << " cannot be found in the command manager" << LL_ENDL; return false; } return true; @@ -222,20 +222,20 @@ bool LLToolBarView::loadToolbars(bool force_default) } else if (!gDirUtilp->fileExists(toolbar_file)) { - llwarns << "User toolbars def not found -> use default" << llendl; + LL_WARNS() << "User toolbars def not found -> use default" << LL_ENDL; toolbar_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "toolbars.xml"); } LLXMLNodePtr root; if(!LLXMLNode::parseFile(toolbar_file, root, NULL)) { - llwarns << "Unable to load toolbars from file: " << toolbar_file << llendl; + LL_WARNS() << "Unable to load toolbars from file: " << toolbar_file << LL_ENDL; err = true; } if (!err && !root->hasName("toolbars")) { - llwarns << toolbar_file << " is not a valid toolbars definition file" << llendl; + LL_WARNS() << toolbar_file << " is not a valid toolbars definition file" << LL_ENDL; err = true; } @@ -248,7 +248,7 @@ bool LLToolBarView::loadToolbars(bool force_default) if (!err && !toolbar_set.validateBlock()) { - llwarns << "Unable to validate toolbars from file: " << toolbar_file << llendl; + LL_WARNS() << "Unable to validate toolbars from file: " << toolbar_file << LL_ENDL; err = true; } @@ -256,7 +256,7 @@ bool LLToolBarView::loadToolbars(bool force_default) { if (force_default) { - llerrs << "Unable to load toolbars from default file : " << toolbar_file << llendl; + LL_ERRS() << "Unable to load toolbars from default file : " << toolbar_file << LL_ENDL; return false; } @@ -285,7 +285,7 @@ bool LLToolBarView::loadToolbars(bool force_default) { if (addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_LEFT])) { - llwarns << "Error adding command '" << command_params.name() << "' to left toolbar." << llendl; + LL_WARNS() << "Error adding command '" << command_params.name() << "' to left toolbar." << LL_ENDL; } } } @@ -300,7 +300,7 @@ bool LLToolBarView::loadToolbars(bool force_default) { if (addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_RIGHT])) { - llwarns << "Error adding command '" << command_params.name() << "' to right toolbar." << llendl; + LL_WARNS() << "Error adding command '" << command_params.name() << "' to right toolbar." << LL_ENDL; } } } @@ -315,7 +315,7 @@ bool LLToolBarView::loadToolbars(bool force_default) { if (addCommandInternal(LLCommandId(command_params), mToolbars[LLToolBarEnums::TOOLBAR_BOTTOM])) { - llwarns << "Error adding command '" << command_params.name() << "' to bottom toolbar." << llendl; + LL_WARNS() << "Error adding command '" << command_params.name() << "' to bottom toolbar." << LL_ENDL; } } } @@ -523,7 +523,7 @@ void LLToolBarView::draw() { if (mToolbars[i]) { - LLLayoutStack::ELayoutOrientation orientation = LLToolBarEnums::getOrientation(mToolbars[i]->getSideType()); + LLView::EOrientation orientation = LLToolBarEnums::getOrientation(mToolbars[i]->getSideType()); if (orientation == LLLayoutStack::HORIZONTAL) { @@ -653,7 +653,7 @@ BOOL LLToolBarView::handleDropTool( void* cargo_data, S32 x, S32 y, LLToolBar* t } else { - llwarns << "Command couldn't be found in command manager" << llendl; + LL_WARNS() << "Command couldn't be found in command manager" << LL_ENDL; } } diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index 08d82ea9cbce569070dda56f00ffc441bb1cd342..56f0f8be25bb0bb07058d265ae8e808974913745 100755 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -401,9 +401,9 @@ BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLToolBrushLand::handleHover( S32 x, S32 y, MASK mask ) { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolBrushLand (" + LL_DEBUGS("UserInput") << "hover handled by LLToolBrushLand (" << (hasMouseCapture() ? "active":"inactive") - << ")" << llendl; + << ")" << LL_ENDL; mMouseX = x; mMouseY = y; mGotHover = TRUE; @@ -456,7 +456,7 @@ void LLToolBrushLand::render() { if(mGotHover) { - //llinfos << "LLToolBrushLand::render()" << llendl; + //LL_INFOS() << "LLToolBrushLand::render()" << LL_ENDL; LLVector3d spot; if(gViewerWindow->mousePointOnLandGlobal(mMouseX, mMouseY, &spot)) { diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index 7314ab60c139b6f507e14fd1e6496ed82bdb3b5f..d307a31843c59f68cbd874b56bca1ed985000009 100755 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -175,7 +175,7 @@ class LLCategoryFireAndForget : public LLInventoryFetchComboObserver virtual void done() { /* no-op: it's fire n forget right? */ - lldebugs << "LLCategoryFireAndForget::done()" << llendl; + LL_DEBUGS() << "LLCategoryFireAndForget::done()" << LL_ENDL; } }; @@ -256,7 +256,7 @@ void LLCategoryDropDescendentsObserver::done() LLInventoryModel::EXCLUDE_TRASH); } - S32 count = items.count(); + S32 count = items.size(); if (count) { std::set<LLUUID> unique_ids; @@ -371,7 +371,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, { if (type == DAD_NONE) { - llwarns << "Attempted to start drag without a cargo type" << llendl; + LL_WARNS() << "Attempted to start drag without a cargo type" << LL_ENDL; return; } mCargoTypes.clear(); @@ -408,16 +408,16 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type, items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 count = cats.count(); + S32 count = cats.size(); S32 i; for(i = 0; i < count; ++i) { - folder_ids.push_back(cats.get(i)->getUUID()); + folder_ids.push_back(cats.at(i)->getUUID()); } - count = items.count(); + count = items.size(); for(i = 0; i < count; ++i) { - item_ids.push_back(items.get(i)->getUUID()); + item_ids.push_back(items.at(i)->getUUID()); } if (!folder_ids.empty() || !item_ids.empty()) { @@ -443,7 +443,7 @@ void LLToolDragAndDrop::beginMultiDrag( { if (DAD_NONE == *types_it) { - llwarns << "Attempted to start drag without a cargo type" << llendl; + LL_WARNS() << "Attempted to start drag without a cargo type" << LL_ENDL; return; } } @@ -479,7 +479,7 @@ void LLToolDragAndDrop::beginMultiDrag( items, LLInventoryModel::EXCLUDE_TRASH, is_not_preferred); - S32 cat_count = cats.count(); + S32 cat_count = cats.size(); for(S32 i = 0; i < cat_count; ++i) { cat_ids.insert(cat->getUUID()); @@ -598,7 +598,7 @@ BOOL LLToolDragAndDrop::handleHover( S32 x, S32 y, MASK mask ) ECursorType cursor = acceptanceToCursor(acceptance); gViewerWindow->getWindow()->setCursor( cursor ); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolDragAndDrop" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolDragAndDrop" << LL_ENDL; return TRUE; } @@ -1035,7 +1035,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj, } else { - llwarns << "Unable to find source object." << llendl; + LL_WARNS() << "Unable to find source object." << LL_ENDL; return FALSE; } } @@ -1085,7 +1085,7 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj, { if (!item) { - llwarns << "LLToolDragAndDrop::dropTextureAllFaces no texture item." << llendl; + LL_WARNS() << "LLToolDragAndDrop::dropTextureAllFaces no texture item." << LL_ENDL; return; } LLUUID asset_id = item->getAssetUUID(); @@ -1095,7 +1095,7 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj, return; } LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id); - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); + add(LLStatViewer::EDIT_TEXTURE, 1); S32 num_faces = hit_obj->getNumTEs(); for( S32 face = 0; face < num_faces; face++ ) { @@ -1115,7 +1115,7 @@ void LLToolDragAndDrop::dropMesh(LLViewerObject* hit_obj, { if (!item) { - llwarns << "no inventory item." << llendl; + LL_WARNS() << "no inventory item." << LL_ENDL; return; } LLUUID asset_id = item->getAssetUUID(); @@ -1152,7 +1152,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj, if (hit_face == -1) return; if (!item) { - llwarns << "LLToolDragAndDrop::dropTextureOneFace no texture item." << llendl; + LL_WARNS() << "LLToolDragAndDrop::dropTextureOneFace no texture item." << LL_ENDL; return; } LLUUID asset_id = item->getAssetUUID(); @@ -1163,7 +1163,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj, } // update viewer side image in anticipation of update from simulator LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id); - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT ); + add(LLStatViewer::EDIT_TEXTURE, 1); LLTextureEntry* tep = hit_obj ? (hit_obj->getTE(hit_face)) : NULL; @@ -1227,8 +1227,8 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj, if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource) || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource)) { - llwarns << "Call to LLToolDragAndDrop::dropScript() from world" - << " or notecard." << llendl; + LL_WARNS() << "Call to LLToolDragAndDrop::dropScript() from world" + << " or notecard." << LL_ENDL; return; } if (hit_obj && item) @@ -1255,7 +1255,7 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj, } else { - llwarns << "Unable to find source object." << llendl; + LL_WARNS() << "Unable to find source object." << LL_ENDL; return; } } @@ -1280,11 +1280,11 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromPosGlobal(mLastHitPos); if (!regionp) { - llwarns << "Couldn't find region to rez object" << llendl; + LL_WARNS() << "Couldn't find region to rez object" << LL_ENDL; return; } - //llinfos << "Rezzing object" << llendl; + //LL_INFOS() << "Rezzing object" << LL_ENDL; make_ui_sound("UISndObjectRezIn"); LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; @@ -1431,7 +1431,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target, effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_REZ_COUNT); + add(LLStatViewer::OBJECT_REZ, 1); } void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, @@ -1444,8 +1444,8 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource) || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource)) { - llwarns << "Call to LLToolDragAndDrop::dropInventory() from world" - << " or notecard." << llendl; + LL_WARNS() << "Call to LLToolDragAndDrop::dropInventory() from world" + << " or notecard." << LL_ENDL; return; } @@ -1475,7 +1475,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj, } else { - llwarns << "Unable to find source object." << llendl; + LL_WARNS() << "Unable to find source object." << LL_ENDL; return; } } @@ -1745,14 +1745,14 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_ EAcceptance LLToolDragAndDrop::dad3dNULL( LLViewerObject*, S32, MASK, BOOL) { - lldebugs << "LLToolDragAndDrop::dad3dNULL()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dNULL()" << LL_ENDL; return ACCEPT_NO; } EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()" << LL_ENDL; // must be in the user's inventory if(mSource != SOURCE_AGENT && mSource != SOURCE_LIBRARY) { @@ -1815,7 +1815,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand( return dad3dRezFromObjectOnLand(obj, face, mask, drop); } - lldebugs << "LLToolDragAndDrop::dad3dRezObjectOnLand()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezObjectOnLand()" << LL_ENDL; LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); @@ -1878,7 +1878,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( return dad3dRezFromObjectOnObject(obj, face, mask, drop); } - lldebugs << "LLToolDragAndDrop::dad3dRezObjectOnObject()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezObjectOnObject()" << LL_ENDL; LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); @@ -1950,7 +1950,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject( EAcceptance LLToolDragAndDrop::dad3dRezScript( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dRezScript()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezScript()" << LL_ENDL; // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. @@ -1988,7 +1988,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript( EAcceptance LLToolDragAndDrop::dad3dApplyToObject( LLViewerObject* obj, S32 face, MASK mask, BOOL drop, EDragAndDropType cargo_type) { - lldebugs << "LLToolDragAndDrop::dad3dApplyToObject()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dApplyToObject()" << LL_ENDL; // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. @@ -2039,7 +2039,7 @@ EAcceptance LLToolDragAndDrop::dad3dApplyToObject( } else { - llwarns << "unsupported asset type" << llendl; + LL_WARNS() << "unsupported asset type" << LL_ENDL; } // VEFFECT: SetTexture @@ -2072,7 +2072,7 @@ EAcceptance LLToolDragAndDrop::dad3dMeshObject( EAcceptance LLToolDragAndDrop::dad3dTextureSelf( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dTextureAvatar()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dTextureAvatar()" << LL_ENDL; if(drop) { if( !(mask & MASK_SHIFT) ) @@ -2087,7 +2087,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureSelf( EAcceptance LLToolDragAndDrop::dad3dWearItem( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dWearItem()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dWearItem()" << LL_ENDL; LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); @@ -2120,7 +2120,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem( EAcceptance LLToolDragAndDrop::dad3dActivateGesture( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dActivateGesture()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dActivateGesture()" << LL_ENDL; LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); @@ -2169,7 +2169,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture( EAcceptance LLToolDragAndDrop::dad3dWearCategory( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dWearCategory()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dWearCategory()" << LL_ENDL; LLViewerInventoryItem* item; LLViewerInventoryCategory* category; locateInventory(item, category); @@ -2220,7 +2220,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory( EAcceptance LLToolDragAndDrop::dad3dUpdateInventory( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dadUpdateInventory()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dadUpdateInventory()" << LL_ENDL; // *HACK: In order to resolve SL-22177, we need to block drags // from notecards and objects onto other objects. @@ -2260,10 +2260,10 @@ BOOL LLToolDragAndDrop::dadUpdateInventory(LLViewerObject* obj, BOOL drop) EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dUpdateInventoryCategory()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dUpdateInventoryCategory()" << LL_ENDL; if (obj == NULL) { - llwarns << "obj is NULL; aborting func with ACCEPT_NO" << llendl; + LL_WARNS() << "obj is NULL; aborting func with ACCEPT_NO" << LL_ENDL; return ACCEPT_NO; } @@ -2293,10 +2293,10 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( items, LLInventoryModel::EXCLUDE_TRASH, droppable); - cats.put(cat); + cats.push_back(cat); if (droppable.countNoCopy() > 0) { - llwarns << "*** Need to confirm this step" << llendl; + LL_WARNS() << "*** Need to confirm this step" << LL_ENDL; } LLViewerObject* root_object = obj; if (obj->getParent()) @@ -2319,7 +2319,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( rv = gInventory.isCategoryComplete(cat->getUUID()) ? ACCEPT_YES_MULTI : ACCEPT_NO; if(rv < ACCEPT_YES_SINGLE) { - lldebugs << "Category " << cat->getUUID() << "is not complete." << llendl; + LL_DEBUGS() << "Category " << cat->getUUID() << "is not complete." << LL_ENDL; break; } } @@ -2341,7 +2341,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory( rv = willObjectAcceptInventory(root_object, item); if (rv < ACCEPT_YES_COPY_SINGLE) { - lldebugs << "Object will not accept " << item->getUUID() << llendl; + LL_DEBUGS() << "Object will not accept " << item->getUUID() << LL_ENDL; break; } } @@ -2382,7 +2382,7 @@ BOOL LLToolDragAndDrop::dadUpdateInventoryCategory(LLViewerObject* obj, EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dGiveInventoryObject()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventoryObject()" << LL_ENDL; // item has to be in agent inventory. if(mSource != SOURCE_AGENT) return ACCEPT_NO; @@ -2420,7 +2420,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject( EAcceptance LLToolDragAndDrop::dad3dGiveInventory( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dGiveInventory()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventory()" << LL_ENDL; // item has to be in agent inventory. if(mSource != SOURCE_AGENT) return ACCEPT_NO; LLViewerInventoryItem* item; @@ -2443,7 +2443,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventory( EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dGiveInventoryCategory()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dGiveInventoryCategory()" << LL_ENDL; if(drop && obj) { LLViewerInventoryItem* item; @@ -2461,7 +2461,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory( EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dRezFromObjectOnLand()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezFromObjectOnLand()" << LL_ENDL; LLViewerInventoryItem* item = NULL; LLViewerInventoryCategory* cat = NULL; locateInventory(item, cat); @@ -2482,7 +2482,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand( EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject( LLViewerObject* obj, S32 face, MASK mask, BOOL drop) { - lldebugs << "LLToolDragAndDrop::dad3dRezFromObjectOnObject()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dRezFromObjectOnObject()" << LL_ENDL; LLViewerInventoryItem* item; LLViewerInventoryCategory* cat; locateInventory(item, cat); @@ -2519,7 +2519,7 @@ EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand( { return ACCEPT_NO; /* - lldebugs << "LLToolDragAndDrop::dad3dCategoryOnLand()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dCategoryOnLand()" << LL_ENDL; LLInventoryItem* item; LLInventoryCategory* cat; locateInventory(item, cat); @@ -2535,7 +2535,7 @@ EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand( items, LLInventoryModel::EXCLUDE_TRASH, droppable); - if(items.count() > 0) + if(items.size() > 0) { rv = ACCEPT_YES_SINGLE; } @@ -2557,19 +2557,19 @@ EAcceptance LLToolDragAndDrop::dad3dAssetOnLand( { return ACCEPT_NO; /* - lldebugs << "LLToolDragAndDrop::dad3dAssetOnLand()" << llendl; + LL_DEBUGS() << "LLToolDragAndDrop::dad3dAssetOnLand()" << LL_ENDL; LLViewerInventoryCategory::cat_array_t cats; LLViewerInventoryItem::item_array_t items; LLViewerInventoryItem::item_array_t copyable_items; locateMultipleInventory(items, cats); - if(!items.count()) return ACCEPT_NO; + if(!items.size()) return ACCEPT_NO; EAcceptance rv = ACCEPT_NO; - for (S32 i = 0; i < items.count(); i++) + for (S32 i = 0; i < items.size(); i++) { LLInventoryItem* item = items[i]; if(item->getPermissions().allowCopyBy(gAgent.getID())) { - copyable_items.put(item); + copyable_items.push_back(item); rv = ACCEPT_YES_SINGLE; } } @@ -2641,21 +2641,21 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory( LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryCategory::cat_array_t& cats, LLViewerInventoryItem::item_array_t& items) { - if(mCargoIDs.count() == 0) return NULL; + if(mCargoIDs.size() == 0) return NULL; if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)) { // The object should be in user inventory. - for (S32 i = 0; i < mCargoIDs.count(); i++) + for (S32 i = 0; i < mCargoIDs.size(); i++) { LLInventoryItem* item = gInventory.getItem(mCargoIDs[i]); if (item) { - items.put(item); + items.push_back(item); } LLInventoryCategory* category = gInventory.getCategory(mCargoIDs[i]); if (category) { - cats.put(category); + cats.push_back(category); } } } @@ -2669,23 +2669,23 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC || (mCargoType == DAD_ROOT_CATEGORY)) { // The object should be in user inventory. - for (S32 i = 0; i < mCargoIDs.count(); i++) + for (S32 i = 0; i < mCargoIDs.size(); i++) { LLInventoryCategory* category = (LLInventoryCategory*)obj->getInventoryObject(mCargoIDs[i]); if (category) { - cats.put(category); + cats.push_back(category); } } } else { - for (S32 i = 0; i < mCargoIDs.count(); i++) + for (S32 i = 0; i < mCargoIDs.size(); i++) { LLInventoryItem* item = (LLInventoryItem*)obj->getInventoryObject(mCargoIDs[i]); if (item) { - items.put(item); + items.push_back(item); } } } @@ -2697,18 +2697,18 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC card = (LLPreviewNotecard*)LLPreview::find(mSourceID); if(card) { - items.put((LLInventoryItem*)card->getDragItem()); + items.push_back((LLInventoryItem*)card->getDragItem()); } } - if(items.count()) return items[0]; - if(cats.count()) return cats[0]; + if(items.size()) return items[0]; + if(cats.size()) return cats[0]; return NULL; } */ // void LLToolDragAndDrop::createContainer(LLViewerInventoryItem::item_array_t &items, const char* preferred_name ) // { -// llwarns << "LLToolDragAndDrop::createContainer()" << llendl; +// LL_WARNS() << "LLToolDragAndDrop::createContainer()" << LL_ENDL; // return; // } diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index f17300a76ab25d238ca43702260dc4d20635acc1..99b794ce582af8e8e7ccd3e6eaa453d9fc458a16 100755 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -31,9 +31,7 @@ #include "lltool.h" #include "llview.h" #include "lluuid.h" -#include "stdenums.h" #include "llassetstorage.h" -#include "lldarray.h" #include "llpermissions.h" #include "llwindow.h" #include "llviewerinventory.h" diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 857b0f07146555cb123c854d1008be66fa950650..ee4ec112f84682dfcdce8a65d2ff9c0b1218373a 100755 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -334,7 +334,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) { if (!mValidClickPoint) { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolFocus [invalid point]" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [invalid point]" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_NO); gViewerWindow->showCursor(); return TRUE; @@ -361,7 +361,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->moveCursorToCenter(); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolFocus [active]" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [active]" << LL_ENDL; } else if ( gCameraBtnPan || mask == MASK_PAN || @@ -389,7 +389,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->moveCursorToCenter(); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPan" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolPan" << LL_ENDL; } else if (gCameraBtnZoom) { @@ -421,7 +421,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->moveCursorToCenter(); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolZoom" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolZoom" << LL_ENDL; } } diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index 9907da0f0e7396604beb71b2d3d7eb08608bf0d2..493c970141be83e74bb14f0379ded80f562587c7 100755 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -115,7 +115,7 @@ BOOL LLToolGrab::handleDoubleClick(S32 x, S32 y, MASK mask) { if (gDebugClicks) { - llinfos << "LLToolGrab handleDoubleClick (becoming mouseDown)" << llendl; + LL_INFOS() << "LLToolGrab handleDoubleClick (becoming mouseDown)" << LL_ENDL; } return FALSE; @@ -125,7 +125,7 @@ BOOL LLToolGrab::handleMouseDown(S32 x, S32 y, MASK mask) { if (gDebugClicks) { - llinfos << "LLToolGrab handleMouseDown" << llendl; + LL_INFOS() << "LLToolGrab handleMouseDown" << LL_ENDL; } // call the base class to propogate info to sim @@ -176,12 +176,12 @@ BOOL LLToolGrab::handleObjectHit(const LLPickInfo& info) if (gDebugClicks) { - llinfos << "LLToolGrab handleObjectHit " << info.mMousePt.mX << "," << info.mMousePt.mY << llendl; + LL_INFOS() << "LLToolGrab handleObjectHit " << info.mMousePt.mX << "," << info.mMousePt.mY << LL_ENDL; } if (NULL == objectp) // unexpected { - llwarns << "objectp was NULL; returning FALSE" << llendl; + LL_WARNS() << "objectp was NULL; returning FALSE" << LL_ENDL; return FALSE; } @@ -707,7 +707,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask) // HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden. gViewerWindow->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (active) [cursor hidden]" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (active) [cursor hidden]" << LL_ENDL; } @@ -871,7 +871,7 @@ void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask) void LLToolGrab::handleHoverInactive(S32 x, S32 y, MASK mask) { // JC - TODO - change cursor based on gGrabBtnVertical, gGrabBtnSpin - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (inactive-not over editable object)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (inactive-not over editable object)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); } @@ -881,7 +881,7 @@ void LLToolGrab::handleHoverFailed(S32 x, S32 y, MASK mask) if( GRAB_NOOBJECT == mMode ) { gViewerWindow->setCursor(UI_CURSOR_NO); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (not on object)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (not on object)" << LL_ENDL; } else { @@ -894,13 +894,13 @@ void LLToolGrab::handleHoverFailed(S32 x, S32 y, MASK mask) { case GRAB_LOCKED: gViewerWindow->setCursor(UI_CURSOR_GRABLOCKED); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (grab failed, no move permission)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed, no move permission)" << LL_ENDL; break; // Non physical now handled by handleHoverActive - CRO // case GRAB_NONPHYSICAL: // gViewerWindow->setCursor(UI_CURSOR_ARROW); -// lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (grab failed, nonphysical)" << llendl; +// LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed, nonphysical)" << LL_ENDL; // break; default: llassert(0); @@ -909,7 +909,7 @@ void LLToolGrab::handleHoverFailed(S32 x, S32 y, MASK mask) else { gViewerWindow->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (grab failed but within slop)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGrab (grab failed but within slop)" << LL_ENDL; } } } @@ -1108,16 +1108,16 @@ void send_ObjectGrab_message(LLViewerObject* object, const LLPickInfo & pick, co msg->sendMessage( object->getRegion()->getHost()); /* Diagnostic code - llinfos << "mUVCoords: " << pick.mUVCoords + LL_INFOS() << "mUVCoords: " << pick.mUVCoords << ", mSTCoords: " << pick.mSTCoords << ", mObjectFace: " << pick.mObjectFace << ", mIntersection: " << pick.mIntersection << ", mNormal: " << pick.mNormal << ", mBinormal: " << pick.mBinormal - << llendl; + << LL_ENDL; - llinfos << "Avatar pos: " << gAgent.getPositionAgent() << llendl; - llinfos << "Object pos: " << object->getPosition() << llendl; + LL_INFOS() << "Avatar pos: " << gAgent.getPositionAgent() << LL_ENDL; + LL_INFOS() << "Object pos: " << object->getPosition() << LL_ENDL; */ } diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index c1735adc9c799ceb941ad88065c6e1d17f116df9..6c9155be851675281d6fccc722c0cd2d25bc8571 100755 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -116,11 +116,11 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->hideCursor(); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGun (mouselook)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGun (mouselook)" << LL_ENDL; } else { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGun (not mouselook)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGun (not mouselook)" << LL_ENDL; } // HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden. diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index a135ba70f510a8af2e13822e23d4107239be3669..aa55caf7ec997005c049de1e208c15a49364120f 100755 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -357,7 +357,7 @@ void LLToolMgr::clearTransientTool() mTransientTool = NULL; if (!mBaseTool) { - llwarns << "mBaseTool is NULL" << llendl; + LL_WARNS() << "mBaseTool is NULL" << LL_ENDL; } } updateToolStatus(); diff --git a/indra/newview/lltoolobjpicker.cpp b/indra/newview/lltoolobjpicker.cpp index b65c4c1ec800094e0e1f4097c88fee4517002641..0d9fe9e5774229d6484cac4ec9d067f174d05a6d 100755 --- a/indra/newview/lltoolobjpicker.cpp +++ b/indra/newview/lltoolobjpicker.cpp @@ -76,7 +76,7 @@ BOOL LLToolObjPicker::handleMouseDown(S32 x, S32 y, MASK mask) } else { - llwarns << "PickerTool doesn't have mouse capture on mouseDown" << llendl; + LL_WARNS() << "PickerTool doesn't have mouse capture on mouseDown" << LL_ENDL; } } @@ -109,7 +109,7 @@ BOOL LLToolObjPicker::handleMouseUp(S32 x, S32 y, MASK mask) } else { - llwarns << "PickerTool doesn't have mouse capture on mouseUp" << llendl; + LL_WARNS() << "PickerTool doesn't have mouse capture on mouseUp" << LL_ENDL; } return handled; } diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 1c362c18e0d7ede5f872388f6b41c46b8cd573c1..558159775f6a3d8a8931c9b3265dbbce87fd2cad 100755 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -42,6 +42,7 @@ #include "llfloaterscriptdebug.h" #include "lltooltip.h" #include "llhudeffecttrail.h" +#include "llhudicon.h" #include "llhudmanager.h" #include "llkeyboard.h" #include "llmediaentry.h" @@ -557,7 +558,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) // could disable it here. show_highlight = true; // cursor set by media object - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } else if (!mMouseOutsideSlop && mMouseButtonDown @@ -594,7 +595,7 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) show_highlight = true; ECursorType cursor = cursorFromObject(click_action_object); gViewerWindow->setCursor(cursor); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } else if ((object && !object->isAvatar() && object->flagUsePhysics()) @@ -602,19 +603,19 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) { show_highlight = true; gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } else if ( (object && object->flagHandleTouch()) || (parent && parent->flagHandleTouch())) { show_highlight = true; gViewerWindow->setCursor(UI_CURSOR_HAND); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } else { gViewerWindow->setCursor(UI_CURSOR_ARROW); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolPie (inactive)" << LL_ENDL; } } @@ -706,7 +707,7 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask) { if (gDebugClicks) { - llinfos << "LLToolPie handleDoubleClick (becoming mouseDown)" << llendl; + LL_INFOS() << "LLToolPie handleDoubleClick (becoming mouseDown)" << LL_ENDL; } if (gSavedSettings.getBOOL("DoubleClickAutoPilot")) diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp index 641fbc50422e966a8dfa98b32fabb9e62faeea3f..ceb57d0172cc91350ba6c3b18ba983934d9a29ef 100755 --- a/indra/newview/lltoolplacer.cpp +++ b/indra/newview/lltoolplacer.cpp @@ -127,7 +127,7 @@ BOOL LLToolPlacer::raycastForNewObjPos( S32 x, S32 y, LLViewerObject** hit_obj, LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromPosGlobal(surface_pos_global); if (!regionp) { - llwarns << "Trying to add object outside of all known regions!" << llendl; + LL_WARNS() << "Trying to add object outside of all known regions!" << LL_ENDL; return FALSE; } @@ -178,7 +178,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) if (NULL == regionp) { - llwarns << "regionp was NULL; aborting function." << llendl; + LL_WARNS() << "regionp was NULL; aborting function." << LL_ENDL; return FALSE; } @@ -433,7 +433,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics ) effectp->setDuration(LL_HUD_DUR_SHORT); effectp->setColor(LLColor4U(gAgent.getEffectColor())); - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CREATE_COUNT); + add(LLStatViewer::OBJECT_CREATE, 1); return TRUE; } @@ -518,7 +518,7 @@ BOOL LLToolPlacer::placeObject(S32 x, S32 y, MASK mask) BOOL LLToolPlacer::handleHover(S32 x, S32 y, MASK mask) { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPlacer" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolPlacer" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_TOOLCREATE); return TRUE; } diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index 7c604a04bf7b53f2e130028a5b0c3cc6c5c5a218..0a9153eecb5593600218bfec9f16f47cdcc40c3b 100755 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -32,6 +32,7 @@ #include "llagentcamera.h" #include "llviewercontrol.h" #include "lldrawable.h" +#include "llhudicon.h" #include "llmanip.h" #include "llmenugl.h" #include "llselectmgr.h" diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp index a48388c591533de82b9a9aaabb348cb4c3b249ec..44c0cb3124da3a8e1ca35e46221269dd244f0cc5 100755 --- a/indra/newview/lltoolselectland.cpp +++ b/indra/newview/lltoolselectland.cpp @@ -168,13 +168,13 @@ BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) roundXY(mWestSouthBottom); roundXY(mEastNorthTop); - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, land)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, land)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_ARROW); } else { mDragEndValid = FALSE; - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, no land)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, no land)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_NO); } @@ -183,13 +183,13 @@ BOOL LLToolSelectLand::handleHover(S32 x, S32 y, MASK mask) } else { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (active, in slop)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (active, in slop)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_ARROW); } } else { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectLand (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectLand (inactive)" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_ARROW); } diff --git a/indra/newview/lltoolselectrect.cpp b/indra/newview/lltoolselectrect.cpp index a3f4e5a18cfdd17c864f3a7aee5aef6e8b23d241..c5616fb2081a8c99f7858b2582f39eb7cb077761 100755 --- a/indra/newview/lltoolselectrect.cpp +++ b/indra/newview/lltoolselectrect.cpp @@ -32,7 +32,6 @@ // Library includes #include "llgl.h" #include "llrender.h" -#include "lldarray.h" // Viewer includes #include "llviewercontrol.h" @@ -145,11 +144,11 @@ BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask) return LLToolSelect::handleHover(x, y, mask); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectRect (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectRect (active)" << LL_ENDL; } else { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectRect (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectRect (inactive)" << LL_ENDL; } gViewerWindow->setCursor(UI_CURSOR_ARROW); diff --git a/indra/newview/lltoolview.cpp b/indra/newview/lltoolview.cpp index 8c40ff3cb336d3a781310f45f6aac3422e1757c6..678e2c241a02f1a0b2da68a8d1ce5a29c5376190 100755 --- a/indra/newview/lltoolview.cpp +++ b/indra/newview/lltoolview.cpp @@ -179,7 +179,7 @@ LLToolContainer* LLToolView::findToolContainer( LLTool *tool ) return contain; } } - llerrs << "LLToolView::findToolContainer - tool not found" << llendl; + LL_ERRS() << "LLToolView::findToolContainer - tool not found" << LL_ENDL; return NULL; } diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index 73ceb783b5f1e576f508e88a0d7fc2a2dbc0d9ae..f611d0503f852bf5b09aad3cae30ad47abcfadd4 100755 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -28,7 +28,6 @@ // library includes #include "llcoord.h" -#include "lldarray.h" #include "llfontgl.h" #include "llgl.h" #include "llrender.h" @@ -427,9 +426,9 @@ F32 pulse_func(F32 t, F32 z, bool tracking_avatar, std::string direction) } else { - z -= t*64.f - 256.f; + z -= t*64.f - 256.f; } - + F32 a = cosf(z*F_PI/512.f)*10.0f; a = llmax(a, 9.9f); a -= 9.9f; @@ -502,54 +501,54 @@ void LLTracker::drawBeacon(LLVector3 pos_agent, std::string direction, LLColor4 step = pos_agent.mV[2] / BEACON_VERTS; } - gGL.color4fv(fogged_color.mV); - - LLVector3 x_axis = LLViewerCamera::getInstance()->getLeftAxis(); - F32 t = gRenderStartTime.getElapsedTimeF32(); - - for (U32 i = 0; i < BEACON_VERTS; i++) - { - F32 x = x_axis.mV[0]; - F32 y = x_axis.mV[1]; + gGL.color4fv(fogged_color.mV); + + LLVector3 x_axis = LLViewerCamera::getInstance()->getLeftAxis(); + F32 t = gRenderStartTime.getElapsedTimeF32(); + + for (U32 i = 0; i < BEACON_VERTS; i++) + { + F32 x = x_axis.mV[0]; + F32 y = x_axis.mV[1]; - F32 z = i * step; - F32 z_next = (i+1)*step; - + F32 z = i * step; + F32 z_next = (i+1)*step; + bool tracking_avatar = getTrackingStatus() == TRACKING_AVATAR; F32 a = pulse_func(t, z, tracking_avatar, direction); F32 an = pulse_func(t, z_next, tracking_avatar, direction); - - LLColor4 c_col = fogged_color + LLColor4(a,a,a,a); - LLColor4 col_next = fogged_color + LLColor4(an,an,an,an); - LLColor4 col_edge = fogged_color * LLColor4(a,a,a,0.0f); - LLColor4 col_edge_next = fogged_color * LLColor4(an,an,an,0.0f); - - a *= 2.f; + + LLColor4 c_col = fogged_color + LLColor4(a,a,a,a); + LLColor4 col_next = fogged_color + LLColor4(an,an,an,an); + LLColor4 col_edge = fogged_color * LLColor4(a,a,a,0.0f); + LLColor4 col_edge_next = fogged_color * LLColor4(an,an,an,0.0f); + + a *= 2.f; a += 1.0f; - - an *= 2.f; + + an *= 2.f; an += 1.0f; - - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.color4fv(col_edge.mV); - gGL.vertex3f(-x*a, -y*a, z); - gGL.color4fv(col_edge_next.mV); - gGL.vertex3f(-x*an, -y*an, z_next); - - gGL.color4fv(c_col.mV); - gGL.vertex3f(0, 0, z); - gGL.color4fv(col_next.mV); - gGL.vertex3f(0, 0, z_next); - - gGL.color4fv(col_edge.mV); - gGL.vertex3f(x*a,y*a,z); - gGL.color4fv(col_edge_next.mV); - gGL.vertex3f(x*an,y*an,z_next); + + gGL.begin(LLRender::TRIANGLE_STRIP); + gGL.color4fv(col_edge.mV); + gGL.vertex3f(-x*a, -y*a, z); + gGL.color4fv(col_edge_next.mV); + gGL.vertex3f(-x*an, -y*an, z_next); + + gGL.color4fv(c_col.mV); + gGL.vertex3f(0, 0, z); + gGL.color4fv(col_next.mV); + gGL.vertex3f(0, 0, z_next); + + gGL.color4fv(col_edge.mV); + gGL.vertex3f(x*a,y*a,z); + gGL.color4fv(col_edge_next.mV); + gGL.vertex3f(x*an,y*an,z_next); gGL.end(); } gGL.popMatrix(); } - + // static void LLTracker::renderBeacon(LLVector3d pos_global, const LLColor4& color, @@ -566,7 +565,7 @@ void LLTracker::renderBeacon(LLVector3d pos_global, { color_frac = 0.4f; // pos_global = gAgentCamera.getCameraPositionGlobal() + 0.99f*(LLViewerCamera::getInstance()->getFar()/dist)*to_vec; - } + } else { color_frac = 1.f - 0.6f*(dist/LLViewerCamera::getInstance()->getFar()); @@ -805,7 +804,7 @@ void LLTracker::cacheLandmarkPosition() } else { - llwarns << "LLTracker couldn't find home pos" << llendl; + LL_WARNS() << "LLTracker couldn't find home pos" << LL_ENDL; mTrackedLandmarkAssetID.setNull(); mTrackedLandmarkItemID.setNull(); } diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h index d8d5803787c55cb88d28035ae2797021da7ccad3..218f3430a6b9cb7e0e9cf31e062fa3fd1bbc5751 100755 --- a/indra/newview/lltracker.h +++ b/indra/newview/lltracker.h @@ -33,7 +33,6 @@ #ifndef LL_LLTRACKER_H #define LL_LLTRACKER_H -#include "lldarray.h" #include "llpointer.h" #include "llstring.h" #include "lluuid.h" @@ -140,8 +139,8 @@ class LLTracker std::string mTrackedLandmarkName; LLUUID mTrackedLandmarkAssetID; LLUUID mTrackedLandmarkItemID; - LLDynamicArray<LLUUID> mLandmarkAssetIDList; - LLDynamicArray<LLUUID> mLandmarkItemIDList; + std::vector<LLUUID> mLandmarkAssetIDList; + std::vector<LLUUID> mLandmarkItemIDList; BOOL mHasReachedLandmark; BOOL mHasLandmarkPosition; BOOL mLandmarkHasBeenVisited; diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index f3d8de1904be0f2f1ccabdd0d806805806db13fa..7e80d72dec61596d782099e911e61c886aaf9e91 100755 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -284,7 +284,7 @@ void LLTranslate::TranslationReceiver::completedRaw( err_msg = LLTrans::getString("TranslationResponseParseError"); } - llwarns << "Translation request failed: " << err_msg << llendl; + LL_WARNS() << "Translation request failed: " << err_msg << LL_ENDL; handleFailure(status, err_msg); } } diff --git a/indra/newview/lluploadfloaterobservers.cpp b/indra/newview/lluploadfloaterobservers.cpp index 1d777b3f7f380be2e6fc0e560a52d580dc900851..248f1bf1d55e8b25c63684aa9116290b6510fa5e 100755 --- a/indra/newview/lluploadfloaterobservers.cpp +++ b/indra/newview/lluploadfloaterobservers.cpp @@ -35,8 +35,8 @@ LLUploadModelPremissionsResponder::LLUploadModelPremissionsResponder(const LLHan void LLUploadModelPremissionsResponder::errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "LLUploadModelPremissionsResponder error [status:" - << status << "]: " << content << llendl; + LL_WARNS() << "LLUploadModelPremissionsResponder error [status:" + << status << "]: " << content << LL_ENDL; LLUploadPermissionsObserver* observer = mObserverHandle.get(); diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp index aa90d16c67f5848153f0511bdcfaac8be8610251..01a81c5f83e440433183e766819693db938304b7 100755 --- a/indra/newview/llurl.cpp +++ b/indra/newview/llurl.cpp @@ -126,13 +126,13 @@ void LLURL::init(const char * url) strncpy(mPath,leftover_url, LL_MAX_PATH -1); /* Flawfinder: ignore */ mPath[LL_MAX_PATH -1] = '\0'; -// llinfos << url << " decomposed into: " << llendl; -// llinfos << " URI : <" << mURI << ">" << llendl; -// llinfos << " Auth: <" << mAuthority << ">" << llendl; -// llinfos << " Path: <" << mPath << ">" << llendl; -// llinfos << " File: <" << mFilename << ">" << llendl; -// llinfos << " Ext : <" << mExtension << ">" << llendl; -// llinfos << " Tag : <" << mTag << ">" << llendl; +// LL_INFOS() << url << " decomposed into: " << LL_ENDL; +// LL_INFOS() << " URI : <" << mURI << ">" << LL_ENDL; +// LL_INFOS() << " Auth: <" << mAuthority << ">" << LL_ENDL; +// LL_INFOS() << " Path: <" << mPath << ">" << LL_ENDL; +// LL_INFOS() << " File: <" << mFilename << ">" << LL_ENDL; +// LL_INFOS() << " Ext : <" << mExtension << ">" << LL_ENDL; +// LL_INFOS() << " Tag : <" << mTag << ">" << LL_ENDL; } void LLURL::cleanup() diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp index ca593c80bc5882e04e4a71630415f3010e8347af..615064c782a1686ba32b1d02c731b54969a8ec21 100755 --- a/indra/newview/llurldispatcher.cpp +++ b/indra/newview/llurldispatcher.cpp @@ -151,7 +151,7 @@ bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl, LLMediaCtrl* web, bool trusted_browser) { - llinfos << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << llendl; + LL_INFOS() << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << LL_ENDL; const LLSD& query_map = LLURI::queryMap(slurl.getAppQuery()); bool handled = LLCommandDispatcher::dispatch( slurl.getAppCmd(), slurl.getAppPath(), query_map, web, nav_type, trusted_browser); diff --git a/indra/newview/llurlhistory.cpp b/indra/newview/llurlhistory.cpp index a80b9da13c96e8b33ba029cad78095577b7b8f2d..8eea2b242aef274a957c65c26edfe33f33a1427d 100755 --- a/indra/newview/llurlhistory.cpp +++ b/indra/newview/llurlhistory.cpp @@ -48,15 +48,15 @@ bool LLURLHistory::loadFile(const std::string& filename) if (file.is_open()) { - llinfos << "Loading history.xml file at " << filename << llendl; + LL_INFOS() << "Loading history.xml file at " << filename << LL_ENDL; LLSDSerialize::fromXML(data, file); } if (data.isUndefined()) { - llinfos << "file missing, ill-formed, " + LL_INFOS() << "file missing, ill-formed, " "or simply undefined; not changing the" - " file" << llendl; + " file" << LL_ENDL; sHistorySD = LLSD(); return false; } @@ -71,7 +71,7 @@ bool LLURLHistory::saveFile(const std::string& filename) std::string temp_str = gDirUtilp->getLindenUserDir(); if( temp_str.empty() ) { - llinfos << "Can't save URL history - no user directory set yet." << llendl; + LL_INFOS() << "Can't save URL history - no user directory set yet." << LL_ENDL; return false; } @@ -79,7 +79,7 @@ bool LLURLHistory::saveFile(const std::string& filename) llofstream out(temp_str); if (!out.good()) { - llwarns << "Unable to open " << filename << " for output." << llendl; + LL_WARNS() << "Unable to open " << filename << " for output." << LL_ENDL; return false; } diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp index 72029203d96e53c8ec4ec19a184aa55547631e4e..8211ce12f645de13b8e4a61ee4ac67fba58f335b 100755 --- a/indra/newview/llurlwhitelist.cpp +++ b/indra/newview/llurlwhitelist.cpp @@ -117,7 +117,7 @@ bool LLUrlWhiteList::save () if (resolvedFilename.empty()) { - llinfos << "No per-user dir for saving URL whitelist - presumably not logged in yet. Skipping." << llendl; + LL_INFOS() << "No per-user dir for saving URL whitelist - presumably not logged in yet. Skipping." << LL_ENDL; return false; } diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index aaa81c57d42c53a74c08e31eb770b22f94cece11..54ac29723f6cef497803737c3a63df7650b7968c 100755 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -31,6 +31,8 @@ #include "stdtypes.h" #include "llvoavatar.h" +#include "llsdparam.h" +#include "llsdutil.h" /* * Classes and utility functions for per-thread and per-region @@ -78,126 +80,259 @@ * */ +namespace LLViewerAssetStatsFF +{ + static EViewerAssetCategories asset_type_to_category(const LLViewerAssetType::EType at, bool with_http, bool is_temp) + { + // For statistical purposes, we divide GETs into several + // populations of asset fetches: + // - textures which are de-prioritized in the asset system + // - wearables (clothing, bodyparts) which directly affect + // user experiences when they log in + // - sounds + // - gestures + // - everything else. + // + llassert_always(50 == LLViewerAssetType::AT_COUNT); + + // Multiple asset definitions are floating around so this requires some + // maintenance and attention. + static const EViewerAssetCategories asset_to_bin_map[LLViewerAssetType::AT_COUNT] = + { + EVACTextureTempHTTPGet, // (0) AT_TEXTURE + EVACSoundUDPGet, // AT_SOUND + EVACOtherGet, // AT_CALLINGCARD + EVACOtherGet, // AT_LANDMARK + EVACOtherGet, // AT_SCRIPT + EVACWearableUDPGet, // AT_CLOTHING + EVACOtherGet, // AT_OBJECT + EVACOtherGet, // AT_NOTECARD + EVACOtherGet, // AT_CATEGORY + EVACOtherGet, // AT_ROOT_CATEGORY + EVACOtherGet, // (10) AT_LSL_TEXT + EVACOtherGet, // AT_LSL_BYTECODE + EVACOtherGet, // AT_TEXTURE_TGA + EVACWearableUDPGet, // AT_BODYPART + EVACOtherGet, // AT_TRASH + EVACOtherGet, // AT_SNAPSHOT_CATEGORY + EVACOtherGet, // AT_LOST_AND_FOUND + EVACSoundUDPGet, // AT_SOUND_WAV + EVACOtherGet, // AT_IMAGE_TGA + EVACOtherGet, // AT_IMAGE_JPEG + EVACGestureUDPGet, // (20) AT_ANIMATION + EVACGestureUDPGet, // AT_GESTURE + EVACOtherGet, // AT_SIMSTATE + EVACOtherGet, // AT_FAVORITE + EVACOtherGet, // AT_LINK + EVACOtherGet, // AT_LINK_FOLDER + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // (30) + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // (40) + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // + EVACOtherGet, // AT_MESH + // (50) + }; -// ------------------------------------------------------ -// Global data definitions -// ------------------------------------------------------ -LLViewerAssetStats * gViewerAssetStatsMain(0); -LLViewerAssetStats * gViewerAssetStatsThread1(0); + if (at < 0 || at >= LLViewerAssetType::AT_COUNT) + { + return EVACOtherGet; + } + EViewerAssetCategories ret(asset_to_bin_map[at]); + if (EVACTextureTempHTTPGet == ret) + { + // Indexed with [is_temp][with_http] + static const EViewerAssetCategories texture_bin_map[2][2] = + { + { + EVACTextureNonTempUDPGet, + EVACTextureNonTempHTTPGet, + }, + { + EVACTextureTempUDPGet, + EVACTextureTempHTTPGet, + } + }; + + ret = texture_bin_map[is_temp][with_http]; + } + return ret; + } + static LLTrace::CountStatHandle<> sEnqueueAssetRequestsTempTextureHTTP ("enqueuedassetrequeststemptexturehttp", + "Number of temporary texture asset http requests enqueued"), + sEnqueueAssetRequestsTempTextureUDP ("enqueuedassetrequeststemptextureudp", + "Number of temporary texture asset udp requests enqueued"), + sEnqueueAssetRequestsNonTempTextureHTTP("enqueuedassetrequestsnontemptexturehttp", + "Number of texture asset http requests enqueued"), + sEnqueueAssetRequestsNonTempTextureUDP ("enqueuedassetrequestsnontemptextureudp", + "Number of texture asset udp requests enqueued"), + sEnqueuedAssetRequestsWearableUdp ("enqueuedassetrequestswearableudp", + "Number of wearable asset requests enqueued"), + sEnqueuedAssetRequestsSoundUdp ("enqueuedassetrequestssoundudp", + "Number of sound asset requests enqueued"), + sEnqueuedAssetRequestsGestureUdp ("enqueuedassetrequestsgestureudp", + "Number of gesture asset requests enqueued"), + sEnqueuedAssetRequestsOther ("enqueuedassetrequestsother", + "Number of other asset requests enqueued"); + + static LLTrace::CountStatHandle<>* sEnqueued[EVACCount] = { + &sEnqueueAssetRequestsTempTextureHTTP, + &sEnqueueAssetRequestsTempTextureUDP, + &sEnqueueAssetRequestsNonTempTextureHTTP, + &sEnqueueAssetRequestsNonTempTextureUDP, + &sEnqueuedAssetRequestsWearableUdp, + &sEnqueuedAssetRequestsSoundUdp, + &sEnqueuedAssetRequestsGestureUdp, + &sEnqueuedAssetRequestsOther + }; + + static LLTrace::CountStatHandle<> sDequeueAssetRequestsTempTextureHTTP ("dequeuedassetrequeststemptexturehttp", + "Number of temporary texture asset http requests dequeued"), + sDequeueAssetRequestsTempTextureUDP ("dequeuedassetrequeststemptextureudp", + "Number of temporary texture asset udp requests dequeued"), + sDequeueAssetRequestsNonTempTextureHTTP("dequeuedassetrequestsnontemptexturehttp", + "Number of texture asset http requests dequeued"), + sDequeueAssetRequestsNonTempTextureUDP ("dequeuedassetrequestsnontemptextureudp", + "Number of texture asset udp requests dequeued"), + sDequeuedAssetRequestsWearableUdp ("dequeuedassetrequestswearableudp", + "Number of wearable asset requests dequeued"), + sDequeuedAssetRequestsSoundUdp ("dequeuedassetrequestssoundudp", + "Number of sound asset requests dequeued"), + sDequeuedAssetRequestsGestureUdp ("dequeuedassetrequestsgestureudp", + "Number of gesture asset requests dequeued"), + sDequeuedAssetRequestsOther ("dequeuedassetrequestsother", + "Number of other asset requests dequeued"); + + static LLTrace::CountStatHandle<>* sDequeued[EVACCount] = { + &sDequeueAssetRequestsTempTextureHTTP, + &sDequeueAssetRequestsTempTextureUDP, + &sDequeueAssetRequestsNonTempTextureHTTP, + &sDequeueAssetRequestsNonTempTextureUDP, + &sDequeuedAssetRequestsWearableUdp, + &sDequeuedAssetRequestsSoundUdp, + &sDequeuedAssetRequestsGestureUdp, + &sDequeuedAssetRequestsOther + }; + + static LLTrace::EventStatHandle<F64Seconds > sResponseAssetRequestsTempTextureHTTP ("assetresponsetimestemptexturehttp", + "Time spent responding to temporary texture asset http requests"), + sResponseAssetRequestsTempTextureUDP ("assetresponsetimestemptextureudp", + "Time spent responding to temporary texture asset udp requests"), + sResponseAssetRequestsNonTempTextureHTTP("assetresponsetimesnontemptexturehttp", + "Time spent responding to texture asset http requests"), + sResponseAssetRequestsNonTempTextureUDP ("assetresponsetimesnontemptextureudp", + "Time spent responding to texture asset udp requests"), + sResponsedAssetRequestsWearableUdp ("assetresponsetimeswearableudp", + "Time spent responding to wearable asset requests"), + sResponsedAssetRequestsSoundUdp ("assetresponsetimessoundudp", + "Time spent responding to sound asset requests"), + sResponsedAssetRequestsGestureUdp ("assetresponsetimesgestureudp", + "Time spent responding to gesture asset requests"), + sResponsedAssetRequestsOther ("assetresponsetimesother", + "Time spent responding to other asset requests"); + + static LLTrace::EventStatHandle<F64Seconds >* sResponse[EVACCount] = { + &sResponseAssetRequestsTempTextureHTTP, + &sResponseAssetRequestsTempTextureUDP, + &sResponseAssetRequestsNonTempTextureHTTP, + &sResponseAssetRequestsNonTempTextureUDP, + &sResponsedAssetRequestsWearableUdp, + &sResponsedAssetRequestsSoundUdp, + &sResponsedAssetRequestsGestureUdp, + &sResponsedAssetRequestsOther + }; +} // ------------------------------------------------------ -// Local declarations +// Global data definitions // ------------------------------------------------------ -namespace -{ - -static LLViewerAssetStats::EViewerAssetCategories -asset_type_to_category(const LLViewerAssetType::EType at, bool with_http, bool is_temp); - -} +LLViewerAssetStats * gViewerAssetStats(0); // ------------------------------------------------------ -// LLViewerAssetStats::PerRegionStats struct definition +// LLViewerAssetStats class definition // ------------------------------------------------------ -void -LLViewerAssetStats::PerRegionStats::reset() +LLViewerAssetStats::LLViewerAssetStats() +: mRegionHandle(U64(0)), + mCurRecording(NULL) { - for (int i(0); i < LL_ARRAY_SIZE(mRequests); ++i) - { - mRequests[i].mEnqueued.reset(); - mRequests[i].mDequeued.reset(); - mRequests[i].mResponse.reset(); - } - mFPS.reset(); - - mTotalTime = 0; - mStartTimestamp = LLViewerAssetStatsFF::get_timestamp(); + start(); } -void -LLViewerAssetStats::PerRegionStats::merge(const LLViewerAssetStats::PerRegionStats & src) +LLViewerAssetStats::LLViewerAssetStats(const LLViewerAssetStats & src) +: mRegionHandle(src.mRegionHandle) { - // mRegionHandle, mTotalTime, mStartTimestamp are left alone. + mRegionRecordings = src.mRegionRecordings; + + mCurRecording = &mRegionRecordings[mRegionHandle]; - // mFPS - if (src.mFPS.getCount() && mFPS.getCount()) + // assume this is being passed to another thread, so make sure we have unique copies of recording data + for (PerRegionRecordingContainer::iterator it = mRegionRecordings.begin(), end_it = mRegionRecordings.end(); + it != end_it; + ++it) { - mFPS.merge(src.mFPS); + it->second.stop(); + it->second.makeUnique(); } - // Avatar stats - data all comes from main thread, so leave alone. + LLStopWatchControlsMixin<LLViewerAssetStats>::setPlayState(src.getPlayState()); +} - // Requests - for (int i = 0; i < LL_ARRAY_SIZE(mRequests); ++i) +void LLViewerAssetStats::handleStart() +{ + if (mCurRecording) { - mRequests[i].mEnqueued.merge(src.mRequests[i].mEnqueued); - mRequests[i].mDequeued.merge(src.mRequests[i].mDequeued); - mRequests[i].mResponse.merge(src.mRequests[i].mResponse); + mCurRecording->start(); } - } - -void -LLViewerAssetStats::PerRegionStats::accumulateTime(duration_t now) +void LLViewerAssetStats::handleStop() { - mTotalTime += (now - mStartTimestamp); - mStartTimestamp = now; + if (mCurRecording) + { + mCurRecording->stop(); + } } - -// ------------------------------------------------------ -// LLViewerAssetStats class definition -// ------------------------------------------------------ -LLViewerAssetStats::LLViewerAssetStats() - : mRegionHandle(U64(0)) +void LLViewerAssetStats::handleReset() { reset(); } -LLViewerAssetStats::LLViewerAssetStats(const LLViewerAssetStats & src) - : mRegionHandle(src.mRegionHandle), - mResetTimestamp(src.mResetTimestamp) -{ - const PerRegionContainer::const_iterator it_end(src.mRegionStats.end()); - for (PerRegionContainer::const_iterator it(src.mRegionStats.begin()); it_end != it; ++it) - { - mRegionStats[it->first] = new PerRegionStats(*it->second); - } - mCurRegionStats = mRegionStats[mRegionHandle]; -} - - -void -LLViewerAssetStats::reset() +void LLViewerAssetStats::reset() { // Empty the map of all region stats - mRegionStats.clear(); + mRegionRecordings.clear(); - // If we have a current stats, reset it, otherwise, as at construction, - // create a new one as we must always have a current stats block. - if (mCurRegionStats) - { - mCurRegionStats->reset(); - } - else + // initialize new recording for current region + if (mRegionHandle) { - mCurRegionStats = new PerRegionStats(mRegionHandle); + mCurRecording = &mRegionRecordings[mRegionHandle]; + mCurRecording->setPlayState(getPlayState()); } - - // And add reference to map - mRegionStats[mRegionHandle] = mCurRegionStats; - - // Start timestamp consistent with per-region collector - mResetTimestamp = mCurRegionStats->mStartTimestamp; } - -void -LLViewerAssetStats::setRegion(region_handle_t region_handle) +void LLViewerAssetStats::setRegion(region_handle_t region_handle) { if (region_handle == mRegionHandle) { @@ -205,410 +340,259 @@ LLViewerAssetStats::setRegion(region_handle_t region_handle) return; } - // Get duration for current set - const duration_t now = LLViewerAssetStatsFF::get_timestamp(); - mCurRegionStats->accumulateTime(now); - - // Prepare new set - PerRegionContainer::iterator new_stats = mRegionStats.find(region_handle); - if (mRegionStats.end() == new_stats) + if (mCurRecording) { - // Haven't seen this region_id before, create a new block and make it current. - mCurRegionStats = new PerRegionStats(region_handle); - mRegionStats[region_handle] = mCurRegionStats; + mCurRecording->pause(); } - else + if (region_handle) { - mCurRegionStats = new_stats->second; + mCurRecording = &mRegionRecordings[region_handle]; + mCurRecording->setPlayState(getPlayState()); } - mCurRegionStats->mStartTimestamp = now; - mRegionHandle = region_handle; -} - -void -LLViewerAssetStats::recordGetEnqueued(LLViewerAssetType::EType at, bool with_http, bool is_temp) -{ - const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp)); - - ++(mCurRegionStats->mRequests[int(eac)].mEnqueued); -} - -void -LLViewerAssetStats::recordGetDequeued(LLViewerAssetType::EType at, bool with_http, bool is_temp) -{ - const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp)); - - ++(mCurRegionStats->mRequests[int(eac)].mDequeued); + mRegionHandle = region_handle; } -void -LLViewerAssetStats::recordGetServiced(LLViewerAssetType::EType at, bool with_http, bool is_temp, duration_t duration) +void LLViewerAssetStats::getStats(AssetStats& stats, bool compact_output) { - const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp)); + using namespace LLViewerAssetStatsFF; - mCurRegionStats->mRequests[int(eac)].mResponse.record(duration); -} + stats.regions.setProvided(); + + for (PerRegionRecordingContainer::iterator it = mRegionRecordings.begin(), end_it = mRegionRecordings.end(); + it != end_it; + ++it) + { + RegionStats& r = stats.regions.add(); + LLTrace::Recording& rec = it->second; + if (!compact_output + || rec.getSum(*sEnqueued[EVACTextureTempHTTPGet]) + || rec.getSum(*sDequeued[EVACTextureTempHTTPGet]) + || rec.getSum(*sResponse[EVACTextureTempHTTPGet]).value()) + { + r.get_texture_temp_http .enqueued((S32)rec.getSum(*sEnqueued[EVACTextureTempHTTPGet])) + .dequeued((S32)rec.getSum(*sDequeued[EVACTextureTempHTTPGet])) + .resp_count((S32)rec.getSum(*sResponse[EVACTextureTempHTTPGet]).value()) + .resp_min(rec.getMin(*sResponse[EVACTextureTempHTTPGet]).value()) + .resp_max(rec.getMax(*sResponse[EVACTextureTempHTTPGet]).value()) + .resp_mean(rec.getMean(*sResponse[EVACTextureTempHTTPGet]).value()); + } + if (!compact_output + || rec.getSum(*sEnqueued[EVACTextureTempUDPGet]) + || rec.getSum(*sDequeued[EVACTextureTempUDPGet]) + || rec.getSum(*sResponse[EVACTextureTempUDPGet]).value()) + { + r.get_texture_temp_udp .enqueued((S32)rec.getSum(*sEnqueued[EVACTextureTempUDPGet])) + .dequeued((S32)rec.getSum(*sDequeued[EVACTextureTempUDPGet])) + .resp_count((S32)rec.getSum(*sResponse[EVACTextureTempUDPGet]).value()) + .resp_min(rec.getMin(*sResponse[EVACTextureTempUDPGet]).value()) + .resp_max(rec.getMax(*sResponse[EVACTextureTempUDPGet]).value()) + .resp_mean(rec.getMean(*sResponse[EVACTextureTempUDPGet]).value()); + } + if (!compact_output + || rec.getSum(*sEnqueued[EVACTextureNonTempHTTPGet]) + || rec.getSum(*sDequeued[EVACTextureNonTempHTTPGet]) + || rec.getSum(*sResponse[EVACTextureNonTempHTTPGet]).value()) + { + r.get_texture_non_temp_http .enqueued((S32)rec.getSum(*sEnqueued[EVACTextureNonTempHTTPGet])) + .dequeued((S32)rec.getSum(*sDequeued[EVACTextureNonTempHTTPGet])) + .resp_count((S32)rec.getSum(*sResponse[EVACTextureNonTempHTTPGet]).value()) + .resp_min(rec.getMin(*sResponse[EVACTextureNonTempHTTPGet]).value()) + .resp_max(rec.getMax(*sResponse[EVACTextureNonTempHTTPGet]).value()) + .resp_mean(rec.getMean(*sResponse[EVACTextureNonTempHTTPGet]).value()); + } -void -LLViewerAssetStats::recordFPS(F32 fps) -{ - mCurRegionStats->mFPS.record(fps); -} + if (!compact_output + || rec.getSum(*sEnqueued[EVACTextureNonTempUDPGet]) + || rec.getSum(*sDequeued[EVACTextureNonTempUDPGet]) + || rec.getSum(*sResponse[EVACTextureNonTempUDPGet]).value()) + { + r.get_texture_non_temp_udp .enqueued((S32)rec.getSum(*sEnqueued[EVACTextureNonTempUDPGet])) + .dequeued((S32)rec.getSum(*sDequeued[EVACTextureNonTempUDPGet])) + .resp_count((S32)rec.getSum(*sResponse[EVACTextureNonTempUDPGet]).value()) + .resp_min(rec.getMin(*sResponse[EVACTextureNonTempUDPGet]).value()) + .resp_max(rec.getMax(*sResponse[EVACTextureNonTempUDPGet]).value()) + .resp_mean(rec.getMean(*sResponse[EVACTextureNonTempUDPGet]).value()); + } -LLSD -LLViewerAssetStats::asLLSD(bool compact_output) -{ - // Top-level tags - static const LLSD::String tags[EVACCount] = + if (!compact_output + || rec.getSum(*sEnqueued[EVACWearableUDPGet]) + || rec.getSum(*sDequeued[EVACWearableUDPGet]) + || rec.getSum(*sResponse[EVACWearableUDPGet]).value()) { - LLSD::String("get_texture_temp_http"), - LLSD::String("get_texture_temp_udp"), - LLSD::String("get_texture_non_temp_http"), - LLSD::String("get_texture_non_temp_udp"), - LLSD::String("get_wearable_udp"), - LLSD::String("get_sound_udp"), - LLSD::String("get_gesture_udp"), - LLSD::String("get_other") - }; + r.get_wearable_udp .enqueued((S32)rec.getSum(*sEnqueued[EVACWearableUDPGet])) + .dequeued((S32)rec.getSum(*sDequeued[EVACWearableUDPGet])) + .resp_count((S32)rec.getSum(*sResponse[EVACWearableUDPGet]).value()) + .resp_min(rec.getMin(*sResponse[EVACWearableUDPGet]).value()) + .resp_max(rec.getMax(*sResponse[EVACWearableUDPGet]).value()) + .resp_mean(rec.getMean(*sResponse[EVACWearableUDPGet]).value()); + } - // Stats Group Sub-tags. - static const LLSD::String enq_tag("enqueued"); - static const LLSD::String deq_tag("dequeued"); - static const LLSD::String rcnt_tag("resp_count"); - static const LLSD::String rmin_tag("resp_min"); - static const LLSD::String rmax_tag("resp_max"); - static const LLSD::String rmean_tag("resp_mean"); - - // MMM Group Sub-tags. - static const LLSD::String cnt_tag("count"); - static const LLSD::String min_tag("min"); - static const LLSD::String max_tag("max"); - static const LLSD::String mean_tag("mean"); - - const duration_t now = LLViewerAssetStatsFF::get_timestamp(); - mCurRegionStats->accumulateTime(now); - - LLSD regions = LLSD::emptyArray(); - for (PerRegionContainer::iterator it = mRegionStats.begin(); - mRegionStats.end() != it; - ++it) - { - if (0 == it->first) + if (!compact_output + || rec.getSum(*sEnqueued[EVACSoundUDPGet]) + || rec.getSum(*sDequeued[EVACSoundUDPGet]) + || rec.getSum(*sResponse[EVACSoundUDPGet]).value()) { - // Never emit NULL UUID/handle in results. - continue; + r.get_sound_udp .enqueued((S32)rec.getSum(*sEnqueued[EVACSoundUDPGet])) + .dequeued((S32)rec.getSum(*sDequeued[EVACSoundUDPGet])) + .resp_count((S32)rec.getSum(*sResponse[EVACSoundUDPGet]).value()) + .resp_min(rec.getMin(*sResponse[EVACSoundUDPGet]).value()) + .resp_max(rec.getMax(*sResponse[EVACSoundUDPGet]).value()) + .resp_mean(rec.getMean(*sResponse[EVACSoundUDPGet]).value()); } - PerRegionStats & stats = *it->second; - - LLSD reg_stat = LLSD::emptyMap(); - - for (int i = 0; i < LL_ARRAY_SIZE(tags); ++i) + if (!compact_output + || rec.getSum(*sEnqueued[EVACGestureUDPGet]) + || rec.getSum(*sDequeued[EVACGestureUDPGet]) + || rec.getSum(*sResponse[EVACGestureUDPGet]).value()) { - PerRegionStats::prs_group & group(stats.mRequests[i]); + r.get_gesture_udp .enqueued((S32)rec.getSum(*sEnqueued[EVACGestureUDPGet])) + .dequeued((S32)rec.getSum(*sDequeued[EVACGestureUDPGet])) + .resp_count((S32)rec.getSum(*sResponse[EVACGestureUDPGet]).value()) + .resp_min(rec.getMin(*sResponse[EVACGestureUDPGet]).value()) + .resp_max(rec.getMax(*sResponse[EVACGestureUDPGet]).value()) + .resp_mean(rec.getMean(*sResponse[EVACGestureUDPGet]).value()); + } - if ((! compact_output) || - group.mEnqueued.getCount() || - group.mDequeued.getCount() || - group.mResponse.getCount()) + if (!compact_output + || rec.getSum(*sEnqueued[EVACOtherGet]) + || rec.getSum(*sDequeued[EVACOtherGet]) + || rec.getSum(*sResponse[EVACOtherGet]).value()) { - LLSD & slot = reg_stat[tags[i]]; - slot = LLSD::emptyMap(); - slot[enq_tag] = LLSD(S32(stats.mRequests[i].mEnqueued.getCount())); - slot[deq_tag] = LLSD(S32(stats.mRequests[i].mDequeued.getCount())); - slot[rcnt_tag] = LLSD(S32(stats.mRequests[i].mResponse.getCount())); - slot[rmin_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMin() * 1.0e-6)); - slot[rmax_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMax() * 1.0e-6)); - slot[rmean_tag] = LLSD(F64(stats.mRequests[i].mResponse.getMean() * 1.0e-6)); - } + r.get_other .enqueued((S32)rec.getSum(*sEnqueued[EVACOtherGet])) + .dequeued((S32)rec.getSum(*sDequeued[EVACOtherGet])) + .resp_count((S32)rec.getSum(*sResponse[EVACOtherGet]).value()) + .resp_min(rec.getMin(*sResponse[EVACOtherGet]).value()) + .resp_max(rec.getMax(*sResponse[EVACOtherGet]).value()) + .resp_mean(rec.getMean(*sResponse[EVACOtherGet]).value()); } - if ((! compact_output) || stats.mFPS.getCount()) + S32 fps = (S32)rec.getLastValue(LLStatViewer::FPS_SAMPLE); + if (!compact_output || fps != 0) { - LLSD & slot = reg_stat["fps"]; - slot = LLSD::emptyMap(); - slot[cnt_tag] = LLSD(S32(stats.mFPS.getCount())); - slot[min_tag] = LLSD(F64(stats.mFPS.getMin())); - slot[max_tag] = LLSD(F64(stats.mFPS.getMax())); - slot[mean_tag] = LLSD(F64(stats.mFPS.getMean())); + r.fps .count(fps) + .min(rec.getMin(LLStatViewer::FPS_SAMPLE)) + .max(rec.getMax(LLStatViewer::FPS_SAMPLE)) + .mean(rec.getMean(LLStatViewer::FPS_SAMPLE)); } U32 grid_x(0), grid_y(0); grid_from_region_handle(it->first, &grid_x, &grid_y); - reg_stat["grid_x"] = LLSD::Integer(grid_x); - reg_stat["grid_y"] = LLSD::Integer(grid_y); - reg_stat["duration"] = LLSD::Real(stats.mTotalTime * 1.0e-6); - regions.append(reg_stat); + r .grid_x(grid_x) + .grid_y(grid_y) + .duration(F64Microseconds(rec.getDuration()).value()); } - LLSD ret = LLSD::emptyMap(); - ret["regions"] = regions; - ret["duration"] = LLSD::Real((now - mResetTimestamp) * 1.0e-6); - - return ret; + stats.duration(mCurRecording ? F64Microseconds(mCurRecording->getDuration()).value() : 0.0); } -void -LLViewerAssetStats::merge(const LLViewerAssetStats & src) +LLSD LLViewerAssetStats::asLLSD(bool compact_output) { - // mRegionHandle, mCurRegionStats and mResetTimestamp are left untouched. - // Just merge the stats bodies - - const PerRegionContainer::const_iterator it_end(src.mRegionStats.end()); - for (PerRegionContainer::const_iterator it(src.mRegionStats.begin()); it_end != it; ++it) + LLParamSDParser parser; + LLSD sd; + AssetStats stats; + getStats(stats, compact_output); + LLInitParam::predicate_rule_t rule = LLInitParam::default_parse_rules(); + if (!compact_output) { - PerRegionContainer::iterator dst(mRegionStats.find(it->first)); - if (mRegionStats.end() == dst) - { - // Destination is missing data, just make a private copy - mRegionStats[it->first] = new PerRegionStats(*it->second); - } - else - { - dst->second->merge(*it->second); - } + rule.allow(LLInitParam::EMPTY); } + parser.writeSD(sd, stats, rule); + return sd; } - // ------------------------------------------------------ // Global free-function definitions (LLViewerAssetStatsFF namespace) // ------------------------------------------------------ namespace LLViewerAssetStatsFF { - -// -// Target thread is elaborated in the function name. This could -// have been something 'templatey' like specializations iterated -// over a set of constants but with so few, this is clearer I think. -// -// As for the threads themselves... rather than do fine-grained -// locking as we gather statistics, this code creates a collector -// for each thread, allocated and run independently. Logging -// happens at relatively infrequent intervals and at that time -// the data is sent to a single thread to be aggregated into -// a single entity with locks, thread safety and other niceties. -// -// A particularly fussy implementation would distribute the -// per-thread pointers across separate cache lines. But that should -// be beyond current requirements. -// - -// 'main' thread - initial program thread - -void -set_region_main(LLViewerAssetStats::region_handle_t region_handle) -{ - if (! gViewerAssetStatsMain) - return; - - gViewerAssetStatsMain->setRegion(region_handle); -} - -void -record_enqueue_main(LLViewerAssetType::EType at, bool with_http, bool is_temp) -{ - if (! gViewerAssetStatsMain) - return; - - gViewerAssetStatsMain->recordGetEnqueued(at, with_http, is_temp); -} - -void -record_dequeue_main(LLViewerAssetType::EType at, bool with_http, bool is_temp) -{ - if (! gViewerAssetStatsMain) - return; - - gViewerAssetStatsMain->recordGetDequeued(at, with_http, is_temp); -} - -void -record_response_main(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration) +void set_region(LLViewerAssetStats::region_handle_t region_handle) { - if (! gViewerAssetStatsMain) + if (! gViewerAssetStats) return; - gViewerAssetStatsMain->recordGetServiced(at, with_http, is_temp, duration); + gViewerAssetStats->setRegion(region_handle); } -void -record_fps_main(F32 fps) +void record_enqueue(LLViewerAssetType::EType at, bool with_http, bool is_temp) { - if (! gViewerAssetStatsMain) - return; - - gViewerAssetStatsMain->recordFPS(fps); -} - -// 'thread1' - should be for TextureFetch thread - -void -set_region_thread1(LLViewerAssetStats::region_handle_t region_handle) -{ - if (! gViewerAssetStatsThread1) - return; - - gViewerAssetStatsThread1->setRegion(region_handle); -} - -void -record_enqueue_thread1(LLViewerAssetType::EType at, bool with_http, bool is_temp) -{ - if (! gViewerAssetStatsThread1) - return; + const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp)); - gViewerAssetStatsThread1->recordGetEnqueued(at, with_http, is_temp); + add(*sEnqueued[int(eac)], 1); } -void -record_dequeue_thread1(LLViewerAssetType::EType at, bool with_http, bool is_temp) +void record_dequeue(LLViewerAssetType::EType at, bool with_http, bool is_temp) { - if (! gViewerAssetStatsThread1) - return; + const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp)); - gViewerAssetStatsThread1->recordGetDequeued(at, with_http, is_temp); + add(*sDequeued[int(eac)], 1); } -void -record_response_thread1(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration) +void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration) { - if (! gViewerAssetStatsThread1) - return; + const EViewerAssetCategories eac(asset_type_to_category(at, with_http, is_temp)); - gViewerAssetStatsThread1->recordGetServiced(at, with_http, is_temp, duration); + record(*sResponse[int(eac)], F64Microseconds(duration)); } - -void -init() +void init() { - if (! gViewerAssetStatsMain) - { - gViewerAssetStatsMain = new LLViewerAssetStats(); - } - if (! gViewerAssetStatsThread1) + if (! gViewerAssetStats) { - gViewerAssetStatsThread1 = new LLViewerAssetStats(); + gViewerAssetStats = new LLViewerAssetStats(); } } void cleanup() { - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = 0; - - delete gViewerAssetStatsThread1; - gViewerAssetStatsThread1 = 0; + delete gViewerAssetStats; + gViewerAssetStats = 0; } } // namespace LLViewerAssetStatsFF -// ------------------------------------------------------ -// Local function definitions -// ------------------------------------------------------ - -namespace -{ -LLViewerAssetStats::EViewerAssetCategories -asset_type_to_category(const LLViewerAssetType::EType at, bool with_http, bool is_temp) -{ - // For statistical purposes, we divide GETs into several - // populations of asset fetches: - // - textures which are de-prioritized in the asset system - // - wearables (clothing, bodyparts) which directly affect - // user experiences when they log in - // - sounds - // - gestures - // - everything else. - // - llassert_always(50 == LLViewerAssetType::AT_COUNT); - - // Multiple asset definitions are floating around so this requires some - // maintenance and attention. - static const LLViewerAssetStats::EViewerAssetCategories asset_to_bin_map[LLViewerAssetType::AT_COUNT] = - { - LLViewerAssetStats::EVACTextureTempHTTPGet, // (0) AT_TEXTURE - LLViewerAssetStats::EVACSoundUDPGet, // AT_SOUND - LLViewerAssetStats::EVACOtherGet, // AT_CALLINGCARD - LLViewerAssetStats::EVACOtherGet, // AT_LANDMARK - LLViewerAssetStats::EVACOtherGet, // AT_SCRIPT - LLViewerAssetStats::EVACWearableUDPGet, // AT_CLOTHING - LLViewerAssetStats::EVACOtherGet, // AT_OBJECT - LLViewerAssetStats::EVACOtherGet, // AT_NOTECARD - LLViewerAssetStats::EVACOtherGet, // AT_CATEGORY - LLViewerAssetStats::EVACOtherGet, // AT_ROOT_CATEGORY - LLViewerAssetStats::EVACOtherGet, // (10) AT_LSL_TEXT - LLViewerAssetStats::EVACOtherGet, // AT_LSL_BYTECODE - LLViewerAssetStats::EVACOtherGet, // AT_TEXTURE_TGA - LLViewerAssetStats::EVACWearableUDPGet, // AT_BODYPART - LLViewerAssetStats::EVACOtherGet, // AT_TRASH - LLViewerAssetStats::EVACOtherGet, // AT_SNAPSHOT_CATEGORY - LLViewerAssetStats::EVACOtherGet, // AT_LOST_AND_FOUND - LLViewerAssetStats::EVACSoundUDPGet, // AT_SOUND_WAV - LLViewerAssetStats::EVACOtherGet, // AT_IMAGE_TGA - LLViewerAssetStats::EVACOtherGet, // AT_IMAGE_JPEG - LLViewerAssetStats::EVACGestureUDPGet, // (20) AT_ANIMATION - LLViewerAssetStats::EVACGestureUDPGet, // AT_GESTURE - LLViewerAssetStats::EVACOtherGet, // AT_SIMSTATE - LLViewerAssetStats::EVACOtherGet, // AT_FAVORITE - LLViewerAssetStats::EVACOtherGet, // AT_LINK - LLViewerAssetStats::EVACOtherGet, // AT_LINK_FOLDER - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // (30) - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // (40) - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // - LLViewerAssetStats::EVACOtherGet, // AT_MESH - // (50) - }; +LLViewerAssetStats::AssetRequestType::AssetRequestType() +: enqueued("enqueued"), + dequeued("dequeued"), + resp_count("resp_count"), + resp_min("resp_min"), + resp_max("resp_max"), + resp_mean("resp_mean") +{} - if (at < 0 || at >= LLViewerAssetType::AT_COUNT) - { - return LLViewerAssetStats::EVACOtherGet; - } - LLViewerAssetStats::EViewerAssetCategories ret(asset_to_bin_map[at]); - if (LLViewerAssetStats::EVACTextureTempHTTPGet == ret) - { - // Indexed with [is_temp][with_http] - static const LLViewerAssetStats::EViewerAssetCategories texture_bin_map[2][2] = - { - { - LLViewerAssetStats::EVACTextureNonTempUDPGet, - LLViewerAssetStats::EVACTextureNonTempHTTPGet, - }, - { - LLViewerAssetStats::EVACTextureTempUDPGet, - LLViewerAssetStats::EVACTextureTempHTTPGet, - } - }; - - ret = texture_bin_map[is_temp][with_http]; - } - return ret; -} - -} // anonymous namespace +LLViewerAssetStats::FPSStats::FPSStats() +: count("count"), + min("min"), + max("max"), + mean("mean") +{} + +LLViewerAssetStats::RegionStats::RegionStats() +: get_texture_temp_http("get_texture_temp_http"), + get_texture_temp_udp("get_texture_temp_udp"), + get_texture_non_temp_http("get_texture_non_temp_http"), + get_texture_non_temp_udp("get_texture_non_temp_udp"), + get_wearable_udp("get_wearable_udp"), + get_sound_udp("get_sound_udp"), + get_gesture_udp("get_gesture_udp"), + get_other("get_other"), + fps("fps"), + grid_x("grid_x"), + grid_y("grid_y"), + duration("duration") +{} + +LLViewerAssetStats::AssetStats::AssetStats() +: regions("regions"), + duration("duration"), + session_id("session_id"), + agent_id("agent_id"), + message("message"), + sequence("sequence"), + initial("initial"), + break_("break") +{} diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h index e4581d2120629c4e0695d59c41348b8e527557de..9d425c82fc97be4dc96bfc08ade7b45f5d688f83 100755 --- a/indra/newview/llviewerassetstats.h +++ b/indra/newview/llviewerassetstats.h @@ -34,9 +34,10 @@ #include "llrefcount.h" #include "llviewerassettype.h" #include "llviewerassetstorage.h" -#include "llsimplestat.h" #include "llsd.h" #include "llvoavatar.h" +#include "lltrace.h" +#include "llinitparam.h" /** * @class LLViewerAssetStats @@ -73,29 +74,15 @@ * LLViewerAssetStatsFF is provided for conditional test-and-call * operations. */ -class LLViewerAssetStats +class LLViewerAssetStats : public LLStopWatchControlsMixin<LLViewerAssetStats> { public: - enum EViewerAssetCategories - { - EVACTextureTempHTTPGet, //< Texture GETs - temp/baked, HTTP - EVACTextureTempUDPGet, //< Texture GETs - temp/baked, UDP - EVACTextureNonTempHTTPGet, //< Texture GETs - perm, HTTP - EVACTextureNonTempUDPGet, //< Texture GETs - perm, UDP - EVACWearableUDPGet, //< Wearable GETs - EVACSoundUDPGet, //< Sound GETs - EVACGestureUDPGet, //< Gesture GETs - EVACOtherGet, //< Other GETs - - EVACCount // Must be last - }; - /** * Type for duration and other time values in the metrics. Selected * for compatibility with the pre-existing timestamp on the texture * fetcher class, LLTextureFetch. */ - typedef U64 duration_t; + typedef U64Microseconds duration_t; /** * Type for the region identifier used in stats. Currently uses @@ -104,64 +91,65 @@ class LLViewerAssetStats */ typedef U64 region_handle_t; - /** - * @brief Collected data for a single region visited by the avatar. - * - * Fairly simple, for each asset bin enumerated above a count - * of enqueue and dequeue operations and simple stats on response - * times for completed requests. - */ - class PerRegionStats : public LLRefCount + struct AssetRequestType : public LLInitParam::Block<AssetRequestType> { - public: - PerRegionStats(const region_handle_t region_handle) - : LLRefCount(), - mRegionHandle(region_handle) - { - reset(); - } - - PerRegionStats(const PerRegionStats & src) - : LLRefCount(), - mRegionHandle(src.mRegionHandle), - mTotalTime(src.mTotalTime), - mStartTimestamp(src.mStartTimestamp), - mFPS(src.mFPS) + Mandatory<S32> enqueued, + dequeued, + resp_count; + Mandatory<F64> resp_min, + resp_max, + resp_mean; + + AssetRequestType(); + }; + + struct FPSStats : public LLInitParam::Block<FPSStats> { - for (int i = 0; i < LL_ARRAY_SIZE(mRequests); ++i) - { - mRequests[i] = src.mRequests[i]; - } - } + Mandatory<S32> count; + Mandatory<F64> min, + max, + mean; + FPSStats(); + }; - // Default assignment and destructor are correct. + struct RegionStats : public LLInitParam::Block<RegionStats> + { + Optional<AssetRequestType> get_texture_temp_http, + get_texture_temp_udp, + get_texture_non_temp_http, + get_texture_non_temp_udp, + get_wearable_udp, + get_sound_udp, + get_gesture_udp, + get_other; + Optional<FPSStats> fps; + Optional<S32> grid_x, + grid_y; + Optional<F64> duration; + + RegionStats(); + }; - void reset(); - - void merge(const PerRegionStats & src); + struct AssetStats : public LLInitParam::Block<AssetStats> + { + Multiple<RegionStats> regions; + Mandatory<F64> duration; - // Apply current running time to total and reset start point. - // Return current timestamp as a convenience. - void accumulateTime(duration_t now); + Mandatory<LLUUID> session_id, + agent_id; - public: - region_handle_t mRegionHandle; - duration_t mTotalTime; - duration_t mStartTimestamp; - LLSimpleStatMMM<> mFPS; + Mandatory<std::string> message; + Mandatory<S32> sequence; + Mandatory<bool> initial, + break_; - struct prs_group - { - LLSimpleStatCounter mEnqueued; - LLSimpleStatCounter mDequeued; - LLSimpleStatMMM<duration_t> mResponse; - } - mRequests [EVACCount]; + AssetStats(); }; public: LLViewerAssetStats(); LLViewerAssetStats(const LLViewerAssetStats &); + // Default destructor is correct. LLViewerAssetStats & operator=(const LLViewerAssetStats &); // Not defined @@ -174,88 +162,28 @@ class LLViewerAssetStats // collection calls. void setRegion(region_handle_t region_handle); - // Asset GET Requests - void recordGetEnqueued(LLViewerAssetType::EType at, bool with_http, bool is_temp); - void recordGetDequeued(LLViewerAssetType::EType at, bool with_http, bool is_temp); - void recordGetServiced(LLViewerAssetType::EType at, bool with_http, bool is_temp, duration_t duration); - - // Frames-Per-Second Samples - void recordFPS(F32 fps); - - // Avatar-related statistics - void recordAvatarStats(); - - // Merge a source instance into a destination instance. This is - // conceptually an 'operator+=()' method: - // - counts are added - // - minimums are min'd - // - maximums are max'd - // - other scalars are ignored ('this' wins) - // - void merge(const LLViewerAssetStats & src); - // Retrieve current metrics for all visited regions (NULL region UUID/handle excluded) - // Returned LLSD is structured as follows: - // - // &stats_group = { - // enqueued : int, - // dequeued : int, - // resp_count : int, - // resp_min : float, - // resp_max : float, - // resp_mean : float - // } - // - // &mmm_group = { - // count : int, - // min : float, - // max : float, - // mean : float - // } - // - // { - // duration: int - // regions: { - // $: { // Keys are strings of the region's handle in hex - // duration: : int, - // fps: : &mmm_group, - // get_texture_temp_http : &stats_group, - // get_texture_temp_udp : &stats_group, - // get_texture_non_temp_http : &stats_group, - // get_texture_non_temp_udp : &stats_group, - // get_wearable_udp : &stats_group, - // get_sound_udp : &stats_group, - // get_gesture_udp : &stats_group, - // get_other : &stats_group - // } - // } - // } - // - // @param compact_output If true, omits from conversion any mmm_block - // or stats_block that would contain all zero data. - // Useful for transmission when the receiver knows - // what is expected and will assume zero for missing - // blocks. + // Uses AssetStats structure seen above + void getStats(AssetStats& stats, bool compact_output); LLSD asLLSD(bool compact_output); protected: - typedef std::map<region_handle_t, LLPointer<PerRegionStats> > PerRegionContainer; + void handleStart(); + void handleStop(); + void handleReset(); + + typedef std::map<region_handle_t, LLTrace::Recording > PerRegionRecordingContainer; // Region of the currently-active region. Always valid but may // be zero after construction or when explicitly set. Unchanged // by a reset() call. region_handle_t mRegionHandle; - // Pointer to metrics collection for currently-active region. Always - // valid and unchanged after reset() though contents will be changed. - // Always points to a collection contained in mRegionStats. - LLPointer<PerRegionStats> mCurRegionStats; + // Pointer to metrics collection for currently-active region. + LLTrace::Recording* mCurRecording; // Metrics data for all regions during one collection cycle - PerRegionContainer mRegionStats; - - // Time of last reset - duration_t mResetTimestamp; + PerRegionRecordingContainer mRegionRecordings; }; @@ -273,12 +201,24 @@ class LLViewerAssetStats * - Main: main() program execution thread * - Thread1: TextureFetch worker thread */ -extern LLViewerAssetStats * gViewerAssetStatsMain; - -extern LLViewerAssetStats * gViewerAssetStatsThread1; +extern LLViewerAssetStats * gViewerAssetStats; namespace LLViewerAssetStatsFF { + enum EViewerAssetCategories + { + EVACTextureTempHTTPGet, //< Texture GETs - temp/baked, HTTP + EVACTextureTempUDPGet, //< Texture GETs - temp/baked, UDP + EVACTextureNonTempHTTPGet, //< Texture GETs - perm, HTTP + EVACTextureNonTempUDPGet, //< Texture GETs - perm, UDP + EVACWearableUDPGet, //< Wearable GETs + EVACSoundUDPGet, //< Sound GETs + EVACGestureUDPGet, //< Gesture GETs + EVACOtherGet, //< Other GETs + + EVACCount // Must be last + }; + /** * @brief Allocation and deallocation of globals. * @@ -303,28 +243,16 @@ inline LLViewerAssetStats::duration_t get_timestamp() /** * Region context, event and duration loggers for the Main thread. */ -void set_region_main(LLViewerAssetStats::region_handle_t region_handle); +void set_region(LLViewerAssetStats::region_handle_t region_handle); -void record_enqueue_main(LLViewerAssetType::EType at, bool with_http, bool is_temp); +void record_enqueue(LLViewerAssetType::EType at, bool with_http, bool is_temp); -void record_dequeue_main(LLViewerAssetType::EType at, bool with_http, bool is_temp); +void record_dequeue(LLViewerAssetType::EType at, bool with_http, bool is_temp); -void record_response_main(LLViewerAssetType::EType at, bool with_http, bool is_temp, +void record_response(LLViewerAssetType::EType at, bool with_http, bool is_temp, LLViewerAssetStats::duration_t duration); -void record_fps_main(F32 fps); - -/** - * Region context, event and duration loggers for Thread 1. - */ -void set_region_thread1(LLViewerAssetStats::region_handle_t region_handle); - -void record_enqueue_thread1(LLViewerAssetType::EType at, bool with_http, bool is_temp); - -void record_dequeue_thread1(LLViewerAssetType::EType at, bool with_http, bool is_temp); - -void record_response_thread1(LLViewerAssetType::EType at, bool with_http, bool is_temp, - LLViewerAssetStats::duration_t duration); +void record_avatar_stats(); } // namespace LLViewerAssetStatsFF diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index d042f6283086783baa01118b6f0a44ae69c3cb47..5fb99ce02facccb7dad54ac813f3ba4d5d39959b 100755 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -69,15 +69,15 @@ class LLViewerAssetRequest : public LLAssetRequest protected: void recordMetrics() { - if (mMetricsStartTime) + if (mMetricsStartTime.value()) { // Okay, it appears this request was used for useful things. Record // the expected dequeue and duration of request processing. - LLViewerAssetStatsFF::record_dequeue_main(mType, false, false); - LLViewerAssetStatsFF::record_response_main(mType, false, false, + LLViewerAssetStatsFF::record_dequeue(mType, false, false); + LLViewerAssetStatsFF::record_response(mType, false, false, (LLViewerAssetStatsFF::get_timestamp() - mMetricsStartTime)); - mMetricsStartTime = 0; + mMetricsStartTime = (U32Seconds)0; } } @@ -113,11 +113,11 @@ void LLViewerAssetStorage::storeAssetData( bool is_priority, bool store_local, bool user_waiting, - F64 timeout) + F64Seconds timeout) { LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy) " << tid << ":" << LLAssetType::lookup(asset_type) - << " ASSET_ID: " << asset_id << llendl; + << " ASSET_ID: " << asset_id << LL_ENDL; if (mUpstreamHost.isOk()) { @@ -137,7 +137,7 @@ void LLViewerAssetStorage::storeAssetData( if (asset_size < 1) { // This can happen if there's a bug in our code or if the VFS has been corrupted. - llwarns << "LLViewerAssetStorage::storeAssetData() Data _should_ already be in the VFS, but it's not! " << asset_id << llendl; + LL_WARNS() << "LLViewerAssetStorage::storeAssetData() Data _should_ already be in the VFS, but it's not! " << asset_id << LL_ENDL; // LLAssetStorage metric: Zero size VFS reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); @@ -174,11 +174,11 @@ void LLViewerAssetStorage::storeAssetData( if( bytes_read == asset_size ) { req->mDataSentInFirstPacket = TRUE; - //llinfos << "LLViewerAssetStorage::createAsset sending data in first packet" << llendl; + //LL_INFOS() << "LLViewerAssetStorage::createAsset sending data in first packet" << LL_ENDL; } else { - llwarns << "Probable corruption in VFS file, aborting store asset data" << llendl; + LL_WARNS() << "Probable corruption in VFS file, aborting store asset data" << LL_ENDL; // LLAssetStorage metric: VFS corrupt - bogus size reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, asset_size, MR_VFS_CORRUPTION, __FILE__, __LINE__, "VFS corruption" ); @@ -207,7 +207,7 @@ void LLViewerAssetStorage::storeAssetData( } else { - llwarns << "AssetStorage: attempt to upload non-existent vfile " << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl; + LL_WARNS() << "AssetStorage: attempt to upload non-existent vfile " << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL; // LLAssetStorage metric: Zero size VFS reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_ZERO_SIZE, __FILE__, __LINE__, "The file didn't exist or was zero length (VFS - can't tell which)" ); if (callback) @@ -218,7 +218,7 @@ void LLViewerAssetStorage::storeAssetData( } else { - llwarns << "Attempt to move asset store request upstream w/o valid upstream provider" << llendl; + LL_WARNS() << "Attempt to move asset store request upstream w/o valid upstream provider" << LL_ENDL; // LLAssetStorage metric: Upstream provider dead reportMetric( asset_id, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_NO_UPSTREAM, __FILE__, __LINE__, "No upstream provider" ); if (callback) @@ -237,20 +237,20 @@ void LLViewerAssetStorage::storeAssetData( bool temp_file, bool is_priority, bool user_waiting, - F64 timeout) + F64Seconds timeout) { if(filename.empty()) { // LLAssetStorage metric: no filename reportMetric( LLUUID::null, asset_type, LLStringUtil::null, LLUUID::null, 0, MR_VFS_CORRUPTION, __FILE__, __LINE__, "Filename missing" ); - llerrs << "No filename specified" << llendl; + LL_ERRS() << "No filename specified" << LL_ENDL; return; } LLAssetID asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << llendl; + LL_DEBUGS("AssetStorage") << "LLViewerAssetStorage::storeAssetData (legacy)" << asset_id << ":" << LLAssetType::lookup(asset_type) << LL_ENDL; - LL_DEBUGS("AssetStorage") << "ASSET_ID: " << asset_id << llendl; + LL_DEBUGS("AssetStorage") << "ASSET_ID: " << asset_id << LL_ENDL; S32 size = 0; LLFILE* fp = LLFile::fopen(filename, "rb"); @@ -369,17 +369,17 @@ void LLViewerAssetStorage::_queueDataRequest( tpvf.setAsset(uuid, atype); tpvf.setCallback(downloadCompleteCallback, req); - LL_DEBUGS("AssetStorage") << "Starting transfer for " << uuid << llendl; + LL_DEBUGS("AssetStorage") << "Starting transfer for " << uuid << LL_ENDL; LLTransferTargetChannel *ttcp = gTransferManager.getTargetChannel(mUpstreamHost, LLTCT_ASSET); ttcp->requestTransfer(spa, tpvf, 100.f + (is_priority ? 1.f : 0.f)); - LLViewerAssetStatsFF::record_enqueue_main(atype, false, false); + LLViewerAssetStatsFF::record_enqueue(atype, false, false); } } else { // uh-oh, we shouldn't have gotten here - llwarns << "Attempt to move asset data request upstream w/o valid upstream provider" << llendl; + LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL; if (callback) { callback(mVFS, uuid, atype, user_data, LL_ERR_CIRCUIT_GONE, LL_EXSTAT_NO_UPSTREAM); diff --git a/indra/newview/llviewerassetstorage.h b/indra/newview/llviewerassetstorage.h index ca9b9943fa8decb19edb22c974233bf6e966a46f..6baec647e60e0886cb6a0e9e5f3cb1ac33338eee 100755 --- a/indra/newview/llviewerassetstorage.h +++ b/indra/newview/llviewerassetstorage.h @@ -51,7 +51,7 @@ class LLViewerAssetStorage : public LLAssetStorage bool is_priority = false, bool store_local = false, bool user_waiting=FALSE, - F64 timeout=LL_ASSET_STORAGE_TIMEOUT); + F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); virtual void storeAssetData( const std::string& filename, @@ -62,7 +62,7 @@ class LLViewerAssetStorage : public LLAssetStorage bool temp_file = false, bool is_priority = false, bool user_waiting=FALSE, - F64 timeout=LL_ASSET_STORAGE_TIMEOUT); + F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT); protected: using LLAssetStorage::_queueDataRequest; diff --git a/indra/newview/llviewerassettype.h b/indra/newview/llviewerassettype.h index ec8b8229175a6e0d048f3be32c0d58dce3565ba5..9ad8ea7eebd589681d19fcfca335b1f79be8c524 100755 --- a/indra/newview/llviewerassettype.h +++ b/indra/newview/llviewerassettype.h @@ -29,6 +29,7 @@ #include <string> #include "llassettype.h" +#include "llui.h" //EDragAndDropType // This class is similar to llassettype, but contains methods // only used by the viewer. diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index fce42a15876416749b86ae1c31c267ce78653ae7..7ce9d858dd89ee068bcd51a77fcb529098a8df0e 100755 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -37,6 +37,7 @@ #include "llviewerwindow.h" #include "llvoiceclient.h" #include "llviewermedia.h" +#include "llviewerregion.h" #include "llprogressview.h" #include "llcallbacklist.h" #include "llstartup.h" @@ -130,7 +131,7 @@ void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) break; default: - llwarns << "Unknown fading state: " << mFadeState << llendl; + LL_WARNS() << "Unknown fading state: " << mFadeState << LL_ENDL; break; } } @@ -306,7 +307,7 @@ void LLViewerAudio::onTeleportFailed() if (parcel) { mNextStreamURI = parcel->getMusicURL(); - llinfos << "Teleport failed -- setting music stream to " << mNextStreamURI << llendl; + LL_INFOS() << "Teleport failed -- setting music stream to " << mNextStreamURI << LL_ENDL; } } mWasPlaying = false; @@ -324,7 +325,7 @@ void LLViewerAudio::onTeleportFinished(const LLVector3d& pos, const bool& local) if (parcel) { mNextStreamURI = parcel->getMusicURL(); - llinfos << "Intraparcel teleport -- setting music stream to " << mNextStreamURI << llendl; + LL_INFOS() << "Intraparcel teleport -- setting music stream to " << mNextStreamURI << LL_ENDL; } } mWasPlaying = false; @@ -334,7 +335,7 @@ void init_audio() { if (!gAudiop) { - llwarns << "Failed to create an appropriate Audio Engine" << llendl; + LL_WARNS() << "Failed to create an appropriate Audio Engine" << LL_ENDL; return; } LLVector3d lpos_global = gAgentCamera.getCameraPositionGlobal(); diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index b5aa0ac92aa489b045999356310fc38de1211a5a..57a0195d23ea41ed3074e0bbb4595422460b5146 100755 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -49,11 +49,15 @@ #include "llglheaders.h" #include "llquaternion.h" #include "llwindow.h" // getPixelAspectRatio() +#include "lltracerecording.h" // System includes #include <iomanip> // for setprecision -U32 LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; +LLTrace::CountStatHandle<> LLViewerCamera::sVelocityStat("camera_velocity"); +LLTrace::CountStatHandle<> LLViewerCamera::sAngularVelocityStat("camera_angular_velocity"); + +LLViewerCamera::eCameraID LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; //glu pick matrix implementation borrowed from Mesa3D glh::matrix4f gl_pick_matrix(GLfloat x, GLfloat y, GLfloat width, GLfloat height, GLint* viewport) @@ -151,7 +155,7 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, setOriginAndLookAt(origin, up_direction, point_of_interest); - mVelocityDir = center - last_position ; + mVelocityDir = origin - last_position ; F32 dpos = mVelocityDir.normVec() ; LLQuaternion rotation; rotation.shortestArc(last_axis, getAtAxis()); @@ -160,11 +164,11 @@ void LLViewerCamera::updateCameraLocation(const LLVector3 ¢er, F32 drot; rotation.getAngleAxis(&drot, &x, &y, &z); - mVelocityStat.addValue(dpos); - mAngularVelocityStat.addValue(drot); + add(sVelocityStat, dpos); + add(sAngularVelocityStat, drot); - mAverageSpeed = mVelocityStat.getMeanPerSec() ; - mAverageAngularSpeed = mAngularVelocityStat.getMeanPerSec() ; + mAverageSpeed = LLTrace::get_frame_recording().getPeriodMeanPerSec(sVelocityStat, 50); + mAverageAngularSpeed = LLTrace::get_frame_recording().getPeriodMeanPerSec(sAngularVelocityStat); mCosHalfCameraFOV = cosf(0.5f * getView() * llmax(1.0f, getAspect())); // update pixel meter ratio using default fov, not modified one diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index b857c7fe89fb108c0c2abf7730b8739531022602..7b2887d725b5458979a437725676bc5b6d824890 100755 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -29,10 +29,10 @@ #include "llcamera.h" #include "llsingleton.h" -#include "llstat.h" #include "lltimer.h" #include "m4math.h" #include "llcoord.h" +#include "lltrace.h" class LLViewerObject; @@ -80,7 +80,7 @@ class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera> NUM_CAMERAS } eCameraID; - static U32 sCurCameraID; + static eCameraID sCurCameraID; LLViewerCamera(); @@ -100,9 +100,9 @@ class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera> BOOL projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp = TRUE) const; BOOL projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const; - const LLVector3* getVelocityDir() const {return &mVelocityDir;} - LLStat *getVelocityStat() { return &mVelocityStat; } - LLStat *getAngularVelocityStat() { return &mAngularVelocityStat; } + LLVector3 getVelocityDir() const {return mVelocityDir;} + static LLTrace::CountStatHandle<>* getVelocityStat() {return &sVelocityStat; } + static LLTrace::CountStatHandle<>* getAngularVelocityStat() {return &sAngularVelocityStat; } F32 getCosHalfFov() {return mCosHalfCameraFOV;} F32 getAverageSpeed() {return mAverageSpeed ;} F32 getAverageAngularSpeed() {return mAverageAngularSpeed;} @@ -117,9 +117,9 @@ class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera> F32 getDefaultFOV() { return mCameraFOVDefault; } BOOL cameraUnderWater() const; + BOOL areVertsVisible(LLViewerObject* volumep, BOOL all_verts); const LLVector3 &getPointOfInterest() { return mLastPointOfInterest; } - BOOL areVertsVisible(LLViewerObject* volumep, BOOL all_verts); F32 getPixelMeterRatio() const { return mPixelMeterRatio; } S32 getScreenPixelArea() const { return mScreenPixelArea; } @@ -130,12 +130,12 @@ class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera> protected: void calcProjection(const F32 far_distance) const; - LLStat mVelocityStat; - LLStat mAngularVelocityStat; + static LLTrace::CountStatHandle<> sVelocityStat; + static LLTrace::CountStatHandle<> sAngularVelocityStat; + LLVector3 mVelocityDir ; F32 mAverageSpeed ; F32 mAverageAngularSpeed ; - mutable LLMatrix4 mProjectionMatrix; // Cache of perspective matrix mutable LLMatrix4 mModelviewMatrix; F32 mCameraFOVDefault; diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 93687dbd5f4adbed9725b5dc53a7b017440352d3..1c3c547bc155cdfd034ff7f764390b4e997e2739 100755 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -241,7 +241,7 @@ std::string LLViewerChat::getSenderSLURL(const LLChat& chat, const LLSD& args) return getObjectImSLURL(chat, args); default: - llwarns << "Getting SLURL for an unsupported sender type: " << chat.mSourceType << llendl; + LL_WARNS() << "Getting SLURL for an unsupported sender type: " << chat.mSourceType << LL_ENDL; } return LLStringUtil::null; diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 744ec4de2b02705f5605ff792df317d58dee2a03..70d3fc9462249105a42125cbea30a5eaa2d71b21 100755 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -264,7 +264,7 @@ static bool handleGammaChanged(const LLSD& newvalue) // Only save it if it's changed if (!gViewerWindow->getWindow()->setGamma(gamma)) { - llwarns << "setGamma failed!" << llendl; + LL_WARNS() << "setGamma failed!" << LL_ENDL; } } @@ -289,7 +289,7 @@ static bool handleMaxPartCountChanged(const LLSD& newvalue) static bool handleVideoMemoryChanged(const LLSD& newvalue) { - gTextureList.updateMaxResidentTexMem(newvalue.asInteger()); + gTextureList.updateMaxResidentTexMem(S32Megabytes(newvalue.asInteger())); return true; } @@ -499,7 +499,7 @@ bool handleVelocityInterpolate(const LLSD& newvalue) msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); gAgent.sendReliableMessage(); - llinfos << "Velocity Interpolation On" << llendl; + LL_INFOS() << "Velocity Interpolation On" << LL_ENDL; } else { @@ -508,7 +508,7 @@ bool handleVelocityInterpolate(const LLSD& newvalue) msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); gAgent.sendReliableMessage(); - llinfos << "Velocity Interpolation Off" << llendl; + LL_INFOS() << "Velocity Interpolation Off" << LL_ENDL; } return true; } @@ -785,13 +785,13 @@ static LLCachedControl<std::string> test_BrowserHomePage("BrowserHomePage", "hah void test_cached_control() { -#define do { TEST_LLCC(T, V) if((T)mySetting_##T != V) llerrs << "Fail "#T << llendl; } while(0) +#define do { TEST_LLCC(T, V) if((T)mySetting_##T != V) LL_ERRS() << "Fail "#T << LL_ENDL; } while(0) TEST_LLCC(U32, 666); TEST_LLCC(S32, (S32)-666); TEST_LLCC(F32, (F32)-666.666); TEST_LLCC(bool, true); TEST_LLCC(BOOL, FALSE); - if((std::string)mySetting_string != "Default String Value") llerrs << "Fail string" << llendl; + if((std::string)mySetting_string != "Default String Value") LL_ERRS() << "Fail string" << LL_ENDL; TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f)); TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f)); TEST_LLCC(LLRect, LLRect(0, 0, 100, 500)); @@ -800,7 +800,7 @@ void test_cached_control() TEST_LLCC(LLColor4U, LLColor4U(255, 200, 100, 255)); //There's no LLSD comparsion for LLCC yet. TEST_LLCC(LLSD, test_llsd); - if((std::string)test_BrowserHomePage != "http://www.secondlife.com") llerrs << "Fail BrowserHomePage" << llendl; + if((std::string)test_BrowserHomePage != "http://www.secondlife.com") LL_ERRS() << "Fail BrowserHomePage" << LL_ENDL; } #endif // TEST_CACHED_CONTROL diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index bbebeea3e0e22a5bd2d6e5de5e912224a1681baa..981e4c40aa904533c1adf9ecf3215b19836eaa91 100755 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -77,6 +77,7 @@ #include "llwlparammanager.h" #include "llwaterparammanager.h" #include "llpostprocess.h" +#include "llscenemonitor.h" extern LLPointer<LLViewerTexture> gStartTexture; extern bool gShiftFrame; @@ -84,9 +85,6 @@ extern bool gShiftFrame; LLPointer<LLViewerTexture> gDisconnectedImagep = NULL; // used to toggle renderer back on after teleport -const F32 TELEPORT_RENDER_DELAY = 20.f; // Max time a teleport is allowed to take before we raise the curtain -const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived. -const F32 TELEPORT_LOCAL_DELAY = 1.0f; // Delay to prevent teleports after starting an in-sim teleport. BOOL gTeleportDisplay = FALSE; LLFrameTimer gTeleportDisplayTimer; LLFrameTimer gTeleportArrivalTimer; @@ -100,6 +98,11 @@ BOOL gWindowResized = FALSE; BOOL gSnapshot = FALSE; BOOL gShaderProfileFrame = FALSE; +// This is how long the sim will try to teleport you before giving up. +const F32 TELEPORT_EXPIRY = 15.0f; +// Additional time (in seconds) to wait per attachment +const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f; + U32 gRecentFrameCount = 0; // number of 'recent' frames LLFrameTimer gRecentFPSTime; LLFrameTimer gRecentMemoryTime; @@ -108,6 +111,7 @@ LLFrameTimer gRecentMemoryTime; void pre_show_depth_buffer(); void post_show_depth_buffer(); void render_ui(F32 zoom_factor = 1.f, int subfield = 0); +void swap(); void render_hud_attachments(); void render_ui_3d(); void render_ui_2d(); @@ -133,7 +137,7 @@ void display_startup() // if (!LLViewerFetchedTexture::sWhiteImagep.isNull()) { - LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName(); + LLTexUnit::sWhiteTexture = LLViewerFetchedTexture::sWhiteImagep->getTexName(); } LLGLSDefault gls_default; @@ -176,11 +180,11 @@ void display_startup() glClear(GL_DEPTH_BUFFER_BIT); } -static LLFastTimer::DeclareTimer FTM_UPDATE_CAMERA("Update Camera"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_CAMERA("Update Camera"); void display_update_camera() { - LLFastTimer t(FTM_UPDATE_CAMERA); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_CAMERA); // TODO: cut draw distance down if customizing avatar? // TODO: cut draw distance on per-parcel basis? @@ -202,51 +206,51 @@ void display_update_camera() LLWorld::getInstance()->setLandFarClip(final_far); } -// Write some stats to llinfos +// Write some stats to LL_INFOS() void display_stats() { F32 fps_log_freq = gSavedSettings.getF32("FPSLogFrequency"); if (fps_log_freq > 0.f && gRecentFPSTime.getElapsedTimeF32() >= fps_log_freq) { F32 fps = gRecentFrameCount / fps_log_freq; - llinfos << llformat("FPS: %.02f", fps) << llendl; + LL_INFOS() << llformat("FPS: %.02f", fps) << LL_ENDL; gRecentFrameCount = 0; gRecentFPSTime.reset(); } F32 mem_log_freq = gSavedSettings.getF32("MemoryLogFrequency"); if (mem_log_freq > 0.f && gRecentMemoryTime.getElapsedTimeF32() >= mem_log_freq) { - gMemoryAllocated = LLMemory::getCurrentRSS(); - U32 memory = (U32)(gMemoryAllocated / (1024*1024)); - llinfos << llformat("MEMORY: %d MB", memory) << llendl; + gMemoryAllocated = (U64Bytes)LLMemory::getCurrentRSS(); + U32Megabytes memory = gMemoryAllocated; + LL_INFOS() << llformat("MEMORY: %d MB", memory.value()) << LL_ENDL; LLMemory::logMemoryInfo(TRUE) ; gRecentMemoryTime.reset(); } } -static LLFastTimer::DeclareTimer FTM_PICK("Picking"); -static LLFastTimer::DeclareTimer FTM_RENDER("Render", true); -static LLFastTimer::DeclareTimer FTM_UPDATE_SKY("Update Sky"); -static LLFastTimer::DeclareTimer FTM_UPDATE_TEXTURES("Update Textures"); -static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE("Update Images"); -static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_CLASS("Class"); -static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_BUMP("Image Update Bump"); -static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_LIST("List"); -static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_DELETE("Delete"); -static LLFastTimer::DeclareTimer FTM_RESIZE_WINDOW("Resize Window"); -static LLFastTimer::DeclareTimer FTM_HUD_UPDATE("HUD Update"); -static LLFastTimer::DeclareTimer FTM_DISPLAY_UPDATE_GEOM("Update Geom"); -static LLFastTimer::DeclareTimer FTM_TEXTURE_UNBIND("Texture Unbind"); -static LLFastTimer::DeclareTimer FTM_TELEPORT_DISPLAY("Teleport Display"); +static LLTrace::BlockTimerStatHandle FTM_PICK("Picking"); +static LLTrace::BlockTimerStatHandle FTM_RENDER("Render"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_SKY("Update Sky"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_DYNAMIC_TEXTURES("Update Dynamic Textures"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE("Update Images"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_CLASS("Class"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_BUMP("Image Update Bump"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_LIST("List"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_DELETE("Delete"); +static LLTrace::BlockTimerStatHandle FTM_RESIZE_WINDOW("Resize Window"); +static LLTrace::BlockTimerStatHandle FTM_HUD_UPDATE("HUD Update"); +static LLTrace::BlockTimerStatHandle FTM_DISPLAY_UPDATE_GEOM("Update Geom"); +static LLTrace::BlockTimerStatHandle FTM_TEXTURE_UNBIND("Texture Unbind"); +static LLTrace::BlockTimerStatHandle FTM_TELEPORT_DISPLAY("Teleport Display"); // Paint the display! void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { - LLFastTimer t(FTM_RENDER); + LL_RECORD_BLOCK_TIME(FTM_RENDER); if (gWindowResized) { //skip render on frames where window has been resized - LLFastTimer t(FTM_RESIZE_WINDOW); + LL_RECORD_BLOCK_TIME(FTM_RESIZE_WINDOW); gGL.flush(); glClear(GL_COLOR_BUFFER_BIT); gViewerWindow->getWindow()->swapBuffers(); @@ -310,7 +314,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gViewerWindow->checkSettings(); { - LLFastTimer ftm(FTM_PICK); + LL_RECORD_BLOCK_TIME(FTM_PICK); LLAppViewer::instance()->pingMainloopTimeout("Display:Pick"); gViewerWindow->performPick(); } @@ -346,7 +350,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // Bail out if we're in the startup state and don't want to try to // render the world. // - if (LLStartUp::getStartupState() < STATE_STARTED) + if (LLStartUp::getStartupState() < STATE_PRECACHE) { LLAppViewer::instance()->pingMainloopTimeout("Display:Startup"); display_startup(); @@ -389,9 +393,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (gTeleportDisplay) { - LLFastTimer t(FTM_TELEPORT_DISPLAY); + LL_RECORD_BLOCK_TIME(FTM_TELEPORT_DISPLAY); LLAppViewer::instance()->pingMainloopTimeout("Display:Teleport"); - const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived. + static LLCachedControl<F32> teleport_arrival_delay(gSavedSettings, "TeleportArrivalDelay"); + static LLCachedControl<F32> teleport_local_delay(gSavedSettings, "TeleportLocalDelay"); S32 attach_count = 0; if (isAgentAvatarValid()) @@ -459,7 +464,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) case LLAgent::TELEPORT_ARRIVING: // Make the user wait while content "pre-caches" { - F32 arrival_fraction = (gTeleportArrivalTimer.getElapsedTimeF32() / TELEPORT_ARRIVAL_DELAY); + F32 arrival_fraction = (gTeleportArrivalTimer.getElapsedTimeF32() / teleport_arrival_delay()); if( arrival_fraction > 1.f ) { arrival_fraction = 1.f; @@ -476,7 +481,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // Short delay when teleporting in the same sim (progress screen active but not shown - did not // fall-through from TELEPORT_START) { - if( gTeleportDisplayTimer.getElapsedTimeF32() > TELEPORT_LOCAL_DELAY ) + if( gTeleportDisplayTimer.getElapsedTimeF32() > teleport_local_delay() ) { //LLFirstUse::useTeleport(); gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); @@ -554,6 +559,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { LLAppViewer::instance()->pingMainloopTimeout("Display:Disconnected"); render_ui(); + swap(); } ////////////////////////// @@ -584,7 +590,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES)) { LLAppViewer::instance()->pingMainloopTimeout("Display:DynamicTextures"); - LLFastTimer t(FTM_UPDATE_TEXTURES); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_DYNAMIC_TEXTURES); if (LLViewerDynamicTexture::updateAllInstances()) { gGL.setColorMask(true, true); @@ -618,15 +624,15 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // *TODO: merge these two methods { - LLFastTimer t(FTM_HUD_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_HUD_UPDATE); LLHUDManager::getInstance()->updateEffects(); LLHUDObject::updateAll(); stop_glerror(); } { - LLFastTimer t(FTM_DISPLAY_UPDATE_GEOM); - const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds; // 50 ms/second update time + LL_RECORD_BLOCK_TIME(FTM_DISPLAY_UPDATE_GEOM); + const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds.value(); // 50 ms/second update time gPipeline.createObjects(max_geom_update_time); gPipeline.processPartitionQ(); gPipeline.updateGeom(max_geom_update_time); @@ -764,29 +770,31 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLAppViewer::instance()->pingMainloopTimeout("Display:UpdateImages"); { - LLFastTimer t(FTM_IMAGE_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE); { - LLFastTimer t(FTM_IMAGE_UPDATE_CLASS); - LLViewerTexture::updateClass(LLViewerCamera::getInstance()->getVelocityStat()->getMean(), - LLViewerCamera::getInstance()->getAngularVelocityStat()->getMean()); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_CLASS); + LLTrace::CountStatHandle<>* velocity_stat = LLViewerCamera::getVelocityStat(); + LLTrace::CountStatHandle<>* angular_velocity_stat = LLViewerCamera::getAngularVelocityStat(); + LLViewerTexture::updateClass(LLTrace::get_frame_recording().getPeriodMeanPerSec(*velocity_stat), + LLTrace::get_frame_recording().getPeriodMeanPerSec(*angular_velocity_stat)); } { - LLFastTimer t(FTM_IMAGE_UPDATE_BUMP); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_BUMP); gBumpImageList.updateImages(); // must be called before gTextureList version so that it's textures are thrown out first. } { - LLFastTimer t(FTM_IMAGE_UPDATE_LIST); - F32 max_image_decode_time = 0.050f*gFrameIntervalSeconds; // 50 ms/second decode time + LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_LIST); + F32 max_image_decode_time = 0.050f*gFrameIntervalSeconds.value(); // 50 ms/second decode time max_image_decode_time = llclamp(max_image_decode_time, 0.002f, 0.005f ); // min 2ms/frame, max 5ms/frame) gTextureList.updateImages(max_image_decode_time); } /*{ - LLFastTimer t(FTM_IMAGE_UPDATE_DELETE); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_DELETE); //remove dead textures from GL LLImageGL::deleteDeadTextures(); stop_glerror(); @@ -822,6 +830,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) } } + LLSceneMonitor::getInstance()->fetchQueryResult(); + LLGLState::checkStates(); LLGLState::checkClientArrays(); @@ -829,7 +839,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) { LLAppViewer::instance()->pingMainloopTimeout("Display:Sky"); - LLFastTimer t(FTM_UPDATE_SKY); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_SKY); gSky.updateSky(); } @@ -961,7 +971,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) } { - LLFastTimer t(FTM_TEXTURE_UNBIND); + LL_RECORD_BLOCK_TIME(FTM_TEXTURE_UNBIND); for (U32 i = 0; i < gGLManager.mNumTextureImageUnits; i++) { //dummy cleanup of any currently bound textures if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) @@ -1009,11 +1019,17 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLPipeline::sUnderWaterRender = FALSE; + { + //capture the frame buffer. + LLSceneMonitor::getInstance()->capture(); + } + LLAppViewer::instance()->pingMainloopTimeout("Display:RenderUI"); if (!for_snapshot) { - LLFastTimer t(FTM_RENDER_UI); + LL_RECORD_BLOCK_TIME(FTM_RENDER_UI); render_ui(); + swap(); } @@ -1059,7 +1075,7 @@ void render_hud_attachments() // clamp target zoom level to reasonable values gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f); // smoothly interpolate current zoom level - gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLCriticalDamp::getInterpolant(0.03f)); + gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLSmoothInterpolation::getInterpolant(0.03f)); if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices()) { @@ -1237,8 +1253,6 @@ BOOL setup_hud_matrices(const LLRect& screen_region) return TRUE; } -static LLFastTimer::DeclareTimer FTM_SWAP("Swap"); - void render_ui(F32 zoom_factor, int subfield) { LLGLState::checkStates(); @@ -1252,6 +1266,15 @@ void render_ui(F32 zoom_factor, int subfield) glh_set_current_modelview(glh_copy_matrix(gGLLastModelView)); } + if(LLSceneMonitor::getInstance()->needsUpdate()) + { + gGL.pushMatrix(); + gViewerWindow->setup2DRender(); + LLSceneMonitor::getInstance()->compare(); + gViewerWindow->setup3DRender(); + gGL.popMatrix(); + } + { BOOL to_texture = gPipeline.canUseVertexShaders() && LLPipeline::sRenderGlow; @@ -1275,7 +1298,7 @@ void render_ui(F32 zoom_factor, int subfield) gGL.color4f(1,1,1,1); if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - LLFastTimer t(FTM_RENDER_UI); + LL_RECORD_BLOCK_TIME(FTM_RENDER_UI); if (!gDisconnected) { @@ -1306,10 +1329,16 @@ void render_ui(F32 zoom_factor, int subfield) glh_set_current_modelview(saved_view); gGL.popMatrix(); } +} + +static LLTrace::BlockTimerStatHandle FTM_SWAP("Swap"); + +void swap() +{ + LL_RECORD_BLOCK_TIME(FTM_SWAP); if (gDisplaySwapBuffers) { - LLFastTimer t(FTM_SWAP); gViewerWindow->getWindow()->swapBuffers(); } gDisplaySwapBuffers = TRUE; @@ -1545,7 +1574,7 @@ void render_disconnected_background() gGL.color4f(1,1,1,1); if (!gDisconnectedImagep && gDisconnected) { - llinfos << "Loading last bitmap..." << llendl; + LL_INFOS() << "Loading last bitmap..." << LL_ENDL; std::string temp_str; temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + SCREEN_LAST_FILENAME; @@ -1553,14 +1582,14 @@ void render_disconnected_background() LLPointer<LLImageBMP> image_bmp = new LLImageBMP; if( !image_bmp->load(temp_str) ) { - //llinfos << "Bitmap load failed" << llendl; + //LL_INFOS() << "Bitmap load failed" << LL_ENDL; return; } LLPointer<LLImageRaw> raw = new LLImageRaw; if (!image_bmp->decode(raw, 0.0f)) { - llinfos << "Bitmap decode failed" << llendl; + LL_INFOS() << "Bitmap decode failed" << LL_ENDL; gDisconnectedImagep = NULL; return; } diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp index f81206ffecd27f57a1a3c8779c9b2d92f24ca94d..3d794f0d91db0c9f0995b3ab96a20d8383e2a32c 100755 --- a/indra/newview/llviewerdisplayname.cpp +++ b/indra/newview/llviewerdisplayname.cpp @@ -62,8 +62,8 @@ class LLSetDisplayNameResponder : public LLHTTPClient::Responder // only care about errors /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "LLSetDisplayNameResponder error [status:" - << status << "]: " << content << llendl; + LL_WARNS() << "LLSetDisplayNameResponder error [status:" + << status << "]: " << content << LL_ENDL; LLViewerDisplayName::sSetDisplayNameSignal(false, "", LLSD()); LLViewerDisplayName::sSetDisplayNameSignal.disconnect_all_slots(); } @@ -103,7 +103,7 @@ void LLViewerDisplayName::set(const std::string& display_name, const set_name_sl change_array.append(av_name.getDisplayName()); change_array.append(display_name); - llinfos << "Set name POST to " << cap_url << llendl; + LL_INFOS() << "Set name POST to " << cap_url << LL_ENDL; // Record our caller for when the server sends back a reply sSetDisplayNameSignal.connect(slot); @@ -132,7 +132,7 @@ class LLSetDisplayNameReply : public LLHTTPNode std::string reason = body["reason"].asString(); LLSD content = body["content"]; - llinfos << "status " << status << " reason " << reason << llendl; + LL_INFOS() << "status " << status << " reason " << reason << LL_ENDL; // If viewer's concept of display name is out-of-date, the set request // will fail with 409 Conflict. If that happens, fetch up-to-date @@ -173,9 +173,9 @@ class LLDisplayNameUpdate : public LLHTTPNode LLAvatarName av_name; av_name.fromLLSD( name_data ); - llinfos << "name-update now " << LLDate::now() + LL_INFOS() << "name-update now " << LLDate::now() << " next_update " << LLDate(av_name.mNextUpdate) - << llendl; + << LL_ENDL; // Name expiration time may be provided in headers, or we may use a // default value diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index a8eeddb798c762ad095a0879d10deccd69d4ca91..e427bb173585a434cdf0cbf6d158fc31a914b629 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -28,66 +28,65 @@ #include "llviewerprecompiledheaders.h" #include "llfloaterreg.h" - #include "llviewerfloaterreg.h" -#include "llfloaterautoreplacesettings.h" + +#include "llcommandhandler.h" #include "llcompilequeue.h" #include "llfasttimerview.h" #include "llfloaterabout.h" #include "llfloaterauction.h" +#include "llfloaterautoreplacesettings.h" #include "llfloateravatar.h" #include "llfloateravatarpicker.h" #include "llfloateravatartextures.h" #include "llfloaterbeacons.h" #include "llfloaterbuildoptions.h" +#include "llfloaterbulkpermission.h" +#include "llfloaterbump.h" #include "llfloaterbuy.h" #include "llfloaterbuycontents.h" #include "llfloaterbuycurrency.h" #include "llfloaterbuycurrencyhtml.h" #include "llfloaterbuyland.h" -#include "llfloaterbulkpermission.h" -#include "llfloaterbump.h" #include "llfloaterbvhpreview.h" #include "llfloatercamera.h" #include "llfloaterchatvoicevolume.h" #include "llfloaterconversationlog.h" #include "llfloaterconversationpreview.h" #include "llfloaterdeleteenvpreset.h" +#include "llfloaterdestinations.h" #include "llfloaterdisplayname.h" #include "llfloatereditdaycycle.h" #include "llfloatereditsky.h" #include "llfloatereditwater.h" #include "llfloaterenvironmentsettings.h" #include "llfloaterevent.h" -#include "llfloaterdestinations.h" #include "llfloaterfonttest.h" #include "llfloatergesture.h" #include "llfloatergodtools.h" #include "llfloatergroups.h" #include "llfloaterhardwaresettings.h" #include "llfloaterhelpbrowser.h" -#include "llfloaterwebcontent.h" -#include "llfloaterwebprofile.h" -#include "llfloatermediasettings.h" #include "llfloaterhud.h" #include "llfloaterimagepreview.h" #include "llfloaterimsession.h" #include "llfloaterinspect.h" #include "llfloaterinventory.h" #include "llfloaterjoystick.h" -#include "llfloaterlagmeter.h" #include "llfloaterland.h" #include "llfloaterlandholdings.h" #include "llfloatermap.h" +#include "llfloatermediasettings.h" #include "llfloatermemleak.h" +#include "llfloatermodelpreview.h" #include "llfloaternamedesc.h" #include "llfloaternotificationsconsole.h" #include "llfloaterobjectweights.h" #include "llfloateropenobject.h" #include "llfloateroutbox.h" #include "llfloaterpathfindingcharacters.h" -#include "llfloaterpathfindinglinksets.h" #include "llfloaterpathfindingconsole.h" +#include "llfloaterpathfindinglinksets.h" #include "llfloaterpay.h" #include "llfloaterperms.h" #include "llfloaterpostprocess.h" @@ -97,6 +96,7 @@ #include "llfloaterregioninfo.h" #include "llfloaterregionrestarting.h" #include "llfloaterreporter.h" +#include "llfloatersceneloadstats.h" #include "llfloaterscriptdebug.h" #include "llfloaterscriptlimits.h" #include "llfloatersearch.h" @@ -112,12 +112,14 @@ #include "llfloatertestlistview.h" #include "llfloatertexturefetchdebugger.h" #include "llfloatertools.h" -#include "llfloatertos.h" #include "llfloatertopobjects.h" +#include "llfloatertos.h" #include "llfloatertoybox.h" #include "llfloatertranslationsettings.h" #include "llfloateruipreview.h" #include "llfloatervoiceeffect.h" +#include "llfloaterwebcontent.h" +#include "llfloaterwebprofile.h" #include "llfloatervoicevolume.h" #include "llfloaterwhitelistentry.h" #include "llfloaterwindowsize.h" @@ -138,10 +140,8 @@ #include "llpreviewscript.h" #include "llpreviewsound.h" #include "llpreviewtexture.h" -#include "llsyswellwindow.h" #include "llscriptfloater.h" -#include "llfloatermodelpreview.h" -#include "llcommandhandler.h" +#include "llsyswellwindow.h" // *NOTE: Please add files in alphabetical order to keep merges easy. @@ -174,7 +174,7 @@ void LLViewerFloaterReg::registerFloaters() // *NOTE: Please keep these alphabetized for easier merges LLFloaterAboutUtil::registerFloater(); - LLFloaterReg::add("fast_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFastTimerView>); + LLFloaterReg::add("block_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFastTimerView>); LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLand>); LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>); LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAuction>); @@ -233,7 +233,6 @@ void LLViewerFloaterReg::registerFloaters() LLNotificationsUI::registerFloater(); LLFloaterDisplayNameUtil::registerFloater(); - LLFloaterReg::add("lagmeter", "floater_lagmeter.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLagMeter>); LLFloaterReg::add("land_holdings", "floater_land_holdings.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLandHoldings>); LLFloaterReg::add("mem_leaking", "floater_mem_leaking.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterMemLeak>); @@ -309,6 +308,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("social", "floater_social.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSocial>); LLFloaterReg::add("stats", "floater_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloater>); LLFloaterReg::add("start_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterRunQueue>); + LLFloaterReg::add("scene_load_stats", "floater_scene_load_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSceneLoadStats>); LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>); LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>); LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>); diff --git a/indra/newview/llviewerfoldertype.cpp b/indra/newview/llviewerfoldertype.cpp index 991f6b40e64dccd3d626e4cf1e38d4aed09eb7dc..4237ffd2953488402f8f683770d21ec24bf43659 100644 --- a/indra/newview/llviewerfoldertype.cpp +++ b/indra/newview/llviewerfoldertype.cpp @@ -159,7 +159,7 @@ bool LLViewerFolderDictionary::initEnsemblesFromFile() LLXmlTree folder_def; if (!folder_def.parseFile(xml_filename)) { - llerrs << "Failed to parse folders file " << xml_filename << llendl; + LL_ERRS() << "Failed to parse folders file " << xml_filename << LL_ENDL; return false; } @@ -170,7 +170,7 @@ bool LLViewerFolderDictionary::initEnsemblesFromFile() { if (!ensemble->hasName("ensemble")) { - llwarns << "Invalid ensemble definition node " << ensemble->getName() << llendl; + LL_WARNS() << "Invalid ensemble definition node " << ensemble->getName() << LL_ENDL; continue; } @@ -178,14 +178,14 @@ bool LLViewerFolderDictionary::initEnsemblesFromFile() static LLStdStringHandle ensemble_num_string = LLXmlTree::addAttributeString("foldertype_num"); if (!ensemble->getFastAttributeS32(ensemble_num_string, ensemble_type)) { - llwarns << "No ensemble type defined" << llendl; + LL_WARNS() << "No ensemble type defined" << LL_ENDL; continue; } if (ensemble_type < S32(LLFolderType::FT_ENSEMBLE_START) || ensemble_type > S32(LLFolderType::FT_ENSEMBLE_END)) { - llwarns << "Exceeded maximum ensemble index" << LLFolderType::FT_ENSEMBLE_END << llendl; + LL_WARNS() << "Exceeded maximum ensemble index" << LLFolderType::FT_ENSEMBLE_END << LL_ENDL; break; } @@ -193,7 +193,7 @@ bool LLViewerFolderDictionary::initEnsemblesFromFile() static LLStdStringHandle xui_name_string = LLXmlTree::addAttributeString("xui_name"); if (!ensemble->getFastAttributeString(xui_name_string, xui_name)) { - llwarns << "No xui name defined" << llendl; + LL_WARNS() << "No xui name defined" << LL_ENDL; continue; } @@ -201,7 +201,7 @@ bool LLViewerFolderDictionary::initEnsemblesFromFile() static LLStdStringHandle icon_name_string = LLXmlTree::addAttributeString("icon_name"); if (!ensemble->getFastAttributeString(icon_name_string, icon_name)) { - llwarns << "No ensemble icon name defined" << llendl; + LL_WARNS() << "No ensemble icon name defined" << LL_ENDL; continue; } diff --git a/indra/newview/llviewergenericmessage.cpp b/indra/newview/llviewergenericmessage.cpp index f8a2be14d46ec5ac59bf4e4ab1d62e98b96ea4e4..3df53a4a306a5db21736c5e1b1443c68a7ca93d6 100755 --- a/indra/newview/llviewergenericmessage.cpp +++ b/indra/newview/llviewergenericmessage.cpp @@ -78,7 +78,7 @@ void process_generic_message(LLMessageSystem* msg, void**) msg->getUUID("AgentData", "AgentID", agent_id); if (agent_id != gAgent.getID()) { - llwarns << "GenericMessage for wrong agent" << llendl; + LL_WARNS() << "GenericMessage for wrong agent" << LL_ENDL; return; } @@ -89,7 +89,7 @@ void process_generic_message(LLMessageSystem* msg, void**) if(!gGenericDispatcher.dispatch(request, invoice, strings)) { - llwarns << "GenericMessage " << request << " failed to dispatch" - << llendl; + LL_WARNS() << "GenericMessage " << request << " failed to dispatch" + << LL_ENDL; } } diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index 3f35a5001d5387199ed5fe450bc1075a756a121b..f30279d1e924b42f32aec97d36ed0f46c1380aef 100755 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -194,13 +194,13 @@ void LLViewerGestureList::xferCallback(void *data, S32 size, void** /*user_data* if (end - buffer > size) { - llerrs << "Read off of end of array, error in serialization" << llendl; + LL_ERRS() << "Read off of end of array, error in serialization" << LL_ENDL; } gGestureList.mIsLoaded = TRUE; } else { - llwarns << "Unable to load gesture list!" << llendl; + LL_WARNS() << "Unable to load gesture list!" << LL_ENDL; } } diff --git a/indra/newview/llviewergesture.h b/indra/newview/llviewergesture.h index 8dba10226bb7f1907eec2c38e830a4ec799d355c..8b621850eadbfe1d79b7e00210965e9ce7740db5 100755 --- a/indra/newview/llviewergesture.h +++ b/indra/newview/llviewergesture.h @@ -30,7 +30,6 @@ #include "llanimationstates.h" #include "lluuid.h" #include "llstring.h" -#include "lldarray.h" #include "llgesture.h" class LLMessageSystem; diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index fff9821e86d0efa81fc939cd278529443f4be0b7..a4773646ef35d4c6e7ad193ba0a70ed7f161ff0f 100755 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -303,8 +303,8 @@ LLViewerInventoryItem::LLViewerInventoryItem(const LLViewerInventoryItem* other) copyViewerItem(other); if (!mIsComplete) { - llwarns << "LLViewerInventoryItem copy constructor for incomplete item" - << mUUID << llendl; + LL_WARNS() << "LLViewerInventoryItem copy constructor for incomplete item" + << mUUID << LL_ENDL; } } @@ -347,8 +347,8 @@ void LLViewerInventoryItem::cloneViewerItem(LLPointer<LLViewerInventoryItem>& ne void LLViewerInventoryItem::removeFromServer() { - lldebugs << "Removing inventory item " << mUUID << " from server." - << llendl; + LL_DEBUGS() << "Removing inventory item " << mUUID << " from server." + << LL_ENDL; LLInventoryModel::LLCategoryUpdate up(mParentUUID, -1); gInventory.accountForUpdate(up); @@ -369,15 +369,15 @@ void LLViewerInventoryItem::updateServer(BOOL is_new) const { // *FIX: deal with this better. // If we're crashing here then the UI is incorrectly enabled. - llerrs << "LLViewerInventoryItem::updateServer() - for incomplete item" - << llendl; + LL_ERRS() << "LLViewerInventoryItem::updateServer() - for incomplete item" + << LL_ENDL; return; } if(gAgent.getID() != mPermissions.getOwner()) { // *FIX: deal with this better. - llwarns << "LLViewerInventoryItem::updateServer() - for unowned item" - << llendl; + LL_WARNS() << "LLViewerInventoryItem::updateServer() - for unowned item" + << LL_ENDL; return; } LLInventoryModel::LLCategoryUpdate up(mParentUUID, is_new ? 1 : 0); @@ -416,7 +416,7 @@ void LLViewerInventoryItem::fetchFromServer(void) const } else { - llwarns << "Agent Region is absent" << llendl; + LL_WARNS() << "Agent Region is absent" << LL_ENDL; } if (!url.empty()) @@ -639,8 +639,8 @@ void LLViewerInventoryCategory::updateServer(BOOL is_new) const void LLViewerInventoryCategory::removeFromServer( void ) { - llinfos << "Removing inventory category " << mUUID << " from server." - << llendl; + LL_INFOS() << "Removing inventory category " << mUUID << " from server." + << LL_ENDL; // communicate that change with the server. if(LLFolderType::lookupIsProtectedType(mPreferredType)) { @@ -701,7 +701,7 @@ bool LLViewerInventoryCategory::fetch() } else { - llwarns << "agent region is null" << llendl; + LL_WARNS() << "agent region is null" << LL_ENDL; } if (!url.empty()) //Capability found. Build up LLSD and use it. { @@ -709,7 +709,7 @@ bool LLViewerInventoryCategory::fetch() } else { //Deprecated, but if we don't have a capability, use the old system. - llinfos << "FetchInventoryDescendents2 capability not found. Using deprecated UDP message." << llendl; + LL_INFOS() << "FetchInventoryDescendents2 capability not found. Using deprecated UDP message." << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessage("FetchInventoryDescendents"); msg->nextBlock("AgentData"); @@ -791,8 +791,8 @@ bool LLViewerInventoryCategory::importFileLocal(LLFILE* fp) } else { - llwarns << "unknown keyword '" << keyword - << "' in inventory import category " << mUUID << llendl; + LL_WARNS() << "unknown keyword '" << keyword + << "' in inventory import category " << mUUID << LL_ENDL; } } return true; @@ -905,7 +905,7 @@ LLInventoryCallbackManager::LLInventoryCallbackManager() : { if( sInstance != NULL ) { - llwarns << "LLInventoryCallbackManager::LLInventoryCallbackManager: unexpected multiple instances" << llendl; + LL_WARNS() << "LLInventoryCallbackManager::LLInventoryCallbackManager: unexpected multiple instances" << LL_ENDL; return; } sInstance = this; @@ -915,7 +915,7 @@ LLInventoryCallbackManager::~LLInventoryCallbackManager() { if( sInstance != this ) { - llwarns << "LLInventoryCallbackManager::~LLInventoryCallbackManager: unexpected multiple instances" << llendl; + LL_WARNS() << "LLInventoryCallbackManager::~LLInventoryCallbackManager: unexpected multiple instances" << LL_ENDL; return; } sInstance = NULL; @@ -1099,12 +1099,12 @@ void link_inventory_item( const LLInventoryObject *baseobj = gInventory.getObject(item_id); if (!baseobj) { - llwarns << "attempt to link to unknown item, linked-to-item's itemID " << item_id << llendl; + LL_WARNS() << "attempt to link to unknown item, linked-to-item's itemID " << item_id << LL_ENDL; return; } if (baseobj && baseobj->getIsLinkType()) { - llwarns << "attempt to create a link to a link, linked-to-item's itemID " << item_id << llendl; + LL_WARNS() << "attempt to create a link to a link, linked-to-item's itemID " << item_id << LL_ENDL; return; } @@ -1113,7 +1113,7 @@ void link_inventory_item( // Fail if item can be found but is of a type that can't be linked. // Arguably should fail if the item can't be found too, but that could // be a larger behavioral change. - llwarns << "attempt to link an unlinkable item, type = " << baseobj->getActualType() << llendl; + LL_WARNS() << "attempt to link an unlinkable item, type = " << baseobj->getActualType() << LL_ENDL; return; } @@ -1134,7 +1134,7 @@ void link_inventory_item( #if 1 // debugging stuff LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id); - lldebugs << "cat: " << cat << llendl; + LL_DEBUGS() << "cat: " << cat << LL_ENDL; #endif LLMessageSystem* msg = gMessageSystem; @@ -1347,7 +1347,7 @@ void menu_create_inventory_item(LLInventoryPanel* panel, LLFolderBridge *bridge, } else { - llwarns << "Can't create unrecognized type " << type_name << llendl; + LL_WARNS() << "Can't create unrecognized type " << type_name << LL_ENDL; } } panel->getRootFolder()->setNeedsAutoRename(TRUE); @@ -1582,7 +1582,7 @@ LLViewerInventoryItem *LLViewerInventoryItem::getLinkedItem() const LLViewerInventoryItem *linked_item = gInventory.getItem(mAssetUUID); if (linked_item && linked_item->getIsLinkType()) { - llwarns << "Warning: Accessing link to link" << llendl; + LL_WARNS() << "Warning: Accessing link to link" << LL_ENDL; return NULL; } return linked_item; diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index ab19a12014f7948484c0c5f298facc4f2e28352f..a10eda947d823e55199db451e16859bf31012329 100755 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -49,7 +49,7 @@ class LLViewerInventoryCategory; class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::trackable { public: - typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t; + typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t; protected: ~LLViewerInventoryItem( void ); // ref counted @@ -181,7 +181,7 @@ class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::tr class LLViewerInventoryCategory : public LLInventoryCategory { public: - typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t; + typedef std::vector<LLPointer<LLViewerInventoryCategory> > cat_array_t; protected: ~LLViewerInventoryCategory(); diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp index 3a04bbed4f9d0209113b0ce3adb2a04cc40e00a3..888decd3bedebbed0717c70bec84bb8723814eb8 100755 --- a/indra/newview/llviewerjointattachment.cpp +++ b/indra/newview/llviewerjointattachment.cpp @@ -28,7 +28,6 @@ #include "llviewerjointattachment.h" -#include "llagentconstants.h" #include "llviewercontrol.h" #include "lldrawable.h" #include "llgl.h" @@ -46,6 +45,7 @@ #include "llglheaders.h" extern LLPipeline gPipeline; +const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters? //----------------------------------------------------------------------------- // LLViewerJointAttachment() @@ -171,7 +171,7 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) // Same object reattached if (isObjectAttached(object)) { - llinfos << "(same object re-attached)" << llendl; + LL_INFOS() << "(same object re-attached)" << LL_ENDL; removeObject(object); // Pass through anyway to let setupDrawable() // re-connect object to the joint correctly @@ -181,7 +181,7 @@ BOOL LLViewerJointAttachment::addObject(LLViewerObject* object) // Request detach, and kill the object in the meantime. if (getAttachedObject(object->getAttachmentItemID())) { - llinfos << "(same object re-attached)" << llendl; + LL_INFOS() << "(same object re-attached)" << LL_ENDL; object->markDead(); // If this happens to be attached to self, then detach. @@ -233,7 +233,7 @@ void LLViewerJointAttachment::removeObject(LLViewerObject *object) } if (iter == mAttachedObjects.end()) { - llwarns << "Could not find object to detach" << llendl; + LL_WARNS() << "Could not find object to detach" << LL_ENDL; return; } diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 64454a03d1a7e4b5bb92617eb60b0e69a054859c..bf7cf08c6364221e94b1f31ae5db841a2ee0e2d5 100755 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -29,7 +29,6 @@ //----------------------------------------------------------------------------- #include "llviewerprecompiledheaders.h" -#include "imageids.h" #include "llfasttimer.h" #include "llrender.h" @@ -116,7 +115,7 @@ void LLViewerJointMesh::uploadJointMatrices() BOOL hardware_skinning = (poolp && poolp->getVertexShaderLevel() > 0) ? TRUE : FALSE; //calculate joint matrices - for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); joint_num++) + for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++) { LLMatrix4 joint_mat = *reference_mesh->mJointRenderData[joint_num]->mWorldMatrix; @@ -132,7 +131,7 @@ void LLViewerJointMesh::uploadJointMatrices() S32 j = 0; //upload joint pivots - for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); joint_num++) + for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++) { LLSkinJoint *sj = reference_mesh->mJointRenderData[joint_num]->mSkinJoint; if (sj) @@ -172,7 +171,7 @@ void LLViewerJointMesh::uploadJointMatrices() GLfloat mat[45*4]; memset(mat, 0, sizeof(GLfloat)*45*4); - for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); joint_num++) + for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); joint_num++) { gJointMatUnaligned[joint_num].transpose(); @@ -193,7 +192,7 @@ void LLViewerJointMesh::uploadJointMatrices() else { //load gJointMatUnaligned into gJointMatAligned - for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.count(); ++joint_num) + for (joint_num = 0; joint_num < reference_mesh->mJointRenderData.size(); ++joint_num) { gJointMatAligned[joint_num].loadu(gJointMatUnaligned[joint_num]); } @@ -377,7 +376,7 @@ void LLViewerJointMesh::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 //----------------------------------------------------------------------------- // updateFaceData() //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_AVATAR_FACE("Avatar Face"); +static LLTrace::BlockTimerStatHandle FTM_AVATAR_FACE("Avatar Face"); void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update) { @@ -400,7 +399,7 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w } - LLFastTimer t(FTM_AVATAR_FACE); + LL_RECORD_BLOCK_TIME(FTM_AVATAR_FACE); LLStrider<LLVector3> verticesp; LLStrider<LLVector3> normalsp; @@ -552,7 +551,7 @@ void LLViewerJointMesh::dump() { if (mValid) { - llinfos << "Usable LOD " << mName << llendl; + LL_INFOS() << "Usable LOD " << mName << LL_ENDL; } } diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index aeeb591d55f31d33bcb863133970567defed02b2..e44d80b7ceab33405c2bdbbc52c6cb9ffdea8ce3 100755 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -107,7 +107,7 @@ NDOF_HotPlugResult LLViewerJoystick::HotPlugAddCallback(NDOF_Device *dev) LLViewerJoystick* joystick(LLViewerJoystick::getInstance()); if (joystick->mDriverState == JDS_UNINITIALIZED) { - llinfos << "HotPlugAddCallback: will use device:" << llendl; + LL_INFOS() << "HotPlugAddCallback: will use device:" << LL_ENDL; ndof_dump(dev); joystick->mNdofDev = dev; joystick->mDriverState = JDS_INITIALIZED; @@ -125,8 +125,8 @@ void LLViewerJoystick::HotPlugRemovalCallback(NDOF_Device *dev) LLViewerJoystick* joystick(LLViewerJoystick::getInstance()); if (joystick->mNdofDev == dev) { - llinfos << "HotPlugRemovalCallback: joystick->mNdofDev=" - << joystick->mNdofDev << "; removed device:" << llendl; + LL_INFOS() << "HotPlugRemovalCallback: joystick->mNdofDev=" + << joystick->mNdofDev << "; removed device:" << LL_ENDL; ndof_dump(dev); joystick->mDriverState = JDS_UNINITIALIZED; } @@ -215,7 +215,7 @@ void LLViewerJoystick::init(bool autoenable) if (ndof_init_first(mNdofDev, NULL)) { mDriverState = JDS_UNINITIALIZED; - llwarns << "ndof_init_first FAILED" << llendl; + LL_WARNS() << "ndof_init_first FAILED" << LL_ENDL; } else { @@ -259,8 +259,8 @@ void LLViewerJoystick::init(bool autoenable) // No device connected, don't change any settings } - llinfos << "ndof: mDriverState=" << mDriverState << "; mNdofDev=" - << mNdofDev << "; libinit=" << libinit << llendl; + LL_INFOS() << "ndof: mDriverState=" << mDriverState << "; mNdofDev=" + << mNdofDev << "; libinit=" << libinit << LL_ENDL; #endif } @@ -270,7 +270,7 @@ void LLViewerJoystick::terminate() #if LIB_NDOF ndof_libcleanup(); - llinfos << "Terminated connection with NDOF device." << llendl; + LL_INFOS() << "Terminated connection with NDOF device." << LL_ENDL; mDriverState = JDS_UNINITIALIZED; #endif } @@ -501,7 +501,7 @@ void LLViewerJoystick::moveObjects(bool reset) }; F32 cur_delta[6]; - F32 time = gFrameIntervalSeconds; + F32 time = gFrameIntervalSeconds.value(); // avoid making ridicously big movements if there's a big drop in fps if (time > .2f) @@ -665,7 +665,7 @@ void LLViewerJoystick::moveAvatar(bool reset) }; // time interval in seconds between this frame and the previous - F32 time = gFrameIntervalSeconds; + F32 time = gFrameIntervalSeconds.value(); // avoid making ridicously big movements if there's a big drop in fps if (time > .2f) @@ -878,7 +878,7 @@ void LLViewerJoystick::moveFlycam(bool reset) gSavedSettings.getF32("FlycamAxisDeadZone6") }; - F32 time = gFrameIntervalSeconds; + F32 time = gFrameIntervalSeconds.value(); // avoid making ridiculously big movements if there's a big drop in fps if (time > .2f) @@ -1101,7 +1101,7 @@ void LLViewerJoystick::setSNDefaults() #endif //gViewerWindow->alertXml("CacheWillClear"); - llinfos << "restoring SpaceNavigator defaults..." << llendl; + LL_INFOS() << "restoring SpaceNavigator defaults..." << LL_ENDL; gSavedSettings.setS32("JoystickAxis0", 1); // z (at) gSavedSettings.setS32("JoystickAxis1", 0); // x (slide) diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index aa9de076b87f46adee7fa15fae458fe0b90528eb..160478788cb487bbec56adebfd627831cc7e0d5a 100755 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -146,9 +146,11 @@ void agent_push_forward( EKeystate s ) if (LLFloaterCamera::inFreeCameraMode()) { camera_move_forward(s); - return; } - agent_push_forwardbackward(s, 1, LLAgent::DOUBLETAP_FORWARD); + else + { + agent_push_forwardbackward(s, 1, LLAgent::DOUBLETAP_FORWARD); + } } void camera_move_backward( EKeystate s ); @@ -159,9 +161,15 @@ void agent_push_backward( EKeystate s ) if (LLFloaterCamera::inFreeCameraMode()) { camera_move_backward(s); - return; } - agent_push_forwardbackward(s, -1, LLAgent::DOUBLETAP_BACKWARD); + else if (!gAgent.backwardGrabbed() && gAgentAvatarp->isSitting()) + { + gAgentCamera.changeCameraToThirdPerson(); + } + else + { + agent_push_forwardbackward(s, -1, LLAgent::DOUBLETAP_BACKWARD); + } } static void agent_slide_leftright( EKeystate s, S32 direction, LLAgent::EDoubleTapRunMode mode ) @@ -269,7 +277,7 @@ F32 get_orbit_rate() if( time < NUDGE_TIME ) { F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME; - //llinfos << rate << llendl; + //LL_INFOS() << rate << LL_ENDL; return rate; } else @@ -676,7 +684,7 @@ BOOL LLViewerKeyboard::handleKey(KEY translated_key, MASK translated_mask, BOOL return FALSE; } - lldebugst(LLERR_USER_INPUT) << "keydown -" << translated_key << "-" << llendl; + LL_DEBUGS("UserInput") << "keydown -" << translated_key << "-" << LL_ENDL; // skip skipped keys if(mKeysSkippedByUI.find(translated_key) != mKeysSkippedByUI.end()) { @@ -733,7 +741,7 @@ BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, c if (!function) { - llerrs << "Can't bind key to function " << function_name << ", no function with this name found" << llendl; + LL_ERRS() << "Can't bind key to function " << function_name << ", no function with this name found" << LL_ENDL; return FALSE; } @@ -746,13 +754,13 @@ BOOL LLViewerKeyboard::bindKey(const S32 mode, const KEY key, const MASK mask, c if (index >= MAX_KEY_BINDINGS) { - llerrs << "LLKeyboard::bindKey() - too many keys for mode " << mode << llendl; + LL_ERRS() << "LLKeyboard::bindKey() - too many keys for mode " << mode << LL_ENDL; return FALSE; } if (mode >= MODE_COUNT) { - llerror("LLKeyboard::bindKey() - unknown mode passed", mode); + LL_ERRS() << "LLKeyboard::bindKey() - unknown mode passed" << mode << LL_ENDL; return FALSE; } @@ -841,7 +849,7 @@ S32 LLViewerKeyboard::loadBindings(const std::string& filename) if(filename.empty()) { - llerrs << " No filename specified" << llendl; + LL_ERRS() << " No filename specified" << LL_ENDL; return 0; } @@ -873,35 +881,35 @@ S32 LLViewerKeyboard::loadBindings(const std::string& filename) if (tokens_read == EOF) { - llinfos << "Unexpected end-of-file at line " << line_count << " of key binding file " << filename << llendl; + LL_INFOS() << "Unexpected end-of-file at line " << line_count << " of key binding file " << filename << LL_ENDL; fclose(fp); return 0; } else if (tokens_read < 4) { - llinfos << "Can't read line " << line_count << " of key binding file " << filename << llendl; + LL_INFOS() << "Can't read line " << line_count << " of key binding file " << filename << LL_ENDL; continue; } // convert mode if (!modeFromString(mode_string, &mode)) { - llinfos << "Unknown mode on line " << line_count << " of key binding file " << filename << llendl; - llinfos << "Mode must be one of FIRST_PERSON, THIRD_PERSON, EDIT, EDIT_AVATAR" << llendl; + LL_INFOS() << "Unknown mode on line " << line_count << " of key binding file " << filename << LL_ENDL; + LL_INFOS() << "Mode must be one of FIRST_PERSON, THIRD_PERSON, EDIT, EDIT_AVATAR" << LL_ENDL; continue; } // convert key if (!LLKeyboard::keyFromString(key_string, &key)) { - llinfos << "Can't interpret key on line " << line_count << " of key binding file " << filename << llendl; + LL_INFOS() << "Can't interpret key on line " << line_count << " of key binding file " << filename << LL_ENDL; continue; } // convert mask if (!LLKeyboard::maskFromString(mask_string, &mask)) { - llinfos << "Can't interpret mask on line " << line_count << " of key binding file " << filename << llendl; + LL_INFOS() << "Can't interpret mask on line " << line_count << " of key binding file " << filename << LL_ENDL; continue; } diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 2c132740fee8310e7023096ca3f4cafe5e415bbc..a4e3c8cdbdd4bfcd99817a9c4f3a6bfb64e67e1c 100755 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -165,7 +165,7 @@ LOG_CLASS(LLMimeDiscoveryResponder); { if(mMediaImpl->mMimeTypeProbe != NULL) { - llerrs << "impl already has an outstanding responder" << llendl; + LL_ERRS() << "impl already has an outstanding responder" << LL_ENDL; } mMediaImpl->mMimeTypeProbe = this; @@ -182,7 +182,7 @@ LOG_CLASS(LLMimeDiscoveryResponder); std::string::size_type idx1 = media_type.find_first_of(";"); std::string mime_type = media_type.substr(0, idx1); - lldebugs << "status is " << status << ", media type \"" << media_type << "\"" << llendl; + LL_DEBUGS() << "status is " << status << ", media type \"" << media_type << "\"" << LL_ENDL; // 2xx status codes indicate success. // Most 4xx status codes are successful enough for our purposes. @@ -213,7 +213,7 @@ LOG_CLASS(LLMimeDiscoveryResponder); } else { - llwarns << "responder failed with status " << status << ", reason " << reason << llendl; + LL_WARNS() << "responder failed with status " << status << ", reason " << reason << LL_ENDL; if(mMediaImpl) { @@ -252,7 +252,7 @@ LOG_CLASS(LLMimeDiscoveryResponder); { if(mMediaImpl->mMimeTypeProbe != this) { - llerrs << "internal error: mMediaImpl->mMimeTypeProbe != this" << llendl; + LL_ERRS() << "internal error: mMediaImpl->mMimeTypeProbe != this" << LL_ENDL; } mMediaImpl->mMimeTypeProbe = NULL; @@ -428,10 +428,10 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s // Try to find media with the same media ID viewer_media_t media_impl = getMediaImplFromTextureID(media_entry->getMediaID()); - lldebugs << "called, current URL is \"" << media_entry->getCurrentURL() + LL_DEBUGS() << "called, current URL is \"" << media_entry->getCurrentURL() << "\", previous URL is \"" << previous_url << "\", update_from_self is " << (update_from_self?"true":"false") - << llendl; + << LL_ENDL; bool was_loaded = false; bool needs_navigate = false; @@ -463,7 +463,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s // The current media URL is now empty. Unload the media source. media_impl->unload(); - lldebugs << "Unloading media instance (new current URL is empty)." << llendl; + LL_DEBUGS() << "Unloading media instance (new current URL is empty)." << LL_ENDL; } } else @@ -477,9 +477,9 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s needs_navigate = url_changed; } - lldebugs << "was_loaded is " << (was_loaded?"true":"false") + LL_DEBUGS() << "was_loaded is " << (was_loaded?"true":"false") << ", auto_play is " << (auto_play?"true":"false") - << ", needs_navigate is " << (needs_navigate?"true":"false") << llendl; + << ", needs_navigate is " << (needs_navigate?"true":"false") << LL_ENDL; } } else @@ -505,7 +505,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s if(needs_navigate) { media_impl->navigateTo(media_impl->mMediaEntryURL, "", true, true); - lldebugs << "navigating to URL " << media_impl->mMediaEntryURL << llendl; + LL_DEBUGS() << "navigating to URL " << media_impl->mMediaEntryURL << LL_ENDL; } else if(!media_impl->mMediaURL.empty() && (media_impl->mMediaURL != media_impl->mMediaEntryURL)) { @@ -515,7 +515,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s // If this causes a navigate at some point (such as after a reload), it should be considered server-driven so it isn't broadcast. media_impl->mNavigateServerRequest = true; - lldebugs << "updating URL in the media impl to " << media_impl->mMediaEntryURL << llendl; + LL_DEBUGS() << "updating URL in the media impl to " << media_impl->mMediaEntryURL << LL_ENDL; } } @@ -560,7 +560,7 @@ std::string LLViewerMedia::getCurrentUserAgent() codec << "SecondLife/"; codec << LLVersionInfo::getVersion(); codec << " (" << channel << "; " << skin_name << " skin)"; - llinfos << codec.str() << llendl; + LL_INFOS() << codec.str() << LL_ENDL; return codec.str(); } @@ -677,7 +677,7 @@ bool LLViewerMedia::isInterestingEnough(const LLVOVolume *object, const F64 &obj } else { - lldebugs << "object interest = " << object_interest << ", lowest loadable = " << sLowestLoadableImplInterest << llendl; + LL_DEBUGS() << "object interest = " << object_interest << ", lowest loadable = " << sLowestLoadableImplInterest << LL_ENDL; if(object_interest >= sLowestLoadableImplInterest) result = true; } @@ -775,19 +775,19 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi } } -static LLFastTimer::DeclareTimer FTM_MEDIA_UPDATE("Update Media"); -static LLFastTimer::DeclareTimer FTM_MEDIA_SPARE_IDLE("Spare Idle"); -static LLFastTimer::DeclareTimer FTM_MEDIA_UPDATE_INTEREST("Update/Interest"); -static LLFastTimer::DeclareTimer FTM_MEDIA_SORT("Sort"); -static LLFastTimer::DeclareTimer FTM_MEDIA_SORT2("Sort 2"); -static LLFastTimer::DeclareTimer FTM_MEDIA_MISC("Misc"); +static LLTrace::BlockTimerStatHandle FTM_MEDIA_UPDATE("Update Media"); +static LLTrace::BlockTimerStatHandle FTM_MEDIA_SPARE_IDLE("Spare Idle"); +static LLTrace::BlockTimerStatHandle FTM_MEDIA_UPDATE_INTEREST("Update/Interest"); +static LLTrace::BlockTimerStatHandle FTM_MEDIA_SORT("Media Sort"); +static LLTrace::BlockTimerStatHandle FTM_MEDIA_SORT2("Media Sort 2"); +static LLTrace::BlockTimerStatHandle FTM_MEDIA_MISC("Misc"); ////////////////////////////////////////////////////////////////////////////////////////// // static void LLViewerMedia::updateMedia(void *dummy_arg) { - LLFastTimer t1(FTM_MEDIA_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_MEDIA_UPDATE); // Enable/disable the plugin read thread LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread")); @@ -799,15 +799,15 @@ void LLViewerMedia::updateMedia(void *dummy_arg) sUpdatedCookies = getCookieStore()->getChangedCookies(); if(!sUpdatedCookies.empty()) { - lldebugs << "updated cookies will be sent to all loaded plugins: " << llendl; - lldebugs << sUpdatedCookies << llendl; + LL_DEBUGS() << "updated cookies will be sent to all loaded plugins: " << LL_ENDL; + LL_DEBUGS() << sUpdatedCookies << LL_ENDL; } impl_list::iterator iter = sViewerMediaImplList.begin(); impl_list::iterator end = sViewerMediaImplList.end(); { - LLFastTimer t(FTM_MEDIA_UPDATE_INTEREST); + LL_RECORD_BLOCK_TIME(FTM_MEDIA_UPDATE_INTEREST); for(; iter != end;) { LLViewerMediaImpl* pimpl = *iter++; @@ -819,12 +819,12 @@ void LLViewerMedia::updateMedia(void *dummy_arg) // Let the spare media source actually launch if(sSpareBrowserMediaSource) { - LLFastTimer t(FTM_MEDIA_SPARE_IDLE); + LL_RECORD_BLOCK_TIME(FTM_MEDIA_SPARE_IDLE); sSpareBrowserMediaSource->idle(); } { - LLFastTimer t(FTM_MEDIA_SORT); + LL_RECORD_BLOCK_TIME(FTM_MEDIA_SORT); // Sort the static instance list using our interest criteria sViewerMediaImplList.sort(priorityComparitor); } @@ -856,7 +856,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg) // If max_normal + max_low is less than max_instances, things will tend to get unloaded instead of being set to slideshow. { - LLFastTimer t(FTM_MEDIA_MISC); + LL_RECORD_BLOCK_TIME(FTM_MEDIA_MISC); for(; iter != end; iter++) { LLViewerMediaImpl* pimpl = *iter; @@ -1024,7 +1024,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg) } else { - LLFastTimer t(FTM_MEDIA_SORT2); + LL_RECORD_BLOCK_TIME(FTM_MEDIA_SORT2); // Use a distance-based sort for proximity values. std::stable_sort(proximity_order.begin(), proximity_order.end(), proximity_comparitor); } @@ -1035,7 +1035,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg) proximity_order[i]->mProximity = i; } - LL_DEBUGS("PluginPriority") << "Total reported CPU usage is " << total_cpu << llendl; + LL_DEBUGS("PluginPriority") << "Total reported CPU usage is " << total_cpu << LL_ENDL; } @@ -1170,14 +1170,14 @@ void LLViewerMedia::clearAllCookies() std::string target; std::string filename; - lldebugs << "base dir = " << base_dir << llendl; + LL_DEBUGS() << "base dir = " << base_dir << LL_ENDL; // The non-logged-in version is easy target = base_dir; target += "browser_profile"; target += gDirUtilp->getDirDelimiter(); target += "cookies"; - lldebugs << "target = " << target << llendl; + LL_DEBUGS() << "target = " << target << LL_ENDL; if(LLFile::isfile(target)) { LLFile::remove(target); @@ -1190,7 +1190,7 @@ void LLViewerMedia::clearAllCookies() target = gDirUtilp->add(base_dir, filename); gDirUtilp->append(target, "browser_profile"); gDirUtilp->append(target, "cookies"); - lldebugs << "target = " << target << llendl; + LL_DEBUGS() << "target = " << target << LL_ENDL; if(LLFile::isfile(target)) { LLFile::remove(target); @@ -1199,7 +1199,7 @@ void LLViewerMedia::clearAllCookies() // Other accounts may have new-style cookie files too -- delete them as well target = gDirUtilp->add(base_dir, filename); gDirUtilp->append(target, PLUGIN_COOKIE_FILE_NAME); - lldebugs << "target = " << target << llendl; + LL_DEBUGS() << "target = " << target << LL_ENDL; if(LLFile::isfile(target)) { LLFile::remove(target); @@ -1281,7 +1281,7 @@ void LLViewerMedia::loadCookieFile() if (resolved_filename.empty()) { - llinfos << "can't get path to plugin cookie file - probably not logged in yet." << llendl; + LL_INFOS() << "can't get path to plugin cookie file - probably not logged in yet." << LL_ENDL; return; } @@ -1289,7 +1289,7 @@ void LLViewerMedia::loadCookieFile() llifstream file(resolved_filename); if (!file.is_open()) { - llwarns << "can't load plugin cookies from file \"" << PLUGIN_COOKIE_FILE_NAME << "\"" << llendl; + LL_WARNS() << "can't load plugin cookies from file \"" << PLUGIN_COOKIE_FILE_NAME << "\"" << LL_ENDL; return; } @@ -1323,7 +1323,7 @@ void LLViewerMedia::saveCookieFile() if (resolved_filename.empty()) { - llinfos << "can't get path to plugin cookie file - probably not logged in yet." << llendl; + LL_INFOS() << "can't get path to plugin cookie file - probably not logged in yet." << LL_ENDL; return; } @@ -1331,7 +1331,7 @@ void LLViewerMedia::saveCookieFile() llofstream file (resolved_filename); if (!file.is_open()) { - llwarns << "can't open plugin cookie file \"" << PLUGIN_COOKIE_FILE_NAME << "\" for writing" << llendl; + LL_WARNS() << "can't open plugin cookie file \"" << PLUGIN_COOKIE_FILE_NAME << "\" for writing" << LL_ENDL; return; } @@ -1434,8 +1434,8 @@ void LLViewerMedia::setOpenIDCookie() std::string profile_url = getProfileURL(""); LLURL raw_profile_url( profile_url.c_str() ); - LL_DEBUGS("MediaAuth") << "Requesting " << profile_url << llendl; - LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << llendl; + LL_DEBUGS("MediaAuth") << "Requesting " << profile_url << LL_ENDL; + LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << LL_ENDL; LLHTTPClient::get(profile_url, new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()), headers); @@ -1954,7 +1954,7 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) // Due to the ordering of messages, it's possible we wouldn't get that information back in time to send cookies before sending a navigate message, // which could cause odd race conditions. std::string all_cookies = LLViewerMedia::getCookieStore()->getAllCookies(); - lldebugs << "setting cookies: " << all_cookies << llendl; + LL_DEBUGS() << "setting cookies: " << all_cookies << LL_ENDL; if(!all_cookies.empty()) { media_source->set_cookies(all_cookies); @@ -2000,7 +2000,7 @@ void LLViewerMediaImpl::loadURI() // Do not log the query parts LLURI u(uri); std::string sanitized_uri = (u.query().empty() ? uri : u.scheme() + "://" + u.authority() + u.path()); - llinfos << "Asking media source to load URI: " << sanitized_uri << llendl; + LL_INFOS() << "Asking media source to load URI: " << sanitized_uri << LL_ENDL; } mMediaSource->loadURI( uri ); @@ -2273,7 +2273,7 @@ void LLViewerMediaImpl::mouseDown(S32 x, S32 y, MASK mask, S32 button) scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; -// llinfos << "mouse down (" << x << ", " << y << ")" << llendl; +// LL_INFOS() << "mouse down (" << x << ", " << y << ")" << LL_ENDL; if (mMediaSource) { mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, button, x, y, mask); @@ -2286,7 +2286,7 @@ void LLViewerMediaImpl::mouseUp(S32 x, S32 y, MASK mask, S32 button) scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; -// llinfos << "mouse up (" << x << ", " << y << ")" << llendl; +// LL_INFOS() << "mouse up (" << x << ", " << y << ")" << LL_ENDL; if (mMediaSource) { mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, button, x, y, mask); @@ -2299,7 +2299,7 @@ void LLViewerMediaImpl::mouseMove(S32 x, S32 y, MASK mask) scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; -// llinfos << "mouse move (" << x << ", " << y << ")" << llendl; +// LL_INFOS() << "mouse move (" << x << ", " << y << ")" << LL_ENDL; if (mMediaSource) { mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, 0, x, y, mask); @@ -2572,7 +2572,7 @@ void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mi // Do not log the query parts LLURI u(url); std::string sanitized_url = (u.query().empty() ? url : u.scheme() + "://" + u.authority() + u.path()); - llinfos << "NOT LOADING media id= " << mTextureId << " url=" << sanitized_url << ", mime_type=" << mime_type << llendl; + LL_INFOS() << "NOT LOADING media id= " << mTextureId << " url=" << sanitized_url << ", mime_type=" << mime_type << LL_ENDL; } // This impl should not be loaded at this time. @@ -2592,19 +2592,19 @@ void LLViewerMediaImpl::navigateInternal() // Do not log the query parts LLURI u(mMediaURL); std::string sanitized_url = (u.query().empty() ? mMediaURL : u.scheme() + "://" + u.authority() + u.path()); - llinfos << "media id= " << mTextureId << " url=" << sanitized_url << ", mime_type=" << mMimeType << llendl; + LL_INFOS() << "media id= " << mTextureId << " url=" << sanitized_url << ", mime_type=" << mMimeType << LL_ENDL; } if(mNavigateSuspended) { - llwarns << "Deferring navigate." << llendl; + LL_WARNS() << "Deferring navigate." << LL_ENDL; mNavigateSuspendedDeferred = true; return; } if(mMimeTypeProbe != NULL) { - llwarns << "MIME type probe already in progress -- bailing out." << llendl; + LL_WARNS() << "MIME type probe already in progress -- bailing out." << LL_ENDL; return; } @@ -2757,14 +2757,14 @@ bool LLViewerMediaImpl::canNavigateBack() } ////////////////////////////////////////////////////////////////////////////////////////// -static LLFastTimer::DeclareTimer FTM_MEDIA_DO_UPDATE("Do Update"); -static LLFastTimer::DeclareTimer FTM_MEDIA_GET_DATA("Get Data"); -static LLFastTimer::DeclareTimer FTM_MEDIA_SET_SUBIMAGE("Set Subimage"); +static LLTrace::BlockTimerStatHandle FTM_MEDIA_DO_UPDATE("Do Update"); +static LLTrace::BlockTimerStatHandle FTM_MEDIA_GET_DATA("Get Data"); +static LLTrace::BlockTimerStatHandle FTM_MEDIA_SET_SUBIMAGE("Set Subimage"); void LLViewerMediaImpl::update() { - LLFastTimer t(FTM_MEDIA_DO_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_MEDIA_DO_UPDATE); if(mMediaSource == NULL) { if(mPriority == LLPluginClassMedia::PRIORITY_UNLOADED) @@ -2866,7 +2866,7 @@ void LLViewerMediaImpl::update() U8* data = NULL; { - LLFastTimer t(FTM_MEDIA_GET_DATA); + LL_RECORD_BLOCK_TIME(FTM_MEDIA_GET_DATA); data = mMediaSource->getBitsData(); } @@ -2875,7 +2875,7 @@ void LLViewerMediaImpl::update() data += ( y_pos * mMediaSource->getTextureDepth() ); { - LLFastTimer t(FTM_MEDIA_SET_SUBIMAGE); + LL_RECORD_BLOCK_TIME(FTM_MEDIA_SET_SUBIMAGE); placeholder_image->setSubImage( data, mMediaSource->getBitsWidth(), @@ -3324,7 +3324,7 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla { std::string uuid = plugin->getClickUUID(); - llinfos << "MEDIA_EVENT_CLOSE_REQUEST for uuid " << uuid << llendl; + LL_INFOS() << "MEDIA_EVENT_CLOSE_REQUEST for uuid " << uuid << LL_ENDL; if(uuid.empty()) { @@ -3343,7 +3343,7 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla { std::string uuid = plugin->getClickUUID(); - llinfos << "MEDIA_EVENT_GEOMETRY_CHANGE for uuid " << uuid << llendl; + LL_INFOS() << "MEDIA_EVENT_GEOMETRY_CHANGE for uuid " << uuid << LL_ENDL; if(uuid.empty()) { @@ -3446,11 +3446,11 @@ BOOL LLViewerMediaImpl::isUpdated() return mIsUpdated ; } -static LLFastTimer::DeclareTimer FTM_MEDIA_CALCULATE_INTEREST("Calculate Interest"); +static LLTrace::BlockTimerStatHandle FTM_MEDIA_CALCULATE_INTEREST("Calculate Interest"); void LLViewerMediaImpl::calculateInterest() { - LLFastTimer t(FTM_MEDIA_CALCULATE_INTEREST); + LL_RECORD_BLOCK_TIME(FTM_MEDIA_CALCULATE_INTEREST); LLViewerMediaTexture* texture = LLViewerTextureManager::findMediaTexture( mTextureId ); if(texture != NULL) @@ -3633,16 +3633,16 @@ void LLViewerMediaImpl::setNavState(EMediaNavState state) switch (state) { - case MEDIANAVSTATE_NONE: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_NONE" << llendl; break; - case MEDIANAVSTATE_BEGUN: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_BEGUN" << llendl; break; - case MEDIANAVSTATE_FIRST_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_FIRST_LOCATION_CHANGED" << llendl; break; - case MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS" << llendl; break; - case MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED" << llendl; break; - case MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS" << llendl; break; - case MEDIANAVSTATE_SERVER_SENT: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_SENT" << llendl; break; - case MEDIANAVSTATE_SERVER_BEGUN: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_BEGUN" << llendl; break; - case MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED" << llendl; break; - case MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED" << llendl; break; + case MEDIANAVSTATE_NONE: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_NONE" << LL_ENDL; break; + case MEDIANAVSTATE_BEGUN: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_BEGUN" << LL_ENDL; break; + case MEDIANAVSTATE_FIRST_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_FIRST_LOCATION_CHANGED" << LL_ENDL; break; + case MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_FIRST_LOCATION_CHANGED_SPURIOUS" << LL_ENDL; break; + case MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED" << LL_ENDL; break; + case MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_COMPLETE_BEFORE_LOCATION_CHANGED_SPURIOUS" << LL_ENDL; break; + case MEDIANAVSTATE_SERVER_SENT: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_SENT" << LL_ENDL; break; + case MEDIANAVSTATE_SERVER_BEGUN: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_BEGUN" << LL_ENDL; break; + case MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_FIRST_LOCATION_CHANGED" << LL_ENDL; break; + case MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED: LL_DEBUGS("Media") << "Setting nav state to MEDIANAVSTATE_SERVER_COMPLETE_BEFORE_LOCATION_CHANGED" << LL_ENDL; break; } } @@ -3674,7 +3674,7 @@ void LLViewerMediaImpl::cancelMimeTypeProbe() // The above should already have set mMimeTypeProbe to NULL. if(mMimeTypeProbe != NULL) { - llerrs << "internal error: mMimeTypeProbe is not NULL after cancelling request." << llendl; + LL_ERRS() << "internal error: mMimeTypeProbe is not NULL after cancelling request." << LL_ENDL; } } } @@ -3756,10 +3756,10 @@ bool LLViewerMediaImpl::shouldShowBasedOnClass() const bool attached_to_another_avatar = isAttachedToAnotherAvatar(); bool inside_parcel = isInAgentParcel(); - // llinfos << " hasFocus = " << hasFocus() << + // LL_INFOS() << " hasFocus = " << hasFocus() << // " others = " << (attached_to_another_avatar && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_ON_OTHERS_SETTING)) << // " within = " << (inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_WITHIN_PARCEL_SETTING)) << - // " outside = " << (!inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING)) << llendl; + // " outside = " << (!inside_parcel && gSavedSettings.getBOOL(LLViewerMedia::SHOW_MEDIA_OUTSIDE_PARCEL_SETTING)) << LL_ENDL; // If it has focus, we should show it // This is incorrect, and causes EXT-6750 (disabled attachment media still plays) diff --git a/indra/newview/llviewermedia_streamingaudio.cpp b/indra/newview/llviewermedia_streamingaudio.cpp index e2a74e8e3c78a13152e234591d9190aa7a638f94..c107e8472c8a6b375c59c9435e702ba39ad40f08 100755 --- a/indra/newview/llviewermedia_streamingaudio.cpp +++ b/indra/newview/llviewermedia_streamingaudio.cpp @@ -56,20 +56,20 @@ void LLStreamingAudio_MediaPlugins::start(const std::string& url) if (!mMediaPlugin) // lazy-init the underlying media plugin { mMediaPlugin = initializeMedia("audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis. - llinfos << "streaming audio mMediaPlugin is now " << mMediaPlugin << llendl; + LL_INFOS() << "streaming audio mMediaPlugin is now " << mMediaPlugin << LL_ENDL; } if(!mMediaPlugin) return; if (!url.empty()) { - llinfos << "Starting internet stream: " << url << llendl; + LL_INFOS() << "Starting internet stream: " << url << LL_ENDL; mURL = url; mMediaPlugin->loadURI ( url ); mMediaPlugin->start(); - llinfos << "Playing stream..." << llendl; + LL_INFOS() << "Playing stream..." << LL_ENDL; } else { - llinfos << "setting stream to NULL"<< llendl; + LL_INFOS() << "setting stream to NULL"<< LL_ENDL; mURL.clear(); mMediaPlugin->stop(); } @@ -77,7 +77,7 @@ void LLStreamingAudio_MediaPlugins::start(const std::string& url) void LLStreamingAudio_MediaPlugins::stop() { - llinfos << "Stopping internet stream." << llendl; + LL_INFOS() << "Stopping internet stream." << LL_ENDL; if(mMediaPlugin) { mMediaPlugin->stop(); @@ -93,12 +93,12 @@ void LLStreamingAudio_MediaPlugins::pause(int pause) if(pause) { - llinfos << "Pausing internet stream." << llendl; + LL_INFOS() << "Pausing internet stream." << LL_ENDL; mMediaPlugin->pause(); } else { - llinfos << "Unpausing internet stream." << llendl; + LL_INFOS() << "Unpausing internet stream." << LL_ENDL; mMediaPlugin->start(); } } diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp index 297906803bdd63846ea181c7b09d73b8ca879b13..aa019dfdd80d8536cf0c0d132e145699e70813d8 100755 --- a/indra/newview/llviewermediafocus.cpp +++ b/indra/newview/llviewermediafocus.cpp @@ -108,7 +108,7 @@ void LLViewerMediaFocus::setFocusFace(LLPointer<LLViewerObject> objectp, S32 fac else { // This should never happen. - llwarns << "Can't find media entry for focused face" << llendl; + LL_WARNS() << "Can't find media entry for focused face" << LL_ENDL; } media_impl->focus(true); @@ -223,7 +223,7 @@ void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal, F32 aspect_ratio = getBBoxAspectRatio(bbox, normal, &height, &width, &depth); F32 camera_aspect = LLViewerCamera::getInstance()->getAspect(); - lldebugs << "normal = " << normal << ", aspect_ratio = " << aspect_ratio << ", camera_aspect = " << camera_aspect << llendl; + LL_DEBUGS() << "normal = " << normal << ", aspect_ratio = " << aspect_ratio << ", camera_aspect = " << camera_aspect << LL_ENDL; // We will normally use the side of the volume aligned with the short side of the screen (i.e. the height for // a screen in a landscape aspect ratio), however there is an edge case where the aspect ratio of the object is @@ -241,14 +241,14 @@ void LLViewerMediaFocus::setCameraZoom(LLViewerObject* object, LLVector3 normal, angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect()); distance = width * 0.5 * padding_factor / tan(angle_of_view * 0.5f ); - lldebugs << "using width (" << width << "), angle_of_view = " << angle_of_view << ", distance = " << distance << llendl; + LL_DEBUGS() << "using width (" << width << "), angle_of_view = " << angle_of_view << ", distance = " << distance << LL_ENDL; } else { angle_of_view = llmax(0.1f, LLViewerCamera::getInstance()->getView()); distance = height * 0.5 * padding_factor / tan(angle_of_view * 0.5f ); - lldebugs << "using height (" << height << "), angle_of_view = " << angle_of_view << ", distance = " << distance << llendl; + LL_DEBUGS() << "using height (" << height << "), angle_of_view = " << angle_of_view << ", distance = " << distance << LL_ENDL; } distance += depth * 0.5; @@ -452,7 +452,7 @@ F32 LLViewerMediaFocus::getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& F32 dot1 = 0.f; F32 dot2 = 0.f; - lldebugs << "bounding box local size = " << bbox_max << ", local_normal = " << local_normal << llendl; + LL_DEBUGS() << "bounding box local size = " << bbox_max << ", local_normal = " << local_normal << LL_ENDL; // The largest component of the localized normal vector is the depth component // meaning that the other two are the legs of the rectangle. @@ -465,21 +465,21 @@ F32 LLViewerMediaFocus::getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& if(XgtY && XgtZ) { - lldebugs << "x component of normal is longest, using y and z" << llendl; + LL_DEBUGS() << "x component of normal is longest, using y and z" << LL_ENDL; comp1.mV[VY] = bbox_max.mV[VY]; comp2.mV[VZ] = bbox_max.mV[VZ]; *depth = bbox_max.mV[VX]; } else if(!XgtY && YgtZ) { - lldebugs << "y component of normal is longest, using x and z" << llendl; + LL_DEBUGS() << "y component of normal is longest, using x and z" << LL_ENDL; comp1.mV[VX] = bbox_max.mV[VX]; comp2.mV[VZ] = bbox_max.mV[VZ]; *depth = bbox_max.mV[VY]; } else { - lldebugs << "z component of normal is longest, using x and y" << llendl; + LL_DEBUGS() << "z component of normal is longest, using x and y" << LL_ENDL; comp1.mV[VX] = bbox_max.mV[VX]; comp2.mV[VY] = bbox_max.mV[VY]; *depth = bbox_max.mV[VZ]; @@ -493,19 +493,19 @@ F32 LLViewerMediaFocus::getBBoxAspectRatio(const LLBBox& bbox, const LLVector3& *height = comp1.length(); *width = comp2.length(); - lldebugs << "comp1 = " << comp1 << ", height = " << *height << llendl; - lldebugs << "comp2 = " << comp2 << ", width = " << *width << llendl; + LL_DEBUGS() << "comp1 = " << comp1 << ", height = " << *height << LL_ENDL; + LL_DEBUGS() << "comp2 = " << comp2 << ", width = " << *width << LL_ENDL; } else { *height = comp2.length(); *width = comp1.length(); - lldebugs << "comp2 = " << comp2 << ", height = " << *height << llendl; - lldebugs << "comp1 = " << comp1 << ", width = " << *width << llendl; + LL_DEBUGS() << "comp2 = " << comp2 << ", height = " << *height << LL_ENDL; + LL_DEBUGS() << "comp1 = " << comp1 << ", width = " << *width << LL_ENDL; } - lldebugs << "returning " << (*width / *height) << llendl; + LL_DEBUGS() << "returning " << (*width / *height) << LL_ENDL; // Return the aspect ratio. return *width / *height; @@ -560,7 +560,7 @@ void LLViewerMediaFocus::focusZoomOnMedia(LLUUID media_id) if(normal.isNull()) { // If that didn't work, use the inverse of the camera "look at" axis, which should keep the camera pointed in the same direction. -// llinfos << "approximate face normal invalid, using camera direction." << llendl; +// LL_INFOS() << "approximate face normal invalid, using camera direction." << LL_ENDL; normal = LLViewerCamera::getInstance()->getAtAxis(); normal *= (F32)-1.0f; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 59e98fc882b9c959f8d3615c60f320427c94c66b..9c08ec7e77d0945d95185a449235babf2db91374 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -126,6 +126,7 @@ #include "lltoolgrab.h" #include "llwindow.h" #include "llpathfindingmanager.h" +#include "llstartup.h" #include "boost/unordered_map.hpp" using namespace LLAvatarAppearanceDefines; @@ -482,14 +483,12 @@ void init_menus() gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE); gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE); -#if !MEM_TRACK_MEM // Don't display the Memory console menu if the feature is turned off LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild<LLMenuItemCheckGL>("Memory", TRUE); if (memoryMenu) { memoryMenu->setVisible(FALSE); } -#endif gMenuBarView->createJumpKeys(); @@ -528,19 +527,13 @@ class LLAdvancedToggleConsole : public view_listener_t } else if ("fast timers" == console_type) { - LLFloaterReg::toggleInstance("fast_timers"); + LLFloaterReg::toggleInstance("block_timers"); } else if ("scene view" == console_type) { toggle_visibility( (void*)gSceneView); } -#if MEM_TRACK_MEM - else if ("memory view" == console_type) - { - toggle_visibility( (void*)gDebugView->mMemoryView ); - } -#endif return true; } }; @@ -560,18 +553,12 @@ class LLAdvancedCheckConsole : public view_listener_t } else if ("fast timers" == console_type) { - new_value = LLFloaterReg::instanceVisible("fast_timers"); + new_value = LLFloaterReg::instanceVisible("block_timers"); } else if ("scene view" == console_type) { new_value = get_visibility( (void*) gSceneView); } -#if MEM_TRACK_MEM - else if ("memory view" == console_type) - { - new_value = get_visibility( (void*)gDebugView->mMemoryView ); - } -#endif return new_value; } @@ -1660,7 +1647,7 @@ class LLAdvancedAnimTenFaster : public view_listener_t { bool handleEvent(const LLSD& userdata) { - //llinfos << "LLAdvancedAnimTenFaster" << llendl; + //LL_INFOS() << "LLAdvancedAnimTenFaster" << LL_ENDL; F32 time_factor = LLMotionController::getCurrentTimeFactor(); time_factor = llmin(time_factor + 0.1f, 2.f); // Upper limit is 200% speed set_all_animation_time_factors(time_factor); @@ -1672,7 +1659,7 @@ class LLAdvancedAnimTenSlower : public view_listener_t { bool handleEvent(const LLSD& userdata) { - //llinfos << "LLAdvancedAnimTenSlower" << llendl; + //LL_INFOS() << "LLAdvancedAnimTenSlower" << LL_ENDL; F32 time_factor = LLMotionController::getCurrentTimeFactor(); time_factor = llmax(time_factor - 0.1f, 0.1f); // Lower limit is at 10% of normal speed set_all_animation_time_factors(time_factor); @@ -1971,9 +1958,9 @@ class LLAdvancedViewerEventRecorder : public view_listener_t std::string command = userdata.asString(); if ("start playback" == command) { - llinfos << "Event Playback starting" << llendl; + LL_INFOS() << "Event Playback starting" << LL_ENDL; LLViewerEventRecorder::instance().playbackRecording(); - llinfos << "Event Playback completed" << llendl; + LL_INFOS() << "Event Playback completed" << LL_ENDL; } else if ("stop playback" == command) { @@ -1982,12 +1969,12 @@ class LLAdvancedViewerEventRecorder : public view_listener_t else if ("start recording" == command) { LLViewerEventRecorder::instance().setEventLoggingOn(); - llinfos << "Event recording started" << llendl; + LL_INFOS() << "Event recording started" << LL_ENDL; } else if ("stop recording" == command) { LLViewerEventRecorder::instance().setEventLoggingOff(); - llinfos << "Event recording stopped" << llendl; + LL_INFOS() << "Event recording stopped" << LL_ENDL; } return true; @@ -2594,11 +2581,11 @@ bool enable_object_touch(LLUICtrl* ctrl) LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mTouchName.empty()) { - gMenuHolder->childSetText(item_name, node->mTouchName); + gMenuHolder->childSetValue(item_name, node->mTouchName); } else { - gMenuHolder->childSetText(item_name, get_default_item_label(item_name)); + gMenuHolder->childSetValue(item_name, get_default_item_label(item_name)); } return new_value; @@ -3234,7 +3221,7 @@ class LLAvatarDebug : public view_listener_t { ((LLVOAvatarSelf *)avatar)->dumpLocalTextures(); } - llinfos << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << llendl; + LL_INFOS() << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << LL_ENDL; std::vector<std::string> strings; strings.push_back(avatar->getID().asString()); LLUUID invoice; @@ -3508,7 +3495,7 @@ void handle_buy_contents(LLSaleInfo sale_info) void handle_region_dump_temp_asset_data(void*) { - llinfos << "Dumping temporary asset data to simulator logs" << llendl; + LL_INFOS() << "Dumping temporary asset data to simulator logs" << LL_ENDL; std::vector<std::string> strings; LLUUID invoice; send_generic_message("dumptempassetdata", strings, invoice); @@ -3516,7 +3503,7 @@ void handle_region_dump_temp_asset_data(void*) void handle_region_clear_temp_asset_data(void*) { - llinfos << "Clearing temporary asset data" << llendl; + LL_INFOS() << "Clearing temporary asset data" << LL_ENDL; std::vector<std::string> strings; LLUUID invoice; send_generic_message("cleartempassetdata", strings, invoice); @@ -3527,14 +3514,14 @@ void handle_region_dump_settings(void*) LLViewerRegion* regionp = gAgent.getRegion(); if (regionp) { - llinfos << "Damage: " << (regionp->getAllowDamage() ? "on" : "off") << llendl; - llinfos << "Landmark: " << (regionp->getAllowLandmark() ? "on" : "off") << llendl; - llinfos << "SetHome: " << (regionp->getAllowSetHome() ? "on" : "off") << llendl; - llinfos << "ResetHome: " << (regionp->getResetHomeOnTeleport() ? "on" : "off") << llendl; - llinfos << "SunFixed: " << (regionp->getSunFixed() ? "on" : "off") << llendl; - llinfos << "BlockFly: " << (regionp->getBlockFly() ? "on" : "off") << llendl; - llinfos << "AllowP2P: " << (regionp->getAllowDirectTeleport() ? "on" : "off") << llendl; - llinfos << "Water: " << (regionp->getWaterHeight()) << llendl; + LL_INFOS() << "Damage: " << (regionp->getAllowDamage() ? "on" : "off") << LL_ENDL; + LL_INFOS() << "Landmark: " << (regionp->getAllowLandmark() ? "on" : "off") << LL_ENDL; + LL_INFOS() << "SetHome: " << (regionp->getAllowSetHome() ? "on" : "off") << LL_ENDL; + LL_INFOS() << "ResetHome: " << (regionp->getResetHomeOnTeleport() ? "on" : "off") << LL_ENDL; + LL_INFOS() << "SunFixed: " << (regionp->getSunFixed() ? "on" : "off") << LL_ENDL; + LL_INFOS() << "BlockFly: " << (regionp->getBlockFly() ? "on" : "off") << LL_ENDL; + LL_INFOS() << "AllowP2P: " << (regionp->getAllowDirectTeleport() ? "on" : "off") << LL_ENDL; + LL_INFOS() << "Water: " << (regionp->getWaterHeight()) << LL_ENDL; } } @@ -3565,7 +3552,7 @@ void handle_dump_focus() { LLUICtrl *ctrl = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus()); - llinfos << "Keyboard focus " << (ctrl ? ctrl->getName() : "(none)") << llendl; + LL_INFOS() << "Keyboard focus " << (ctrl ? ctrl->getName() : "(none)") << LL_ENDL; } class LLSelfStandUp : public view_listener_t @@ -3777,7 +3764,7 @@ void process_grant_godlike_powers(LLMessageSystem* msg, void**) } else { - llwarns << "Grant godlike for wrong agent " << agent_id << llendl; + LL_WARNS() << "Grant godlike for wrong agent " << agent_id << LL_ENDL; } } @@ -4119,7 +4106,7 @@ class LLEditEnableDuplicate : public view_listener_t void handle_duplicate_in_place(void*) { - llinfos << "handle_duplicate_in_place" << llendl; + LL_INFOS() << "handle_duplicate_in_place" << LL_ENDL; LLVector3 offset(0.f, 0.f, 0.f); LLSelectMgr::getInstance()->selectDuplicate(offset, TRUE); @@ -4290,13 +4277,16 @@ static bool get_derezzable_objects( EDeRezDestination dest, std::string& error, LLViewerRegion*& first_region, - LLDynamicArray<LLViewerObjectPtr>* derez_objectsp, + std::vector<LLViewerObjectPtr>* derez_objectsp, bool only_check = false) { bool found = false; LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); + if (derez_objectsp) + derez_objectsp->reserve(selection->getRootObjectCount()); + // Check conditions that we can't deal with, building a list of // everything that we'll actually be derezzing. for (LLObjectSelection::valid_root_iterator iter = selection->valid_root_begin(); @@ -4333,7 +4323,7 @@ static bool get_derezzable_objects( && dest != DRD_RETURN_TO_OWNER) { // this object is an asset container, derez its contents, not it - llwarns << "Attempt to derez deprecated AssetContainer object type not supported." << llendl; + LL_WARNS() << "Attempt to derez deprecated AssetContainer object type not supported." << LL_ENDL; /* object->requestInventory(container_inventory_arrived, (void *)(BOOL)(DRD_TAKE_INTO_AGENT_INVENTORY == dest)); @@ -4375,7 +4365,7 @@ static bool get_derezzable_objects( break; if (derez_objectsp) - derez_objectsp->put(object); + derez_objectsp->push_back(object); } } @@ -4395,16 +4385,16 @@ static void derez_objects( const LLUUID& dest_id, LLViewerRegion*& first_region, std::string& error, - LLDynamicArray<LLViewerObjectPtr>* objectsp) + std::vector<LLViewerObjectPtr>* objectsp) { - LLDynamicArray<LLViewerObjectPtr> derez_objects; + std::vector<LLViewerObjectPtr> derez_objects; if (!objectsp) // if objects to derez not specified { // get them from selection if (!get_derezzable_objects(dest, error, first_region, &derez_objects, false)) { - llwarns << "No objects to derez" << llendl; + LL_WARNS() << "No objects to derez" << LL_ENDL; return; } @@ -4424,13 +4414,13 @@ static void derez_objects( // satisfy anybody. const S32 MAX_ROOTS_PER_PACKET = 250; const S32 MAX_PACKET_COUNT = 254; - F32 packets = ceil((F32)objectsp->count() / (F32)MAX_ROOTS_PER_PACKET); + F32 packets = ceil((F32)objectsp->size() / (F32)MAX_ROOTS_PER_PACKET); if(packets > (F32)MAX_PACKET_COUNT) { error = "AcquireErrorTooManyObjects"; } - if(error.empty() && objectsp->count() > 0) + if(error.empty() && objectsp->size() > 0) { U8 d = (U8)dest; LLUUID tid; @@ -4455,11 +4445,11 @@ static void derez_objects( msg->addU8Fast(_PREHASH_PacketCount, packet_count); msg->addU8Fast(_PREHASH_PacketNumber, packet_number); objects_in_packet = 0; - while((object_index < objectsp->count()) + while((object_index < objectsp->size()) && (objects_in_packet++ < MAX_ROOTS_PER_PACKET)) { - LLViewerObject* object = objectsp->get(object_index++); + LLViewerObject* object = objectsp->at(object_index++); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID()); // VEFFECT: DerezObject @@ -4539,7 +4529,7 @@ class LLObjectReturn : public view_listener_t LLObjectSelectionHandle mObjectSelection; - LLDynamicArray<LLViewerObjectPtr> mReturnableObjects; + std::vector<LLViewerObjectPtr> mReturnableObjects; std::string mError; LLViewerRegion* mFirstRegion; }; @@ -4892,7 +4882,7 @@ bool callback_show_buy_currency(const LLSD& notification, const LLSD& response) S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (0 == option) { - llinfos << "Loading page " << LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL") << llendl; + LL_INFOS() << "Loading page " << LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL") << LL_ENDL; LLWeb::loadURL(LLNotifications::instance().getGlobalString("BUY_CURRENCY_URL")); } return false; @@ -5411,7 +5401,7 @@ class LLObjectsReturnPackage }; LLObjectSelectionHandle mObjectSelection; - LLDynamicArray<LLViewerObjectPtr> mReturnableObjects; + std::vector<LLViewerObjectPtr> mReturnableObjects; std::string mError; LLViewerRegion *mFirstRegion; }; @@ -5579,7 +5569,7 @@ void print_agent_nvpairs(void*) { LLViewerObject *objectp; - llinfos << "Agent Name Value Pairs" << llendl; + LL_INFOS() << "Agent Name Value Pairs" << LL_ENDL; objectp = gObjectList.findObject(gAgentID); if (objectp) @@ -5588,10 +5578,10 @@ void print_agent_nvpairs(void*) } else { - llinfos << "Can't find agent object" << llendl; + LL_INFOS() << "Can't find agent object" << LL_ENDL; } - llinfos << "Camera at " << gAgentCamera.getCameraPositionGlobal() << llendl; + LL_INFOS() << "Camera at " << gAgentCamera.getCameraPositionGlobal() << LL_ENDL; } void show_debug_menus() @@ -5644,7 +5634,7 @@ void toggle_debug_menus(void*) // { // return; // } -// llinfos << "Exporting selected objects:" << llendl; +// LL_INFOS() << "Exporting selected objects:" << LL_ENDL; // gExporterRequestID.generate(); // gExportDirectory = ""; @@ -5663,7 +5653,7 @@ void toggle_debug_menus(void*) // LLViewerObject* object = node->getObject(); // msg->nextBlockFast(_PREHASH_ObjectData); // msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); -// llinfos << "Object: " << object->getID() << llendl; +// LL_INFOS() << "Object: " << object->getID() << LL_ENDL; // } // msg->sendReliable(gAgent.getRegion()->getHost()); @@ -6005,11 +5995,11 @@ bool enable_object_sit(LLUICtrl* ctrl) LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if (node && node->mValid && !node->mSitName.empty()) { - gMenuHolder->childSetText(item_name, node->mSitName); + gMenuHolder->childSetValue(item_name, node->mSitName); } else { - gMenuHolder->childSetText(item_name, get_default_item_label(item_name)); + gMenuHolder->childSetValue(item_name, get_default_item_label(item_name)); } } return !sitting_on_sel && is_object_sittable(); @@ -6199,7 +6189,7 @@ class LLPromptShowURL : public view_listener_t } else { - llinfos << "PromptShowURL invalid parameters! Expecting \"ALERT,URL\"." << llendl; + LL_INFOS() << "PromptShowURL invalid parameters! Expecting \"ALERT,URL\"." << LL_ENDL; } return true; } @@ -6232,7 +6222,7 @@ class LLPromptShowFile : public view_listener_t } else { - llinfos << "PromptShowFile invalid parameters! Expecting \"ALERT,FILE\"." << llendl; + LL_INFOS() << "PromptShowFile invalid parameters! Expecting \"ALERT,FILE\"." << LL_ENDL; } return true; } @@ -6515,7 +6505,7 @@ void callback_attachment_drop(const LLSD& notification, const LLSD& response) if (!object) { - llwarns << "handle_drop_attachment() - no object to drop" << llendl; + LL_WARNS() << "handle_drop_attachment() - no object to drop" << LL_ENDL; return; } @@ -6532,13 +6522,13 @@ void callback_attachment_drop(const LLSD& notification, const LLSD& response) if (!object) { - llwarns << "handle_detach() - no object to detach" << llendl; + LL_WARNS() << "handle_detach() - no object to detach" << LL_ENDL; return; } if (object->isAvatar()) { - llwarns << "Trying to detach avatar from avatar." << llendl; + LL_WARNS() << "Trying to detach avatar from avatar." << LL_ENDL; return; } @@ -6563,7 +6553,7 @@ class LLAttachmentDrop : public view_listener_t } else { - llwarns << "Drop object not found" << llendl; + LL_WARNS() << "Drop object not found" << LL_ENDL; return true; } @@ -6637,7 +6627,7 @@ class LLAttachmentDetach : public view_listener_t LLViewerObject *object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (!object) { - llwarns << "handle_detach() - no object to detach" << llendl; + LL_WARNS() << "handle_detach() - no object to detach" << LL_ENDL; return true; } @@ -6654,13 +6644,13 @@ class LLAttachmentDetach : public view_listener_t if (!object) { - llwarns << "handle_detach() - no object to detach" << llendl; + LL_WARNS() << "handle_detach() - no object to detach" << LL_ENDL; return true; } if (object->isAvatar()) { - llwarns << "Trying to detach avatar from avatar." << llendl; + LL_WARNS() << "Trying to detach avatar from avatar." << LL_ENDL; return true; } @@ -6924,14 +6914,14 @@ void queue_actions(LLFloaterScriptQueue* q, const std::string& msg) } else { - llerrs << "Bad logic." << llendl; + LL_ERRS() << "Bad logic." << LL_ENDL; } } else { if (!q->start()) { - llwarns << "Unexpected script compile failure." << llendl; + LL_WARNS() << "Unexpected script compile failure." << LL_ENDL; } } } @@ -6986,7 +6976,7 @@ class LLToolsSelectedScriptAction : public view_listener_t } else { - llwarns << "Failed to generate LLFloaterScriptQueue with action: " << action << llendl; + LL_WARNS() << "Failed to generate LLFloaterScriptQueue with action: " << action << LL_ENDL; } return true; } @@ -7118,12 +7108,12 @@ void handle_dump_attachments(void*) !attached_object->mDrawable->isRenderType(0)); LLVector3 pos; if (visible) pos = attached_object->mDrawable->getPosition(); - llinfos << "ATTACHMENT " << key << ": item_id=" << attached_object->getAttachmentItemID() + LL_INFOS() << "ATTACHMENT " << key << ": item_id=" << attached_object->getAttachmentItemID() << (attached_object ? " present " : " absent ") << (visible ? "visible " : "invisible ") << " at " << pos << " and " << (visible ? attached_object->getPosition() : LLVector3::zero) - << llendl; + << LL_ENDL; } } } @@ -7556,7 +7546,7 @@ void handle_dump_avatar_local_textures(void*) void handle_dump_timers() { - LLFastTimer::dumpCurTimes(); + LLTrace::BlockTimer::dumpCurTimes(); } void handle_debug_avatar_textures(void*) @@ -7574,7 +7564,7 @@ void handle_grab_baked_texture(void* data) if (!isAgentAvatarValid()) return; const LLUUID& asset_id = gAgentAvatarp->grabBakedTexture(baked_tex_index); - LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl; + LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << LL_ENDL; LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE; LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE; const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type)); @@ -7630,7 +7620,7 @@ void handle_grab_baked_texture(void* data) } else { - llwarns << "Can't find a folder to put it in" << llendl; + LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL; } } @@ -7844,7 +7834,7 @@ void handle_buy_currency_test(void*) replace["[LANGUAGE]"] = LLUI::getLanguage(); LLStringUtil::format(url, replace); - llinfos << "buy currency url " << url << llendl; + LL_INFOS() << "buy currency url " << url << LL_ENDL; LLFloaterReg::showInstance("buy_currency_html", LLSD(url)); } @@ -8318,7 +8308,7 @@ class LLWorldEnvPreset : public view_listener_t } else { - llwarns << "Unknown item selected" << llendl; + LL_WARNS() << "Unknown item selected" << LL_ENDL; } return true; @@ -8351,7 +8341,7 @@ class LLWorldEnableEnvPreset : public view_listener_t } else { - llwarns << "Unknown item" << llendl; + LL_WARNS() << "Unknown item" << LL_ENDL; } return false; diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 4c95dcd6a21097a39f0a813e143fb951f802f85e..04697f34727fcf3bec6e4a17182f214bbe46c869 100755 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -253,7 +253,7 @@ const std::string upload_pick(void* data) LLFilePicker& picker = LLFilePicker::instance(); if (!picker.getOpenFile(type)) { - llinfos << "Couldn't import objects from file" << llendl; + LL_INFOS() << "Couldn't import objects from file" << LL_ENDL; return std::string(); } @@ -327,7 +327,7 @@ const std::string upload_pick(void* data) std::string error_msg; if (check_for_invalid_wav_formats(filename,error_msg)) { - llinfos << error_msg << ": " << filename << llendl; + LL_INFOS() << error_msg << ": " << filename << LL_ENDL; LLSD args; args["FILE"] = filename; LLNotificationsUtil::add( error_msg, args ); @@ -455,7 +455,7 @@ class LLFileUploadBulk : public view_listener_t } else { - llinfos << "Couldn't import objects from file" << llendl; + LL_INFOS() << "Couldn't import objects from file" << LL_ENDL; } return true; } @@ -463,11 +463,11 @@ class LLFileUploadBulk : public view_listener_t void upload_error(const std::string& error_message, const std::string& label, const std::string& filename, const LLSD& args) { - llwarns << error_message << llendl; + LL_WARNS() << error_message << LL_ENDL; LLNotificationsUtil::add(label, args); if(LLFile::remove(filename) == -1) { - lldebugs << "unable to remove temp file" << llendl; + LL_DEBUGS() << "unable to remove temp file" << LL_ENDL; } LLFilePicker::instance().reset(); } @@ -544,7 +544,7 @@ class LLFileTakeSnapshotToDisk : public view_listener_t formatted = new LLImageJPEG(gSavedSettings.getS32("SnapshotQuality")); break; default: - llwarns << "Unknown local snapshot format: " << fmt << llendl; + LL_WARNS() << "Unknown local snapshot format: " << fmt << LL_ENDL; case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG: formatted = new LLImagePNG; break; @@ -581,8 +581,8 @@ void handle_compress_image(void*) { std::string outfile = infile + ".j2c"; - llinfos << "Input: " << infile << llendl; - llinfos << "Output: " << outfile << llendl; + LL_INFOS() << "Input: " << infile << LL_ENDL; + LL_INFOS() << "Output: " << outfile << LL_ENDL; BOOL success; @@ -590,11 +590,11 @@ void handle_compress_image(void*) if (success) { - llinfos << "Compression complete" << llendl; + LL_INFOS() << "Compression complete" << LL_ENDL; } else { - llinfos << "Compression failed: " << LLImage::getLastError() << llendl; + LL_INFOS() << "Compression failed: " << LLImage::getLastError() << LL_ENDL; } infile = picker.getNextFile(); @@ -662,7 +662,7 @@ LLUUID upload_new_resource( asset_type = LLAssetType::AT_SOUND; // tag it as audio S32 encode_result = 0; - llinfos << "Attempting to encode wav as an ogg file" << llendl; + LL_INFOS() << "Attempting to encode wav as an ogg file" << LL_ENDL; encode_result = encode_vorbis_file(src_filename, filename); @@ -713,8 +713,8 @@ LLUUID upload_new_resource( "%254s %254s\n", label, value); - llinfos << "got: " << label << " = " << value - << llendl; + LL_INFOS() << "got: " << label << " = " << value + << LL_ENDL; if (EOF == tokens_read) { @@ -767,7 +767,7 @@ LLUUID upload_new_resource( // read in and throw out most of the header except for the type if (fread(buf, header_size, 1, in) != 1) { - llwarns << "Short read" << llendl; + LL_WARNS() << "Short read" << LL_ENDL; } memcpy(&type_num, buf + 16, sizeof(S16)); /* Flawfinder: ignore */ asset_type = (LLAssetType::EType)type_num; @@ -781,7 +781,7 @@ LLUUID upload_new_resource( { if (fwrite(buf, 1, readbytes, out) != readbytes) { - llwarns << "Short write" << llendl; + LL_WARNS() << "Short write" << LL_ENDL; } } fclose(out); @@ -799,7 +799,7 @@ LLUUID upload_new_resource( } else { - llinfos << "Couldn't open .lin file " << src_filename << llendl; + LL_INFOS() << "Couldn't open .lin file " << src_filename << LL_ENDL; } } else if (exten == "bvh") @@ -875,13 +875,13 @@ LLUUID upload_new_resource( } else { - llwarns << error_message << llendl; + LL_WARNS() << error_message << LL_ENDL; LLSD args; args["ERROR_MESSAGE"] = error_message; LLNotificationsUtil::add("ErrorMessage", args); if(LLFile::remove(filename) == -1) { - lldebugs << "unable to remove temp file" << llendl; + LL_DEBUGS() << "unable to remove temp file" << LL_ENDL; } LLFilePicker::instance().reset(); } @@ -949,7 +949,7 @@ void upload_done_callback( if(is_balance_sufficient) { // Actually add the upload to inventory - llinfos << "Adding " << uuid << " to inventory." << llendl; + LL_INFOS() << "Adding " << uuid << " to inventory." << LL_ENDL; const LLUUID folder_id = gInventory.findCategoryUUIDForType(dest_loc); if(folder_id.notNull()) { @@ -966,7 +966,7 @@ void upload_done_callback( } else { - llwarns << "Can't find a folder to put it in" << llendl; + LL_WARNS() << "Can't find a folder to put it in" << LL_ENDL; } } } @@ -1098,17 +1098,17 @@ void upload_new_resource( if( LLAssetType::AT_SOUND == asset_type ) { - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_UPLOAD_SOUND_COUNT ); + add(LLStatViewer::UPLOAD_SOUND, 1); } else if( LLAssetType::AT_TEXTURE == asset_type ) { - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_UPLOAD_TEXTURE_COUNT ); + add(LLStatViewer::UPLOAD_TEXTURE, 1); } else if( LLAssetType::AT_ANIMATION == asset_type) { - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_UPLOAD_ANIM_COUNT ); + add(LLStatViewer::ANIMATION_UPLOADS, 1); } if(LLInventoryType::IT_NONE == inv_type) @@ -1131,21 +1131,21 @@ void upload_new_resource( upload_message.append(display_name); LLUploadDialog::modalUploadDialog(upload_message); - llinfos << "*** Uploading: " << llendl; - llinfos << "Type: " << LLAssetType::lookup(asset_type) << llendl; - llinfos << "UUID: " << uuid << llendl; - llinfos << "Name: " << name << llendl; - llinfos << "Desc: " << desc << llendl; - llinfos << "Expected Upload Cost: " << expected_upload_cost << llendl; - lldebugs << "Folder: " << gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type) << llendl; - lldebugs << "Asset Type: " << LLAssetType::lookup(asset_type) << llendl; + LL_INFOS() << "*** Uploading: " << LL_ENDL; + LL_INFOS() << "Type: " << LLAssetType::lookup(asset_type) << LL_ENDL; + LL_INFOS() << "UUID: " << uuid << LL_ENDL; + LL_INFOS() << "Name: " << name << LL_ENDL; + LL_INFOS() << "Desc: " << desc << LL_ENDL; + LL_INFOS() << "Expected Upload Cost: " << expected_upload_cost << LL_ENDL; + LL_DEBUGS() << "Folder: " << gInventory.findCategoryUUIDForType((destination_folder_type == LLFolderType::FT_NONE) ? LLFolderType::assetTypeToFolderType(asset_type) : destination_folder_type) << LL_ENDL; + LL_DEBUGS() << "Asset Type: " << LLAssetType::lookup(asset_type) << LL_ENDL; std::string url = gAgent.getRegion()->getCapability( "NewFileAgentInventory"); if ( !url.empty() ) { - llinfos << "New Agent Inventory via capability" << llendl; + LL_INFOS() << "New Agent Inventory via capability" << LL_ENDL; LLSD body; body = generate_new_resource_upload_capability_body( @@ -1168,7 +1168,7 @@ void upload_new_resource( } else { - llinfos << "NewAgentInventory capability not found, new agent inventory via asset system." << llendl; + LL_INFOS() << "NewAgentInventory capability not found, new agent inventory via asset system." << LL_ENDL; // check for adequate funds // TODO: do this check on the sim if (LLAssetType::AT_SOUND == asset_type || @@ -1233,18 +1233,15 @@ void increase_new_upload_stats(LLAssetType::EType asset_type) { if ( LLAssetType::AT_SOUND == asset_type ) { - LLViewerStats::getInstance()->incStat( - LLViewerStats::ST_UPLOAD_SOUND_COUNT ); + add(LLStatViewer::UPLOAD_SOUND, 1); } else if ( LLAssetType::AT_TEXTURE == asset_type ) { - LLViewerStats::getInstance()->incStat( - LLViewerStats::ST_UPLOAD_TEXTURE_COUNT ); + add(LLStatViewer::UPLOAD_TEXTURE, 1); } else if ( LLAssetType::AT_ANIMATION == asset_type ) { - LLViewerStats::getInstance()->incStat( - LLViewerStats::ST_UPLOAD_ANIM_COUNT ); + add(LLStatViewer::ANIMATION_UPLOADS, 1); } } diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h index 3136358b83653e8c1d4d3b6d36482895f73f2729..3034d00b22ef4202d7cf4dddf4036198269effe7 100755 --- a/indra/newview/llviewermenufile.h +++ b/indra/newview/llviewermenufile.h @@ -31,6 +31,8 @@ #include "llassetstorage.h" #include "llinventorytype.h" #include "llfilepicker.h" +#include "llthread.h" +#include <queue> class LLTransactionID; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 9d125878019e1b9103805705b0ade680e92c0bc1..00d28a43074141639ecba06a7df7baeba863329d 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -151,6 +151,11 @@ LLFrameTimer gThrottleTimer; const U32 OFFER_THROTTLE_MAX_COUNT=5; //number of items per time period const F32 OFFER_THROTTLE_TIME=10.f; //time period in seconds +// Agent Update Flags (U8) +const U8 AU_FLAGS_NONE = 0x00; +const U8 AU_FLAGS_HIDETITLE = 0x01; +const U8 AU_FLAGS_CLIENT_AUTOPILOT = 0x02; + //script permissions const std::string SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] = { @@ -372,9 +377,11 @@ void process_layer_data(LLMessageSystem *mesgsys, void **user_data) { LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(mesgsys->getSender()); + LL_DEBUGS_ONCE("SceneLoadTiming") << "Received layer data" << LL_ENDL; + if(!regionp) { - llwarns << "Invalid region for layer data." << llendl; + LL_WARNS() << "Invalid region for layer data." << LL_ENDL; return; } S32 size; @@ -400,11 +407,11 @@ void process_layer_data(LLMessageSystem *mesgsys, void **user_data) LLVLData *vl_datap = new LLVLData(regionp, type, datap, size); if (mesgsys->getReceiveCompressedSize()) { - gVLManager.addLayerData(vl_datap, mesgsys->getReceiveCompressedSize()); + gVLManager.addLayerData(vl_datap, (S32Bytes)mesgsys->getReceiveCompressedSize()); } else { - gVLManager.addLayerData(vl_datap, mesgsys->getReceiveSize()); + gVLManager.addLayerData(vl_datap, (S32Bytes)mesgsys->getReceiveSize()); } } @@ -669,7 +676,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response) S32 max_groups = gMaxAgentGroups; if(gAgent.isInGroup(group_id)) ++max_groups; - if(gAgent.mGroups.count() < max_groups) + if(gAgent.mGroups.size() < max_groups) { accept_invite = true; } @@ -1214,7 +1221,7 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam const LLInventoryObject *obj = gInventory.getObject(obj_id); if (!obj) { - llwarns << "Cannot find object [ itemID:" << obj_id << " ] to open." << llendl; + LL_WARNS() << "Cannot find object [ itemID:" << obj_id << " ] to open." << LL_ENDL; continue; } @@ -1490,7 +1497,7 @@ void LLOfferInfo::handleRespond(const LLSD& notification, const LLSD& response) const std::string name = notification["name"].asString(); if(mRespondFunctions.find(name) == mRespondFunctions.end()) { - llwarns << "Unexpected notification name : " << name << llendl; + LL_WARNS() << "Unexpected notification name : " << name << LL_ENDL; llassert(!"Unexpected notification name"); return; } @@ -2632,7 +2639,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLSD args; args["SUBJECT"] = subj; args["MESSAGE"] = mes; - LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).time_stamp(timestamp)); + LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).time_stamp(LLDate(timestamp))); } // Also send down the old path for now. @@ -3458,7 +3465,7 @@ public : void handleFailure(int status, const std::string& err_msg) { - llwarns << "Translation failed for mesg " << m_origMesg << " toLang " << mToLang << " fromLang " << mFromLang << llendl; + LL_WARNS() << "Translation failed for mesg " << m_origMesg << " toLang " << mToLang << " fromLang " << mFromLang << LL_ENDL; std::string msg = LLTrans::getString("TranslationFailed", LLSD().with("[REASON]", err_msg)); LLStringUtil::replaceString(msg, "\n", " "); // we want one-line error messages @@ -3913,6 +3920,8 @@ void process_teleport_finish(LLMessageSystem* msg, void**) // Teleport is finished; it can't be cancelled now. gViewerWindow->setProgressCancelButtonVisible(FALSE); + gPipeline.doResetVertexBuffers(true); + // Do teleport effect for where you're leaving // VEFFECT: TeleportStart LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); @@ -4246,7 +4255,7 @@ const F32 THRESHOLD_HEAD_ROT_QDOT = 0.9997f; // ~= 2.5 degrees -- if its less th const F32 MAX_HEAD_ROT_QDOT = 0.99999f; // ~= 0.5 degrees -- if its greater than this then no need to update head_rot // between these values we delay the updates (but no more than one second) -static LLFastTimer::DeclareTimer FTM_AGENT_UPDATE_SEND("Send Message"); +static LLTrace::BlockTimerStatHandle FTM_AGENT_UPDATE_SEND("Send Message"); void send_agent_update(BOOL force_send, BOOL send_reliable) { @@ -4423,14 +4432,14 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) update_sec = cur_sec; //msg_number = 0; max_update_count = llmax(max_update_count, update_count); - llinfos << "Sent " << update_count << " AgentUpdate messages per second, max is " << max_update_count << llendl; + LL_INFOS() << "Sent " << update_count << " AgentUpdate messages per second, max is " << max_update_count << LL_ENDL; } update_sec = cur_sec; update_count = 0; } */ - LLFastTimer t(FTM_AGENT_UPDATE_SEND); + LL_RECORD_BLOCK_TIME(FTM_AGENT_UPDATE_SEND); // Build the message msg->newMessageFast(_PREHASH_AgentUpdate); msg->nextBlockFast(_PREHASH_AgentData); @@ -4496,18 +4505,18 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) // *TODO: Remove this dependency, or figure out a better way to handle // this hack. -extern U32 gObjectBits; +extern U32Bits gObjectData; void process_object_update(LLMessageSystem *mesgsys, void **user_data) { // Update the data counters if (mesgsys->getReceiveCompressedSize()) { - gObjectBits += mesgsys->getReceiveCompressedSize() * 8; + gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize(); } else { - gObjectBits += mesgsys->getReceiveSize() * 8; + gObjectData += (U32Bytes)mesgsys->getReceiveSize(); } // Update the object... @@ -4519,11 +4528,11 @@ void process_compressed_object_update(LLMessageSystem *mesgsys, void **user_data // Update the data counters if (mesgsys->getReceiveCompressedSize()) { - gObjectBits += mesgsys->getReceiveCompressedSize() * 8; + gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize(); } else { - gObjectBits += mesgsys->getReceiveSize() * 8; + gObjectData += (U32Bytes)mesgsys->getReceiveSize(); } // Update the object... @@ -4535,11 +4544,11 @@ void process_cached_object_update(LLMessageSystem *mesgsys, void **user_data) // Update the data counters if (mesgsys->getReceiveCompressedSize()) { - gObjectBits += mesgsys->getReceiveCompressedSize() * 8; + gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize(); } else { - gObjectBits += mesgsys->getReceiveSize() * 8; + gObjectData += (U32Bytes)mesgsys->getReceiveSize(); } // Update the object... @@ -4551,38 +4560,40 @@ void process_terse_object_update_improved(LLMessageSystem *mesgsys, void **user_ { if (mesgsys->getReceiveCompressedSize()) { - gObjectBits += mesgsys->getReceiveCompressedSize() * 8; + gObjectData += (U32Bytes)mesgsys->getReceiveCompressedSize(); } else { - gObjectBits += mesgsys->getReceiveSize() * 8; + gObjectData += (U32Bytes)mesgsys->getReceiveSize(); } gObjectList.processCompressedObjectUpdate(mesgsys, user_data, OUT_TERSE_IMPROVED); } -static LLFastTimer::DeclareTimer FTM_PROCESS_OBJECTS("Process Kill Objects"); - +static LLTrace::BlockTimerStatHandle FTM_PROCESS_OBJECTS("Process Kill Objects"); void process_kill_object(LLMessageSystem *mesgsys, void **user_data) { - LLFastTimer t(FTM_PROCESS_OBJECTS); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_OBJECTS); LLUUID id; - U32 local_id; - S32 i; - S32 num_objects; - num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData); + U32 ip = mesgsys->getSenderIP(); + U32 port = mesgsys->getSenderPort(); + LLViewerRegion* regionp = NULL; + { + LLHost host(ip, port); + regionp = LLWorld::getInstance()->getRegion(host); + } - for (i = 0; i < num_objects; i++) + bool delete_object = LLViewerRegion::sVOCacheCullingEnabled; + S32 num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData); + for (S32 i = 0; i < num_objects; ++i) { + U32 local_id; mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i); - LLViewerObjectList::getUUIDFromLocal(id, - local_id, - gMessageSystem->getSenderIP(), - gMessageSystem->getSenderPort()); + LLViewerObjectList::getUUIDFromLocal(id, local_id, ip, port); if (id == LLUUID::null) { LL_DEBUGS("Messaging") << "Unknown kill for local " << local_id << LL_ENDL; @@ -4593,9 +4604,12 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) LL_DEBUGS("Messaging") << "Kill message for local " << local_id << LL_ENDL; } - // ...don't kill the avatar - if (!(id == gAgentID)) + if (id == gAgentID) { + // never kill our avatar + continue; + } + LLViewerObject *objectp = gObjectList.findObject(id); if (objectp) { @@ -4609,6 +4623,10 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data) // Do the kill gObjectList.killObject(objectp); } + + if(delete_object) + { + regionp->killCacheEntry(local_id); } // We should remove the object from selection after it is marked dead by gObjectList to make LLToolGrab, @@ -4831,145 +4849,18 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) F32 stat_value; msg->getU32("Stat", "StatID", stat_id, i); msg->getF32("Stat", "StatValue", stat_value, i); - switch (stat_id) + LLStatViewer::SimMeasurementSampler* measurementp = LLStatViewer::SimMeasurementSampler::getInstance((ESimStatID)stat_id); + + if (measurementp ) { - case LL_SIM_STAT_TIME_DILATION: - LLViewerStats::getInstance()->mSimTimeDilation.addValue(stat_value); - break; - case LL_SIM_STAT_FPS: - LLViewerStats::getInstance()->mSimFPS.addValue(stat_value); - break; - case LL_SIM_STAT_PHYSFPS: - LLViewerStats::getInstance()->mSimPhysicsFPS.addValue(stat_value); - break; - case LL_SIM_STAT_AGENTUPS: - LLViewerStats::getInstance()->mSimAgentUPS.addValue(stat_value); - break; - case LL_SIM_STAT_FRAMEMS: - LLViewerStats::getInstance()->mSimFrameMsec.addValue(stat_value); - break; - case LL_SIM_STAT_NETMS: - LLViewerStats::getInstance()->mSimNetMsec.addValue(stat_value); - break; - case LL_SIM_STAT_SIMOTHERMS: - LLViewerStats::getInstance()->mSimSimOtherMsec.addValue(stat_value); - break; - case LL_SIM_STAT_SIMPHYSICSMS: - LLViewerStats::getInstance()->mSimSimPhysicsMsec.addValue(stat_value); - break; - case LL_SIM_STAT_AGENTMS: - LLViewerStats::getInstance()->mSimAgentMsec.addValue(stat_value); - break; - case LL_SIM_STAT_IMAGESMS: - LLViewerStats::getInstance()->mSimImagesMsec.addValue(stat_value); - break; - case LL_SIM_STAT_SCRIPTMS: - LLViewerStats::getInstance()->mSimScriptMsec.addValue(stat_value); - break; - case LL_SIM_STAT_NUMTASKS: - LLViewerStats::getInstance()->mSimObjects.addValue(stat_value); - break; - case LL_SIM_STAT_NUMTASKSACTIVE: - LLViewerStats::getInstance()->mSimActiveObjects.addValue(stat_value); - break; - case LL_SIM_STAT_NUMAGENTMAIN: - LLViewerStats::getInstance()->mSimMainAgents.addValue(stat_value); - break; - case LL_SIM_STAT_NUMAGENTCHILD: - LLViewerStats::getInstance()->mSimChildAgents.addValue(stat_value); - break; - case LL_SIM_STAT_NUMSCRIPTSACTIVE: - LLViewerStats::getInstance()->mSimActiveScripts.addValue(stat_value); - break; - case LL_SIM_STAT_SCRIPT_EPS: - LLViewerStats::getInstance()->mSimScriptEPS.addValue(stat_value); - break; - case LL_SIM_STAT_INPPS: - LLViewerStats::getInstance()->mSimInPPS.addValue(stat_value); - break; - case LL_SIM_STAT_OUTPPS: - LLViewerStats::getInstance()->mSimOutPPS.addValue(stat_value); - break; - case LL_SIM_STAT_PENDING_DOWNLOADS: - LLViewerStats::getInstance()->mSimPendingDownloads.addValue(stat_value); - break; - case LL_SIM_STAT_PENDING_UPLOADS: - LLViewerStats::getInstance()->mSimPendingUploads.addValue(stat_value); - break; - case LL_SIM_STAT_PENDING_LOCAL_UPLOADS: - LLViewerStats::getInstance()->mSimPendingLocalUploads.addValue(stat_value); - break; - case LL_SIM_STAT_TOTAL_UNACKED_BYTES: - LLViewerStats::getInstance()->mSimTotalUnackedBytes.addValue(stat_value / 1024.f); - break; - case LL_SIM_STAT_PHYSICS_PINNED_TASKS: - LLViewerStats::getInstance()->mPhysicsPinnedTasks.addValue(stat_value); - break; - case LL_SIM_STAT_PHYSICS_LOD_TASKS: - LLViewerStats::getInstance()->mPhysicsLODTasks.addValue(stat_value); - break; - case LL_SIM_STAT_SIMPHYSICSSTEPMS: - LLViewerStats::getInstance()->mSimSimPhysicsStepMsec.addValue(stat_value); - break; - case LL_SIM_STAT_SIMPHYSICSSHAPEMS: - LLViewerStats::getInstance()->mSimSimPhysicsShapeUpdateMsec.addValue(stat_value); - break; - case LL_SIM_STAT_SIMPHYSICSOTHERMS: - LLViewerStats::getInstance()->mSimSimPhysicsOtherMsec.addValue(stat_value); - break; - case LL_SIM_STAT_SIMPHYSICSMEMORY: - LLViewerStats::getInstance()->mPhysicsMemoryAllocated.addValue(stat_value); - break; - case LL_SIM_STAT_SIMSPARETIME: - LLViewerStats::getInstance()->mSimSpareMsec.addValue(stat_value); - break; - case LL_SIM_STAT_SIMSLEEPTIME: - LLViewerStats::getInstance()->mSimSleepMsec.addValue(stat_value); - break; - case LL_SIM_STAT_IOPUMPTIME: - LLViewerStats::getInstance()->mSimPumpIOMsec.addValue(stat_value); - break; - case LL_SIM_STAT_PCTSCRIPTSRUN: - LLViewerStats::getInstance()->mSimPctScriptsRun.addValue(stat_value); - break; - case LL_SIM_STAT_SIMAISTEPTIMEMS: - LLViewerStats::getInstance()->mSimSimAIStepMsec.addValue(stat_value); - break; - case LL_SIM_STAT_SKIPPEDAISILSTEPS_PS: - LLViewerStats::getInstance()->mSimSimSkippedSilhouetteSteps.addValue(stat_value); - break; - case LL_SIM_STAT_PCTSTEPPEDCHARACTERS: - LLViewerStats::getInstance()->mSimSimPctSteppedCharacters.addValue(stat_value); - break; - default: - // Used to be a commented out warning. - LL_DEBUGS("Messaging") << "Unknown stat id" << stat_id << LL_ENDL; - break; + measurementp->sample(stat_value); + } + else + { + LL_WARNS() << "Unknown sim stat identifier: " << stat_id << LL_ENDL; } } - /* - msg->getF32Fast(_PREHASH_Statistics, _PREHASH_PhysicsTimeDilation, time_dilation); - LLViewerStats::getInstance()->mSimTDStat.addValue(time_dilation); - - // Process information - // { CpuUsage F32 } - // { SimMemTotal F32 } - // { SimMemRSS F32 } - // { ProcessUptime F32 } - F32 cpu_usage; - F32 sim_mem_total; - F32 sim_mem_rss; - F32 process_uptime; - msg->getF32Fast(_PREHASH_Statistics, _PREHASH_CpuUsage, cpu_usage); - msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemTotal, sim_mem_total); - msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemRSS, sim_mem_rss); - msg->getF32Fast(_PREHASH_Statistics, _PREHASH_ProcessUptime, process_uptime); - LLViewerStats::getInstance()->mSimCPUUsageStat.addValue(cpu_usage); - LLViewerStats::getInstance()->mSimMemTotalStat.addValue(sim_mem_total); - LLViewerStats::getInstance()->mSimMemRSSStat.addValue(sim_mem_rss); - */ - // // Various hacks that aren't statistics, but are being handled here. // @@ -5533,8 +5424,8 @@ static std::string reason_from_transaction_type(S32 transaction_type, return std::string(); default: - llwarns << "Unknown transaction type " - << transaction_type << llendl; + LL_WARNS() << "Unknown transaction type " + << transaction_type << LL_ENDL; return std::string(); } } @@ -5910,7 +5801,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) std::istringstream llsdData(llsdRaw); if (!LLSDSerialize::deserialize(llsdBlock, llsdData, llsdRaw.length())) { - llwarns << "attempt_standard_notification: Attempted to read notification parameter data into LLSD but failed:" << llsdRaw << llendl; + LL_WARNS() << "attempt_standard_notification: Attempted to read notification parameter data into LLSD but failed:" << llsdRaw << LL_ENDL; } } @@ -5960,7 +5851,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) snap_filename += SCREEN_HOME_FILENAME; gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE); } - + if (notificationID == "RegionRestartMinutes" || notificationID == "RegionRestartSeconds") { @@ -6008,7 +5899,7 @@ static void process_special_alert_messages(const std::string & message) // text should be altered in the notifications.xml files. if ( message == "You died and have been teleported to your home location") { - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_KILLED_COUNT); + add(LLStatViewer::KILLED, 1); } else if( message == "Home position set." ) { @@ -6120,10 +6011,10 @@ void process_alert_core(const std::string& message, BOOL modal) LLFloaterRegionRestarting::close(); } - std::string new_msg =LLNotifications::instance().getGlobalString(text); - args["MESSAGE"] = new_msg; - LLNotificationsUtil::add("SystemMessage", args); - } + std::string new_msg =LLNotifications::instance().getGlobalString(text); + args["MESSAGE"] = new_msg; + LLNotificationsUtil::add("SystemMessage", args); + } else if (modal) { LLSD args; @@ -6737,7 +6628,7 @@ void process_teleport_failed(LLMessageSystem *msg, void**) std::istringstream llsd_data(llsd_raw); if (!LLSDSerialize::deserialize(llsd_block, llsd_data, llsd_raw.length())) { - llwarns << "process_teleport_failed: Attempted to read alert parameter data into LLSD but failed:" << llsd_raw << llendl; + LL_WARNS() << "process_teleport_failed: Attempted to read alert parameter data into LLSD but failed:" << llsd_raw << LL_ENDL; } else { @@ -6980,7 +6871,7 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response) void handle_lure(const LLUUID& invitee) { - LLDynamicArray<LLUUID> ids; + std::vector<LLUUID> ids; ids.push_back(invitee); handle_lure(ids); } @@ -6996,7 +6887,7 @@ void handle_lure(const uuid_vec_t& ids) edit_args["REGION"] = gAgent.getRegion()->getName(); LLSD payload; - for (LLDynamicArray<LLUUID>::const_iterator it = ids.begin(); + for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) { @@ -7017,7 +6908,7 @@ bool teleport_request_callback(const LLSD& notification, const LLSD& response) LLUUID from_id = notification["payload"]["from_id"].asUUID(); if(from_id.isNull()) { - llwarns << "from_id is NULL" << llendl; + LL_WARNS() << "from_id is NULL" << LL_ENDL; return false; } @@ -7253,7 +7144,7 @@ void process_script_dialog(LLMessageSystem* msg, void**) S32 button_count = msg->getNumberOfBlocks("Buttons"); if (button_count > SCRIPT_DIALOG_MAX_BUTTONS) { - llwarns << "Too many script dialog buttons - omitting some" << llendl; + LL_WARNS() << "Too many script dialog buttons - omitting some" << LL_ENDL; button_count = SCRIPT_DIALOG_MAX_BUTTONS; } @@ -7413,7 +7304,7 @@ void process_initiate_download(LLMessageSystem* msg, void**) if (!gXferManager->validateFileForRequest(viewer_filename)) { - llwarns << "SECURITY: Unauthorized download to local file " << viewer_filename << llendl; + LL_WARNS() << "SECURITY: Unauthorized download to local file " << viewer_filename << LL_ENDL; return; } gXferManager->requestFile(viewer_filename, @@ -7443,10 +7334,10 @@ void process_script_teleport_request(LLMessageSystem* msg, void**) LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance(); if(instance) { - llinfos << "Object named " << object_name + LL_INFOS() << "Object named " << object_name << " is offering TP to region " << sim_name << " position " << pos - << llendl; + << LL_ENDL; instance->trackURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]); LLFloaterReg::showInstance("world_map", "center"); @@ -7592,8 +7483,6 @@ void onCovenantLoadComplete(LLVFS *vfs, } else { - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index 3237f3fbdddca44e8b90c301592aa2cfba8eee67..d8f5c71f8d3bfff2a6b7c30e43832d939a81215d 100755 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -33,7 +33,6 @@ #include "lltransactiontypes.h" #include "lluuid.h" #include "message.h" -#include "stdenums.h" #include "llnotifications.h" #include "llextendedstatus.h" diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index e7821d4b9e489a43692d3b7013f1a95497d501e5..faa58d423f39aad36d2171bd8f62dc87e64c03c0 100755 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -550,7 +550,7 @@ std::string LLGridManager::getUpdateServiceURL() std::string update_url_base = gSavedSettings.getString("CmdLineUpdateService");; if ( !update_url_base.empty() ) { - LL_INFOS2("UpdaterService","GridManager") + LL_INFOS("UpdaterService","GridManager") << "Update URL base overridden from command line: " << update_url_base << LL_ENDL; } @@ -560,7 +560,7 @@ std::string LLGridManager::getUpdateServiceURL() } else { - LL_WARNS2("UpdaterService","GridManager") + LL_WARNS("UpdaterService","GridManager") << "The grid property '" << GRID_UPDATE_SERVICE_URL << "' is not defined for the grid '" << mGrid << "'" << LL_ENDL; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index c789719291eb884e323d37b8f214b5311d4079c4..1dabe0794272753096e80202da46b30e6c849d98 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -29,7 +29,6 @@ #include "llviewerobject.h" #include "llaudioengine.h" -#include "imageids.h" #include "indra_constants.h" #include "llmath.h" #include "llflexibleobject.h" @@ -39,6 +38,7 @@ #include "llfloaterreg.h" #include "llfontgl.h" #include "llframetimer.h" +#include "llhudicon.h" #include "llinventory.h" #include "llinventorydefines.h" #include "llmaterialtable.h" @@ -52,7 +52,6 @@ #include "llxfermanager.h" #include "message.h" #include "object_flags.h" -#include "timing.h" #include "llaudiosourcevo.h" #include "llagent.h" @@ -100,6 +99,7 @@ #include "lltrans.h" #include "llsdutil.h" #include "llmediaentry.h" +#include "llvocache.h" //#define DEBUG_UPDATE_TYPE @@ -112,21 +112,33 @@ BOOL LLViewerObject::sMapDebug = TRUE; LLColor4 LLViewerObject::sEditSelectColor( 1.0f, 1.f, 0.f, 0.3f); // Edit OK LLColor4 LLViewerObject::sNoEditSelectColor( 1.0f, 0.f, 0.f, 0.3f); // Can't edit S32 LLViewerObject::sAxisArrowLength(50); + + BOOL LLViewerObject::sPulseEnabled(FALSE); BOOL LLViewerObject::sUseSharedDrawables(FALSE); // TRUE // sMaxUpdateInterpolationTime must be greater than sPhaseOutUpdateInterpolationTime -F64 LLViewerObject::sMaxUpdateInterpolationTime = 3.0; // For motion interpolation: after X seconds with no updates, don't predict object motion -F64 LLViewerObject::sPhaseOutUpdateInterpolationTime = 2.0; // For motion interpolation: after Y seconds with no updates, taper off motion prediction +F64Seconds LLViewerObject::sMaxUpdateInterpolationTime(3.0); // For motion interpolation: after X seconds with no updates, don't predict object motion +F64Seconds LLViewerObject::sPhaseOutUpdateInterpolationTime(2.0); // For motion interpolation: after Y seconds with no updates, taper off motion prediction + +std::map<std::string, U32> LLViewerObject::sObjectDataMap; + +// The maximum size of an object extra parameters binary (packed) block +#define MAX_OBJECT_PARAMS_SIZE 1024 +// At 45 Hz collisions seem stable and objects seem +// to settle down at a reasonable rate. +// JC 3/18/2003 -static LLFastTimer::DeclareTimer FTM_CREATE_OBJECT("Create Object"); +const F32 PHYSICS_TIMESTEP = 1.f / 45.f; + +static LLTrace::BlockTimerStatHandle FTM_CREATE_OBJECT("Create Object"); // static LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) { LLViewerObject *res = NULL; - LLFastTimer t1(FTM_CREATE_OBJECT); + LL_RECORD_BLOCK_TIME(FTM_CREATE_OBJECT); switch (pcode) { @@ -161,13 +173,13 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco case LL_PCODE_LEGACY_GRASS: res = new LLVOGrass(id, pcode, regionp); break; case LL_PCODE_LEGACY_PART_SYS: -// llwarns << "Creating old part sys!" << llendl; +// LL_WARNS() << "Creating old part sys!" << LL_ENDL; // res = new LLVOPart(id, pcode, regionp); break; res = NULL; break; case LL_PCODE_LEGACY_TREE: res = new LLVOTree(id, pcode, regionp); break; case LL_PCODE_TREE_NEW: -// llwarns << "Creating new tree!" << llendl; +// LL_WARNS() << "Creating new tree!" << LL_ENDL; // res = new LLVOTree(id, pcode, regionp); break; res = NULL; break; case LL_VO_SURFACE_PATCH: @@ -187,14 +199,15 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco case LL_VO_WL_SKY: res = new LLVOWLSky(id, pcode, regionp); break; default: - llwarns << "Unknown object pcode " << (S32)pcode << llendl; + LL_WARNS() << "Unknown object pcode " << (S32)pcode << LL_ENDL; res = NULL; break; } return res; } LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global) -: LLPrimitive(), +: LLTrace::MemTrackable<LLViewerObject>("LLViewerObject"), + LLPrimitive(), mChildList(), mID(id), mLocalID(0), @@ -340,7 +353,7 @@ void LLViewerObject::markDead() { if (!mDead) { - //llinfos << "Marking self " << mLocalID << " as dead." << llendl; + //LL_INFOS() << "Marking self " << mLocalID << " as dead." << LL_ENDL; // Root object of this hierarchy unlinks itself. if (getParent()) @@ -350,6 +363,10 @@ void LLViewerObject::markDead() // Mark itself as dead mDead = TRUE; + if(mRegionp) + { + mRegionp->removeFromCreatedList(getLocalID()); + } gObjectList.cleanupReferences(this); LLViewerObject *childp; @@ -358,7 +375,7 @@ void LLViewerObject::markDead() childp = mChildList.back(); if (childp->getPCode() != LL_PCODE_LEGACY_AVATAR) { - //llinfos << "Marking child " << childp->getLocalID() << " as dead." << llendl; + //LL_INFOS() << "Marking child " << childp->getLocalID() << " as dead." << LL_ENDL; childp->setParent(NULL); // LLViewerObject::markDead 1 childp->markDead(); } @@ -428,17 +445,17 @@ void LLViewerObject::markDead() void LLViewerObject::dump() const { - llinfos << "Type: " << pCodeToString(mPrimitiveCode) << llendl; - llinfos << "Drawable: " << (LLDrawable *)mDrawable << llendl; - llinfos << "Update Age: " << LLFrameTimer::getElapsedSeconds() - mLastMessageUpdateSecs << llendl; - - llinfos << "Parent: " << getParent() << llendl; - llinfos << "ID: " << mID << llendl; - llinfos << "LocalID: " << mLocalID << llendl; - llinfos << "PositionRegion: " << getPositionRegion() << llendl; - llinfos << "PositionAgent: " << getPositionAgent() << llendl; - llinfos << "PositionGlobal: " << getPositionGlobal() << llendl; - llinfos << "Velocity: " << getVelocity() << llendl; + LL_INFOS() << "Type: " << pCodeToString(mPrimitiveCode) << LL_ENDL; + LL_INFOS() << "Drawable: " << (LLDrawable *)mDrawable << LL_ENDL; + LL_INFOS() << "Update Age: " << LLFrameTimer::getElapsedSeconds() - mLastMessageUpdateSecs << LL_ENDL; + + LL_INFOS() << "Parent: " << getParent() << LL_ENDL; + LL_INFOS() << "ID: " << mID << LL_ENDL; + LL_INFOS() << "LocalID: " << mLocalID << LL_ENDL; + LL_INFOS() << "PositionRegion: " << getPositionRegion() << LL_ENDL; + LL_INFOS() << "PositionAgent: " << getPositionAgent() << LL_ENDL; + LL_INFOS() << "PositionGlobal: " << getPositionGlobal() << LL_ENDL; + LL_INFOS() << "Velocity: " << getVelocity() << LL_ENDL; if (mDrawable.notNull() && mDrawable->getNumFaces() && mDrawable->getFace(0)) @@ -446,31 +463,31 @@ void LLViewerObject::dump() const LLFacePool *poolp = mDrawable->getFace(0)->getPool(); if (poolp) { - llinfos << "Pool: " << poolp << llendl; - llinfos << "Pool reference count: " << poolp->mReferences.size() << llendl; + LL_INFOS() << "Pool: " << poolp << LL_ENDL; + LL_INFOS() << "Pool reference count: " << poolp->mReferences.size() << LL_ENDL; } } - //llinfos << "BoxTree Min: " << mDrawable->getBox()->getMin() << llendl; - //llinfos << "BoxTree Max: " << mDrawable->getBox()->getMin() << llendl; + //LL_INFOS() << "BoxTree Min: " << mDrawable->getBox()->getMin() << LL_ENDL; + //LL_INFOS() << "BoxTree Max: " << mDrawable->getBox()->getMin() << LL_ENDL; /* - llinfos << "Velocity: " << getVelocity() << llendl; - llinfos << "AnyOwner: " << permAnyOwner() << " YouOwner: " << permYouOwner() << " Edit: " << mPermEdit << llendl; - llinfos << "UsePhysics: " << flagUsePhysics() << " CanSelect " << mbCanSelect << " UserSelected " << mUserSelected << llendl; - llinfos << "AppAngle: " << mAppAngle << llendl; - llinfos << "PixelArea: " << mPixelArea << llendl; + LL_INFOS() << "Velocity: " << getVelocity() << LL_ENDL; + LL_INFOS() << "AnyOwner: " << permAnyOwner() << " YouOwner: " << permYouOwner() << " Edit: " << mPermEdit << LL_ENDL; + LL_INFOS() << "UsePhysics: " << flagUsePhysics() << " CanSelect " << mbCanSelect << " UserSelected " << mUserSelected << LL_ENDL; + LL_INFOS() << "AppAngle: " << mAppAngle << LL_ENDL; + LL_INFOS() << "PixelArea: " << mPixelArea << LL_ENDL; char buffer[1000]; char *key; for (key = mNameValuePairs.getFirstKey(); key; key = mNameValuePairs.getNextKey() ) { mNameValuePairs[key]->printNameValue(buffer); - llinfos << buffer << llendl; + LL_INFOS() << buffer << LL_ENDL; } for (child_list_t::iterator iter = mChildList.begin(); iter != mChildList.end(); iter++) { LLViewerObject* child = *iter; - llinfos << " child " << child->getID() << llendl; + LL_INFOS() << " child " << child->getID() << LL_ENDL; } */ } @@ -481,7 +498,7 @@ void LLViewerObject::printNameValuePairs() const iter != mNameValuePairs.end(); iter++) { LLNameValue* nv = iter->second; - llinfos << nv->printNameValue() << llendl; + LL_INFOS() << nv->printNameValue() << LL_ENDL; } } @@ -490,10 +507,12 @@ void LLViewerObject::initVOClasses() // Initialized shared class stuff first. LLVOAvatar::initClass(); LLVOTree::initClass(); - llinfos << "Viewer Object size: " << sizeof(LLViewerObject) << llendl; + LL_INFOS() << "Viewer Object size: " << sizeof(LLViewerObject) << LL_ENDL; LLVOGrass::initClass(); LLVOWater::initClass(); LLVOVolume::initClass(); + + initObjectDataMap(); } void LLViewerObject::cleanupVOClasses() @@ -503,6 +522,118 @@ void LLViewerObject::cleanupVOClasses() LLVOTree::cleanupClass(); LLVOAvatar::cleanupClass(); LLVOVolume::cleanupClass(); + + sObjectDataMap.clear(); +} + +//object data map for compressed && !OUT_TERSE_IMPROVED +//static +void LLViewerObject::initObjectDataMap() +{ + U32 count = 0; + + sObjectDataMap["ID"] = count; //full id //LLUUID + count += sizeof(LLUUID); + + sObjectDataMap["LocalID"] = count; //U32 + count += sizeof(U32); + + sObjectDataMap["PCode"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["State"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["CRC"] = count; //U32 + count += sizeof(U32); + + sObjectDataMap["Material"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["ClickAction"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["Scale"] = count; //LLVector3 + count += sizeof(LLVector3); + + sObjectDataMap["Pos"] = count; //LLVector3 + count += sizeof(LLVector3); + + sObjectDataMap["Rot"] = count; //LLVector3 + count += sizeof(LLVector3); + + sObjectDataMap["SpecialCode"] = count; //U32 + count += sizeof(U32); + + sObjectDataMap["Owner"] = count; //LLUUID + count += sizeof(LLUUID); + + sObjectDataMap["Omega"] = count; //LLVector3, when SpecialCode & 0x80 is set + count += sizeof(LLVector3); + + //ParentID is after Omega if there is Omega, otherwise is after Owner + sObjectDataMap["ParentID"] = count;//U32, when SpecialCode & 0x20 is set + count += sizeof(U32); + + //------- + //The rest items are not included here + //------- +} + +//static +void LLViewerObject::unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackVector3(value, name.c_str()); + dp->reset(); +} + +//static +void LLViewerObject::unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackUUID(value, name.c_str()); + dp->reset(); +} + +//static +void LLViewerObject::unpackU32(LLDataPackerBinaryBuffer* dp, U32& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackU32(value, name.c_str()); + dp->reset(); +} + +//static +void LLViewerObject::unpackU8(LLDataPackerBinaryBuffer* dp, U8& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackU8(value, name.c_str()); + dp->reset(); +} + +//static +U32 LLViewerObject::unpackParentID(LLDataPackerBinaryBuffer* dp, U32& parent_id) +{ + dp->shift(sObjectDataMap["SpecialCode"]); + U32 value; + dp->unpackU32(value, "SpecialCode"); + + parent_id = 0; + if(value & 0x20) + { + S32 offset = sObjectDataMap["ParentID"]; + if(!(value & 0x80)) + { + offset -= sizeof(LLVector3); + } + + dp->shift(offset); + dp->unpackU32(parent_id, "ParentID"); + } + dp->reset(); + + return parent_id; } // Replaces all name value pairs with data from \n delimited list @@ -613,7 +744,7 @@ void LLViewerObject::buildReturnablesForChildrenVO( std::vector<PotentialReturna { if ( !pChild ) { - llerrs<<"child viewerobject is NULL "<<llendl; + LL_ERRS()<<"child viewerobject is NULL "<<LL_ENDL; } constructAndAddReturnable( returnables, pChild, pTargetRegion ); @@ -894,26 +1025,47 @@ U32 LLViewerObject::checkMediaURL(const std::string &media_url) return retval; } +//extract spatial information from object update message +//return parent_id +//static +U32 LLViewerObject::extractSpatialExtents(LLDataPackerBinaryBuffer *dp, LLVector3& pos, LLVector3& scale, LLQuaternion& rot) +{ + U32 parent_id = 0; + LLViewerObject::unpackParentID(dp, parent_id); + + LLViewerObject::unpackVector3(dp, scale, "Scale"); + LLViewerObject::unpackVector3(dp, pos, "Pos"); + + LLVector3 vec; + LLViewerObject::unpackVector3(dp, vec, "Rot"); + rot.unpackFromVector3(vec); + + return parent_id; +} + U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp) { + LL_DEBUGS_ONCE("SceneLoadTiming") << "Received viewer object data" << LL_ENDL; + U32 retval = 0x0; // If region is removed from the list it is also deleted. if (!LLWorld::instance().isRegionListed(mRegionp)) { - llwarns << "Updating object in an invalid region" << llendl; + LL_WARNS() << "Updating object in an invalid region" << LL_ENDL; return retval; } // Coordinates of objects on simulators are region-local. - U64 region_handle; - mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); + U64 region_handle = 0; + if(mesgsys != NULL) { + mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle); if(regionp != mRegionp && regionp && mRegionp)//region cross { @@ -926,6 +1078,17 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } else { + if(regionp != mRegionp) + { + if(mRegionp) + { + mRegionp->removeFromCreatedList(getLocalID()); + } + if(regionp) + { + regionp->addToCreatedList(getLocalID()); + } + } mRegionp = regionp ; } } @@ -935,14 +1098,18 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U32 x, y; from_region_handle(region_handle, &x, &y); - llerrs << "Object has invalid region " << x << ":" << y << "!" << llendl; + LL_ERRS() << "Object has invalid region " << x << ":" << y << "!" << LL_ENDL; return retval; } + F32 time_dilation = 1.f; + if(mesgsys != NULL) + { U16 time_dilation16; mesgsys->getU16Fast(_PREHASH_RegionData, _PREHASH_TimeDilation, time_dilation16); - F32 time_dilation = ((F32) time_dilation16) / 65535.f; + time_dilation = ((F32) time_dilation16) / 65535.f; mRegionp->setTimeDilation(time_dilation); + } // this will be used to determine if we've really changed position // Use getPosition, not getPositionRegion, since this is what we're comparing directly against. @@ -990,7 +1157,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, case OUT_FULL: { #ifdef DEBUG_UPDATE_TYPE - llinfos << "Full:" << getID() << llendl; + LL_INFOS() << "Full:" << getID() << LL_ENDL; #endif //clear cost and linkset cost mCostStale = true; @@ -1296,7 +1463,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, S32 param_size; dp.unpackU16(param_type, "param_type"); dp.unpackBinaryData(param_block, param_size, "param_data"); - //llinfos << "Param type: " << param_type << ", Size: " << param_size << llendl; + //LL_INFOS() << "Param type: " << param_type << ", Size: " << param_size << LL_ENDL; LLDataPackerBinaryBuffer dp2(param_block, param_size); unpackParameterEntry(param_type, &dp2); } @@ -1318,7 +1485,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, case OUT_TERSE_IMPROVED: { #ifdef DEBUG_UPDATE_TYPE - llinfos << "TI:" << getID() << llendl; + LL_INFOS() << "TI:" << getID() << LL_ENDL; #endif length = mesgsys->getSizeFast(_PREHASH_ObjectData, block_num, _PREHASH_ObjectData); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_ObjectData, data, length, block_num); @@ -1495,7 +1662,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, case OUT_TERSE_IMPROVED: { #ifdef DEBUG_UPDATE_TYPE - llinfos << "CompTI:" << getID() << llendl; + LL_INFOS() << "CompTI:" << getID() << LL_ENDL; #endif U8 value; dp->unpackU8(value, "agent"); @@ -1541,7 +1708,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, case OUT_FULL_CACHED: { #ifdef DEBUG_UPDATE_TYPE - llinfos << "CompFull:" << getID() << llendl; + LL_INFOS() << "CompFull:" << getID() << LL_ENDL; #endif mCostStale = true; @@ -1679,7 +1846,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, S32 param_size; dp->unpackU16(param_type, "param_type"); dp->unpackBinaryData(param_block, param_size, "param_data"); - //llinfos << "Param type: " << param_type << ", Size: " << param_size << llendl; + //LL_INFOS() << "Param type: " << param_type << ", Size: " << param_size << LL_ENDL; LLDataPackerBinaryBuffer dp2(param_block, param_size); unpackParameterEntry(param_type, &dp2); } @@ -1717,13 +1884,12 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Preload these five flags for every object. // Finer shades require the object to be selected, and the selection manager // stores the extended permission info. + if(mesgsys != NULL) + { U32 flags; mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, block_num); - // keep local flags and overwrite remote-controlled flags - mFlags = (mFlags & FLAGS_LOCAL) | flags; - - // ...new objects that should come in selected need to be added to the selected list - mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0); + loadFlags(flags); + } } break; @@ -1751,10 +1917,21 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, { // No parent now, new parent in message -> attach to that parent if possible LLUUID parent_uuid; + + if(mesgsys != NULL) + { LLViewerObjectList::getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort()); + } + else + { + LLViewerObjectList::getUUIDFromLocal(parent_uuid, + parent_id, + mRegionp->getHost().getAddress(), + mRegionp->getHost().getPort()); + } LLViewerObject *sent_parentp = gObjectList.findObject(parent_uuid); @@ -1764,7 +1941,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (sent_parentp && sent_parentp->getParent() == this) { // Try to recover if we attempt to attach a parent to its child - llwarns << "Attempt to attach a parent to it's child: " << this->getID() << " to " << sent_parentp->getID() << llendl; + LL_WARNS() << "Attempt to attach a parent to it's child: " << this->getID() << " to " << sent_parentp->getID() << LL_ENDL; this->removeChild(sent_parentp); sent_parentp->setDrawableParent(NULL); } @@ -1783,7 +1960,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, { if (mDrawable->isDead() || !mDrawable->getVObj()) { - llwarns << "Drawable is dead or no VObj!" << llendl; + LL_WARNS() << "Drawable is dead or no VObj!" << LL_ENDL; sent_parentp->addChild(this); } else @@ -1793,9 +1970,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Bad, we got a cycle somehow. // Kill both the parent and the child, and // set cache misses for both of them. - llwarns << "Attempting to recover from parenting cycle!" << llendl; - llwarns << "Killing " << sent_parentp->getID() << " and " << getID() << llendl; - llwarns << "Adding to cache miss list" << llendl; + LL_WARNS() << "Attempting to recover from parenting cycle!" << LL_ENDL; + LL_WARNS() << "Killing " << sent_parentp->getID() << " and " << getID() << LL_ENDL; + LL_WARNS() << "Adding to cache miss list" << LL_ENDL; setParent(NULL); sent_parentp->setParent(NULL); getRegion()->addCacheMissFull(getLocalID()); @@ -1830,9 +2007,18 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // //parent_id - U32 ip = mesgsys->getSenderIP(); - U32 port = mesgsys->getSenderPort(); + U32 ip, port; + if(mesgsys != NULL) + { + ip = mesgsys->getSenderIP(); + port = mesgsys->getSenderPort(); + } + else + { + ip = mRegionp->getHost().getAddress(); + port = mRegionp->getHost().getPort(); + } gObjectList.orphanize(this, parent_id, ip, port); // Hide particles, icon and HUD @@ -1853,7 +2039,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, //LLViewerObjectList::getUUIDFromLocal(parent_uuid, parent_id, mesgsys->getSenderIP(), mesgsys->getSenderPort() ); //if (parent_uuid != cur_parentp->getID() ) //{ - // llerrs << "Local ID match but UUID mismatch of viewer object" << llendl; + // LL_ERRS() << "Local ID match but UUID mismatch of viewer object" << LL_ENDL; //} } else @@ -1870,10 +2056,21 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, else { LLUUID parent_uuid; + + if(mesgsys != NULL) + { LLViewerObjectList::getUUIDFromLocal(parent_uuid, parent_id, gMessageSystem->getSenderIP(), gMessageSystem->getSenderPort()); + } + else + { + LLViewerObjectList::getUUIDFromLocal(parent_uuid, + parent_id, + mRegionp->getHost().getAddress(), + mRegionp->getHost().getPort()); + } sent_parentp = gObjectList.findObject(parent_uuid); if (isAvatar()) @@ -1894,8 +2091,18 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // Switching parents, but we don't know the new parent. // - U32 ip = mesgsys->getSenderIP(); - U32 port = mesgsys->getSenderPort(); + U32 ip, port; + + if(mesgsys != NULL) + { + ip = mesgsys->getSenderIP(); + port = mesgsys->getSenderPort(); + } + else + { + ip = mRegionp->getHost().getAddress(); + port = mRegionp->getHost().getPort(); + } // We're an orphan, flag things appropriately. gObjectList.orphanize(this, parent_id, ip, port); @@ -1914,9 +2121,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Bad, we got a cycle somehow. // Kill both the parent and the child, and // set cache misses for both of them. - llwarns << "Attempting to recover from parenting cycle!" << llendl; - llwarns << "Killing " << sent_parentp->getID() << " and " << getID() << llendl; - llwarns << "Adding to cache miss list" << llendl; + LL_WARNS() << "Attempting to recover from parenting cycle!" << LL_ENDL; + LL_WARNS() << "Killing " << sent_parentp->getID() << " and " << getID() << LL_ENDL; + LL_WARNS() << "Adding to cache miss list" << LL_ENDL; setParent(NULL); sent_parentp->setParent(NULL); getRegion()->addCacheMissFull(getLocalID()); @@ -1948,7 +2155,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // This is probably an object flying across a region boundary, the // object probably ISN'T being reparented, but just got an object // update out of order (child update before parent). - //llinfos << "Don't reparent object handoffs!" << llendl; + //LL_INFOS() << "Don't reparent object handoffs!" << LL_ENDL; remove_parent = false; } } @@ -1979,18 +2186,18 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, new_rot.normQuat(); - if (sPingInterpolate) + if (sPingInterpolate && mesgsys != NULL) { LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mesgsys->getSender()); if (cdp) { - F32 ping_delay = 0.5f * time_dilation * ( ((F32)cdp->getPingDelay()) * 0.001f + gFrameDTClamped); + F32 ping_delay = 0.5f * time_dilation * ( ((F32)cdp->getPingDelay().valueInUnits<LLUnits::Seconds>()) + gFrameDTClamped); LLVector3 diff = getVelocity() * ping_delay; new_pos_parent += diff; } else { - llwarns << "findCircuit() returned NULL; skipping interpolation" << llendl; + LL_WARNS() << "findCircuit() returned NULL; skipping interpolation" << LL_ENDL; } } @@ -2002,6 +2209,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // If we're going to skip this message, why are we // doing all the parenting, etc above? + if(mesgsys != NULL) + { U32 packet_id = mesgsys->getCurrentRecvPacketID(); if (packet_id < mLatestRecvPacketID && mLatestRecvPacketID - packet_id < 65536) @@ -2009,8 +2218,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, //skip application of this message, it's old return retval; } - mLatestRecvPacketID = packet_id; + } // Set the change flags for scale if (new_scale != getScale()) @@ -2042,7 +2251,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } else { - llwarns << "Can not move the object/avatar to an infinite location!" << llendl ; + LL_WARNS() << "Can not move the object/avatar to an infinite location!" << LL_ENDL ; retval |= INVALID_UPDATE ; } @@ -2058,7 +2267,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // If we're snapping the position by more than 0.5m, update LLViewerStats::mAgentPositionSnaps if ( asAvatar() && asAvatar()->isSelf() && (mag_sqr > 0.25f) ) { - LLViewerStats::getInstance()->mAgentPositionSnaps.push( diff.length() ); + record(LLStatViewer::AGENT_POSITION_SNAP, LLUnit<F64, LLUnits::Meters>(diff.length())); } } @@ -2159,7 +2368,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Don't clear invisibility flag on update if still orphaned! if (mDrawable->isState(LLDrawable::FORCE_INVISIBLE) && !mOrphaned) { -// lldebugs << "Clearing force invisible: " << mID << ":" << getPCodeString() << ":" << getPositionAgent() << llendl; +// LL_DEBUGS() << "Clearing force invisible: " << mID << ":" << getPCodeString() << ":" << getPositionAgent() << LL_ENDL; mDrawable->clearState(LLDrawable::FORCE_INVISIBLE); gPipeline.markRebuild( mDrawable, LLDrawable::REBUILD_ALL, TRUE ); } @@ -2181,12 +2390,26 @@ BOOL LLViewerObject::isActive() const return TRUE; } +//load flags from cache or from message +void LLViewerObject::loadFlags(U32 flags) +{ + if(flags == (U32)(-1)) + { + return; //invalid + } + + // keep local flags and overwrite remote-controlled flags + mFlags = (mFlags & FLAGS_LOCAL) | flags; + // ...new objects that should come in selected need to be added to the selected list + mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0); + return; +} void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &time) { - //static LLFastTimer::DeclareTimer ftm("Viewer Object"); - //LLFastTimer t(ftm); + //static LLTrace::BlockTimerStatHandle ftm("Viewer Object"); + //LL_RECORD_BLOCK_TIME(ftm); if (!mDead) { @@ -2194,13 +2417,14 @@ void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &time) { // calculate dt from last update F32 time_dilation = mRegionp ? mRegionp->getTimeDilation() : 1.0f; - F32 dt = time_dilation * (F32)(time - mLastInterpUpdateSecs); + F32 dt_raw = ((F64Seconds)time - mLastInterpUpdateSecs).value(); + F32 dt = time_dilation * dt_raw; applyAngularVelocity(dt); if (isAttachment()) { - mLastInterpUpdateSecs = time; + mLastInterpUpdateSecs = (F64Seconds)time; return; } else @@ -2214,8 +2438,8 @@ void LLViewerObject::idleUpdate(LLAgent &agent, const F64 &time) } -// Move an object due to idle-time viewer side updates by iterpolating motion -void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) +// Move an object due to idle-time viewer side updates by interpolating motion +void LLViewerObject::interpolateLinearMotion(const F64SecondsImplicit& time, const F32SecondsImplicit& dt_seconds) { // linear motion // PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object @@ -2226,8 +2450,9 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) // to see if object is selected, instead of explicitly // zeroing it out - F64 time_since_last_update = time - mLastMessageUpdateSecs; - if (time_since_last_update <= 0.0 || dt <= 0.f) + F32 dt = dt_seconds; + F64Seconds time_since_last_update = time - mLastMessageUpdateSecs; + if (time_since_last_update <= (F64Seconds)0.0 || dt <= 0.f) { return; } @@ -2235,7 +2460,7 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) LLVector3 accel = getAcceleration(); LLVector3 vel = getVelocity(); - if (sMaxUpdateInterpolationTime <= 0.0) + if (sMaxUpdateInterpolationTime <= (F64Seconds)0.0) { // Old code path ... unbounded, simple interpolation if (!(accel.isExactlyZero() && vel.isExactlyZero())) { @@ -2257,8 +2482,8 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) LLVector3 new_v = accel * dt; if (time_since_last_update > sPhaseOutUpdateInterpolationTime && - sPhaseOutUpdateInterpolationTime > 0.0) - { // Haven't seen a viewer update in a while, check to see if the ciruit is still active + sPhaseOutUpdateInterpolationTime > (F64Seconds)0.0) + { // Haven't seen a viewer update in a while, check to see if the circuit is still active if (mRegionp) { // The simulator will NOT send updates if the object continues normally on the path // predicted by the velocity and the acceleration (often gravity) sent to the viewer @@ -2267,19 +2492,19 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) if (cdp) { // Find out how many seconds since last packet arrived on the circuit - F64 time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime(); + F64Seconds time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime(); if (!cdp->isAlive() || // Circuit is dead or blocked cdp->isBlocked() || // or doesn't seem to be getting any packets (time_since_last_packet > sPhaseOutUpdateInterpolationTime)) { // Start to reduce motion interpolation since we haven't seen a server update in a while - F64 time_since_last_interpolation = time - mLastInterpUpdateSecs; + F64Seconds time_since_last_interpolation = time - mLastInterpUpdateSecs; F64 phase_out = 1.0; if (time_since_last_update > sMaxUpdateInterpolationTime) { // Past the time limit, so stop the object phase_out = 0.0; - //llinfos << "Motion phase out to zero" << llendl; + //LL_INFOS() << "Motion phase out to zero" << LL_ENDL; // Kill angular motion as well. Note - not adding this due to paranoia // about stopping rotation for llTargetOmega objects and not having it restart @@ -2289,13 +2514,13 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) { // Last update was already phased out a bit phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) / (sMaxUpdateInterpolationTime - time_since_last_interpolation); - //llinfos << "Continuing motion phase out of " << (F32) phase_out << llendl; + //LL_INFOS() << "Continuing motion phase out of " << (F32) phase_out << LL_ENDL; } else { // Phase out from full value phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) / (sMaxUpdateInterpolationTime - sPhaseOutUpdateInterpolationTime); - //llinfos << "Starting motion phase out of " << (F32) phase_out << llendl; + //LL_INFOS() << "Starting motion phase out of " << (F32) phase_out << LL_ENDL; } phase_out = llclamp(phase_out, 0.0, 1.0); @@ -2340,8 +2565,8 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) if (clip_pos_global != new_pos_global) { // Was clipped, so this means we hit a edge where there is no region to enter - //llinfos << "Hit empty region edge, clipped predicted position to " << mRegionp->getPosRegionFromGlobal(clip_pos_global) - // << " from " << new_pos << llendl; + //LL_INFOS() << "Hit empty region edge, clipped predicted position to " << mRegionp->getPosRegionFromGlobal(clip_pos_global) + // << " from " << new_pos << LL_ENDL; new_pos = mRegionp->getPosRegionFromGlobal(clip_pos_global); // Stop motion and get server update for bouncing on the edge @@ -2350,7 +2575,7 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) } else { // Let predicted movement cross into another region - //llinfos << "Predicting region crossing to " << new_pos << llendl; + //LL_INFOS() << "Predicting region crossing to " << new_pos << LL_ENDL; } } @@ -2498,7 +2723,7 @@ void LLViewerObject::saveScript( * XXXPAM Investigate not making this copy. Seems unecessary, but I'm unsure about the * interaction with doUpdateInventory() called below. */ - lldebugs << "LLViewerObject::saveScript() " << item->getUUID() << " " << item->getAssetUUID() << llendl; + LL_DEBUGS() << "LLViewerObject::saveScript() " << item->getUUID() << " " << item->getAssetUUID() << LL_ENDL; LLPointer<LLViewerInventoryItem> task_item = new LLViewerInventoryItem(item->getUUID(), mID, item->getPermissions(), item->getAssetUUID(), item->getType(), @@ -2529,7 +2754,7 @@ void LLViewerObject::saveScript( void LLViewerObject::moveInventory(const LLUUID& folder_id, const LLUUID& item_id) { - lldebugs << "LLViewerObject::moveInventory " << item_id << llendl; + LL_DEBUGS() << "LLViewerObject::moveInventory " << item_id << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_MoveTaskInventory); msg->nextBlockFast(_PREHASH_AgentData); @@ -2646,12 +2871,12 @@ struct LLFilenameAndTask LLFilenameAndTask() { ++sCount; - lldebugs << "Constructing LLFilenameAndTask: " << sCount << llendl; + LL_DEBUGS() << "Constructing LLFilenameAndTask: " << sCount << LL_ENDL; } ~LLFilenameAndTask() { --sCount; - lldebugs << "Destroying LLFilenameAndTask: " << sCount << llendl; + LL_DEBUGS() << "Destroying LLFilenameAndTask: " << sCount << LL_ENDL; } private: LLFilenameAndTask(const LLFilenameAndTask& rhs); @@ -2671,8 +2896,8 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) LLViewerObject* object = gObjectList.findObject(task_id); if(!object) { - llwarns << "LLViewerObject::processTaskInv object " - << task_id << " does not exist." << llendl; + LL_WARNS() << "LLViewerObject::processTaskInv object " + << task_id << " does not exist." << LL_ENDL; return; } @@ -2686,7 +2911,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data) if(ft->mFilename.empty()) { - lldebugs << "Task has no inventory" << llendl; + LL_DEBUGS() << "Task has no inventory" << LL_ENDL; // mock up some inventory to make a drop target. if(object->mInventory) { @@ -2746,15 +2971,15 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS // MAINT-2597 - crash when trying to edit a no-mod object // Somehow get an contents inventory response, but with an invalid stream (possibly 0 size?) // Stated repro was specific to no-mod objects so failing without user interaction should be safe. - llwarns << "Trying to load invalid task inventory file. Ignoring file contents." << llendl; + LL_WARNS() << "Trying to load invalid task inventory file. Ignoring file contents." << LL_ENDL; } } else { // This Occurs When to requests were made, and the first one // has already handled it. - lldebugs << "Problem loading task inventory. Return code: " - << error_code << llendl; + LL_DEBUGS() << "Problem loading task inventory. Return code: " + << error_code << LL_ENDL; } delete ft; } @@ -2795,8 +3020,8 @@ BOOL LLViewerObject::loadTaskInvFile(const std::string& filename) } else { - llwarns << "Unknown token in inventory file '" - << keyword << "'" << llendl; + LL_WARNS() << "Unknown token in inventory file '" + << keyword << "'" << LL_ENDL; } } ifs.close(); @@ -2804,8 +3029,8 @@ BOOL LLViewerObject::loadTaskInvFile(const std::string& filename) } else { - llwarns << "unable to load task inventory: " << filename_and_local_path - << llendl; + LL_WARNS() << "unable to load task inventory: " << filename_and_local_path + << LL_ENDL; return FALSE; } doInventoryCallback(); @@ -2829,7 +3054,7 @@ void LLViewerObject::doInventoryCallback() } else { - llinfos << "LLViewerObject::doInventoryCallback() deleting bad listener entry." << llendl; + LL_INFOS() << "LLViewerObject::doInventoryCallback() deleting bad listener entry." << LL_ENDL; delete info; mInventoryCallbacks.erase(curiter); } @@ -2977,7 +3202,7 @@ LLInventoryObject* LLViewerObject::getInventoryRoot() LLViewerInventoryItem* LLViewerObject::getInventoryItemByAsset(const LLUUID& asset_id) { if (mInventoryDirty) - llwarns << "Peforming inventory lookup for object " << mID << " that has dirty inventory!" << llendl; + LL_WARNS() << "Peforming inventory lookup for object " << mID << " that has dirty inventory!" << LL_ENDL; LLViewerInventoryItem* rv = NULL; if(mInventory) @@ -3382,7 +3607,7 @@ void LLViewerObject::addNVPair(const std::string& data) // char splat[MAX_STRING]; // temp->printNameValue(splat); -// llinfos << "addNVPair " << splat << llendl; +// LL_INFOS() << "addNVPair " << splat << LL_ENDL; name_value_map_t::iterator iter = mNameValuePairs.find(nv->mName); if (iter != mNameValuePairs.end()) @@ -3396,7 +3621,7 @@ void LLViewerObject::addNVPair(const std::string& data) else { delete nv; -// llinfos << "Trying to write to Read Only NVPair " << temp->mName << " in addNVPair()" << llendl; +// LL_INFOS() << "Trying to write to Read Only NVPair " << temp->mName << " in addNVPair()" << LL_ENDL; return; } } @@ -3407,7 +3632,7 @@ BOOL LLViewerObject::removeNVPair(const std::string& name) { char* canonical_name = gNVNameTable.addString(name); - lldebugs << "LLViewerObject::removeNVPair(): " << name << llendl; + LL_DEBUGS() << "LLViewerObject::removeNVPair(): " << name << LL_ENDL; name_value_map_t::iterator iter = mNameValuePairs.find(canonical_name); if (iter != mNameValuePairs.end()) @@ -3433,7 +3658,7 @@ BOOL LLViewerObject::removeNVPair(const std::string& name) } else { - lldebugs << "removeNVPair - No region for object" << llendl; + LL_DEBUGS() << "removeNVPair - No region for object" << LL_ENDL; } } return FALSE; @@ -4213,7 +4438,7 @@ S32 LLViewerObject::setTEColor(const U8 te, const LLColor4& color) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (color != tep->getColor()) { @@ -4233,7 +4458,7 @@ S32 LLViewerObject::setTEBumpmap(const U8 te, const U8 bump) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (bump != tep->getBumpmap()) { @@ -4254,7 +4479,7 @@ S32 LLViewerObject::setTETexGen(const U8 te, const U8 texgen) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (texgen != tep->getTexGen()) { @@ -4270,7 +4495,7 @@ S32 LLViewerObject::setTEMediaTexGen(const U8 te, const U8 media) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (media != tep->getMediaTexGen()) { @@ -4286,7 +4511,7 @@ S32 LLViewerObject::setTEShiny(const U8 te, const U8 shiny) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (shiny != tep->getShiny()) { @@ -4302,7 +4527,7 @@ S32 LLViewerObject::setTEFullbright(const U8 te, const U8 fullbright) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (fullbright != tep->getFullbright()) { @@ -4324,7 +4549,7 @@ S32 LLViewerObject::setTEMediaFlags(const U8 te, const U8 media_flags) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (media_flags != tep->getMediaFlags()) { @@ -4347,7 +4572,7 @@ S32 LLViewerObject::setTEGlow(const U8 te, const F32 glow) const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; } else if (glow != tep->getGlow()) { @@ -4390,7 +4615,7 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri const LLTextureEntry *tep = getTE(te); if (!tep) { - llwarns << "No texture entry for te " << (S32)te << ", object " << mID << llendl; + LL_WARNS() << "No texture entry for te " << (S32)te << ", object " << mID << LL_ENDL; return 0; } @@ -4509,7 +4734,7 @@ LLViewerTexture *LLViewerObject::getTEImage(const U8 face) const } } - llerrs << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << llendl; + LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL; return NULL; } @@ -4531,7 +4756,7 @@ bool LLViewerObject::isImageAlphaBlended(const U8 te) const case GL_RGB: break; default: { - llwarns << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << llendl; + LL_WARNS() << "Unexpected tex format in LLViewerObject::isImageAlphaBlended...returning no alpha." << LL_ENDL; } break; } @@ -4556,7 +4781,7 @@ LLViewerTexture *LLViewerObject::getTENormalMap(const U8 face) const } } - llerrs << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << llendl; + LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL; return NULL; } @@ -4578,14 +4803,14 @@ LLViewerTexture *LLViewerObject::getTESpecularMap(const U8 face) const } } - llerrs << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << llendl; + LL_ERRS() << llformat("Requested Image from invalid face: %d/%d",face,getNumTEs()) << LL_ENDL; return NULL; } void LLViewerObject::fitFaceTexture(const U8 face) { - llinfos << "fitFaceTexture not implemented" << llendl; + LL_INFOS() << "fitFaceTexture not implemented" << LL_ENDL; } @@ -4834,7 +5059,7 @@ void LLViewerObject::unpackParticleSource(const S32 block_num, const LLUUID& own // We need to be able to deal with a particle source that hasn't changed, but still got an update! if (pss) { -// llinfos << "Making particle system with owner " << owner_id << llendl; +// LL_INFOS() << "Making particle system with owner " << owner_id << LL_ENDL; pss->setOwnerUUID(owner_id); mPartSourcep = pss; LLViewerPartSim::getInstance()->addPartSource(pss); @@ -4881,7 +5106,7 @@ void LLViewerObject::unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_ // We need to be able to deal with a particle source that hasn't changed, but still got an update! if (pss) { -// llinfos << "Making particle system with owner " << owner_id << llendl; +// LL_INFOS() << "Making particle system with owner " << owner_id << LL_ENDL; pss->setOwnerUUID(owner_id); mPartSourcep = pss; LLViewerPartSim::getInstance()->addPartSource(pss); @@ -4966,7 +5191,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow // At least, this appears to be how the scripts work. // The attached sound ID is set to NULL to avoid it playing back when the // object rezzes in on non-looping sounds. - //llinfos << "Clearing attached sound " << mAudioSourcep->getCurrentData()->getID() << llendl; + //LL_INFOS() << "Clearing attached sound " << mAudioSourcep->getCurrentData()->getID() << LL_ENDL; gAudiop->cleanupAudioSource(mAudioSourcep); mAudioSourcep = NULL; } @@ -4981,7 +5206,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow && mAudioSourcep && mAudioSourcep->isLoop() && mAudioSourcep->getCurrentData() && mAudioSourcep->getCurrentData()->getID() == audio_uuid) { - //llinfos << "Already playing this sound on a loop, ignoring" << llendl; + //LL_INFOS() << "Already playing this sound on a loop, ignoring" << LL_ENDL; return; } @@ -4995,7 +5220,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow if (mAudioSourcep && mAudioSourcep->isMuted() && mAudioSourcep->getCurrentData() && mAudioSourcep->getCurrentData()->getID() == audio_uuid) { - //llinfos << "Already having this sound as muted sound, ignoring" << llendl; + //LL_INFOS() << "Already having this sound as muted sound, ignoring" << LL_ENDL; return; } @@ -5018,7 +5243,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow // Play this sound if region maturity permits if( gAgent.canAccessMaturityAtGlobal(this->getPositionGlobal()) ) { - //llinfos << "Playing attached sound " << audio_uuid << llendl; + //LL_INFOS() << "Playing attached sound " << audio_uuid << LL_ENDL; mAudioSourcep->play(audio_uuid); } } @@ -5100,7 +5325,7 @@ LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 para } default: { - llinfos << "Unknown param type." << llendl; + LL_INFOS() << "Unknown param type." << LL_ENDL; break; } }; @@ -5238,7 +5463,7 @@ void LLViewerObject::parameterChanged(U16 param_type, LLNetworkData* data, BOOL } else { - llwarns << "Failed to send object extra parameters: " << param_type << llendl; + LL_WARNS() << "Failed to send object extra parameters: " << param_type << LL_ENDL; } } } @@ -5503,7 +5728,18 @@ void LLViewerObject::setRegion(LLViewerRegion *regionp) { if (!regionp) { - llwarns << "viewer object set region to NULL" << llendl; + LL_WARNS() << "viewer object set region to NULL" << LL_ENDL; + } + if(regionp != mRegionp) + { + if(mRegionp) + { + mRegionp->removeFromCreatedList(getLocalID()); + } + if(regionp) + { + regionp->addToCreatedList(getLocalID()); + } } mLatestRecvPacketID = 0; @@ -5525,10 +5761,10 @@ void LLViewerObject::updateRegion(LLViewerRegion *regionp) // if (regionp) // { // F64 now = LLFrameTimer::getElapsedSeconds(); -// llinfos << "Updating to region " << regionp->getName() +// LL_INFOS() << "Updating to region " << regionp->getName() // << ", ms since last update message: " << (F32)((now - mLastMessageUpdateSecs) * 1000.0) // << ", ms since last interpolation: " << (F32)((now - mLastInterpUpdateSecs) * 1000.0) -// << llendl; +// << LL_ENDL; // } } diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index c34d4493d53d7301febcf36dcc0cf406e7dbc8d5..d92c00a6b21fb9ee532b19b67df0f0fe0d98e25c 100755 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -30,8 +30,7 @@ #include <map> #include "llassetstorage.h" -#include "lldarrayptr.h" -#include "llhudicon.h" +//#include "llhudicon.h" #include "llinventory.h" #include "llrefcount.h" #include "llprimitive.h" @@ -43,33 +42,30 @@ #include "v3math.h" #include "llvertexbuffer.h" #include "llbbox.h" -#include "llbbox.h" class LLAgent; // TODO: Get rid of this. class LLAudioSource; class LLAudioSourceVO; -class LLDataPacker; class LLColor4; -class LLFrameTimer; +class LLDataPacker; +class LLDataPackerBinaryBuffer; class LLDrawable; -class LLHost; class LLHUDText; -class LLWorld; -class LLNameValue; -class LLNetMap; +class LLHost; class LLMessageSystem; +class LLNameValue; class LLPartSysData; -class LLPrimitive; class LLPipeline; class LLTextureEntry; -class LLViewerTexture; +class LLVOAvatar; +class LLVOInventoryListener; class LLViewerInventoryItem; class LLViewerObject; +class LLViewerObjectMedia; class LLViewerPartSourceScript; class LLViewerRegion; -class LLViewerObjectMedia; -class LLVOInventoryListener; -class LLVOAvatar; +class LLViewerTexture; +class LLWorld; typedef enum e_object_update_type { @@ -107,7 +103,11 @@ struct PotentialReturnableObject //============================================================================ -class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate +class LLViewerObject +: public LLPrimitive, + public LLRefCount, + public LLGLUpdate, + public LLTrace::MemTrackable<LLViewerObject> { protected: ~LLViewerObject(); // use unref() @@ -157,6 +157,7 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate INVALID_UPDATE = 0x80000000 }; + static U32 extractSpatialExtents(LLDataPackerBinaryBuffer *dp, LLVector3& pos, LLVector3& scale, LLQuaternion& rot); virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, U32 block_num, @@ -525,6 +526,7 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate virtual void updateRegion(LLViewerRegion *regionp); void updateFlags(BOOL physics_changed = FALSE); + void loadFlags(U32 flags); //load flags from cache or from message BOOL setFlags(U32 flag, BOOL state); BOOL setFlagsWithoutUpdate(U32 flag, BOOL state); void setPhysicsShapeType(U8 type); @@ -554,6 +556,13 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate friend class LLViewerObjectList; friend class LLViewerMediaList; +public: + static void unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name); + static void unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name); + static void unpackU32(LLDataPackerBinaryBuffer* dp, U32& value, std::string name); + static void unpackU8(LLDataPackerBinaryBuffer* dp, U8& value, std::string name); + static U32 unpackParentID(LLDataPackerBinaryBuffer* dp, U32& parent_id); + public: //counter-translation void resetChildrenPosition(const LLVector3& offset, BOOL simplified = FALSE) ; @@ -575,7 +584,9 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate U32 checkMediaURL(const std::string &media_url); // Motion prediction between updates - void interpolateLinearMotion(const F64 & time, const F32 & dt); + void interpolateLinearMotion(const F64SecondsImplicit & time, const F32SecondsImplicit & dt); + + static void initObjectDataMap(); public: // @@ -628,6 +639,7 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate // Grabbed from UPDATE_FLAGS U32 mFlags; + static std::map<std::string, U32> sObjectDataMap; public: // Sent to sim in UPDATE_FLAGS, received in ObjectPhysicsProperties U8 mPhysicsShapeType; @@ -651,7 +663,7 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate // TODO: Make all this stuff private. JC LLPointer<LLHUDText> mText; - LLPointer<LLHUDIcon> mIcon; + LLPointer<class LLHUDIcon> mIcon; static BOOL sUseSharedDrawables; @@ -689,8 +701,6 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate void deleteParticleSource(); void setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id); -public: - private: void setNameValueList(const std::string& list); // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string void deleteTEImages(); // correctly deletes list of images @@ -701,8 +711,8 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate child_list_t mChildList; - F64 mLastInterpUpdateSecs; // Last update for purposes of interpolation - F64 mLastMessageUpdateSecs; // Last update from a message from the simulator + F64Seconds mLastInterpUpdateSecs; // Last update for purposes of interpolation + F64Seconds mLastMessageUpdateSecs; // Last update from a message from the simulator TPACKETID mLatestRecvPacketID; // Latest time stamp on message from simulator // extra data sent from the sim...currently only used for tree species info @@ -768,12 +778,13 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate static S32 sAxisArrowLength; + // These two caches are only correct for non-parented objects right now! mutable LLVector3 mPositionRegion; mutable LLVector3 mPositionAgent; - static void setPhaseOutUpdateInterpolationTime(F32 value) { sPhaseOutUpdateInterpolationTime = (F64) value; } - static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64) value; } + static void setPhaseOutUpdateInterpolationTime(F32 value) { sPhaseOutUpdateInterpolationTime = (F64Seconds) value; } + static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64Seconds) value; } static void setVelocityInterpolate(BOOL value) { sVelocityInterpolate = value; } static void setPingInterpolate(BOOL value) { sPingInterpolate = value; } @@ -781,8 +792,8 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate private: static S32 sNumObjects; - static F64 sPhaseOutUpdateInterpolationTime; // For motion interpolation - static F64 sMaxUpdateInterpolationTime; // For motion interpolation + static F64Seconds sPhaseOutUpdateInterpolationTime; // For motion interpolation + static F64Seconds sMaxUpdateInterpolationTime; // For motion interpolation static BOOL sVelocityInterpolate; static BOOL sPingInterpolate; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index f667c2bf331aeefdea261e941723bd60ca3a90a9..0e40db8504d2294516cc3c256fdc6b072256dc34 100755 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -29,7 +29,6 @@ #include "llviewerobjectlist.h" #include "message.h" -#include "timing.h" #include "llfasttimer.h" #include "llrender.h" #include "llwindow.h" // decBusyCount() @@ -47,6 +46,7 @@ #include "lltooltip.h" #include "llworld.h" #include "llstring.h" +#include "llhudicon.h" #include "llhudnametag.h" #include "lldrawable.h" #include "llflexibleobject.h" @@ -76,6 +76,7 @@ #include "object_flags.h" #include "llappviewer.h" +#include "llvocache.h" extern F32 gMinObjectDistance; extern BOOL gAnimateTextures; @@ -93,12 +94,9 @@ extern LLPipeline gPipeline; U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check. std::map<U64, U32> LLViewerObjectList::sIPAndPortToIndex; std::map<U64, LLUUID> LLViewerObjectList::sIndexAndLocalIDToUUID; -LLStat LLViewerObjectList::sCacheHitRate("object_cache_hits", 128); LLViewerObjectList::LLViewerObjectList() { - mNumVisCulled = 0; - mNumSizeCulled = 0; mCurLazyUpdateIndex = 0; mCurBin = 0; mNumDeadObjects = 0; @@ -172,7 +170,7 @@ BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp) U64 ipport = (((U64)ip) << 32) | (U64)port; U32 index = sIPAndPortToIndex[ipport]; - // llinfos << "Removing object from table, local ID " << local_id << ", ip " << ip << ":" << port << llendl; + // LL_INFOS() << "Removing object from table, local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL; U64 indexid = (((U64)index) << 32) | (U64)local_id; @@ -189,8 +187,8 @@ BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp) return TRUE; } // UUIDs did not match - this would zap a valid entry, so don't erase it - //llinfos << "Tried to erase entry where id in table (" - // << iter->second << ") did not match object " << object.getID() << llendl; + //LL_INFOS() << "Tried to erase entry where id in table (" + // << iter->second << ") did not match object " << object.getID() << LL_ENDL; } return FALSE ; @@ -215,8 +213,8 @@ void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id, sIndexAndLocalIDToUUID[indexid] = id; - //llinfos << "Adding object to table, full ID " << id - // << ", local ID " << local_id << ", ip " << ip << ":" << port << llendl; + //LL_INFOS() << "Adding object to table, full ID " << id + // << ", local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL; } S32 gFullObjectUpdates = 0; @@ -227,9 +225,15 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, U32 i, const EObjectUpdateType update_type, LLDataPacker* dpp, - BOOL just_created) + bool just_created, + bool from_cache) { - LLMessageSystem* msg = gMessageSystem; + LLMessageSystem* msg = NULL; + + if(!from_cache) + { + msg = gMessageSystem; + } // ignore returned flags objectp->processUpdateMessage(msg, user_data, i, update_type, dpp); @@ -253,7 +257,18 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, // RN: this must be called after we have a drawable // (from gPipeline.addObject) // so that the drawable parent is set properly + if(msg != NULL) + { findOrphans(objectp, msg->getSenderIP(), msg->getSenderPort()); + } + else + { + LLViewerRegion* regionp = objectp->getRegion(); + if(regionp != NULL) + { + findOrphans(objectp, regionp->getHost().getAddress(), regionp->getHost().getPort()); + } + } // If we're just wandering around, don't create new objects selected. if (just_created @@ -262,8 +277,8 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, { if ( LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance() ) { - // llinfos << "DEBUG selecting " << objectp->mID << " " - // << objectp->mLocalID << llendl; + // LL_INFOS() << "DEBUG selecting " << objectp->mID << " " + // << objectp->mLocalID << LL_ENDL; LLSelectMgr::getInstance()->selectObjectAndFamily(objectp); dialog_refresh_all(); } @@ -274,14 +289,104 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, } } -static LLFastTimer::DeclareTimer FTM_PROCESS_OBJECTS("Process Objects"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_OBJECTS("Process Objects"); + +LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry* entry, LLViewerRegion* regionp) +{ + LLDataPacker *cached_dpp = entry->getDP(); + + if (!cached_dpp) + { + return NULL; //nothing cached. + } + + LLViewerObject *objectp; + U32 local_id; + LLPCode pcode = 0; + LLUUID fullid; + LLViewerStatsRecorder& recorder = LLViewerStatsRecorder::instance(); + + // Cache Hit. + record(LLStatViewer::OBJECT_CACHE_HIT_RATE, LLUnits::Ratio::fromValue(1)); + + cached_dpp->reset(); + cached_dpp->unpackUUID(fullid, "ID"); + cached_dpp->unpackU32(local_id, "LocalID"); + cached_dpp->unpackU8(pcode, "PCode"); + + objectp = findObject(fullid); + + if (objectp) + { + if(!objectp->isDead() && (objectp->mLocalID != entry->getLocalID() || + objectp->getRegion() != regionp)) + { + removeFromLocalIDTable(objectp); + setUUIDAndLocal(fullid, entry->getLocalID(), + regionp->getHost().getAddress(), + regionp->getHost().getPort()); + + if (objectp->mLocalID != entry->getLocalID()) + { // Update local ID in object with the one sent from the region + objectp->mLocalID = entry->getLocalID(); + } + + if (objectp->getRegion() != regionp) + { // Object changed region, so update it + objectp->updateRegion(regionp); // for LLVOAvatar + } + } + else + { + //should fall through if already loaded because may need to update the object. + //return objectp; //already loaded. + } + } + + bool justCreated = false; + if (!objectp) + { + objectp = createObjectFromCache(pcode, regionp, fullid, entry->getLocalID()); + + if (!objectp) + { + LL_INFOS() << "createObject failure for object: " << fullid << LL_ENDL; + recorder.objectUpdateFailure(entry->getLocalID(), OUT_FULL_CACHED, 0); + return NULL; + } + justCreated = true; + mNumNewObjects++; + } + + if (objectp->isDead()) + { + LL_WARNS() << "Dead object " << objectp->mID << " in UUID map 1!" << LL_ENDL; + } + + processUpdateCore(objectp, NULL, 0, OUT_FULL_CACHED, cached_dpp, justCreated, true); + objectp->loadFlags(entry->getUpdateFlags()); //just in case, reload update flags from cache. + + if(entry->getHitCount() > 0) + { + objectp->setLastUpdateType(OUT_FULL_CACHED); + } + else + { + objectp->setLastUpdateType(OUT_FULL_COMPRESSED); //newly cached + objectp->setLastUpdateCached(TRUE); + } + recorder.log(0.2f); + LLVOAvatar::cullAvatarsByPixelArea(); + + return objectp; +} void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, void **user_data, const EObjectUpdateType update_type, - bool cached, bool compressed) + bool compressed) { - LLFastTimer t(FTM_PROCESS_OBJECTS); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_OBJECTS); LLViewerObject *objectp; S32 num_objects; @@ -297,9 +402,9 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData); // I don't think this case is ever hit. TODO* Test this. - if (!cached && !compressed && update_type != OUT_FULL) + if (!compressed && update_type != OUT_FULL) { - //llinfos << "TEST: !cached && !compressed && update_type != OUT_FULL" << llendl; + //LL_INFOS() << "TEST: !cached && !compressed && update_type != OUT_FULL" << LL_ENDL; gTerseObjectUpdates += num_objects; /* S32 size; @@ -311,7 +416,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, { size = mesgsys->getReceiveSize(); } - llinfos << "Received terse " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << llendl; + LL_INFOS() << "Received terse " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << LL_ENDL; */ } else @@ -327,7 +432,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, size = mesgsys->getReceiveSize(); } - llinfos << "Received " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << llendl; + LL_INFOS() << "Received " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << LL_ENDL; */ gFullObjectUpdates += num_objects; } @@ -339,13 +444,12 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, if (!regionp) { - llwarns << "Object update from unknown region! " << region_handle << llendl; + LL_WARNS() << "Object update from unknown region! " << region_handle << LL_ENDL; return; } U8 compressed_dpbuffer[2048]; LLDataPackerBinaryBuffer compressed_dp(compressed_dpbuffer, 2048); - LLDataPacker *cached_dpp = NULL; LLViewerStatsRecorder& recorder = LLViewerStatsRecorder::instance(); for (i = 0; i < num_objects; i++) @@ -354,57 +458,37 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, LLTimer update_timer; BOOL justCreated = FALSE; S32 msg_size = 0; + bool update_cache = false; //update object cache if it is a full-update or terse update - if (cached) - { - U32 id; - U32 crc; - mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, id, i); - mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_CRC, crc, i); - msg_size += sizeof(U32) * 2; - - // Lookup data packer and add this id to cache miss lists if necessary. - U8 cache_miss_type = LLViewerRegion::CACHE_MISS_TYPE_NONE; - cached_dpp = regionp->getDP(id, crc, cache_miss_type); - if (cached_dpp) - { - // Cache Hit. - cached_dpp->reset(); - cached_dpp->unpackUUID(fullid, "ID"); - cached_dpp->unpackU32(local_id, "LocalID"); - cached_dpp->unpackU8(pcode, "PCode"); - } - else - { - // Cache Miss. - recorder.cacheMissEvent(id, update_type, cache_miss_type, msg_size); - - continue; // no data packer, skip this object - } - } - else if (compressed) + if (compressed) { S32 uncompressed_length = 2048; compressed_dp.reset(); - U32 flags = 0; - if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? - { - mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); - } - uncompressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compressed_dpbuffer, 0, i); compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length); if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? { - compressed_dp.unpackUUID(fullid, "ID"); - compressed_dp.unpackU32(local_id, "LocalID"); - compressed_dp.unpackU8(pcode, "PCode"); + U32 flags = 0; + mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); + + if(flags & FLAGS_TEMPORARY_ON_REZ) + { + compressed_dp.unpackUUID(fullid, "ID"); + compressed_dp.unpackU32(local_id, "LocalID"); + compressed_dp.unpackU8(pcode, "PCode"); + } + else //send to object cache + { + regionp->cacheFullUpdate(compressed_dp, flags); + continue; } - else + } + else //OUT_TERSE_IMPROVED { + update_cache = true; compressed_dp.unpackU32(local_id, "LocalID"); getUUIDFromLocal(fullid, local_id, @@ -412,7 +496,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, gMessageSystem->getSenderPort()); if (fullid.isNull()) { - // llwarns << "update for unknown localid " << local_id << " host " << gMessageSystem->getSender() << ":" << gMessageSystem->getSenderPort() << llendl; + // LL_WARNS() << "update for unknown localid " << local_id << " host " << gMessageSystem->getSender() << ":" << gMessageSystem->getSenderPort() << LL_ENDL; mNumUnknownUpdates++; } } @@ -428,20 +512,26 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, gMessageSystem->getSenderPort()); if (fullid.isNull()) { - // llwarns << "update for unknown localid " << local_id << " host " << gMessageSystem->getSender() << llendl; + // LL_WARNS() << "update for unknown localid " << local_id << " host " << gMessageSystem->getSender() << LL_ENDL; mNumUnknownUpdates++; } } else // OUT_FULL only? { + update_cache = true; mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FullID, fullid, i); mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i); msg_size += sizeof(LLUUID); msg_size += sizeof(U32); - // llinfos << "Full Update, obj " << local_id << ", global ID" << fullid << "from " << mesgsys->getSender() << llendl; + // LL_INFOS() << "Full Update, obj " << local_id << ", global ID" << fullid << "from " << mesgsys->getSender() << LL_ENDL; } objectp = findObject(fullid); + if(update_cache) + { + objectp = regionp->updateCacheEntry(local_id, objectp, update_type); + } + // This looks like it will break if the local_id of the object doesn't change // upon boundary crossing, but we check for region id matching later... // Reset object local id and region pointer if things have changed @@ -451,13 +541,13 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, { //if (objectp->getRegion()) //{ - // llinfos << "Local ID change: Removing object from table, local ID " << objectp->mLocalID + // LL_INFOS() << "Local ID change: Removing object from table, local ID " << objectp->mLocalID // << ", id from message " << local_id << ", from " // << LLHost(objectp->getRegion()->getHost().getAddress(), objectp->getRegion()->getHost().getPort()) // << ", full id " << fullid // << ", objects id " << objectp->getID() // << ", regionp " << (U32) regionp << ", object region " << (U32) objectp->getRegion() - // << llendl; + // << LL_ENDL; //} removeFromLocalIDTable(objectp); setUUIDAndLocal(fullid, @@ -482,19 +572,16 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, { if (update_type == OUT_TERSE_IMPROVED) { - // llinfos << "terse update for an unknown object (compressed):" << fullid << llendl; + // LL_INFOS() << "terse update for an unknown object (compressed):" << fullid << LL_ENDL; recorder.objectUpdateFailure(local_id, update_type, msg_size); continue; } } - else if (cached) // Cache hit only? - { - } else { if (update_type != OUT_FULL) { - //llinfos << "terse update for an unknown object:" << fullid << llendl; + //LL_INFOS() << "terse update for an unknown object:" << fullid << LL_ENDL; recorder.objectUpdateFailure(local_id, update_type, msg_size); continue; } @@ -507,7 +594,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, if (mDeadObjects.find(fullid) != mDeadObjects.end()) { mNumDeadObjectUpdates++; - //llinfos << "update for a dead object:" << fullid << llendl; + //LL_INFOS() << "update for a dead object:" << fullid << LL_ENDL; recorder.objectUpdateFailure(local_id, update_type, msg_size); continue; } @@ -516,23 +603,21 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, objectp = createObject(pcode, regionp, fullid, local_id, gMessageSystem->getSender()); if (!objectp) { - llinfos << "createObject failure for object: " << fullid << llendl; + LL_INFOS() << "createObject failure for object: " << fullid << LL_ENDL; recorder.objectUpdateFailure(local_id, update_type, msg_size); continue; } + justCreated = TRUE; mNumNewObjects++; - sCacheHitRate.addValue(cached ? 100.f : 0.f); - } - if (objectp->isDead()) { - llwarns << "Dead object " << objectp->mID << " in UUID map 1!" << llendl; + LL_WARNS() << "Dead object " << objectp->mID << " in UUID map 1!" << LL_ENDL; } - bool bCached = false; + //bool bCached = false; if (compressed) { if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? @@ -540,17 +625,21 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, objectp->mLocalID = local_id; } processUpdateCore(objectp, user_data, i, update_type, &compressed_dp, justCreated); + +#if 0 if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? { + U32 flags = 0; + mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); + + if(!(flags & FLAGS_TEMPORARY_ON_REZ)) + { bCached = true; - LLViewerRegion::eCacheUpdateResult result = objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp); + LLViewerRegion::eCacheUpdateResult result = objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp, flags); recorder.cacheFullUpdate(local_id, update_type, result, objectp, msg_size); } } - else if (cached) // Cache hit only? - { - objectp->mLocalID = local_id; - processUpdateCore(objectp, user_data, i, update_type, cached_dpp, justCreated); +#endif } else { @@ -561,8 +650,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, processUpdateCore(objectp, user_data, i, update_type, NULL, justCreated); } recorder.objectUpdateEvent(local_id, update_type, objectp, msg_size); - objectp->setLastUpdateType(update_type); - objectp->setLastUpdateCached(bCached); + objectp->setLastUpdateType(update_type); } recorder.log(0.2f); @@ -574,14 +662,52 @@ void LLViewerObjectList::processCompressedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, const EObjectUpdateType update_type) { - processObjectUpdate(mesgsys, user_data, update_type, false, true); + processObjectUpdate(mesgsys, user_data, update_type, true); } void LLViewerObjectList::processCachedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, const EObjectUpdateType update_type) { - processObjectUpdate(mesgsys, user_data, update_type, true, false); + //processObjectUpdate(mesgsys, user_data, update_type, true, false); + + S32 num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData); + gFullObjectUpdates += num_objects; + + U64 region_handle; + mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle); + if (!regionp) + { + LL_WARNS() << "Object update from unknown region! " << region_handle << LL_ENDL; + return; + } + + LLViewerStatsRecorder& recorder = LLViewerStatsRecorder::instance(); + + for (S32 i = 0; i < num_objects; i++) + { + S32 msg_size = 0; + U32 id; + U32 crc; + U32 flags; + mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, id, i); + mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_CRC, crc, i); + mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); + msg_size += sizeof(U32) * 2; + + // Lookup data packer and add this id to cache miss lists if necessary. + U8 cache_miss_type = LLViewerRegion::CACHE_MISS_TYPE_NONE; + if(!regionp->probeCache(id, crc, flags, cache_miss_type)) + { + // Cache Miss. + recorder.cacheMissEvent(id, update_type, cache_miss_type, msg_size); + + continue; // no data packer, skip this object + } + } + + return; } void LLViewerObjectList::dirtyAllObjectInventory() @@ -692,10 +818,10 @@ class LLObjectCostResponder : public LLCurl::Responder void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llwarns + LL_WARNS() << "Transport error requesting object cost " << "[status: " << statusNum << "]: " - << content << llendl; + << content << LL_ENDL; // TODO*: Error message to user // For now just clear the request from the pending list @@ -708,11 +834,11 @@ class LLObjectCostResponder : public LLCurl::Responder { // Improper response or the request had an error, // show an error to the user? - llwarns + LL_WARNS() << "Application level error when fetching object " << "cost. Message: " << content["error"]["message"].asString() << ", identifier: " << content["error"]["identifier"].asString() - << llendl; + << LL_ENDL; // TODO*: Adaptively adjust request size if the // service says we've requested too many and retry @@ -781,10 +907,10 @@ class LLPhysicsFlagsResponder : public LLCurl::Responder void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llwarns + LL_WARNS() << "Transport error requesting object physics flags " << "[status: " << statusNum << "]: " - << content << llendl; + << content << LL_ENDL; // TODO*: Error message to user // For now just clear the request from the pending list @@ -797,11 +923,11 @@ class LLPhysicsFlagsResponder : public LLCurl::Responder { // Improper response or the request had an error, // show an error to the user? - llwarns + LL_WARNS() << "Application level error when fetching object " << "physics flags. Message: " << content["error"]["message"].asString() << ", identifier: " << content["error"]["identifier"].asString() - << llendl; + << LL_ENDL; // TODO*: Adaptively adjust request size if the // service says we've requested too many and retry @@ -852,6 +978,8 @@ class LLPhysicsFlagsResponder : public LLCurl::Responder LLSD mObjectIDs; }; +static LLTrace::BlockTimerStatHandle FTM_IDLE_COPY("Idle Copy"); + void LLViewerObjectList::update(LLAgent &agent) { // Update globals @@ -864,7 +992,7 @@ void LLViewerObjectList::update(LLAgent &agent) phase_out_time < 0.0 || phase_out_time > interp_time) { - llwarns << "Invalid values for InterpolationTime or InterpolationPhaseOut, resetting to defaults" << llendl; + LL_WARNS() << "Invalid values for InterpolationTime or InterpolationPhaseOut, resetting to defaults" << LL_ENDL; interp_time = 3.0f; phase_out_time = 1.0f; } @@ -875,14 +1003,14 @@ void LLViewerObjectList::update(LLAgent &agent) // update global timer F32 last_time = gFrameTimeSeconds; - U64 time = totalTime(); // this will become the new gFrameTime when the update is done + U64Microseconds time = totalTime(); // this will become the new gFrameTime when the update is done // Time _can_ go backwards, for example if the user changes the system clock. // It doesn't cause any fatal problems (just some oddness with stats), so we shouldn't assert here. // llassert(time > gFrameTime); - F64 time_diff = U64_to_F64(time - gFrameTime)/(F64)SEC_TO_MICROSEC; + F64Seconds time_diff = time - gFrameTime; gFrameTime = time; - F64 time_since_start = U64_to_F64(gFrameTime - gStartTime)/(F64)SEC_TO_MICROSEC; - gFrameTimeSeconds = (F32)time_since_start; + F64Seconds time_since_start = gFrameTime - gStartTime; + gFrameTimeSeconds = time_since_start; gFrameIntervalSeconds = gFrameTimeSeconds - last_time; if (gFrameIntervalSeconds < 0.f) @@ -902,10 +1030,8 @@ void LLViewerObjectList::update(LLAgent &agent) U32 idle_count = 0; - static LLFastTimer::DeclareTimer idle_copy("Idle Copy"); - { - LLFastTimer t(idle_copy); + LL_RECORD_BLOCK_TIME(FTM_IDLE_COPY); for (std::vector<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin(); active_iter != mActiveObjects.end(); active_iter++) @@ -926,7 +1052,7 @@ void LLViewerObjectList::update(LLAgent &agent) else { // There shouldn't be any NULL pointers in the list, but they have caused // crashes before. This may be idleUpdate() messing with the list. - llwarns << "LLViewerObjectList::update has a NULL objectp" << llendl; + LL_WARNS() << "LLViewerObjectList::update has a NULL objectp" << LL_ENDL; } } } @@ -971,9 +1097,6 @@ void LLViewerObjectList::update(LLAgent &agent) fetchObjectCosts(); fetchPhysicsFlags(); - mNumSizeCulled = 0; - mNumVisCulled = 0; - // update max computed render cost LLVOVolume::updateRenderComplexity(); @@ -987,7 +1110,7 @@ void LLViewerObjectList::update(LLAgent &agent) /* // Debugging code for viewing orphans, and orphaned parents LLUUID id; - for (i = 0; i < mOrphanParents.count(); i++) + for (i = 0; i < mOrphanParents.size(); i++) { id = sIndexAndLocalIDToUUID[mOrphanParents[i]]; LLViewerObject *objectp = findObject(id); @@ -1004,7 +1127,7 @@ void LLViewerObjectList::update(LLAgent &agent) } LLColor4 text_color; - for (i = 0; i < mOrphanChildren.count(); i++) + for (i = 0; i < mOrphanChildren.size(); i++) { OrphanInfo oi = mOrphanChildren[i]; LLViewerObject *objectp = findObject(oi.mChildInfo); @@ -1033,10 +1156,8 @@ void LLViewerObjectList::update(LLAgent &agent) } */ - LLViewerStats::getInstance()->mNumObjectsStat.addValue((S32) mObjects.size()); - LLViewerStats::getInstance()->mNumActiveObjectsStat.addValue(idle_count); - LLViewerStats::getInstance()->mNumSizeCulledStat.addValue(mNumSizeCulled); - LLViewerStats::getInstance()->mNumVisCulledStat.addValue(mNumVisCulled); + sample(LLStatViewer::NUM_OBJECTS, mObjects.size()); + sample(LLStatViewer::NUM_ACTIVE_OBJECTS, idle_count); } void LLViewerObjectList::fetchObjectCosts() @@ -1169,7 +1290,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) { if (mDeadObjects.find(objectp->mID) != mDeadObjects.end()) { - llinfos << "Object " << objectp->mID << " already on dead list!" << llendl; + LL_INFOS() << "Object " << objectp->mID << " already on dead list!" << LL_ENDL; } else { @@ -1183,16 +1304,16 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) //if (objectp->getRegion()) //{ - // llinfos << "cleanupReferences removing object from table, local ID " << objectp->mLocalID << ", ip " + // LL_INFOS() << "cleanupReferences removing object from table, local ID " << objectp->mLocalID << ", ip " // << objectp->getRegion()->getHost().getAddress() << ":" - // << objectp->getRegion()->getHost().getPort() << llendl; + // << objectp->getRegion()->getHost().getPort() << LL_ENDL; //} removeFromLocalIDTable(objectp); if (objectp->onActiveList()) { - //llinfos << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list in cleanupReferences." << llendl; + //LL_INFOS() << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list in cleanupReferences." << LL_ENDL; objectp->setOnActiveList(FALSE); removeFromActiveList(objectp); } @@ -1209,11 +1330,11 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) mNumDeadObjects++; } -static LLFastTimer::DeclareTimer FTM_REMOVE_DRAWABLE("Remove Drawable"); +static LLTrace::BlockTimerStatHandle FTM_REMOVE_DRAWABLE("Remove Drawable"); void LLViewerObjectList::removeDrawable(LLDrawable* drawablep) { - LLFastTimer t(FTM_REMOVE_DRAWABLE); + LL_RECORD_BLOCK_TIME(FTM_REMOVE_DRAWABLE); if (!drawablep) { @@ -1249,16 +1370,7 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) if (objectp) { - if (objectp->isDead()) - { - // This object is already dead. Don't need to do more. - return TRUE; - } - else - { - objectp->markDead(); - } - + objectp->markDead(); // does the right thing if object already dead return TRUE; } @@ -1301,19 +1413,19 @@ void LLViewerObjectList::killAllObjects() if(!mObjects.empty()) { - llwarns << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.size() << llendl; + LL_WARNS() << "LLViewerObjectList::killAllObjects still has entries in mObjects: " << mObjects.size() << LL_ENDL; mObjects.clear(); } if (!mActiveObjects.empty()) { - llwarns << "Some objects still on active object list!" << llendl; + LL_WARNS() << "Some objects still on active object list!" << LL_ENDL; mActiveObjects.clear(); } if (!mMapObjects.empty()) { - llwarns << "Some objects still on map object list!" << llendl; + LL_WARNS() << "Some objects still on map object list!" << LL_ENDL; mMapObjects.clear(); } } @@ -1404,7 +1516,7 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) { if (active) { - //llinfos << "Adding " << objectp->mID << " " << objectp->getPCodeString() << " to active list." << llendl; + //LL_INFOS() << "Adding " << objectp->mID << " " << objectp->getPCodeString() << " to active list." << LL_ENDL; S32 idx = objectp->getListIndex(); if (idx <= -1) { @@ -1420,13 +1532,13 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) if (idx >= mActiveObjects.size() || mActiveObjects[idx] != objectp) { - llwarns << "Invalid object list index detected!" << llendl; + LL_WARNS() << "Invalid object list index detected!" << LL_ENDL; } } } else { - //llinfos << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list." << llendl; + //LL_INFOS() << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list." << LL_ENDL; removeFromActiveList(objectp); objectp->setOnActiveList(FALSE); } @@ -1464,7 +1576,7 @@ void LLViewerObjectList::updateObjectCost(const LLUUID& object_id, F32 object_co void LLViewerObjectList::onObjectCostFetchFailure(const LLUUID& object_id) { - //llwarns << "Failed to fetch object cost for object: " << object_id << llendl; + //LL_WARNS() << "Failed to fetch object cost for object: " << object_id << LL_ENDL; mPendingObjectCost.erase(object_id); } @@ -1503,13 +1615,13 @@ void LLViewerObjectList::updatePhysicsProperties(const LLUUID& object_id, void LLViewerObjectList::onPhysicsFlagsFetchFailure(const LLUUID& object_id) { - //llwarns << "Failed to fetch physics flags for object: " << object_id << llendl; + //LL_WARNS() << "Failed to fetch physics flags for object: " << object_id << LL_ENDL; mPendingPhysicsFlags.erase(object_id); } -static LLFastTimer::DeclareTimer FTM_SHIFT_OBJECTS("Shift Objects"); -static LLFastTimer::DeclareTimer FTM_PIPELINE_SHIFT("Pipeline Shift"); -static LLFastTimer::DeclareTimer FTM_REGION_SHIFT("Region Shift"); +static LLTrace::BlockTimerStatHandle FTM_SHIFT_OBJECTS("Shift Objects"); +static LLTrace::BlockTimerStatHandle FTM_PIPELINE_SHIFT("Pipeline Shift"); +static LLTrace::BlockTimerStatHandle FTM_REGION_SHIFT("Region Shift"); void LLViewerObjectList::shiftObjects(const LLVector3 &offset) { @@ -1522,7 +1634,7 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset) return; } - LLFastTimer t(FTM_SHIFT_OBJECTS); + LL_RECORD_BLOCK_TIME(FTM_SHIFT_OBJECTS); LLViewerObject *objectp; for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) @@ -1541,12 +1653,12 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset) } { - LLFastTimer t(FTM_PIPELINE_SHIFT); + LL_RECORD_BLOCK_TIME(FTM_PIPELINE_SHIFT); gPipeline.shiftObjects(offset); } { - LLFastTimer t(FTM_REGION_SHIFT); + LL_RECORD_BLOCK_TIME(FTM_REGION_SHIFT); LLWorld::getInstance()->shiftRegions(offset); } } @@ -1606,7 +1718,7 @@ void LLViewerObjectList::clearAllMapObjectsInRegion(LLViewerRegion* regionp) if(dead_object_list.size() > 0) { - llwarns << "There are " << dead_object_list.size() << " dead objects on the map!" << llendl ; + LL_WARNS() << "There are " << dead_object_list.size() << " dead objects on the map!" << LL_ENDL ; for(std::set<LLViewerObject*>::iterator iter = dead_object_list.begin(); iter != dead_object_list.end(); ++iter) { @@ -1615,7 +1727,7 @@ void LLViewerObjectList::clearAllMapObjectsInRegion(LLViewerRegion* regionp) } if(region_object_list.size() > 0) { - llwarns << "There are " << region_object_list.size() << " objects not removed from the deleted region!" << llendl ; + LL_WARNS() << "There are " << region_object_list.size() << " objects not removed from the deleted region!" << LL_ENDL ; for(std::set<LLViewerObject*>::iterator iter = region_object_list.begin(); iter != region_object_list.end(); ++iter) { @@ -1881,7 +1993,7 @@ LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLVi LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp); if (!objectp) { -// llwarns << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << llendl; +// LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << LL_ENDL; return NULL; } @@ -1894,6 +2006,29 @@ LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLVi return objectp; } +LLViewerObject *LLViewerObjectList::createObjectFromCache(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id) +{ + llassert_always(uuid.notNull()); + + LLViewerObject *objectp = LLViewerObject::createObject(uuid, pcode, regionp); + if (!objectp) + { +// LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << " id:" << fullid << LL_ENDL; + return NULL; + } + + objectp->mLocalID = local_id; + mUUIDObjectMap[uuid] = objectp; + setUUIDAndLocal(uuid, + local_id, + regionp->getHost().getAddress(), + regionp->getHost().getPort()); + mObjects.push_back(objectp); + + updateActive(objectp); + + return objectp; +} LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id, const LLHost &sender) @@ -1912,9 +2047,13 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp); if (!objectp) { -// llwarns << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << " id:" << fullid << llendl; +// LL_WARNS() << "Couldn't create object of type " << LLPrimitive::pCodeToString(pcode) << " id:" << fullid << LL_ENDL; return NULL; } + if(regionp) + { + regionp->addToCreatedList(local_id); + } mUUIDObjectMap[fullid] = objectp; setUUIDAndLocal(fullid, @@ -1961,9 +2100,7 @@ S32 LLViewerObjectList::findReferences(LLDrawable *drawablep) const void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port) { -#ifdef ORPHAN_SPAM - llinfos << "Orphaning object " << childp->getID() << " with parent " << parent_id << llendl; -#endif + LL_DEBUGS("ORPHANS") << "Orphaning object " << childp->getID() << " with parent " << parent_id << LL_ENDL; // We're an orphan, flag things appropriately. childp->mOrphaned = TRUE; @@ -1979,7 +2116,7 @@ void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip // object probably ISN'T being reparented, but just got an object // update out of order (child update before parent). make_invisible = false; - //llinfos << "Don't make object handoffs invisible!" << llendl; + //LL_INFOS() << "Don't make object handoffs invisible!" << LL_ENDL; } } @@ -2011,11 +2148,17 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) { if (objectp->isDead()) { - llwarns << "Trying to find orphans for dead obj " << objectp->mID - << ":" << objectp->getPCodeString() << llendl; + LL_WARNS() << "Trying to find orphans for dead obj " << objectp->mID + << ":" << objectp->getPCodeString() << LL_ENDL; return; } + //search object cache to get orphans + if(objectp->getRegion()) + { + objectp->getRegion()->findOrphans(objectp->getLocalID()); + } + // See if we are a parent of an orphan. // Note: This code is fairly inefficient but it should happen very rarely. // It can be sped up if this is somehow a performance issue... @@ -2046,16 +2189,16 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) { if (childp == objectp) { - llwarns << objectp->mID << " has self as parent, skipping!" - << llendl; + LL_WARNS() << objectp->mID << " has self as parent, skipping!" + << LL_ENDL; continue; } + LL_DEBUGS("ORPHANS") << "Reunited parent " << objectp->mID + << " with child " << childp->mID << LL_ENDL; + LL_DEBUGS("ORPHANS") << "Glob: " << objectp->getPositionGlobal() << LL_ENDL; + LL_DEBUGS("ORPHANS") << "Agent: " << objectp->getPositionAgent() << LL_ENDL; #ifdef ORPHAN_SPAM - llinfos << "Reunited parent " << objectp->mID - << " with child " << childp->mID << llendl; - llinfos << "Glob: " << objectp->getPositionGlobal() << llendl; - llinfos << "Agent: " << objectp->getPositionAgent() << llendl; addDebugBeacon(objectp->getPositionAgent(),""); #endif gPipeline.markMoved(objectp->mDrawable); @@ -2080,7 +2223,7 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) } else { - llinfos << "Missing orphan child, removing from list" << llendl; + LL_INFOS() << "Missing orphan child, removing from list" << LL_ENDL; iter = mOrphanChildren.erase(iter); } @@ -2143,3 +2286,10 @@ bool LLViewerObjectList::OrphanInfo::operator!=(const OrphanInfo &rhs) const } +LLDebugBeacon::~LLDebugBeacon() +{ + if (mHUDObject.notNull()) + { + mHUDObject->markDead(); + } +} diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 98b50fa78902f3b1bd818e6a617ff9dbfdebcc9a..594317cd9ff2b83829895470fe4b6789b0565b16 100755 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -31,8 +31,8 @@ #include <set> // common includes -#include "llstat.h" #include "llstring.h" +#include "lltrace.h" // project includes #include "llviewerobject.h" @@ -40,6 +40,7 @@ class LLCamera; class LLNetMap; class LLDebugBeacon; +class LLVOCacheEntry; const U32 CLOSE_BIN_SIZE = 10; const U32 NUM_BINS = 128; @@ -65,6 +66,7 @@ class LLViewerObjectList inline LLViewerObject *findObject(const LLUUID &id); LLViewerObject *createObjectViewer(const LLPCode pcode, LLViewerRegion *regionp); // Create a viewer-side object + LLViewerObject *createObjectFromCache(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id); LLViewerObject *createObject(const LLPCode pcode, LLViewerRegion *regionp, const LLUUID &uuid, const U32 local_id, const LLHost &sender); @@ -78,8 +80,10 @@ class LLViewerObjectList void cleanDeadObjects(const BOOL use_timer = TRUE); // Clean up the dead object list. // Simulator and viewer side object updates... - void processUpdateCore(LLViewerObject* objectp, void** data, U32 block, const EObjectUpdateType update_type, LLDataPacker* dpp, BOOL justCreated); - void processObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type, bool cached=false, bool compressed=false); + void processUpdateCore(LLViewerObject* objectp, void** data, U32 block, const EObjectUpdateType update_type, + LLDataPacker* dpp, bool justCreated, bool from_cache = false); + LLViewerObject* processObjectUpdateFromCache(LLVOCacheEntry* entry, LLViewerRegion* regionp); + void processObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type, bool compressed=false); void processCompressedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type); void processCachedObjectUpdate(LLMessageSystem *mesgsys, void **user_data, EObjectUpdateType update_type); void updateApparentAngles(LLAgent &agent); @@ -166,8 +170,6 @@ class LLViewerObjectList // Statistics data (see also LLViewerStats) S32 mNumNewObjects; - S32 mNumSizeCulled; - S32 mNumVisCulled; // if we paused in the last frame // used to discount stats from this frame @@ -194,8 +196,6 @@ class LLViewerObjectList std::vector<OrphanInfo> mOrphanChildren; // UUID's of orphaned objects S32 mNumOrphans; - static LLStat sCacheHitRate; - typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t; vobj_list_t mObjects; @@ -233,20 +233,14 @@ class LLViewerObjectList class LLDebugBeacon { public: - ~LLDebugBeacon() - { - if (mHUDObject.notNull()) - { - mHUDObject->markDead(); - } - } + ~LLDebugBeacon(); LLVector3 mPositionAgent; std::string mString; LLColor4 mColor; LLColor4 mTextColor; S32 mLineWidth; - LLPointer<LLHUDObject> mHUDObject; + LLPointer<class LLHUDObject> mHUDObject; }; @@ -278,7 +272,7 @@ inline LLViewerObject *LLViewerObjectList::getObject(const S32 index) objectp = mObjects[index]; if (objectp->isDead()) { - //llwarns << "Dead object " << objectp->mID << " in getObject" << llendl; + //LL_WARNS() << "Dead object " << objectp->mID << " in getObject" << LL_ENDL; return NULL; } return objectp; diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp new file mode 100644 index 0000000000000000000000000000000000000000..03c3f0fc0891c94a3a2e208a095bd85a1ba89306 --- /dev/null +++ b/indra/newview/llvieweroctree.cpp @@ -0,0 +1,1560 @@ +/** + * @file llvieweroctree.cpp + * @brief LLViewerOctreeGroup class implementation and supporting functions + * + * $LicenseInfo:firstyear=2003&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llvieweroctree.h" +#include "llviewerregion.h" +#include "pipeline.h" +#include "llviewercontrol.h" +#include "llappviewer.h" +#include "llglslshader.h" +#include "llviewershadermgr.h" + +//----------------------------------------------------------------------------------- +//static variables definitions +//----------------------------------------------------------------------------------- +U32 LLViewerOctreeEntryData::sCurVisible = 10; //reserve the low numbers for special use. +BOOL LLViewerOctreeDebug::sInDebug = FALSE; + +static LLTrace::CountStatHandle<S32> sOcclusionQueries("occlusion_queries", "Number of occlusion queries executed"), + sNumObjectsOccluded("occluded_objects", "Count of objects being occluded by a query"), + sNumObjectsUnoccluded("unoccluded_objects", "Count of objects being unoccluded by a query"); + +//----------------------------------------------------------------------------------- +//some global functions definitions +//----------------------------------------------------------------------------------- +typedef enum +{ + b000 = 0x00, + b001 = 0x01, + b010 = 0x02, + b011 = 0x03, + b100 = 0x04, + b101 = 0x05, + b110 = 0x06, + b111 = 0x07, +} eLoveTheBits; + +//contact Runitai Linden for a copy of the SL object used to write this table +//basically, you give the table a bitmask of the look-at vector to a node and it +//gives you a triangle fan index array +static U16 sOcclusionIndices[] = +{ + //000 + b111, b110, b010, b011, b001, b101, b100, b110, + //001 + b011, b010, b000, b001, b101, b111, b110, b010, + //010 + b101, b100, b110, b111, b011, b001, b000, b100, + //011 + b001, b000, b100, b101, b111, b011, b010, b000, + //100 + b110, b000, b010, b011, b111, b101, b100, b000, + //101 + b010, b100, b000, b001, b011, b111, b110, b100, + //110 + b100, b010, b110, b111, b101, b001, b000, b010, + //111 + b000, b110, b100, b101, b001, b011, b010, b110, +}; + +U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center) +{ + LLVector4a origin; + origin.load3(camera->getOrigin().mV); + + S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7; + + return cypher*8; +} + +U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center) +{ + LLVector4a origin; + origin.load3(camera->getOrigin().mV); + + S32 cypher = center.greaterThan(origin).getGatheredBits() & 0x7; + + return (U8*) (sOcclusionIndices+cypher*8); +} + +//create a vertex buffer for efficiently rendering cubes +LLVertexBuffer* ll_create_cube_vb(U32 type_mask, U32 usage) +{ + LLVertexBuffer* ret = new LLVertexBuffer(type_mask, usage); + + ret->allocateBuffer(8, 64, true); + + LLStrider<LLVector3> pos; + LLStrider<U16> idx; + + ret->getVertexStrider(pos); + ret->getIndexStrider(idx); + + pos[0] = LLVector3(-1,-1,-1); + pos[1] = LLVector3(-1,-1, 1); + pos[2] = LLVector3(-1, 1,-1); + pos[3] = LLVector3(-1, 1, 1); + pos[4] = LLVector3( 1,-1,-1); + pos[5] = LLVector3( 1,-1, 1); + pos[6] = LLVector3( 1, 1,-1); + pos[7] = LLVector3( 1, 1, 1); + + for (U32 i = 0; i < 64; i++) + { + idx[i] = sOcclusionIndices[i]; + } + + ret->flush(); + + return ret; +} + + +#define LL_TRACK_PENDING_OCCLUSION_QUERIES 0 + +const F32 SG_OCCLUSION_FUDGE = 0.25f; +#define SG_DISCARD_TOLERANCE 0.01f + + +S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad) +{ + return AABBSphereIntersectR2(min, max, origin, rad*rad); +} + +S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &r) +{ + F32 d = 0.f; + F32 t; + + if ((min-origin).magVecSquared() < r && + (max-origin).magVecSquared() < r) + { + return 2; + } + + for (U32 i = 0; i < 3; i++) + { + if (origin.mV[i] < min.mV[i]) + { + t = min.mV[i] - origin.mV[i]; + d += t*t; + } + else if (origin.mV[i] > max.mV[i]) + { + t = origin.mV[i] - max.mV[i]; + d += t*t; + } + + if (d > r) + { + return 0; + } + } + + return 1; +} + + +S32 AABBSphereIntersect(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &rad) +{ + return AABBSphereIntersectR2(min, max, origin, rad*rad); +} + +S32 AABBSphereIntersectR2(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &r) +{ + F32 d = 0.f; + F32 t; + + LLVector4a origina; + origina.load3(origin.mV); + + LLVector4a v; + v.setSub(min, origina); + + if (v.dot3(v) < r) + { + v.setSub(max, origina); + if (v.dot3(v) < r) + { + return 2; + } + } + + + for (U32 i = 0; i < 3; i++) + { + if (origin.mV[i] < min[i]) + { + t = min[i] - origin.mV[i]; + d += t*t; + } + else if (origin.mV[i] > max[i]) + { + t = origin.mV[i] - max[i]; + d += t*t; + } + + if (d > r) + { + return 0; + } + } + + return 1; +} + +//----------------------------------------------------------------------------------- +//class LLViewerOctreeEntry definitions +//----------------------------------------------------------------------------------- +LLViewerOctreeEntry::LLViewerOctreeEntry() +: LLTrace::MemTrackable<LLViewerOctreeEntry, 16>("LLViewerOctreeEntry"), + mGroup(NULL), + mBinRadius(0.f), + mBinIndex(-1), + mVisible(0) +{ + mPositionGroup.clear(); + mExtents[0].clear(); + mExtents[1].clear(); + + for(S32 i = 0; i < NUM_DATA_TYPE; i++) + { + mData[i] = NULL; + } +} + +LLViewerOctreeEntry::~LLViewerOctreeEntry() +{ + llassert(!mGroup); +} + +void LLViewerOctreeEntry::addData(LLViewerOctreeEntryData* data) +{ + //llassert(mData[data->getDataType()] == NULL); + llassert(data != NULL); + + mData[data->getDataType()] = data; +} + +void LLViewerOctreeEntry::removeData(LLViewerOctreeEntryData* data) +{ + //llassert(data->getDataType() != LLVOCACHEENTRY); //can not remove VOCache entry + + if(!mData[data->getDataType()]) + { + return; + } + if(mData[data->getDataType()] != data) + { + return; + } + + mData[data->getDataType()] = NULL; + + if(mGroup != NULL && !mData[LLDRAWABLE]) + { + LLViewerOctreeGroup* group = mGroup; + mGroup = NULL; + group->removeFromGroup(data); + + llassert(mBinIndex == -1); + } +} + +//called by group handleDestruction() ONLY when group is destroyed by octree. +void LLViewerOctreeEntry::nullGroup() +{ + mGroup = NULL; +} + +void LLViewerOctreeEntry::setGroup(LLViewerOctreeGroup* group) +{ + if(mGroup == group) + { + return; + } + + if(mGroup) + { + LLViewerOctreeGroup* old_group = mGroup; + mGroup = NULL; + old_group->removeFromGroup(this); + + llassert(mBinIndex == -1); + } + + mGroup = group; +} + +//----------------------------------------------------------------------------------- +//class LLViewerOctreeEntryData definitions +//----------------------------------------------------------------------------------- +LLViewerOctreeEntryData::~LLViewerOctreeEntryData() +{ + if(mEntry) + { + mEntry->removeData(this); + } +} + +LLViewerOctreeEntryData::LLViewerOctreeEntryData(LLViewerOctreeEntry::eEntryDataType_t data_type) + : mDataType(data_type), + mEntry(NULL) +{ +} + +//virtual +void LLViewerOctreeEntryData::setOctreeEntry(LLViewerOctreeEntry* entry) +{ + llassert_always(mEntry.isNull()); + + if(mEntry.notNull()) + { + return; + } + + if(!entry) + { + mEntry = new LLViewerOctreeEntry(); + } + else + { + mEntry = entry; + } + mEntry->addData(this); +} + +void LLViewerOctreeEntryData::removeOctreeEntry() +{ + if(mEntry) + { + mEntry->removeData(this); + mEntry = NULL; + } +} + +void LLViewerOctreeEntryData::setSpatialExtents(const LLVector3& min, const LLVector3& max) +{ + mEntry->mExtents[0].load3(min.mV); + mEntry->mExtents[1].load3(max.mV); +} + +void LLViewerOctreeEntryData::setSpatialExtents(const LLVector4a& min, const LLVector4a& max) +{ + mEntry->mExtents[0] = min; + mEntry->mExtents[1] = max; +} + +void LLViewerOctreeEntryData::setPositionGroup(const LLVector4a& pos) +{ + mEntry->mPositionGroup = pos; +} + +const LLVector4a* LLViewerOctreeEntryData::getSpatialExtents() const +{ + return mEntry->getSpatialExtents(); +} + +//virtual +void LLViewerOctreeEntryData::setGroup(LLViewerOctreeGroup* group) +{ + mEntry->setGroup(group); +} + +void LLViewerOctreeEntryData::shift(const LLVector4a &shift_vector) +{ + mEntry->mExtents[0].add(shift_vector); + mEntry->mExtents[1].add(shift_vector); + mEntry->mPositionGroup.add(shift_vector); +} + +LLViewerOctreeGroup* LLViewerOctreeEntryData::getGroup()const +{ + return mEntry.notNull() ? mEntry->mGroup : NULL; +} + +const LLVector4a& LLViewerOctreeEntryData::getPositionGroup() const +{ + return mEntry->getPositionGroup(); +} + +//virtual +bool LLViewerOctreeEntryData::isVisible() const +{ + if(mEntry) + { + return mEntry->mVisible == sCurVisible; + } + return false; +} + +//virtual +bool LLViewerOctreeEntryData::isRecentlyVisible() const +{ + if(!mEntry) + { + return false; + } + + if(isVisible()) + { + return true; + } + if(getGroup() && getGroup()->isRecentlyVisible()) + { + setVisible(); + return true; + } + + return false; +} + +void LLViewerOctreeEntryData::setVisible() const +{ + if(mEntry) + { + mEntry->mVisible = sCurVisible; + } +} + +void LLViewerOctreeEntryData::resetVisible() const +{ + if(mEntry) + { + mEntry->mVisible = 0; + } +} +//----------------------------------------------------------------------------------- +//class LLViewerOctreeGroup definitions +//----------------------------------------------------------------------------------- + +LLViewerOctreeGroup::~LLViewerOctreeGroup() +{ + //empty here +} + +LLViewerOctreeGroup::LLViewerOctreeGroup(OctreeNode* node) +: LLTrace::MemTrackable<LLViewerOctreeGroup, 16>("LLViewerOctreeGroup"), + mOctreeNode(node), + mAnyVisible(0), + mState(CLEAN) +{ + LLVector4a tmp; + tmp.splat(0.f); + mExtents[0] = mExtents[1] = mObjectBounds[0] = mObjectBounds[0] = mObjectBounds[1] = + mObjectExtents[0] = mObjectExtents[1] = tmp; + + mBounds[0] = node->getCenter(); + mBounds[1] = node->getSize(); + + mOctreeNode->addListener(this); +} + +bool LLViewerOctreeGroup::hasElement(LLViewerOctreeEntryData* data) +{ + if(!data->getEntry()) + { + return false; + } + return std::find(getDataBegin(), getDataEnd(), data->getEntry()) != getDataEnd(); +} + +bool LLViewerOctreeGroup::removeFromGroup(LLViewerOctreeEntryData* data) +{ + return removeFromGroup(data->getEntry()); +} + +bool LLViewerOctreeGroup::removeFromGroup(LLViewerOctreeEntry* entry) +{ + llassert(entry != NULL); + llassert(!entry->getGroup()); + + if(isDead()) //group is about to be destroyed, not need to double delete the entry. + { + entry->setBinIndex(-1); + return true; + } + + unbound(); + setState(OBJECT_DIRTY); + + if (mOctreeNode) + { + if (!mOctreeNode->remove(entry)) //this could cause *this* pointer to be destroyed, so no more function calls after this. + { + OCT_ERRS << "Could not remove LLVOCacheEntry from LLVOCacheOctreeGroup" << LL_ENDL; + return false; + } + } + + return true; +} + +//virtual +void LLViewerOctreeGroup::unbound() +{ + if (isDirty()) + { + return; + } + + setState(DIRTY); + + //all the parent nodes need to rebound this child + if (mOctreeNode) + { + OctreeNode* parent = (OctreeNode*) mOctreeNode->getParent(); + while (parent != NULL) + { + LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) parent->getListener(0); + if (!group || group->isDirty()) + { + return; + } + + group->setState(DIRTY); + parent = (OctreeNode*) parent->getParent(); + } + } +} + +//virtual +void LLViewerOctreeGroup::rebound() +{ + if (!isDirty()) + { + return; + } + + if (mOctreeNode->getChildCount() == 1 && mOctreeNode->getElementCount() == 0) + { + LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) mOctreeNode->getChild(0)->getListener(0); + group->rebound(); + + //copy single child's bounding box + mBounds[0] = group->mBounds[0]; + mBounds[1] = group->mBounds[1]; + mExtents[0] = group->mExtents[0]; + mExtents[1] = group->mExtents[1]; + + group->setState(SKIP_FRUSTUM_CHECK); + } + else if (mOctreeNode->isLeaf()) + { //copy object bounding box if this is a leaf + boundObjects(TRUE, mExtents[0], mExtents[1]); + mBounds[0] = mObjectBounds[0]; + mBounds[1] = mObjectBounds[1]; + } + else + { + LLVector4a& newMin = mExtents[0]; + LLVector4a& newMax = mExtents[1]; + LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) mOctreeNode->getChild(0)->getListener(0); + group->clearState(SKIP_FRUSTUM_CHECK); + group->rebound(); + //initialize to first child + newMin = group->mExtents[0]; + newMax = group->mExtents[1]; + + //first, rebound children + for (U32 i = 1; i < mOctreeNode->getChildCount(); i++) + { + group = (LLViewerOctreeGroup*) mOctreeNode->getChild(i)->getListener(0); + group->clearState(SKIP_FRUSTUM_CHECK); + group->rebound(); + const LLVector4a& max = group->mExtents[1]; + const LLVector4a& min = group->mExtents[0]; + + newMax.setMax(newMax, max); + newMin.setMin(newMin, min); + } + + boundObjects(FALSE, newMin, newMax); + + mBounds[0].setAdd(newMin, newMax); + mBounds[0].mul(0.5f); + mBounds[1].setSub(newMax, newMin); + mBounds[1].mul(0.5f); + } + + clearState(DIRTY); + + return; +} + +//virtual +void LLViewerOctreeGroup::handleInsertion(const TreeNode* node, LLViewerOctreeEntry* obj) +{ + obj->setGroup(this); + unbound(); + setState(OBJECT_DIRTY); +} + +//virtual +void LLViewerOctreeGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntry* obj) +{ + unbound(); + setState(OBJECT_DIRTY); + + obj->setGroup(NULL); //this could cause *this* pointer to be destroyed. So no more function calls after this. +} + +//virtual +void LLViewerOctreeGroup::handleDestruction(const TreeNode* node) +{ + for (OctreeNode::element_iter i = mOctreeNode->getDataBegin(); i != mOctreeNode->getDataEnd(); ++i) + { + LLViewerOctreeEntry* obj = *i; + if (obj && obj->getGroup() == this) + { + obj->nullGroup(); + //obj->setGroup(NULL); + } + } + mOctreeNode = NULL; +} + +//virtual +void LLViewerOctreeGroup::handleStateChange(const TreeNode* node) +{ + //drop bounding box upon state change + if (mOctreeNode != node) + { + mOctreeNode = (OctreeNode*) node; + } + unbound(); +} + +//virtual +void LLViewerOctreeGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child) +{ + if (child->getListenerCount() == 0) + { + new LLViewerOctreeGroup(child); + } + else + { + OCT_ERRS << "LLViewerOctreeGroup redundancy detected." << LL_ENDL; + } + + unbound(); + + ((LLViewerOctreeGroup*)child->getListener(0))->unbound(); +} + +//virtual +void LLViewerOctreeGroup::handleChildRemoval(const OctreeNode* parent, const OctreeNode* child) +{ + unbound(); +} + +LLViewerOctreeGroup* LLViewerOctreeGroup::getParent() +{ + if (isDead()) + { + return NULL; + } + + if(!mOctreeNode) + { + return NULL; + } + + OctreeNode* parent = mOctreeNode->getOctParent(); + + if (parent) + { + return (LLViewerOctreeGroup*) parent->getListener(0); + } + + return NULL; +} + +//virtual +bool LLViewerOctreeGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut) +{ + const OctreeNode* node = mOctreeNode; + + if (node->isEmpty()) + { //don't do anything if there are no objects + if (empty && mOctreeNode->getParent()) + { //only root is allowed to be empty + OCT_ERRS << "Empty leaf found in octree." << LL_ENDL; + } + return false; + } + + LLVector4a& newMin = mObjectExtents[0]; + LLVector4a& newMax = mObjectExtents[1]; + + if (hasState(OBJECT_DIRTY)) + { //calculate new bounding box + clearState(OBJECT_DIRTY); + + //initialize bounding box to first element + OctreeNode::const_element_iter i = node->getDataBegin(); + LLViewerOctreeEntry* entry = *i; + const LLVector4a* minMax = entry->getSpatialExtents(); + + newMin = minMax[0]; + newMax = minMax[1]; + + for (++i; i != node->getDataEnd(); ++i) + { + entry = *i; + minMax = entry->getSpatialExtents(); + + update_min_max(newMin, newMax, minMax[0]); + update_min_max(newMin, newMax, minMax[1]); + } + + mObjectBounds[0].setAdd(newMin, newMax); + mObjectBounds[0].mul(0.5f); + mObjectBounds[1].setSub(newMax, newMin); + mObjectBounds[1].mul(0.5f); + } + + if (empty) + { + minOut = newMin; + maxOut = newMax; + } + else + { + minOut.setMin(minOut, newMin); + maxOut.setMax(maxOut, newMax); + } + + return TRUE; +} + +//virtual +BOOL LLViewerOctreeGroup::isVisible() const +{ + return mVisible[LLViewerCamera::sCurCameraID] >= LLViewerOctreeEntryData::getCurrentFrame() ? TRUE : FALSE; +} + +//virtual +BOOL LLViewerOctreeGroup::isRecentlyVisible() const +{ + return FALSE; +} + +void LLViewerOctreeGroup::setVisible() +{ + mVisible[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame(); + + if(LLViewerCamera::sCurCameraID < LLViewerCamera::CAMERA_WATER0) + { + mAnyVisible = LLViewerOctreeEntryData::getCurrentFrame(); + } +} + +void LLViewerOctreeGroup::checkStates() +{ +#if LL_OCTREE_PARANOIA_CHECK + //LLOctreeStateCheck checker; + //checker.traverse(mOctreeNode); +#endif +} + +//------------------------------------------------------------------------------------------- +//occulsion culling functions and classes +//------------------------------------------------------------------------------------------- +std::set<U32> LLOcclusionCullingGroup::sPendingQueries; +class LLOcclusionQueryPool : public LLGLNamePool +{ +public: + LLOcclusionQueryPool() + { + } + +protected: + + virtual GLuint allocateName() + { + GLuint ret = 0; + + glGenQueriesARB(1, &ret); + + return ret; + } + + virtual void releaseName(GLuint name) + { +#if LL_TRACK_PENDING_OCCLUSION_QUERIES + LLOcclusionCullingGroup::sPendingQueries.erase(name); +#endif + glDeleteQueriesARB(1, &name); + } +}; + +static LLOcclusionQueryPool sQueryPool; +U32 LLOcclusionCullingGroup::getNewOcclusionQueryObjectName() +{ + return sQueryPool.allocate(); +} + +void LLOcclusionCullingGroup::releaseOcclusionQueryObjectName(GLuint name) +{ + sQueryPool.release(name); +} + +//===================================== +// Occlusion State Set/Clear +//===================================== +class LLSpatialSetOcclusionState : public OctreeTraveler +{ +public: + U32 mState; + LLSpatialSetOcclusionState(U32 state) : mState(state) { } + virtual void visit(const OctreeNode* branch) + { + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)branch->getListener(0); + if(group) + { + group->setOcclusionState(mState); + } + } +}; + +class LLSpatialSetOcclusionStateDiff : public LLSpatialSetOcclusionState +{ +public: + LLSpatialSetOcclusionStateDiff(U32 state) : LLSpatialSetOcclusionState(state) { } + + virtual void traverse(const OctreeNode* n) + { + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*) n->getListener(0); + + if (group && !group->isOcclusionState(mState)) + { + OctreeTraveler::traverse(n); + } + } +}; + + +LLOcclusionCullingGroup::LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part) : + LLViewerOctreeGroup(node), + mSpatialPartition(part) +{ + part->mLODSeed = (part->mLODSeed+1)%part->mLODPeriod; + mLODHash = part->mLODSeed; + + OctreeNode* oct_parent = node->getOctParent(); + LLOcclusionCullingGroup* parent = oct_parent ? (LLOcclusionCullingGroup*) oct_parent->getListener(0) : NULL; + + for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) + { + mOcclusionQuery[i] = 0; + mOcclusionIssued[i] = 0; + mOcclusionState[i] = parent ? SG_STATE_INHERIT_MASK & parent->mOcclusionState[i] : 0; + mVisible[i] = 0; + } +} + +LLOcclusionCullingGroup::~LLOcclusionCullingGroup() +{ + releaseOcclusionQueryObjectNames(); +} + +BOOL LLOcclusionCullingGroup::needsUpdate() +{ + return (LLDrawable::getCurrentFrame() % mSpatialPartition->mLODPeriod == mLODHash) ? TRUE : FALSE; +} + +BOOL LLOcclusionCullingGroup::isRecentlyVisible() const +{ + const S32 MIN_VIS_FRAME_RANGE = 2; + return (LLDrawable::getCurrentFrame() - mVisible[LLViewerCamera::sCurCameraID]) < MIN_VIS_FRAME_RANGE ; +} + +BOOL LLOcclusionCullingGroup::isAnyRecentlyVisible() const +{ + const S32 MIN_VIS_FRAME_RANGE = 2; + return (LLDrawable::getCurrentFrame() - mAnyVisible) < MIN_VIS_FRAME_RANGE ; +} + +//virtual +void LLOcclusionCullingGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child) +{ + if (child->getListenerCount() == 0) + { + new LLOcclusionCullingGroup(child, mSpatialPartition); + } + else + { + OCT_ERRS << "LLOcclusionCullingGroup redundancy detected." << LL_ENDL; + } + + unbound(); + + ((LLViewerOctreeGroup*)child->getListener(0))->unbound(); +} + +void LLOcclusionCullingGroup::releaseOcclusionQueryObjectNames() +{ + if (gGLManager.mHasOcclusionQuery) + { + for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; ++i) + { + if (mOcclusionQuery[i]) + { + releaseOcclusionQueryObjectName(mOcclusionQuery[i]); + mOcclusionQuery[i] = 0; + } + } + } +} + +void LLOcclusionCullingGroup::setOcclusionState(U32 state, S32 mode) +{ + if (mode > STATE_MODE_SINGLE) + { + if (mode == STATE_MODE_DIFF) + { + LLSpatialSetOcclusionStateDiff setter(state); + setter.traverse(mOctreeNode); + } + else if (mode == STATE_MODE_BRANCH) + { + LLSpatialSetOcclusionState setter(state); + setter.traverse(mOctreeNode); + } + else + { + for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) + { + mOcclusionState[i] |= state; + + if ((state & DISCARD_QUERY) && mOcclusionQuery[i]) + { + releaseOcclusionQueryObjectName(mOcclusionQuery[i]); + mOcclusionQuery[i] = 0; + } + } + } + } + else + { + if (state & OCCLUDED) + { + add(sNumObjectsOccluded, 1); + } + mOcclusionState[LLViewerCamera::sCurCameraID] |= state; + if ((state & DISCARD_QUERY) && mOcclusionQuery[LLViewerCamera::sCurCameraID]) + { + releaseOcclusionQueryObjectName(mOcclusionQuery[LLViewerCamera::sCurCameraID]); + mOcclusionQuery[LLViewerCamera::sCurCameraID] = 0; + } + } +} + +class LLSpatialClearOcclusionState : public OctreeTraveler +{ +public: + U32 mState; + + LLSpatialClearOcclusionState(U32 state) : mState(state) { } + virtual void visit(const OctreeNode* branch) + { + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)branch->getListener(0); + if(group) + { + group->clearOcclusionState(mState); + } + } +}; + +class LLSpatialClearOcclusionStateDiff : public LLSpatialClearOcclusionState +{ +public: + LLSpatialClearOcclusionStateDiff(U32 state) : LLSpatialClearOcclusionState(state) { } + + virtual void traverse(const OctreeNode* n) + { + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*) n->getListener(0); + + if (group && group->isOcclusionState(mState)) + { + OctreeTraveler::traverse(n); + } + } +}; + +void LLOcclusionCullingGroup::clearOcclusionState(U32 state, S32 mode) +{ + if (mode > STATE_MODE_SINGLE) + { + if (mode == STATE_MODE_DIFF) + { + LLSpatialClearOcclusionStateDiff clearer(state); + clearer.traverse(mOctreeNode); + } + else if (mode == STATE_MODE_BRANCH) + { + LLSpatialClearOcclusionState clearer(state); + clearer.traverse(mOctreeNode); + } + else + { + for (U32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) + { + mOcclusionState[i] &= ~state; + } + } + } + else + { + if (state & OCCLUDED) + { + add(sNumObjectsUnoccluded, 1); + } + mOcclusionState[LLViewerCamera::sCurCameraID] &= ~state; + } +} + +static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_READBACK("Readback Occlusion"); +static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_WAIT("Occlusion Wait"); + +BOOL LLOcclusionCullingGroup::earlyFail(LLCamera* camera, const LLVector4a* bounds) +{ + if (camera->getOrigin().isExactlyZero()) + { + return FALSE; + } + + const F32 vel = SG_OCCLUSION_FUDGE*2.f; + LLVector4a fudge; + fudge.splat(vel); + + const LLVector4a& c = bounds[0]; + LLVector4a r; + r.setAdd(bounds[1], fudge); + + /*if (r.magVecSquared() > 1024.0*1024.0) + { + return TRUE; + }*/ + + LLVector4a e; + e.load3(camera->getOrigin().mV); + + LLVector4a min; + min.setSub(c,r); + LLVector4a max; + max.setAdd(c,r); + + S32 lt = e.lessThan(min).getGatheredBits() & 0x7; + if (lt) + { + return FALSE; + } + + S32 gt = e.greaterThan(max).getGatheredBits() & 0x7; + if (gt) + { + return FALSE; + } + + return TRUE; +} + +U32 LLOcclusionCullingGroup::getLastOcclusionIssuedTime() +{ + return mOcclusionIssued[LLViewerCamera::sCurCameraID]; +} + +void LLOcclusionCullingGroup::checkOcclusion() +{ + if (LLPipeline::sUseOcclusion > 1) + { + LL_RECORD_BLOCK_TIME(FTM_OCCLUSION_READBACK); + LLOcclusionCullingGroup* parent = (LLOcclusionCullingGroup*)getParent(); + if (parent && parent->isOcclusionState(LLOcclusionCullingGroup::OCCLUDED)) + { //if the parent has been marked as occluded, the child is implicitly occluded + clearOcclusionState(QUERY_PENDING | DISCARD_QUERY); + } + else if (isOcclusionState(QUERY_PENDING)) + { //otherwise, if a query is pending, read it back + + GLuint available = 0; + if (mOcclusionQuery[LLViewerCamera::sCurCameraID]) + { + glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available); + + static LLCachedControl<bool> wait_for_query(gSavedSettings, "RenderSynchronousOcclusion", true); + + if (wait_for_query && mOcclusionIssued[LLViewerCamera::sCurCameraID] < gFrameCount) + { //query was issued last frame, wait until it's available + S32 max_loop = 1024; + LL_RECORD_BLOCK_TIME(FTM_OCCLUSION_WAIT); + while (!available && max_loop-- > 0) + { + //do some usefu work while we wait + F32 max_time = llmin(gFrameIntervalSeconds.value()*10.f, 1.f); + LLAppViewer::instance()->updateTextureThreads(max_time); + + glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available); + } + } + } + else + { + available = 1; + } + + if (available) + { //result is available, read it back, otherwise wait until next frame + GLuint res = 1; + if (!isOcclusionState(DISCARD_QUERY) && mOcclusionQuery[LLViewerCamera::sCurCameraID]) + { + glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_ARB, &res); +#if LL_TRACK_PENDING_OCCLUSION_QUERIES + sPendingQueries.erase(mOcclusionQuery[LLViewerCamera::sCurCameraID]); +#endif + } + else if (mOcclusionQuery[LLViewerCamera::sCurCameraID]) + { //delete the query to avoid holding onto hundreds of pending queries + releaseOcclusionQueryObjectName(mOcclusionQuery[LLViewerCamera::sCurCameraID]); + mOcclusionQuery[LLViewerCamera::sCurCameraID] = 0; + } + + if (isOcclusionState(DISCARD_QUERY)) + { + res = 2; + } + + if (res > 0) + { + assert_states_valid(this); + clearOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF); + assert_states_valid(this); + } + else + { + assert_states_valid(this); + + setOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF); + + assert_states_valid(this); + } + + clearOcclusionState(QUERY_PENDING | DISCARD_QUERY); + } + } + else if (mSpatialPartition->isOcclusionEnabled() && isOcclusionState(LLOcclusionCullingGroup::OCCLUDED)) + { //check occlusion has been issued for occluded node that has not had a query issued + assert_states_valid(this); + clearOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF); + assert_states_valid(this); + } + } +} + +static LLTrace::BlockTimerStatHandle FTM_PUSH_OCCLUSION_VERTS("Push Occlusion"); +static LLTrace::BlockTimerStatHandle FTM_SET_OCCLUSION_STATE("Occlusion State"); +static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_EARLY_FAIL("Occlusion Early Fail"); +static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_ALLOCATE("Allocate"); +static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_BUILD("Build"); +static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_BEGIN_QUERY("Begin Query"); +static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_END_QUERY("End Query"); +static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_SET_BUFFER("Set Buffer"); +static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_DRAW_WATER("Draw Water"); +static LLTrace::BlockTimerStatHandle FTM_OCCLUSION_DRAW("Draw"); + +void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* shift) +{ + if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1) + { + //move mBounds to the agent space if necessary + LLVector4a bounds[2]; + bounds[0] = mBounds[0]; + bounds[1] = mBounds[1]; + if(shift != NULL) + { + bounds[0].add(*shift); + } + + // Don't cull hole/edge water, unless we have the GL_ARB_depth_clamp extension + if (earlyFail(camera, bounds)) + { + LL_RECORD_BLOCK_TIME(FTM_OCCLUSION_EARLY_FAIL); + setOcclusionState(LLOcclusionCullingGroup::DISCARD_QUERY); + assert_states_valid(this); + clearOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF); + assert_states_valid(this); + } + else + { + if (!isOcclusionState(QUERY_PENDING) || isOcclusionState(DISCARD_QUERY)) + { + { //no query pending, or previous query to be discarded + LL_RECORD_BLOCK_TIME(FTM_RENDER_OCCLUSION); + + if (!mOcclusionQuery[LLViewerCamera::sCurCameraID]) + { + LL_RECORD_BLOCK_TIME(FTM_OCCLUSION_ALLOCATE); + mOcclusionQuery[LLViewerCamera::sCurCameraID] = getNewOcclusionQueryObjectName(); + } + + // Depth clamp all water to avoid it being culled as a result of being + // behind the far clip plane, and in the case of edge water to avoid + // it being culled while still visible. + bool const use_depth_clamp = gGLManager.mHasDepthClamp && + (mSpatialPartition->mDrawableType == LLDrawPool::POOL_WATER || + mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER); + + LLGLEnable clamp(use_depth_clamp ? GL_DEPTH_CLAMP : 0); + +#if !LL_DARWIN + U32 mode = gGLManager.mHasOcclusionQuery2 ? GL_ANY_SAMPLES_PASSED : GL_SAMPLES_PASSED_ARB; +#else + U32 mode = GL_SAMPLES_PASSED_ARB; +#endif + +#if LL_TRACK_PENDING_OCCLUSION_QUERIES + sPendingQueries.insert(mOcclusionQuery[LLViewerCamera::sCurCameraID]); +#endif + add(sOcclusionQueries, 1); + + { + LL_RECORD_BLOCK_TIME(FTM_PUSH_OCCLUSION_VERTS); + + //store which frame this query was issued on + mOcclusionIssued[LLViewerCamera::sCurCameraID] = gFrameCount; + + { + LL_RECORD_BLOCK_TIME(FTM_OCCLUSION_BEGIN_QUERY); + glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]); + } + + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + llassert(shader); + + shader->uniform3fv(LLShaderMgr::BOX_CENTER, 1, bounds[0].getF32ptr()); + shader->uniform3f(LLShaderMgr::BOX_SIZE, bounds[1][0]+SG_OCCLUSION_FUDGE, + bounds[1][1]+SG_OCCLUSION_FUDGE, + bounds[1][2]+SG_OCCLUSION_FUDGE); + + if (!use_depth_clamp && mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER) + { + LL_RECORD_BLOCK_TIME(FTM_OCCLUSION_DRAW_WATER); + + LLGLSquashToFarClip squash(glh_get_current_projection(), 1); + if (camera->getOrigin().isExactlyZero()) + { //origin is invalid, draw entire box + gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0); + gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8); + } + else + { + gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, bounds[0])); + } + } + else + { + LL_RECORD_BLOCK_TIME(FTM_OCCLUSION_DRAW); + if (camera->getOrigin().isExactlyZero()) + { //origin is invalid, draw entire box + gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, 0); + gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, b111*8); + } + else + { + gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, bounds[0])); + } + } + + + { + LL_RECORD_BLOCK_TIME(FTM_OCCLUSION_END_QUERY); + glEndQueryARB(mode); + } + } + } + + { + LL_RECORD_BLOCK_TIME(FTM_SET_OCCLUSION_STATE); + setOcclusionState(LLOcclusionCullingGroup::QUERY_PENDING); + clearOcclusionState(LLOcclusionCullingGroup::DISCARD_QUERY); + } + } + } + } +} +//------------------------------------------------------------------------------------------- +//end of occulsion culling functions and classes +//------------------------------------------------------------------------------------------- + +//----------------------------------------------------------------------------------- +//class LLViewerOctreePartition definitions +//----------------------------------------------------------------------------------- +LLViewerOctreePartition::LLViewerOctreePartition() : + mRegionp(NULL), + mOcclusionEnabled(TRUE), + mDrawableType(0), + mLODSeed(0), + mLODPeriod(1) +{ + LLVector4a center, size; + center.splat(0.f); + size.splat(1.f); + + mOctree = new OctreeRoot(center,size, NULL); +} + +LLViewerOctreePartition::~LLViewerOctreePartition() +{ + delete mOctree; + mOctree = NULL; +} + +BOOL LLViewerOctreePartition::isOcclusionEnabled() +{ + return mOcclusionEnabled || LLPipeline::sUseOcclusion > 2; +} + +//----------------------------------------------------------------------------------- +//class LLViewerOctreeCull definitions +//----------------------------------------------------------------------------------- + +//virtual +bool LLViewerOctreeCull::earlyFail(LLViewerOctreeGroup* group) +{ + return false; +} + +//virtual +void LLViewerOctreeCull::traverse(const OctreeNode* n) +{ + LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) n->getListener(0); + + if (earlyFail(group)) + { + return; + } + + if (mRes == 2 || + (mRes && group->hasState(LLViewerOctreeGroup::SKIP_FRUSTUM_CHECK))) + { //fully in, just add everything + OctreeTraveler::traverse(n); + } + else + { + mRes = frustumCheck(group); + + if (mRes) + { //at least partially in, run on down + OctreeTraveler::traverse(n); + } + + mRes = 0; + } +} + +//------------------------------------------ +//agent space group culling +S32 LLViewerOctreeCull::AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group) +{ + return mCamera->AABBInFrustumNoFarClip(group->mBounds[0], group->mBounds[1]); +} + +S32 LLViewerOctreeCull::AABBSphereIntersectGroupExtents(const LLViewerOctreeGroup* group) +{ + return AABBSphereIntersect(group->mExtents[0], group->mExtents[1], mCamera->getOrigin(), mCamera->mFrustumCornerDist); +} + +S32 LLViewerOctreeCull::AABBInFrustumGroupBounds(const LLViewerOctreeGroup* group) +{ + return mCamera->AABBInFrustum(group->mBounds[0], group->mBounds[1]); +} +//------------------------------------------ + +//------------------------------------------ +//agent space object set culling +S32 LLViewerOctreeCull::AABBInFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group) +{ + return mCamera->AABBInFrustumNoFarClip(group->mObjectBounds[0], group->mObjectBounds[1]); +} + +S32 LLViewerOctreeCull::AABBSphereIntersectObjectExtents(const LLViewerOctreeGroup* group) +{ + return AABBSphereIntersect(group->mObjectExtents[0], group->mObjectExtents[1], mCamera->getOrigin(), mCamera->mFrustumCornerDist); +} + +S32 LLViewerOctreeCull::AABBInFrustumObjectBounds(const LLViewerOctreeGroup* group) +{ + return mCamera->AABBInFrustum(group->mObjectBounds[0], group->mObjectBounds[1]); +} +//------------------------------------------ + +//------------------------------------------ +//local regional space group culling +S32 LLViewerOctreeCull::AABBInRegionFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group) +{ + return mCamera->AABBInRegionFrustumNoFarClip(group->mBounds[0], group->mBounds[1]); +} + +S32 LLViewerOctreeCull::AABBInRegionFrustumGroupBounds(const LLViewerOctreeGroup* group) +{ + return mCamera->AABBInRegionFrustum(group->mBounds[0], group->mBounds[1]); +} + +S32 LLViewerOctreeCull::AABBRegionSphereIntersectGroupExtents(const LLViewerOctreeGroup* group, const LLVector3& shift) +{ + return AABBSphereIntersect(group->mExtents[0], group->mExtents[1], mCamera->getOrigin() - shift, mCamera->mFrustumCornerDist); +} +//------------------------------------------ + +//------------------------------------------ +//local regional space object culling +S32 LLViewerOctreeCull::AABBInRegionFrustumObjectBounds(const LLViewerOctreeGroup* group) +{ + return mCamera->AABBInRegionFrustum(group->mObjectBounds[0], group->mObjectBounds[1]); +} + +S32 LLViewerOctreeCull::AABBInRegionFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group) +{ + return mCamera->AABBInRegionFrustumNoFarClip(group->mObjectBounds[0], group->mObjectBounds[1]); +} + +S32 LLViewerOctreeCull::AABBRegionSphereIntersectObjectExtents(const LLViewerOctreeGroup* group, const LLVector3& shift) +{ + return AABBSphereIntersect(group->mObjectExtents[0], group->mObjectExtents[1], mCamera->getOrigin() - shift, mCamera->mFrustumCornerDist); +} +//------------------------------------------ +//check if the objects projection large enough + +bool LLViewerOctreeCull::checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_radius) +{ + LLVector3 local_orig = mCamera->getOrigin() - shift; + LLVector4a origin; + origin.load3(local_orig.mV); + + LLVector4a lookAt; + lookAt.setSub(center, origin); + F32 distance = lookAt.getLength3().getF32(); + if(distance <= near_radius) + { + return true; //always load close-by objects + } + + // treat object as if it were near_radius meters closer than it actually was. + // this allows us to get some temporal coherence on visibility...objects that can be reached quickly will tend to be visible + distance -= near_radius; + + F32 squared_rad = size.dot3(size).getF32(); + return squared_rad / distance > pixel_threshold; +} + +//virtual +bool LLViewerOctreeCull::checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group) +{ + if (branch->getElementCount() == 0) //no elements + { + return false; + } + else if (branch->getChildCount() == 0) //leaf state, already checked tightest bounding box + { + return true; + } + else if (mRes == 1 && !frustumCheckObjects(group)) //no objects in frustum + { + return false; + } + + return true; +} + +//virtual +void LLViewerOctreeCull::preprocess(LLViewerOctreeGroup* group) +{ +} + +//virtual +void LLViewerOctreeCull::processGroup(LLViewerOctreeGroup* group) +{ +} + +//virtual +void LLViewerOctreeCull::visit(const OctreeNode* branch) +{ + LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) branch->getListener(0); + + preprocess(group); + + if (checkObjects(branch, group)) + { + processGroup(group); + } +} + +//-------------------------------------------------------------- +//class LLViewerOctreeDebug +//virtual +void LLViewerOctreeDebug::visit(const OctreeNode* branch) +{ +#if 0 + LL_INFOS() << "Node: " << (U32)branch << " # Elements: " << branch->getElementCount() << " # Children: " << branch->getChildCount() << LL_ENDL; + for (U32 i = 0; i < branch->getChildCount(); i++) + { + LL_INFOS() << "Child " << i << " : " << (U32)branch->getChild(i) << LL_ENDL; + } +#endif + LLViewerOctreeGroup* group = (LLViewerOctreeGroup*) branch->getListener(0); + processGroup(group); +} + +//virtual +void LLViewerOctreeDebug::processGroup(LLViewerOctreeGroup* group) +{ +#if 0 + const LLVector4a* vec4 = group->getBounds(); + LLVector3 vec[2]; + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + LL_INFOS() << "Bounds: " << vec[0] << " : " << vec[1] << LL_ENDL; + + vec4 = group->getExtents(); + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + LL_INFOS() << "Extents: " << vec[0] << " : " << vec[1] << LL_ENDL; + + vec4 = group->getObjectBounds(); + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + LL_INFOS() << "ObjectBounds: " << vec[0] << " : " << vec[1] << LL_ENDL; + + vec4 = group->getObjectExtents(); + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + LL_INFOS() << "ObjectExtents: " << vec[0] << " : " << vec[1] << LL_ENDL; +#endif +} +//-------------------------------------------------------------- diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h new file mode 100644 index 0000000000000000000000000000000000000000..219ec7e8da7c47d2d46f6a512267ca2e6fd96bb0 --- /dev/null +++ b/indra/newview/llvieweroctree.h @@ -0,0 +1,420 @@ +/** + * @file llvieweroctree.h + * @brief LLViewerObjectOctree.cpp header file, defining all supporting classes. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_VIEWEROCTREE_H +#define LL_VIEWEROCTREE_H + +#include <vector> +#include <map> + +#include "v2math.h" +#include "v3math.h" +#include "v4math.h" +#include "m4math.h" +#include "llvector4a.h" +#include "llquaternion.h" +#include "lloctree.h" +#include "llviewercamera.h" + +class LLViewerRegion; +class LLViewerOctreeEntryData; +class LLViewerOctreeGroup; +class LLViewerOctreeEntry; +class LLViewerOctreePartition; + +typedef LLOctreeListener<LLViewerOctreeEntry> OctreeListener; +typedef LLTreeNode<LLViewerOctreeEntry> TreeNode; +typedef LLOctreeNode<LLViewerOctreeEntry> OctreeNode; +typedef LLOctreeRoot<LLViewerOctreeEntry> OctreeRoot; +typedef LLOctreeTraveler<LLViewerOctreeEntry> OctreeTraveler; + +#if LL_OCTREE_PARANOIA_CHECK +#define assert_octree_valid(x) x->validate() +#define assert_states_valid(x) ((LLViewerOctreeGroup*) x->mSpatialPartition->mOctree->getListener(0))->checkStates() +#else +#define assert_octree_valid(x) +#define assert_states_valid(x) +#endif + +// get index buffer for binary encoded axis vertex buffer given a box at center being viewed by given camera +U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center); +U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center); + +S32 AABBSphereIntersect(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &rad); +S32 AABBSphereIntersectR2(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &radius_squared); + +S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad); +S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared); + +//defines data needed for octree of an entry +//LL_ALIGN_PREFIX(16) +class LLViewerOctreeEntry : public LLRefCount, public LLTrace::MemTrackable<LLViewerOctreeEntry, 16> +{ + friend class LLViewerOctreeEntryData; + +public: + typedef enum + { + LLDRAWABLE = 0, + LLVOCACHEENTRY, + NUM_DATA_TYPE + }eEntryDataType_t; + +protected: + virtual ~LLViewerOctreeEntry(); + +public: + LLViewerOctreeEntry(); + + void nullGroup(); //called by group handleDestruction() only + void setGroup(LLViewerOctreeGroup* group); + void removeData(LLViewerOctreeEntryData* data); + + LLViewerOctreeEntryData* getDrawable() const {return mData[LLDRAWABLE];} + bool hasDrawable() const {return mData[LLDRAWABLE] != NULL;} + LLViewerOctreeEntryData* getVOCacheEntry() const {return mData[LLVOCACHEENTRY];} + bool hasVOCacheEntry() const {return mData[LLVOCACHEENTRY] != NULL;} + + const LLVector4a* getSpatialExtents() const {return mExtents;} + const LLVector4a& getPositionGroup() const {return mPositionGroup;} + LLViewerOctreeGroup* getGroup()const {return mGroup;} + + F32 getBinRadius() const {return mBinRadius;} + S32 getBinIndex() const {return mBinIndex; } + void setBinIndex(S32 index) const {mBinIndex = index; } + +private: + void addData(LLViewerOctreeEntryData* data); + +private: + LLViewerOctreeEntryData* mData[NUM_DATA_TYPE]; //do not use LLPointer here. + LLViewerOctreeGroup* mGroup; + + //aligned members + LL_ALIGN_16(LLVector4a mExtents[2]); + LL_ALIGN_16(LLVector4a mPositionGroup); + F32 mBinRadius; + mutable S32 mBinIndex; + mutable U32 mVisible; + +} ;//LL_ALIGN_POSTFIX(16); + +//defines an abstract class for entry data +//LL_ALIGN_PREFIX(16) +class LLViewerOctreeEntryData : public LLRefCount +{ +protected: + virtual ~LLViewerOctreeEntryData(); + +public: + LLViewerOctreeEntryData(const LLViewerOctreeEntryData& rhs) + { + *this = rhs; + } + LLViewerOctreeEntryData(LLViewerOctreeEntry::eEntryDataType_t data_type); + + LLViewerOctreeEntry::eEntryDataType_t getDataType() const {return mDataType;} + LLViewerOctreeEntry* getEntry() {return mEntry;} + + virtual void setOctreeEntry(LLViewerOctreeEntry* entry); + void removeOctreeEntry(); + + F32 getBinRadius() const {return mEntry->getBinRadius();} + const LLVector4a* getSpatialExtents() const; + LLViewerOctreeGroup* getGroup()const; + const LLVector4a& getPositionGroup() const; + + void setBinRadius(F32 rad) {mEntry->mBinRadius = rad;} + void setSpatialExtents(const LLVector3& min, const LLVector3& max); + void setSpatialExtents(const LLVector4a& min, const LLVector4a& max); + void setPositionGroup(const LLVector4a& pos); + + virtual void setGroup(LLViewerOctreeGroup* group); + void shift(const LLVector4a &shift_vector); + + U32 getVisible() const {return mEntry ? mEntry->mVisible : 0;} + void setVisible() const; + void resetVisible() const; + virtual bool isVisible() const; + virtual bool isRecentlyVisible() const; + + static S32 getCurrentFrame() { return sCurVisible; } + +protected: + LLVector4a& getGroupPosition() {return mEntry->mPositionGroup;} + void initVisible(U32 visible) {mEntry->mVisible = visible;} + + static void incrementVisible() {sCurVisible++;} +protected: + LLPointer<LLViewerOctreeEntry> mEntry; + LLViewerOctreeEntry::eEntryDataType_t mDataType; + static U32 sCurVisible; // Counter for what value of mVisible means currently visible +};//LL_ALIGN_POSTFIX(16); + + +//defines an octree group for an octree node, which contains multiple entries. +//LL_ALIGN_PREFIX(16) +class LLViewerOctreeGroup +: public LLOctreeListener<LLViewerOctreeEntry>, public LLTrace::MemTrackable<LLViewerOctreeGroup, 16> +{ + friend class LLViewerOctreeCull; +protected: + virtual ~LLViewerOctreeGroup(); + +public: + enum + { + CLEAN = 0x00000000, + DIRTY = 0x00000001, + OBJECT_DIRTY = 0x00000002, + SKIP_FRUSTUM_CHECK = 0x00000004, + DEAD = 0x00000008, + INVALID_STATE = 0x00000010, + }; + +public: + typedef LLOctreeNode<LLViewerOctreeEntry>::element_iter element_iter; + typedef LLOctreeNode<LLViewerOctreeEntry>::element_list element_list; + + LLViewerOctreeGroup(OctreeNode* node); + LLViewerOctreeGroup(const LLViewerOctreeGroup& rhs) + : LLTrace::MemTrackable<LLViewerOctreeGroup, 16>("LLViewerOctreeGroup") + { + *this = rhs; + } + + bool removeFromGroup(LLViewerOctreeEntryData* data); + bool removeFromGroup(LLViewerOctreeEntry* entry); + + virtual void unbound(); + virtual void rebound(); + + BOOL isDead() { return hasState(DEAD); } + + void setVisible(); + BOOL isVisible() const; + virtual BOOL isRecentlyVisible() const; + S32 getVisible(LLViewerCamera::eCameraID id) const {return mVisible[id];} + S32 getAnyVisible() const {return mAnyVisible;} + bool isEmpty() const { return mOctreeNode->isEmpty(); } + + U32 getState() {return mState; } + bool isDirty() const {return mState & DIRTY;} + bool hasState(U32 state) const {return mState & state;} + void setState(U32 state) {mState |= state;} + void clearState(U32 state) {mState &= ~state;} + + //LISTENER FUNCTIONS + virtual void handleInsertion(const TreeNode* node, LLViewerOctreeEntry* obj); + virtual void handleRemoval(const TreeNode* node, LLViewerOctreeEntry* obj); + virtual void handleDestruction(const TreeNode* node); + virtual void handleStateChange(const TreeNode* node); + virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); + virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child); + + OctreeNode* getOctreeNode() {return mOctreeNode;} + LLViewerOctreeGroup* getParent(); + + const LLVector4a* getBounds() const {return mBounds;} + const LLVector4a* getExtents() const {return mExtents;} + const LLVector4a* getObjectBounds() const {return mObjectBounds;} + const LLVector4a* getObjectExtents() const {return mObjectExtents;} + + //octree wrappers to make code more readable + element_list& getData() { return mOctreeNode->getData(); } + element_iter getDataBegin() { return mOctreeNode->getDataBegin(); } + element_iter getDataEnd() { return mOctreeNode->getDataEnd(); } + U32 getElementCount() const { return mOctreeNode->getElementCount(); } + bool hasElement(LLViewerOctreeEntryData* data); + +protected: + void checkStates(); +private: + virtual bool boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut); + +protected: + U32 mState; + OctreeNode* mOctreeNode; + + LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects) + LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node + LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children + LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node + + S32 mAnyVisible; //latest visible to any camera + S32 mVisible[LLViewerCamera::NUM_CAMERAS]; + +};//LL_ALIGN_POSTFIX(16); + +//octree group which has capability to support occlusion culling +//LL_ALIGN_PREFIX(16) +class LLOcclusionCullingGroup : public LLViewerOctreeGroup +{ +public: + typedef enum + { + OCCLUDED = 0x00010000, + QUERY_PENDING = 0x00020000, + ACTIVE_OCCLUSION = 0x00040000, + DISCARD_QUERY = 0x00080000, + EARLY_FAIL = 0x00100000, + } eOcclusionState; + + typedef enum + { + STATE_MODE_SINGLE = 0, //set one node + STATE_MODE_BRANCH, //set entire branch + STATE_MODE_DIFF, //set entire branch as long as current state is different + STATE_MODE_ALL_CAMERAS, //used for occlusion state, set state for all cameras + } eSetStateMode; + +protected: + virtual ~LLOcclusionCullingGroup(); + +public: + LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part); + LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLViewerOctreeGroup(rhs) + { + *this = rhs; + } + + void setOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); + void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); + void checkOcclusion(); //read back last occlusion query (if any) + void doOcclusion(LLCamera* camera, const LLVector4a* shift = NULL); //issue occlusion query + BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } + U32 getOcclusionState() const { return mOcclusionState[LLViewerCamera::sCurCameraID];} + + BOOL needsUpdate(); + U32 getLastOcclusionIssuedTime(); + + //virtual + void handleChildAddition(const OctreeNode* parent, OctreeNode* child); + + //virtual + BOOL isRecentlyVisible() const; + LLViewerOctreePartition* getSpatialPartition()const {return mSpatialPartition;} + BOOL isAnyRecentlyVisible() const; + + static U32 getNewOcclusionQueryObjectName(); + static void releaseOcclusionQueryObjectName(U32 name); + +protected: + void releaseOcclusionQueryObjectNames(); + +private: + BOOL earlyFail(LLCamera* camera, const LLVector4a* bounds); + +protected: + U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS]; + U32 mOcclusionIssued[LLViewerCamera::NUM_CAMERAS]; + + S32 mLODHash; + + LLViewerOctreePartition* mSpatialPartition; + U32 mOcclusionQuery[LLViewerCamera::NUM_CAMERAS]; + +public: + static std::set<U32> sPendingQueries; +};//LL_ALIGN_POSTFIX(16); + +class LLViewerOctreePartition +{ +public: + LLViewerOctreePartition(); + virtual ~LLViewerOctreePartition(); + + // Cull on arbitrary frustum + virtual S32 cull(LLCamera &camera, bool do_occlusion) = 0; + BOOL isOcclusionEnabled(); + +public: + U32 mPartitionType; + U32 mDrawableType; + OctreeNode* mOctree; + LLViewerRegion* mRegionp; // the region this partition belongs to. + 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) +}; + +class LLViewerOctreeCull : public OctreeTraveler +{ +public: + LLViewerOctreeCull(LLCamera* camera) + : mCamera(camera), mRes(0) { } + + virtual void traverse(const OctreeNode* n); + +protected: + virtual bool earlyFail(LLViewerOctreeGroup* group); + + //agent space group cull + S32 AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group); + S32 AABBSphereIntersectGroupExtents(const LLViewerOctreeGroup* group); + S32 AABBInFrustumGroupBounds(const LLViewerOctreeGroup* group); + + //agent space object set cull + S32 AABBInFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group); + S32 AABBSphereIntersectObjectExtents(const LLViewerOctreeGroup* group); + S32 AABBInFrustumObjectBounds(const LLViewerOctreeGroup* group); + + //local region space group cull + S32 AABBInRegionFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group); + S32 AABBInRegionFrustumGroupBounds(const LLViewerOctreeGroup* group); + S32 AABBRegionSphereIntersectGroupExtents(const LLViewerOctreeGroup* group, const LLVector3& shift); + + //local region space object set cull + S32 AABBInRegionFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group); + S32 AABBInRegionFrustumObjectBounds(const LLViewerOctreeGroup* group); + S32 AABBRegionSphereIntersectObjectExtents(const LLViewerOctreeGroup* group, const LLVector3& shift); + + virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0; + virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0; + + bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_radius); + virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group); + virtual void preprocess(LLViewerOctreeGroup* group); + virtual void processGroup(LLViewerOctreeGroup* group); + virtual void visit(const OctreeNode* branch); + +protected: + LLCamera *mCamera; + S32 mRes; +}; + +//scan the octree, output the info of each node for debug use. +class LLViewerOctreeDebug : public OctreeTraveler +{ +public: + virtual void processGroup(LLViewerOctreeGroup* group); + virtual void visit(const OctreeNode* branch); + +public: + static BOOL sInDebug; +}; + +#endif diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index 386b2fd4001a4807f086322a7386c5e604430247..b55154f889d325e14f38f8a04465ce8aeed78494 100755 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -159,7 +159,7 @@ void LLViewerParcelMedia::update(LLParcel* parcel) // static void LLViewerParcelMedia::play(LLParcel* parcel) { - lldebugs << "LLViewerParcelMedia::play" << llendl; + LL_DEBUGS() << "LLViewerParcelMedia::play" << LL_ENDL; if (!parcel) return; @@ -471,7 +471,7 @@ void LLViewerParcelMedia::sendMediaNavigateMessage(const std::string& url) } else { - llwarns << "can't get ParcelNavigateMedia capability" << llendl; + LL_WARNS() << "can't get ParcelNavigateMedia capability" << LL_ENDL; } } diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index e361fad9de37f986bd58809095407413466a81ad..cdb08f4707aa167ff5df76c0397f989046f89f53 100755 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -36,7 +36,6 @@ #include "llnotifications.h" #include "llnotificationsutil.h" #include "llparcel.h" -#include "llsecondlifeurls.h" #include "message.h" #include "llfloaterreg.h" @@ -198,22 +197,22 @@ LLViewerParcelMgr::~LLViewerParcelMgr() void LLViewerParcelMgr::dump() { - llinfos << "Parcel Manager Dump" << llendl; - llinfos << "mSelected " << S32(mSelected) << llendl; - llinfos << "Selected parcel: " << llendl; - llinfos << mWestSouth << " to " << mEastNorth << llendl; + LL_INFOS() << "Parcel Manager Dump" << LL_ENDL; + LL_INFOS() << "mSelected " << S32(mSelected) << LL_ENDL; + LL_INFOS() << "Selected parcel: " << LL_ENDL; + LL_INFOS() << mWestSouth << " to " << mEastNorth << LL_ENDL; mCurrentParcel->dump(); - llinfos << "banning " << mCurrentParcel->mBanList.size() << llendl; + LL_INFOS() << "banning " << mCurrentParcel->mBanList.size() << LL_ENDL; access_map_const_iterator cit = mCurrentParcel->mBanList.begin(); access_map_const_iterator end = mCurrentParcel->mBanList.end(); for ( ; cit != end; ++cit) { - llinfos << "ban id " << (*cit).first << llendl; + LL_INFOS() << "ban id " << (*cit).first << LL_ENDL; } - llinfos << "Hover parcel:" << llendl; + LL_INFOS() << "Hover parcel:" << LL_ENDL; mHoverParcel->dump(); - llinfos << "Agent parcel:" << llendl; + LL_INFOS() << "Agent parcel:" << LL_ENDL; mAgentParcel->dump(); } @@ -591,13 +590,13 @@ void LLViewerParcelMgr::deselectLand() void LLViewerParcelMgr::addObserver(LLParcelObserver* observer) { - mObservers.put(observer); + mObservers.push_back(observer); } void LLViewerParcelMgr::removeObserver(LLParcelObserver* observer) { - mObservers.removeObj(observer); + vector_replace_with_last(mObservers, observer); } @@ -606,16 +605,16 @@ void LLViewerParcelMgr::removeObserver(LLParcelObserver* observer) // from the list. void LLViewerParcelMgr::notifyObservers() { - LLDynamicArray<LLParcelObserver*> observers; - S32 count = mObservers.count(); + std::vector<LLParcelObserver*> observers; + S32 count = mObservers.size(); S32 i; for(i = 0; i < count; ++i) { - observers.put(mObservers.get(i)); + observers.push_back(mObservers.at(i)); } for(i = 0; i < count; ++i) { - observers.get(i)->changed(); + observers.at(i)->changed(); } } @@ -948,7 +947,7 @@ void LLViewerParcelMgr::sendParcelGodForceOwner(const LLUUID& owner_id) return; } - llinfos << "Claiming " << mWestSouth << " to " << mEastNorth << llendl; + LL_INFOS() << "Claiming " << mWestSouth << " to " << mEastNorth << LL_ENDL; // BUG: Only works for the region containing mWestSouthBottom LLVector3d east_north_region_check( mEastNorth ); @@ -971,7 +970,7 @@ void LLViewerParcelMgr::sendParcelGodForceOwner(const LLUUID& owner_id) return; } - llinfos << "Region " << region->getOriginGlobal() << llendl; + LL_INFOS() << "Region " << region->getOriginGlobal() << LL_ENDL; LLSD payload; payload["owner_id"] = owner_id; @@ -1111,8 +1110,8 @@ LLViewerParcelMgr::ParcelBuyInfo* LLViewerParcelMgr::setupParcelBuy( if (is_claim) { - llinfos << "Claiming " << mWestSouth << " to " << mEastNorth << llendl; - llinfos << "Region " << region->getOriginGlobal() << llendl; + LL_INFOS() << "Claiming " << mWestSouth << " to " << mEastNorth << LL_ENDL; + LL_INFOS() << "Region " << region->getOriginGlobal() << LL_ENDL; // BUG: Only works for the region containing mWestSouthBottom LLVector3d east_north_region_check( mEastNorth ); @@ -1282,7 +1281,7 @@ void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_ag LLViewerRegion *region = use_agent_region ? gAgent.getRegion() : LLWorld::getInstance()->getRegionFromPosGlobal( mWestSouth ); if (!region) return; - //llinfos << "found region: " << region->getName() << llendl; + //LL_INFOS() << "found region: " << region->getName() << LL_ENDL; LLSD body; std::string url = region->getCapability("ParcelPropertiesUpdate"); @@ -1292,8 +1291,8 @@ void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, bool use_ag U32 message_flags = 0x01; body["flags"] = ll_sd_from_U32(message_flags); parcel->packMessage(body); - llinfos << "Sending parcel properties update via capability to: " - << url << llendl; + LL_INFOS() << "Sending parcel properties update via capability to: " + << url << LL_ENDL; LLHTTPClient::post(url, body, new LLHTTPClient::Responder()); } else @@ -1387,7 +1386,7 @@ void LLViewerParcelMgr::processParcelOverlay(LLMessageSystem *msg, void **user) if (packed_overlay_size <= 0) { - llwarns << "Overlay size " << packed_overlay_size << llendl; + LL_WARNS() << "Overlay size " << packed_overlay_size << LL_ENDL; return; } @@ -1395,8 +1394,8 @@ void LLViewerParcelMgr::processParcelOverlay(LLMessageSystem *msg, void **user) S32 expected_size = parcels_per_edge * parcels_per_edge / PARCEL_OVERLAY_CHUNKS; if (packed_overlay_size != expected_size) { - llwarns << "Got parcel overlay size " << packed_overlay_size - << " expecting " << expected_size << llendl; + LL_WARNS() << "Got parcel overlay size " << packed_overlay_size + << " expecting " << expected_size << LL_ENDL; return; } @@ -1462,7 +1461,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use if (request_result == PARCEL_RESULT_NO_DATA) { // no valid parcel data - llinfos << "no valid parcel data" << llendl; + LL_INFOS() << "no valid parcel data" << LL_ENDL; return; } @@ -1494,9 +1493,9 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } else { - llinfos << "out of order agent parcel sequence id " << sequence_id + LL_INFOS() << "out of order agent parcel sequence id " << sequence_id << " last good " << parcel_mgr.mAgentParcelSequenceID - << llendl; + << LL_ENDL; return; } @@ -1745,7 +1744,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } else { - llinfos << "Stopping parcel music (invalid audio stream URL)" << llendl; + LL_INFOS() << "Stopping parcel music (invalid audio stream URL)" << LL_ENDL; // clears the URL // null value causes fade out LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); @@ -1753,7 +1752,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use } else if (!gAudiop->getInternetStreamURL().empty()) { - llinfos << "Stopping parcel music (parcel stream URL is empty)" << llendl; + LL_INFOS() << "Stopping parcel music (parcel stream URL is empty)" << LL_ENDL; // null value causes fade out LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); } @@ -1781,7 +1780,7 @@ void LLViewerParcelMgr::optionally_start_music(const std::string& music_url) gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING) && gSavedSettings.getBOOL("MediaTentativeAutoPlay"))) { - llinfos << "Starting parcel music " << music_url << llendl; + LL_INFOS() << "Starting parcel music " << music_url << LL_ENDL; LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(music_url); } else @@ -1810,7 +1809,7 @@ void LLViewerParcelMgr::processParcelAccessListReply(LLMessageSystem *msg, void if (parcel_id != parcel->getLocalID()) { LL_WARNS_ONCE("") << "processParcelAccessListReply for parcel " << parcel_id - << " which isn't the selected parcel " << parcel->getLocalID()<< llendl; + << " which isn't the selected parcel " << parcel->getLocalID()<< LL_ENDL; return; } diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 9da49bb3f33fa376a2a0065056a72e63a2b6e1fc..58d398e141cfc736dd94a31e2072e65239f6f412 100755 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -28,7 +28,6 @@ #define LL_LLVIEWERPARCELMGR_H #include "v3dmath.h" -#include "lldarray.h" #include "llframetimer.h" #include "llsingleton.h" #include "llparcelselection.h" @@ -333,7 +332,7 @@ class LLViewerParcelMgr : public LLSingleton<LLViewerParcelMgr> LLVector3d mHoverWestSouth; LLVector3d mHoverEastNorth; - LLDynamicArray<LLParcelObserver*> mObservers; + std::vector<LLParcelObserver*> mObservers; BOOL mTeleportInProgress; teleport_finished_signal_t mTeleportFinishedSignal; diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index a1c12c5cd6ead81bfc950b2fc4ff811ffd13933d..4fd423b6f4e40df75b45b0e1e2b96f4e6b392f46 100755 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -432,9 +432,12 @@ void LLViewerParcelOverlay::updatePropertyLines() const LLColor4U auction_coloru = LLUIColorTable::instance().getColor("PropertyColorAuction").get(); // Build into dynamic arrays, then copy into static arrays. - LLDynamicArray<LLVector3, 256> new_vertex_array; - LLDynamicArray<LLColor4U, 256> new_color_array; - LLDynamicArray<LLVector2, 256> new_coord_array; + std::vector<LLVector3> new_vertex_array; + new_vertex_array.reserve(256); + std::vector<LLColor4U> new_color_array; + new_color_array.reserve(256); + std::vector<LLVector2> new_coord_array; + new_coord_array.reserve(256); U8 overlay = 0; BOOL add_edge = FALSE; @@ -599,7 +602,7 @@ void LLViewerParcelOverlay::updatePropertyLines() // Now copy into static arrays for faster rendering. // Attempt to recycle old arrays if possible to avoid memory // shuffling. - S32 new_vertex_count = new_vertex_array.count(); + S32 new_vertex_count = new_vertex_array.size(); if (!(mVertexArray && mColorArray && new_vertex_count == mVertexCount)) { @@ -623,7 +626,7 @@ void LLViewerParcelOverlay::updatePropertyLines() F32* vertex = mVertexArray; for (i = 0; i < mVertexCount; i++) { - const LLVector3& point = new_vertex_array.get(i); + const LLVector3& point = new_vertex_array.at(i); *vertex = point.mV[VX]; vertex++; *vertex = point.mV[VY]; @@ -635,7 +638,7 @@ void LLViewerParcelOverlay::updatePropertyLines() U8* colorp = mColorArray; for (i = 0; i < mVertexCount; i++) { - const LLColor4U& color = new_color_array.get(i); + const LLColor4U& color = new_color_array.at(i); *colorp = color.mV[VRED]; colorp++; *colorp = color.mV[VGREEN]; @@ -652,9 +655,9 @@ void LLViewerParcelOverlay::updatePropertyLines() void LLViewerParcelOverlay::addPropertyLine( - LLDynamicArray<LLVector3, 256>& vertex_array, - LLDynamicArray<LLColor4U, 256>& color_array, - LLDynamicArray<LLVector2, 256>& coord_array, + std::vector<LLVector3>& vertex_array, + std::vector<LLColor4U>& color_array, + std::vector<LLVector2>& coord_array, const F32 start_x, const F32 start_y, const U32 edge, const LLColor4U& color) @@ -662,6 +665,10 @@ void LLViewerParcelOverlay::addPropertyLine( LLColor4U underwater( color ); underwater.mV[VALPHA] /= 2; + vertex_array.reserve(16); + color_array.reserve(16); + coord_array.reserve(16); + LLSurface& land = mRegion->getLand(); F32 dx; @@ -702,7 +709,7 @@ void LLViewerParcelOverlay::addPropertyLine( break; default: - llerrs << "Invalid edge in addPropertyLine" << llendl; + LL_ERRS() << "Invalid edge in addPropertyLine" << LL_ENDL; return; } @@ -716,11 +723,11 @@ void LLViewerParcelOverlay::addPropertyLine( // First part, only one vertex outside_z = land.resolveHeightRegion( outside_x, outside_y ); - if (outside_z > 20.f) color_array.put( color ); - else color_array.put( underwater ); + if (outside_z > 20.f) color_array.push_back( color ); + else color_array.push_back( underwater ); - vertex_array.put( LLVector3(outside_x, outside_y, outside_z) ); - coord_array.put( LLVector2(outside_x - start_x, 0.f) ); + vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) ); + coord_array.push_back( LLVector2(outside_x - start_x, 0.f) ); inside_x += dx * LINE_WIDTH; inside_y += dy * LINE_WIDTH; @@ -732,17 +739,17 @@ void LLViewerParcelOverlay::addPropertyLine( inside_z = land.resolveHeightRegion( inside_x, inside_y ); outside_z = land.resolveHeightRegion( outside_x, outside_y ); - if (inside_z > 20.f) color_array.put( color ); - else color_array.put( underwater ); + if (inside_z > 20.f) color_array.push_back( color ); + else color_array.push_back( underwater ); - if (outside_z > 20.f) color_array.put( color ); - else color_array.put( underwater ); + if (outside_z > 20.f) color_array.push_back( color ); + else color_array.push_back( underwater ); - vertex_array.put( LLVector3(inside_x, inside_y, inside_z) ); - vertex_array.put( LLVector3(outside_x, outside_y, outside_z) ); + vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) ); + vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) ); - coord_array.put( LLVector2(outside_x - start_x, 1.f) ); - coord_array.put( LLVector2(outside_x - start_x, 0.f) ); + coord_array.push_back( LLVector2(outside_x - start_x, 1.f) ); + coord_array.push_back( LLVector2(outside_x - start_x, 0.f) ); inside_x += dx * (dx - LINE_WIDTH); inside_y += dy * (dy - LINE_WIDTH); @@ -758,17 +765,17 @@ void LLViewerParcelOverlay::addPropertyLine( inside_z = land.resolveHeightRegion( inside_x, inside_y ); outside_z = land.resolveHeightRegion( outside_x, outside_y ); - if (inside_z > 20.f) color_array.put( color ); - else color_array.put( underwater ); + if (inside_z > 20.f) color_array.push_back( color ); + else color_array.push_back( underwater ); - if (outside_z > 20.f) color_array.put( color ); - else color_array.put( underwater ); + if (outside_z > 20.f) color_array.push_back( color ); + else color_array.push_back( underwater ); - vertex_array.put( LLVector3(inside_x, inside_y, inside_z) ); - vertex_array.put( LLVector3(outside_x, outside_y, outside_z) ); + vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) ); + vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) ); - coord_array.put( LLVector2(outside_x - start_x, 1.f) ); - coord_array.put( LLVector2(outside_x - start_x, 0.f) ); + coord_array.push_back( LLVector2(outside_x - start_x, 1.f) ); + coord_array.push_back( LLVector2(outside_x - start_x, 0.f) ); inside_x += dx; inside_y += dy; @@ -787,17 +794,17 @@ void LLViewerParcelOverlay::addPropertyLine( inside_z = land.resolveHeightRegion( inside_x, inside_y ); outside_z = land.resolveHeightRegion( outside_x, outside_y ); - if (inside_z > 20.f) color_array.put( color ); - else color_array.put( underwater ); + if (inside_z > 20.f) color_array.push_back( color ); + else color_array.push_back( underwater ); - if (outside_z > 20.f) color_array.put( color ); - else color_array.put( underwater ); + if (outside_z > 20.f) color_array.push_back( color ); + else color_array.push_back( underwater ); - vertex_array.put( LLVector3(inside_x, inside_y, inside_z) ); - vertex_array.put( LLVector3(outside_x, outside_y, outside_z) ); + vertex_array.push_back( LLVector3(inside_x, inside_y, inside_z) ); + vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) ); - coord_array.put( LLVector2(outside_x - start_x, 1.f) ); - coord_array.put( LLVector2(outside_x - start_x, 0.f) ); + coord_array.push_back( LLVector2(outside_x - start_x, 1.f) ); + coord_array.push_back( LLVector2(outside_x - start_x, 0.f) ); inside_x += dx * LINE_WIDTH; inside_y += dy * LINE_WIDTH; @@ -808,11 +815,11 @@ void LLViewerParcelOverlay::addPropertyLine( // Last edge is not drawn to the edge outside_z = land.resolveHeightRegion( outside_x, outside_y ); - if (outside_z > 20.f) color_array.put( color ); - else color_array.put( underwater ); + if (outside_z > 20.f) color_array.push_back( color ); + else color_array.push_back( underwater ); - vertex_array.put( LLVector3(outside_x, outside_y, outside_z) ); - coord_array.put( LLVector2(outside_x - start_x, 0.f) ); + vertex_array.push_back( LLVector3(outside_x, outside_y, outside_z) ); + coord_array.push_back( LLVector2(outside_x - start_x, 0.f) ); } diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h index 7445d5bf1ddbb50ca28ed6c001b13c8880bc194a..14a2af5354764a3fd6cdaf08e0e88710e65f4f08 100755 --- a/indra/newview/llviewerparceloverlay.h +++ b/indra/newview/llviewerparceloverlay.h @@ -31,7 +31,6 @@ // One of these structures per region. #include "llbbox.h" -#include "lldarray.h" #include "llframetimer.h" #include "lluuid.h" #include "llviewertexture.h" @@ -88,9 +87,9 @@ class LLViewerParcelOverlay : public LLGLUpdate U8 ownership(S32 row, S32 col) const { return 0x7 & mOwnership[row * mParcelGridsPerEdge + col]; } - void addPropertyLine(LLDynamicArray<LLVector3, 256>& vertex_array, - LLDynamicArray<LLColor4U, 256>& color_array, - LLDynamicArray<LLVector2, 256>& coord_array, + void addPropertyLine(std::vector<LLVector3>& vertex_array, + std::vector<LLColor4U>& color_array, + std::vector<LLVector2>& coord_array, const F32 start_x, const F32 start_y, const U32 edge, const LLColor4U& color); diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index 163c90019fcd256ce0968d3cbe4af0d934cbffbc..76418ad6a629fbb9e10800535d9a7efe627648f7 100755 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -144,7 +144,7 @@ LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 bo if (!mRegionp) { - //llwarns << "No region at position, using agent region!" << llendl; + //LL_WARNS() << "No region at position, using agent region!" << LL_ENDL; mRegionp = gAgent.getRegion(); } mCenterAgent = center_agent; @@ -174,8 +174,8 @@ LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 bo if (group != NULL) { - LLVector3 center(group->mOctreeNode->getCenter().getF32ptr()); - LLVector3 size(group->mOctreeNode->getSize().getF32ptr()); + LLVector3 center(group->getOctreeNode()->getCenter().getF32ptr()); + LLVector3 size(group->getOctreeNode()->getSize().getF32ptr()); size += LLVector3(0.01f, 0.01f, 0.01f); mMinObjPos = center - size; mMaxObjPos = center + size; @@ -477,12 +477,12 @@ void LLViewerPartSim::checkParticleCount(U32 size) { if(LLViewerPartSim::sParticleCount2 != LLViewerPartSim::sParticleCount) { - llerrs << "sParticleCount: " << LLViewerPartSim::sParticleCount << " ; sParticleCount2: " << LLViewerPartSim::sParticleCount2 << llendl ; + LL_ERRS() << "sParticleCount: " << LLViewerPartSim::sParticleCount << " ; sParticleCount2: " << LLViewerPartSim::sParticleCount2 << LL_ENDL ; } if(size > (U32)LLViewerPartSim::sParticleCount2) { - llerrs << "curren particle size: " << LLViewerPartSim::sParticleCount2 << " array size: " << size << llendl ; + LL_ERRS() << "curren particle size: " << LLViewerPartSim::sParticleCount2 << " array size: " << size << LL_ENDL ; } } @@ -493,6 +493,20 @@ LLViewerPartSim::LLViewerPartSim() mID = ++id_seed; } +//enable/disable particle system +void LLViewerPartSim::enable(bool enabled) +{ + if(!enabled && sMaxParticleCount > 0) + { + sMaxParticleCount = 0; //disable + } + else if(enabled && sMaxParticleCount < 1) + { + sMaxParticleCount = llmin(gSavedSettings.getS32("RenderMaxPartCount"), LL_MAX_PARTICLE_COUNT); + } + + return; +} void LLViewerPartSim::destroyClass() { @@ -563,8 +577,8 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part) if (part->mPosAgent.magVecSquared() > MAX_MAG || !part->mPosAgent.isFinite()) { #if 0 && !LL_RELEASE_FOR_DOWNLOAD - llwarns << "LLViewerPartSim::put Part out of range!" << llendl; - llwarns << part->mPosAgent << llendl; + LL_WARNS() << "LLViewerPartSim::put Part out of range!" << LL_ENDL; + LL_WARNS() << part->mPosAgent << LL_ENDL; #endif } else @@ -593,9 +607,9 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part) !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK)); if (!groupp->addPart(part)) { - llwarns << "LLViewerPartSim::put - Particle didn't go into its box!" << llendl; - llinfos << groupp->getCenterAgent() << llendl; - llinfos << part->mPosAgent << llendl; + LL_WARNS() << "LLViewerPartSim::put - Particle didn't go into its box!" << LL_ENDL; + LL_INFOS() << groupp->getCenterAgent() << LL_ENDL; + LL_INFOS() << part->mPosAgent << LL_ENDL; mViewerPartGroups.pop_back() ; delete groupp; groupp = NULL ; @@ -643,7 +657,7 @@ void LLViewerPartSim::shift(const LLVector3 &offset) } } -static LLFastTimer::DeclareTimer FTM_SIMULATE_PARTICLES("Simulate Particles"); +static LLTrace::BlockTimerStatHandle FTM_SIMULATE_PARTICLES("Simulate Particles"); void LLViewerPartSim::updateSimulation() { @@ -659,7 +673,7 @@ void LLViewerPartSim::updateSimulation() return; } - LLFastTimer ftm(FTM_SIMULATE_PARTICLES); + LL_RECORD_BLOCK_TIME(FTM_SIMULATE_PARTICLES); // Start at a random particle system so the same // particle system doesn't always get first pick at the @@ -780,7 +794,7 @@ void LLViewerPartSim::updateSimulation() updatePartBurstRate() ; - //llinfos << "Particles: " << sParticleCount << " Adaptive Rate: " << sParticleAdaptiveRate << llendl; + //LL_INFOS() << "Particles: " << sParticleCount << " Adaptive Rate: " << sParticleAdaptiveRate << LL_ENDL; } void LLViewerPartSim::updatePartBurstRate() @@ -818,7 +832,7 @@ void LLViewerPartSim::addPartSource(LLPointer<LLViewerPartSource> sourcep) { if (!sourcep) { - llwarns << "Null part source!" << llendl; + LL_WARNS() << "Null part source!" << LL_ENDL; return; } sourcep->setStart() ; diff --git a/indra/newview/llviewerpartsim.h b/indra/newview/llviewerpartsim.h index 2daa07ed8c3eb6d76a38b71899019321f5b4b489..40e8e1d45df1322a758fa8682c9858ffce0972b9 100755 --- a/indra/newview/llviewerpartsim.h +++ b/indra/newview/llviewerpartsim.h @@ -27,7 +27,6 @@ #ifndef LL_LLVIEWERPARTSIM_H #define LL_LLVIEWERPARTSIM_H -#include "lldarrayptr.h" #include "llframetimer.h" #include "llpointer.h" #include "llpartdata.h" @@ -36,7 +35,6 @@ class LLViewerTexture; class LLViewerPart; class LLViewerRegion; -class LLViewerTexture; class LLVOPartGroup; #define LL_MAX_PARTICLE_COUNT 8192 @@ -145,6 +143,8 @@ class LLViewerPartSim : public LLSingleton<LLViewerPartSim> typedef std::vector<LLViewerPartGroup *> group_list_t; typedef std::vector<LLPointer<LLViewerPartSource> > source_list_t; + void enable(bool enabled); + void shift(const LLVector3 &offset); void updateSimulation(); diff --git a/indra/newview/llviewerpartsource.cpp b/indra/newview/llviewerpartsource.cpp index b6bbd6140dcf64c19fd42a18a83c91f0f5f148d5..a7fd2e0fe41f83075d3f1577743089a683a7f8d2 100755 --- a/indra/newview/llviewerpartsource.cpp +++ b/indra/newview/llviewerpartsource.cpp @@ -69,7 +69,7 @@ void LLViewerPartSource::updatePart(LLViewerPart &part, const F32 dt) void LLViewerPartSource::update(const F32 dt) { - llerrs << "Creating default part source!" << llendl; + LL_ERRS() << "Creating default part source!" << LL_ENDL; } LLUUID LLViewerPartSource::getImageUUID() const @@ -396,7 +396,7 @@ void LLViewerPartSourceScript::update(const F32 dt) { part->mPosAgent = mPosAgent; part->mVelocity.setVec(0.f, 0.f, 0.f); - //llwarns << "Unknown source pattern " << (S32)mPartSysData.mPattern << llendl; + //LL_WARNS() << "Unknown source pattern " << (S32)mPartSysData.mPattern << LL_ENDL; } if (part->mFlags & LLPartData::LL_PART_FOLLOW_SRC_MASK || // SVC-193, VWR-717 diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index a565005f302c5368ee555c676f75429ecbaf49db..999d9092bd29944b97ff97d89cc58cd8211fb4f3 100755 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -51,12 +51,8 @@ #endif // Library headers from llcommon project: -#include "bitpack.h" -#include "lldeleteutils.h" -#include "imageids.h" #include "indra_constants.h" #include "llinitparam.h" - #include "llallocator.h" #include "llapp.h" #include "llcriticaldamp.h" @@ -65,11 +61,7 @@ #include "llerror.h" #include "llfasttimer.h" #include "llframetimer.h" -#include "llhash.h" -#include "lllocalidhashmap.h" -#include "llnametable.h" #include "llpointer.h" -#include "llpriqueuemap.h" #include "llprocessor.h" #include "llrefcount.h" #include "llsafehandle.h" @@ -79,12 +71,8 @@ #include "llstrider.h" #include "llstring.h" #include "llsys.h" -#include "llthread.h" #include "lltimer.h" -#include "lluuidhashmap.h" -#include "stdenums.h" #include "stdtypes.h" -#include "timing.h" #include "u64.h" // Library includes from llmath project diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a271690349ff30f516d71d4834de7a5494cef185..1932f4e8ce443df077b43509087b58d468fe96ff 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -71,6 +71,10 @@ #include "stringize.h" #include "llviewercontrol.h" #include "llsdserialize.h" +#include "llvieweroctree.h" +#include "llviewerdisplay.h" +#include "llviewerwindow.h" +#include "llprogressview.h" #ifdef LL_WINDOWS #pragma warning(disable:4355) @@ -85,6 +89,11 @@ const S32 MAX_SEED_CAP_ATTEMPTS_BEFORE_LOGIN = 3; const F32 CAP_REQUEST_TIMEOUT = 18; // Even though we gave up on login, keep trying for caps after we are logged in: const S32 MAX_CAP_REQUEST_ATTEMPTS = 30; +const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; + +BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; +S32 LLViewerRegion::sLastCameraUpdated = 0; +S32 LLViewerRegion::sNewObjectCreationThrottle = -1; typedef std::map<std::string, std::string> CapabilityMap; @@ -98,6 +107,10 @@ class LLViewerRegionImpl { mSeedCapMaxAttemptsBeforeLogin(MAX_SEED_CAP_ATTEMPTS_BEFORE_LOGIN), mSeedCapAttempts(0), mHttpResponderID(0), + mLastCameraUpdate(0), + mLastCameraOrigin(), + mVOCachePartition(NULL), + mLandp(NULL), // I'd prefer to set the LLCapabilityListener name to match the region // name -- it's disappointing that's not available at construction time. // We could instead store an LLCapabilityListener*, making @@ -109,8 +122,7 @@ class LLViewerRegionImpl { // construction time. mCapabilityListener(host.getString(), gMessageSystem, *region, gAgent.getID(), gAgent.getSessionID()) - { - } + {} void buildCapabilityNames(LLSD& capabilityNames); @@ -134,7 +146,15 @@ class LLViewerRegionImpl { // Misc LLVLComposition *mCompositionp; // Composition layer for the surface - LLVOCacheEntry::vocache_entry_map_t mCacheMap; + LLVOCacheEntry::vocache_entry_map_t mCacheMap; //all cached entries + LLVOCacheEntry::vocache_entry_set_t mActiveSet; //all active entries; + LLVOCacheEntry::vocache_entry_set_t mWaitingSet; //entries waiting for LLDrawable to be generated. + std::set< LLPointer<LLViewerOctreeGroup> > mVisibleGroups; //visible groupa + LLVOCachePartition* mVOCachePartition; + LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //must-be-created visible entries wait for objects creation. + LLVOCacheEntry::vocache_entry_priority_list_t mWaitingList; //transient list storing sorted visible entries waiting for object creation. + std::set<U32> mNonCacheableCreatedList; //list of local ids of all non-cacheable objects + // time? // LRU info? @@ -159,7 +179,10 @@ class LLViewerRegionImpl { LLCapabilityListener mCapabilityListener; //spatial partitions for objects in this region - std::vector<LLSpatialPartition*> mObjectPartition; + std::vector<LLViewerOctreePartition*> mObjectPartition; + + LLVector3 mLastCameraOrigin; + U32 mLastCameraUpdate; }; // support for secondlife:///app/region/{REGION} SLapps @@ -213,7 +236,7 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - LL_WARNS2("AppInit", "Capabilities") << "[status:" << statusNum << ":] " << content << LL_ENDL; + LL_WARNS("AppInit", "Capabilities") << "[status:" << statusNum << ":] " << content << LL_ENDL; LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if (regionp) { @@ -226,12 +249,12 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if(!regionp) //region was removed { - LL_WARNS2("AppInit", "Capabilities") << "Received results for region that no longer exists!" << LL_ENDL; + LL_WARNS("AppInit", "Capabilities") << "Received results for region that no longer exists!" << LL_ENDL; return ; } if( mID != regionp->getHttpResponderID() ) // region is no longer referring to this responder { - LL_WARNS2("AppInit", "Capabilities") << "Received results for a stale http responder!" << LL_ENDL; + LL_WARNS("AppInit", "Capabilities") << "Received results for a stale http responder!" << LL_ENDL; regionp->failedSeedCapability(); return ; } @@ -241,8 +264,7 @@ class BaseCapabilitiesComplete : public LLHTTPClient::Responder { regionp->setCapability(iter->first, iter->second); - LL_DEBUGS2("AppInit", "Capabilities") << "got capability for " - << iter->first << LL_ENDL; + LL_DEBUGS("AppInit", "Capabilities") << "got capability for " << iter->first << LL_ENDL; /* HACK we're waiting for the ServerReleaseNotes */ if (iter->first == "ServerReleaseNotes" && regionp->getReleaseNotesRequested()) @@ -282,8 +304,8 @@ class BaseCapabilitiesCompleteTracker : public LLHTTPClient::Responder void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - llwarns << "BaseCapabilitiesCompleteTracker error [status:" - << statusNum << "]: " << content << llendl; + LL_WARNS() << "BaseCapabilitiesCompleteTracker error [status:" + << statusNum << "]: " << content << LL_ENDL; } void result(const LLSD& content) @@ -297,22 +319,22 @@ class BaseCapabilitiesCompleteTracker : public LLHTTPClient::Responder for(iter = content.beginMap(); iter != content.endMap(); ++iter) { regionp->setCapabilityDebug(iter->first, iter->second); - //llinfos<<"BaseCapabilitiesCompleteTracker New Caps "<<iter->first<<" "<< iter->second<<llendl; + //LL_INFOS()<<"BaseCapabilitiesCompleteTracker New Caps "<<iter->first<<" "<< iter->second<<LL_ENDL; } if ( regionp->getRegionImpl()->mCapabilities.size() != regionp->getRegionImpl()->mSecondCapabilitiesTracker.size() ) { - llinfos << "BaseCapabilitiesCompleteTracker " << "sim " << regionp->getName() + LL_INFOS() << "BaseCapabilitiesCompleteTracker " << "sim " << regionp->getName() << " sent duplicate seed caps that differs in size - most likely content. " << (S32) regionp->getRegionImpl()->mCapabilities.size() << " vs " << regionp->getRegionImpl()->mSecondCapabilitiesTracker.size() - << llendl; + << LL_ENDL; //todo#add cap debug versus original check? /* CapabilityMap::const_iterator iter = regionp->getRegionImpl()->mCapabilities.begin(); while (iter!=regionp->getRegionImpl()->mCapabilities.end() ) { - llinfos << "BaseCapabilitiesCompleteTracker Original " << iter->first << " " << iter->second<<llendl; + LL_INFOS() << "BaseCapabilitiesCompleteTracker Original " << iter->first << " " << iter->second<<LL_ENDL; ++iter; } */ @@ -357,7 +379,13 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mCacheLoaded(FALSE), mCacheDirty(FALSE), mReleaseNotesRequested(FALSE), - mCapabilitiesReceived(false) + mCapabilitiesReceived(false), + mBitsReceived(0.f), + mPacketsReceived(0.f), + mDead(FALSE), + mLastVisitedEntry(NULL), + mInvisibilityCheckHistory(-1), + mPaused(FALSE) { mWidth = region_width_meters; mImpl->mOriginGlobal = from_region_handle(handle); @@ -389,17 +417,19 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, //create object partitions //MUST MATCH declaration of eObjectPartitions - mImpl->mObjectPartition.push_back(new LLHUDPartition()); //PARTITION_HUD - mImpl->mObjectPartition.push_back(new LLTerrainPartition()); //PARTITION_TERRAIN - mImpl->mObjectPartition.push_back(new LLVoidWaterPartition()); //PARTITION_VOIDWATER - mImpl->mObjectPartition.push_back(new LLWaterPartition()); //PARTITION_WATER - mImpl->mObjectPartition.push_back(new LLTreePartition()); //PARTITION_TREE - mImpl->mObjectPartition.push_back(new LLParticlePartition()); //PARTITION_PARTICLE - mImpl->mObjectPartition.push_back(new LLGrassPartition()); //PARTITION_GRASS - mImpl->mObjectPartition.push_back(new LLVolumePartition()); //PARTITION_VOLUME - mImpl->mObjectPartition.push_back(new LLBridgePartition()); //PARTITION_BRIDGE - mImpl->mObjectPartition.push_back(new LLHUDParticlePartition());//PARTITION_HUD_PARTICLE - mImpl->mObjectPartition.push_back(NULL); //PARTITION_NONE + mImpl->mObjectPartition.push_back(new LLHUDPartition(this)); //PARTITION_HUD + mImpl->mObjectPartition.push_back(new LLTerrainPartition(this)); //PARTITION_TERRAIN + mImpl->mObjectPartition.push_back(new LLVoidWaterPartition(this)); //PARTITION_VOIDWATER + mImpl->mObjectPartition.push_back(new LLWaterPartition(this)); //PARTITION_WATER + mImpl->mObjectPartition.push_back(new LLTreePartition(this)); //PARTITION_TREE + mImpl->mObjectPartition.push_back(new LLParticlePartition(this)); //PARTITION_PARTICLE + mImpl->mObjectPartition.push_back(new LLGrassPartition(this)); //PARTITION_GRASS + mImpl->mObjectPartition.push_back(new LLVolumePartition(this)); //PARTITION_VOLUME + mImpl->mObjectPartition.push_back(new LLBridgePartition(this)); //PARTITION_BRIDGE + mImpl->mObjectPartition.push_back(new LLHUDParticlePartition(this));//PARTITION_HUD_PARTICLE + mImpl->mObjectPartition.push_back(new LLVOCachePartition(this)); //PARTITION_VO_CACHE + mImpl->mObjectPartition.push_back(NULL); //PARTITION_NONE + mImpl->mVOCachePartition = getVOCachePartition(); mRenderInfoRequestTimer.resetWithExpiry(0.f); // Set timer to be expired setCapabilitiesReceivedCallback(boost::bind(&LLAvatarRenderInfoAccountant::expireRenderInfoReportTimer, _1)); @@ -410,19 +440,25 @@ void LLViewerRegion::initStats() { mImpl->mLastNetUpdate.reset(); mPacketsIn = 0; - mBitsIn = 0; - mLastBitsIn = 0; + mBitsIn = (U32Bits)0; + mLastBitsIn = (U32Bits)0; mLastPacketsIn = 0; mPacketsOut = 0; mLastPacketsOut = 0; mPacketsLost = 0; mLastPacketsLost = 0; - mPingDelay = 0; + mPingDelay = (U32Seconds)0; mAlive = false; // can become false if circuit disconnects } LLViewerRegion::~LLViewerRegion() { + mDead = TRUE; + mImpl->mActiveSet.clear(); + mImpl->mVisibleEntries.clear(); + mImpl->mVisibleGroups.clear(); + mImpl->mWaitingSet.clear(); + gVLManager.cleanupData(this); // Can't do this on destruction, because the neighbor pointers might be invalid. // This should be reference counted... @@ -437,10 +473,10 @@ LLViewerRegion::~LLViewerRegion() delete mImpl->mEventPoll; LLHTTPSender::clearSender(mImpl->mHost); - saveObjectCache(); - std::for_each(mImpl->mObjectPartition.begin(), mImpl->mObjectPartition.end(), DeletePointer()); + saveObjectCache(); + delete mImpl; mImpl = NULL; } @@ -481,9 +517,13 @@ void LLViewerRegion::loadObjectCache() // Presume success. If it fails, we don't want to try again. mCacheLoaded = TRUE; - if(LLVOCache::hasInstance()) + if(LLVOCache::instanceExists()) { LLVOCache::getInstance()->readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap) ; + if (mImpl->mCacheMap.empty()) + { + mCacheDirty = TRUE; + } } } @@ -500,16 +540,15 @@ void LLViewerRegion::saveObjectCache() return; } - if(LLVOCache::hasInstance()) + if(LLVOCache::instanceExists()) { - LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty) ; + const F32 start_time_threshold = 600.0f; //seconds + bool removal_enabled = sVOCacheCullingEnabled && (mRegionTimer.getElapsedTimeF32() > start_time_threshold); //allow to remove invalid objects from object cache file. + + LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled) ; mCacheDirty = FALSE; } - for(LLVOCacheEntry::vocache_entry_map_t::iterator iter = mImpl->mCacheMap.begin(); iter != mImpl->mCacheMap.end(); ++iter) - { - delete iter->second; - } mImpl->mCacheMap.clear(); } @@ -711,84 +750,800 @@ std::string LLViewerRegion::accessToShortString(U8 sim_access) } } -// static -U8 LLViewerRegion::shortStringToAccess(const std::string &sim_access) -{ - U8 accessValue; +// static +U8 LLViewerRegion::shortStringToAccess(const std::string &sim_access) +{ + U8 accessValue; + + if (LLStringUtil::compareStrings(sim_access, "PG") == 0) + { + accessValue = SIM_ACCESS_PG; + } + else if (LLStringUtil::compareStrings(sim_access, "M") == 0) + { + accessValue = SIM_ACCESS_MATURE; + } + else if (LLStringUtil::compareStrings(sim_access, "A") == 0) + { + accessValue = SIM_ACCESS_ADULT; + } + else + { + accessValue = SIM_ACCESS_MIN; + } + + return accessValue; +} + +// static +void LLViewerRegion::processRegionInfo(LLMessageSystem* msg, void**) +{ + // send it to 'observers' + // *TODO: switch the floaters to using LLRegionInfoModel + LL_INFOS() << "Processing region info" << LL_ENDL; + LLRegionInfoModel::instance().update(msg); + LLFloaterGodTools::processRegionInfo(msg); + LLFloaterRegionInfo::processRegionInfo(msg); + LLFloaterReporter::processRegionInfo(msg); +} + +void LLViewerRegion::setCacheID(const LLUUID& id) +{ + mImpl->mCacheID = id; +} + +S32 LLViewerRegion::renderPropertyLines() +{ + if (mParcelOverlay) + { + return mParcelOverlay->renderPropertyLines(); + } + else + { + return 0; + } +} + +// This gets called when the height field changes. +void LLViewerRegion::dirtyHeights() +{ + // Property lines need to be reconstructed when the land changes. + if (mParcelOverlay) + { + mParcelOverlay->setDirty(); + } +} + +//physically delete the cache entry +void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) +{ + if(!entry || !entry->isValid()) + { + return; + } + + if(for_rendering && !entry->isState(LLVOCacheEntry::ACTIVE)) + { + addNewObject(entry); //force to add to rendering pipeline + } + + //remove from active list and waiting list + if(entry->isState(LLVOCacheEntry::ACTIVE)) + { + mImpl->mActiveSet.erase(entry); + } + else + { + if(entry->isState(LLVOCacheEntry::WAITING)) + { + mImpl->mWaitingSet.erase(entry); + } + + //remove from mVOCachePartition + removeFromVOCacheTree(entry); + } + + //remove from the forced visible list + mImpl->mVisibleEntries.erase(entry); + + //disconnect from parent if it is a child + if(entry->getParentID() > 0) + { + LLVOCacheEntry* parent = getCacheEntry(entry->getParentID()); + if(parent) + { + parent->removeChild(entry); + } + } + else if(entry->getNumOfChildren() > 0)//remove children from cache if has any + { + LLVOCacheEntry* child = entry->getChild(); + while(child != NULL) + { + killCacheEntry(child, for_rendering); + child = entry->getChild(); + } + } + + //will remove it from the object cache, real deletion + entry->setState(LLVOCacheEntry::INACTIVE); + entry->removeOctreeEntry(); + entry->setValid(FALSE); +} + +//physically delete the cache entry +void LLViewerRegion::killCacheEntry(U32 local_id) +{ + killCacheEntry(getCacheEntry(local_id)); +} + +U32 LLViewerRegion::getNumOfActiveCachedObjects() const +{ + return mImpl->mActiveSet.size(); +} + +void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) +{ + if(!entry || mDead) + { + return; + } + if(entry->isState(LLVOCacheEntry::ACTIVE)) + { + return; //already inserted. + } + + if(entry->isState(LLVOCacheEntry::WAITING)) + { + mImpl->mWaitingSet.erase(entry); + } + + entry->setState(LLVOCacheEntry::ACTIVE); + entry->setVisible(); + + llassert(entry->getEntry()->hasDrawable()); + mImpl->mActiveSet.insert(entry); +} + +void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep) +{ + if(mDead || !entry || !entry->isValid()) + { + return; + } + if(!entry->isState(LLVOCacheEntry::ACTIVE)) + { + return; //not an active entry. + } + + //shift to the local regional space from agent space + if(drawablep != NULL && drawablep->getVObj().notNull()) + { + const LLVector3& pos = drawablep->getVObj()->getPositionRegion(); + LLVector4a shift; + shift.load3(pos.mV); + shift.sub(entry->getPositionGroup()); + entry->shift(shift); + } + + if(entry->getParentID() > 0) //is a child + { + LLVOCacheEntry* parent = getCacheEntry(entry->getParentID()); + if(parent) + { + parent->addChild(entry); + } + else //parent not in cache. + { + //this happens only when parent is not cacheable. + mOrphanMap[entry->getParentID()].push_back(entry->getLocalID()); + } + } + else //insert to vo cache tree. + { + entry->updateParentBoundingInfo(); + entry->saveBoundingSphere(); + addToVOCacheTree(entry); + } + + mImpl->mVisibleEntries.erase(entry); + mImpl->mActiveSet.erase(entry); + mImpl->mWaitingSet.erase(entry); + entry->setState(LLVOCacheEntry::INACTIVE); +} + +bool LLViewerRegion::addVisibleGroup(LLViewerOctreeGroup* group) +{ + if(mDead || group->isEmpty()) + { + return false; + } + + mImpl->mVisibleGroups.insert(group); + + return true; +} + +U32 LLViewerRegion::getNumOfVisibleGroups() const +{ + return mImpl ? mImpl->mVisibleGroups.size() : 0; +} + +void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) +{ + if(!sVOCacheCullingEnabled) + { + return; + } + + if(mDead || !entry || !entry->getEntry() || !entry->isValid()) + { + return; + } + if(entry->getParentID() > 0) + { + return; //no child prim in cache octree. + } + + if(entry->hasState(LLVOCacheEntry::IN_VO_TREE)) + { + return; //already in the tree. + } + + llassert_always(!entry->getGroup()); //not in octree. + llassert(!entry->getEntry()->hasDrawable()); //not have drawables + + if(mImpl->mVOCachePartition->addEntry(entry->getEntry())) + { + entry->setState(LLVOCacheEntry::IN_VO_TREE); + } +} + +void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) +{ + if(mDead || !entry || !entry->getEntry()) + { + return; + } + + if(!entry->hasState(LLVOCacheEntry::IN_VO_TREE)) + { + return; //not in the tree. + } + entry->clearState(LLVOCacheEntry::IN_VO_TREE); + + mImpl->mVOCachePartition->removeEntry(entry->getEntry()); +} + +//add child objects as visible entries +void LLViewerRegion::addVisibleChildCacheEntry(LLVOCacheEntry* parent, LLVOCacheEntry* child) +{ + if(mDead) + { + return; + } + + if(parent && (!parent->isValid() || !parent->isState(LLVOCacheEntry::ACTIVE))) + { + return; //parent must be valid and in rendering pipeline + } + + if(child && (!child->getEntry() || !child->isValid() || !child->isState(LLVOCacheEntry::INACTIVE))) + { + return; //child must be valid and not in the rendering pipeline + } + + if(child) + { + child->setState(LLVOCacheEntry::IN_QUEUE); + mImpl->mVisibleEntries.insert(child); + } + else if(parent && parent->getNumOfChildren() > 0) //add all children + { + child = parent->getChild(); + while(child != NULL) + { + addVisibleChildCacheEntry(NULL, child); + child = parent->getChild(); + } + } +} + +void LLViewerRegion::updateVisibleEntries(F32 max_time) +{ + if(mDead) + { + return; + } + + if(mImpl->mVisibleGroups.empty() && mImpl->mVisibleEntries.empty()) + { + return; + } + + if(!sNewObjectCreationThrottle) + { + return; + } + + const F32 LARGE_SCENE_CONTRIBUTION = 1000.f; //a large number to force to load the object. + const LLVector3 camera_origin = LLViewerCamera::getInstance()->getOrigin(); + const U32 cur_frame = LLViewerOctreeEntryData::getCurrentFrame(); + bool needs_update = ((cur_frame - mImpl->mLastCameraUpdate) > 5) && ((camera_origin - mImpl->mLastCameraOrigin).lengthSquared() > 10.f); + U32 last_update = mImpl->mLastCameraUpdate; + LLVector4a local_origin; + local_origin.load3((camera_origin - getOriginAgent()).mV); + + //process visible entries + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) + { + LLVOCacheEntry* vo_entry = *iter; + + if(vo_entry->isValid() && vo_entry->getState() < LLVOCacheEntry::WAITING) + { + //set a large number to force to load this object. + vo_entry->setSceneContribution(LARGE_SCENE_CONTRIBUTION); + + mImpl->mWaitingList.insert(vo_entry); + ++iter; + } + else + { + LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter; + ++next_iter; + mImpl->mVisibleEntries.erase(iter); + iter = next_iter; + } + } + + // + //process visible groups + // + //object projected area threshold + F32 projection_threshold = LLVOCacheEntry::getSquaredPixelThreshold(mImpl->mVOCachePartition->isFrontCull()); + F32 dist_threshold = mImpl->mVOCachePartition->isFrontCull() ? gAgentCamera.mDrawDistance : LLVOCacheEntry::sRearFarRadius; + + std::set< LLPointer<LLViewerOctreeGroup> >::iterator group_iter = mImpl->mVisibleGroups.begin(); + for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter) + { + LLPointer<LLViewerOctreeGroup> group = *group_iter; + if(group->getNumRefs() < 3 || //group to be deleted + !group->getOctreeNode() || group->isEmpty()) //group empty +{ + continue; + } + + for (LLViewerOctreeGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) + { + if((*i)->hasVOCacheEntry()) + { + LLVOCacheEntry* vo_entry = (LLVOCacheEntry*)(*i)->getVOCacheEntry(); + + if(vo_entry->getParentID() > 0) //is a child + { + //child visibility depends on its parent. + continue; + } + if(!vo_entry->isValid()) + { + continue; //skip invalid entry. + } + + vo_entry->calcSceneContribution(local_origin, needs_update, last_update, dist_threshold); + if(vo_entry->getSceneContribution() > projection_threshold) + { + mImpl->mWaitingList.insert(vo_entry); + } + } + } + } + + if(needs_update) + { + mImpl->mLastCameraOrigin = camera_origin; + mImpl->mLastCameraUpdate = cur_frame; + } + + return; +} + +void LLViewerRegion::createVisibleObjects(F32 max_time) +{ + if(mDead) + { + return; + } + if(mImpl->mWaitingList.empty()) + { + mImpl->mVOCachePartition->setCullHistory(FALSE); + return; + } + + S32 throttle = sNewObjectCreationThrottle; + BOOL has_new_obj = FALSE; + LLTimer update_timer; + for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); + iter != mImpl->mWaitingList.end(); ++iter) + { + LLVOCacheEntry* vo_entry = *iter; + + if(vo_entry->getState() < LLVOCacheEntry::WAITING) + { + addNewObject(vo_entry); + has_new_obj = TRUE; + if(throttle > 0 && !(--throttle) && update_timer.getElapsedTimeF32() > max_time) + { + break; + } + } + } + + mImpl->mVOCachePartition->setCullHistory(has_new_obj); + + return; +} + +void LLViewerRegion::clearCachedVisibleObjects() +{ + mImpl->mWaitingList.clear(); + mImpl->mVisibleGroups.clear(); + + //reset all occluders + mImpl->mVOCachePartition->resetOccluders(); + mPaused = TRUE; + + //clean visible entries + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) + { + LLVOCacheEntry* entry = *iter; + LLVOCacheEntry* parent = getCacheEntry(entry->getParentID()); + + if(!entry->getParentID() || parent) //no child or parent is cache-able + { + if(parent) //has a cache-able parent + { + parent->addChild(entry); + } + + LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter; + ++next_iter; + mImpl->mVisibleEntries.erase(iter); + iter = next_iter; + } + else //parent is not cache-able, leave it. + { + ++iter; + } + } + + //remove all visible entries. + mLastVisitedEntry = NULL; + std::vector<LLDrawable*> delete_list; + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin(); + iter != mImpl->mActiveSet.end(); ++iter) + { + LLDrawable* drawablep = (LLDrawable*)(*iter)->getEntry()->getDrawable(); + + if(drawablep && !drawablep->getParent()) + { + delete_list.push_back(drawablep); + } + } + + if(!delete_list.empty()) + { + for(S32 i = 0; i < delete_list.size(); i++) + { + gObjectList.killObject(delete_list[i]->getVObj()); + } + delete_list.clear(); + } + + return; +} + +//perform some necessary but very light updates. +//to replace the function idleUpdate(...) in case there is no enough time. +void LLViewerRegion::lightIdleUpdate() +{ + if(!sVOCacheCullingEnabled) + { + return; + } + if(mImpl->mCacheMap.empty()) + { + return; + } + + //reset all occluders + mImpl->mVOCachePartition->resetOccluders(); +} + +void LLViewerRegion::idleUpdate(F32 max_update_time) +{ + LLTimer update_timer; + F32 max_time; + + mLastUpdate = LLViewerOctreeEntryData::getCurrentFrame(); + + mImpl->mLandp->idleUpdate(max_update_time); + + if (mParcelOverlay) + { + // Hopefully not a significant time sink... + mParcelOverlay->idleUpdate(); + } + + if(!sVOCacheCullingEnabled) + { + return; + } + if(mImpl->mCacheMap.empty()) + { + return; + } + if(mPaused) + { + mPaused = FALSE; //unpause. + } + + LLViewerCamera::eCameraID old_camera_id = LLViewerCamera::sCurCameraID; + LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; + + //reset all occluders + mImpl->mVOCachePartition->resetOccluders(); + + max_time = max_update_time - update_timer.getElapsedTimeF32(); + + //kill invisible objects + killInvisibleObjects(max_time * 0.4f); + max_time = max_update_time - update_timer.getElapsedTimeF32(); + + updateVisibleEntries(max_time); + max_time = max_update_time - update_timer.getElapsedTimeF32(); + + createVisibleObjects(max_time); + + mImpl->mWaitingList.clear(); + mImpl->mVisibleGroups.clear(); + + LLViewerCamera::sCurCameraID = old_camera_id; + return; +} + +//update the throttling number for new object creation +void LLViewerRegion::calcNewObjectCreationThrottle() +{ + static LLCachedControl<S32> new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle"); + static LLCachedControl<F32> throttle_delay_time(gSavedSettings,"NewObjectCreationThrottleDelayTime"); + static LLFrameTimer timer; + + // + //sNewObjectCreationThrottle = + //-2: throttle is disabled because either the screen is showing progress view, or immediate after the screen is not black + //-1: throttle is disabled by the debug setting + //0: no new object creation is allowed + //>0: valid throttling number + // + + if(gViewerWindow->getProgressView()->getVisible() && throttle_delay_time > 0.f) + { + sNewObjectCreationThrottle = -2; //cancel the throttling + timer.reset(); + } + else if(sNewObjectCreationThrottle < -1) //just recoved from the login/teleport screen + { + if(timer.getElapsedTimeF32() > throttle_delay_time) //wait for throttle_delay_time to reset the throttle + { + sNewObjectCreationThrottle = new_object_creation_throttle; //reset + if(sNewObjectCreationThrottle < -1) + { + sNewObjectCreationThrottle = -1; + } + } + } + + //update some LLVOCacheEntry debug setting factors. + LLVOCacheEntry::updateDebugSettings(); +} + +BOOL LLViewerRegion::isViewerCameraStatic() +{ + return sLastCameraUpdated < LLViewerOctreeEntryData::getCurrentFrame(); +} + +void LLViewerRegion::killInvisibleObjects(F32 max_time) +{ + if(!sVOCacheCullingEnabled) + { + return; + } + if(mImpl->mActiveSet.empty()) + { + return; + } + if(sNewObjectCreationThrottle < 0) + { + return; + } + + LLTimer update_timer; + LLVector4a camera_origin; + camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV); + LLVector4a local_origin; + local_origin.load3((LLViewerCamera::getInstance()->getOrigin() - getOriginAgent()).mV); + F32 back_threshold = LLVOCacheEntry::sRearFarRadius; + + size_t max_update = 64; + if(!mInvisibilityCheckHistory && isViewerCameraStatic()) + { + //history is clean, reduce number of checking + max_update /= 2; + } + + std::vector<LLDrawable*> delete_list; + S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); + LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); + + for(; update_counter > 0; --update_counter, ++iter) + { + if(iter == mImpl->mActiveSet.end()) + { + iter = mImpl->mActiveSet.begin(); + } + if((*iter)->getParentID() > 0) + { + continue; //skip child objects, they are removed with their parent. + } + + LLVOCacheEntry* vo_entry = *iter; + if(!vo_entry->isAnyVisible(camera_origin, local_origin, back_threshold) && vo_entry->mLastCameraUpdated < sLastCameraUpdated) + { + killObject(vo_entry, delete_list); + } - if (LLStringUtil::compareStrings(sim_access, "PG") == 0) - { - accessValue = SIM_ACCESS_PG; + if(max_time < update_timer.getElapsedTimeF32()) //time out + { + break; + } } - else if (LLStringUtil::compareStrings(sim_access, "M") == 0) + + if(iter == mImpl->mActiveSet.end()) { - accessValue = SIM_ACCESS_MATURE; + mLastVisitedEntry = NULL; } - else if (LLStringUtil::compareStrings(sim_access, "A") == 0) + else { - accessValue = SIM_ACCESS_ADULT; + mLastVisitedEntry = *iter; } - else + + mInvisibilityCheckHistory <<= 1; + if(!delete_list.empty()) { - accessValue = SIM_ACCESS_MIN; + mInvisibilityCheckHistory |= 1; + S32 count = delete_list.size(); + for(S32 i = 0; i < count; i++) + { + gObjectList.killObject(delete_list[i]->getVObj()); + } + delete_list.clear(); } - return accessValue; + return; } -// static -void LLViewerRegion::processRegionInfo(LLMessageSystem* msg, void**) +void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list) { - // send it to 'observers' - // *TODO: switch the floaters to using LLRegionInfoModel - llinfos << "Processing region info" << llendl; - LLRegionInfoModel::instance().update(msg); - LLFloaterGodTools::processRegionInfo(msg); - LLFloaterRegionInfo::processRegionInfo(msg); - LLFloaterReporter::processRegionInfo(msg); -} + //kill the object. + LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable(); + llassert(drawablep); + llassert(drawablep->getRegion() == this); -void LLViewerRegion::setCacheID(const LLUUID& id) -{ - mImpl->mCacheID = id; + if(drawablep && !drawablep->getParent()) + { + LLViewerObject::const_child_list_t& child_list = drawablep->getVObj()->getChildren(); + for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); + iter != child_list.end(); iter++) + { + LLViewerObject* child = *iter; + if(child->mDrawable) + { + if(!child->mDrawable->getEntry() || !child->mDrawable->getEntry()->hasVOCacheEntry()) + { + //do not remove parent if any of its children non-cacheable + //especially for the case that an avatar sits on a cache-able object + ((LLViewerOctreeEntryData*)drawablep)->setVisible(); + return; + } + + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)child->mDrawable->getGroup(); + if(group && group->isAnyRecentlyVisible()) + { + //set the parent visible if any of its children visible. + ((LLViewerOctreeEntryData*)drawablep)->setVisible(); + return; + } + } + } + delete_list.push_back(drawablep); + } } -S32 LLViewerRegion::renderPropertyLines() +LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) { - if (mParcelOverlay) + if(!entry || !entry->getEntry()) { - return mParcelOverlay->renderPropertyLines(); + if(entry) + { + mImpl->mVisibleEntries.erase(entry); + entry->setState(LLVOCacheEntry::INACTIVE); + } + return NULL; + } + + LLViewerObject* obj = NULL; + if(!entry->getEntry()->hasDrawable()) //not added to the rendering pipeline yet + { + //add the object + obj = gObjectList.processObjectUpdateFromCache(entry, this); + if(obj) + { + if(!entry->isState(LLVOCacheEntry::ACTIVE)) + { + mImpl->mWaitingSet.insert(entry); + entry->setState(LLVOCacheEntry::WAITING); + } + } } else { - return 0; + LLViewerRegion* old_regionp = ((LLDrawable*)entry->getEntry()->getDrawable())->getRegion(); + if(old_regionp != this) + { + //this object exists in two regions at the same time; + //this case can be safely ignored here because + //server should soon send update message to remove one region for this object. + + LL_WARNS() << "Entry: " << entry->getLocalID() << " exists in two regions at the same time." << LL_ENDL; + return NULL; + } + + LL_WARNS() << "Entry: " << entry->getLocalID() << " in rendering pipeline but not set to be active." << LL_ENDL; + + //should not hit here any more, but does not hurt either, just put it back to active list + addActiveCacheEntry(entry); } + return obj; } -// This gets called when the height field changes. -void LLViewerRegion::dirtyHeights() +//update object cache if the object receives a full-update or terse update +//update_type == EObjectUpdateType::OUT_TERSE_IMPROVED or EObjectUpdateType::OUT_FULL +LLViewerObject* LLViewerRegion::updateCacheEntry(U32 local_id, LLViewerObject* objectp, U32 update_type) { - // Property lines need to be reconstructed when the land changes. - if (mParcelOverlay) + if(objectp && update_type != (U32)OUT_TERSE_IMPROVED) { - mParcelOverlay->setDirty(); + return objectp; //no need to access cache } -} -BOOL LLViewerRegion::idleUpdate(F32 max_update_time) -{ - // did_update returns TRUE if we did at least one significant update - BOOL did_update = mImpl->mLandp->idleUpdate(max_update_time); - - if (mParcelOverlay) + LLVOCacheEntry* entry = getCacheEntry(local_id); + if (!entry) { - // Hopefully not a significant time sink... - mParcelOverlay->idleUpdate(); + return objectp; //not in the cache, do nothing. + } + if(!objectp) //object not created + { + //create a new object from cache. + objectp = addNewObject(entry); } - return did_update; -} + //remove from cache if terse update + if(update_type == (U32)OUT_TERSE_IMPROVED) + { + killCacheEntry(entry, true); + } + return objectp; +} // As above, but forcibly do the update. void LLViewerRegion::forceUpdate() @@ -966,9 +1721,8 @@ void LLViewerRegion::updateNetStats() mPacketsLost = cdp->getPacketsLost(); mPingDelay = cdp->getPingDelay(); - mBitStat.addValue(mBitsIn - mLastBitsIn); - mPacketsStat.addValue(mPacketsIn - mLastPacketsIn); - mPacketsLostStat.addValue(mPacketsLost); + mBitsReceived += mBitsIn - mLastBitsIn; + mPacketsReceived += mPacketsIn - mLastPacketsIn; } @@ -977,7 +1731,7 @@ U32 LLViewerRegion::getPacketsLost() const LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mImpl->mHost); if (!cdp) { - llinfos << "LLViewerRegion::getPacketsLost couldn't find circuit for " << mImpl->mHost << llendl; + LL_INFOS() << "LLViewerRegion::getPacketsLost couldn't find circuit for " << mImpl->mHost << LL_ENDL; return 0; } else @@ -1090,14 +1844,14 @@ class CoarseLocationUpdate : public LLHTTPNode S32 target_index = input["body"]["Index"][0]["Prey"].asInteger(); S32 you_index = input["body"]["Index"][0]["You" ].asInteger(); - LLDynamicArray<U32>* avatar_locs = ®ion->mMapAvatars; - LLDynamicArray<LLUUID>* avatar_ids = ®ion->mMapAvatarIDs; - avatar_locs->reset(); - avatar_ids->reset(); + std::vector<U32>* avatar_locs = ®ion->mMapAvatars; + std::vector<LLUUID>* avatar_ids = ®ion->mMapAvatarIDs; + avatar_locs->clear(); + avatar_ids->clear(); - //llinfos << "coarse locations agent[0] " << input["body"]["AgentData"][0]["AgentID"].asUUID() << llendl; - //llinfos << "my agent id = " << gAgent.getID() << llendl; - //llinfos << ll_pretty_print_sd(input) << llendl; + //LL_INFOS() << "coarse locations agent[0] " << input["body"]["AgentData"][0]["AgentID"].asUUID() << LL_ENDL; + //LL_INFOS() << "my agent id = " << gAgent.getID() << LL_ENDL; + //LL_INFOS() << ll_pretty_print_sd(input) << LL_ENDL; LLSD locs = input["body"]["Location"], @@ -1133,13 +1887,13 @@ class CoarseLocationUpdate : public LLHTTPNode pos |= y; pos <<= 8; pos |= z; - avatar_locs->put(pos); - //llinfos << "next pos: " << x << "," << y << "," << z << ": " << pos << llendl; + avatar_locs->push_back(pos); + //LL_INFOS() << "next pos: " << x << "," << y << "," << z << ": " << pos << LL_ENDL; if(has_agent_data) // for backwards compatibility with old message format { LLUUID agent_id(agents_it->get("AgentID").asUUID()); - //llinfos << "next agent: " << agent_id.asString() << llendl; - avatar_ids->put(agent_id); + //LL_INFOS() << "next agent: " << agent_id.asString() << LL_ENDL; + avatar_ids->push_back(agent_id); } } if (has_agent_data) @@ -1159,9 +1913,9 @@ LLHTTPRegistration<CoarseLocationUpdate> // the deprecated coarse location handler void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) { - //llinfos << "CoarseLocationUpdate" << llendl; - mMapAvatars.reset(); - mMapAvatarIDs.reset(); // only matters in a rare case but it's good to be safe. + //LL_INFOS() << "CoarseLocationUpdate" << LL_ENDL; + mMapAvatars.clear(); + mMapAvatarIDs.clear(); // only matters in a rare case but it's good to be safe. U8 x_pos = 0; U8 y_pos = 0; @@ -1187,9 +1941,9 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id, i); } - //llinfos << " object X: " << (S32)x_pos << " Y: " << (S32)y_pos + //LL_INFOS() << " object X: " << (S32)x_pos << " Y: " << (S32)y_pos // << " Z: " << (S32)(z_pos * 4) - // << llendl; + // << LL_ENDL; // treat the target specially for the map if(i == target_index) @@ -1210,10 +1964,10 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) pos |= y_pos; pos <<= 8; pos |= z_pos; - mMapAvatars.put(pos); + mMapAvatars.push_back(pos); if(has_agent_data) { - mMapAvatarIDs.put(agent_id); + mMapAvatarIDs.push_back(agent_id); } } } @@ -1240,59 +1994,322 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) std::stringstream str; LLSDSerialize::toPrettyXML(sim_features, str); - llinfos << str.str() << llendl; + LL_INFOS() << str.str() << LL_ENDL; mSimulatorFeatures = sim_features; } -LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) +//this is called when the parent is not cacheable. +//move all orphan children out of cache and insert to rendering octree. +void LLViewerRegion::findOrphans(U32 parent_id) +{ + orphan_list_t::iterator iter = mOrphanMap.find(parent_id); + if(iter != mOrphanMap.end()) + { + std::vector<U32>* children = &mOrphanMap[parent_id]; + for(S32 i = 0; i < children->size(); i++) + { + //parent is visible, so is the child. + addVisibleChildCacheEntry(NULL, getCacheEntry((*children)[i])); + } + children->clear(); + mOrphanMap.erase(parent_id); + } +} + +void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) +{ + if(!sVOCacheCullingEnabled) + { + gObjectList.processObjectUpdateFromCache(entry, this); + return; + } + if(!entry || !entry->isValid()) + { + return; + } + + if(!entry->getEntry()) + { + entry->setOctreeEntry(NULL); + } + + if(entry->getEntry()->hasDrawable()) //already in the rendering pipeline + { + LLViewerRegion* old_regionp = ((LLDrawable*)entry->getEntry()->getDrawable())->getRegion(); + if(old_regionp != this && old_regionp) +{ + LLViewerObject* obj = ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj(); + if(obj) + { + //remove from old region + old_regionp->killCacheEntry(obj->getLocalID()); + + //change region + obj->setRegion(this); + } + } + + addActiveCacheEntry(entry); + + //set parent id + U32 parent_id = 0; + LLViewerObject::unpackParentID(entry->getDP(), parent_id); + if(parent_id != entry->getParentID()) + { + entry->setParentID(parent_id); + } + + //update the object + gObjectList.processObjectUpdateFromCache(entry, this); + return; //done + } + + //must not be active. + llassert_always(!entry->isState(LLVOCacheEntry::ACTIVE)); + removeFromVOCacheTree(entry); //remove from cache octree if it is in. + + LLVector3 pos; + LLVector3 scale; + LLQuaternion rot; + + //decode spatial info and parent info + U32 parent_id = LLViewerObject::extractSpatialExtents(entry->getDP(), pos, scale, rot); + + U32 old_parent_id = entry->getParentID(); + bool same_old_parent = false; + if(parent_id != old_parent_id) //parent changed. + { + if(old_parent_id > 0) //has an old parent, disconnect it + { + LLVOCacheEntry* old_parent = getCacheEntry(old_parent_id); + if(old_parent) + { + old_parent->removeChild(entry); + if(!old_parent->isState(LLVOCacheEntry::INACTIVE)) + { + mImpl->mVisibleEntries.erase(entry); + entry->setState(LLVOCacheEntry::INACTIVE); + } + } + } + entry->setParentID(parent_id); + } + else + { + same_old_parent = true; + } + + if(parent_id > 0) //has a new parent + { + //1, find the parent in cache + LLVOCacheEntry* parent = getCacheEntry(parent_id); + + //2, parent is not in the cache, put into the orphan list. + if(!parent) + { + if(!same_old_parent) + { + //check if parent is non-cacheable and already created + if(isNonCacheableObjectCreated(parent_id)) + { + //parent is visible, so is the child. + addVisibleChildCacheEntry(NULL, entry); + } + else + { + entry->setBoundingInfo(pos, scale); + mOrphanMap[parent_id].push_back(entry->getLocalID()); + } + } + else + { + entry->setBoundingInfo(pos, scale); + } + } + else //parent in cache. + { + if(!parent->isState(LLVOCacheEntry::INACTIVE)) + { + //parent is visible, so is the child. + addVisibleChildCacheEntry(parent, entry); + } + else + { + entry->setBoundingInfo(pos, scale); + parent->addChild(entry); + + if(parent->getGroup()) //re-insert parent to vo-cache tree because its bounding info changed. + { + removeFromVOCacheTree(parent); + addToVOCacheTree(parent); + } + } + } + + return; + } + + // + //no parent + // + entry->setBoundingInfo(pos, scale); + + if(!parent_id) //a potential parent + { + //find all children and update their bounding info + orphan_list_t::iterator iter = mOrphanMap.find(entry->getLocalID()); + if(iter != mOrphanMap.end()) + { + std::vector<U32>* orphans = &mOrphanMap[entry->getLocalID()]; + S32 size = orphans->size(); + for(S32 i = 0; i < size; i++) + { + LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); + if(child) + { + entry->addChild(child); + } + } + orphans->clear(); + mOrphanMap.erase(entry->getLocalID()); + } + } + + if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) + { + addToVOCacheTree(entry); + } + return ; +} + +LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerBinaryBuffer &dp, U32 flags) { - U32 local_id = objectp->getLocalID(); - U32 crc = objectp->getCRC(); + eCacheUpdateResult result; + U32 crc; + U32 local_id; + + LLViewerObject::unpackU32(&dp, local_id, "LocalID"); + LLViewerObject::unpackU32(&dp, crc, "CRC"); - LLVOCacheEntry* entry = get_if_there(mImpl->mCacheMap, local_id, (LLVOCacheEntry*)NULL); + LLVOCacheEntry* entry = getCacheEntry(local_id, false); if (entry) { + entry->setValid(); + // we've seen this object before if (entry->getCRC() == crc) { // Record a hit entry->recordDupe(); - return CACHE_UPDATE_DUPE; + result = CACHE_UPDATE_DUPE; } + else //CRC changed + { + // Update the cache entry + entry->updateEntry(crc, dp); - // Update the cache entry - mImpl->mCacheMap.erase(local_id); - delete entry; + decodeBoundingInfo(entry); + + result = CACHE_UPDATE_CHANGED; + } + } + else + { + // we haven't seen this object before + // Create new entry and add to map + result = CACHE_UPDATE_ADDED; entry = new LLVOCacheEntry(local_id, crc, dp); + record(LLStatViewer::OBJECT_CACHE_HIT_RATE, LLUnits::Ratio::fromValue(0)); + mImpl->mCacheMap[local_id] = entry; - return CACHE_UPDATE_CHANGED; + + decodeBoundingInfo(entry); + } + entry->setUpdateFlags(flags); + + return result; } - // we haven't seen this object before +LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp, U32 flags) +{ + eCacheUpdateResult result = cacheFullUpdate(dp, flags); + + return result; +} - // Create new entry and add to map - eCacheUpdateResult result = CACHE_UPDATE_ADDED; - if (mImpl->mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES) +LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) +{ + if(!sVOCacheCullingEnabled) { - delete mImpl->mCacheMap.begin()->second ; - mImpl->mCacheMap.erase(mImpl->mCacheMap.begin()); - result = CACHE_UPDATE_REPLACED; + return NULL; + } + + LLVOCacheEntry* entry = getCacheEntry(local_id); + removeFromVOCacheTree(entry); + return entry; +} + +LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id, bool valid) +{ + LLVOCacheEntry::vocache_entry_map_t::iterator iter = mImpl->mCacheMap.find(local_id); + if(iter != mImpl->mCacheMap.end()) + { + if(!valid || iter->second->isValid()) + { + return iter->second; + } + } + return NULL; } - entry = new LLVOCacheEntry(local_id, crc, dp); - mImpl->mCacheMap[local_id] = entry; - return result; +void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type) +{ +#if 0 + mCacheMissList.insert(CacheMissItem(id, miss_type)); +#else + mCacheMissList.push_back(CacheMissItem(id, miss_type)); +#endif +} + +//check if a non-cacheable object is already created. +bool LLViewerRegion::isNonCacheableObjectCreated(U32 local_id) +{ + if(mImpl && local_id > 0 && mImpl->mNonCacheableCreatedList.find(local_id) != mImpl->mNonCacheableCreatedList.end()) + { + return true; + } + return false; +} + +void LLViewerRegion::removeFromCreatedList(U32 local_id) +{ + if(mImpl && local_id > 0) + { + std::set<U32>::iterator iter = mImpl->mNonCacheableCreatedList.find(local_id); + if(iter != mImpl->mNonCacheableCreatedList.end()) + { + mImpl->mNonCacheableCreatedList.erase(iter); + } + } + } + +void LLViewerRegion::addToCreatedList(U32 local_id) +{ + if(mImpl && local_id > 0) + { + mImpl->mNonCacheableCreatedList.insert(local_id); + } } // Get data packer for this object, if we have cached data // AND the CRC matches. JC -LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc, U8 &cache_miss_type) +bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type) { //llassert(mCacheLoaded); This assert failes often, changing to early-out -- davep, 2010/10/18 - LLVOCacheEntry* entry = get_if_there(mImpl->mCacheMap, local_id, (LLVOCacheEntry*)NULL); + LLVOCacheEntry* entry = getCacheEntry(local_id, false); if (entry) { @@ -1302,70 +2319,57 @@ LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc, U8 &cache_miss_type) // Record a hit entry->recordHit(); cache_miss_type = CACHE_MISS_TYPE_NONE; - return entry->getDP(crc); + entry->setUpdateFlags(flags); + + if(entry->isState(LLVOCacheEntry::ACTIVE)) + { + ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj()->loadFlags(flags); + return true; + } + + if(entry->isValid()) + { + return true; //already probed + } + + entry->setValid(); + decodeBoundingInfo(entry); + return true; } else { - // llinfos << "CRC miss for " << local_id << llendl; - cache_miss_type = CACHE_MISS_TYPE_CRC; - mCacheMissCRC.put(local_id); + // LL_INFOS() << "CRC miss for " << local_id << LL_ENDL; + + addCacheMiss(local_id, CACHE_MISS_TYPE_CRC); } } else { - // llinfos << "Cache miss for " << local_id << llendl; - cache_miss_type = CACHE_MISS_TYPE_FULL; - mCacheMissFull.put(local_id); + // LL_INFOS() << "Cache miss for " << local_id << LL_ENDL; + addCacheMiss(local_id, CACHE_MISS_TYPE_FULL); } - return NULL; + return false; } void LLViewerRegion::addCacheMissFull(const U32 local_id) { - mCacheMissFull.put(local_id); + addCacheMiss(local_id, CACHE_MISS_TYPE_FULL); } void LLViewerRegion::requestCacheMisses() { - S32 full_count = mCacheMissFull.count(); - S32 crc_count = mCacheMissCRC.count(); - if (full_count == 0 && crc_count == 0) return; + if (!mCacheMissList.size()) + { + return; + } LLMessageSystem* msg = gMessageSystem; BOOL start_new_message = TRUE; S32 blocks = 0; - S32 i; - - // Send full cache miss updates. For these, we KNOW we don't - // have a viewer object. - for (i = 0; i < full_count; i++) - { - if (start_new_message) - { - msg->newMessageFast(_PREHASH_RequestMultipleObjects); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - start_new_message = FALSE; - } - - msg->nextBlockFast(_PREHASH_ObjectData); - msg->addU8Fast(_PREHASH_CacheMissType, CACHE_MISS_TYPE_FULL); - msg->addU32Fast(_PREHASH_ID, mCacheMissFull[i]); - blocks++; - - if (blocks >= 255) - { - sendReliableMessage(); - start_new_message = TRUE; - blocks = 0; - } - } - // Send CRC miss updates. For these, we _might_ have a viewer object, - // but probably not. - for (i = 0; i < crc_count; i++) + //send requests for all cache-missed objects + for (CacheMissItem::cache_miss_list_t::iterator iter = mCacheMissList.begin(); iter != mCacheMissList.end(); ++iter) { if (start_new_message) { @@ -1377,8 +2381,8 @@ void LLViewerRegion::requestCacheMisses() } msg->nextBlockFast(_PREHASH_ObjectData); - msg->addU8Fast(_PREHASH_CacheMissType, CACHE_MISS_TYPE_CRC); - msg->addU32Fast(_PREHASH_ID, mCacheMissCRC[i]); + msg->addU8Fast(_PREHASH_CacheMissType, (*iter).mType); + msg->addU32Fast(_PREHASH_ID, (*iter).mID); blocks++; if (blocks >= 255) @@ -1394,13 +2398,13 @@ void LLViewerRegion::requestCacheMisses() { sendReliableMessage(); } - mCacheMissFull.reset(); - mCacheMissCRC.reset(); mCacheDirty = TRUE ; - // llinfos << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << llendl; - LLViewerStatsRecorder::instance().requestCacheMissesEvent(full_count + crc_count); + // LL_INFOS() << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << LL_ENDL; + LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size()); LLViewerStatsRecorder::instance().log(0.2f); + + mCacheMissList.clear(); } void LLViewerRegion::dumpCache() @@ -1431,14 +2435,14 @@ void LLViewerRegion::dumpCache() change_bin[changes]++; } - llinfos << "Count " << mImpl->mCacheMap.size() << llendl; + LL_INFOS() << "Count " << mImpl->mCacheMap.size() << LL_ENDL; for (i = 0; i < BINS; i++) { - llinfos << "Hits " << i << " " << hit_bin[i] << llendl; + LL_INFOS() << "Hits " << i << " " << hit_bin[i] << LL_ENDL; } for (i = 0; i < BINS; i++) { - llinfos << "Changes " << i << " " << change_bin[i] << llendl; + LL_INFOS() << "Changes " << i << " " << change_bin[i] << LL_ENDL; } } @@ -1578,8 +2582,20 @@ void LLViewerRegion::unpackRegionHandshake() msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("RegionInfo"); - msg->addU32("Flags", 0x0 ); + + U32 flags = 0; + if(sVOCacheCullingEnabled) + { + flags |= 0x00000001; //set the bit 0 to be 1 to ask sim to send all cacheable objects. + } + if(mImpl->mCacheMap.empty()) + { + flags |= 0x00000002; //set the bit 1 to be 1 to tell sim the cache file is empty, no need to send cache probes. + } + msg->addU32("Flags", flags ); msg->sendReliable(host); + + mRegionTimer.reset(); //reset region timer. } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) @@ -1670,7 +2686,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) { if (getCapability("Seed") == url) { - // llwarns << "Ignoring duplicate seed capability" << llendl; + //LL_WARNS() << "Ignoring duplicate seed capability" << LL_ENDL; //Instead of just returning we build up a second set of seed caps and compare them //to the "original" seed cap received and determine why there is problem! LLSD capabilityNames = LLSD::emptyArray(); @@ -1689,7 +2705,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) LLSD capabilityNames = LLSD::emptyArray(); mImpl->buildCapabilityNames(capabilityNames); - llinfos << "posting to seed " << url << llendl; + LL_INFOS() << "posting to seed " << url << LL_ENDL; S32 id = ++mImpl->mHttpResponderID; LLHTTPClient::post(url, capabilityNames, @@ -1709,7 +2725,7 @@ void LLViewerRegion::failedSeedCapability() std::string url = getCapability("Seed"); if ( url.empty() ) { - LL_WARNS2("AppInit", "Capabilities") << "Failed to get seed capabilities, and can not determine url for retries!" << LL_ENDL; + LL_WARNS("AppInit", "Capabilities") << "Failed to get seed capabilities, and can not determine url for retries!" << LL_ENDL; return; } // After a few attempts, continue login. We will keep trying once in-world: @@ -1724,8 +2740,8 @@ void LLViewerRegion::failedSeedCapability() LLSD capabilityNames = LLSD::emptyArray(); mImpl->buildCapabilityNames(capabilityNames); - llinfos << "posting to seed " << url << " (retry " - << mImpl->mSeedCapAttempts << ")" << llendl; + LL_INFOS() << "posting to seed " << url << " (retry " + << mImpl->mSeedCapAttempts << ")" << LL_ENDL; S32 id = ++mImpl->mHttpResponderID; LLHTTPClient::post(url, capabilityNames, @@ -1735,7 +2751,7 @@ void LLViewerRegion::failedSeedCapability() else { // *TODO: Give a user pop-up about this error? - LL_WARNS2("AppInit", "Capabilities") << "Failed to get seed capabilities from '" << url << "' after " << mImpl->mSeedCapAttempts << " attempts. Giving up!" << LL_ENDL; + LL_WARNS("AppInit", "Capabilities") << "Failed to get seed capabilities from '" << url << "' after " << mImpl->mSeedCapAttempts << " attempts. Giving up!" << LL_ENDL; } } @@ -1751,7 +2767,7 @@ class SimulatorFeaturesReceived : public LLHTTPClient::Responder void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content) { - LL_WARNS2("AppInit", "SimulatorFeatures") << "[status:" << statusNum << "]: " << content << LL_ENDL; + LL_WARNS("AppInit", "SimulatorFeatures") << "[status:" << statusNum << "]: " << content << LL_ENDL; retry(); } @@ -1760,7 +2776,7 @@ class SimulatorFeaturesReceived : public LLHTTPClient::Responder LLViewerRegion *regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); if(!regionp) //region is removed or responder is not created. { - LL_WARNS2("AppInit", "SimulatorFeatures") << "Received results for region that no longer exists!" << LL_ENDL; + LL_WARNS("AppInit", "SimulatorFeatures") << "Received results for region that no longer exists!" << LL_ENDL; return ; } @@ -1773,7 +2789,7 @@ class SimulatorFeaturesReceived : public LLHTTPClient::Responder if (mAttempt < mMaxAttempts) { mAttempt++; - LL_WARNS2("AppInit", "SimulatorFeatures") << "Re-trying '" << mRetryURL << "'. Retry #" << mAttempt << LL_ENDL; + LL_WARNS("AppInit", "SimulatorFeatures") << "Re-trying '" << mRetryURL << "'. Retry #" << mAttempt << LL_ENDL; LLHTTPClient::get(mRetryURL, new SimulatorFeaturesReceived(*this), LLSD(), CAP_REQUEST_TIMEOUT); } } @@ -1826,7 +2842,7 @@ std::string LLViewerRegion::getCapability(const std::string& name) const { if (!capabilitiesReceived() && (name!=std::string("Seed")) && (name!=std::string("ObjectMedia"))) { - llwarns << "getCapability called before caps received" << llendl; + LL_WARNS() << "getCapability called before caps received" << LL_ENDL; } CapabilityMap::const_iterator iter = mImpl->mCapabilities.find(name); @@ -1871,17 +2887,26 @@ void LLViewerRegion::logActiveCapabilities() const { if (!iter->second.empty()) { - llinfos << iter->first << " URL is " << iter->second << llendl; + LL_INFOS() << iter->first << " URL is " << iter->second << LL_ENDL; } } - llinfos << "Dumped " << count << " entries." << llendl; + LL_INFOS() << "Dumped " << count << " entries." << LL_ENDL; } LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type) { - if (type < mImpl->mObjectPartition.size()) + if (type < mImpl->mObjectPartition.size() && type < PARTITION_VO_CACHE) + { + return (LLSpatialPartition*)mImpl->mObjectPartition[type]; + } + return NULL; +} + +LLVOCachePartition* LLViewerRegion::getVOCachePartition() +{ + if(PARTITION_VO_CACHE < mImpl->mObjectPartition.size()) { - return mImpl->mObjectPartition[type]; + return (LLVOCachePartition*)mImpl->mObjectPartition[PARTITION_VO_CACHE]; } return NULL; } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index a8716985cbe82e31dbe210a9b895914697133f50..00d3900a88c1fe79e1d51ff1787b30a09d944322 100755 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -32,9 +32,7 @@ #include <string> #include <boost/signals2.hpp> -#include "lldarray.h" #include "llwind.h" -#include "llstat.h" #include "v3dmath.h" #include "llstring.h" #include "llregionflags.h" @@ -67,8 +65,11 @@ class LLDataPacker; class LLDataPackerBinaryBuffer; class LLHost; class LLBBox; - +class LLSpatialGroup; +class LLDrawable; class LLViewerRegionImpl; +class LLViewerOctreeGroup; +class LLVOCachePartition; class LLViewerRegion: public LLCapabilityProvider // implements this interface { @@ -86,6 +87,7 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface PARTITION_VOLUME, PARTITION_BRIDGE, PARTITION_HUD_PARTICLE, + PARTITION_VO_CACHE, PARTITION_NONE, NUM_PARTITIONS } eObjectPartitions; @@ -219,11 +221,21 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface // can process the message. static void processRegionInfo(LLMessageSystem* msg, void**); + //check if the viewer camera is static + static BOOL isViewerCameraStatic(); + static void calcNewObjectCreationThrottle(); + void setCacheID(const LLUUID& id); F32 getWidth() const { return mWidth; } - BOOL idleUpdate(F32 max_update_time); + void idleUpdate(F32 max_update_time); + void lightIdleUpdate(); + bool addVisibleGroup(LLViewerOctreeGroup* group); + void addVisibleChildCacheEntry(LLVOCacheEntry* parent, LLVOCacheEntry* child); + void addActiveCacheEntry(LLVOCacheEntry* entry); + void removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep); + void killCacheEntry(U32 local_id); //physically delete the cache entry // Like idleUpdate, but forces everything to complete regardless of // how long it takes. @@ -316,11 +328,17 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface } eCacheUpdateResult; // handle a full update message - eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp); - LLDataPacker *getDP(U32 local_id, U32 crc, U8 &cache_miss_type); + eCacheUpdateResult cacheFullUpdate(LLDataPackerBinaryBuffer &dp, U32 flags); + eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp, U32 flags); + LLVOCacheEntry* getCacheEntryForOctree(U32 local_id); + LLVOCacheEntry* getCacheEntry(U32 local_id, bool valid = true); + bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type); void requestCacheMisses(); void addCacheMissFull(const U32 local_id); - + //update object cache if the object receives a full-update or terse update + LLViewerObject* updateCacheEntry(U32 local_id, LLViewerObject* objectp, U32 update_type); + void findOrphans(U32 parent_id); + void clearCachedVisibleObjects(); void dumpCache(); void unpackRegionHandshake(); @@ -333,7 +351,10 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface virtual std::string getDescription() const; std::string getHttpUrl() const { return mHttpUrl ;} + U32 getNumOfVisibleGroups() const; + U32 getNumOfActiveCachedObjects() const; LLSpatialPartition* getSpatialPartition(U32 type); + LLVOCachePartition* getVOCachePartition(); bool objectIsReturnable(const LLVector3& pos, const std::vector<LLBBox>& boxes) const; bool childrenObjectReturnable( const std::vector<LLBBox>& boxes ) const; @@ -343,12 +364,35 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface void getNeighboringRegionsStatus( std::vector<S32>& regions ); const LLViewerRegionImpl * getRegionImpl() const { return mImpl; } LLViewerRegionImpl * getRegionImplNC() { return mImpl; } - + // implements the materials capability throttle bool materialsCapThrottled() const { return !mMaterialsCapThrottleTimer.hasExpired(); } void resetMaterialsCapThrottle(); U32 getMaxMaterialsPerTransaction() const; + + void removeFromCreatedList(U32 local_id); + void addToCreatedList(U32 local_id); + + BOOL isPaused() const {return mPaused;} + S32 getLastUpdate() const {return mLastUpdate;} + + static BOOL isNewObjectCreationThrottleDisabled() {return sNewObjectCreationThrottle < 0;} + +private: + void addToVOCacheTree(LLVOCacheEntry* entry); + LLViewerObject* addNewObject(LLVOCacheEntry* entry); + void killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list); + void removeFromVOCacheTree(LLVOCacheEntry* entry); + void killCacheEntry(LLVOCacheEntry* entry, bool for_rendering = false); //physically delete the cache entry + void killInvisibleObjects(F32 max_time); + void createVisibleObjects(F32 max_time); + void updateVisibleEntries(F32 max_time); //update visible entries + + void addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type); + void decodeBoundingInfo(LLVOCacheEntry* entry); + bool isNonCacheableObjectCreated(U32 local_id); + public: struct CompareDistance { @@ -368,9 +412,8 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface LLWind mWind; LLViewerParcelOverlay *mParcelOverlay; - LLStat mBitStat; - LLStat mPacketsStat; - LLStat mPacketsLostStat; + F32Bits mBitsReceived; + F32 mPacketsReceived; LLMatrix4 mRenderMatrix; @@ -379,17 +422,47 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface // messaging system in which the previous message only sends and parses the // positions stored in the first array so they're maintained separately until // we stop supporting the old CoarseLocationUpdate message. - LLDynamicArray<U32> mMapAvatars; - LLDynamicArray<LLUUID> mMapAvatarIDs; + std::vector<U32> mMapAvatars; + std::vector<LLUUID> mMapAvatarIDs; + + static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not. + static S32 sLastCameraUpdated; LLFrameTimer & getRenderInfoRequestTimer() { return mRenderInfoRequestTimer; }; + struct CompareRegionByLastUpdate + { + bool operator()(const LLViewerRegion* const& lhs, const LLViewerRegion* const& rhs) + { + S32 lpa = lhs->getLastUpdate(); + S32 rpa = rhs->getLastUpdate(); + + //small mLastUpdate first + if(lpa < rpa) + { + return true; + } + else if(lpa > rpa) + { + return false; + } + else + { + return lhs < rhs; + } + } + }; + typedef std::set<LLViewerRegion*, CompareRegionByLastUpdate> region_priority_list_t; + private: + static S32 sNewObjectCreationThrottle; LLViewerRegionImpl * mImpl; + LLFrameTimer mRegionTimer; F32 mWidth; // Width of region on a side (meters) U64 mHandle; F32 mTimeDilation; // time dilation of physics simulation on simulator + S32 mLastUpdate; //last time called idleUpdate() // simulator name std::string mName; @@ -399,14 +472,14 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface BOOL mIsEstateManager; U32 mPacketsIn; - U32 mBitsIn; - U32 mLastBitsIn; + U32Bits mBitsIn, + mLastBitsIn; U32 mLastPacketsIn; U32 mPacketsOut; U32 mLastPacketsOut; S32 mPacketsLost; S32 mLastPacketsLost; - U32 mPingDelay; + U32Milliseconds mPingDelay; F32 mDeltaTime; // Time since last measurement of lastPackets, Bits, etc U64 mRegionFlags; // includes damage flags @@ -417,6 +490,9 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface F32 mCameraDistanceSquared; // updated once per frame U8 mCentralBakeVersion; + LLVOCacheEntry* mLastVisitedEntry; + U32 mInvisibilityCheckHistory; + // Information for Homestead / CR-53 S32 mClassID; S32 mCPURatio; @@ -431,16 +507,28 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface // a structure of size 2^14 = 16,000 BOOL mCacheLoaded; BOOL mCacheDirty; + BOOL mAlive; // can become false if circuit disconnects + BOOL mCapabilitiesReceived; + BOOL mReleaseNotesRequested; + BOOL mDead; //if true, this region is in the process of deleting. + BOOL mPaused; //pause processing the objects in the region - LLDynamicArray<U32> mCacheMissFull; - LLDynamicArray<U32> mCacheMissCRC; + typedef std::map<U32, std::vector<U32> > orphan_list_t; + orphan_list_t mOrphanMap; - bool mAlive; // can become false if circuit disconnects - bool mCapabilitiesReceived; - caps_received_signal_t mCapabilitiesReceivedSignal; + class CacheMissItem + { + public: + CacheMissItem(U32 id, LLViewerRegion::eCacheMissType miss_type) : mID(id), mType(miss_type){} - BOOL mReleaseNotesRequested; + U32 mID; //local object id + LLViewerRegion::eCacheMissType mType; //cache miss type + + typedef std::list<CacheMissItem> cache_miss_list_t; + }; + CacheMissItem::cache_miss_list_t mCacheMissList; + caps_received_signal_t mCapabilitiesReceivedSignal; LLSD mSimulatorFeatures; // the materials capability throttle diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index e88b22b4617bcf7f3c8412f8d4c83b5973698f9c..9d2a4a50e120ad406d6f24dd19e41e2798c940ec 100755 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -52,6 +52,7 @@ static LLStaticHashedString sTexture0("texture0"); static LLStaticHashedString sTexture1("texture1"); static LLStaticHashedString sTex0("tex0"); static LLStaticHashedString sTex1("tex1"); +static LLStaticHashedString sDitherTex("dither_tex"); static LLStaticHashedString sGlowMap("glowMap"); static LLStaticHashedString sScreenMap("screenMap"); @@ -81,6 +82,8 @@ LLGLSLShader gGlowCombineProgram; LLGLSLShader gSplatTextureRectProgram; LLGLSLShader gGlowCombineFXAAProgram; LLGLSLShader gTwoTextureAddProgram; +LLGLSLShader gTwoTextureCompareProgram; +LLGLSLShader gOneTextureFilterProgram; LLGLSLShader gOneTextureNoColorProgram; LLGLSLShader gDebugProgram; LLGLSLShader gClipProgram; @@ -437,7 +440,7 @@ void LLViewerShaderMgr::setShaders() // Shaders LL_INFOS("ShaderLoading") << "\n~~~~~~~~~~~~~~~~~~\n Loading Shaders:\n~~~~~~~~~~~~~~~~~~" << LL_ENDL; - LL_INFOS("ShaderLoading") << llformat("Using GLSL %d.%d", gGLManager.mGLSLVersionMajor, gGLManager.mGLSLVersionMinor) << llendl; + LL_INFOS("ShaderLoading") << llformat("Using GLSL %d.%d", gGLManager.mGLSLVersionMajor, gGLManager.mGLSLVersionMinor) << LL_ENDL; for (S32 i = 0; i < SHADER_COUNT; i++) { @@ -693,6 +696,8 @@ void LLViewerShaderMgr::unloadShaders() gSplatTextureRectProgram.unload(); gGlowCombineFXAAProgram.unload(); gTwoTextureAddProgram.unload(); + gTwoTextureCompareProgram.unload(); + gOneTextureFilterProgram.unload(); gOneTextureNoColorProgram.unload(); gSolidColorProgram.unload(); @@ -854,7 +859,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders() shaders.push_back( make_pair( "objects/indexedTextureV.glsl", 1 ) ); } shaders.push_back( make_pair( "objects/nonindexedTextureV.glsl", 1 ) ); - + boost::unordered_map<std::string, std::string> attribs; // We no longer have to bind the shaders to global glhandles, they are automatically added to a map now. @@ -909,7 +914,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders() index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightShinyF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightShinyWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(ch); shaders.push_back( make_pair( "lighting/lightFullbrightShinyWaterF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); - + for (U32 i = 0; i < shaders.size(); i++) { // Note usage of GL_FRAGMENT_SHADER_ARB @@ -1264,7 +1269,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredBumpProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; success = gDeferredBumpProgram.createShader(NULL, NULL); } - + gDeferredMaterialProgram[1].mFeatures.hasLighting = false; gDeferredMaterialProgram[5].mFeatures.hasLighting = false; gDeferredMaterialProgram[9].mFeatures.hasLighting = false; @@ -1869,7 +1874,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true; gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true; } - + if (success) { gDeferredPostGammaCorrectProgram.mName = "Deferred Gamma Correction Post Process"; @@ -3110,6 +3115,40 @@ BOOL LLViewerShaderMgr::loadShadersInterface() } } +#ifdef LL_WINDOWS + if (success) + { + gTwoTextureCompareProgram.mName = "Two Texture Compare Shader"; + gTwoTextureCompareProgram.mShaderFiles.clear(); + gTwoTextureCompareProgram.mShaderFiles.push_back(make_pair("interface/twotexturecompareV.glsl", GL_VERTEX_SHADER_ARB)); + gTwoTextureCompareProgram.mShaderFiles.push_back(make_pair("interface/twotexturecompareF.glsl", GL_FRAGMENT_SHADER_ARB)); + gTwoTextureCompareProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gTwoTextureCompareProgram.createShader(NULL, NULL); + if (success) + { + gTwoTextureCompareProgram.bind(); + gTwoTextureCompareProgram.uniform1i(sTex0, 0); + gTwoTextureCompareProgram.uniform1i(sTex1, 1); + gTwoTextureCompareProgram.uniform1i(sDitherTex, 2); + } + } + + if (success) + { + gOneTextureFilterProgram.mName = "One Texture Filter Shader"; + gOneTextureFilterProgram.mShaderFiles.clear(); + gOneTextureFilterProgram.mShaderFiles.push_back(make_pair("interface/onetexturefilterV.glsl", GL_VERTEX_SHADER_ARB)); + gOneTextureFilterProgram.mShaderFiles.push_back(make_pair("interface/onetexturefilterF.glsl", GL_FRAGMENT_SHADER_ARB)); + gOneTextureFilterProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gOneTextureFilterProgram.createShader(NULL, NULL); + if (success) + { + gOneTextureFilterProgram.bind(); + gOneTextureFilterProgram.uniform1i(sTex0, 0); + } + } +#endif + if (success) { gOneTextureNoColorProgram.mName = "One Texture No Color Shader"; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 53569ca7ab5e398f231b7ce9f10ec7cfd65e8356..42147fdd2999f3bdc351e373fc1a543e4a0bcd56 100755 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -187,6 +187,10 @@ extern LLGLSLShader gBenchmarkProgram; //output tex0[tc0] + tex1[tc1] extern LLGLSLShader gTwoTextureAddProgram; +//output tex0[tc0] - tex1[tc1] +extern LLGLSLShader gTwoTextureCompareProgram; +//discard some fragments based on user-set color tolerance +extern LLGLSLShader gOneTextureFilterProgram; extern LLGLSLShader gOneTextureNoColorProgram; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 35bba4184e63f342776ebe6f2d244d265626e44f..d5ae2d1030837f995096da39cf7a5cde3adc8bae 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -61,363 +61,251 @@ #include "llviewernetwork.h" #include "llmeshrepository.h" //for LLMeshRepository::sBytesReceived - -class StatAttributes +namespace LLStatViewer { -public: - StatAttributes(const char* name, - const BOOL enabled, - const BOOL is_timer) - : mName(name), - mEnabled(enabled), - mIsTimer(is_timer) - { - } + +LLTrace::CountStatHandle<> FPS("FPS", "Frames rendered"), + PACKETS_IN("Packets In", "Packets received"), + PACKETS_LOST("packetsloststat", "Packets lost"), + PACKETS_OUT("packetsoutstat", "Packets sent"), + TEXTURE_PACKETS("texturepacketsstat", "Texture data packets received"), + CHAT_COUNT("chatcount", "Chat messages sent"), + IM_COUNT("imcount", "IMs sent"), + OBJECT_CREATE("objectcreate", "Number of objects created"), + OBJECT_REZ("objectrez", "Object rez count"), + LOGIN_TIMEOUTS("logintimeouts", "Number of login attempts that timed out"), + LSL_SAVES("lslsaves", "Number of times user has saved a script"), + ANIMATION_UPLOADS("animationuploads", "Animations uploaded"), + FLY("fly", "Fly count"), + TELEPORT("teleport", "Teleport count"), + DELETE_OBJECT("deleteobject", "Objects deleted"), + SNAPSHOT("snapshot", "Snapshots taken"), + UPLOAD_SOUND("uploadsound", "Sounds uploaded"), + UPLOAD_TEXTURE("uploadtexture", "Textures uploaded"), + EDIT_TEXTURE("edittexture", "Changes to textures on objects"), + KILLED("killed", "Number of times killed"), + FRAMETIME_DOUBLED("frametimedoubled", "Ratio of frames 2x longer than previous"), + TEX_BAKES("texbakes", "Number of times avatar textures have been baked"), + TEX_REBAKES("texrebakes", "Number of times avatar textures have been forced to rebake"), + NUM_NEW_OBJECTS("numnewobjectsstat", "Number of objects in scene that were not previously in cache"); + +LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > + TRIANGLES_DRAWN("trianglesdrawnstat"); + +LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > + TRIANGLES_DRAWN_PER_FRAME("trianglesdrawnperframestat"); + +LLTrace::CountStatHandle<F64Kilobytes > + ACTIVE_MESSAGE_DATA_RECEIVED("activemessagedatareceived", "Message system data received on all active regions"), + LAYERS_NETWORK_DATA_RECEIVED("layersdatareceived", "Network data received for layer data (terrain)"), + OBJECT_NETWORK_DATA_RECEIVED("objectdatareceived", "Network data received for objects"), + ASSET_UDP_DATA_RECEIVED("assetudpdatareceived", "Network data received for assets (animations, sounds) over UDP message system"), + TEXTURE_NETWORK_DATA_RECEIVED("texturedatareceived", "Network data received for textures"), + MESSAGE_SYSTEM_DATA_IN("messagedatain", "Incoming message system network data"), + MESSAGE_SYSTEM_DATA_OUT("messagedataout", "Outgoing message system network data"); + +LLTrace::CountStatHandle<F64Seconds > + SIM_20_FPS_TIME("sim20fpstime", "Seconds with sim FPS below 20"), + SIM_PHYSICS_20_FPS_TIME("simphysics20fpstime", "Seconds with physics FPS below 20"), + LOSS_5_PERCENT_TIME("loss5percenttime", "Seconds with packet loss > 5%"); + +SimMeasurement<> SIM_TIME_DILATION("simtimedilation", "Simulator time scale", LL_SIM_STAT_TIME_DILATION), + SIM_FPS("simfps", "Simulator framerate", LL_SIM_STAT_FPS), + SIM_PHYSICS_FPS("simphysicsfps", "Simulator physics framerate", LL_SIM_STAT_PHYSFPS), + SIM_AGENT_UPS("simagentups", "", LL_SIM_STAT_AGENTUPS), + SIM_SCRIPT_EPS("simscripteps", "", LL_SIM_STAT_SCRIPT_EPS), + SIM_SKIPPED_SILHOUETTE("simsimskippedsilhouettesteps", "", LL_SIM_STAT_SKIPPEDAISILSTEPS_PS), + SIM_MAIN_AGENTS("simmainagents", "Number of avatars in current region", LL_SIM_STAT_NUMAGENTMAIN), + SIM_CHILD_AGENTS("simchildagents", "Number of avatars in neighboring regions", LL_SIM_STAT_NUMAGENTCHILD), + SIM_OBJECTS("simobjects", "", LL_SIM_STAT_NUMTASKS), + SIM_ACTIVE_OBJECTS("simactiveobjects", "Number of scripted and/or mocing objects", LL_SIM_STAT_NUMTASKSACTIVE), + SIM_ACTIVE_SCRIPTS("simactivescripts", "Number of scripted objects", LL_SIM_STAT_NUMSCRIPTSACTIVE), + SIM_IN_PACKETS_PER_SEC("siminpps", "", LL_SIM_STAT_INPPS), + SIM_OUT_PACKETS_PER_SEC("simoutpps", "", LL_SIM_STAT_OUTPPS), + SIM_PENDING_DOWNLOADS("simpendingdownloads", "", LL_SIM_STAT_PENDING_DOWNLOADS), + SIM_PENDING_UPLOADS("simpendinguploads", "", LL_SIM_STAT_PENDING_UPLOADS), + SIM_PENDING_LOCAL_UPLOADS("simpendinglocaluploads", "", LL_SIM_STAT_PENDING_LOCAL_UPLOADS), + SIM_PHYSICS_PINNED_TASKS("physicspinnedtasks", "", LL_SIM_STAT_PHYSICS_PINNED_TASKS), + SIM_PHYSICS_LOD_TASKS("physicslodtasks", "", LL_SIM_STAT_PHYSICS_LOD_TASKS); + +SimMeasurement<LLUnit<F64, LLUnits::Percent> > + SIM_PERCENTAGE_SCRIPTS_RUN("simpctscriptsrun", "", LL_SIM_STAT_PCTSCRIPTSRUN), + SIM_SKIPPED_CHARACTERS_PERCENTAGE("simsimpctsteppedcharacters", "", LL_SIM_STAT_PCTSTEPPEDCHARACTERS); + +LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"), + NUM_IMAGES("numimagesstat"), + NUM_RAW_IMAGES("numrawimagesstat"), + NUM_OBJECTS("numobjectsstat"), + NUM_ACTIVE_OBJECTS("numactiveobjectsstat"), + ENABLE_VBO("enablevbo", "Vertex Buffers Enabled"), + LIGHTING_DETAIL("lightingdetail", "Lighting Detail"), + VISIBLE_AVATARS("visibleavatars", "Visible Avatars"), + SHADER_OBJECTS("shaderobjects", "Object Shaders"), + DRAW_DISTANCE("drawdistance", "Draw Distance"), + PENDING_VFS_OPERATIONS("vfspendingoperations"), + WINDOW_WIDTH("windowwidth", "Window width"), + WINDOW_HEIGHT("windowheight", "Window height"); + +LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > + PACKETS_LOST_PERCENT("packetslostpercentstat"); + +static LLTrace::SampleStatHandle<bool> + CHAT_BUBBLES("chatbubbles", "Chat Bubbles Enabled"); + +LLTrace::SampleStatHandle<F64Megabytes > GL_TEX_MEM("gltexmemstat"), + GL_BOUND_MEM("glboundmemstat"), + RAW_MEM("rawmemstat"), + FORMATTED_MEM("formattedmemstat"); +LLTrace::SampleStatHandle<F64Kilobytes > DELTA_BANDWIDTH("deltabandwidth", "Increase/Decrease in bandwidth based on packet loss"), + MAX_BANDWIDTH("maxbandwidth", "Max bandwidth setting"); + - std::string mName; - BOOL mEnabled; - BOOL mIsTimer; -}; +SimMeasurement<F64Milliseconds > SIM_FRAME_TIME("simframemsec", "", LL_SIM_STAT_FRAMEMS), + SIM_NET_TIME("simnetmsec", "", LL_SIM_STAT_NETMS), + SIM_OTHER_TIME("simsimothermsec", "", LL_SIM_STAT_SIMOTHERMS), + SIM_PHYSICS_TIME("simsimphysicsmsec", "", LL_SIM_STAT_SIMPHYSICSMS), + SIM_PHYSICS_STEP_TIME("simsimphysicsstepmsec", "", LL_SIM_STAT_SIMPHYSICSSTEPMS), + SIM_PHYSICS_SHAPE_UPDATE_TIME("simsimphysicsshapeupdatemsec", "", LL_SIM_STAT_SIMPHYSICSSHAPEMS), + SIM_PHYSICS_OTHER_TIME("simsimphysicsothermsec", "", LL_SIM_STAT_SIMPHYSICSOTHERMS), + SIM_AI_TIME("simsimaistepmsec", "", LL_SIM_STAT_SIMAISTEPTIMEMS), + SIM_AGENTS_TIME("simagentmsec", "", LL_SIM_STAT_AGENTMS), + SIM_IMAGES_TIME("simimagesmsec", "", LL_SIM_STAT_IMAGESMS), + SIM_SCRIPTS_TIME("simscriptmsec", "", LL_SIM_STAT_SCRIPTMS), + SIM_SPARE_TIME("simsparemsec", "", LL_SIM_STAT_SIMSPARETIME), + SIM_SLEEP_TIME("simsleepmsec", "", LL_SIM_STAT_SIMSLEEPTIME), + SIM_PUMP_IO_TIME("simpumpiomsec", "", LL_SIM_STAT_IOPUMPTIME); + +SimMeasurement<F64Kilobytes > SIM_UNACKED_BYTES("simtotalunackedbytes", "", LL_SIM_STAT_TOTAL_UNACKED_BYTES); +SimMeasurement<F64Megabytes > SIM_PHYSICS_MEM("physicsmemoryallocated", "", LL_SIM_STAT_SIMPHYSICSMEMORY); -const StatAttributes STAT_INFO[LLViewerStats::ST_COUNT] = -{ - // ST_VERSION - StatAttributes("Version", TRUE, FALSE), - // ST_AVATAR_EDIT_SECONDS - StatAttributes("Seconds in Edit Appearence", FALSE, TRUE), - // ST_TOOLBOX_SECONDS - StatAttributes("Seconds using Toolbox", FALSE, TRUE), - // ST_CHAT_COUNT - StatAttributes("Chat messages sent", FALSE, FALSE), - // ST_IM_COUNT - StatAttributes("IMs sent", FALSE, FALSE), - // ST_FULLSCREEN_BOOL - StatAttributes("Fullscreen mode", FALSE, FALSE), - // ST_RELEASE_COUNT - StatAttributes("Object release count", FALSE, FALSE), - // ST_CREATE_COUNT - StatAttributes("Object create count", FALSE, FALSE), - // ST_REZ_COUNT - StatAttributes("Object rez count", FALSE, FALSE), - // ST_FPS_10_SECONDS - StatAttributes("Seconds below 10 FPS", FALSE, TRUE), - // ST_FPS_2_SECONDS - StatAttributes("Seconds below 2 FPS", FALSE, TRUE), - // ST_MOUSELOOK_SECONDS - StatAttributes("Seconds in Mouselook", FALSE, TRUE), - // ST_FLY_COUNT - StatAttributes("Fly count", FALSE, FALSE), - // ST_TELEPORT_COUNT - StatAttributes("Teleport count", FALSE, FALSE), - // ST_OBJECT_DELETE_COUNT - StatAttributes("Objects deleted", FALSE, FALSE), - // ST_SNAPSHOT_COUNT - StatAttributes("Snapshots taken", FALSE, FALSE), - // ST_UPLOAD_SOUND_COUNT - StatAttributes("Sounds uploaded", FALSE, FALSE), - // ST_UPLOAD_TEXTURE_COUNT - StatAttributes("Textures uploaded", FALSE, FALSE), - // ST_EDIT_TEXTURE_COUNT - StatAttributes("Changes to textures on objects", FALSE, FALSE), - // ST_KILLED_COUNT - StatAttributes("Number of times killed", FALSE, FALSE), - // ST_FRAMETIME_JITTER - StatAttributes("Average delta between sucessive frame times", FALSE, FALSE), - // ST_FRAMETIME_SLEW - StatAttributes("Average delta between frame time and mean", FALSE, FALSE), - // ST_INVENTORY_TOO_LONG - StatAttributes("Inventory took too long to load", FALSE, FALSE), - // ST_WEARABLES_TOO_LONG - StatAttributes("Wearables took too long to load", FALSE, FALSE), - // ST_LOGIN_SECONDS - StatAttributes("Time between LoginRequest and LoginReply", FALSE, FALSE), - // ST_LOGIN_TIMEOUT_COUNT - StatAttributes("Number of login attempts that timed out", FALSE, FALSE), - // ST_HAS_BAD_TIMER - StatAttributes("Known bad timer if != 0.0", FALSE, FALSE), - // ST_DOWNLOAD_FAILED - StatAttributes("Number of times LLAssetStorage::getAssetData() has failed", FALSE, FALSE), - // ST_LSL_SAVE_COUNT - StatAttributes("Number of times user has saved a script", FALSE, FALSE), - // ST_UPLOAD_ANIM_COUNT - StatAttributes("Animations uploaded", FALSE, FALSE), - // ST_FPS_8_SECONDS - StatAttributes("Seconds below 8 FPS", FALSE, TRUE), - // ST_SIM_FPS_20_SECONDS - StatAttributes("Seconds with sim FPS below 20", FALSE, TRUE), - // ST_PHYS_FPS_20_SECONDS - StatAttributes("Seconds with physics FPS below 20", FALSE, TRUE), - // ST_LOSS_05_SECONDS - StatAttributes("Seconds with packet loss > 5%", FALSE, TRUE), - // ST_FPS_DROP_50_RATIO - StatAttributes("Ratio of frames 2x longer than previous", FALSE, FALSE), - // ST_ENABLE_VBO - StatAttributes("Vertex Buffers Enabled", TRUE, FALSE), - // ST_DELTA_BANDWIDTH - StatAttributes("Increase/Decrease in bandwidth based on packet loss", FALSE, FALSE), - // ST_MAX_BANDWIDTH - StatAttributes("Max bandwidth setting", FALSE, FALSE), - // ST_LIGHTING_DETAIL - StatAttributes("Lighting Detail", FALSE, FALSE), - // ST_VISIBLE_AVATARS - StatAttributes("Visible Avatars", FALSE, FALSE), - // ST_SHADER_OJECTS - StatAttributes("Object Shaders", FALSE, FALSE), - // ST_SHADER_ENVIRONMENT - StatAttributes("Environment Shaders", FALSE, FALSE), - // ST_VISIBLE_DRAW_DIST - StatAttributes("Draw Distance", FALSE, FALSE), - // ST_VISIBLE_CHAT_BUBBLES - StatAttributes("Chat Bubbles Enabled", FALSE, FALSE), - // ST_SHADER_AVATAR - StatAttributes("Avatar Shaders", FALSE, FALSE), - // ST_FRAME_SECS - StatAttributes("FRAME_SECS", FALSE, FALSE), - // ST_UPDATE_SECS - StatAttributes("UPDATE_SECS", FALSE, FALSE), - // ST_NETWORK_SECS - StatAttributes("NETWORK_SECS", FALSE, FALSE), - // ST_IMAGE_SECS - StatAttributes("IMAGE_SECS", FALSE, FALSE), - // ST_REBUILD_SECS - StatAttributes("REBUILD_SECS", FALSE, FALSE), - // ST_RENDER_SECS - StatAttributes("RENDER_SECS", FALSE, FALSE), - // ST_CROSSING_AVG - StatAttributes("CROSSING_AVG", FALSE, FALSE), - // ST_CROSSING_MAX - StatAttributes("CROSSING_MAX", FALSE, FALSE), - // ST_LIBXUL_WIDGET_USED - StatAttributes("LibXUL Widget used", FALSE, FALSE), // Unused - // ST_WINDOW_WIDTH - StatAttributes("Window width", FALSE, FALSE), - // ST_WINDOW_HEIGHT - StatAttributes("Window height", FALSE, FALSE), - // ST_TEX_BAKES - StatAttributes("Texture Bakes", FALSE, FALSE), - // ST_TEX_REBAKES - StatAttributes("Texture Rebakes", FALSE, FALSE) +LLTrace::SampleStatHandle<F64Milliseconds > FRAMETIME_JITTER("frametimejitter", "Average delta between successive frame times"), + FRAMETIME_SLEW("frametimeslew", "Average delta between frame time and mean"), + SIM_PING("simpingstat"); -}; +LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Meters> > AGENT_POSITION_SNAP("agentpositionsnap", "agent position corrections"); -LLViewerStats::LLViewerStats() : - mKBitStat("kbitstat"), - mLayersKBitStat("layerskbitstat"), - mObjectKBitStat("objectkbitstat"), - mAssetKBitStat("assetkbitstat"), - mTextureKBitStat("texturekbitstat"), - mVFSPendingOperations("vfspendingoperations"), - mObjectsDrawnStat("objectsdrawnstat"), - mObjectsCulledStat("objectsculledstat"), - mObjectsTestedStat("objectstestedstat"), - mObjectsComparedStat("objectscomparedstat"), - mObjectsOccludedStat("objectsoccludedstat"), - mFPSStat("fpsstat"), - mPacketsInStat("packetsinstat"), - mPacketsLostStat("packetsloststat"), - mPacketsOutStat("packetsoutstat"), - mPacketsLostPercentStat("packetslostpercentstat", 64), - mTexturePacketsStat("texturepacketsstat"), - mActualInKBitStat("actualinkbitstat"), - mActualOutKBitStat("actualoutkbitstat"), - mTrianglesDrawnStat("trianglesdrawnstat"), - mSimTimeDilation("simtimedilation"), - mSimFPS("simfps"), - mSimPhysicsFPS("simphysicsfps"), - mSimAgentUPS("simagentups"), - mSimScriptEPS("simscripteps"), - mSimFrameMsec("simframemsec"), - mSimNetMsec("simnetmsec"), - mSimSimOtherMsec("simsimothermsec"), - mSimSimPhysicsMsec("simsimphysicsmsec"), - mSimSimPhysicsStepMsec("simsimphysicsstepmsec"), - mSimSimPhysicsShapeUpdateMsec("simsimphysicsshapeupdatemsec"), - mSimSimPhysicsOtherMsec("simsimphysicsothermsec"), - mSimSimAIStepMsec("simsimaistepmsec"), - mSimSimSkippedSilhouetteSteps("simsimskippedsilhouettesteps"), - mSimSimPctSteppedCharacters("simsimpctsteppedcharacters"), - mSimAgentMsec("simagentmsec"), - mSimImagesMsec("simimagesmsec"), - mSimScriptMsec("simscriptmsec"), - mSimSpareMsec("simsparemsec"), - mSimSleepMsec("simsleepmsec"), - mSimPumpIOMsec("simpumpiomsec"), - mSimMainAgents("simmainagents"), - mSimChildAgents("simchildagents"), - mSimObjects("simobjects"), - mSimActiveObjects("simactiveobjects"), - mSimActiveScripts("simactivescripts"), - mSimPctScriptsRun("simpctscriptsrun"), - mSimInPPS("siminpps"), - mSimOutPPS("simoutpps"), - mSimPendingDownloads("simpendingdownloads"), - mSimPendingUploads("simpendinguploads"), - mSimPendingLocalUploads("simpendinglocaluploads"), - mSimTotalUnackedBytes("simtotalunackedbytes"), - mPhysicsPinnedTasks("physicspinnedtasks"), - mPhysicsLODTasks("physicslodtasks"), - mPhysicsMemoryAllocated("physicsmemoryallocated"), - mSimPingStat("simpingstat"), - mNumImagesStat("numimagesstat", 32, TRUE), - mNumRawImagesStat("numrawimagesstat", 32, TRUE), - mGLTexMemStat("gltexmemstat", 32, TRUE), - mGLBoundMemStat("glboundmemstat", 32, TRUE), - mRawMemStat("rawmemstat", 32, TRUE), - mFormattedMemStat("formattedmemstat", 32, TRUE), - mNumObjectsStat("numobjectsstat"), - mNumActiveObjectsStat("numactiveobjectsstat"), - mNumNewObjectsStat("numnewobjectsstat"), - mNumSizeCulledStat("numsizeculledstat"), - mNumVisCulledStat("numvisculledstat"), - mLastTimeDiff(0.0) -{ - for (S32 i = 0; i < ST_COUNT; i++) - { - mStats[i] = 0.0; - } +LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY("loadingwearableslongdelay", "Wearables took too long to load"); - if (LLTimer::knownBadTimer()) - { - mStats[ST_HAS_BAD_TIMER] = 1.0; - } +LLTrace::EventStatHandle<F64Milliseconds > REGION_CROSSING_TIME("regioncrossingtime", "CROSSING_AVG"), + FRAME_STACKTIME("framestacktime", "FRAME_SECS"), + UPDATE_STACKTIME("updatestacktime", "UPDATE_SECS"), + NETWORK_STACKTIME("networkstacktime", "NETWORK_SECS"), + IMAGE_STACKTIME("imagestacktime", "IMAGE_SECS"), + REBUILD_STACKTIME("rebuildstacktime", "REBUILD_SECS"), + RENDER_STACKTIME("renderstacktime", "RENDER_SECS"); - mAgentPositionSnaps.reset(); -} +LLTrace::EventStatHandle<F64Seconds > AVATAR_EDIT_TIME("avataredittime", "Seconds in Edit Appearance"), + TOOLBOX_TIME("toolboxtime", "Seconds using Toolbox"), + MOUSELOOK_TIME("mouselooktime", "Seconds in Mouselook"), + FPS_10_TIME("fps10time", "Seconds below 10 FPS"), + FPS_8_TIME("fps8time", "Seconds below 8 FPS"), + FPS_2_TIME("fps2time", "Seconds below 2 FPS"); -LLViewerStats::~LLViewerStats() -{ -} +LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > OBJECT_CACHE_HIT_RATE("object_cache_hits"); -void LLViewerStats::resetStats() -{ - LLViewerStats& stats = LLViewerStats::instance(); - stats.mKBitStat.reset(); - stats.mLayersKBitStat.reset(); - stats.mObjectKBitStat.reset(); - stats.mTextureKBitStat.reset(); - stats.mVFSPendingOperations.reset(); - stats.mAssetKBitStat.reset(); - stats.mPacketsInStat.reset(); - stats.mPacketsLostStat.reset(); - stats.mPacketsOutStat.reset(); - stats.mFPSStat.reset(); - stats.mTexturePacketsStat.reset(); - stats.mAgentPositionSnaps.reset(); } - -F64 LLViewerStats::getStat(EStatType type) const +LLViewerStats::LLViewerStats() +: mLastTimeDiff(0.0) { - return mStats[type]; + getRecording().start(); } -F64 LLViewerStats::setStat(EStatType type, F64 value) -{ - mStats[type] = value; - return mStats[type]; -} +LLViewerStats::~LLViewerStats() +{} -F64 LLViewerStats::incStat(EStatType type, F64 value) +void LLViewerStats::resetStats() { - mStats[type] += value; - return mStats[type]; + getRecording().reset(); } -void LLViewerStats::updateFrameStats(const F64 time_diff) +void LLViewerStats::updateFrameStats(const F64Seconds time_diff) { - if (mPacketsLostPercentStat.getCurrent() > 5.0) + if (getRecording().getLastValue(LLStatViewer::PACKETS_LOST_PERCENT) > F32Percent(5.0)) { - incStat(ST_LOSS_05_SECONDS, time_diff); + add(LLStatViewer::LOSS_5_PERCENT_TIME, time_diff); } - if (mSimFPS.getCurrent() < 20.f && mSimFPS.getCurrent() > 0.f) + F32 sim_fps = getRecording().getLastValue(LLStatViewer::SIM_FPS); + if (0.f < sim_fps && sim_fps < 20.f) { - incStat(ST_SIM_FPS_20_SECONDS, time_diff); + add(LLStatViewer::SIM_20_FPS_TIME, time_diff); } - if (mSimPhysicsFPS.getCurrent() < 20.f && mSimPhysicsFPS.getCurrent() > 0.f) + F32 sim_physics_fps = getRecording().getLastValue(LLStatViewer::SIM_PHYSICS_FPS); + + if (0.f < sim_physics_fps && sim_physics_fps < 20.f) { - incStat(ST_PHYS_FPS_20_SECONDS, time_diff); + add(LLStatViewer::SIM_PHYSICS_20_FPS_TIME, time_diff); } - if (time_diff >= 0.5) + if (time_diff >= (F64Seconds)0.5) { - incStat(ST_FPS_2_SECONDS, time_diff); + record(LLStatViewer::FPS_2_TIME, time_diff); } - if (time_diff >= 0.125) + if (time_diff >= (F64Seconds)0.125) { - incStat(ST_FPS_8_SECONDS, time_diff); + record(LLStatViewer::FPS_8_TIME, time_diff); } - if (time_diff >= 0.1) + if (time_diff >= (F64Seconds)0.1) { - incStat(ST_FPS_10_SECONDS, time_diff); + record(LLStatViewer::FPS_10_TIME, time_diff); } - if (gFrameCount && mLastTimeDiff > 0.0) + if (gFrameCount && mLastTimeDiff > (F64Seconds)0.0) { // new "stutter" meter - setStat(ST_FPS_DROP_50_RATIO, - (getStat(ST_FPS_DROP_50_RATIO) * (F64)(gFrameCount - 1) + - (time_diff >= 2.0 * mLastTimeDiff ? 1.0 : 0.0)) / gFrameCount); - + add(LLStatViewer::FRAMETIME_DOUBLED, time_diff >= 2.0 * mLastTimeDiff ? 1 : 0); // old stats that were never really used - setStat(ST_FRAMETIME_JITTER, - (getStat(ST_FRAMETIME_JITTER) * (gFrameCount - 1) + - fabs(mLastTimeDiff - time_diff) / mLastTimeDiff) / gFrameCount); + sample(LLStatViewer::FRAMETIME_JITTER, F64Milliseconds (mLastTimeDiff - time_diff)); - F32 average_frametime = gRenderStartTime.getElapsedTimeF32() / (F32)gFrameCount; - setStat(ST_FRAMETIME_SLEW, - (getStat(ST_FRAMETIME_SLEW) * (gFrameCount - 1) + - fabs(average_frametime - time_diff) / average_frametime) / gFrameCount); + F32Seconds average_frametime = gRenderStartTime.getElapsedTimeF32() / (F32)gFrameCount; + sample(LLStatViewer::FRAMETIME_SLEW, F64Milliseconds (average_frametime - time_diff)); F32 max_bandwidth = gViewerThrottle.getMaxBandwidth(); F32 delta_bandwidth = gViewerThrottle.getCurrentBandwidth() - max_bandwidth; - setStat(ST_DELTA_BANDWIDTH, delta_bandwidth / 1024.f); - - setStat(ST_MAX_BANDWIDTH, max_bandwidth / 1024.f); - + sample(LLStatViewer::DELTA_BANDWIDTH, F64Bits(delta_bandwidth)); + sample(LLStatViewer::MAX_BANDWIDTH, F64Bits(max_bandwidth)); } mLastTimeDiff = time_diff; - } -void LLViewerStats::addToMessage(LLSD &body) const +void LLViewerStats::addToMessage(LLSD &body) { LLSD &misc = body["misc"]; - for (S32 i = 0; i < ST_COUNT; i++) - { - if (STAT_INFO[i].mEnabled) - { - // TODO: send timer value so dataserver can normalize - misc[STAT_INFO[i].mName] = mStats[i]; - llinfos << "STAT: " << STAT_INFO[i].mName << ": " << mStats[i] - << llendl; - } - } + misc["Version"] = TRUE; + //TODO RN: get last value, not mean + misc["Vertex Buffers Enabled"] = getRecording().getMean(LLStatViewer::ENABLE_VBO); - body["AgentPositionSnaps"] = mAgentPositionSnaps.getData(); - llinfos << "STAT: AgentPositionSnaps: Mean = " << mAgentPositionSnaps.getMean() << "; StdDev = " << mAgentPositionSnaps.getStdDev() - << "; Count = " << mAgentPositionSnaps.getCount() << llendl; + body["AgentPositionSnaps"] = getRecording().getSum(LLStatViewer::AGENT_POSITION_SNAP).value(); //mAgentPositionSnaps.asLLSD(); + LL_INFOS() << "STAT: AgentPositionSnaps: Mean = " << getRecording().getMean(LLStatViewer::AGENT_POSITION_SNAP).value() << "; StdDev = " << getRecording().getStandardDeviation(LLStatViewer::AGENT_POSITION_SNAP).value() + << "; Count = " << getRecording().getSampleCount(LLStatViewer::AGENT_POSITION_SNAP) << LL_ENDL; } // *NOTE:Mani The following methods used to exist in viewer.cpp // Moving them here, but not merging them into LLViewerStats yet. -U32 gTotalLandIn = 0, gTotalLandOut = 0; -U32 gTotalWaterIn = 0, gTotalWaterOut = 0; - -F32 gAveLandCompression = 0.f, gAveWaterCompression = 0.f; -F32 gBestLandCompression = 1.f, gBestWaterCompression = 1.f; -F32 gWorstLandCompression = 0.f, gWorstWaterCompression = 0.f; - - - -U32 gTotalWorldBytes = 0, gTotalObjectBytes = 0, gTotalTextureBytes = 0, gSimPingCount = 0; -U32 gObjectBits = 0; -F32 gAvgSimPing = 0.f; -U32 gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {0}; +U32 gTotalLandIn = 0, + gTotalLandOut = 0, + gTotalWaterIn = 0, + gTotalWaterOut = 0; + +F32 gAveLandCompression = 0.f, + gAveWaterCompression = 0.f, + gBestLandCompression = 1.f, + gBestWaterCompression = 1.f, + gWorstLandCompression = 0.f, + gWorstWaterCompression = 0.f; + +U32Bytes gTotalWorldData, + gTotalObjectData, + gTotalTextureData; +U32 gSimPingCount = 0; +U32Bits gObjectData; +F32Milliseconds gAvgSimPing(0.f); +U32Bytes gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {U32Bytes(0)}; extern U32 gVisCompared; extern U32 gVisTested; @@ -426,59 +314,70 @@ LLFrameTimer gTextureTimer; void update_statistics() { - gTotalWorldBytes += gVLManager.getTotalBytes(); - gTotalObjectBytes += gObjectBits / 8; - - LLViewerStats& stats = LLViewerStats::instance(); + gTotalWorldData += gVLManager.getTotalBytes(); + gTotalObjectData += gObjectData; // make sure we have a valid time delta for this frame if (gFrameIntervalSeconds > 0.f) { if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK) { - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_MOUSELOOK_SECONDS, gFrameIntervalSeconds); + record(LLStatViewer::MOUSELOOK_TIME, gFrameIntervalSeconds); } else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR) { - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_AVATAR_EDIT_SECONDS, gFrameIntervalSeconds); + record(LLStatViewer::AVATAR_EDIT_TIME, gFrameIntervalSeconds); } else if (LLFloaterReg::instanceVisible("build")) { - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TOOLBOX_SECONDS, gFrameIntervalSeconds); + record(LLStatViewer::TOOLBOX_TIME, gFrameIntervalSeconds); } } - stats.setStat(LLViewerStats::ST_ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable")); - stats.setStat(LLViewerStats::ST_LIGHTING_DETAIL, (F64)gPipeline.getLightingDetail()); - stats.setStat(LLViewerStats::ST_DRAW_DIST, (F64)gSavedSettings.getF32("RenderFarClip")); - stats.setStat(LLViewerStats::ST_CHAT_BUBBLES, (F64)gSavedSettings.getBOOL("UseChatBubbles")); - - stats.setStat(LLViewerStats::ST_FRAME_SECS, gDebugView->mFastTimerView->getTime("Frame")); - F64 idle_secs = gDebugView->mFastTimerView->getTime("Idle"); - F64 network_secs = gDebugView->mFastTimerView->getTime("Network"); - stats.setStat(LLViewerStats::ST_UPDATE_SECS, idle_secs - network_secs); - stats.setStat(LLViewerStats::ST_NETWORK_SECS, network_secs); - stats.setStat(LLViewerStats::ST_IMAGE_SECS, gDebugView->mFastTimerView->getTime("Update Images")); - stats.setStat(LLViewerStats::ST_REBUILD_SECS, gDebugView->mFastTimerView->getTime("Sort Draw State")); - stats.setStat(LLViewerStats::ST_RENDER_SECS, gDebugView->mFastTimerView->getTime("Geometry")); + + LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording(); + + record(LLStatViewer::TRIANGLES_DRAWN_PER_FRAME, last_frame_recording.getSum(LLStatViewer::TRIANGLES_DRAWN)); + + sample(LLStatViewer::ENABLE_VBO, (F64)gSavedSettings.getBOOL("RenderVBOEnable")); + sample(LLStatViewer::LIGHTING_DETAIL, (F64)gPipeline.getLightingDetail()); + sample(LLStatViewer::DRAW_DISTANCE, (F64)gSavedSettings.getF32("RenderFarClip")); + sample(LLStatViewer::CHAT_BUBBLES, gSavedSettings.getBOOL("UseChatBubbles")); + + typedef LLTrace::StatType<LLTrace::TimeBlockAccumulator>::instance_tracker_t stat_type_t; + + F64Seconds idle_secs = last_frame_recording.getSum(*stat_type_t::getInstance("Idle")); + F64Seconds network_secs = last_frame_recording.getSum(*stat_type_t::getInstance("Network")); + + record(LLStatViewer::FRAME_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Frame"))); + record(LLStatViewer::UPDATE_STACKTIME, idle_secs - network_secs); + record(LLStatViewer::NETWORK_STACKTIME, network_secs); + record(LLStatViewer::IMAGE_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Update Images"))); + record(LLStatViewer::REBUILD_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Sort Draw State"))); + record(LLStatViewer::RENDER_STACKTIME, last_frame_recording.getSum(*stat_type_t::getInstance("Render Geometry"))); LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(gAgent.getRegion()->getHost()); if (cdp) { - stats.mSimPingStat.addValue(cdp->getPingDelay()); - gAvgSimPing = ((gAvgSimPing * (F32)gSimPingCount) + (F32)(cdp->getPingDelay())) / ((F32)gSimPingCount + 1); + sample(LLStatViewer::SIM_PING, F64Milliseconds (cdp->getPingDelay())); + gAvgSimPing = ((gAvgSimPing * gSimPingCount) + cdp->getPingDelay()) / (gSimPingCount + 1); gSimPingCount++; } else { - stats.mSimPingStat.addValue(10000); + sample(LLStatViewer::SIM_PING, U32Seconds(10)); + } + + if (LLViewerStats::instance().getRecording().getSum(LLStatViewer::FPS)) + { + sample(LLStatViewer::FPS_SAMPLE, LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::FPS)); } + add(LLStatViewer::FPS, 1); - stats.mFPSStat.addValue(1); - F32 layer_bits = (F32)(gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits()); - stats.mLayersKBitStat.addValue(layer_bits/1024.f); - stats.mObjectKBitStat.addValue(gObjectBits/1024.f); - stats.mVFSPendingOperations.addValue(LLVFile::getVFSThread()->getPending()); - stats.mAssetKBitStat.addValue(gTransferManager.getTransferBitsIn(LLTCT_ASSET)/1024.f); + F64Bits layer_bits = gVLManager.getLandBits() + gVLManager.getWindBits() + gVLManager.getCloudBits(); + add(LLStatViewer::LAYERS_NETWORK_DATA_RECEIVED, layer_bits); + add(LLStatViewer::OBJECT_NETWORK_DATA_RECEIVED, gObjectData); + sample(LLStatViewer::PENDING_VFS_OPERATIONS, LLVFile::getVFSThread()->getPending()); + add(LLStatViewer::ASSET_UDP_DATA_RECEIVED, F64Bits(gTransferManager.getTransferBitsIn(LLTCT_ASSET))); gTransferManager.resetTransferBitsIn(LLTCT_ASSET); if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) @@ -490,23 +389,13 @@ void update_statistics() gTextureTimer.unpause(); } - { - static F32 visible_avatar_frames = 0.f; - static F32 avg_visible_avatars = 0; - F32 visible_avatars = (F32)LLVOAvatar::sNumVisibleAvatars; - if (visible_avatars > 0.f) - { - visible_avatar_frames = 1.f; - avg_visible_avatars = (avg_visible_avatars * (F32)(visible_avatar_frames - 1.f) + visible_avatars) / visible_avatar_frames; - } - stats.setStat(LLViewerStats::ST_VISIBLE_AVATARS, (F64)avg_visible_avatars); - } + sample(LLStatViewer::VISIBLE_AVATARS, LLVOAvatar::sNumVisibleAvatars); LLWorld::getInstance()->updateNetStats(); LLWorld::getInstance()->requestCacheMisses(); // Reset all of these values. gVLManager.resetBitCounts(); - gObjectBits = 0; + gObjectData = (U32Bytes)0; // gDecodedBits = 0; // Only update texture stats periodically so that they are less noisy @@ -515,11 +404,7 @@ void update_statistics() static LLFrameTimer texture_stats_timer; if (texture_stats_timer.getElapsedTimeF32() >= texture_stats_freq) { - stats.mTextureKBitStat.addValue(LLViewerTextureList::sTextureBits/1024.f); - stats.mTexturePacketsStat.addValue(LLViewerTextureList::sTexturePackets); - gTotalTextureBytes += LLViewerTextureList::sTextureBits / 8; - LLViewerTextureList::sTextureBits = 0; - LLViewerTextureList::sTexturePackets = 0; + gTotalTextureData = LLViewerStats::instance().getRecording().getSum(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED); texture_stats_timer.reset(); } } @@ -532,13 +417,13 @@ class ViewerStatsResponder : public LLHTTPClient::Responder void error(U32 statusNum, const std::string& reason) { - llinfos << "ViewerStatsResponder::error " << statusNum << " " - << reason << llendl; + LL_INFOS() << "ViewerStatsResponder::error " << statusNum << " " + << reason << LL_ENDL; } void result(const LLSD& content) { - llinfos << "ViewerStatsResponder::result" << llendl; + LL_INFOS() << "ViewerStatsResponder::result" << LL_ENDL; } }; @@ -568,10 +453,12 @@ void send_stats() std::string url = gAgent.getRegion()->getCapability("ViewerStats"); if (url.empty()) { - llwarns << "Could not get ViewerStats capability" << llendl; + LL_WARNS() << "Could not get ViewerStats capability" << LL_ENDL; return; } + LLViewerStats::instance().getRecording().pause(); + body["session_id"] = gAgentSessionID; LLSD &agent = body["agent"]; @@ -609,14 +496,14 @@ void send_stats() gSimFrames = (F32) gFrameCount; agent["agents_in_view"] = LLVOAvatar::sNumVisibleAvatars; - agent["ping"] = gAvgSimPing; + agent["ping"] = gAvgSimPing.value(); agent["meters_traveled"] = gAgent.getDistanceTraveled(); agent["regions_visited"] = gAgent.getRegionsVisited(); agent["mem_use"] = LLMemory::getCurrentRSS() / 1024.0; LLSD &system = body["system"]; - system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB(); + system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB().value(); system["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple(); system["cpu"] = gSysCPU.getCPUString(); unsigned char MACAddress[MAC_ADDRESS_BYTES]; @@ -668,9 +555,9 @@ void send_stats() LLSD &download = body["downloads"]; - download["world_kbytes"] = gTotalWorldBytes / 1024.0; - download["object_kbytes"] = gTotalObjectBytes / 1024.0; - download["texture_kbytes"] = gTotalTextureBytes / 1024.0; + download["world_kbytes"] = F64Kilobytes(gTotalWorldData).value(); + download["object_kbytes"] = F64Kilobytes(gTotalObjectData).value(); + download["texture_kbytes"] = F64Kilobytes(gTotalTextureData).value(); download["mesh_kbytes"] = LLMeshRepository::sBytesReceived/1024.0; LLSD &in = body["stats"]["net"]["in"]; @@ -711,7 +598,7 @@ void send_stats() S32 window_height = gViewerWindow->getWindowHeightRaw(); S32 window_size = (window_width * window_height) / 1024; misc["string_1"] = llformat("%d", window_size); - misc["string_2"] = llformat("Texture Time: %.2f, Total Time: %.2f", gTextureTimer.getElapsedTimeF32(), gFrameTimeSeconds); + misc["string_2"] = llformat("Texture Time: %.2f, Total Time: %.2f", gTextureTimer.getElapsedTimeF32(), gFrameTimeSeconds.value()); // misc["int_1"] = LLSD::Integer(gSavedSettings.getU32("RenderQualityPerformance")); // Steve: 1.21 // misc["int_2"] = LLSD::Integer(gFrameStalls); // Steve: 1.21 @@ -721,8 +608,8 @@ void send_stats() F32 grey_time = LLVOAvatar::sGreyTime * 1000.f / gFrameTimeSeconds; misc["int_2"] = LLSD::Integer(grey_time); // Steve: 1.22 - llinfos << "Misc Stats: int_1: " << misc["int_1"] << " int_2: " << misc["int_2"] << llendl; - llinfos << "Misc Stats: string_1: " << misc["string_1"] << " string_2: " << misc["string_2"] << llendl; + LL_INFOS() << "Misc Stats: int_1: " << misc["int_1"] << " int_2: " << misc["int_2"] << LL_ENDL; + LL_INFOS() << "Misc Stats: string_1: " << misc["string_1"] << " string_2: " << misc["string_2"] << LL_ENDL; body["DisplayNamesEnabled"] = gSavedSettings.getBOOL("UseDisplayNames"); body["DisplayNamesShowUsername"] = gSavedSettings.getBOOL("NameTagShowUsernames"); @@ -731,6 +618,8 @@ void send_stats() LLViewerStats::getInstance()->addToMessage(body); LLHTTPClient::post(url, body, new ViewerStatsResponder()); + + LLViewerStats::instance().getRecording().resume(); } LLFrameTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) @@ -748,7 +637,7 @@ LLFrameTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_na void LLViewerStats::PhaseMap::startPhase(const std::string& phase_name) { LLFrameTimer& timer = getPhaseTimer(phase_name); - lldebugs << "startPhase " << phase_name << llendl; + LL_DEBUGS() << "startPhase " << phase_name << LL_ENDL; timer.unpause(); } @@ -763,19 +652,19 @@ void LLViewerStats::PhaseMap::stopAllPhases() // Going from started to paused state - record stats. recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); } - lldebugs << "stopPhase (all) " << phase_name << llendl; + LL_DEBUGS() << "stopPhase (all) " << phase_name << LL_ENDL; iter->second.pause(); } } void LLViewerStats::PhaseMap::clearPhases() { - lldebugs << "clearPhases" << llendl; + LL_DEBUGS() << "clearPhases" << LL_ENDL; mPhaseMap.clear(); } -LLSD LLViewerStats::PhaseMap::dumpPhases() +LLSD LLViewerStats::PhaseMap::asLLSD() { LLSD result; for (phase_map_t::iterator iter = mPhaseMap.begin(); iter != mPhaseMap.end(); ++iter) diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 6b2461be41fb51fd9eca307590412fa09de80ad2..0d959ed034640b10d7f0c28d416cb2db62e38a10 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -1,5 +1,5 @@ /** - * @file llviewerstats.h + * @file llviewerim_peningtats.h * @brief LLViewerStats class header file * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ @@ -27,171 +27,236 @@ #ifndef LL_LLVIEWERSTATS_H #define LL_LLVIEWERSTATS_H -#include "llstat.h" #include "lltextureinfo.h" +#include "lltracerecording.h" +#include "lltrace.h" + + +enum ESimStatID +{ + LL_SIM_STAT_TIME_DILATION = 0, + LL_SIM_STAT_FPS = 1, + LL_SIM_STAT_PHYSFPS = 2, + LL_SIM_STAT_AGENTUPS = 3, + LL_SIM_STAT_FRAMEMS = 4, + LL_SIM_STAT_NETMS = 5, + LL_SIM_STAT_SIMOTHERMS = 6, + LL_SIM_STAT_SIMPHYSICSMS = 7, + LL_SIM_STAT_AGENTMS = 8, + LL_SIM_STAT_IMAGESMS = 9, + LL_SIM_STAT_SCRIPTMS = 10, + LL_SIM_STAT_NUMTASKS = 11, + LL_SIM_STAT_NUMTASKSACTIVE = 12, + LL_SIM_STAT_NUMAGENTMAIN = 13, + LL_SIM_STAT_NUMAGENTCHILD = 14, + LL_SIM_STAT_NUMSCRIPTSACTIVE = 15, + LL_SIM_STAT_LSLIPS = 16, + LL_SIM_STAT_INPPS = 17, + LL_SIM_STAT_OUTPPS = 18, + LL_SIM_STAT_PENDING_DOWNLOADS = 19, + LL_SIM_STAT_PENDING_UPLOADS = 20, + LL_SIM_STAT_VIRTUAL_SIZE_KB = 21, + LL_SIM_STAT_RESIDENT_SIZE_KB = 22, + LL_SIM_STAT_PENDING_LOCAL_UPLOADS = 23, + LL_SIM_STAT_TOTAL_UNACKED_BYTES = 24, + LL_SIM_STAT_PHYSICS_PINNED_TASKS = 25, + LL_SIM_STAT_PHYSICS_LOD_TASKS = 26, + LL_SIM_STAT_SIMPHYSICSSTEPMS = 27, + LL_SIM_STAT_SIMPHYSICSSHAPEMS = 28, + LL_SIM_STAT_SIMPHYSICSOTHERMS = 29, + LL_SIM_STAT_SIMPHYSICSMEMORY = 30, + LL_SIM_STAT_SCRIPT_EPS = 31, + LL_SIM_STAT_SIMSPARETIME = 32, + LL_SIM_STAT_SIMSLEEPTIME = 33, + LL_SIM_STAT_IOPUMPTIME = 34, + LL_SIM_STAT_PCTSCRIPTSRUN = 35, + LL_SIM_STAT_REGION_IDLE = 36, // dataserver only + LL_SIM_STAT_REGION_IDLE_POSSIBLE = 37, // dataserver only + LL_SIM_STAT_SIMAISTEPTIMEMS = 38, + LL_SIM_STAT_SKIPPEDAISILSTEPS_PS = 39, + LL_SIM_STAT_PCTSTEPPEDCHARACTERS = 40 +}; + +namespace LLStatViewer +{ + +struct SimMeasurementSampler : public LLInstanceTracker<SimMeasurementSampler, ESimStatID> +{ + SimMeasurementSampler(ESimStatID id) + : LLInstanceTracker<SimMeasurementSampler, ESimStatID>(id) + {} + virtual ~SimMeasurementSampler() {} + + virtual void sample(F64 value) = 0; +}; + +template<typename T = F64> +struct SimMeasurement : public LLTrace::SampleStatHandle<T>, public SimMeasurementSampler +{ + typedef SimMeasurement<T> self_t; + + SimMeasurement(const char* name, const char* description, ESimStatID stat_id) + : LLTrace::SampleStatHandle<T>(name, description), + SimMeasurementSampler(stat_id) + {} + + using SimMeasurementSampler::getInstance; + + //friend void sample(self_t& measurement, T value) + //{ + // LLTrace::sample(static_cast<LLTrace::SampleStatHandle<T>& >(measurement), value); + //} + + /*virtual*/ void sample(F64 value) + { + LLTrace::sample(static_cast<LLTrace::SampleStatHandle<T>& >(*this), value); + //LLStatViewer::sample(*this, value); + } + +}; + +extern LLTrace::CountStatHandle<> FPS, + PACKETS_IN, + PACKETS_LOST, + PACKETS_OUT, + TEXTURE_PACKETS, + CHAT_COUNT, + IM_COUNT, + OBJECT_CREATE, + OBJECT_REZ, + LOGIN_TIMEOUTS, + LSL_SAVES, + ANIMATION_UPLOADS, + FLY, + TELEPORT, + DELETE_OBJECT, + SNAPSHOT, + UPLOAD_SOUND, + UPLOAD_TEXTURE, + EDIT_TEXTURE, + KILLED, + FRAMETIME_DOUBLED, + TEX_BAKES, + TEX_REBAKES, + NUM_NEW_OBJECTS; + +extern LLTrace::CountStatHandle<LLUnit<F64, LLUnits::Kilotriangles> > TRIANGLES_DRAWN; + +extern LLTrace::CountStatHandle<F64Kilobytes > ACTIVE_MESSAGE_DATA_RECEIVED, + LAYERS_NETWORK_DATA_RECEIVED, + OBJECT_NETWORK_DATA_RECEIVED, + ASSET_UDP_DATA_RECEIVED, + TEXTURE_NETWORK_DATA_RECEIVED, + MESSAGE_SYSTEM_DATA_IN, + MESSAGE_SYSTEM_DATA_OUT; + +extern LLTrace::CountStatHandle<F64Seconds > SIM_20_FPS_TIME, + SIM_PHYSICS_20_FPS_TIME, + LOSS_5_PERCENT_TIME; + +extern SimMeasurement<> SIM_TIME_DILATION, + SIM_FPS, + SIM_PHYSICS_FPS, + SIM_AGENT_UPS, + SIM_SCRIPT_EPS, + SIM_SKIPPED_SILHOUETTE, + SIM_MAIN_AGENTS, + SIM_CHILD_AGENTS, + SIM_OBJECTS, + SIM_ACTIVE_OBJECTS, + SIM_ACTIVE_SCRIPTS, + SIM_IN_PACKETS_PER_SEC, + SIM_OUT_PACKETS_PER_SEC, + SIM_PENDING_DOWNLOADS, + SIM_PENDING_UPLOADS, + SIM_PENDING_LOCAL_UPLOADS, + SIM_PHYSICS_PINNED_TASKS, + SIM_PHYSICS_LOD_TASKS; + +extern SimMeasurement<LLUnit<F64, LLUnits::Percent> > SIM_PERCENTAGE_SCRIPTS_RUN, + SIM_SKIPPED_CHARACTERS_PERCENTAGE; + +extern LLTrace::SampleStatHandle<> FPS_SAMPLE, + NUM_IMAGES, + NUM_RAW_IMAGES, + NUM_OBJECTS, + NUM_ACTIVE_OBJECTS, + ENABLE_VBO, + LIGHTING_DETAIL, + VISIBLE_AVATARS, + SHADER_OBJECTS, + DRAW_DISTANCE, + PENDING_VFS_OPERATIONS, + WINDOW_WIDTH, + WINDOW_HEIGHT; + +extern LLTrace::SampleStatHandle<LLUnit<F32, LLUnits::Percent> > PACKETS_LOST_PERCENT; + +extern LLTrace::SampleStatHandle<F64Megabytes > GL_TEX_MEM, + GL_BOUND_MEM, + RAW_MEM, + FORMATTED_MEM; +extern LLTrace::SampleStatHandle<F64Kilobytes > DELTA_BANDWIDTH, + MAX_BANDWIDTH; +extern SimMeasurement<F64Milliseconds > SIM_FRAME_TIME, + SIM_NET_TIME, + SIM_OTHER_TIME, + SIM_PHYSICS_TIME, + SIM_PHYSICS_STEP_TIME, + SIM_PHYSICS_SHAPE_UPDATE_TIME, + SIM_PHYSICS_OTHER_TIME, + SIM_AI_TIME, + SIM_AGENTS_TIME, + SIM_IMAGES_TIME, + SIM_SCRIPTS_TIME, + SIM_SPARE_TIME, + SIM_SLEEP_TIME, + SIM_PUMP_IO_TIME; + +extern SimMeasurement<F64Kilobytes > SIM_UNACKED_BYTES; +extern SimMeasurement<F64Megabytes > SIM_PHYSICS_MEM; + + +extern LLTrace::SampleStatHandle<F64Milliseconds > FRAMETIME_JITTER, + FRAMETIME_SLEW, + SIM_PING; + +extern LLTrace::EventStatHandle<LLUnit<F64, LLUnits::Meters> > AGENT_POSITION_SNAP; + +extern LLTrace::EventStatHandle<> LOADING_WEARABLES_LONG_DELAY; + +extern LLTrace::EventStatHandle<F64Milliseconds > REGION_CROSSING_TIME, + FRAME_STACKTIME, + UPDATE_STACKTIME, + NETWORK_STACKTIME, + IMAGE_STACKTIME, + REBUILD_STACKTIME, + RENDER_STACKTIME; + +extern LLTrace::EventStatHandle<F64Seconds > AVATAR_EDIT_TIME, + TOOLBOX_TIME, + MOUSELOOK_TIME, + FPS_10_TIME, + FPS_8_TIME, + FPS_2_TIME; + +extern LLTrace::EventStatHandle<LLUnit<F32, LLUnits::Percent> > OBJECT_CACHE_HIT_RATE; + +} class LLViewerStats : public LLSingleton<LLViewerStats> { public: - LLStat mKBitStat, - mLayersKBitStat, - mObjectKBitStat, - mAssetKBitStat, - mTextureKBitStat, - mVFSPendingOperations, - mObjectsDrawnStat, - mObjectsCulledStat, - mObjectsTestedStat, - mObjectsComparedStat, - mObjectsOccludedStat, - mFPSStat, - mPacketsInStat, - mPacketsLostStat, - mPacketsOutStat, - mPacketsLostPercentStat, - mTexturePacketsStat, - mActualInKBitStat, // From the packet ring (when faking a bad connection) - mActualOutKBitStat, // From the packet ring (when faking a bad connection) - mTrianglesDrawnStat; - - // Simulator stats - LLStat mSimTimeDilation, - - mSimFPS, - mSimPhysicsFPS, - mSimAgentUPS, - mSimScriptEPS, - - mSimFrameMsec, - mSimNetMsec, - mSimSimOtherMsec, - mSimSimPhysicsMsec, - - mSimSimPhysicsStepMsec, - mSimSimPhysicsShapeUpdateMsec, - mSimSimPhysicsOtherMsec, - mSimSimAIStepMsec, - mSimSimSkippedSilhouetteSteps, - mSimSimPctSteppedCharacters, - - mSimAgentMsec, - mSimImagesMsec, - mSimScriptMsec, - mSimSpareMsec, - mSimSleepMsec, - mSimPumpIOMsec, - - mSimMainAgents, - mSimChildAgents, - mSimObjects, - mSimActiveObjects, - mSimActiveScripts, - mSimPctScriptsRun, - - mSimInPPS, - mSimOutPPS, - mSimPendingDownloads, - mSimPendingUploads, - mSimPendingLocalUploads, - mSimTotalUnackedBytes, - - mPhysicsPinnedTasks, - mPhysicsLODTasks, - mPhysicsMemoryAllocated, - - mSimPingStat, - - mNumImagesStat, - mNumRawImagesStat, - mGLTexMemStat, - mGLBoundMemStat, - mRawMemStat, - mFormattedMemStat, - - mNumObjectsStat, - mNumActiveObjectsStat, - mNumNewObjectsStat, - mNumSizeCulledStat, - mNumVisCulledStat; - void resetStats(); + public: - // If you change this, please also add a corresponding text label in llviewerstats.cpp - enum EStatType - { - ST_VERSION = 0, - ST_AVATAR_EDIT_SECONDS = 1, - ST_TOOLBOX_SECONDS = 2, - ST_CHAT_COUNT = 3, - ST_IM_COUNT = 4, - ST_FULLSCREEN_BOOL = 5, - ST_RELEASE_COUNT= 6, - ST_CREATE_COUNT = 7, - ST_REZ_COUNT = 8, - ST_FPS_10_SECONDS = 9, - ST_FPS_2_SECONDS = 10, - ST_MOUSELOOK_SECONDS = 11, - ST_FLY_COUNT = 12, - ST_TELEPORT_COUNT = 13, - ST_OBJECT_DELETE_COUNT = 14, - ST_SNAPSHOT_COUNT = 15, - ST_UPLOAD_SOUND_COUNT = 16, - ST_UPLOAD_TEXTURE_COUNT = 17, - ST_EDIT_TEXTURE_COUNT = 18, - ST_KILLED_COUNT = 19, - ST_FRAMETIME_JITTER = 20, - ST_FRAMETIME_SLEW = 21, - ST_INVENTORY_TOO_LONG = 22, - ST_WEARABLES_TOO_LONG = 23, - ST_LOGIN_SECONDS = 24, - ST_LOGIN_TIMEOUT_COUNT = 25, - ST_HAS_BAD_TIMER = 26, - ST_DOWNLOAD_FAILED = 27, - ST_LSL_SAVE_COUNT = 28, - ST_UPLOAD_ANIM_COUNT = 29, - ST_FPS_8_SECONDS = 30, - ST_SIM_FPS_20_SECONDS = 31, - ST_PHYS_FPS_20_SECONDS = 32, - ST_LOSS_05_SECONDS = 33, - ST_FPS_DROP_50_RATIO = 34, - ST_ENABLE_VBO = 35, - ST_DELTA_BANDWIDTH = 36, - ST_MAX_BANDWIDTH = 37, - ST_LIGHTING_DETAIL = 38, - ST_VISIBLE_AVATARS = 39, - ST_SHADER_OBJECTS = 40, - ST_SHADER_ENVIRONMENT = 41, - ST_DRAW_DIST = 42, - ST_CHAT_BUBBLES = 43, - ST_SHADER_AVATAR = 44, - ST_FRAME_SECS = 45, - ST_UPDATE_SECS = 46, - ST_NETWORK_SECS = 47, - ST_IMAGE_SECS = 48, - ST_REBUILD_SECS = 49, - ST_RENDER_SECS = 50, - ST_CROSSING_AVG = 51, - ST_CROSSING_MAX = 52, - ST_LIBXUL_WIDGET_USED = 53, // Unused - ST_WINDOW_WIDTH = 54, - ST_WINDOW_HEIGHT = 55, - ST_TEX_BAKES = 56, - ST_TEX_REBAKES = 57, - - ST_COUNT = 58 - }; LLViewerStats(); ~LLViewerStats(); - // all return latest value of given stat - F64 getStat(EStatType type) const; - F64 setStat(EStatType type, F64 value); // set the stat to value - F64 incStat(EStatType type, F64 value = 1.f); // add value to the stat - - void updateFrameStats(const F64 time_diff); + void updateFrameStats(const F64Seconds time_diff); - void addToMessage(LLSD &body) const; + void addToMessage(LLSD &body); struct StatsAccumulator { @@ -263,7 +328,7 @@ class LLViewerStats : public LLSingleton<LLViewerStats> mCountOfNextUpdatesToIgnore = 0; } - inline LLSD getData() const + inline LLSD asLLSD() const { LLSD data; data["mean"] = getMean(); @@ -275,8 +340,6 @@ class LLViewerStats : public LLSingleton<LLViewerStats> } }; - StatsAccumulator mAgentPositionSnaps; - // Phase tracking (originally put in for avatar rezzing), tracking // progress of active/completed phases for activities like outfit changing. typedef std::map<std::string,LLFrameTimer> phase_map_t; @@ -294,18 +357,20 @@ class LLViewerStats : public LLSingleton<LLViewerStats> void stopPhase(const std::string& phase_name); void stopAllPhases(); void clearPhases(); - LLSD dumpPhases(); + LLSD asLLSD(); static StatsAccumulator& getPhaseStats(const std::string& phase_name); static void recordPhaseStat(const std::string& phase_name, F32 value); phase_map_t::iterator begin() { return mPhaseMap.begin(); } phase_map_t::iterator end() { return mPhaseMap.end(); } }; + LLTrace::Recording& getRecording() { return mRecording; } + const LLTrace::Recording& getRecording() const { return mRecording; } private: - F64 mStats[ST_COUNT]; + LLTrace::Recording mRecording; - F64 mLastTimeDiff; // used for time stat updates + F64Seconds mLastTimeDiff; // used for time stat updates }; static const F32 SEND_STATS_PERIOD = 300.0f; @@ -315,7 +380,7 @@ void update_statistics(); void send_stats(); extern LLFrameTimer gTextureTimer; -extern U32 gTotalTextureBytes; -extern U32 gTotalObjectBytes; -extern U32 gTotalTextureBytesPerBoostLevel[] ; +extern U32Bytes gTotalTextureData; +extern U32Bytes gTotalObjectData; +extern U32Bytes gTotalTextureBytesPerBoostLevel[] ; #endif // LL_LLVIEWERSTATS_H diff --git a/indra/newview/llviewerstatsrecorder.cpp b/indra/newview/llviewerstatsrecorder.cpp index 2b3e2932292f3b298fc54b37424e8566e9457e08..b5ccf4ffa0620410bd627b2479fa01df4cc70f2e 100755 --- a/indra/newview/llviewerstatsrecorder.cpp +++ b/indra/newview/llviewerstatsrecorder.cpp @@ -49,7 +49,7 @@ LLViewerStatsRecorder::LLViewerStatsRecorder() : { if (NULL != sInstance) { - llerrs << "Attempted to create multiple instances of LLViewerStatsRecorder!" << llendl; + LL_ERRS() << "Attempted to create multiple instances of LLViewerStatsRecorder!" << LL_ENDL; } sInstance = this; clearStats(); @@ -132,7 +132,7 @@ void LLViewerStatsRecorder::recordObjectUpdateEvent(U32 local_id, const EObjectU mObjectCacheHitSize += msg_size; break; default: - llwarns << "Unknown update_type" << llendl; + LL_WARNS() << "Unknown update_type" << LL_ENDL; break; }; } @@ -154,7 +154,7 @@ void LLViewerStatsRecorder::recordCacheFullUpdate(U32 local_id, const EObjectUpd mObjectCacheUpdateReplacements++; break; default: - llwarns << "Unknown update_result type" << llendl; + LL_WARNS() << "Unknown update_result type" << LL_ENDL; break; }; } @@ -173,7 +173,7 @@ void LLViewerStatsRecorder::writeToLog( F32 interval ) if ( delta_time < interval || total_objects == 0) return; mLastSnapshotTime = LLTimer::getTotalSeconds(); - lldebugs << "ILX: " + LL_DEBUGS() << "ILX: " << mObjectCacheHitCount << " hits, " << mObjectCacheMissFullCount << " full misses, " << mObjectCacheMissCrcCount << " crc misses, " @@ -186,7 +186,7 @@ void LLViewerStatsRecorder::writeToLog( F32 interval ) << mObjectCacheUpdateAdds << " cache update adds, " << mObjectCacheUpdateReplacements << " cache update replacements, " << mObjectUpdateFailures << " update failures" - << llendl; + << LL_ENDL; if (mObjectCacheFile == NULL) { @@ -220,12 +220,12 @@ void LLViewerStatsRecorder::writeToLog( F32 interval ) data_size = data_msg.str().size(); if (fwrite(data_msg.str().c_str(), 1, data_size, mObjectCacheFile ) != data_size) { - llwarns << "failed to write full headers to " << STATS_FILE_NAME << llendl; + LL_WARNS() << "failed to write full headers to " << STATS_FILE_NAME << LL_ENDL; } } else { - llwarns << "Couldn't open " << STATS_FILE_NAME << " for logging." << llendl; + //LL_WARNS() << "Couldn't open " << STATS_FILE_NAME << " for logging." << LL_ENDL; return; } } @@ -257,7 +257,7 @@ void LLViewerStatsRecorder::writeToLog( F32 interval ) data_size = data_msg.str().size(); if ( data_size != fwrite(data_msg.str().c_str(), 1, data_size, mObjectCacheFile )) { - llwarns << "Unable to write complete column data to " << STATS_FILE_NAME << llendl; + LL_WARNS() << "Unable to write complete column data to " << STATS_FILE_NAME << LL_ENDL; } clearStats(); diff --git a/indra/newview/llviewertexlayer.cpp b/indra/newview/llviewertexlayer.cpp index 777e1f9c76a6d6e7240b6b18cd0d09b1466bb086..62e8da81ec021a6433dd17cacfa98ed42b18c993 100755 --- a/indra/newview/llviewertexlayer.cpp +++ b/indra/newview/llviewertexlayer.cpp @@ -118,7 +118,7 @@ void LLViewerTexLayerSetBuffer::destroyGLTexture() // static void LLViewerTexLayerSetBuffer::dumpTotalByteCount() { - llinfos << "Composite System GL Buffers: " << (LLViewerTexLayerSetBuffer::sGLByteCount/1024) << "KB" << llendl; + LL_INFOS() << "Composite System GL Buffers: " << (LLViewerTexLayerSetBuffer::sGLByteCount/1024) << "KB" << LL_ENDL; } void LLViewerTexLayerSetBuffer::requestUpdate() @@ -231,7 +231,7 @@ void LLViewerTexLayerSetBuffer::midRenderTexLayerSet(BOOL success) { if (!success) { - llinfos << "Failed attempt to bake " << mTexLayerSet->getBodyRegionName() << llendl; + LL_INFOS() << "Failed attempt to bake " << mTexLayerSet->getBodyRegionName() << LL_ENDL; mUploadPending = FALSE; } else @@ -363,8 +363,8 @@ BOOL LLViewerTexLayerSetBuffer::requestUpdateImmediate() void LLViewerTexLayerSetBuffer::doUpload() { LLViewerTexLayerSet* layer_set = getViewerTexLayerSet(); - LL_DEBUGS("Avatar") << "Uploading baked " << layer_set->getBodyRegionName() << llendl; - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES); + LL_DEBUGS("Avatar") << "Uploading baked " << layer_set->getBodyRegionName() << LL_ENDL; + add(LLStatViewer::TEX_BAKES, 1); // Don't need caches since we're baked now. (note: we won't *really* be baked // until this image is sent to the server and the Avatar Appearance message is received.) @@ -449,7 +449,7 @@ void LLViewerTexLayerSetBuffer::doUpload() LLSD body = LLSD::emptyMap(); // The responder will call LLViewerTexLayerSetBuffer::onTextureUploadComplete() LLHTTPClient::post(url, body, new LLSendTexLayerResponder(body, mUploadID, LLAssetType::AT_TEXTURE, baked_upload_data)); - llinfos << "Baked texture upload via capability of " << mUploadID << " to " << url << llendl; + LL_INFOS() << "Baked texture upload via capability of " << mUploadID << " to " << url << LL_ENDL; } else { @@ -460,7 +460,7 @@ void LLViewerTexLayerSetBuffer::doUpload() TRUE, // temp_file TRUE, // is_priority TRUE); // store_local - llinfos << "Baked texture upload via Asset Store." << llendl; + LL_INFOS() << "Baked texture upload via Asset Store." << LL_ENDL; } if (highest_lod) @@ -497,7 +497,7 @@ void LLViewerTexLayerSetBuffer::doUpload() mUploadPending = FALSE; LLVFile file(gVFS, asset_id, LLAssetType::AT_TEXTURE, LLVFile::WRITE); file.remove(); - llinfos << "Unable to create baked upload file (reason: corrupted)." << llendl; + LL_INFOS() << "Unable to create baked upload file (reason: corrupted)." << LL_ENDL; } } } @@ -505,7 +505,7 @@ void LLViewerTexLayerSetBuffer::doUpload() { // The VFS write file operation failed. mUploadPending = FALSE; - llinfos << "Unable to create baked upload file (reason: failed to write file)" << llendl; + LL_INFOS() << "Unable to create baked upload file (reason: failed to write file)" << LL_ENDL; } delete [] baked_color_data; @@ -587,14 +587,14 @@ void LLViewerTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, LLAvatarAppearanceDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->getViewerTexLayerSet()); // Update baked texture info with the new UUID U64 now = LLFrameTimer::getTotalTime(); // Record starting time - llinfos << "Baked" << resolution << "texture upload for " << name << " took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl; + LL_INFOS() << "Baked" << resolution << "texture upload for " << name << " took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << LL_ENDL; gAgentAvatarp->setNewBakedTexture(baked_te, uuid); } else { ++failures; S32 max_attempts = baked_upload_data->mIsHighestRes ? BAKE_UPLOAD_ATTEMPTS : 1; // only retry final bakes - llwarns << "Baked" << resolution << "texture upload for " << name << " failed (attempt " << failures << "/" << max_attempts << ")" << llendl; + LL_WARNS() << "Baked" << resolution << "texture upload for " << name << " failed (attempt " << failures << "/" << max_attempts << ")" << LL_ENDL; if (failures < max_attempts) { layerset_buffer->mUploadFailCount = failures; @@ -605,7 +605,7 @@ void LLViewerTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, } else { - llinfos << "Received baked texture out of date, ignored." << llendl; + LL_INFOS() << "Received baked texture out of date, ignored." << LL_ENDL; } gAgentAvatarp->dirtyMesh(); @@ -617,7 +617,7 @@ void LLViewerTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid, // and rebake it at some point in the future (after login?)), // or this response to upload is out of date, in which case a // current response should be on the way or already processed. - llwarns << "Baked upload failed" << llendl; + LL_WARNS() << "Baked upload failed" << LL_ENDL; } delete baked_upload_data; @@ -694,7 +694,7 @@ void LLViewerTexLayerSet::createComposite() // Composite other avatars at reduced resolution if( !mAvatarAppearance->isSelf() ) { - llerrs << "composites should not be created for non-self avatars!" << llendl; + LL_ERRS() << "composites should not be created for non-self avatars!" << LL_ENDL; } mComposite = new LLViewerTexLayerSetBuffer( this, width, height ); } diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index e51f7b2c714d41bf256a12ef57d7cec1d94e43d7..69f9bbdff85ded1ed9c45ec947df974cb2767178 100755 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -100,7 +100,7 @@ class LLEmbeddedLandmarkCopied: public LLInventoryCallback if (item_ptr.isNull()) { // check to prevent a crash. See EXT-8459. - llwarns << "Passed handle contains a dead inventory item. Most likely notecard has been closed and embedded item was destroyed." << llendl; + LL_WARNS() << "Passed handle contains a dead inventory item. Most likely notecard has been closed and embedded item was destroyed." << LL_ENDL; } else { @@ -143,7 +143,7 @@ class LLEmbeddedNotecardOpener : public LLInventoryCallback LLInventoryItem* item = gInventory.getItem(inv_item); if(!item) { - llwarns << "Item add reported, but not found in inventory!: " << inv_item << llendl; + LL_WARNS() << "Item add reported, but not found in inventory!: " << inv_item << LL_ENDL; } else { @@ -438,7 +438,7 @@ llwchar LLEmbeddedItems::getEmbeddedCharFromIndex(S32 index) { if (index >= (S32)mEmbeddedIndexedChars.size()) { - llwarns << "No item for embedded char " << index << " using LL_UNKNOWN_CHAR" << llendl; + LL_WARNS() << "No item for embedded char " << index << " using LL_UNKNOWN_CHAR" << LL_ENDL; return LL_UNKNOWN_CHAR; } return mEmbeddedIndexedChars[index]; @@ -494,7 +494,7 @@ S32 LLEmbeddedItems::getIndexFromEmbeddedChar(llwchar wch) } else { - llwarns << "Embedded char " << wch << " not found, using 0" << llendl; + LL_WARNS() << "Embedded char " << wch << " not found, using 0" << LL_ENDL; return 0; } } @@ -689,9 +689,9 @@ void LLViewerTextEditor::makePristine() LLTextEditor::makePristine(); } -void LLViewerTextEditor::handleVisibilityChange( BOOL new_visibility ) +void LLViewerTextEditor::onVisibilityChange( BOOL new_visibility ) { - LLUICtrl::handleVisibilityChange(new_visibility); + LLUICtrl::onVisibilityChange(new_visibility); } BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask) @@ -925,7 +925,7 @@ BOOL LLViewerTextEditor::handleDragAndDrop(S32 x, S32 y, MASK mask, } handled = TRUE; - lldebugst(LLERR_USER_INPUT) << "dragAndDrop handled by LLViewerTextEditor " << getName() << llendl; + LL_DEBUGS("UserInput") << "dragAndDrop handled by LLViewerTextEditor " << getName() << LL_ENDL; return handled; } diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h index 33b78a59641d53a65d730c2c8b8add5685fd11ee..477119d4f2468d4ba7b645daf4a555c09c64f86e 100755 --- a/indra/newview/llviewertexteditor.h +++ b/indra/newview/llviewertexteditor.h @@ -47,7 +47,7 @@ class LLViewerTextEditor : public LLTextEditor virtual void makePristine(); - /*virtual*/ void handleVisibilityChange( BOOL new_visibility ); + /*virtual*/ void onVisibilityChange( BOOL new_visibility ); // mousehandler overrides virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 3da6d33d7281990b74a99608523aac72dc9d8704..3be82a55314e6b66387f00715613e1de1bc7003a 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -29,7 +29,6 @@ #include "llviewertexture.h" // Library includes -#include "imageids.h" #include "llmath.h" #include "llerror.h" #include "llgl.h" @@ -63,6 +62,11 @@ #include "lltexturecache.h" /////////////////////////////////////////////////////////////////////////////// +// extern +const S32Megabytes gMinVideoRam(32); +const S32Megabytes gMaxVideoRam(512); + + // statics LLPointer<LLViewerTexture> LLViewerTexture::sNullImagep = NULL; LLPointer<LLViewerTexture> LLViewerTexture::sBlackImagep = NULL; @@ -72,8 +76,8 @@ LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sWhiteImagep = NULL; LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sDefaultImagep = NULL; LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sSmokeImagep = NULL; LLPointer<LLViewerFetchedTexture> LLViewerFetchedTexture::sFlatNormalImagep = NULL; -LLViewerMediaTexture::media_map_t LLViewerMediaTexture::sMediaMap ; -LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL ; +LLViewerMediaTexture::media_map_t LLViewerMediaTexture::sMediaMap; +LLTexturePipelineTester* LLViewerTextureManager::sTesterp = NULL; const std::string sTesterName("TextureTester"); S32 LLViewerTexture::sImageCount = 0; @@ -82,21 +86,21 @@ S32 LLViewerTexture::sAuxCount = 0; LLFrameTimer LLViewerTexture::sEvaluationTimer; F32 LLViewerTexture::sDesiredDiscardBias = 0.f; F32 LLViewerTexture::sDesiredDiscardScale = 1.1f; -S32 LLViewerTexture::sBoundTextureMemoryInBytes = 0; -S32 LLViewerTexture::sTotalTextureMemoryInBytes = 0; -S32 LLViewerTexture::sMaxBoundTextureMemInMegaBytes = 0; -S32 LLViewerTexture::sMaxTotalTextureMemInMegaBytes = 0; -S32 LLViewerTexture::sMaxDesiredTextureMemInBytes = 0 ; -S8 LLViewerTexture::sCameraMovingDiscardBias = 0 ; -F32 LLViewerTexture::sCameraMovingBias = 0.0f ; -S32 LLViewerTexture::sMaxSculptRez = 128 ; //max sculpt image size -const S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64 ; -const S32 MAX_CACHED_RAW_SCULPT_IMAGE_AREA = LLViewerTexture::sMaxSculptRez * LLViewerTexture::sMaxSculptRez ; -const S32 MAX_CACHED_RAW_TERRAIN_IMAGE_AREA = 128 * 128 ; -S32 LLViewerTexture::sMinLargeImageSize = 65536 ; //256 * 256. -S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA ; -BOOL LLViewerTexture::sFreezeImageScalingDown = FALSE ; -F32 LLViewerTexture::sCurrentTime = 0.0f ; +S32Bytes LLViewerTexture::sBoundTextureMemory; +S32Bytes LLViewerTexture::sTotalTextureMemory; +S32Megabytes LLViewerTexture::sMaxBoundTextureMem; +S32Megabytes LLViewerTexture::sMaxTotalTextureMem; +S32Bytes LLViewerTexture::sMaxDesiredTextureMem; +S8 LLViewerTexture::sCameraMovingDiscardBias = 0; +F32 LLViewerTexture::sCameraMovingBias = 0.0f; +S32 LLViewerTexture::sMaxSculptRez = 128; //max sculpt image size +const S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64; +const S32 MAX_CACHED_RAW_SCULPT_IMAGE_AREA = LLViewerTexture::sMaxSculptRez * LLViewerTexture::sMaxSculptRez; +const S32 MAX_CACHED_RAW_TERRAIN_IMAGE_AREA = 128 * 128; +S32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256. +S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA; +BOOL LLViewerTexture::sFreezeImageScalingDown = FALSE; +F32 LLViewerTexture::sCurrentTime = 0.0f; F32 LLViewerTexture::sTexelPixelRatio = 1.0f; LLViewerTexture::EDebugTexels LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF; @@ -138,7 +142,7 @@ void LLLoadedCallbackEntry::removeTexture(LLViewerFetchedTexture* tex) { if(mSourceCallbackList) { - mSourceCallbackList->erase(tex->getID()) ; + mSourceCallbackList->erase(tex->getID()); } } @@ -151,33 +155,33 @@ void LLLoadedCallbackEntry::cleanUpCallbackList(LLLoadedCallbackEntry::source_ca for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = callback_list->begin(); iter != callback_list->end(); ++iter) { - LLViewerFetchedTexture* tex = gTextureList.findImage(*iter) ; + LLViewerFetchedTexture* tex = gTextureList.findImage(*iter); if(tex) { - tex->deleteCallbackEntry(callback_list) ; + tex->deleteCallbackEntry(callback_list); } } - callback_list->clear() ; + callback_list->clear(); } } LLViewerMediaTexture* LLViewerTextureManager::createMediaTexture(const LLUUID &media_id, BOOL usemipmaps, LLImageGL* gl_image) { - return new LLViewerMediaTexture(media_id, usemipmaps, gl_image) ; + return new LLViewerMediaTexture(media_id, usemipmaps, gl_image); } LLViewerTexture* LLViewerTextureManager::findTexture(const LLUUID& id) { - LLViewerTexture* tex ; + LLViewerTexture* tex; //search fetched texture list - tex = gTextureList.findImage(id) ; + tex = gTextureList.findImage(id); //search media texture list if(!tex) { - tex = LLViewerTextureManager::findMediaTexture(id) ; + tex = LLViewerTextureManager::findMediaTexture(id); } - return tex ; + return tex; } LLViewerFetchedTexture* LLViewerTextureManager::findFetchedTexture(const LLUUID& id) @@ -187,78 +191,78 @@ LLViewerFetchedTexture* LLViewerTextureManager::findFetchedTexture(const LLUUID LLViewerMediaTexture* LLViewerTextureManager::findMediaTexture(const LLUUID &media_id) { - return LLViewerMediaTexture::findMediaTexture(media_id) ; + return LLViewerMediaTexture::findMediaTexture(media_id); } LLViewerMediaTexture* LLViewerTextureManager::getMediaTexture(const LLUUID& id, BOOL usemipmaps, LLImageGL* gl_image) { - LLViewerMediaTexture* tex = LLViewerMediaTexture::findMediaTexture(id) ; + LLViewerMediaTexture* tex = LLViewerMediaTexture::findMediaTexture(id); if(!tex) { - tex = LLViewerTextureManager::createMediaTexture(id, usemipmaps, gl_image) ; + tex = LLViewerTextureManager::createMediaTexture(id, usemipmaps, gl_image); } - tex->initVirtualSize() ; + tex->initVirtualSize(); - return tex ; + return tex; } LLViewerFetchedTexture* LLViewerTextureManager::staticCastToFetchedTexture(LLTexture* tex, BOOL report_error) { if(!tex) { - return NULL ; + return NULL; } - S8 type = tex->getType() ; + S8 type = tex->getType(); if(type == LLViewerTexture::FETCHED_TEXTURE || type == LLViewerTexture::LOD_TEXTURE) { - return static_cast<LLViewerFetchedTexture*>(tex) ; + return static_cast<LLViewerFetchedTexture*>(tex); } if(report_error) { - llerrs << "not a fetched texture type: " << type << llendl ; + LL_ERRS() << "not a fetched texture type: " << type << LL_ENDL; } - return NULL ; + return NULL; } LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(BOOL usemipmaps, BOOL generate_gl_tex) { - LLPointer<LLViewerTexture> tex = new LLViewerTexture(usemipmaps) ; + LLPointer<LLViewerTexture> tex = new LLViewerTexture(usemipmaps); if(generate_gl_tex) { - tex->generateGLTexture() ; - tex->setCategory(LLGLTexture::LOCAL) ; + tex->generateGLTexture(); + tex->setCategory(LLGLTexture::LOCAL); } - return tex ; + return tex; } LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLUUID& id, BOOL usemipmaps, BOOL generate_gl_tex) { - LLPointer<LLViewerTexture> tex = new LLViewerTexture(id, usemipmaps) ; + LLPointer<LLViewerTexture> tex = new LLViewerTexture(id, usemipmaps); if(generate_gl_tex) { - tex->generateGLTexture() ; - tex->setCategory(LLGLTexture::LOCAL) ; + tex->generateGLTexture(); + tex->setCategory(LLGLTexture::LOCAL); } - return tex ; + return tex; } LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const LLImageRaw* raw, BOOL usemipmaps) { - LLPointer<LLViewerTexture> tex = new LLViewerTexture(raw, usemipmaps) ; - tex->setCategory(LLGLTexture::LOCAL) ; - return tex ; + LLPointer<LLViewerTexture> tex = new LLViewerTexture(raw, usemipmaps); + tex->setCategory(LLGLTexture::LOCAL); + return tex; } LLPointer<LLViewerTexture> LLViewerTextureManager::getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex) { - LLPointer<LLViewerTexture> tex = new LLViewerTexture(width, height, components, usemipmaps) ; + LLPointer<LLViewerTexture> tex = new LLViewerTexture(width, height, components, usemipmaps); if(generate_gl_tex) { - tex->generateGLTexture() ; - tex->setCategory(LLGLTexture::LOCAL) ; + tex->generateGLTexture(); + tex->setCategory(LLGLTexture::LOCAL); } - return tex ; + return tex; } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture( @@ -271,11 +275,11 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTexture( LLGLenum primary_format, LLHost request_from_host) { - return gTextureList.getImage(image_id, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; + return gTextureList.getImage(image_id, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host); } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile( - const std::string& filename, + const std::string& filename, FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, @@ -284,11 +288,11 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromFile( LLGLenum primary_format, const LLUUID& force_id) { - return gTextureList.getImageFromFile(filename, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; + return gTextureList.getImageFromFile(filename, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id); } //static -LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string& url, +LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const std::string& url, FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, @@ -298,12 +302,12 @@ LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromUrl(const s const LLUUID& force_id ) { - return gTextureList.getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id) ; + return gTextureList.getImageFromUrl(url, f_type, usemipmaps, boost_priority, texture_type, internal_format, primary_format, force_id); } LLViewerFetchedTexture* LLViewerTextureManager::getFetchedTextureFromHost(const LLUUID& image_id, FTType f_type, LLHost host) { - return gTextureList.getImageFromHost(image_id, f_type, host) ; + return gTextureList.getImageFromHost(image_id, f_type, host); } // Create a bridge to the viewer texture manager. @@ -331,15 +335,15 @@ void LLViewerTextureManager::init() { LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,3); raw->clear(0x77, 0x77, 0x77, 0xFF); - LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), TRUE) ; + LLViewerTexture::sNullImagep = LLViewerTextureManager::getLocalTexture(raw.get(), TRUE); } const S32 dim = 128; LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3); U8* data = image_raw->getData(); - memset(data, 0, dim * dim * 3) ; - LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE) ; + memset(data, 0, dim * dim * 3); + LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE); #if 1 LLPointer<LLViewerFetchedTexture> imagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT); @@ -368,16 +372,16 @@ void LLViewerTextureManager::init() } imagep->createGLTexture(0, image_raw); //cache the raw image - imagep->setCachedRawImage(0, image_raw) ; + imagep->setCachedRawImage(0, image_raw); image_raw = NULL; #else LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI); #endif LLViewerFetchedTexture::sDefaultImagep->dontDiscard(); - LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ; + LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER); LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - LLViewerFetchedTexture::sSmokeImagep->setNoDelete() ; + LLViewerFetchedTexture::sSmokeImagep->setNoDelete(); image_raw = new LLImageRaw(32,32,3); data = image_raw->getData(); @@ -394,14 +398,14 @@ void LLViewerTextureManager::init() LLViewerTexture::sCheckerBoardImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE); - LLViewerTexture::initClass() ; - + LLViewerTexture::initClass(); + // Create a texture manager bridge. gTextureManagerBridgep = new LLViewerTextureManagerBridge; if (LLMetricPerformanceTesterBasic::isMetricLogRequested(sTesterName) && !LLMetricPerformanceTesterBasic::getTester(sTesterName)) { - sTesterp = new LLTexturePipelineTester() ; + sTesterp = new LLTexturePipelineTester(); if (!sTesterp->isValid()) { delete sTesterp; @@ -415,7 +419,7 @@ void LLViewerTextureManager::cleanup() stop_glerror(); delete gTextureManagerBridgep; - LLImageGL::sDefaultGLTexture = NULL ; + LLImageGL::sDefaultGLTexture = NULL; LLViewerTexture::sNullImagep = NULL; LLViewerTexture::sBlackImagep = NULL; LLViewerTexture::sCheckerBoardImagep = NULL; @@ -427,7 +431,7 @@ void LLViewerTextureManager::cleanup() LLViewerFetchedTexture::sFlatNormalImagep = NULL; - LLViewerMediaTexture::cleanUpClass() ; + LLViewerMediaTexture::cleanUpClass(); } //---------------------------------------------------------------------------------------------- @@ -437,7 +441,7 @@ void LLViewerTextureManager::cleanup() // static void LLViewerTexture::initClass() { - LLImageGL::sDefaultGLTexture = LLViewerFetchedTexture::sDefaultImagep->getGLTexture() ; + LLImageGL::sDefaultGLTexture = LLViewerFetchedTexture::sDefaultImagep->getGLTexture(); if(gSavedSettings.getBOOL("TextureFetchDebuggerEnabled")) { @@ -453,42 +457,42 @@ const S32 min_non_tex_system_mem = (128<<20); // 128 MB F32 texmem_lower_bound_scale = 0.85f; F32 texmem_middle_bound_scale = 0.925f; -static LLFastTimer::DeclareTimer FTM_TEXTURE_MEMORY_CHECK("Memory Check"); +static LLTrace::BlockTimerStatHandle FTM_TEXTURE_MEMORY_CHECK("Memory Check"); //static bool LLViewerTexture::isMemoryForTextureLow() { - const F32 WAIT_TIME = 1.0f ; //second - static LLFrameTimer timer ; + const F32 WAIT_TIME = 1.0f; //second + static LLFrameTimer timer; if(timer.getElapsedTimeF32() < WAIT_TIME) //call this once per second. { return false; } - timer.reset() ; + timer.reset(); - LLFastTimer t(FTM_TEXTURE_MEMORY_CHECK); + LL_RECORD_BLOCK_TIME(FTM_TEXTURE_MEMORY_CHECK); - const S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB - const S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB + const S32Megabytes MIN_FREE_TEXTURE_MEMORY(5); //MB + const S32Megabytes MIN_FREE_MAIN_MEMORY(100); //MB - bool low_mem = false ; + bool low_mem = false; if (gGLManager.mHasATIMemInfo) { S32 meminfo[4]; glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, meminfo); - if(meminfo[0] / 1024 < MIN_FREE_TEXTURE_MEMORY) + if((S32Megabytes)meminfo[0] < MIN_FREE_TEXTURE_MEMORY) { - low_mem = true ; + low_mem = true; } if(!low_mem) //check main memory, only works for windows. { - LLMemory::updateMemoryInfo() ; - if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy) + LLMemory::updateMemoryInfo(); + if(LLMemory::getAvailableMemKB() < MIN_FREE_TEXTURE_MEMORY) { - low_mem = true ; + low_mem = true; } } } @@ -500,45 +504,45 @@ bool LLViewerTexture::isMemoryForTextureLow() if(free_memory / 1024 < MIN_FREE_TEXTURE_MEMORY) { - low_mem = true ; + low_mem = true; } } #endif - return low_mem ; + return low_mem; } -static LLFastTimer::DeclareTimer FTM_TEXTURE_UPDATE_MEDIA("Media"); -static LLFastTimer::DeclareTimer FTM_TEXTURE_UPDATE_TEST("Test"); +static LLTrace::BlockTimerStatHandle FTM_TEXTURE_UPDATE_MEDIA("Media"); +static LLTrace::BlockTimerStatHandle FTM_TEXTURE_UPDATE_TEST("Test"); //static void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity) { - sCurrentTime = gFrameTimeSeconds ; + sCurrentTime = gFrameTimeSeconds; LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { - LLFastTimer t(FTM_TEXTURE_UPDATE_TEST); - tester->update() ; + LL_RECORD_BLOCK_TIME(FTM_TEXTURE_UPDATE_TEST); + tester->update(); } { - LLFastTimer t(FTM_TEXTURE_UPDATE_MEDIA); - LLViewerMediaTexture::updateClass() ; + LL_RECORD_BLOCK_TIME(FTM_TEXTURE_UPDATE_MEDIA); + LLViewerMediaTexture::updateClass(); } - sBoundTextureMemoryInBytes = LLImageGL::sBoundTextureMemoryInBytes;//in bytes - sTotalTextureMemoryInBytes = LLImageGL::sGlobalTextureMemoryInBytes;//in bytes - sMaxBoundTextureMemInMegaBytes = gTextureList.getMaxResidentTexMem();//in MB - sMaxTotalTextureMemInMegaBytes = gTextureList.getMaxTotalTextureMem() ;//in MB - sMaxDesiredTextureMemInBytes = MEGA_BYTES_TO_BYTES(sMaxTotalTextureMemInMegaBytes) ; //in Bytes, by default and when total used texture memory is small. + sBoundTextureMemory = LLImageGL::sBoundTextureMemory; + sTotalTextureMemory = LLImageGL::sGlobalTextureMemory; + sMaxBoundTextureMem = gTextureList.getMaxResidentTexMem(); + sMaxTotalTextureMem = gTextureList.getMaxTotalTextureMem(); + sMaxDesiredTextureMem = sMaxTotalTextureMem; //in Bytes, by default and when total used texture memory is small. - if (BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) >= sMaxBoundTextureMemInMegaBytes || - BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) >= sMaxTotalTextureMemInMegaBytes) + if (sBoundTextureMemory >= sMaxBoundTextureMem || + sTotalTextureMemory >= sMaxTotalTextureMem) { - //when texture memory overflows, lower down the threashold to release the textures more aggressively. - sMaxDesiredTextureMemInBytes = llmin((S32)(sMaxDesiredTextureMemInBytes * 0.75f) , MEGA_BYTES_TO_BYTES(MAX_VIDEO_RAM_IN_MEGA_BYTES)) ;//512 MB + //when texture memory overflows, lower down the threshold to release the textures more aggressively. + sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, F32Bytes(gMaxVideoRam)); // If we are using more texture memory than we should, // scale up the desired discard level @@ -554,8 +558,8 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity sEvaluationTimer.reset(); } else if (sDesiredDiscardBias > 0.0f && - BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) < sMaxBoundTextureMemInMegaBytes * texmem_lower_bound_scale && - BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) < sMaxTotalTextureMemInMegaBytes * texmem_lower_bound_scale) + sBoundTextureMemory < sMaxBoundTextureMem * texmem_lower_bound_scale && + sTotalTextureMemory < sMaxTotalTextureMem * texmem_lower_bound_scale) { // If we are using less texture memory than we should, // scale down the desired discard level @@ -566,14 +570,14 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity } } sDesiredDiscardBias = llclamp(sDesiredDiscardBias, desired_discard_bias_min, desired_discard_bias_max); - - F32 camera_moving_speed = LLViewerCamera::getInstance()->getAverageSpeed() ; + + F32 camera_moving_speed = LLViewerCamera::getInstance()->getAverageSpeed(); F32 camera_angular_speed = LLViewerCamera::getInstance()->getAverageAngularSpeed(); sCameraMovingBias = llmax(0.2f * camera_moving_speed, 2.0f * camera_angular_speed - 1); sCameraMovingDiscardBias = (S8)(sCameraMovingBias); - LLViewerTexture::sFreezeImageScalingDown = (BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) < 0.75f * sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale) && - (BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) < 0.75f * sMaxTotalTextureMemInMegaBytes * texmem_middle_bound_scale) ; + LLViewerTexture::sFreezeImageScalingDown = (sBoundTextureMemory < 0.75f * sMaxBoundTextureMem * texmem_middle_bound_scale) && + (sTotalTextureMemory < 0.75f * sMaxTotalTextureMem * texmem_middle_bound_scale); } //end of static functions @@ -618,7 +622,7 @@ LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) : LLViewerTexture::~LLViewerTexture() { - // LL_DEBUGS("Avatar") << mID << llendl; + // LL_DEBUGS("Avatar") << mID << LL_ENDL; cleanup(); sImageCount--; } @@ -629,31 +633,31 @@ void LLViewerTexture::init(bool firstinit) mSelectedTime = 0.f; mMaxVirtualSize = 0.f; mMaxVirtualSizeResetInterval = 1; - mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval ; - mAdditionalDecodePriority = 0.f ; - mParcelMedia = NULL ; + mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval; + mAdditionalDecodePriority = 0.f; + mParcelMedia = NULL; mNumVolumes = 0; - mFaceList[LLRender::DIFFUSE_MAP].clear() ; - mFaceList[LLRender::NORMAL_MAP].clear() ; - mFaceList[LLRender::SPECULAR_MAP].clear() ; + mFaceList[LLRender::DIFFUSE_MAP].clear(); + mFaceList[LLRender::NORMAL_MAP].clear(); + mFaceList[LLRender::SPECULAR_MAP].clear(); mNumFaces[LLRender::DIFFUSE_MAP] = mNumFaces[LLRender::NORMAL_MAP] = - mNumFaces[LLRender::SPECULAR_MAP] = 0 ; + mNumFaces[LLRender::SPECULAR_MAP] = 0; mVolumeList.clear(); } //virtual S8 LLViewerTexture::getType() const { - return LLViewerTexture::LOCAL_TEXTURE ; + return LLViewerTexture::LOCAL_TEXTURE; } void LLViewerTexture::cleanup() { - mFaceList[LLRender::DIFFUSE_MAP].clear() ; - mFaceList[LLRender::NORMAL_MAP].clear() ; - mFaceList[LLRender::SPECULAR_MAP].clear() ; + mFaceList[LLRender::DIFFUSE_MAP].clear(); + mFaceList[LLRender::NORMAL_MAP].clear(); + mFaceList[LLRender::SPECULAR_MAP].clear(); mVolumeList.clear(); } @@ -662,20 +666,20 @@ void LLViewerTexture::dump() { LLGLTexture::dump(); - llinfos << "LLViewerTexture" + LL_INFOS() << "LLViewerTexture" << " mID " << mID - << llendl; + << LL_ENDL; } void LLViewerTexture::setBoostLevel(S32 level) { if(mBoostLevel != level) { - mBoostLevel = level ; + mBoostLevel = level; if(mBoostLevel != LLViewerTexture::BOOST_NONE && mBoostLevel != LLViewerTexture::BOOST_SELECTED) { - setNoDelete() ; + setNoDelete(); } } @@ -683,6 +687,30 @@ void LLViewerTexture::setBoostLevel(S32 level) { mSelectedTime = gFrameTimeSeconds; } + +} + +bool LLViewerTexture::isActiveFetching() +{ + return false; +} + +bool LLViewerTexture::bindDebugImage(const S32 stage) +{ + if (stage < 0) return false; + + bool res = true; + if (LLViewerTexture::sCheckerBoardImagep.notNull() && (this != LLViewerTexture::sCheckerBoardImagep.get())) + { + res = gGL.getTexUnit(stage)->bind(LLViewerTexture::sCheckerBoardImagep); + } + + if(!res) + { + return bindDefaultImage(stage); + } + + return res; } bool LLViewerTexture::bindDefaultImage(S32 stage) @@ -701,17 +729,17 @@ bool LLViewerTexture::bindDefaultImage(S32 stage) } if (!res) { - llwarns << "LLViewerTexture::bindDefaultImage failed." << llendl; + LL_WARNS() << "LLViewerTexture::bindDefaultImage failed." << LL_ENDL; } stop_glerror(); //check if there is cached raw image and switch to it if possible - switchToCachedImage() ; + switchToCachedImage(); LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { - tester->updateGrayTextureBinding() ; + tester->updateGrayTextureBinding(); } return res; } @@ -731,17 +759,17 @@ void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) co { if(needs_gltexture) { - mNeedsGLTexture = TRUE ; + mNeedsGLTexture = TRUE; } virtual_size *= sTexelPixelRatio; if(!mMaxVirtualSizeResetCounter) { //flag to reset the values because the old values are used. - resetMaxVirtualSizeResetCounter() ; + resetMaxVirtualSizeResetCounter(); mMaxVirtualSize = virtual_size; - mAdditionalDecodePriority = 0.f ; - mNeedsGLTexture = needs_gltexture ; + mAdditionalDecodePriority = 0.f; + mNeedsGLTexture = needs_gltexture; } else if (virtual_size > mMaxVirtualSize) { @@ -751,15 +779,15 @@ void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) co void LLViewerTexture::resetTextureStats() { - mMaxVirtualSize = 0.0f ; - mAdditionalDecodePriority = 0.f ; - mMaxVirtualSizeResetCounter = 0 ; + mMaxVirtualSize = 0.0f; + mAdditionalDecodePriority = 0.f; + mMaxVirtualSizeResetCounter = 0; } //virtual F32 LLViewerTexture::getMaxVirtualSize() { - return mMaxVirtualSize ; + return mMaxVirtualSize; } //virtual @@ -775,12 +803,12 @@ void LLViewerTexture::addFace(U32 ch, LLFace* facep) if(mNumFaces[ch] >= mFaceList[ch].size()) { - mFaceList[ch].resize(2 * mNumFaces[ch] + 1) ; + mFaceList[ch].resize(2 * mNumFaces[ch] + 1); } - mFaceList[ch][mNumFaces[ch]] = facep ; - facep->setIndexInTex(ch, mNumFaces[ch]) ; - mNumFaces[ch]++ ; - mLastFaceListUpdateTimer.reset() ; + mFaceList[ch][mNumFaces[ch]] = facep; + facep->setIndexInTex(ch, mNumFaces[ch]); + mNumFaces[ch]++; + mLastFaceListUpdateTimer.reset(); } //virtual @@ -790,18 +818,18 @@ void LLViewerTexture::removeFace(U32 ch, LLFace* facep) if(mNumFaces[ch] > 1) { - S32 index = facep->getIndexInTex(ch) ; + S32 index = facep->getIndexInTex(ch); llassert(index < mFaceList[ch].size()); llassert(index < mNumFaces[ch]); - mFaceList[ch][index] = mFaceList[ch][--mNumFaces[ch]] ; - mFaceList[ch][index]->setIndexInTex(ch, index) ; + mFaceList[ch][index] = mFaceList[ch][--mNumFaces[ch]]; + mFaceList[ch][index]->setIndexInTex(ch, index); } else { - mFaceList[ch].clear() ; - mNumFaces[ch] = 0 ; + mFaceList[ch].clear(); + mNumFaces[ch] = 0; } - mLastFaceListUpdateTimer.reset() ; + mLastFaceListUpdateTimer.reset(); } S32 LLViewerTexture::getTotalNumFaces() const @@ -828,12 +856,12 @@ void LLViewerTexture::addVolume(LLVOVolume* volumep) { if( mNumVolumes >= mVolumeList.size()) { - mVolumeList.resize(2 * mNumVolumes + 1) ; + mVolumeList.resize(2 * mNumVolumes + 1); } - mVolumeList[mNumVolumes] = volumep ; - volumep->setIndexInTex(mNumVolumes) ; - mNumVolumes++ ; - mLastVolumeListUpdateTimer.reset() ; + mVolumeList[mNumVolumes] = volumep; + volumep->setIndexInTex(mNumVolumes); + mNumVolumes++; + mLastVolumeListUpdateTimer.reset(); } //virtual @@ -841,29 +869,29 @@ void LLViewerTexture::removeVolume(LLVOVolume* volumep) { if(mNumVolumes > 1) { - S32 index = volumep->getIndexInTex() ; + S32 index = volumep->getIndexInTex(); llassert(index < mVolumeList.size()); llassert(index < mNumVolumes); - mVolumeList[index] = mVolumeList[--mNumVolumes] ; - mVolumeList[index]->setIndexInTex(index) ; + mVolumeList[index] = mVolumeList[--mNumVolumes]; + mVolumeList[index]->setIndexInTex(index); } else { - mVolumeList.clear() ; - mNumVolumes = 0 ; + mVolumeList.clear(); + mNumVolumes = 0; } - mLastVolumeListUpdateTimer.reset() ; + mLastVolumeListUpdateTimer.reset(); } S32 LLViewerTexture::getNumVolumes() const { - return mNumVolumes ; + return mNumVolumes; } void LLViewerTexture::reorganizeFaceList() { static const F32 MAX_WAIT_TIME = 20.f; // seconds - static const U32 MAX_EXTRA_BUFFER_SIZE = 4 ; + static const U32 MAX_EXTRA_BUFFER_SIZE = 4; if(mLastFaceListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME) { @@ -873,32 +901,32 @@ void LLViewerTexture::reorganizeFaceList() for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i) { if(mNumFaces[i] + MAX_EXTRA_BUFFER_SIZE > mFaceList[i].size()) - { - return ; - } - + { + return; + } + mFaceList[i].erase(mFaceList[i].begin() + mNumFaces[i], mFaceList[i].end()); } - mLastFaceListUpdateTimer.reset() ; + mLastFaceListUpdateTimer.reset(); } void LLViewerTexture::reorganizeVolumeList() { static const F32 MAX_WAIT_TIME = 20.f; // seconds - static const U32 MAX_EXTRA_BUFFER_SIZE = 4 ; + static const U32 MAX_EXTRA_BUFFER_SIZE = 4; if(mNumVolumes + MAX_EXTRA_BUFFER_SIZE > mVolumeList.size()) { - return ; + return; } if(mLastVolumeListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME) { - return ; + return; } - mLastVolumeListUpdateTimer.reset() ; + mLastVolumeListUpdateTimer.reset(); mVolumeList.erase(mVolumeList.begin() + mNumVolumes, mVolumeList.end()); } @@ -916,7 +944,7 @@ void LLViewerTexture::setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) BOOL LLViewerTexture::isLargeImage() { - return (S32)mTexelsPerImage > LLViewerTexture::sMinLargeImageSize ; + return (S32)mTexelsPerImage > LLViewerTexture::sMinLargeImageSize; } //virtual @@ -925,7 +953,7 @@ void LLViewerTexture::updateBindStatsForTester() LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { - tester->updateTextureBindingStats(this) ; + tester->updateTextureBindingStats(this); } } @@ -941,19 +969,19 @@ LLViewerFetchedTexture::LLViewerFetchedTexture(const LLUUID& id, FTType f_type, : LLViewerTexture(id, usemipmaps), mTargetHost(host) { - init(TRUE) ; + init(TRUE); mFTType = f_type; if (mFTType == FTT_HOST_BAKE) { mCanUseHTTP = false; } - generateGLTexture() ; + generateGLTexture(); } LLViewerFetchedTexture::LLViewerFetchedTexture(const LLImageRaw* raw, FTType f_type, BOOL usemipmaps) : LLViewerTexture(raw, usemipmaps) { - init(TRUE) ; + init(TRUE); mFTType = f_type; } @@ -961,9 +989,9 @@ LLViewerFetchedTexture::LLViewerFetchedTexture(const std::string& url, FTType f_ : LLViewerTexture(id, usemipmaps), mUrl(url) { - init(TRUE) ; + init(TRUE); mFTType = f_type; - generateGLTexture() ; + generateGLTexture(); } void LLViewerFetchedTexture::init(bool firstinit) @@ -974,7 +1002,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mRequestedDiscardLevel = -1; mRequestedDownloadPriority = 0.f; mFullyLoaded = FALSE; - mCanUseHTTP = true ; + mCanUseHTTP = true; mDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1; mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1; @@ -982,7 +1010,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mKnownDrawWidth = 0; mKnownDrawHeight = 0; - mKnownDrawSizeChanged = FALSE ; + mKnownDrawSizeChanged = FALSE; if (firstinit) { @@ -995,7 +1023,7 @@ void LLViewerFetchedTexture::init(bool firstinit) mIsMissingAsset = FALSE; mLoadedCallbackDesiredDiscardLevel = S8_MAX; - mPauseLoadedCallBacks = FALSE ; + mPauseLoadedCallBacks = FALSE; mNeedsCreateTexture = FALSE; @@ -1010,21 +1038,21 @@ void LLViewerFetchedTexture::init(bool firstinit) mDownloadProgress = 0.f; mFetchDeltaTime = 999999.f; mRequestDeltaTime = 0.f; - mForSculpt = FALSE ; - mIsFetched = FALSE ; + mForSculpt = FALSE; + mIsFetched = FALSE; mInFastCacheList = FALSE; - mCachedRawImage = NULL ; - mCachedRawDiscardLevel = -1 ; - mCachedRawImageReady = FALSE ; - - mSavedRawImage = NULL ; - mForceToSaveRawImage = FALSE ; - mSaveRawImage = FALSE ; - mSavedRawDiscardLevel = -1 ; - mDesiredSavedRawDiscardLevel = -1 ; - mLastReferencedSavedRawImageTime = 0.0f ; - mKeptSavedRawImageTime = 0.f ; + mCachedRawImage = NULL; + mCachedRawDiscardLevel = -1; + mCachedRawImageReady = FALSE; + + mSavedRawImage = NULL; + mForceToSaveRawImage = FALSE; + mSaveRawImage = FALSE; + mSavedRawDiscardLevel = -1; + mDesiredSavedRawDiscardLevel = -1; + mLastReferencedSavedRawImageTime = 0.0f; + mKeptSavedRawImageTime = 0.f; mLastCallBackActiveTime = 0.f; mInDebug = FALSE; @@ -1047,7 +1075,7 @@ LLViewerFetchedTexture::~LLViewerFetchedTexture() //virtual S8 LLViewerFetchedTexture::getType() const { - return LLViewerTexture::FETCHED_TEXTURE ; + return LLViewerTexture::FETCHED_TEXTURE; } FTType LLViewerFetchedTexture::getFTType() const @@ -1064,7 +1092,7 @@ void LLViewerFetchedTexture::cleanup() // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. entryp->mCallback( FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData ); - entryp->removeTexture(this) ; + entryp->removeTexture(this); delete entryp; } mLoadedCallbackList.clear(); @@ -1072,10 +1100,10 @@ void LLViewerFetchedTexture::cleanup() // Clean up image data destroyRawImage(); - mCachedRawImage = NULL ; - mCachedRawDiscardLevel = -1 ; - mCachedRawImageReady = FALSE ; - mSavedRawImage = NULL ; + mCachedRawImage = NULL; + mCachedRawDiscardLevel = -1; + mCachedRawImageReady = FALSE; + mSavedRawImage = NULL; mSavedRawDiscardLevel = -1; } @@ -1088,7 +1116,7 @@ void LLViewerFetchedTexture::loadFromFastCache() } mInFastCacheList = FALSE; - mRawImage = LLAppViewer::getTextureCache()->readFromFastCache(getID(), mRawDiscardLevel) ; + mRawImage = LLAppViewer::getTextureCache()->readFromFastCache(getID(), mRawDiscardLevel); if(mRawImage.notNull()) { mFullWidth = mRawImage->getWidth() << mRawDiscardLevel; @@ -1099,58 +1127,58 @@ void LLViewerFetchedTexture::loadFromFastCache() { //discard all oversized textures. destroyRawImage(); - llwarns << "oversized, setting as missing" << llendl; + LL_WARNS() << "oversized, setting as missing" << LL_ENDL; setIsMissingAsset(); - mRawDiscardLevel = INVALID_DISCARD_LEVEL ; + mRawDiscardLevel = INVALID_DISCARD_LEVEL; } else { mRequestedDiscardLevel = mDesiredDiscardLevel + 1; mIsRawImageValid = TRUE; - addToCreateTexture() ; + addToCreateTexture(); } } } void LLViewerFetchedTexture::setForSculpt() { - static const S32 MAX_INTERVAL = 8 ; //frames + static const S32 MAX_INTERVAL = 8; //frames - mForSculpt = TRUE ; + mForSculpt = TRUE; if(isForSculptOnly() && hasGLTexture() && !getBoundRecently()) { - destroyGLTexture() ; //sculpt image does not need gl texture. + destroyGLTexture(); //sculpt image does not need gl texture. mTextureState = ACTIVE; } - checkCachedRawSculptImage() ; - setMaxVirtualSizeResetInterval(MAX_INTERVAL) ; + checkCachedRawSculptImage(); + setMaxVirtualSizeResetInterval(MAX_INTERVAL); } BOOL LLViewerFetchedTexture::isForSculptOnly() const { - return mForSculpt && !mNeedsGLTexture ; + return mForSculpt && !mNeedsGLTexture; } BOOL LLViewerFetchedTexture::isDeleted() { - return mTextureState == DELETED ; + return mTextureState == DELETED; } BOOL LLViewerFetchedTexture::isInactive() { - return mTextureState == INACTIVE ; + return mTextureState == INACTIVE; } BOOL LLViewerFetchedTexture::isDeletionCandidate() { - return mTextureState == DELETION_CANDIDATE ; + return mTextureState == DELETION_CANDIDATE; } void LLViewerFetchedTexture::setDeletionCandidate() { if(mGLTexturep.notNull() && mGLTexturep->getTexName() && (mTextureState == INACTIVE)) { - mTextureState = DELETION_CANDIDATE ; + mTextureState = DELETION_CANDIDATE; } } @@ -1159,7 +1187,7 @@ void LLViewerFetchedTexture::setInactive() { if(mTextureState == ACTIVE && mGLTexturep.notNull() && mGLTexturep->getTexName() && !mGLTexturep->getBoundRecently()) { - mTextureState = INACTIVE ; + mTextureState = INACTIVE; } } @@ -1176,84 +1204,84 @@ void LLViewerFetchedTexture::dump() { LLViewerTexture::dump(); - llinfos << "Dump : " << mID + LL_INFOS() << "Dump : " << mID << ", mIsMissingAsset = " << (S32)mIsMissingAsset << ", mFullWidth = " << (S32)mFullWidth << ", mFullHeight = " << (S32)mFullHeight << ", mOrigWidth = " << (S32)mOrigWidth << ", mOrigHeight = " << (S32)mOrigHeight - << llendl; - llinfos << " : " + << LL_ENDL; + LL_INFOS() << " : " << " mFullyLoaded = " << (S32)mFullyLoaded << ", mFetchState = " << (S32)mFetchState << ", mFetchPriority = " << (S32)mFetchPriority << ", mDownloadProgress = " << (F32)mDownloadProgress - << llendl; - llinfos << " : " + << LL_ENDL; + LL_INFOS() << " : " << " mHasFetcher = " << (S32)mHasFetcher << ", mIsFetching = " << (S32)mIsFetching << ", mIsFetched = " << (S32)mIsFetched << ", mBoostLevel = " << (S32)mBoostLevel - << llendl; + << LL_ENDL; } /////////////////////////////////////////////////////////////////////////////// // ONLY called from LLViewerFetchedTextureList void LLViewerFetchedTexture::destroyTexture() { - if(LLImageGL::sGlobalTextureMemoryInBytes < sMaxDesiredTextureMemInBytes * 0.95f)//not ready to release unused memory. + if(LLImageGL::sGlobalTextureMemory < sMaxDesiredTextureMem * 0.95f)//not ready to release unused memory. { return ; } if (mNeedsCreateTexture)//return if in the process of generating a new texture. { - return ; + return; } - - //LL_DEBUGS("Avatar") << mID << llendl; - destroyGLTexture() ; - mFullyLoaded = FALSE ; + + //LL_DEBUGS("Avatar") << mID << LL_ENDL; + destroyGLTexture(); + mFullyLoaded = FALSE; } void LLViewerFetchedTexture::addToCreateTexture() { - bool force_update = false ; + bool force_update = false; if (getComponents() != mRawImage->getComponents()) { // We've changed the number of components, so we need to move any // objects using this pool to a different pool. mComponents = mRawImage->getComponents(); - mGLTexturep->setComponents(mComponents) ; - force_update = true ; + mGLTexturep->setComponents(mComponents); + force_update = true; for (U32 j = 0; j < LLRender::NUM_TEXTURE_CHANNELS; ++j) { llassert(mNumFaces[j] <= mFaceList[j].size()); - for(U32 i = 0 ; i < mNumFaces[j]; i++) - { - mFaceList[j][i]->dirtyTexture() ; + for(U32 i = 0; i < mNumFaces[j]; i++) + { + mFaceList[j][i]->dirtyTexture(); } } //discard the cached raw image and the saved raw image - mCachedRawImageReady = FALSE ; - mCachedRawDiscardLevel = -1 ; - mCachedRawImage = NULL ; - mSavedRawDiscardLevel = -1 ; - mSavedRawImage = NULL ; + mCachedRawImageReady = FALSE; + mCachedRawDiscardLevel = -1; + mCachedRawImage = NULL; + mSavedRawDiscardLevel = -1; + mSavedRawImage = NULL; } if(isForSculptOnly()) { //just update some variables, not to create a real GL texture. - createGLTexture(mRawDiscardLevel, mRawImage, 0, FALSE) ; - mNeedsCreateTexture = FALSE ; + createGLTexture(mRawDiscardLevel, mRawImage, 0, FALSE); + mNeedsCreateTexture = FALSE; destroyRawImage(); } else if(!force_update && getDiscardLevel() > -1 && getDiscardLevel() <= mRawDiscardLevel) { - mNeedsCreateTexture = FALSE ; + mNeedsCreateTexture = FALSE; destroyRawImage(); } else @@ -1273,11 +1301,11 @@ void LLViewerFetchedTexture::addToCreateTexture() //scale it down to size >= LLViewerTexture::sMinLargeImageSize if(w * h > LLViewerTexture::sMinLargeImageSize) { - S32 d_level = llmin(mRequestedDiscardLevel, (S32)mDesiredDiscardLevel) - mRawDiscardLevel ; + S32 d_level = llmin(mRequestedDiscardLevel, (S32)mDesiredDiscardLevel) - mRawDiscardLevel; if(d_level > 0) { - S32 i = 0 ; + S32 i = 0; while((d_level > 0) && ((w >> i) * (h >> i) > LLViewerTexture::sMinLargeImageSize)) { i++; @@ -1285,12 +1313,12 @@ void LLViewerFetchedTexture::addToCreateTexture() } if(i > 0) { - mRawDiscardLevel += i ; + mRawDiscardLevel += i; if(mRawDiscardLevel >= getDiscardLevel() && getDiscardLevel() > 0) { - mNeedsCreateTexture = FALSE ; + mNeedsCreateTexture = FALSE; destroyRawImage(); - return ; + return; } { @@ -1306,7 +1334,7 @@ void LLViewerFetchedTexture::addToCreateTexture() mNeedsCreateTexture = TRUE; gTextureList.mCreateTextureList.insert(this); } - return ; + return; } // ONLY called from LLViewerTextureList @@ -1320,12 +1348,12 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) mNeedsCreateTexture = FALSE; if (mRawImage.isNull()) { - llerrs << "LLViewerTexture trying to create texture with no Raw Image" << llendl; + LL_ERRS() << "LLViewerTexture trying to create texture with no Raw Image" << LL_ENDL; } -// llinfos << llformat("IMAGE Creating (%d) [%d x %d] Bytes: %d ", +// LL_INFOS() << llformat("IMAGE Creating (%d) [%d x %d] Bytes: %d ", // mRawDiscardLevel, // mRawImage->getWidth(), mRawImage->getHeight(),mRawImage->getDataSize()) -// << mID.getString() << llendl; +// << mID.getString() << LL_ENDL; BOOL res = TRUE; // store original size only for locally-sourced images @@ -1360,14 +1388,14 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) U32 raw_height = mRawImage->getHeight() << mRawDiscardLevel; if( raw_width > MAX_IMAGE_SIZE || raw_height > MAX_IMAGE_SIZE ) { - llinfos << "Width or height is greater than " << MAX_IMAGE_SIZE << ": (" << raw_width << "," << raw_height << ")" << llendl; + LL_INFOS() << "Width or height is greater than " << MAX_IMAGE_SIZE << ": (" << raw_width << "," << raw_height << ")" << LL_ENDL; size_okay = false; } if (!LLImageGL::checkSize(mRawImage->getWidth(), mRawImage->getHeight())) { // A non power-of-two image was uploaded (through a non standard client) - llinfos << "Non power of two width or height: (" << mRawImage->getWidth() << "," << mRawImage->getHeight() << ")" << llendl; + LL_INFOS() << "Non power of two width or height: (" << mRawImage->getWidth() << "," << mRawImage->getHeight() << ")" << LL_ENDL; size_okay = false; } @@ -1376,15 +1404,15 @@ BOOL LLViewerFetchedTexture::createTexture(S32 usename/*= 0*/) // An inappropriately-sized image was uploaded (through a non standard client) // We treat these images as missing assets which causes them to // be renderd as 'missing image' and to stop requesting data - llwarns << "!size_ok, setting as missing" << llendl; + LL_WARNS() << "!size_ok, setting as missing" << LL_ENDL; setIsMissingAsset(); destroyRawImage(); return FALSE; } - res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel); + res = mGLTexturep->createGLTexture(mRawDiscardLevel, mRawImage, usename, TRUE, mBoostLevel); - setActive() ; + setActive(); if (!needsToSaveRawImage()) { @@ -1400,11 +1428,11 @@ void LLViewerFetchedTexture::setKnownDrawSize(S32 width, S32 height) { if(mKnownDrawWidth < width || mKnownDrawHeight < height) { - mKnownDrawWidth = llmax(mKnownDrawWidth, width) ; - mKnownDrawHeight = llmax(mKnownDrawHeight, height) ; + mKnownDrawWidth = llmax(mKnownDrawWidth, width); + mKnownDrawHeight = llmax(mKnownDrawHeight, height); - mKnownDrawSizeChanged = TRUE ; - mFullyLoaded = FALSE ; + mKnownDrawSizeChanged = TRUE; + mFullyLoaded = FALSE; } addTextureStats((F32)(mKnownDrawWidth * mKnownDrawHeight)); } @@ -1416,13 +1444,13 @@ void LLViewerFetchedTexture::processTextureStats() { if(mDesiredDiscardLevel > mMinDesiredDiscardLevel)//need to load more { - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ; - mFullyLoaded = FALSE ; + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel); + mFullyLoaded = FALSE; } } else { - updateVirtualSize() ; + updateVirtualSize(); static LLCachedControl<bool> textures_fullres(gSavedSettings,"TextureLoadFullRes", false); @@ -1432,7 +1460,7 @@ void LLViewerFetchedTexture::processTextureStats() } else if(!mFullWidth || !mFullHeight) { - mDesiredDiscardLevel = llmin(getMaxDiscardLevel(), (S32)mLoadedCallbackDesiredDiscardLevel) ; + mDesiredDiscardLevel = llmin(getMaxDiscardLevel(), (S32)mLoadedCallbackDesiredDiscardLevel); } else { @@ -1450,36 +1478,36 @@ void LLViewerFetchedTexture::processTextureStats() else if(mKnownDrawSizeChanged)//known draw size is set { mDesiredDiscardLevel = (S8)llmin(log((F32)mFullWidth / mKnownDrawWidth) / log_2, - log((F32)mFullHeight / mKnownDrawHeight) / log_2) ; - mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()) ; - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ; + log((F32)mFullHeight / mKnownDrawHeight) / log_2); + mDesiredDiscardLevel = llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()); + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel); } - mKnownDrawSizeChanged = FALSE ; + mKnownDrawSizeChanged = FALSE; if(getDiscardLevel() >= 0 && (getDiscardLevel() <= mDesiredDiscardLevel)) { - mFullyLoaded = TRUE ; + mFullyLoaded = TRUE; } } } if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0) //force to refetch the texture. { - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel) ; + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel); if(getDiscardLevel() < 0 || getDiscardLevel() > mDesiredDiscardLevel) { - mFullyLoaded = FALSE ; + mFullyLoaded = FALSE; } } } -const F32 MAX_PRIORITY_PIXEL = 999.f ; //pixel area -const F32 PRIORITY_BOOST_LEVEL_FACTOR = 1000.f ; //boost level -const F32 PRIORITY_DELTA_DISCARD_LEVEL_FACTOR = 100000.f ; //delta discard -const S32 MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY = 4 ; -const F32 PRIORITY_ADDITIONAL_FACTOR = 1000000.f ; //additional -const S32 MAX_ADDITIONAL_LEVEL_FOR_PRIORITY = 8 ; -const F32 PRIORITY_BOOST_HIGH_FACTOR = 10000000.f ;//boost high +const F32 MAX_PRIORITY_PIXEL = 999.f; //pixel area +const F32 PRIORITY_BOOST_LEVEL_FACTOR = 1000.f; //boost level +const F32 PRIORITY_DELTA_DISCARD_LEVEL_FACTOR = 100000.f; //delta discard +const S32 MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY = 4; +const F32 PRIORITY_ADDITIONAL_FACTOR = 1000000.f; //additional +const S32 MAX_ADDITIONAL_LEVEL_FOR_PRIORITY = 8; +const F32 PRIORITY_BOOST_HIGH_FACTOR = 10000000.f;//boost high F32 LLViewerFetchedTexture::calcDecodePriority() { #ifndef LL_RELEASE_FOR_DOWNLOAD @@ -1495,7 +1523,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() } if(mFullyLoaded && !mForceToSaveRawImage)//already loaded for static texture { - return -1.0f ; //alreay fetched + return -1.0f; //alreay fetched } S32 cur_discard = getCurrentDiscardLevelForFetching(); @@ -1510,7 +1538,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() } else if(mDesiredDiscardLevel >= cur_discard && cur_discard > -1) { - priority = -2.0f ; + priority = -2.0f; } else if(mCachedRawDiscardLevel > -1 && mDesiredDiscardLevel >= mCachedRawDiscardLevel) { @@ -1547,7 +1575,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() S32 ddiscard = MAX_DISCARD_LEVEL - (S32)desired; ddiscard = llclamp(ddiscard, 0, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY); priority = (ddiscard + 1) * PRIORITY_DELTA_DISCARD_LEVEL_FACTOR; - setAdditionalDecodePriority(0.1f) ;//boost the textures without any data so far. + setAdditionalDecodePriority(0.1f);//boost the textures without any data so far. } else if ((mMinDiscardLevel > 0) && (cur_discard <= mMinDiscardLevel)) { @@ -1582,13 +1610,13 @@ F32 LLViewerFetchedTexture::calcDecodePriority() // [10,000,000] + [1,000,000-9,000,000] + [100,000-500,000] + [1-20,000] + [0-999] if (priority > 0.0f) { - bool large_enough = mCachedRawImageReady && ((S32)mTexelsPerImage > sMinLargeImageSize) ; + bool large_enough = mCachedRawImageReady && ((S32)mTexelsPerImage > sMinLargeImageSize); if(large_enough) { //Note: //to give small, low-priority textures some chance to be fetched, //cut the priority in half if the texture size is larger than 256 * 256 and has a 64*64 ready. - priority *= 0.5f ; + priority *= 0.5f; } pixel_priority = llclamp(pixel_priority, 0.0f, MAX_PRIORITY_PIXEL); @@ -1607,7 +1635,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() //Note: //to give small, low-priority textures some chance to be fetched, //if high priority texture has a 64*64 ready, lower its fetching priority. - setAdditionalDecodePriority(0.5f) ; + setAdditionalDecodePriority(0.5f); } else { @@ -1624,7 +1652,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() //Note: //to give small, low-priority textures some chance to be fetched, //cut the additional priority to a quarter if the texture size is larger than 256 * 256 and has a 64*64 ready. - additional *= 0.25f ; + additional *= 0.25f; } priority += additional; } @@ -1639,9 +1667,9 @@ F32 LLViewerFetchedTexture::maxDecodePriority() PRIORITY_ADDITIONAL_FACTOR * (MAX_ADDITIONAL_LEVEL_FOR_PRIORITY + 1) + //additional (view dependent factors) PRIORITY_DELTA_DISCARD_LEVEL_FACTOR * (MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY + 1) + //delta discard PRIORITY_BOOST_LEVEL_FACTOR * (BOOST_MAX_LEVEL - 1) + //boost level - MAX_PRIORITY_PIXEL + 1.0f ; //pixel area. + MAX_PRIORITY_PIXEL + 1.0f; //pixel area. - return max_priority ; + return max_priority; } //============================================================================ @@ -1652,7 +1680,7 @@ void LLViewerFetchedTexture::setDecodePriority(F32 priority) if(mDecodePriority < F_ALMOST_ZERO) { - mStopFetchingTimer.reset() ; + mStopFetchingTimer.reset(); } } @@ -1669,35 +1697,35 @@ void LLViewerFetchedTexture::updateVirtualSize() { if(!mMaxVirtualSizeResetCounter) { - addTextureStats(0.f, FALSE) ;//reset + addTextureStats(0.f, FALSE);//reset } for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch) - { + { llassert(mNumFaces[ch] <= mFaceList[ch].size()); - for(U32 i = 0 ; i < mNumFaces[ch]; i++) + for(U32 i = 0; i < mNumFaces[ch]; i++) { - LLFace* facep = mFaceList[ch][i] ; - if( facep ) + LLFace* facep = mFaceList[ch][i]; + if( facep ) + { + LLDrawable* drawable = facep->getDrawable(); + if (drawable) { - LLDrawable* drawable = facep->getDrawable(); - if (drawable) + if(drawable->isRecentlyVisible()) { - if(drawable->isRecentlyVisible()) + if (getBoostLevel() == LLViewerTexture::BOOST_NONE && + drawable->getVObj() && drawable->getVObj()->isSelected()) { - if (getBoostLevel() == LLViewerTexture::BOOST_NONE && - drawable->getVObj() && drawable->getVObj()->isSelected()) - { - setBoostLevel(LLViewerTexture::BOOST_SELECTED); - } - addTextureStats(facep->getVirtualSize()) ; - setAdditionalDecodePriority(facep->getImportanceToCamera()) ; + setBoostLevel(LLViewerTexture::BOOST_SELECTED); } + addTextureStats(facep->getVirtualSize()); + setAdditionalDecodePriority(facep->getImportanceToCamera()); } } } } + } //reset whether or not a face was selected after 10 seconds const F32 SELECTION_RESET_TIME = 10.f; @@ -1711,26 +1739,26 @@ void LLViewerFetchedTexture::updateVirtualSize() { mMaxVirtualSizeResetCounter--; } - reorganizeFaceList() ; + reorganizeFaceList(); reorganizeVolumeList(); } S32 LLViewerFetchedTexture::getCurrentDiscardLevelForFetching() { - S32 current_discard = getDiscardLevel() ; + S32 current_discard = getDiscardLevel(); if(mForceToSaveRawImage) { if(mSavedRawDiscardLevel < 0 || current_discard < 0) { - current_discard = -1 ; + current_discard = -1; } else { - current_discard = llmax(current_discard, mSavedRawDiscardLevel) ; + current_discard = llmax(current_discard, mSavedRawDiscardLevel); } } - return current_discard ; + return current_discard; } bool LLViewerFetchedTexture::setDebugFetching(S32 debug_level) @@ -1747,6 +1775,13 @@ bool LLViewerFetchedTexture::setDebugFetching(S32 debug_level) return true; } +bool LLViewerFetchedTexture::isActiveFetching() +{ + static LLCachedControl<bool> monitor_enabled(gSavedSettings,"DebugShowTextureInfo"); + + return mFetchState > 7 && mFetchState < 10 && monitor_enabled; //in state of WAIT_HTTP_REQ or DECODE_IMAGE. +} + bool LLViewerFetchedTexture::updateFetch() { static LLCachedControl<bool> textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled", false); @@ -1754,7 +1789,7 @@ bool LLViewerFetchedTexture::updateFetch() static LLCachedControl<S32> sCameraMotionBoost(gSavedSettings,"TextureCameraMotionBoost", 3); if(textures_decode_disabled) { - return false ; + return false; } mFetchState = 0; @@ -1789,7 +1824,7 @@ bool LLViewerFetchedTexture::updateFetch() return false; } - S32 current_discard = getCurrentDiscardLevelForFetching() ; + S32 current_discard = getCurrentDiscardLevelForFetching(); S32 desired_discard = getDesiredDiscardLevel(); F32 decode_priority = getDecodePriority(); decode_priority = llclamp(decode_priority, 0.0f, maxDecodePriority()); @@ -1807,7 +1842,7 @@ bool LLViewerFetchedTexture::updateFetch() if (finished) { mIsFetching = FALSE; - mLastPacketTimer.reset() ; + mLastPacketTimer.reset(); } else { @@ -1821,8 +1856,8 @@ bool LLViewerFetchedTexture::updateFetch() LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { - mIsFetched = TRUE ; - tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)) ; + mIsFetched = TRUE; + tester->updateTextureLoadingStats(this, mRawImage, LLAppViewer::getTextureFetch()->isFromLocalCache(mID)); } mRawDiscardLevel = fetch_discard; if ((mRawImage->getDataSize() > 0 && mRawDiscardLevel >= 0) && @@ -1836,19 +1871,19 @@ bool LLViewerFetchedTexture::updateFetch() { //discard all oversized textures. destroyRawImage(); - llwarns << "oversize, setting as missing" << llendl; + LL_WARNS() << "oversize, setting as missing" << LL_ENDL; setIsMissingAsset(); - mRawDiscardLevel = INVALID_DISCARD_LEVEL ; - mIsFetching = FALSE ; + mRawDiscardLevel = INVALID_DISCARD_LEVEL; + mIsFetching = FALSE; mLastPacketTimer.reset(); } else { mIsRawImageValid = TRUE; - addToCreateTexture() ; + addToCreateTexture(); } - return TRUE ; + return TRUE; } else { @@ -1866,16 +1901,16 @@ bool LLViewerFetchedTexture::updateFetch() // We finished but received no data if (current_discard < 0) { - llwarns << "!mIsFetching, setting as missing, decode_priority " << decode_priority + LL_WARNS() << "!mIsFetching, setting as missing, decode_priority " << decode_priority << " mRawDiscardLevel " << mRawDiscardLevel << " current_discard " << current_discard - << llendl; + << LL_ENDL; setIsMissingAsset(); desired_discard = -1; } else { - //llwarns << mID << ": Setting min discard to " << current_discard << llendl; + //LL_WARNS() << mID << ": Setting min discard to " << current_discard << LL_ENDL; mMinDiscardLevel = current_discard; desired_discard = current_discard; } @@ -1893,13 +1928,13 @@ bool LLViewerFetchedTexture::updateFetch() // // Useful debugging code for undesired deprioritization of textures. // if (decode_priority <= 0.0f && desired_discard >= 0 && desired_discard < current_discard) // { -// llinfos << "Calling updateRequestPriority() with decode_priority = 0.0f" << llendl; +// LL_INFOS() << "Calling updateRequestPriority() with decode_priority = 0.0f" << LL_ENDL; // calcDecodePriority(); // } - static const F32 MAX_HOLD_TIME = 5.0f ; //seconds to wait before canceling fecthing if decode_priority is 0.f. + static const F32 MAX_HOLD_TIME = 5.0f; //seconds to wait before canceling fecthing if decode_priority is 0.f. if(decode_priority > 0.0f || mStopFetchingTimer.getElapsedTimeF32() > MAX_HOLD_TIME) { - mStopFetchingTimer.reset() ; + mStopFetchingTimer.reset(); LLAppViewer::getTextureFetch()->updateRequestPriority(mID, decode_priority); } } @@ -1925,7 +1960,7 @@ bool LLViewerFetchedTexture::updateFetch() else if(mCachedRawImage.notNull() && (current_discard < 0 || current_discard > mCachedRawDiscardLevel)) { make_request = false; - switchToCachedImage() ; //use the cached raw data first + switchToCachedImage(); //use the cached raw data first } //else if (!isJustBound() && mCachedRawImageReady) //{ @@ -1937,7 +1972,7 @@ bool LLViewerFetchedTexture::updateFetch() // Load the texture progressively: we try not to rush to the desired discard too fast. // If the camera is not moving, we do not tweak the discard level notch by notch but go to the desired discard with larger boosted steps // This mitigates the "textures stay blurry" problem when loading while not killing the texture memory while moving around - S32 delta_level = (mBoostLevel > LLGLTexture::BOOST_NONE) ? 2 : 1 ; + S32 delta_level = (mBoostLevel > LLGLTexture::BOOST_NONE) ? 2 : 1; if (current_discard < 0) { desired_discard = llmax(desired_discard, getMaxDiscardLevel() - delta_level); @@ -2008,7 +2043,7 @@ bool LLViewerFetchedTexture::updateFetch() const F32 FETCH_IDLE_TIME = 5.f; if (mLastPacketTimer.getElapsedTimeF32() > FETCH_IDLE_TIME) { - LL_DEBUGS("Texture") << "exceeded idle time " << FETCH_IDLE_TIME << ", deleting request: " << getID() << llendl; + LL_DEBUGS("Texture") << "exceeded idle time " << FETCH_IDLE_TIME << ", deleting request: " << getID() << LL_ENDL; LLAppViewer::getTextureFetch()->deleteRequest(getID(), true); mHasFetcher = FALSE; } @@ -2023,7 +2058,7 @@ void LLViewerFetchedTexture::clearFetchedResults() { if(mNeedsCreateTexture || mIsFetching) { - return ; + return; } cleanup(); @@ -2040,7 +2075,7 @@ void LLViewerFetchedTexture::forceToDeleteRequest() if (mHasFetcher) { mHasFetcher = FALSE; - mIsFetching = FALSE ; + mIsFetching = FALSE; } resetTextureStats(); @@ -2052,14 +2087,14 @@ void LLViewerFetchedTexture::setIsMissingAsset() { if (mUrl.empty()) { - llwarns << mID << ": Marking image as missing" << llendl; + LL_WARNS() << mID << ": Marking image as missing" << LL_ENDL; } else { // This may or may not be an error - it is normal to have no // map tile on an empty region, but bad if we're failing on a // server bake texture. - llwarns << mUrl << ": Marking image as missing" << llendl; + LL_WARNS() << mUrl << ": Marking image as missing" << LL_ENDL; } if (mHasFetcher) { @@ -2088,19 +2123,19 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call } else { - mLoadedCallbackDesiredDiscardLevel = llmin(mLoadedCallbackDesiredDiscardLevel, (S8)discard_level) ; + mLoadedCallbackDesiredDiscardLevel = llmin(mLoadedCallbackDesiredDiscardLevel, (S8)discard_level); } if(mPauseLoadedCallBacks) { if(!pause) { - unpauseLoadedCallbacks(src_callback_list) ; + unpauseLoadedCallbacks(src_callback_list); } } else if(pause) { - pauseLoadedCallbacks(src_callback_list) ; + pauseLoadedCallbacks(src_callback_list); } LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata, src_callback_list, this, pause); @@ -2109,21 +2144,21 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call mNeedsAux |= needs_aux; if(keep_imageraw) { - mSaveRawImage = TRUE ; + mSaveRawImage = TRUE; } if (mNeedsAux && mAuxRawImage.isNull() && getDiscardLevel() >= 0) { // We need aux data, but we've already loaded the image, and it didn't have any - llwarns << "No aux data available for callback for image:" << getID() << llendl; + LL_WARNS() << "No aux data available for callback for image:" << getID() << LL_ENDL; } - mLastCallBackActiveTime = sCurrentTime ; + mLastCallBackActiveTime = sCurrentTime; } void LLViewerFetchedTexture::clearCallbackEntryList() { if(mLoadedCallbackList.empty()) { - return ; + return; } for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); @@ -2134,29 +2169,29 @@ void LLViewerFetchedTexture::clearCallbackEntryList() // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData); - iter = mLoadedCallbackList.erase(iter) ; + iter = mLoadedCallbackList.erase(iter); delete entryp; } gTextureList.mCallbackList.erase(this); - mLoadedCallbackDesiredDiscardLevel = S8_MAX ; + mLoadedCallbackDesiredDiscardLevel = S8_MAX; if(needsToSaveRawImage()) { - destroySavedRawImage() ; + destroySavedRawImage(); } - return ; + return; } void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::source_callback_list_t* callback_list) { if(mLoadedCallbackList.empty() || !callback_list) { - return ; + return; } - S32 desired_discard = S8_MAX ; - S32 desired_raw_discard = INVALID_DISCARD_LEVEL ; + S32 desired_discard = S8_MAX; + S32 desired_raw_discard = INVALID_DISCARD_LEVEL; for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); iter != mLoadedCallbackList.end(); ) { @@ -2166,17 +2201,17 @@ void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::so // We never finished loading the image. Indicate failure. // Note: this allows mLoadedCallbackUserData to be cleaned up. entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData); - iter = mLoadedCallbackList.erase(iter) ; + iter = mLoadedCallbackList.erase(iter); delete entryp; } else { ++iter; - desired_discard = llmin(desired_discard, entryp->mDesiredDiscard) ; + desired_discard = llmin(desired_discard, entryp->mDesiredDiscard); if(entryp->mNeedsImageRaw) { - desired_raw_discard = llmin(desired_raw_discard, entryp->mDesiredDiscard) ; + desired_raw_discard = llmin(desired_raw_discard, entryp->mDesiredDiscard); } } } @@ -2189,18 +2224,18 @@ void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::so if(needsToSaveRawImage()) { - destroySavedRawImage() ; + destroySavedRawImage(); } } else if(needsToSaveRawImage() && mBoostLevel != LLGLTexture::BOOST_PREVIEW) { if(desired_raw_discard != INVALID_DISCARD_LEVEL) { - mDesiredSavedRawDiscardLevel = desired_raw_discard ; + mDesiredSavedRawDiscardLevel = desired_raw_discard; } else { - destroySavedRawImage() ; + destroySavedRawImage(); } } } @@ -2209,29 +2244,29 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry: { if(!callback_list) { - mPauseLoadedCallBacks = FALSE ; - return ; + mPauseLoadedCallBacks = FALSE; + return; } - BOOL need_raw = FALSE ; + BOOL need_raw = FALSE; for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); iter != mLoadedCallbackList.end(); ) { LLLoadedCallbackEntry *entryp = *iter++; if(entryp->mSourceCallbackList == callback_list) { - entryp->mPaused = FALSE ; + entryp->mPaused = FALSE; if(entryp->mNeedsImageRaw) { - need_raw = TRUE ; + need_raw = TRUE; } } } - mPauseLoadedCallBacks = FALSE ; - mLastCallBackActiveTime = sCurrentTime ; + mPauseLoadedCallBacks = FALSE; + mLastCallBackActiveTime = sCurrentTime; if(need_raw) { - mSaveRawImage = TRUE ; + mSaveRawImage = TRUE; } } @@ -2239,10 +2274,10 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s { if(!callback_list) { - return ; + return; } - bool paused = true ; + bool paused = true; for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); iter != mLoadedCallbackList.end(); ) @@ -2250,25 +2285,25 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s LLLoadedCallbackEntry *entryp = *iter++; if(entryp->mSourceCallbackList == callback_list) { - entryp->mPaused = TRUE ; + entryp->mPaused = TRUE; } else if(!entryp->mPaused) { - paused = false ; + paused = false; } } if(paused) { - mPauseLoadedCallBacks = TRUE ;//when set, loaded callback is paused. + mPauseLoadedCallBacks = TRUE;//when set, loaded callback is paused. resetTextureStats(); - mSaveRawImage = FALSE ; + mSaveRawImage = FALSE; } } bool LLViewerFetchedTexture::doLoadedCallbacks() { - static const F32 MAX_INACTIVE_TIME = 900.f ; //seconds + static const F32 MAX_INACTIVE_TIME = 900.f; //seconds if (mNeedsCreateTexture) { @@ -2281,8 +2316,8 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() } if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME && !mIsFetching) { - clearCallbackEntryList() ; //remove all callbacks. - return false ; + clearCallbackEntryList(); //remove all callbacks. + return false; } bool res = false; @@ -2302,7 +2337,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() // Remove ourself from the global list of textures with callbacks gTextureList.mCallbackList.erase(this); - return false ; + return false; } S32 gl_discard = getDiscardLevel(); @@ -2409,7 +2444,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() if (run_raw_callbacks && mIsRawImageValid && (mRawDiscardLevel <= getMaxDiscardLevel())) { // Do callbacks which require raw image data. - //llinfos << "doLoadedCallbacks raw for " << getID() << llendl; + //LL_INFOS() << "doLoadedCallbacks raw for " << getID() << LL_ENDL; // Call each party interested in the raw data. for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); @@ -2423,15 +2458,15 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() // to satisfy the interested party, then this is the last time that // we're going to call them. - mLastCallBackActiveTime = sCurrentTime ; + mLastCallBackActiveTime = sCurrentTime; //llassert_always(mRawImage.notNull()); if(mNeedsAux && mAuxRawImage.isNull()) { - llwarns << "Raw Image with no Aux Data for callback" << llendl; + LL_WARNS() << "Raw Image with no Aux Data for callback" << LL_ENDL; } BOOL final = mRawDiscardLevel <= entryp->mDesiredDiscard ? TRUE : FALSE; - //llinfos << "Running callback for " << getID() << llendl; - //llinfos << mRawImage->getWidth() << "x" << mRawImage->getHeight() << llendl; + //LL_INFOS() << "Running callback for " << getID() << LL_ENDL; + //LL_INFOS() << mRawImage->getWidth() << "x" << mRawImage->getHeight() << LL_ENDL; entryp->mLastUsedDiscard = mRawDiscardLevel; entryp->mCallback(TRUE, this, mRawImage, mAuxRawImage, mRawDiscardLevel, final, entryp->mUserData); if (final) @@ -2449,7 +2484,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() // if (run_gl_callbacks && (gl_discard <= getMaxDiscardLevel())) { - //llinfos << "doLoadedCallbacks GL for " << getID() << llendl; + //LL_INFOS() << "doLoadedCallbacks GL for " << getID() << LL_ENDL; // Call the callbacks interested in GL data. for(callback_list_t::iterator iter = mLoadedCallbackList.begin(); @@ -2459,7 +2494,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks() LLLoadedCallbackEntry *entryp = *curiter; if (!entryp->mNeedsImageRaw && (entryp->mLastUsedDiscard > gl_discard)) { - mLastCallBackActiveTime = sCurrentTime ; + mLastCallBackActiveTime = sCurrentTime; BOOL final = gl_discard <= entryp->mDesiredDiscard ? TRUE : FALSE; entryp->mLastUsedDiscard = gl_discard; entryp->mCallback(TRUE, this, NULL, NULL, gl_discard, final, entryp->mUserData); @@ -2493,66 +2528,66 @@ void LLViewerFetchedTexture::forceImmediateUpdate() //only immediately update a deleted texture which is now being re-used. if(!isDeleted()) { - return ; + return; } //if already called forceImmediateUpdate() if(mInImageList && mDecodePriority == LLViewerFetchedTexture::maxDecodePriority()) { - return ; + return; } - gTextureList.forceImmediateUpdate(this) ; - return ; + gTextureList.forceImmediateUpdate(this); + return; } LLImageRaw* LLViewerFetchedTexture::reloadRawImage(S8 discard_level) { - llassert_always(mGLTexturep.notNull()) ; + llassert_always(mGLTexturep.notNull()); llassert_always(discard_level >= 0); llassert_always(mComponents > 0); if (mRawImage.notNull()) { //mRawImage is in use by somebody else, do not delete it. - return NULL ; + return NULL; } if(mSavedRawDiscardLevel >= 0 && mSavedRawDiscardLevel <= discard_level) { if(mSavedRawDiscardLevel != discard_level) { - mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents()) ; - mRawImage->copy(getSavedRawImage()) ; + mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents()); + mRawImage->copy(getSavedRawImage()); } else { - mRawImage = getSavedRawImage() ; + mRawImage = getSavedRawImage(); } - mRawDiscardLevel = discard_level ; + mRawDiscardLevel = discard_level; } else { //force to fetch raw image again if cached raw image is not good enough. if(mCachedRawDiscardLevel > discard_level) { - mRawImage = mCachedRawImage ; + mRawImage = mCachedRawImage; mRawDiscardLevel = mCachedRawDiscardLevel; } else //cached raw image is good enough, copy it. { if(mCachedRawDiscardLevel != discard_level) { - mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents()) ; - mRawImage->copy(mCachedRawImage) ; + mRawImage = new LLImageRaw(getWidth(discard_level), getHeight(discard_level), getComponents()); + mRawImage->copy(mCachedRawImage); } else { - mRawImage = mCachedRawImage ; + mRawImage = mCachedRawImage; } - mRawDiscardLevel = discard_level ; + mRawDiscardLevel = discard_level; } } - mIsRawImageValid = TRUE ; + mIsRawImageValid = TRUE; sRawCount++; return mRawImage; @@ -2560,7 +2595,7 @@ LLImageRaw* LLViewerFetchedTexture::reloadRawImage(S8 discard_level) bool LLViewerFetchedTexture::needsToSaveRawImage() { - return mForceToSaveRawImage || mSaveRawImage ; + return mForceToSaveRawImage || mSaveRawImage; } void LLViewerFetchedTexture::destroyRawImage() @@ -2579,9 +2614,9 @@ void LLViewerFetchedTexture::destroyRawImage() { if(needsToSaveRawImage()) { - saveRawImage() ; + saveRawImage(); } - setCachedRawImage() ; + setCachedRawImage(); } mRawImage = NULL; @@ -2597,19 +2632,19 @@ void LLViewerFetchedTexture::switchToCachedImage() { if(mCachedRawImage.notNull()) { - mRawImage = mCachedRawImage ; + mRawImage = mCachedRawImage; if (getComponents() != mRawImage->getComponents()) { // We've changed the number of components, so we need to move any // objects using this pool to a different pool. mComponents = mRawImage->getComponents(); - mGLTexturep->setComponents(mComponents) ; + mGLTexturep->setComponents(mComponents); gTextureList.dirtyImage(this); } mIsRawImageValid = TRUE; - mRawDiscardLevel = mCachedRawDiscardLevel ; + mRawDiscardLevel = mCachedRawDiscardLevel; gTextureList.mCreateTextureList.insert(this); mNeedsCreateTexture = TRUE; } @@ -2621,9 +2656,9 @@ void LLViewerFetchedTexture::setCachedRawImage(S32 discard_level, LLImageRaw* im { if(imageraw != mRawImage.get()) { - mCachedRawImage = imageraw ; - mCachedRawDiscardLevel = discard_level ; - mCachedRawImageReady = TRUE ; + mCachedRawImage = imageraw; + mCachedRawDiscardLevel = discard_level; + mCachedRawImageReady = TRUE; } } @@ -2631,49 +2666,49 @@ void LLViewerFetchedTexture::setCachedRawImage() { if(mRawImage == mCachedRawImage) { - return ; + return; } if(!mIsRawImageValid) { - return ; + return; } if(mCachedRawImageReady) { - return ; + return; } if(mCachedRawDiscardLevel < 0 || mCachedRawDiscardLevel > mRawDiscardLevel) { - S32 i = 0 ; - S32 w = mRawImage->getWidth() ; - S32 h = mRawImage->getHeight() ; + S32 i = 0; + S32 w = mRawImage->getWidth(); + S32 h = mRawImage->getHeight(); - S32 max_size = MAX_CACHED_RAW_IMAGE_AREA ; + S32 max_size = MAX_CACHED_RAW_IMAGE_AREA; if(LLGLTexture::BOOST_TERRAIN == mBoostLevel) { - max_size = MAX_CACHED_RAW_TERRAIN_IMAGE_AREA ; + max_size = MAX_CACHED_RAW_TERRAIN_IMAGE_AREA; } if(mForSculpt) { - max_size = MAX_CACHED_RAW_SCULPT_IMAGE_AREA ; - mCachedRawImageReady = !mRawDiscardLevel ; + max_size = MAX_CACHED_RAW_SCULPT_IMAGE_AREA; + mCachedRawImageReady = !mRawDiscardLevel; } else { - mCachedRawImageReady = (!mRawDiscardLevel || ((w * h) >= max_size)) ; + mCachedRawImageReady = (!mRawDiscardLevel || ((w * h) >= max_size)); } while(((w >> i) * (h >> i)) > max_size) { - ++i ; + ++i; } if(i) { if(!(w >> i) || !(h >> i)) { - --i ; + --i; } { @@ -2682,9 +2717,9 @@ void LLViewerFetchedTexture::setCachedRawImage() mRawImage->scale(w >> i, h >> i) ; } } - mCachedRawImage = mRawImage ; - mRawDiscardLevel += i ; - mCachedRawDiscardLevel = mRawDiscardLevel ; + mCachedRawImage = mRawImage; + mRawDiscardLevel += i; + mCachedRawDiscardLevel = mRawDiscardLevel; } } @@ -2694,11 +2729,11 @@ void LLViewerFetchedTexture::checkCachedRawSculptImage() { if(getDiscardLevel() != 0) { - mCachedRawImageReady = FALSE ; + mCachedRawImageReady = FALSE; } else if(isForSculptOnly()) { - resetTextureStats() ; //do not update this image any more. + resetTextureStats(); //do not update this image any more. } } } @@ -2707,45 +2742,45 @@ void LLViewerFetchedTexture::saveRawImage() { if(mRawImage.isNull() || mRawImage == mSavedRawImage || (mSavedRawDiscardLevel >= 0 && mSavedRawDiscardLevel <= mRawDiscardLevel)) { - return ; + return; } - mSavedRawDiscardLevel = mRawDiscardLevel ; - mSavedRawImage = new LLImageRaw(mRawImage->getData(), mRawImage->getWidth(), mRawImage->getHeight(), mRawImage->getComponents()) ; + mSavedRawDiscardLevel = mRawDiscardLevel; + mSavedRawImage = new LLImageRaw(mRawImage->getData(), mRawImage->getWidth(), mRawImage->getHeight(), mRawImage->getComponents()); if(mForceToSaveRawImage && mSavedRawDiscardLevel <= mDesiredSavedRawDiscardLevel) { - mForceToSaveRawImage = FALSE ; + mForceToSaveRawImage = FALSE; } - mLastReferencedSavedRawImageTime = sCurrentTime ; + mLastReferencedSavedRawImageTime = sCurrentTime; } void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, F32 kept_time) { - mKeptSavedRawImageTime = kept_time ; - mLastReferencedSavedRawImageTime = sCurrentTime ; + mKeptSavedRawImageTime = kept_time; + mLastReferencedSavedRawImageTime = sCurrentTime; if(mSavedRawDiscardLevel > -1 && mSavedRawDiscardLevel <= desired_discard) { - return ; //raw imge is ready. + return; //raw imge is ready. } if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard) { - mForceToSaveRawImage = TRUE ; - mDesiredSavedRawDiscardLevel = desired_discard ; + mForceToSaveRawImage = TRUE; + mDesiredSavedRawDiscardLevel = desired_discard; //copy from the cached raw image if exists. if(mCachedRawImage.notNull() && mRawImage.isNull() ) { - mRawImage = mCachedRawImage ; - mRawDiscardLevel = mCachedRawDiscardLevel ; + mRawImage = mCachedRawImage; + mRawDiscardLevel = mCachedRawDiscardLevel; - saveRawImage() ; + saveRawImage(); - mRawImage = NULL ; - mRawDiscardLevel = INVALID_DISCARD_LEVEL ; + mRawImage = NULL; + mRawDiscardLevel = INVALID_DISCARD_LEVEL; } } } @@ -2753,38 +2788,38 @@ void LLViewerFetchedTexture::destroySavedRawImage() { if(mLastReferencedSavedRawImageTime < mKeptSavedRawImageTime) { - return ; //keep the saved raw image. + return; //keep the saved raw image. } - mForceToSaveRawImage = FALSE ; - mSaveRawImage = FALSE ; + mForceToSaveRawImage = FALSE; + mSaveRawImage = FALSE; - clearCallbackEntryList() ; + clearCallbackEntryList(); - mSavedRawImage = NULL ; - mForceToSaveRawImage = FALSE ; - mSaveRawImage = FALSE ; - mSavedRawDiscardLevel = -1 ; - mDesiredSavedRawDiscardLevel = -1 ; - mLastReferencedSavedRawImageTime = 0.0f ; - mKeptSavedRawImageTime = 0.f ; + mSavedRawImage = NULL; + mForceToSaveRawImage = FALSE; + mSaveRawImage = FALSE; + mSavedRawDiscardLevel = -1; + mDesiredSavedRawDiscardLevel = -1; + mLastReferencedSavedRawImageTime = 0.0f; + mKeptSavedRawImageTime = 0.f; } LLImageRaw* LLViewerFetchedTexture::getSavedRawImage() { - mLastReferencedSavedRawImageTime = sCurrentTime ; + mLastReferencedSavedRawImageTime = sCurrentTime; - return mSavedRawImage ; + return mSavedRawImage; } BOOL LLViewerFetchedTexture::hasSavedRawImage() const { - return mSavedRawImage.notNull() ; + return mSavedRawImage.notNull(); } F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const { - return sCurrentTime - mLastReferencedSavedRawImageTime ; + return sCurrentTime - mLastReferencedSavedRawImageTime; } //---------------------------------------------------------------------------------------------- @@ -2797,13 +2832,13 @@ F32 LLViewerFetchedTexture::getElapsedLastReferencedSavedRawImageTime() const LLViewerLODTexture::LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host, BOOL usemipmaps) : LLViewerFetchedTexture(id, f_type, host, usemipmaps) { - init(TRUE) ; + init(TRUE); } LLViewerLODTexture::LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, BOOL usemipmaps) : LLViewerFetchedTexture(url, f_type, id, usemipmaps) { - init(TRUE) ; + init(TRUE); } void LLViewerLODTexture::init(bool firstinit) @@ -2816,19 +2851,19 @@ void LLViewerLODTexture::init(bool firstinit) //virtual S8 LLViewerLODTexture::getType() const { - return LLViewerTexture::LOD_TEXTURE ; + return LLViewerTexture::LOD_TEXTURE; } BOOL LLViewerLODTexture::isUpdateFrozen() { - return LLViewerTexture::sFreezeImageScalingDown && !getDiscardLevel() ; + return LLViewerTexture::sFreezeImageScalingDown && !getDiscardLevel(); } // This is gauranteed to get called periodically for every texture //virtual void LLViewerLODTexture::processTextureStats() { - updateVirtualSize() ; + updateVirtualSize(); static LLCachedControl<bool> textures_fullres(gSavedSettings,"TextureLoadFullRes", false); @@ -2850,7 +2885,7 @@ void LLViewerLODTexture::processTextureStats() } else if (!mFullWidth || !mFullHeight) { - mDesiredDiscardLevel = getMaxDiscardLevel() ; + mDesiredDiscardLevel = getMaxDiscardLevel(); } else { @@ -2876,7 +2911,7 @@ void LLViewerLODTexture::processTextureStats() if(isLargeImage() && !isJustBound() && mAdditionalDecodePriority < 0.3f) { //if is a big image and not being used recently, nor close to the view point, do not load hi-res data. - mMaxVirtualSize = llmin(mMaxVirtualSize, (F32)LLViewerTexture::sMinLargeImageSize) ; + mMaxVirtualSize = llmin(mMaxVirtualSize, (F32)LLViewerTexture::sMinLargeImageSize); } if ((mCalculatedDiscardLevel >= 0.f) && @@ -2897,7 +2932,7 @@ void LLViewerLODTexture::processTextureStats() { discard_level += sDesiredDiscardBias; discard_level *= sDesiredDiscardScale; // scale - discard_level += sCameraMovingDiscardBias ; + discard_level += sCameraMovingDiscardBias; } discard_level = floorf(discard_level); @@ -2924,19 +2959,19 @@ void LLViewerLODTexture::processTextureStats() if(desired_discard_bias_max <= sDesiredDiscardBias && !mForceToSaveRawImage) { //needs to release texture memory urgently - scaleDown() ; + scaleDown(); } // Limit the amount of GL memory bound each frame - else if ( BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) > sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale && + else if ( sBoundTextureMemory > sMaxBoundTextureMem * texmem_middle_bound_scale && (!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel)) { - scaleDown() ; + scaleDown(); } // Only allow GL to have 2x the video card memory - else if ( BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) > sMaxTotalTextureMemInMegaBytes*texmem_middle_bound_scale && + else if ( sTotalTextureMemory > sMaxTotalTextureMem * texmem_middle_bound_scale && (!getBoundRecently() || mDesiredDiscardLevel >= mCachedRawDiscardLevel)) { - scaleDown() ; + scaleDown(); } } @@ -2944,13 +2979,13 @@ void LLViewerLODTexture::processTextureStats() if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0) { - mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel) ; + mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel); } else if(LLPipeline::sMemAllocationThrottled)//release memory of large textures by decrease their resolutions. { if(scaleDown()) { - mDesiredDiscardLevel = mCachedRawDiscardLevel ; + mDesiredDiscardLevel = mCachedRawDiscardLevel; } } } @@ -2959,17 +2994,17 @@ bool LLViewerLODTexture::scaleDown() { if(hasGLTexture() && mCachedRawDiscardLevel > getDiscardLevel()) { - switchToCachedImage() ; + switchToCachedImage(); LLTexturePipelineTester* tester = (LLTexturePipelineTester*)LLMetricPerformanceTesterBasic::getTester(sTesterName); if (tester) { - tester->setStablizingTime() ; + tester->setStablizingTime(); } - return true ; + return true; } - return false ; + return false; } //---------------------------------------------------------------------------------------------- //end of LLViewerLODTexture @@ -2981,14 +3016,14 @@ bool LLViewerLODTexture::scaleDown() //static void LLViewerMediaTexture::updateClass() { - static const F32 MAX_INACTIVE_TIME = 30.f ; + static const F32 MAX_INACTIVE_TIME = 30.f; #if 0 //force to play media. - gSavedSettings.setBOOL("AudioStreamingMedia", true) ; + gSavedSettings.setBOOL("AudioStreamingMedia", true); #endif - for(media_map_t::iterator iter = sMediaMap.begin() ; iter != sMediaMap.end(); ) + for(media_map_t::iterator iter = sMediaMap.begin(); iter != sMediaMap.end(); ) { LLViewerMediaTexture* mediap = iter->second; @@ -2999,29 +3034,29 @@ void LLViewerMediaTexture::updateClass() // if(mediap->getLastReferencedTimer()->getElapsedTimeF32() > MAX_INACTIVE_TIME) { - media_map_t::iterator cur = iter++ ; - sMediaMap.erase(cur) ; - continue ; + media_map_t::iterator cur = iter++; + sMediaMap.erase(cur); + continue; } } - ++iter ; + ++iter; } } //static void LLViewerMediaTexture::removeMediaImplFromTexture(const LLUUID& media_id) { - LLViewerMediaTexture* media_tex = findMediaTexture(media_id) ; + LLViewerMediaTexture* media_tex = findMediaTexture(media_id); if(media_tex) { - media_tex->invalidateMediaImpl() ; + media_tex->invalidateMediaImpl(); } } //static void LLViewerMediaTexture::cleanUpClass() { - sMediaMap.clear() ; + sMediaMap.clear(); } //static @@ -3033,9 +3068,9 @@ LLViewerMediaTexture* LLViewerMediaTexture::findMediaTexture(const LLUUID& media return NULL; } - LLViewerMediaTexture* media_tex = iter->second ; - media_tex->setMediaImpl() ; - media_tex->getLastReferencedTimer()->reset() ; + LLViewerMediaTexture* media_tex = iter->second; + media_tex->setMediaImpl(); + media_tex->getLastReferencedTimer()->reset(); return media_tex; } @@ -3047,48 +3082,48 @@ LLViewerMediaTexture::LLViewerMediaTexture(const LLUUID& id, BOOL usemipmaps, LL { sMediaMap.insert(std::make_pair(id, this)); - mGLTexturep = gl_image ; + mGLTexturep = gl_image; if(mGLTexturep.isNull()) { - generateGLTexture() ; + generateGLTexture(); } mGLTexturep->setAllowCompression(false); - mGLTexturep->setNeedsAlphaAndPickMask(FALSE) ; + mGLTexturep->setNeedsAlphaAndPickMask(FALSE); - mIsPlaying = FALSE ; + mIsPlaying = FALSE; - setMediaImpl() ; + setMediaImpl(); - setCategory(LLGLTexture::MEDIA) ; + setCategory(LLGLTexture::MEDIA); - LLViewerTexture* tex = gTextureList.findImage(mID) ; + LLViewerTexture* tex = gTextureList.findImage(mID); if(tex) //this media is a parcel media for tex. { - tex->setParcelMedia(this) ; + tex->setParcelMedia(this); } } //virtual LLViewerMediaTexture::~LLViewerMediaTexture() { - LLViewerTexture* tex = gTextureList.findImage(mID) ; + LLViewerTexture* tex = gTextureList.findImage(mID); if(tex) //this media is a parcel media for tex. { - tex->setParcelMedia(NULL) ; + tex->setParcelMedia(NULL); } } void LLViewerMediaTexture::reinit(BOOL usemipmaps /* = TRUE */) { - llassert(mGLTexturep.notNull()) ; + llassert(mGLTexturep.notNull()); - mUseMipMaps = usemipmaps ; - getLastReferencedTimer()->reset() ; - mGLTexturep->setUseMipMaps(mUseMipMaps) ; - mGLTexturep->setNeedsAlphaAndPickMask(FALSE) ; + mUseMipMaps = usemipmaps; + getLastReferencedTimer()->reset(); + mGLTexturep->setUseMipMaps(mUseMipMaps); + mGLTexturep->setNeedsAlphaAndPickMask(FALSE); } void LLViewerMediaTexture::setUseMipMaps(BOOL mipmap) @@ -3097,26 +3132,26 @@ void LLViewerMediaTexture::setUseMipMaps(BOOL mipmap) if(mGLTexturep.notNull()) { - mGLTexturep->setUseMipMaps(mipmap) ; + mGLTexturep->setUseMipMaps(mipmap); } } //virtual S8 LLViewerMediaTexture::getType() const { - return LLViewerTexture::MEDIA_TEXTURE ; + return LLViewerTexture::MEDIA_TEXTURE; } void LLViewerMediaTexture::invalidateMediaImpl() { - mMediaImplp = NULL ; + mMediaImplp = NULL; } void LLViewerMediaTexture::setMediaImpl() { if(!mMediaImplp) { - mMediaImplp = LLViewerMedia::getMediaImplFromTextureID(mID) ; + mMediaImplp = LLViewerMedia::getMediaImplFromTextureID(mID); } } @@ -3125,71 +3160,71 @@ void LLViewerMediaTexture::setMediaImpl() // because it does not check the face validity after the current frame. BOOL LLViewerMediaTexture::findFaces() { - mMediaFaceList.clear() ; + mMediaFaceList.clear(); - BOOL ret = TRUE ; + BOOL ret = TRUE; - LLViewerTexture* tex = gTextureList.findImage(mID) ; + LLViewerTexture* tex = gTextureList.findImage(mID); if(tex) //this media is a parcel media for tex. { for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch) { - const ll_face_list_t* face_list = tex->getFaceList(ch) ; - U32 end = tex->getNumFaces(ch) ; - for(U32 i = 0 ; i < end ; i++) - { - mMediaFaceList.push_back((*face_list)[i]) ; - } + const ll_face_list_t* face_list = tex->getFaceList(ch); + U32 end = tex->getNumFaces(ch); + for(U32 i = 0; i < end; i++) + { + mMediaFaceList.push_back((*face_list)[i]); } } + } if(!mMediaImplp) { - return TRUE ; + return TRUE; } //for media on a face. - const std::list< LLVOVolume* >* obj_list = mMediaImplp->getObjectList() ; - std::list< LLVOVolume* >::const_iterator iter = obj_list->begin() ; + const std::list< LLVOVolume* >* obj_list = mMediaImplp->getObjectList(); + std::list< LLVOVolume* >::const_iterator iter = obj_list->begin(); for(; iter != obj_list->end(); ++iter) { - LLVOVolume* obj = *iter ; + LLVOVolume* obj = *iter; if(obj->mDrawable.isNull()) { - ret = FALSE ; - continue ; + ret = FALSE; + continue; } - S32 face_id = -1 ; - S32 num_faces = obj->mDrawable->getNumFaces() ; + S32 face_id = -1; + S32 num_faces = obj->mDrawable->getNumFaces(); while((face_id = obj->getFaceIndexWithMediaImpl(mMediaImplp, face_id)) > -1 && face_id < num_faces) { - LLFace* facep = obj->mDrawable->getFace(face_id) ; + LLFace* facep = obj->mDrawable->getFace(face_id); if(facep) { - mMediaFaceList.push_back(facep) ; + mMediaFaceList.push_back(facep); } else { - ret = FALSE ; + ret = FALSE; } } } - return ret ; + return ret; } void LLViewerMediaTexture::initVirtualSize() { if(mIsPlaying) { - return ; + return; } - findFaces() ; + findFaces(); for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter) { - addTextureStats((*iter)->getVirtualSize()) ; + addTextureStats((*iter)->getVirtualSize()); } } @@ -3197,77 +3232,77 @@ void LLViewerMediaTexture::addMediaToFace(LLFace* facep) { if(facep) { - facep->setHasMedia(true) ; + facep->setHasMedia(true); } if(!mIsPlaying) { - return ; //no need to add the face because the media is not in playing. + return; //no need to add the face because the media is not in playing. } - switchTexture(LLRender::DIFFUSE_MAP, facep) ; + switchTexture(LLRender::DIFFUSE_MAP, facep); } void LLViewerMediaTexture::removeMediaFromFace(LLFace* facep) { if(!facep) { - return ; + return; } - facep->setHasMedia(false) ; + facep->setHasMedia(false); if(!mIsPlaying) { - return ; //no need to remove the face because the media is not in playing. + return; //no need to remove the face because the media is not in playing. } - mIsPlaying = FALSE ; //set to remove the media from the face. - switchTexture(LLRender::DIFFUSE_MAP, facep) ; - mIsPlaying = TRUE ; //set the flag back. + mIsPlaying = FALSE; //set to remove the media from the face. + switchTexture(LLRender::DIFFUSE_MAP, facep); + mIsPlaying = TRUE; //set the flag back. if(getTotalNumFaces() < 1) //no face referencing to this media { - stopPlaying() ; + stopPlaying(); } } //virtual void LLViewerMediaTexture::addFace(U32 ch, LLFace* facep) { - LLViewerTexture::addFace(ch, facep) ; + LLViewerTexture::addFace(ch, facep); - const LLTextureEntry* te = facep->getTextureEntry() ; + const LLTextureEntry* te = facep->getTextureEntry(); if(te && te->getID().notNull()) { - LLViewerTexture* tex = gTextureList.findImage(te->getID()) ; + LLViewerTexture* tex = gTextureList.findImage(te->getID()); if(tex) { - mTextureList.push_back(tex) ;//increase the reference number by one for tex to avoid deleting it. - return ; + mTextureList.push_back(tex);//increase the reference number by one for tex to avoid deleting it. + return; } } //check if it is a parcel media if(facep->getTexture() && facep->getTexture() != this && facep->getTexture()->getID() == mID) { - mTextureList.push_back(facep->getTexture()) ; //a parcel media. - return ; + mTextureList.push_back(facep->getTexture()); //a parcel media. + return; } if(te && te->getID().notNull()) //should have a texture { - llerrs << "The face does not have a valid texture before media texture." << llendl ; + LL_ERRS() << "The face does not have a valid texture before media texture." << LL_ENDL; } } //virtual void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) { - LLViewerTexture::removeFace(ch, facep) ; + LLViewerTexture::removeFace(ch, facep); - const LLTextureEntry* te = facep->getTextureEntry() ; + const LLTextureEntry* te = facep->getTextureEntry(); if(te && te->getID().notNull()) { - LLViewerTexture* tex = gTextureList.findImage(te->getID()) ; + LLViewerTexture* tex = gTextureList.findImage(te->getID()); if(tex) { for(std::list< LLPointer<LLViewerTexture> >::iterator iter = mTextureList.begin(); @@ -3275,8 +3310,8 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) { if(*iter == tex) { - mTextureList.erase(iter) ; //decrease the reference number for tex by one. - return ; + mTextureList.erase(iter); //decrease the reference number for tex by one. + return; } } @@ -3284,13 +3319,13 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) for (U32 ch = 0; ch < 3; ++ch) { - // - //we have some trouble here: the texture of the face is changed. - //we need to find the former texture, and remove it from the list to avoid memory leaking. + // + //we have some trouble here: the texture of the face is changed. + //we need to find the former texture, and remove it from the list to avoid memory leaking. llassert(mNumFaces[ch] <= mFaceList[ch].size()); - for(U32 j = 0 ; j < mNumFaces[ch] ; j++) + for(U32 j = 0; j < mNumFaces[ch]; j++) { te_list.push_back(mFaceList[ch][j]->getTextureEntry());//all textures are in use. } @@ -3298,8 +3333,8 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) if (te_list.empty()) { - mTextureList.clear() ; - return ; + mTextureList.clear(); + return; } S32 end = te_list.size(); @@ -3309,18 +3344,18 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) { S32 i = 0; - for(i = 0 ; i < end ; i++) + for(i = 0; i < end; i++) { if(te_list[i] && te_list[i]->getID() == (*iter)->getID())//the texture is in use. { - te_list[i] = NULL ; - break ; + te_list[i] = NULL; + break; } } if(i == end) //no hit for this texture, remove it. { - mTextureList.erase(iter) ; //decrease the reference number for tex by one. - return ; + mTextureList.erase(iter); //decrease the reference number for tex by one. + return; } } } @@ -3332,14 +3367,14 @@ void LLViewerMediaTexture::removeFace(U32 ch, LLFace* facep) { if((*iter)->getID() == mID) { - mTextureList.erase(iter) ; //decrease the reference number for tex by one. - return ; + mTextureList.erase(iter); //decrease the reference number for tex by one. + return; } } if(te && te->getID().notNull()) //should have a texture { - llerrs << "mTextureList texture reference number is corrupted." << llendl ; + LL_ERRS() << "mTextureList texture reference number is corrupted." << LL_ENDL; } } @@ -3348,9 +3383,9 @@ void LLViewerMediaTexture::stopPlaying() // Don't stop the media impl playing here -- this breaks non-inworld media (login screen, search, and media browser). // if(mMediaImplp) // { -// mMediaImplp->stop() ; +// mMediaImplp->stop(); // } - mIsPlaying = FALSE ; + mIsPlaying = FALSE; } void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep) @@ -3363,29 +3398,29 @@ void LLViewerMediaTexture::switchTexture(U32 ch, LLFace* facep) { if(mID == facep->getTexture()->getID()) //this is a parcel media { - return ; //let the prim media win. + return; //let the prim media win. } } if(mIsPlaying) //old textures switch to the media texture { - facep->switchTexture(ch, this) ; + facep->switchTexture(ch, this); } else //switch to old textures. { - const LLTextureEntry* te = facep->getTextureEntry() ; + const LLTextureEntry* te = facep->getTextureEntry(); if(te) { - LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL ; + LLViewerTexture* tex = te->getID().notNull() ? gTextureList.findImage(te->getID()) : NULL; if(!tex && te->getID() != mID)//try parcel media. { - tex = gTextureList.findImage(mID) ; + tex = gTextureList.findImage(mID); } if(!tex) { - tex = LLViewerFetchedTexture::sDefaultImagep ; + tex = LLViewerFetchedTexture::sDefaultImagep; } - facep->switchTexture(ch, tex) ; + facep->switchTexture(ch, tex); } } } @@ -3395,36 +3430,36 @@ void LLViewerMediaTexture::setPlaying(BOOL playing) { if(!mMediaImplp) { - return ; + return; } if(!playing && !mIsPlaying) { - return ; //media is already off + return; //media is already off } if(playing == mIsPlaying && !mMediaImplp->isUpdated()) { - return ; //nothing has changed since last time. + return; //nothing has changed since last time. } - mIsPlaying = playing ; + mIsPlaying = playing; if(mIsPlaying) //is about to play this media { if(findFaces()) { //about to update all faces. - mMediaImplp->setUpdated(FALSE) ; + mMediaImplp->setUpdated(FALSE); } if(mMediaFaceList.empty())//no face pointing to this media { - stopPlaying() ; - return ; + stopPlaying(); + return; } for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter) { - switchTexture(LLRender::DIFFUSE_MAP, *iter) ; + switchTexture(LLRender::DIFFUSE_MAP, *iter); } } else //stop playing this media @@ -3432,12 +3467,12 @@ void LLViewerMediaTexture::setPlaying(BOOL playing) U32 ch = LLRender::DIFFUSE_MAP; llassert(mNumFaces[ch] <= mFaceList[ch].size()); - for(U32 i = mNumFaces[ch] ; i ; i--) + for(U32 i = mNumFaces[ch]; i; i--) { - switchTexture(ch, mFaceList[ch][i - 1]) ; //current face could be removed in this function. + switchTexture(ch, mFaceList[ch][i - 1]); //current face could be removed in this function. } } - return ; + return; } //virtual @@ -3445,13 +3480,13 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() { if(LLFrameTimer::getFrameCount() == mUpdateVirtualSizeTime) { - return mMaxVirtualSize ; + return mMaxVirtualSize; } - mUpdateVirtualSizeTime = LLFrameTimer::getFrameCount() ; + mUpdateVirtualSizeTime = LLFrameTimer::getFrameCount(); if(!mMaxVirtualSizeResetCounter) { - addTextureStats(0.f, FALSE) ;//reset + addTextureStats(0.f, FALSE);//reset } if(mIsPlaying) //media is playing @@ -3459,28 +3494,28 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() for (U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch) { llassert(mNumFaces[ch] <= mFaceList[ch].size()); - for(U32 i = 0 ; i < mNumFaces[ch] ; i++) + for(U32 i = 0; i < mNumFaces[ch]; i++) { - LLFace* facep = mFaceList[ch][i] ; - if(facep->getDrawable()->isRecentlyVisible()) - { - addTextureStats(facep->getVirtualSize()) ; - } - } - } + LLFace* facep = mFaceList[ch][i]; + if(facep->getDrawable()->isRecentlyVisible()) + { + addTextureStats(facep->getVirtualSize()); + } + } + } } else //media is not in playing { - findFaces() ; + findFaces(); if(!mMediaFaceList.empty()) { for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter) { - LLFace* facep = *iter ; + LLFace* facep = *iter; if(facep->getDrawable()->isRecentlyVisible()) { - addTextureStats(facep->getVirtualSize()) ; + addTextureStats(facep->getVirtualSize()); } } } @@ -3490,10 +3525,10 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() { mMaxVirtualSizeResetCounter--; } - reorganizeFaceList() ; + reorganizeFaceList(); reorganizeVolumeList(); - return mMaxVirtualSize ; + return mMaxVirtualSize; } //---------------------------------------------------------------------------------------------- //end of LLViewerMediaTexture @@ -3504,27 +3539,27 @@ F32 LLViewerMediaTexture::getMaxVirtualSize() //---------------------------------------------------------------------------------------------- LLTexturePipelineTester::LLTexturePipelineTester() : LLMetricPerformanceTesterWithSession(sTesterName) { - addMetric("TotalBytesLoaded") ; - addMetric("TotalBytesLoadedFromCache") ; - addMetric("TotalBytesLoadedForLargeImage") ; - addMetric("TotalBytesLoadedForSculpties") ; - addMetric("StartFetchingTime") ; - addMetric("TotalGrayTime") ; - addMetric("TotalStablizingTime") ; - addMetric("StartTimeLoadingSculpties") ; - addMetric("EndTimeLoadingSculpties") ; - - addMetric("Time") ; - addMetric("TotalBytesBound") ; - addMetric("TotalBytesBoundForLargeImage") ; - addMetric("PercentageBytesBound") ; + addMetric("TotalBytesLoaded"); + addMetric("TotalBytesLoadedFromCache"); + addMetric("TotalBytesLoadedForLargeImage"); + addMetric("TotalBytesLoadedForSculpties"); + addMetric("StartFetchingTime"); + addMetric("TotalGrayTime"); + addMetric("TotalStablizingTime"); + addMetric("StartTimeLoadingSculpties"); + addMetric("EndTimeLoadingSculpties"); + + addMetric("Time"); + addMetric("TotalBytesBound"); + addMetric("TotalBytesBoundForLargeImage"); + addMetric("PercentageBytesBound"); - mTotalBytesLoaded = 0 ; - mTotalBytesLoadedFromCache = 0 ; - mTotalBytesLoadedForLargeImage = 0 ; - mTotalBytesLoadedForSculpties = 0 ; + mTotalBytesLoaded = (S32Bytes)0; + mTotalBytesLoadedFromCache = (S32Bytes)0; + mTotalBytesLoadedForLargeImage = (S32Bytes)0; + mTotalBytesLoadedForSculpties = (S32Bytes)0; - reset() ; + reset(); } LLTexturePipelineTester::~LLTexturePipelineTester() @@ -3534,222 +3569,222 @@ LLTexturePipelineTester::~LLTexturePipelineTester() void LLTexturePipelineTester::update() { - mLastTotalBytesUsed = mTotalBytesUsed ; - mLastTotalBytesUsedForLargeImage = mTotalBytesUsedForLargeImage ; - mTotalBytesUsed = 0 ; - mTotalBytesUsedForLargeImage = 0 ; + mLastTotalBytesUsed = mTotalBytesUsed; + mLastTotalBytesUsedForLargeImage = mTotalBytesUsedForLargeImage; + mTotalBytesUsed = (S32Bytes)0; + mTotalBytesUsedForLargeImage = (S32Bytes)0; if(LLAppViewer::getTextureFetch()->getNumRequests() > 0) //fetching list is not empty { if(mPause) { //start a new fetching session - reset() ; - mStartFetchingTime = LLImageGL::sLastFrameTime ; - mPause = FALSE ; + reset(); + mStartFetchingTime = LLImageGL::sLastFrameTime; + mPause = FALSE; } //update total gray time if(mUsingDefaultTexture) { - mUsingDefaultTexture = FALSE ; - mTotalGrayTime = LLImageGL::sLastFrameTime - mStartFetchingTime ; + mUsingDefaultTexture = FALSE; + mTotalGrayTime = LLImageGL::sLastFrameTime - mStartFetchingTime; } //update the stablizing timer. - updateStablizingTime() ; + updateStablizingTime(); - outputTestResults() ; + outputTestResults(); } else if(!mPause) { //stop the current fetching session - mPause = TRUE ; - outputTestResults() ; - reset() ; + mPause = TRUE; + outputTestResults(); + reset(); } } void LLTexturePipelineTester::reset() { - mPause = TRUE ; + mPause = TRUE; - mUsingDefaultTexture = FALSE ; - mStartStablizingTime = 0.0f ; - mEndStablizingTime = 0.0f ; + mUsingDefaultTexture = FALSE; + mStartStablizingTime = 0.0f; + mEndStablizingTime = 0.0f; - mTotalBytesUsed = 0 ; - mTotalBytesUsedForLargeImage = 0 ; - mLastTotalBytesUsed = 0 ; - mLastTotalBytesUsedForLargeImage = 0 ; + mTotalBytesUsed = (S32Bytes)0; + mTotalBytesUsedForLargeImage = (S32Bytes)0; + mLastTotalBytesUsed = (S32Bytes)0; + mLastTotalBytesUsedForLargeImage = (S32Bytes)0; - mStartFetchingTime = 0.0f ; + mStartFetchingTime = 0.0f; - mTotalGrayTime = 0.0f ; - mTotalStablizingTime = 0.0f ; + mTotalGrayTime = 0.0f; + mTotalStablizingTime = 0.0f; - mStartTimeLoadingSculpties = 1.0f ; - mEndTimeLoadingSculpties = 0.0f ; + mStartTimeLoadingSculpties = 1.0f; + mEndTimeLoadingSculpties = 0.0f; } //virtual void LLTexturePipelineTester::outputTestRecord(LLSD *sd) { std::string currentLabel = getCurrentLabelName(); - (*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded ; - (*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache ; - (*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage ; - (*sd)[currentLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties ; + (*sd)[currentLabel]["TotalBytesLoaded"] = (LLSD::Integer)mTotalBytesLoaded.value(); + (*sd)[currentLabel]["TotalBytesLoadedFromCache"] = (LLSD::Integer)mTotalBytesLoadedFromCache.value(); + (*sd)[currentLabel]["TotalBytesLoadedForLargeImage"] = (LLSD::Integer)mTotalBytesLoadedForLargeImage.value(); + (*sd)[currentLabel]["TotalBytesLoadedForSculpties"] = (LLSD::Integer)mTotalBytesLoadedForSculpties.value(); - (*sd)[currentLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime ; - (*sd)[currentLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime ; - (*sd)[currentLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime ; + (*sd)[currentLabel]["StartFetchingTime"] = (LLSD::Real)mStartFetchingTime; + (*sd)[currentLabel]["TotalGrayTime"] = (LLSD::Real)mTotalGrayTime; + (*sd)[currentLabel]["TotalStablizingTime"] = (LLSD::Real)mTotalStablizingTime; - (*sd)[currentLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties ; - (*sd)[currentLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties ; + (*sd)[currentLabel]["StartTimeLoadingSculpties"] = (LLSD::Real)mStartTimeLoadingSculpties; + (*sd)[currentLabel]["EndTimeLoadingSculpties"] = (LLSD::Real)mEndTimeLoadingSculpties; - (*sd)[currentLabel]["Time"] = LLImageGL::sLastFrameTime ; - (*sd)[currentLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed ; - (*sd)[currentLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage ; - (*sd)[currentLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded) ; + (*sd)[currentLabel]["Time"] = LLImageGL::sLastFrameTime; + (*sd)[currentLabel]["TotalBytesBound"] = (LLSD::Integer)mLastTotalBytesUsed.value(); + (*sd)[currentLabel]["TotalBytesBoundForLargeImage"] = (LLSD::Integer)mLastTotalBytesUsedForLargeImage.value(); + (*sd)[currentLabel]["PercentageBytesBound"] = (LLSD::Real)(100.f * mLastTotalBytesUsed / mTotalBytesLoaded); } void LLTexturePipelineTester::updateTextureBindingStats(const LLViewerTexture* imagep) { - U32 mem_size = (U32)imagep->getTextureMemory() ; - mTotalBytesUsed += mem_size ; + U32Bytes mem_size = imagep->getTextureMemory(); + mTotalBytesUsed += mem_size; - if(MIN_LARGE_IMAGE_AREA <= (U32)(mem_size / (U32)imagep->getComponents())) + if(MIN_LARGE_IMAGE_AREA <= (U32)(mem_size.value() / (U32)imagep->getComponents())) { - mTotalBytesUsedForLargeImage += mem_size ; + mTotalBytesUsedForLargeImage += mem_size; } } void LLTexturePipelineTester::updateTextureLoadingStats(const LLViewerFetchedTexture* imagep, const LLImageRaw* raw_imagep, BOOL from_cache) { - U32 data_size = (U32)raw_imagep->getDataSize() ; - mTotalBytesLoaded += data_size ; + U32Bytes data_size = (U32Bytes)raw_imagep->getDataSize(); + mTotalBytesLoaded += data_size; if(from_cache) { - mTotalBytesLoadedFromCache += data_size ; + mTotalBytesLoadedFromCache += data_size; } - if(MIN_LARGE_IMAGE_AREA <= (U32)(data_size / (U32)raw_imagep->getComponents())) + if(MIN_LARGE_IMAGE_AREA <= (U32)(data_size.value() / (U32)raw_imagep->getComponents())) { - mTotalBytesLoadedForLargeImage += data_size ; + mTotalBytesLoadedForLargeImage += data_size; } if(imagep->forSculpt()) { - mTotalBytesLoadedForSculpties += data_size ; + mTotalBytesLoadedForSculpties += data_size; if(mStartTimeLoadingSculpties > mEndTimeLoadingSculpties) { - mStartTimeLoadingSculpties = LLImageGL::sLastFrameTime ; + mStartTimeLoadingSculpties = LLImageGL::sLastFrameTime; } - mEndTimeLoadingSculpties = LLImageGL::sLastFrameTime ; + mEndTimeLoadingSculpties = LLImageGL::sLastFrameTime; } } void LLTexturePipelineTester::updateGrayTextureBinding() { - mUsingDefaultTexture = TRUE ; + mUsingDefaultTexture = TRUE; } void LLTexturePipelineTester::setStablizingTime() { if(mStartStablizingTime <= mStartFetchingTime) { - mStartStablizingTime = LLImageGL::sLastFrameTime ; + mStartStablizingTime = LLImageGL::sLastFrameTime; } - mEndStablizingTime = LLImageGL::sLastFrameTime ; + mEndStablizingTime = LLImageGL::sLastFrameTime; } void LLTexturePipelineTester::updateStablizingTime() { if(mStartStablizingTime > mStartFetchingTime) { - F32 t = mEndStablizingTime - mStartStablizingTime ; + F32 t = mEndStablizingTime - mStartStablizingTime; if(t > F_ALMOST_ZERO && (t - mTotalStablizingTime) < F_ALMOST_ZERO) { //already stablized - mTotalStablizingTime = LLImageGL::sLastFrameTime - mStartStablizingTime ; + mTotalStablizingTime = LLImageGL::sLastFrameTime - mStartStablizingTime; //cancel the timer - mStartStablizingTime = 0.f ; - mEndStablizingTime = 0.f ; + mStartStablizingTime = 0.f; + mEndStablizingTime = 0.f; } else { - mTotalStablizingTime = t ; + mTotalStablizingTime = t; } } - mTotalStablizingTime = 0.f ; + mTotalStablizingTime = 0.f; } //virtual void LLTexturePipelineTester::compareTestSessions(std::ofstream* os) { - LLTexturePipelineTester::LLTextureTestSession* base_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mBaseSessionp) ; - LLTexturePipelineTester::LLTextureTestSession* current_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mCurrentSessionp) ; + LLTexturePipelineTester::LLTextureTestSession* base_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mBaseSessionp); + LLTexturePipelineTester::LLTextureTestSession* current_sessionp = dynamic_cast<LLTexturePipelineTester::LLTextureTestSession*>(mCurrentSessionp); if(!base_sessionp || !current_sessionp) { - llerrs << "type of test session does not match!" << llendl ; + LL_ERRS() << "type of test session does not match!" << LL_ENDL; } //compare and output the comparison - *os << llformat("%s\n", getTesterName().c_str()) ; - *os << llformat("AggregateResults\n") ; + *os << llformat("%s\n", getTesterName().c_str()); + *os << llformat("AggregateResults\n"); - compareTestResults(os, "TotalFetchingTime", base_sessionp->mTotalFetchingTime, current_sessionp->mTotalFetchingTime) ; - compareTestResults(os, "TotalGrayTime", base_sessionp->mTotalGrayTime, current_sessionp->mTotalGrayTime) ; + compareTestResults(os, "TotalFetchingTime", base_sessionp->mTotalFetchingTime, current_sessionp->mTotalFetchingTime); + compareTestResults(os, "TotalGrayTime", base_sessionp->mTotalGrayTime, current_sessionp->mTotalGrayTime); compareTestResults(os, "TotalStablizingTime", base_sessionp->mTotalStablizingTime, current_sessionp->mTotalStablizingTime); - compareTestResults(os, "StartTimeLoadingSculpties", base_sessionp->mStartTimeLoadingSculpties, current_sessionp->mStartTimeLoadingSculpties) ; - compareTestResults(os, "TotalTimeLoadingSculpties", base_sessionp->mTotalTimeLoadingSculpties, current_sessionp->mTotalTimeLoadingSculpties) ; + compareTestResults(os, "StartTimeLoadingSculpties", base_sessionp->mStartTimeLoadingSculpties, current_sessionp->mStartTimeLoadingSculpties); + compareTestResults(os, "TotalTimeLoadingSculpties", base_sessionp->mTotalTimeLoadingSculpties, current_sessionp->mTotalTimeLoadingSculpties); - compareTestResults(os, "TotalBytesLoaded", base_sessionp->mTotalBytesLoaded, current_sessionp->mTotalBytesLoaded) ; - compareTestResults(os, "TotalBytesLoadedFromCache", base_sessionp->mTotalBytesLoadedFromCache, current_sessionp->mTotalBytesLoadedFromCache) ; - compareTestResults(os, "TotalBytesLoadedForLargeImage", base_sessionp->mTotalBytesLoadedForLargeImage, current_sessionp->mTotalBytesLoadedForLargeImage) ; - compareTestResults(os, "TotalBytesLoadedForSculpties", base_sessionp->mTotalBytesLoadedForSculpties, current_sessionp->mTotalBytesLoadedForSculpties) ; + compareTestResults(os, "TotalBytesLoaded", base_sessionp->mTotalBytesLoaded, current_sessionp->mTotalBytesLoaded); + compareTestResults(os, "TotalBytesLoadedFromCache", base_sessionp->mTotalBytesLoadedFromCache, current_sessionp->mTotalBytesLoadedFromCache); + compareTestResults(os, "TotalBytesLoadedForLargeImage", base_sessionp->mTotalBytesLoadedForLargeImage, current_sessionp->mTotalBytesLoadedForLargeImage); + compareTestResults(os, "TotalBytesLoadedForSculpties", base_sessionp->mTotalBytesLoadedForSculpties, current_sessionp->mTotalBytesLoadedForSculpties); - *os << llformat("InstantResults\n") ; - S32 size = llmin(base_sessionp->mInstantPerformanceListCounter, current_sessionp->mInstantPerformanceListCounter) ; - for(S32 i = 0 ; i < size ; i++) + *os << llformat("InstantResults\n"); + S32 size = llmin(base_sessionp->mInstantPerformanceListCounter, current_sessionp->mInstantPerformanceListCounter); + for(S32 i = 0; i < size; i++) { - *os << llformat("Time(B-T)-%.4f-%.4f\n", base_sessionp->mInstantPerformanceList[i].mTime, current_sessionp->mInstantPerformanceList[i].mTime) ; + *os << llformat("Time(B-T)-%.4f-%.4f\n", base_sessionp->mInstantPerformanceList[i].mTime, current_sessionp->mInstantPerformanceList[i].mTime); compareTestResults(os, "AverageBytesUsedPerSecond", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond, - current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond) ; + current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond); compareTestResults(os, "AverageBytesUsedForLargeImagePerSecond", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond, - current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond) ; + current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond); compareTestResults(os, "AveragePercentageBytesUsedPerSecond", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond, - current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond) ; + current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond); } if(size < base_sessionp->mInstantPerformanceListCounter) { - for(S32 i = size ; i < base_sessionp->mInstantPerformanceListCounter ; i++) + for(S32 i = size; i < base_sessionp->mInstantPerformanceListCounter; i++) { - *os << llformat("Time(B-T)-%.4f- \n", base_sessionp->mInstantPerformanceList[i].mTime) ; + *os << llformat("Time(B-T)-%.4f- \n", base_sessionp->mInstantPerformanceList[i].mTime); - *os << llformat(", AverageBytesUsedPerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond) ; - *os << llformat(", AverageBytesUsedForLargeImagePerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond) ; - *os << llformat(", AveragePercentageBytesUsedPerSecond, %.4f, N/A \n", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond) ; + *os << llformat(", AverageBytesUsedPerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond); + *os << llformat(", AverageBytesUsedForLargeImagePerSecond, %d, N/A \n", base_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond); + *os << llformat(", AveragePercentageBytesUsedPerSecond, %.4f, N/A \n", base_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond); } } else if(size < current_sessionp->mInstantPerformanceListCounter) { - for(S32 i = size ; i < current_sessionp->mInstantPerformanceListCounter ; i++) + for(S32 i = size; i < current_sessionp->mInstantPerformanceListCounter; i++) { - *os << llformat("Time(B-T)- -%.4f\n", current_sessionp->mInstantPerformanceList[i].mTime) ; + *os << llformat("Time(B-T)- -%.4f\n", current_sessionp->mInstantPerformanceList[i].mTime); - *os << llformat(", AverageBytesUsedPerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond) ; - *os << llformat(", AverageBytesUsedForLargeImagePerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond) ; - *os << llformat(", AveragePercentageBytesUsedPerSecond, N/A, %.4f\n", current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond) ; + *os << llformat(", AverageBytesUsedPerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedPerSecond); + *os << llformat(", AverageBytesUsedForLargeImagePerSecond, N/A, %d\n", current_sessionp->mInstantPerformanceList[i].mAverageBytesUsedForLargeImagePerSecond); + *os << llformat(", AveragePercentageBytesUsedPerSecond, N/A, %.4f\n", current_sessionp->mInstantPerformanceList[i].mAveragePercentageBytesUsedPerSecond); } } } @@ -3757,144 +3792,144 @@ void LLTexturePipelineTester::compareTestSessions(std::ofstream* os) //virtual LLMetricPerformanceTesterWithSession::LLTestSession* LLTexturePipelineTester::loadTestSession(LLSD* log) { - LLTexturePipelineTester::LLTextureTestSession* sessionp = new LLTexturePipelineTester::LLTextureTestSession() ; + LLTexturePipelineTester::LLTextureTestSession* sessionp = new LLTexturePipelineTester::LLTextureTestSession(); if(!sessionp) { - return NULL ; + return NULL; } - F32 total_fetching_time = 0.f ; - F32 total_gray_time = 0.f ; - F32 total_stablizing_time = 0.f ; - F32 total_loading_sculpties_time = 0.f ; - - F32 start_fetching_time = -1.f ; - F32 start_fetching_sculpties_time = 0.f ; - - F32 last_time = 0.0f ; - S32 frame_count = 0 ; - - sessionp->mInstantPerformanceListCounter = 0 ; - sessionp->mInstantPerformanceList.resize(128) ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0 ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0 ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ; + F32 total_fetching_time = 0.f; + F32 total_gray_time = 0.f; + F32 total_stablizing_time = 0.f; + F32 total_loading_sculpties_time = 0.f; + + F32 start_fetching_time = -1.f; + F32 start_fetching_sculpties_time = 0.f; + + F32 last_time = 0.0f; + S32 frame_count = 0; + + sessionp->mInstantPerformanceListCounter = 0; + sessionp->mInstantPerformanceList.resize(128); + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f; //load a session std::string currentLabel = getCurrentLabelName(); - BOOL in_log = (*log).has(currentLabel) ; + BOOL in_log = (*log).has(currentLabel); while (in_log) { - LLSD::String label = currentLabel ; + LLSD::String label = currentLabel; if(sessionp->mInstantPerformanceListCounter >= (S32)sessionp->mInstantPerformanceList.size()) { - sessionp->mInstantPerformanceList.resize(sessionp->mInstantPerformanceListCounter + 128) ; + sessionp->mInstantPerformanceList.resize(sessionp->mInstantPerformanceListCounter + 128); } //time - F32 start_time = (*log)[label]["StartFetchingTime"].asReal() ; - F32 cur_time = (*log)[label]["Time"].asReal() ; + F32 start_time = (*log)[label]["StartFetchingTime"].asReal(); + F32 cur_time = (*log)[label]["Time"].asReal(); if(start_time - start_fetching_time > F_ALMOST_ZERO) //fetching has paused for a while { - sessionp->mTotalFetchingTime += total_fetching_time ; - sessionp->mTotalGrayTime += total_gray_time ; - sessionp->mTotalStablizingTime += total_stablizing_time ; + sessionp->mTotalFetchingTime += total_fetching_time; + sessionp->mTotalGrayTime += total_gray_time; + sessionp->mTotalStablizingTime += total_stablizing_time; - sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time ; - sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time ; + sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time; + sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time; - start_fetching_time = start_time ; - total_fetching_time = 0.0f ; - total_gray_time = 0.f ; - total_stablizing_time = 0.f ; - total_loading_sculpties_time = 0.f ; + start_fetching_time = start_time; + total_fetching_time = 0.0f; + total_gray_time = 0.f; + total_stablizing_time = 0.f; + total_loading_sculpties_time = 0.f; } else { - total_fetching_time = cur_time - start_time ; - total_gray_time = (*log)[label]["TotalGrayTime"].asReal() ; - total_stablizing_time = (*log)[label]["TotalStablizingTime"].asReal() ; + total_fetching_time = cur_time - start_time; + total_gray_time = (*log)[label]["TotalGrayTime"].asReal(); + total_stablizing_time = (*log)[label]["TotalStablizingTime"].asReal(); - total_loading_sculpties_time = (*log)[label]["EndTimeLoadingSculpties"].asReal() - (*log)[label]["StartTimeLoadingSculpties"].asReal() ; + total_loading_sculpties_time = (*log)[label]["EndTimeLoadingSculpties"].asReal() - (*log)[label]["StartTimeLoadingSculpties"].asReal(); if(start_fetching_sculpties_time < 0.f && total_loading_sculpties_time > 0.f) { - start_fetching_sculpties_time = (*log)[label]["StartTimeLoadingSculpties"].asReal() ; + start_fetching_sculpties_time = (*log)[label]["StartTimeLoadingSculpties"].asReal(); } } //total loaded bytes - sessionp->mTotalBytesLoaded = (*log)[label]["TotalBytesLoaded"].asInteger() ; - sessionp->mTotalBytesLoadedFromCache = (*log)[label]["TotalBytesLoadedFromCache"].asInteger() ; - sessionp->mTotalBytesLoadedForLargeImage = (*log)[label]["TotalBytesLoadedForLargeImage"].asInteger() ; - sessionp->mTotalBytesLoadedForSculpties = (*log)[label]["TotalBytesLoadedForSculpties"].asInteger() ; + sessionp->mTotalBytesLoaded = (*log)[label]["TotalBytesLoaded"].asInteger(); + sessionp->mTotalBytesLoadedFromCache = (*log)[label]["TotalBytesLoadedFromCache"].asInteger(); + sessionp->mTotalBytesLoadedForLargeImage = (*log)[label]["TotalBytesLoadedForLargeImage"].asInteger(); + sessionp->mTotalBytesLoadedForSculpties = (*log)[label]["TotalBytesLoadedForSculpties"].asInteger(); //instant metrics sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond += - (*log)[label]["TotalBytesBound"].asInteger() ; + (*log)[label]["TotalBytesBound"].asInteger(); sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond += - (*log)[label]["TotalBytesBoundForLargeImage"].asInteger() ; + (*log)[label]["TotalBytesBoundForLargeImage"].asInteger(); sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond += - (*log)[label]["PercentageBytesBound"].asReal() ; - frame_count++ ; + (*log)[label]["PercentageBytesBound"].asReal(); + frame_count++; if(cur_time - last_time >= 1.0f) { - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond /= frame_count ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond /= frame_count ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond /= frame_count ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = last_time ; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond /= frame_count; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond /= frame_count; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond /= frame_count; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = last_time; - frame_count = 0 ; - last_time = cur_time ; - sessionp->mInstantPerformanceListCounter++ ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0 ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0 ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f ; - sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f ; + frame_count = 0; + last_time = cur_time; + sessionp->mInstantPerformanceListCounter++; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedPerSecond = 0; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAverageBytesUsedForLargeImagePerSecond = 0; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mAveragePercentageBytesUsedPerSecond = 0.f; + sessionp->mInstantPerformanceList[sessionp->mInstantPerformanceListCounter].mTime = 0.f; } // Next label - incrementCurrentCount() ; + incrementCurrentCount(); currentLabel = getCurrentLabelName(); - in_log = (*log).has(currentLabel) ; + in_log = (*log).has(currentLabel); } - sessionp->mTotalFetchingTime += total_fetching_time ; - sessionp->mTotalGrayTime += total_gray_time ; - sessionp->mTotalStablizingTime += total_stablizing_time ; + sessionp->mTotalFetchingTime += total_fetching_time; + sessionp->mTotalGrayTime += total_gray_time; + sessionp->mTotalStablizingTime += total_stablizing_time; if(sessionp->mStartTimeLoadingSculpties < 0.f) { - sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time ; + sessionp->mStartTimeLoadingSculpties = start_fetching_sculpties_time; } - sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time ; + sessionp->mTotalTimeLoadingSculpties += total_loading_sculpties_time; return sessionp; } LLTexturePipelineTester::LLTextureTestSession::LLTextureTestSession() { - reset() ; + reset(); } LLTexturePipelineTester::LLTextureTestSession::~LLTextureTestSession() { } void LLTexturePipelineTester::LLTextureTestSession::reset() { - mTotalFetchingTime = 0.0f ; + mTotalFetchingTime = 0.0f; - mTotalGrayTime = 0.0f ; - mTotalStablizingTime = 0.0f ; + mTotalGrayTime = 0.0f; + mTotalStablizingTime = 0.0f; - mStartTimeLoadingSculpties = 0.0f ; - mTotalTimeLoadingSculpties = 0.0f ; + mStartTimeLoadingSculpties = 0.0f; + mTotalTimeLoadingSculpties = 0.0f; - mTotalBytesLoaded = 0 ; - mTotalBytesLoadedFromCache = 0 ; - mTotalBytesLoadedForLargeImage = 0 ; - mTotalBytesLoadedForSculpties = 0 ; + mTotalBytesLoaded = 0; + mTotalBytesLoadedFromCache = 0; + mTotalBytesLoadedForLargeImage = 0; + mTotalBytesLoadedForSculpties = 0; - mInstantPerformanceListCounter = 0 ; + mInstantPerformanceListCounter = 0; } //---------------------------------------------------------------------------------------------- //end of LLTexturePipelineTester diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 10101a4b9b7ce70cd61ca834f869892ecdf9e22b..b12b988513c34d4c3117d22a7e3782ae3edf0a82 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -34,13 +34,12 @@ #include "llgltypes.h" #include "llrender.h" #include "llmetricperformancetester.h" -#include "llface.h" #include <map> #include <list> -#define MIN_VIDEO_RAM_IN_MEGA_BYTES 32 -#define MAX_VIDEO_RAM_IN_MEGA_BYTES 512 // 512MB max for performance reasons. +extern const S32Megabytes gMinVideoRam; +extern const S32Megabytes gMaxVideoRam; class LLImageGL ; class LLImageRaw; @@ -101,8 +100,7 @@ class LLViewerTexture : public LLGLTexture INVALID_TEXTURE_TYPE }; - - typedef std::vector<LLFace*> ll_face_list_t; + typedef std::vector<class LLFace*> ll_face_list_t; typedef std::vector<LLVOVolume*> ll_volume_list_t; @@ -121,10 +119,12 @@ class LLViewerTexture : public LLGLTexture virtual S8 getType() const; virtual BOOL isMissingAsset()const ; - virtual void dump(); // debug info to llinfos + virtual void dump(); // debug info to LL_INFOS() /*virtual*/ bool bindDefaultImage(const S32 stage = 0) ; + /*virtual*/ bool bindDebugImage(const S32 stage = 0) ; /*virtual*/ void forceImmediateUpdate() ; + /*virtual*/ bool isActiveFetching(); /*virtual*/ const LLUUID& getID() const { return mID; } void setBoostLevel(S32 level); @@ -205,11 +205,11 @@ class LLViewerTexture : public LLGLTexture static LLFrameTimer sEvaluationTimer; static F32 sDesiredDiscardBias; static F32 sDesiredDiscardScale; - static S32 sBoundTextureMemoryInBytes; - static S32 sTotalTextureMemoryInBytes; - static S32 sMaxBoundTextureMemInMegaBytes; - static S32 sMaxTotalTextureMemInMegaBytes; - static S32 sMaxDesiredTextureMemInBytes ; + static S32Bytes sBoundTextureMemory; + static S32Bytes sTotalTextureMemory; + static S32Megabytes sMaxBoundTextureMem; + static S32Megabytes sMaxTotalTextureMem; + static S32Bytes sMaxDesiredTextureMem ; static S8 sCameraMovingDiscardBias; static F32 sCameraMovingBias; static S32 sMaxSculptRez ; @@ -217,7 +217,7 @@ class LLViewerTexture : public LLGLTexture static S32 sMaxSmallImageSize ; static BOOL sFreezeImageScalingDown ;//do not scale down image res if set. static F32 sCurrentTime ; - + enum EDebugTexels { DEBUG_TEXELS_OFF, @@ -397,12 +397,15 @@ class LLViewerFetchedTexture : public LLViewerTexture void loadFromFastCache(); void setInFastCacheList(bool in_list) { mInFastCacheList = in_list; } bool isInFastCacheList() { return mInFastCacheList; } + + /*virtual*/bool isActiveFetching(); //is actively in fetching by the fetching pipeline. + protected: /*virtual*/ void switchToCachedImage(); S32 getCurrentDiscardLevelForFetching() ; private: - void init(bool firstinit) ; + void init(bool firstinit) ; void cleanup() ; void saveRawImage() ; @@ -444,7 +447,7 @@ class LLViewerFetchedTexture : public LLViewerTexture S8 mHasFetcher; // We've made a fecth request S8 mIsFetching; // Fetch request is active bool mCanUseHTTP ; //This texture can be fetched through http if true. - + FTType mFTType; // What category of image is this - map tile, server bake, etc? mutable S8 mIsMissingAsset; // True if we know that there is no image asset with this image id in the database. @@ -687,18 +690,18 @@ class LLTexturePipelineTester : public LLMetricPerformanceTesterWithSession private: BOOL mUsingDefaultTexture; //if set, some textures are still gray. - U32 mTotalBytesUsed ; //total bytes of textures bound/used for the current frame. - U32 mTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the current frame for images larger than 256 * 256. - U32 mLastTotalBytesUsed ; //total bytes of textures bound/used for the previous frame. - U32 mLastTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the previous frame for images larger than 256 * 256. + U32Bytes mTotalBytesUsed ; //total bytes of textures bound/used for the current frame. + U32Bytes mTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the current frame for images larger than 256 * 256. + U32Bytes mLastTotalBytesUsed ; //total bytes of textures bound/used for the previous frame. + U32Bytes mLastTotalBytesUsedForLargeImage ; //total bytes of textures bound/used for the previous frame for images larger than 256 * 256. // //data size // - U32 mTotalBytesLoaded ; //total bytes fetched by texture pipeline - U32 mTotalBytesLoadedFromCache ; //total bytes fetched by texture pipeline from local cache - U32 mTotalBytesLoadedForLargeImage ; //total bytes fetched by texture pipeline for images larger than 256 * 256. - U32 mTotalBytesLoadedForSculpties ; //total bytes fetched by texture pipeline for sculpties + U32Bytes mTotalBytesLoaded ; //total bytes fetched by texture pipeline + U32Bytes mTotalBytesLoadedFromCache ; //total bytes fetched by texture pipeline from local cache + U32Bytes mTotalBytesLoadedForLargeImage ; //total bytes fetched by texture pipeline for images larger than 256 * 256. + U32Bytes mTotalBytesLoadedForSculpties ; //total bytes fetched by texture pipeline for sculpties // //time diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 783d1f220226e005091ffcbb96fb694f57214775..b98726900f8cc345bd24731b2cc51028c04cd54f 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -30,7 +30,6 @@ #include "llviewertexturelist.h" -#include "imageids.h" #include "llgl.h" // fot gathering stats from GL #include "llimagegl.h" #include "llimagebmp.h" @@ -58,24 +57,19 @@ #include "pipeline.h" #include "llappviewer.h" #include "llxuiparser.h" +#include "lltracerecording.h" #include "llviewerdisplay.h" - +#include "llviewerwindow.h" +#include "llprogressview.h" //////////////////////////////////////////////////////////////////////////// void (*LLViewerTextureList::sUUIDCallback)(void **, const LLUUID&) = NULL; -U32 LLViewerTextureList::sTextureBits = 0; -U32 LLViewerTextureList::sTexturePackets = 0; S32 LLViewerTextureList::sNumImages = 0; -LLStat LLViewerTextureList::sNumImagesStat("Num Images", 32, TRUE); -LLStat LLViewerTextureList::sNumRawImagesStat("Num Raw Images", 32, TRUE); -LLStat LLViewerTextureList::sGLTexMemStat("GL Texture Mem", 32, TRUE); -LLStat LLViewerTextureList::sGLBoundMemStat("GL Bound Mem", 32, TRUE); -LLStat LLViewerTextureList::sRawMemStat("Raw Image Mem", 32, TRUE); -LLStat LLViewerTextureList::sFormattedMemStat("Formatted Image Mem", 32, TRUE); LLViewerTextureList gTextureList; -static LLFastTimer::DeclareTimer FTM_PROCESS_IMAGES("Process Images"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_IMAGES("Process Images"); + /////////////////////////////////////////////////////////////////////////////// @@ -93,11 +87,11 @@ void LLViewerTextureList::init() mInitialized = TRUE ; sNumImages = 0; mUpdateStats = TRUE; - mMaxResidentTexMemInMegaBytes = 0; - mMaxTotalTextureMemInMegaBytes = 0 ; + mMaxResidentTexMemInMegaBytes = (U32Bytes)0; + mMaxTotalTextureMemInMegaBytes = (U32Bytes)0; // Update how much texture RAM we're allowed to use. - updateMaxResidentTexMem(0); // 0 = use current + updateMaxResidentTexMem(S32Megabytes(0)); // 0 = use current doPreloadImages(); } @@ -292,18 +286,18 @@ void LLViewerTextureList::shutdown() void LLViewerTextureList::dump() { - llinfos << "LLViewerTextureList::dump()" << llendl; + LL_INFOS() << "LLViewerTextureList::dump()" << LL_ENDL; for (image_priority_list_t::iterator it = mImageList.begin(); it != mImageList.end(); ++it) { LLViewerFetchedTexture* image = *it; - llinfos << "priority " << image->getDecodePriority() + LL_INFOS() << "priority " << image->getDecodePriority() << " boost " << image->getBoostLevel() << " size " << image->getWidth() << "x" << image->getHeight() << " discard " << image->getDiscardLevel() << " desired " << image->getDesiredDiscardLevel() << " http://asset.siva.lindenlab.com/" << image->getID() << ".texture" - << llendl; + << LL_ENDL; } } @@ -327,7 +321,7 @@ void LLViewerTextureList::restoreGL() /////////////////////////////////////////////////////////////////////////////// -LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& filename, +LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& filename, FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, @@ -344,7 +338,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromFile(const std::string& std::string full_path = gDirUtilp->findSkinnedFilename("textures", filename); if (full_path.empty()) { - llwarns << "Failed to find local image file: " << filename << llendl; + LL_WARNS() << "Failed to find local image file: " << filename << LL_ENDL; return LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); } @@ -379,13 +373,13 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& } LLPointer<LLViewerFetchedTexture> imagep = findImage(new_id); - + if (!imagep.isNull()) { LLViewerFetchedTexture *texture = imagep.get(); if (texture->getUrl().empty()) { - llwarns << "Requested texture " << new_id << " already exists but does not have a URL" << llendl; + LL_WARNS() << "Requested texture " << new_id << " already exists but does not have a URL" << LL_ENDL; } else if (texture->getUrl() != url) { @@ -393,7 +387,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& // e.g. could be two avatars wearing the same outfit. LL_DEBUGS("Avatar") << "Requested texture " << new_id << " already exists with a different url, requested: " << url - << " current: " << texture->getUrl() << llendl; + << " current: " << texture->getUrl() << LL_ENDL; } } @@ -408,7 +402,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& imagep = new LLViewerLODTexture(url, f_type, new_id, usemipmaps); break ; default: - llerrs << "Invalid texture type " << texture_type << llendl ; + LL_ERRS() << "Invalid texture type " << texture_type << LL_ENDL ; } if (internal_format && primary_format) @@ -435,7 +429,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& } -LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, +LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, @@ -465,20 +459,20 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, if (request_from_host.isOk() && !texture->getTargetHost().isOk()) { - llwarns << "Requested texture " << image_id << " already exists but does not have a host" << llendl; + LL_WARNS() << "Requested texture " << image_id << " already exists but does not have a host" << LL_ENDL; } else if (request_from_host.isOk() && texture->getTargetHost().isOk() && request_from_host != texture->getTargetHost()) { - llwarns << "Requested texture " << image_id << " already exists with a different target host, requested: " - << request_from_host << " current: " << texture->getTargetHost() << llendl; + LL_WARNS() << "Requested texture " << image_id << " already exists with a different target host, requested: " + << request_from_host << " current: " << texture->getTargetHost() << LL_ENDL; } if (f_type != FTT_DEFAULT && imagep->getFTType() != f_type) { - llwarns << "FTType mismatch: requested " << f_type << " image has " << imagep->getFTType() << llendl; + LL_WARNS() << "FTType mismatch: requested " << f_type << " image has " << imagep->getFTType() << LL_ENDL; } - + } if (imagep.isNull()) { @@ -491,7 +485,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, } //when this function is called, there is no such texture in the gTextureList with image_id. -LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, +LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, FTType f_type, BOOL usemipmaps, LLViewerTexture::EBoostLevel boost_priority, @@ -512,7 +506,7 @@ LLViewerFetchedTexture* LLViewerTextureList::createImage(const LLUUID &image_id, imagep = new LLViewerLODTexture(image_id, f_type, request_from_host, usemipmaps); break ; default: - llerrs << "Invalid texture type " << texture_type << llendl ; + LL_ERRS() << "Invalid texture type " << texture_type << LL_ENDL ; } if (internal_format && primary_format) @@ -562,13 +556,13 @@ void LLViewerTextureList::addImageToList(LLViewerFetchedTexture *image) llassert(image); if (image->isInImageList()) { // Flag is already set? - llwarns << "LLViewerTextureList::addImageToList - image " << image->getID() << " already in list" << llendl; + LL_WARNS() << "LLViewerTextureList::addImageToList - image " << image->getID() << " already in list" << LL_ENDL; } else { if((mImageList.insert(image)).second != true) { - llwarns << "Error happens when insert image " << image->getID() << " into mImageList!" << llendl ; + LL_WARNS() << "Error happens when insert image " << image->getID() << " into mImageList!" << LL_ENDL ; } image->setInImageList(TRUE) ; } @@ -586,36 +580,36 @@ void LLViewerTextureList::removeImageFromList(LLViewerFetchedTexture *image) count = mImageList.erase(image) ; if(count != 1) { - llinfos << "Image " << image->getID() + LL_INFOS() << "Image " << image->getID() << " had mInImageList set but mImageList.erase() returned " << count - << llendl; + << LL_ENDL; } } else { // Something is wrong, image is expected in list or callers should check first - llinfos << "Calling removeImageFromList() for " << image->getID() + LL_INFOS() << "Calling removeImageFromList() for " << image->getID() << " but doesn't have mInImageList set" << " ref count is " << image->getNumRefs() - << llendl; + << LL_ENDL; uuid_map_t::iterator iter = mUUIDMap.find(image->getID()); if(iter == mUUIDMap.end()) { - llinfos << "Image " << image->getID() << " is also not in mUUIDMap!" << llendl ; + LL_INFOS() << "Image " << image->getID() << " is also not in mUUIDMap!" << LL_ENDL ; } else if (iter->second != image) { - llinfos << "Image " << image->getID() << " was in mUUIDMap but with different pointer" << llendl ; + LL_INFOS() << "Image " << image->getID() << " was in mUUIDMap but with different pointer" << LL_ENDL ; } else { - llinfos << "Image " << image->getID() << " was in mUUIDMap with same pointer" << llendl ; + LL_INFOS() << "Image " << image->getID() << " was in mUUIDMap with same pointer" << LL_ENDL ; } count = mImageList.erase(image) ; if(count != 0) { // it was in the list already? - llwarns << "Image " << image->getID() + LL_WARNS() << "Image " << image->getID() << " had mInImageList false but mImageList.erase() returned " << count - << llendl; + << LL_ENDL; } } @@ -634,7 +628,7 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image) LLViewerFetchedTexture *image = findImage(image_id); if (image) { - llinfos << "Image with ID " << image_id << " already in list" << llendl; + LL_INFOS() << "Image with ID " << image_id << " already in list" << LL_ENDL; } sNumImages++; @@ -669,16 +663,18 @@ void LLViewerTextureList::dirtyImage(LLViewerFetchedTexture *image) } //////////////////////////////////////////////////////////////////////////// -static LLFastTimer::DeclareTimer FTM_IMAGE_MARK_DIRTY("Dirty Images"); -static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_PRIORITIES("Prioritize"); -static LLFastTimer::DeclareTimer FTM_IMAGE_CALLBACKS("Callbacks"); -static LLFastTimer::DeclareTimer FTM_IMAGE_FETCH("Fetch"); -static LLFastTimer::DeclareTimer FTM_FAST_CACHE_IMAGE_FETCH("Fast Cache Fetch"); -static LLFastTimer::DeclareTimer FTM_IMAGE_CREATE("Create"); -static LLFastTimer::DeclareTimer FTM_IMAGE_STATS("Stats"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_MARK_DIRTY("Dirty Images"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_PRIORITIES("Prioritize"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_CALLBACKS("Callbacks"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_FETCH("Fetch"); +static LLTrace::BlockTimerStatHandle FTM_FAST_CACHE_IMAGE_FETCH("Fast Cache Fetch"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_CREATE("Create"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_STATS("Stats"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_TEXTURES("Update Textures"); void LLViewerTextureList::updateImages(F32 max_time) { + LL_RECORD_BLOCK_TIME(FTM_UPDATE_TEXTURES); static BOOL cleared = FALSE; if(gTeleportDisplay) { @@ -692,48 +688,51 @@ void LLViewerTextureList::updateImages(F32 max_time) } cleared = FALSE; - LLAppViewer::getTextureFetch()->setTextureBandwidth(LLViewerStats::getInstance()->mTextureKBitStat.getMeanPerSec()); + LLAppViewer::getTextureFetch()->setTextureBandwidth(LLTrace::get_frame_recording().getPeriodMeanPerSec(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED).value()); - LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages); - LLViewerStats::getInstance()->mNumRawImagesStat.addValue(LLImageRaw::sRawImageCount); - LLViewerStats::getInstance()->mGLTexMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sGlobalTextureMemoryInBytes)); - LLViewerStats::getInstance()->mGLBoundMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageGL::sBoundTextureMemoryInBytes)); - LLViewerStats::getInstance()->mRawMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageRaw::sGlobalRawMemory)); - LLViewerStats::getInstance()->mFormattedMemStat.addValue((F32)BYTES_TO_MEGA_BYTES(LLImageFormatted::sGlobalFormattedMemory)); + { + using namespace LLStatViewer; + sample(NUM_IMAGES, sNumImages); + sample(NUM_RAW_IMAGES, LLImageRaw::sRawImageCount); + sample(GL_TEX_MEM, LLImageGL::sGlobalTextureMemory); + sample(GL_BOUND_MEM, LLImageGL::sBoundTextureMemory); + sample(RAW_MEM, F64Bytes(LLImageRaw::sGlobalRawMemory)); + sample(FORMATTED_MEM, F64Bytes(LLImageFormatted::sGlobalFormattedMemory)); + } { //loading from fast cache - LLFastTimer t(FTM_FAST_CACHE_IMAGE_FETCH); + LL_RECORD_BLOCK_TIME(FTM_FAST_CACHE_IMAGE_FETCH); max_time -= updateImagesLoadingFastCache(max_time); } { - LLFastTimer t(FTM_IMAGE_UPDATE_PRIORITIES); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_PRIORITIES); updateImagesDecodePriorities(); } F32 total_max_time = max_time; { - LLFastTimer t(FTM_IMAGE_FETCH); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_FETCH); max_time -= updateImagesFetchTextures(max_time); } { - LLFastTimer t(FTM_IMAGE_CREATE); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_CREATE); max_time = llmax(max_time, total_max_time*.50f); // at least 50% of max_time max_time -= updateImagesCreateTextures(max_time); } if (!mDirtyTextureList.empty()) { - LLFastTimer t(FTM_IMAGE_MARK_DIRTY); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_MARK_DIRTY); gPipeline.dirtyPoolObjectTextures(mDirtyTextureList); mDirtyTextureList.clear(); } { - LLFastTimer t(FTM_IMAGE_CALLBACKS); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_CALLBACKS); bool didone = false; for (image_list_t::iterator iter = mCallbackList.begin(); iter != mCallbackList.end(); ) @@ -754,7 +753,7 @@ void LLViewerTextureList::updateImages(F32 max_time) } { - LLFastTimer t(FTM_IMAGE_STATS); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_STATS); updateImagesUpdateStats(); } } @@ -780,8 +779,15 @@ void LLViewerTextureList::updateImagesDecodePriorities() { // Update the decode priority for N images each frame { + F32 lazy_flush_timeout = 30.f; // stop decoding + F32 max_inactive_time = 20.f; // actually delete + S32 min_refs = 3; // 1 for mImageList, 1 for mUUIDMap, 1 for local reference + + //reset imagep->getLastReferencedTimer() when screen is showing the progress view to avoid removing pre-fetched textures too soon. + bool reset_timer = gViewerWindow->getProgressView()->getVisible(); + static const S32 MAX_PRIO_UPDATES = gSavedSettings.getS32("TextureFetchUpdatePriorities"); // default: 32 - const size_t max_update_count = llmin((S32) (MAX_PRIO_UPDATES*MAX_PRIO_UPDATES*gFrameIntervalSeconds) + 1, MAX_PRIO_UPDATES); + const size_t max_update_count = llmin((S32) (MAX_PRIO_UPDATES*MAX_PRIO_UPDATES*gFrameIntervalSeconds.value()) + 1, MAX_PRIO_UPDATES); S32 update_counter = llmin(max_update_count, mUUIDMap.size()); uuid_map_t::iterator iter = mUUIDMap.upper_bound(mLastUpdateUUID); while ((update_counter-- > 0) && !mUUIDMap.empty()) @@ -803,14 +809,14 @@ void LLViewerTextureList::updateImagesDecodePriorities() // // Flush formatted images using a lazy flush // - const F32 LAZY_FLUSH_TIMEOUT = 30.f; // stop decoding - const F32 MAX_INACTIVE_TIME = 20.f; // actually delete - S32 min_refs = 3; // 1 for mImageList, 1 for mUUIDMap, 1 for local reference - S32 num_refs = imagep->getNumRefs(); if (num_refs == min_refs) { - if (imagep->getLastReferencedTimer()->getElapsedTimeF32() > LAZY_FLUSH_TIMEOUT) + if(reset_timer) + { + imagep->getLastReferencedTimer()->reset(); + } + else if (imagep->getLastReferencedTimer()->getElapsedTimeF32() > lazy_flush_timeout) { // Remove the unused image from the image list deleteImage(imagep); @@ -822,7 +828,7 @@ void LLViewerTextureList::updateImagesDecodePriorities() { if(imagep->hasSavedRawImage()) { - if(imagep->getElapsedLastReferencedSavedRawImageTime() > MAX_INACTIVE_TIME) + if(imagep->getElapsedLastReferencedSavedRawImageTime() > max_inactive_time) { imagep->destroySavedRawImage() ; } @@ -839,7 +845,11 @@ void LLViewerTextureList::updateImagesDecodePriorities() } else if(imagep->isInactive()) { - if (imagep->getLastReferencedTimer()->getElapsedTimeF32() > MAX_INACTIVE_TIME) + if(reset_timer) + { + imagep->getLastReferencedTimer()->reset(); + } + else if (imagep->getLastReferencedTimer()->getElapsedTimeF32() > max_inactive_time) { imagep->setDeletionCandidate() ; } @@ -917,11 +927,11 @@ void LLViewerTextureList::setDebugFetching(LLViewerFetchedTexture* tex, S32 debu if (type_from_host == LLImageBase::TYPE_NORMAL && type_from_boost == LLImageBase::TYPE_AVATAR_BAKE) { - llwarns << "TAT: get_image_type() type_from_host doesn't match type_from_boost" + LL_WARNS() << "TAT: get_image_type() type_from_host doesn't match type_from_boost" << " host " << target_host << " boost " << imagep->getBoostLevel() << " imageid " << imagep->getID() - << llendl; + << LL_ENDL; imagep->dump(); } return type_from_host; @@ -1015,11 +1025,11 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time) static const F32 MIN_PRIORITY_THRESHOLD = gSavedSettings.getF32("TextureFetchUpdatePriorityThreshold"); // default: 0.0 static const bool SKIP_LOW_PRIO = gSavedSettings.getBOOL("TextureFetchUpdateSkipLowPriority"); // default: false - size_t max_priority_count = llmin((S32) (MAX_HIGH_PRIO_COUNT*MAX_HIGH_PRIO_COUNT*gFrameIntervalSeconds)+1, MAX_HIGH_PRIO_COUNT); + size_t max_priority_count = llmin((S32) (MAX_HIGH_PRIO_COUNT*MAX_HIGH_PRIO_COUNT*gFrameIntervalSeconds.value())+1, MAX_HIGH_PRIO_COUNT); max_priority_count = llmin(max_priority_count, mImageList.size()); size_t total_update_count = mUUIDMap.size(); - size_t max_update_count = llmin((S32) (MAX_UPDATE_COUNT*MAX_UPDATE_COUNT*gFrameIntervalSeconds)+1, MAX_UPDATE_COUNT); + size_t max_update_count = llmin((S32) (MAX_UPDATE_COUNT*MAX_UPDATE_COUNT*gFrameIntervalSeconds.value())+1, MAX_UPDATE_COUNT); max_update_count = llmin(max_update_count, total_update_count); // MAX_HIGH_PRIO_COUNT high priority entries @@ -1195,13 +1205,13 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename, if (compressedImage.isNull()) { image->setLastError("Couldn't convert the image to jpeg2000."); - llinfos << "Couldn't convert to j2c, file : " << filename << llendl; + LL_INFOS() << "Couldn't convert to j2c, file : " << filename << LL_ENDL; return FALSE; } if (!compressedImage->save(out_filename)) { image->setLastError("Couldn't create the jpeg2000 image for upload."); - llinfos << "Couldn't create output file : " << out_filename << llendl; + LL_INFOS() << "Couldn't create output file : " << out_filename << LL_ENDL; return FALSE; } // Test to see if the encode and save worked @@ -1209,7 +1219,7 @@ BOOL LLViewerTextureList::createUploadFile(const std::string& filename, if (!integrity_test->loadAndValidate( out_filename )) { image->setLastError("The created jpeg2000 image is corrupt."); - llinfos << "Image file : " << out_filename << " is corrupt" << llendl; + LL_INFOS() << "Image file : " << out_filename << " is corrupt" << LL_ENDL; return FALSE; } return TRUE; @@ -1234,13 +1244,13 @@ LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImage // Read the blocks and precincts size settings S32 block_size = gSavedSettings.getS32("Jpeg2000BlocksSize"); S32 precinct_size = gSavedSettings.getS32("Jpeg2000PrecinctsSize"); - llinfos << "Advanced JPEG2000 Compression: precinct = " << precinct_size << ", block = " << block_size << llendl; + LL_INFOS() << "Advanced JPEG2000 Compression: precinct = " << precinct_size << ", block = " << block_size << LL_ENDL; compressedImage->initEncode(*raw_image, block_size, precinct_size, 0); } if (!compressedImage->encode(raw_image, 0.0f)) { - llinfos << "convertToUploadFile : encode returns with error!!" << llendl; + LL_INFOS() << "convertToUploadFile : encode returns with error!!" << LL_ENDL; // Clear up the pointer so we don't leak that one compressedImage = NULL; } @@ -1252,28 +1262,28 @@ const S32 MIN_VIDEO_RAM = 32; const S32 MAX_VIDEO_RAM = 512; // 512MB max for performance reasons. // Returns min setting for TextureMemory (in MB) -S32 LLViewerTextureList::getMinVideoRamSetting() +S32Megabytes LLViewerTextureList::getMinVideoRamSetting() { - S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); + S32Megabytes system_ram = gSysMemory.getPhysicalMemoryClamped(); //min texture mem sets to 64M if total physical mem is more than 1.5GB - return (system_ram > 1500) ? 64 : MIN_VIDEO_RAM_IN_MEGA_BYTES ; + return (system_ram > S32Megabytes(1500)) ? S32Megabytes(64) : gMinVideoRam ; } //static // Returns max setting for TextureMemory (in MB) -S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended, float mem_multiplier) +S32Megabytes LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended, float mem_multiplier) { - S32 max_texmem; + S32Megabytes max_texmem; if (gGLManager.mVRAM != 0) { // Treat any card with < 32 MB (shudder) as having 32 MB // - it's going to be swapping constantly regardless - S32 max_vram = gGLManager.mVRAM; + S32Megabytes max_vram(gGLManager.mVRAM); if(gGLManager.mIsATI) { //shrink the availabe vram for ATI cards because some of them do not handel texture swapping well. - max_vram = (S32)(max_vram * 0.75f); + max_vram = max_vram * 0.75f; } max_vram = llmax(max_vram, getMinVideoRamSetting()); @@ -1285,48 +1295,48 @@ S32 LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended, float mem_m { if (!get_recommended) { - max_texmem = 512; + max_texmem = (S32Megabytes)512; } else if (gSavedSettings.getBOOL("NoHardwareProbe")) //did not do hardware detection at startup { - max_texmem = 512; + max_texmem = (S32Megabytes)512; } else { - max_texmem = 128; + max_texmem = (S32Megabytes)128; } - llwarns << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << llendl; + LL_WARNS() << "VRAM amount not detected, defaulting to " << max_texmem << " MB" << LL_ENDL; } - S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); // In MB - //llinfos << "*** DETECTED " << system_ram << " MB of system memory." << llendl; + S32Megabytes system_ram = gSysMemory.getPhysicalMemoryClamped(); // In MB + //LL_INFOS() << "*** DETECTED " << system_ram << " MB of system memory." << LL_ENDL; if (get_recommended) - max_texmem = llmin(max_texmem, (S32)(system_ram/2)); + max_texmem = llmin(max_texmem, system_ram/2); else - max_texmem = llmin(max_texmem, (S32)(system_ram)); - + max_texmem = llmin(max_texmem, system_ram); + // limit the texture memory to a multiple of the default if we've found some cards to behave poorly otherwise - max_texmem = llmin(max_texmem, (S32) (mem_multiplier * (F32) max_texmem)); + max_texmem = llmin(max_texmem, (S32Megabytes) (mem_multiplier * max_texmem)); - max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), MAX_VIDEO_RAM_IN_MEGA_BYTES); + max_texmem = llclamp(max_texmem, getMinVideoRamSetting(), gMaxVideoRam); return max_texmem; } -const S32 VIDEO_CARD_FRAMEBUFFER_MEM = 12; // MB -const S32 MIN_MEM_FOR_NON_TEXTURE = 512 ; //MB -void LLViewerTextureList::updateMaxResidentTexMem(S32 mem) +const S32Megabytes VIDEO_CARD_FRAMEBUFFER_MEM(12); +const S32Megabytes MIN_MEM_FOR_NON_TEXTURE(512); +void LLViewerTextureList::updateMaxResidentTexMem(S32Megabytes mem) { // Initialize the image pipeline VRAM settings - S32 cur_mem = gSavedSettings.getS32("TextureMemory"); + S32Megabytes cur_mem(gSavedSettings.getS32("TextureMemory")); F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple"); - S32 default_mem = getMaxVideoRamSetting(true, mem_multiplier); // recommended default - if (mem == 0) + S32Megabytes default_mem = getMaxVideoRamSetting(true, mem_multiplier); // recommended default + if (mem == (S32Bytes)0) { - mem = cur_mem > 0 ? cur_mem : default_mem; + mem = cur_mem > (S32Bytes)0 ? cur_mem : default_mem; } - else if (mem < 0) + else if (mem < (S32Bytes)0) { mem = default_mem; } @@ -1334,38 +1344,38 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem) mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting(false, mem_multiplier)); if (mem != cur_mem) { - gSavedSettings.setS32("TextureMemory", mem); + gSavedSettings.setS32("TextureMemory", mem.value()); return; //listener will re-enter this function } // TODO: set available resident texture mem based on use by other subsystems // currently max(12MB, VRAM/4) assumed... - S32 vb_mem = mem; - S32 fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4); + S32Megabytes vb_mem = mem; + S32Megabytes fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4); mMaxResidentTexMemInMegaBytes = (vb_mem - fb_mem) ; //in MB mMaxTotalTextureMemInMegaBytes = mMaxResidentTexMemInMegaBytes * 2; - if (mMaxResidentTexMemInMegaBytes > 640) + if (mMaxResidentTexMemInMegaBytes > (S32Megabytes)640) { - mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes >> 2); + mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes / 4); } //system mem - S32 system_ram = (S32)BYTES_TO_MEGA_BYTES(gSysMemory.getPhysicalMemoryClamped()); // In MB + S32Megabytes system_ram = gSysMemory.getPhysicalMemoryClamped(); //minimum memory reserved for non-texture use. //if system_raw >= 1GB, reserve at least 512MB for non-texture use; //otherwise reserve half of the system_ram for non-texture use. - S32 min_non_texture_mem = llmin(system_ram / 2, MIN_MEM_FOR_NON_TEXTURE) ; + S32Megabytes min_non_texture_mem = llmin(system_ram / 2, MIN_MEM_FOR_NON_TEXTURE) ; if (mMaxTotalTextureMemInMegaBytes > system_ram - min_non_texture_mem) { mMaxTotalTextureMemInMegaBytes = system_ram - min_non_texture_mem ; } - llinfos << "Total Video Memory set to: " << vb_mem << " MB" << llendl; - llinfos << "Available Texture Memory set to: " << (vb_mem - fb_mem) << " MB" << llendl; + LL_INFOS() << "Total Video Memory set to: " << vb_mem << " MB" << LL_ENDL; + LL_INFOS() << "Available Texture Memory set to: " << (vb_mem - fb_mem) << " MB" << LL_ENDL; } /////////////////////////////////////////////////////////////////////////////// @@ -1375,7 +1385,7 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d { static LLCachedControl<bool> log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic", false) ; - LLFastTimer t(FTM_PROCESS_IMAGES); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_IMAGES); // Receive image header, copy into image object and decompresses // if this is a one-packet image. @@ -1385,17 +1395,17 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d char ip_string[256]; u32_to_ip_string(msg->getSenderIP(),ip_string); - U32 received_size ; + U32Bytes received_size ; if (msg->getReceiveCompressedSize()) { - received_size = msg->getReceiveCompressedSize() ; + received_size = (U32Bytes)msg->getReceiveCompressedSize() ; } else { - received_size = msg->getReceiveSize() ; + received_size = (U32Bytes)msg->getReceiveSize() ; } - gTextureList.sTextureBits += received_size * 8; - gTextureList.sTexturePackets++; + add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, received_size); + add(LLStatViewer::TEXTURE_PACKETS, 1); U8 codec; U16 packets; @@ -1414,8 +1424,8 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d { // msg->getSizeFast() is probably trying to tell us there // was an error. - llerrs << "image header chunk size was negative: " - << data_size << llendl; + LL_ERRS() << "image header chunk size was negative: " + << data_size << LL_ENDL; return; } @@ -1447,7 +1457,7 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d { static LLCachedControl<bool> log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic", false) ; - LLFastTimer t(FTM_PROCESS_IMAGES); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_IMAGES); // Receives image packet, copy into image object, // checks if all packets received, decompresses if so. @@ -1458,17 +1468,18 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d char ip_string[256]; u32_to_ip_string(msg->getSenderIP(),ip_string); - U32 received_size ; + U32Bytes received_size ; if (msg->getReceiveCompressedSize()) { - received_size = msg->getReceiveCompressedSize() ; + received_size = (U32Bytes)msg->getReceiveCompressedSize() ; } else { - received_size = msg->getReceiveSize() ; + received_size = (U32Bytes)msg->getReceiveSize() ; } - gTextureList.sTextureBits += received_size * 8; - gTextureList.sTexturePackets++; + + add(LLStatViewer::TEXTURE_NETWORK_DATA_RECEIVED, F64Bytes(received_size)); + add(LLStatViewer::TEXTURE_PACKETS, 1); //llprintline("Start decode, image header..."); msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, id); @@ -1483,13 +1494,13 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d { // msg->getSizeFast() is probably trying to tell us there // was an error. - llerrs << "image data chunk size was negative: " - << data_size << llendl; + LL_ERRS() << "image data chunk size was negative: " + << data_size << LL_ENDL; return; } if (data_size > MTUBYTES) { - llerrs << "image data chunk too large: " << data_size << " bytes" << llendl; + LL_ERRS() << "image data chunk too large: " << data_size << " bytes" << LL_ENDL; return; } U8 *data = new U8[data_size]; @@ -1519,35 +1530,18 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d // static void LLViewerTextureList::processImageNotInDatabase(LLMessageSystem *msg,void **user_data) { - LLFastTimer t(FTM_PROCESS_IMAGES); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_IMAGES); LLUUID image_id; msg->getUUIDFast(_PREHASH_ImageID, _PREHASH_ID, image_id); LLViewerFetchedTexture* image = gTextureList.findImage( image_id ); if( image ) { - llwarns << "not in db" << llendl; + LL_WARNS() << "not in db" << LL_ENDL; image->setIsMissingAsset(); } } -/////////////////////////////////////////////////////////////////////////////// - -//static -const U32 SIXTEEN_MEG = 0x1000000; -S32 LLViewerTextureList::calcMaxTextureRAM() -{ - // Decide the maximum amount of RAM we should allow the user to allocate to texture cache - LLMemoryInfo memory_info; - U32 available_memory = memory_info.getPhysicalMemoryClamped(); - - clamp_rescale((F32)available_memory, - (F32)(SIXTEEN_MEG * 16), - (F32)U32_MAX, - (F32)(SIXTEEN_MEG * 4), - (F32)(U32_MAX >> 1)); - return available_memory; -} /////////////////////////////////////////////////////////////////////////////// @@ -1594,28 +1588,31 @@ LLUIImagePtr LLUIImageList::getUIImage(const std::string& image_name, S32 priori } LLUIImagePtr LLUIImageList::loadUIImageByName(const std::string& name, const std::string& filename, - BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority ) + BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority, + LLUIImage::EScaleStyle scale_style) { if (boost_priority == LLGLTexture::BOOST_NONE) { boost_priority = LLGLTexture::BOOST_UI; } LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTextureFromFile(filename, FTT_LOCAL_FILE, MIPMAP_NO, boost_priority); - return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect); + return loadUIImage(imagep, name, use_mips, scale_rect, clip_rect, scale_style); } LLUIImagePtr LLUIImageList::loadUIImageByID(const LLUUID& id, - BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority) + BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLViewerTexture::EBoostLevel boost_priority, + LLUIImage::EScaleStyle scale_style) { if (boost_priority == LLGLTexture::BOOST_NONE) { boost_priority = LLGLTexture::BOOST_UI; } LLViewerFetchedTexture* imagep = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, MIPMAP_NO, boost_priority); - return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect); + return loadUIImage(imagep, id.asString(), use_mips, scale_rect, clip_rect, scale_style); } -LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect) +LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, + LLUIImage::EScaleStyle scale_style) { if (!imagep) return NULL; @@ -1628,6 +1625,8 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st imagep->setNoDelete(); LLUIImagePtr new_imagep = new LLUIImage(name, imagep); + new_imagep->setScaleStyle(scale_style); + mUIImages.insert(std::make_pair(name, new_imagep)); mUITextureList.push_back(imagep); @@ -1646,17 +1645,17 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st return new_imagep; } -LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect) +LLUIImagePtr LLUIImageList::preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle scale_style) { // look for existing image uuid_ui_image_map_t::iterator found_it = mUIImages.find(name); if (found_it != mUIImages.end()) { // image already loaded! - llerrs << "UI Image " << name << " already loaded." << llendl; + LL_ERRS() << "UI Image " << name << " already loaded." << LL_ENDL; } - return loadUIImageByName(name, filename, use_mips, scale_rect, clip_rect); + return loadUIImageByName(name, filename, use_mips, scale_rect, clip_rect, LLGLTexture::BOOST_UI, scale_style); } //static @@ -1716,14 +1715,28 @@ void LLUIImageList::onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_v } } +namespace LLInitParam +{ + template<> + struct TypeValues<LLUIImage::EScaleStyle> : public TypeValuesHelper<LLUIImage::EScaleStyle> + { + static void declareValues() + { + declare("scale_inner", LLUIImage::SCALE_INNER); + declare("scale_outer", LLUIImage::SCALE_OUTER); + } + }; +} + struct UIImageDeclaration : public LLInitParam::Block<UIImageDeclaration> { - Mandatory<std::string> name; - Optional<std::string> file_name; - Optional<bool> preload; - Optional<LLRect> scale; - Optional<LLRect> clip; - Optional<bool> use_mips; + Mandatory<std::string> name; + Optional<std::string> file_name; + Optional<bool> preload; + Optional<LLRect> scale; + Optional<LLRect> clip; + Optional<bool> use_mips; + Optional<LLUIImage::EScaleStyle> scale_type; UIImageDeclaration() : name("name"), @@ -1731,7 +1744,8 @@ struct UIImageDeclaration : public LLInitParam::Block<UIImageDeclaration> preload("preload", false), scale("scale"), clip("clip"), - use_mips("use_mips", false) + use_mips("use_mips", false), + scale_type("scale_type", LLUIImage::SCALE_INNER) {} }; @@ -1756,7 +1770,7 @@ bool LLUIImageList::initFromFile() std::vector<std::string>::const_iterator pi(textures_paths.begin()), pend(textures_paths.end()); if (pi == pend) { - llwarns << "No textures.xml found in skins directories" << llendl; + LL_WARNS() << "No textures.xml found in skins directories" << LL_ENDL; return false; } @@ -1764,12 +1778,12 @@ bool LLUIImageList::initFromFile() LLXMLNodePtr root; if (!LLXMLNode::parseFile(*pi, root, NULL)) { - llwarns << "Unable to parse UI image list file " << *pi << llendl; + LL_WARNS() << "Unable to parse UI image list file " << *pi << LL_ENDL; return false; } if (!root->hasAttribute("version")) { - llwarns << "No valid version number in UI image list file " << *pi << llendl; + LL_WARNS() << "No valid version number in UI image list file " << *pi << LL_ENDL; return false; } @@ -1819,7 +1833,7 @@ bool LLUIImageList::initFromFile() { continue; } - preloadUIImage(image.name, file_name, image.use_mips, image.scale, image.clip); + preloadUIImage(image.name, file_name, image.use_mips, image.scale, image.clip, image.scale_type); } if (cur_pass == PASS_DECODE_NOW && !gSavedSettings.getBOOL("NoPreload")) diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 26dc6dcbe25777b9f1866557af75a888d435e226..2f84d0947a938e3828eb77176b30e05ab7749b49 100755 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -1,5 +1,5 @@ /** - * @file llviewertexturelist.h + * @file llviewertexturelinumimagest.h * @brief Object for managing the list of images within a region * * $LicenseInfo:firstyear=2000&license=viewerlgpl$ @@ -30,11 +30,11 @@ #include "lluuid.h" //#include "message.h" #include "llgl.h" -#include "llstat.h" #include "llviewertexture.h" #include "llui.h" #include <list> #include <set> +#include "lluiimage.h" const U32 LL_IMAGE_REZ_LOSSLESS_CUTOFF = 128; @@ -71,7 +71,6 @@ class LLViewerTextureList static BOOL createUploadFile(const std::string& filename, const std::string& out_filename, const U8 codec); static LLPointer<LLImageJ2C> convertToUploadFile(LLPointer<LLImageRaw> raw_image); static void processImageNotInDatabase( LLMessageSystem *msg, void **user_data ); - static S32 calcMaxTextureRAM(); static void receiveImageHeader(LLMessageSystem *msg, void **user_data); static void receiveImagePacket(LLMessageSystem *msg, void **user_data); @@ -101,11 +100,11 @@ class LLViewerTextureList void setUpdateStats(BOOL b) { mUpdateStats = b; } - S32 getMaxResidentTexMem() const { return mMaxResidentTexMemInMegaBytes; } - S32 getMaxTotalTextureMem() const { return mMaxTotalTextureMemInMegaBytes;} + S32Megabytes getMaxResidentTexMem() const { return mMaxResidentTexMemInMegaBytes; } + S32Megabytes getMaxTotalTextureMem() const { return mMaxTotalTextureMemInMegaBytes;} S32 getNumImages() { return mImageList.size(); } - void updateMaxResidentTexMem(S32 mem); + void updateMaxResidentTexMem(S32Megabytes mem); void doPreloadImages(); void doPrefetchImages(); @@ -113,8 +112,8 @@ class LLViewerTextureList void clearFetchingRequests(); void setDebugFetching(LLViewerFetchedTexture* tex, S32 debug_level); - static S32 getMinVideoRamSetting(); - static S32 getMaxVideoRamSetting(bool get_recommended, float mem_multiplier); + static S32Megabytes getMinVideoRamSetting(); + static S32Megabytes getMaxVideoRamSetting(bool get_recommended, float mem_multiplier); private: void updateImagesDecodePriorities(); @@ -200,21 +199,10 @@ class LLViewerTextureList BOOL mInitialized ; BOOL mUpdateStats; - S32 mMaxResidentTexMemInMegaBytes; - S32 mMaxTotalTextureMemInMegaBytes; + S32Megabytes mMaxResidentTexMemInMegaBytes; + S32Megabytes mMaxTotalTextureMemInMegaBytes; LLFrameTimer mForceDecodeTimer; -public: - static U32 sTextureBits; - static U32 sTexturePackets; - - static LLStat sNumImagesStat; - static LLStat sNumRawImagesStat; - static LLStat sGLTexMemStat; - static LLStat sGLBoundMemStat; - static LLStat sRawMemStat; - static LLStat sFormattedMemStat; - private: static S32 sNumImages; static void (*sUUIDCallback)(void**, const LLUUID &); @@ -230,20 +218,22 @@ class LLUIImageList : public LLImageProviderInterface, public LLSingleton<LLUIIm bool initFromFile(); - LLPointer<LLUIImage> preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect); + LLPointer<LLUIImage> preloadUIImage(const std::string& name, const std::string& filename, BOOL use_mips, const LLRect& scale_rect, const LLRect& clip_rect, LLUIImage::EScaleStyle stype); static void onUIImageLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata ); private: LLPointer<LLUIImage> loadUIImageByName(const std::string& name, const std::string& filename, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, - LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI); + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI, + LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER); LLPointer<LLUIImage> loadUIImageByID(const LLUUID& id, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, - LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI); + LLViewerTexture::EBoostLevel boost_priority = LLGLTexture::BOOST_UI, + LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER); - LLPointer<LLUIImage> loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null); + LLPointer<LLUIImage> loadUIImage(LLViewerFetchedTexture* imagep, const std::string& name, BOOL use_mips = FALSE, const LLRect& scale_rect = LLRect::null, const LLRect& clip_rect = LLRect::null, LLUIImage::EScaleStyle = LLUIImage::SCALE_INNER); struct LLUIImageLoadData diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index 5147272122e6c0d5d4f1b1809302c7675e0916bd..22de7e150b9d7d34276c1eaada8dc9bd440b26e6 100755 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -48,8 +48,8 @@ const F32 MIN_FRACTIONAL = 0.2f; const F32 MIN_BANDWIDTH = 50.f; const F32 MAX_BANDWIDTH = 3000.f; const F32 STEP_FRACTIONAL = 0.1f; -const F32 TIGHTEN_THROTTLE_THRESHOLD = 3.0f; // packet loss % per s -const F32 EASE_THROTTLE_THRESHOLD = 0.5f; // packet loss % per s +const LLUnit<F32, LLUnits::Percent> TIGHTEN_THROTTLE_THRESHOLD(3.0f); // packet loss % per s +const LLUnit<F32, LLUnits::Percent> EASE_THROTTLE_THRESHOLD(0.5f); // packet loss % per s const F32 DYNAMIC_UPDATE_DURATION = 5.0f; // seconds LLViewerThrottle gViewerThrottle; @@ -146,7 +146,7 @@ LLViewerThrottleGroup LLViewerThrottleGroup::operator-(const LLViewerThrottleGro void LLViewerThrottleGroup::sendToSim() const { - llinfos << "Sending throttle settings, total BW " << mThrottleTotal << llendl; + LL_INFOS() << "Sending throttle settings, total BW " << mThrottleTotal << LL_ENDL; LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_AgentThrottle); @@ -304,7 +304,8 @@ void LLViewerThrottle::updateDynamicThrottle() } mUpdateTimer.reset(); - if (LLViewerStats::getInstance()->mPacketsLostPercentStat.getMean() > TIGHTEN_THROTTLE_THRESHOLD) + LLUnit<F32, LLUnits::Percent> mean_packets_lost = LLViewerStats::instance().getRecording().getMean(LLStatViewer::PACKETS_LOST_PERCENT); + if (mean_packets_lost > TIGHTEN_THROTTLE_THRESHOLD) { if (mThrottleFrac <= MIN_FRACTIONAL || mCurrentBandwidth / 1024.0f <= MIN_BANDWIDTH) { @@ -315,9 +316,9 @@ void LLViewerThrottle::updateDynamicThrottle() mCurrentBandwidth = mMaxBandwidth * mThrottleFrac; mCurrent = getThrottleGroup(mCurrentBandwidth / 1024.0f); mCurrent.sendToSim(); - llinfos << "Tightening network throttle to " << mCurrentBandwidth << llendl; + LL_INFOS() << "Tightening network throttle to " << mCurrentBandwidth << LL_ENDL; } - else if (LLViewerStats::getInstance()->mPacketsLostPercentStat.getMean() <= EASE_THROTTLE_THRESHOLD) + else if (mean_packets_lost <= EASE_THROTTLE_THRESHOLD) { if (mThrottleFrac >= MAX_FRACTIONAL || mCurrentBandwidth / 1024.0f >= MAX_BANDWIDTH) { @@ -328,6 +329,6 @@ void LLViewerThrottle::updateDynamicThrottle() mCurrentBandwidth = mMaxBandwidth * mThrottleFrac; mCurrent = getThrottleGroup(mCurrentBandwidth/1024.0f); mCurrent.sendToSim(); - llinfos << "Easing network throttle to " << mCurrentBandwidth << llendl; + LL_INFOS() << "Easing network throttle to " << mCurrentBandwidth << LL_ENDL; } } diff --git a/indra/newview/llviewerwearable.cpp b/indra/newview/llviewerwearable.cpp index e8425dc76a1d5eb77c94ac8a4fdb9a9a6e36cbc0..a544cc81dacd91e9f3c3c8d478a6abbfdd5bf1fc 100644 --- a/indra/newview/llviewerwearable.cpp +++ b/indra/newview/llviewerwearable.cpp @@ -30,6 +30,7 @@ #include "llagentcamera.h" #include "llagentwearables.h" #include "llfloatersidepanelcontainer.h" +#include "lllocaltextureobject.h" #include "llnotificationsutil.h" #include "llsidepanelappearance.h" #include "lltextureentry.h" @@ -103,7 +104,7 @@ LLWearable::EImportResult LLViewerWearable::importStream( std::istream& input_st { // Shouldn't really log the asset id for security reasons, but // we need it in this case. - llwarns << "Bad Wearable asset header: " << mAssetID << llendl; + LL_WARNS() << "Bad Wearable asset header: " << mAssetID << LL_ENDL; //gVFS->dumpMap(); return result; } @@ -143,7 +144,7 @@ BOOL LLViewerWearable::isOldVersion() const if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion ) { - llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl; + LL_WARNS() << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << LL_ENDL; llassert(0); } @@ -536,8 +537,8 @@ struct LLWearableSaveData void LLViewerWearable::saveNewAsset() const { -// llinfos << "LLViewerWearable::saveNewAsset() type: " << getTypeName() << llendl; - //llinfos << *this << llendl; +// LL_INFOS() << "LLViewerWearable::saveNewAsset() type: " << getTypeName() << LL_ENDL; + //LL_INFOS() << *this << LL_ENDL; const std::string filename = asset_id_to_filename(mAssetID); LLFILE* fp = LLFile::fopen(filename, "wb"); /* Flawfinder: ignore */ @@ -554,7 +555,7 @@ void LLViewerWearable::saveNewAsset() const if(!successful_save) { std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str()); - llwarns << buffer << llendl; + LL_WARNS() << buffer << LL_ENDL; LLSD args; args["NAME"] = mName; @@ -569,7 +570,7 @@ void LLViewerWearable::saveNewAsset() const std::string url = gAgent.getRegion()->getCapability("NewAgentInventory"); if (!url.empty()) { - llinfos << "Update Agent Inventory via capability" << llendl; + LL_INFOS() << "Update Agent Inventory via capability" << LL_ENDL; LLSD body; body["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::assetToFolderType(getAssetType())); body["asset_type"] = LLAssetType::lookup(getAssetType()); @@ -598,12 +599,12 @@ void LLViewerWearable::onSaveNewAssetComplete(const LLUUID& new_asset_id, void* if(0 == status) { // Success - llinfos << "Saved wearable " << type_name << llendl; + LL_INFOS() << "Saved wearable " << type_name << LL_ENDL; } else { std::string buffer = llformat("Unable to save %s to central asset store.", type_name.c_str()); - llwarns << buffer << " Status: " << status << llendl; + LL_WARNS() << buffer << " Status: " << status << LL_ENDL; LLSD args; args["NAME"] = type_name; LLNotificationsUtil::add("CannotSaveToAssetStore", args); diff --git a/indra/newview/llviewerwearable.h b/indra/newview/llviewerwearable.h index 65566f23a5a9981d6b3a5dc7ecac34a5d8d12a6e..8f49e3c4e23872b1839747a9f8e132920e20d345 100644 --- a/indra/newview/llviewerwearable.h +++ b/indra/newview/llviewerwearable.h @@ -29,6 +29,7 @@ #include "llwearable.h" #include "llavatarappearancedefines.h" +#include "llextendedstatus.h" class LLVOAvatar; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 609d2b47f2d270defb042381667a754edc55d2e5..ec794e527d71cf08cf078fafa6e56036a6d0c07f 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -40,6 +40,7 @@ #include "llagentcamera.h" #include "llcommunicationchannel.h" #include "llfloaterreg.h" +#include "llhudicon.h" #include "llmeshrepository.h" #include "llnotificationhandler.h" #include "llpanellogin.h" @@ -75,13 +76,11 @@ #include "message.h" #include "object_flags.h" #include "lltimer.h" -#include "timing.h" #include "llviewermenu.h" #include "lltooltip.h" #include "llmediaentry.h" #include "llurldispatcher.h" #include "raytrace.h" -#include "llstat.h" // newview includes #include "llagent.h" @@ -218,6 +217,7 @@ // Globals // void render_ui(F32 zoom_factor = 1.f, int subfield = 0); +void swap(); extern BOOL gDebugClicks; extern BOOL gDisplaySwapBuffers; @@ -238,7 +238,7 @@ LLVector4a gDebugRaycastParticleIntersection; LLVector2 gDebugRaycastTexCoord; LLVector4a gDebugRaycastNormal; LLVector4a gDebugRaycastTangent; -S32 gDebugRaycastFaceHit; +S32 gDebugRaycastFaceHit; LLVector4a gDebugRaycastStart; LLVector4a gDebugRaycastEnd; @@ -258,6 +258,9 @@ std::string LLViewerWindow::sSnapshotDir; std::string LLViewerWindow::sMovieBaseName; +LLTrace::SampleStatHandle<> LLViewerWindow::sMouseVelocityStat("Mouse Velocity"); + + class RecordToChatConsole : public LLError::Recorder, public LLSingleton<RecordToChatConsole> { public: @@ -287,6 +290,8 @@ class RecordToChatConsole : public LLError::Recorder, public LLSingleton<RecordT // LLDebugText // +static LLTrace::BlockTimerStatHandle FTM_DISPLAY_DEBUG_TEXT("Display Debug Text"); + class LLDebugText { private: @@ -460,6 +465,8 @@ class LLDebugText if (gSavedSettings.getBOOL("DebugShowRenderInfo")) { + LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording(); + if (gPipeline.getUseVertexShaders() == 0) { addText(xpos, ypos, "Shaders Disabled"); @@ -565,7 +572,7 @@ class LLDebugText addText(xpos, ypos, llformat("%d Unique Textures", LLImageGL::sUniqueCount)); ypos += y_inc; - addText(xpos, ypos, llformat("%d Render Calls", gPipeline.mBatchCount)); + addText(xpos, ypos, llformat("%d Render Calls", last_frame_recording.getSampleCount(LLPipeline::sStatBatchSize))); ypos += y_inc; addText(xpos, ypos, llformat("%d/%d Objects Active", gObjectList.getNumActiveObjects(), gObjectList.getNumObjects())); @@ -580,14 +587,9 @@ class LLDebugText gPipeline.mTextureMatrixOps = 0; gPipeline.mMatrixOpCount = 0; - if (gPipeline.mBatchCount > 0) + if (last_frame_recording.getSampleCount(LLPipeline::sStatBatchSize) > 0) { - addText(xpos, ypos, llformat("Batch min/max/mean: %d/%d/%d", gPipeline.mMinBatchSize, gPipeline.mMaxBatchSize, - gPipeline.mTrianglesDrawn/gPipeline.mBatchCount)); - - gPipeline.mMinBatchSize = gPipeline.mMaxBatchSize; - gPipeline.mMaxBatchSize = 0; - gPipeline.mBatchCount = 0; + addText(xpos, ypos, llformat("Batch min/max/mean: %d/%d/%d", last_frame_recording.getMin(LLPipeline::sStatBatchSize), last_frame_recording.getMax(LLPipeline::sStatBatchSize), last_frame_recording.getMean(LLPipeline::sStatBatchSize))); } ypos += y_inc; @@ -599,9 +601,9 @@ class LLDebugText ypos += y_inc; - if (!LLSpatialGroup::sPendingQueries.empty()) + if (!LLOcclusionCullingGroup::sPendingQueries.empty()) { - addText(xpos,ypos, llformat("%d Queries pending", LLSpatialGroup::sPendingQueries.size())); + addText(xpos,ypos, llformat("%d Queries pending", LLOcclusionCullingGroup::sPendingQueries.size())); ypos += y_inc; } @@ -775,9 +777,9 @@ class LLDebugText U32 old_y = ypos ; for(S32 i = LLViewerTexture::BOOST_NONE; i < LLViewerTexture::MAX_GL_IMAGE_CATEGORY; i++) { - if(gTotalTextureBytesPerBoostLevel[i] > 0) + if(gTotalTextureBytesPerBoostLevel[i] > (S32Bytes)0) { - addText(xpos, ypos, llformat("Boost_Level %d: %.3f MB", i, (F32)gTotalTextureBytesPerBoostLevel[i] / (1024 * 1024))); + addText(xpos, ypos, llformat("Boost_Level %d: %.3f MB", i, F32Megabytes(gTotalTextureBytesPerBoostLevel[i]).value())); ypos += y_inc; } } @@ -836,6 +838,7 @@ class LLDebugText void draw() { + LL_RECORD_BLOCK_TIME(FTM_DISPLAY_DEBUG_TEXT); for (line_list_t::iterator iter = mLineList.begin(); iter != mLineList.end(); ++iter) { @@ -925,7 +928,7 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK if (gDebugClicks) { - llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl; + LL_INFOS() << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << LL_ENDL; } // Make sure we get a corresponding mouseup event, even if the mouse leaves the window @@ -951,13 +954,13 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); if (LLView::sDebugMouseHandling) { - llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl; + LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << LL_ENDL; } BOOL r = mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down); if (r) { - lldebugs << "LLViewerWindow::handleAnyMouseClick viewer with mousecaptor calling updatemouseeventinfo - local_x|global x "<< local_x << " " << x << "local/global y " << local_y << " " << y << llendl; + LL_DEBUGS() << "LLViewerWindow::handleAnyMouseClick viewer with mousecaptor calling updatemouseeventinfo - local_x|global x "<< local_x << " " << x << "local/global y " << local_y << " " << y << LL_ENDL; LLViewerEventRecorder::instance().setMouseGlobalCoords(x,y); LLViewerEventRecorder::instance().logMouseEvent(std::string(buttonstatestr),std::string(buttonname)); @@ -977,7 +980,7 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK if (r) { - lldebugs << "LLViewerWindow::handleAnyMouseClick calling updatemouseeventinfo - global x "<< " " << x << "global y " << y << "buttonstate: " << buttonstatestr << " buttonname " << buttonname << llendl; + LL_DEBUGS() << "LLViewerWindow::handleAnyMouseClick calling updatemouseeventinfo - global x "<< " " << x << "global y " << y << "buttonstate: " << buttonstatestr << " buttonname " << buttonname << LL_ENDL; LLViewerEventRecorder::instance().setMouseGlobalCoords(x,y); @@ -993,12 +996,12 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK if (LLView::sDebugMouseHandling) { - llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLViewerEventRecorder::instance().get_xui() << llendl; + LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " " << LLViewerEventRecorder::instance().get_xui() << LL_ENDL; } return TRUE; } else if (LLView::sDebugMouseHandling) { - llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl; + LL_INFOS() << buttonname << " Mouse " << buttonstatestr << " not handled by view" << LL_ENDL; } } @@ -1124,7 +1127,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi S32 object_face = pick_info.mObjectFace; std::string url = data; - lldebugs << "Object: picked at " << pos.mX << ", " << pos.mY << " - face = " << object_face << " - URL = " << url << llendl; + LL_DEBUGS() << "Object: picked at " << pos.mX << ", " << pos.mY << " - face = " << object_face << " - URL = " << url << LL_ENDL; LLVOVolume *obj = dynamic_cast<LLVOVolume*>(static_cast<LLViewerObject*>(pick_info.getObject())); @@ -1457,10 +1460,11 @@ BOOL LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S FillRect(hdc, &wnd_rect, CreateSolidBrush(RGB(255, 255, 255))); std::string temp_str; + LLTrace::Recording& recording = LLViewerStats::instance().getRecording(); temp_str = llformat( "FPS %3.1f Phy FPS %2.1f Time Dil %1.3f", /* Flawfinder: ignore */ - LLViewerStats::getInstance()->mFPSStat.getMeanPerSec(), - LLViewerStats::getInstance()->mSimPhysicsFPS.getPrev(0), - LLViewerStats::getInstance()->mSimTimeDilation.getPrev(0)); + recording.getPerSec(LLStatViewer::FPS), //mFPSStat.getMeanPerSec(), + recording.getLastValue(LLStatViewer::SIM_PHYSICS_FPS), + recording.getLastValue(LLStatViewer::SIM_TIME_DILATION)); S32 len = temp_str.length(); TextOutA(hdc, 0, 0, temp_str.c_str(), len); @@ -1595,8 +1599,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) mResDirty(false), mStatesDirty(false), mCurrResolutionIndex(0), - mProgressView(NULL), - mMouseVelocityStat(new LLStat("Mouse Velocity")) + mProgressView(NULL) { // gKeyboard is still NULL, so it doesn't do LLWindowListener any good to // pass its value right now. Instead, pass it a nullary function that @@ -1614,7 +1617,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) LLNotifications::instance().setIgnoreAllNotifications(ignore); if (ignore) { - llinfos << "NOTE: ALL NOTIFICATIONS THAT OCCUR WILL GET ADDED TO IGNORE LIST FOR LATER RUNS." << llendl; + LL_INFOS() << "NOTE: ALL NOTIFICATIONS THAT OCCUR WILL GET ADDED TO IGNORE LIST FOR LATER RUNS." << LL_ENDL; } // Default to application directory. @@ -1652,14 +1655,14 @@ LLViewerWindow::LLViewerWindow(const Params& p) { LLSplashScreen::update(LLTrans::getString("StartupRequireDriverUpdate")); - LL_WARNS("Window") << "Failed to create window, to be shutting Down, be sure your graphics driver is updated." << llendl ; + LL_WARNS("Window") << "Failed to create window, to be shutting Down, be sure your graphics driver is updated." << LL_ENDL ; ms_sleep(5000) ; //wait for 5 seconds. LLSplashScreen::update(LLTrans::getString("ShuttingDown")); #if LL_LINUX || LL_SOLARIS - llwarns << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt or README-solaris.txt for further information." - << llendl; + LL_WARNS() << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt or README-solaris.txt for further information." + << LL_ENDL; #else LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings" << LL_ENDL; @@ -1679,7 +1682,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) if(p.fullscreen && ( scr.mX!=p.width || scr.mY!=p.height)) { - llwarns << "Fullscreen has forced us in to a different resolution now using "<<scr.mX<<" x "<<scr.mY<<llendl; + LL_WARNS() << "Fullscreen has forced us in to a different resolution now using "<<scr.mX<<" x "<<scr.mY<<LL_ENDL; gSavedSettings.setS32("FullScreenWidth",scr.mX); gSavedSettings.setS32("FullScreenHeight",scr.mY); } @@ -2038,27 +2041,27 @@ void LLViewerWindow::shutdownViews() // clean up warning logger LLError::removeRecorder(RecordToChatConsole::getInstance()); - llinfos << "Warning logger is cleaned." << llendl ; + LL_INFOS() << "Warning logger is cleaned." << LL_ENDL ; delete mDebugText; mDebugText = NULL; - llinfos << "DebugText deleted." << llendl ; + LL_INFOS() << "DebugText deleted." << LL_ENDL ; // Cleanup global views if (gMorphView) { gMorphView->setVisible(FALSE); } - llinfos << "Global views cleaned." << llendl ; + LL_INFOS() << "Global views cleaned." << LL_ENDL ; LLNotificationsUI::LLToast::cleanupToasts(); - llinfos << "Leftover toast cleaned up." << llendl; + LL_INFOS() << "Leftover toast cleaned up." << LL_ENDL; // DEV-40930: Clear sModalStack. Otherwise, any LLModalDialog left open // will crump with LL_ERRS. LLModalDialog::shutdownModals(); - llinfos << "LLModalDialog shut down." << llendl; + LL_INFOS() << "LLModalDialog shut down." << LL_ENDL; // destroy the nav bar, not currently part of gViewerWindow // *TODO: Make LLNavigationBar part of gViewerWindow @@ -2066,17 +2069,17 @@ void LLViewerWindow::shutdownViews() { delete LLNavigationBar::getInstance(); } - llinfos << "LLNavigationBar destroyed." << llendl ; + LL_INFOS() << "LLNavigationBar destroyed." << LL_ENDL ; // destroy menus after instantiating navbar above, as it needs // access to gMenuHolder cleanup_menus(); - llinfos << "menus destroyed." << llendl ; + LL_INFOS() << "menus destroyed." << LL_ENDL ; // Delete all child views. delete mRootView; mRootView = NULL; - llinfos << "RootView deleted." << llendl ; + LL_INFOS() << "RootView deleted." << LL_ENDL ; LLMenuOptionPathfindingRebakeNavmesh::getInstance()->quit(); @@ -2104,12 +2107,12 @@ void LLViewerWindow::shutdownGL() gSky.cleanup(); stop_glerror(); - llinfos << "Cleaning up pipeline" << llendl; + LL_INFOS() << "Cleaning up pipeline" << LL_ENDL; gPipeline.cleanup(); stop_glerror(); //MUST clean up pipeline before cleaning up wearables - llinfos << "Cleaning up wearables" << llendl; + LL_INFOS() << "Cleaning up wearables" << LL_ENDL; LLWearableList::instance().cleanup() ; gTextureList.shutdown(); @@ -2123,12 +2126,12 @@ void LLViewerWindow::shutdownGL() LLViewerTextureManager::cleanup() ; LLImageGL::cleanupClass() ; - llinfos << "All textures and llimagegl images are destroyed!" << llendl ; + LL_INFOS() << "All textures and llimagegl images are destroyed!" << LL_ENDL ; - llinfos << "Cleaning up select manager" << llendl; + LL_INFOS() << "Cleaning up select manager" << LL_ENDL; LLSelectMgr::getInstance()->cleanup(); - llinfos << "Stopping GL during shutdown" << llendl; + LL_INFOS() << "Stopping GL during shutdown" << LL_ENDL; stopGL(FALSE); stop_glerror(); @@ -2136,19 +2139,17 @@ void LLViewerWindow::shutdownGL() LLVertexBuffer::cleanupClass(); - llinfos << "LLVertexBuffer cleaned." << llendl ; + LL_INFOS() << "LLVertexBuffer cleaned." << LL_ENDL ; } // shutdownViews() and shutdownGL() need to be called first LLViewerWindow::~LLViewerWindow() { - llinfos << "Destroying Window" << llendl; + LL_INFOS() << "Destroying Window" << LL_ENDL; destroyWindow(); delete mDebugText; mDebugText = NULL; - - delete mMouseVelocityStat; } @@ -2259,8 +2260,8 @@ void LLViewerWindow::reshape(S32 width, S32 height) } } - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_WIDTH, (F64)width); - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_HEIGHT, (F64)height); + sample(LLStatViewer::WINDOW_WIDTH, width); + sample(LLStatViewer::WINDOW_HEIGHT, height); LLLayoutStack::updateClass(); } @@ -2535,7 +2536,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) ||(gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE)) ||(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE))) { - lldebugs << "LLviewerWindow::handleKey handle nav keys for nav" << llendl; + LL_DEBUGS() << "LLviewerWindow::handleKey handle nav keys for nav" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); return TRUE; } @@ -2568,7 +2569,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // if nothing has focus, go to first or last UI element as appropriate if (key == KEY_TAB && (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL)) { - llwarns << "LLviewerWindow::handleKey give floaters first chance at tab key " << llendl; + LL_WARNS() << "LLviewerWindow::handleKey give floaters first chance at tab key " << LL_ENDL; if (gMenuHolder) gMenuHolder->hideMenus(); // if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode @@ -2630,17 +2631,17 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) if (keyboard_focus->handleKey(key, mask, FALSE)) { - lldebugs << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned true" << llendl; + LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned true" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); return TRUE; } else { - lldebugs << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned FALSE" << llendl; + LL_DEBUGS() << "LLviewerWindow::handleKey - in 'traverse up' - no loops seen... just called keyboard_focus->handleKey an it returned FALSE" << LL_ENDL; } } if( LLToolMgr::getInstance()->getCurrentTool()->handleKey(key, mask) ) { - lldebugs << "LLviewerWindow::handleKey toolbar handling?" << llendl; + LL_DEBUGS() << "LLviewerWindow::handleKey toolbar handling?" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); return TRUE; } @@ -2648,7 +2649,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // Try for a new-format gesture if (LLGestureMgr::instance().triggerGesture(key, mask)) { - lldebugs << "LLviewerWindow::handleKey new gesture feature" << llendl; + LL_DEBUGS() << "LLviewerWindow::handleKey new gesture feature" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); return TRUE; } @@ -2657,7 +2658,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // don't pass it down to the menus. if (gGestureList.trigger(key, mask)) { - lldebugs << "LLviewerWindow::handleKey check gesture trigger" << llendl; + LL_DEBUGS() << "LLviewerWindow::handleKey check gesture trigger" << LL_ENDL; LLViewerEventRecorder::instance().logKeyEvent(key,mask); return TRUE; } @@ -2750,7 +2751,7 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) mouse_captor->handleScrollWheel(local_x, local_y, clicks); if (LLView::sDebugMouseHandling) { - llinfos << "Scroll Wheel handled by captor " << mouse_captor->getName() << llendl; + LL_INFOS() << "Scroll Wheel handled by captor " << mouse_captor->getName() << LL_ENDL; } return; } @@ -2768,13 +2769,13 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) { if (LLView::sDebugMouseHandling) { - llinfos << "Scroll Wheel" << LLView::sMouseHandlerMessage << llendl; + LL_INFOS() << "Scroll Wheel" << LLView::sMouseHandlerMessage << LL_ENDL; } return; } else if (LLView::sDebugMouseHandling) { - llinfos << "Scroll Wheel not handled by view" << llendl; + LL_INFOS() << "Scroll Wheel not handled by view" << LL_ENDL; } // Zoom the camera in and out behavior @@ -2863,12 +2864,13 @@ void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params) } } +static LLTrace::BlockTimerStatHandle ftm("Update UI"); + // Update UI based on stored mouse position from mouse-move // event processing. void LLViewerWindow::updateUI() { - static LLFastTimer::DeclareTimer ftm("Update UI"); - LLFastTimer t(ftm); + LL_RECORD_BLOCK_TIME(ftm); static std::string last_handle_msg; @@ -3089,12 +3091,12 @@ void LLViewerWindow::updateUI() handled = mouse_captor->handleHover(local_x, local_y, mask); if (LLView::sDebugMouseHandling) { - llinfos << "Hover handled by captor " << mouse_captor->getName() << llendl; + LL_INFOS() << "Hover handled by captor " << mouse_captor->getName() << LL_ENDL; } if( !handled ) { - lldebugst(LLERR_USER_INPUT) << "hover not handled by mouse captor" << llendl; + LL_DEBUGS("UserInput") << "hover not handled by mouse captor" << LL_ENDL; } } else @@ -3115,7 +3117,7 @@ void LLViewerWindow::updateUI() if (LLView::sDebugMouseHandling && LLView::sMouseHandlerMessage != last_handle_msg) { last_handle_msg = LLView::sMouseHandlerMessage; - llinfos << "Hover" << LLView::sMouseHandlerMessage << llendl; + LL_INFOS() << "Hover" << LLView::sMouseHandlerMessage << LL_ENDL; } handled = TRUE; } @@ -3124,7 +3126,7 @@ void LLViewerWindow::updateUI() if (last_handle_msg != LLStringUtil::null) { last_handle_msg.clear(); - llinfos << "Hover not handled by view" << llendl; + LL_INFOS() << "Hover not handled by view" << LL_ENDL; } } } @@ -3337,8 +3339,8 @@ void LLViewerWindow::updateMouseDelta() static F32 fdy = 0.f; F32 amount = 16.f; - fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f); - fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f); + fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds.value()*amount,1.f); + fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds.value()*amount,1.f); mCurrentMouseDelta.set(llround(fdx), llround(fdy)); mouse_vel.setVec(fdx,fdy); @@ -3349,7 +3351,7 @@ void LLViewerWindow::updateMouseDelta() mouse_vel.setVec((F32) dx, (F32) dy); } - mMouseVelocityStat->addValue(mouse_vel.magVec()); + sample(sMouseVelocityStat, mouse_vel.magVec()); } void LLViewerWindow::updateKeyboardFocus() @@ -3440,10 +3442,10 @@ void LLViewerWindow::updateKeyboardFocus() } } -static LLFastTimer::DeclareTimer FTM_UPDATE_WORLD_VIEW("Update World View"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_WORLD_VIEW("Update World View"); void LLViewerWindow::updateWorldViewRect(bool use_full_window) { - LLFastTimer ft(FTM_UPDATE_WORLD_VIEW); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_WORLD_VIEW); // start off using whole window to render world LLRect new_world_rect = mWindowRectRaw; @@ -3716,11 +3718,11 @@ BOOL LLViewerWindow::clickPointOnSurfaceGlobal(const S32 x, const S32 y, LLViewe if (!intersect) { point_global = clickPointInWorldGlobal(x, y, objectp); - llinfos << "approx intersection at " << (objectp->getPositionGlobal() - point_global) << llendl; + LL_INFOS() << "approx intersection at " << (objectp->getPositionGlobal() - point_global) << LL_ENDL; } else { - llinfos << "good intersection at " << (objectp->getPositionGlobal() - point_global) << llendl; + LL_INFOS() << "good intersection at " << (objectp->getPositionGlobal() - point_global) << LL_ENDL; } return intersect; @@ -3940,7 +3942,7 @@ LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 de } } } - + return found; } @@ -4088,13 +4090,13 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d S32 grids_per_edge = (S32) regionp->getLand().mGridsPerEdge; if ((i >= grids_per_edge) || (j >= grids_per_edge)) { - //llinfos << "LLViewerWindow::mousePointOnLand probe_point is out of region" << llendl; + //LL_INFOS() << "LLViewerWindow::mousePointOnLand probe_point is out of region" << LL_ENDL; continue; } land_z = regionp->getLand().resolveHeightRegion(probe_point_region); - //llinfos << "mousePointOnLand initial z " << land_z << llendl; + //LL_INFOS() << "mousePointOnLand initial z " << land_z << LL_ENDL; if (probe_point_region.mV[VZ] < land_z) { @@ -4135,7 +4137,7 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d j = (S32) (local_probe_point.mV[VY]/regionp->getLand().getMetersPerGrid()); if ((i >= regionp->getLand().mGridsPerEdge) || (j >= regionp->getLand().mGridsPerEdge)) { - // llinfos << "LLViewerWindow::mousePointOnLand probe_point is out of region" << llendl; + // LL_INFOS() << "LLViewerWindow::mousePointOnLand probe_point is out of region" << LL_ENDL; continue; } land_z = regionp->getLand().mSurfaceZ[ i + j * (regionp->getLand().mGridsPerEdge) ]; @@ -4143,7 +4145,7 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d land_z = regionp->getLand().resolveHeightRegion(probe_point_region); - //llinfos << "mousePointOnLand refine z " << land_z << llendl; + //LL_INFOS() << "mousePointOnLand refine z " << land_z << LL_ENDL; if (probe_point_region.mV[VZ] < land_z) { @@ -4163,7 +4165,7 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picke { if (!image) { - llwarns << "No image to save" << llendl; + LL_WARNS() << "No image to save" << LL_ENDL; return FALSE; } @@ -4223,7 +4225,7 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picke } while( -1 != err ); // search until the file is not found (i.e., stat() gives an error). - llinfos << "Saving snapshot to " << filepath << llendl; + LL_INFOS() << "Saving snapshot to " << filepath << LL_ENDL; return image->save(filepath); } @@ -4246,7 +4248,7 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height) BOOL LLViewerWindow::saveSnapshot( const std::string& filepath, S32 image_width, S32 image_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) { - llinfos << "Saving snapshot to: " << filepath << llendl; + LL_INFOS() << "Saving snapshot to: " << filepath << LL_ENDL; LLPointer<LLImageRaw> raw = new LLImageRaw; BOOL success = rawSnapshot(raw, image_width, image_height, TRUE, FALSE, show_ui, do_rebuild); @@ -4261,12 +4263,12 @@ BOOL LLViewerWindow::saveSnapshot( const std::string& filepath, S32 image_width, } else { - llwarns << "Unable to encode bmp snapshot" << llendl; + LL_WARNS() << "Unable to encode bmp snapshot" << LL_ENDL; } } else { - llwarns << "Unable to capture raw snapshot" << llendl; + LL_WARNS() << "Unable to capture raw snapshot" << LL_ENDL; } return success; @@ -4307,7 +4309,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei { if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3)) { - llwarns << "No enough memory to take the snapshot with size (w : h): " << image_width << " : " << image_height << llendl ; + LL_WARNS() << "No enough memory to take the snapshot with size (w : h): " << image_width << " : " << image_height << LL_ENDL ; return FALSE ; //there is no enough memory for taking this snapshot. } } @@ -4404,7 +4406,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei if (show_ui && scale_factor > 1.f) { // Note: we should never get there... - llwarns << "over scaling UI not supported." << llendl; + LL_WARNS() << "over scaling UI not supported." << LL_ENDL; } S32 buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f); @@ -4436,7 +4438,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei if (high_res && show_ui) { // Note: we should never get there... - llwarns << "High res UI snapshot not supported. " << llendl; + LL_WARNS() << "High res UI snapshot not supported. " << LL_ENDL; /*send_agent_pause(); //rescale fonts initFonts(scale_factor); @@ -4481,6 +4483,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei // Required for showing the GUI in snapshots and performing bloom composite overlay // Call even if show_ui is FALSE render_ui(scale_factor, subfield); + swap(); } for (U32 out_y = 0; out_y < read_height ; out_y++) @@ -4802,10 +4805,10 @@ LLProgressView *LLViewerWindow::getProgressView() const void LLViewerWindow::dumpState() { - llinfos << "LLViewerWindow Active " << S32(mActive) << llendl; - llinfos << "mWindow visible " << S32(mWindow->getVisible()) + LL_INFOS() << "LLViewerWindow Active " << S32(mActive) << LL_ENDL; + LL_INFOS() << "mWindow visible " << S32(mWindow->getVisible()) << " minimized " << S32(mWindow->getMinimized()) - << llendl; + << LL_ENDL; } void LLViewerWindow::stopGL(BOOL save_state) @@ -4816,7 +4819,7 @@ void LLViewerWindow::stopGL(BOOL save_state) //especially be careful to put anything behind gTextureList.destroyGL(save_state); if (!gGLManager.mIsDisabled) { - llinfos << "Shutting down GL..." << llendl; + LL_INFOS() << "Shutting down GL..." << LL_ENDL; // Pause texture decode threads (will get unpaused during main loop) LLAppViewer::getTextureCache()->pause(); @@ -4861,7 +4864,7 @@ void LLViewerWindow::stopGL(BOOL save_state) gGLManager.mIsDisabled = TRUE; stop_glerror(); - llinfos << "Remaining allocated texture memory: " << LLImageGL::sGlobalTextureMemoryInBytes << " bytes" << llendl; + LL_INFOS() << "Remaining allocated texture memory: " << LLImageGL::sGlobalTextureMemory.value() << " bytes" << LL_ENDL; } } @@ -4873,7 +4876,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) //especially, be careful to put something before gTextureList.restoreGL(); if (gGLManager.mIsDisabled) { - llinfos << "Restoring GL..." << llendl; + LL_INFOS() << "Restoring GL..." << LL_ENDL; gGLManager.mIsDisabled = FALSE; initGLDefaults(); @@ -4910,10 +4913,10 @@ void LLViewerWindow::restoreGL(const std::string& progress_message) setShowProgress(TRUE); setProgressString(progress_message); } - llinfos << "...Restoring GL done" << llendl; + LL_INFOS() << "...Restoring GL done" << LL_ENDL; if(!LLAppViewer::instance()->restoreErrorTrap()) { - llwarns << " Someone took over my signal/exception handler (post restoreGL)!" << llendl; + LL_WARNS() << " Someone took over my signal/exception handler (post restoreGL)!" << LL_ENDL; } } @@ -4939,11 +4942,11 @@ void LLViewerWindow::requestResolutionUpdate() mResDirty = true; } -static LLFastTimer::DeclareTimer FTM_WINDOW_CHECK_SETTINGS("Window Settings"); +static LLTrace::BlockTimerStatHandle FTM_WINDOW_CHECK_SETTINGS("Window Settings"); void LLViewerWindow::checkSettings() { - LLFastTimer t(FTM_WINDOW_CHECK_SETTINGS); + LL_RECORD_BLOCK_TIME(FTM_WINDOW_CHECK_SETTINGS); if (mStatesDirty) { gGL.refreshState(); @@ -4961,7 +4964,7 @@ void LLViewerWindow::checkSettings() void LLViewerWindow::restartDisplay(BOOL show_progress_bar) { - llinfos << "Restaring GL" << llendl; + LL_INFOS() << "Restaring GL" << LL_ENDL; stopGL(); if (show_progress_bar) { @@ -5004,7 +5007,7 @@ BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL disable_vsyn LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus(); send_agent_pause(); - llinfos << "Stopping GL during changeDisplaySettings" << llendl; + LL_INFOS() << "Stopping GL during changeDisplaySettings" << LL_ENDL; stopGL(); mIgnoreActivate = TRUE; LLCoordScreen old_size; @@ -5030,7 +5033,7 @@ BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL disable_vsyn } send_agent_resume(); - llinfos << "Restoring GL during resolution change" << llendl; + LL_INFOS() << "Restoring GL during resolution change" << LL_ENDL; if (show_progress_bar) { restoreGL(LLTrans::getString("ProgressChangingResolution")); @@ -5096,7 +5099,7 @@ void LLViewerWindow::calcDisplayScale() if (display_scale != mDisplayScale) { - llinfos << "Setting display scale to " << display_scale << llendl; + LL_INFOS() << "Setting display scale to " << display_scale << LL_ENDL; mDisplayScale = display_scale; // Init default fonts @@ -5399,7 +5402,7 @@ void LLPickInfo::getSurfaceInfo() tangent.clear(); normal.clear(); intersection.clear(); - + LLViewerObject* objectp = getObject(); if (objectp) @@ -5420,7 +5423,7 @@ void LLPickInfo::getSurfaceInfo() if (facep) { mUVCoords = facep->surfaceToTexture(mSTCoords, intersection, normal); - } + } } mIntersection.set(intersection.getF32ptr()); diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index c16b80b2149f5cbe7551f2352650ef2fbcd8f1c6..5d2df2dfd721994bed248419925552cc0570b8cd 100755 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -45,12 +45,12 @@ #include "llnotifications.h" #include "llhandle.h" #include "llinitparam.h" +#include "lltrace.h" #include <boost/function.hpp> #include <boost/signals2.hpp> #include <boost/scoped_ptr.hpp> -class LLStat; class LLView; class LLViewerObject; class LLUUID; @@ -257,7 +257,7 @@ class LLViewerWindow : public LLWindowCallbacks S32 getCurrentMouseDX() const { return mCurrentMouseDelta.mX; } S32 getCurrentMouseDY() const { return mCurrentMouseDelta.mY; } LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; } - LLStat* getMouseVelocityStat() { return mMouseVelocityStat; } + static LLTrace::SampleStatHandle<>* getMouseVelocityStat() { return &sMouseVelocityStat; } BOOL getLeftMouseDown() const { return mLeftMouseDown; } BOOL getMiddleMouseDown() const { return mMiddleMouseDown; } BOOL getRightMouseDown() const { return mRightMouseDown; } @@ -438,7 +438,6 @@ class LLViewerWindow : public LLWindowCallbacks LLCoordGL mCurrentMousePoint; // last mouse position in GL coords LLCoordGL mLastMousePoint; // Mouse point at last frame. LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame - LLStat* mMouseVelocityStat; BOOL mLeftMouseDown; BOOL mMiddleMouseDown; BOOL mRightMouseDown; @@ -493,6 +492,8 @@ class LLViewerWindow : public LLWindowCallbacks // Object temporarily hovered over while dragging LLPointer<LLViewerObject> mDragHoveredObject; + + static LLTrace::SampleStatHandle<> sMouseVelocityStat; }; // diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index 94760e3c8351ce1ec50bb40b707f2f8a0e6c89b6..4e9400872a62fe784936c94d4d22b65bd0dd2369 100755 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -28,7 +28,6 @@ #include "llvlcomposition.h" -#include "imageids.h" #include "llerror.h" #include "v3math.h" #include "llsurface.h" @@ -288,7 +287,7 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, { mDetailTextures[i]->destroyRawImage() ; } - lldebugs << "cached raw data for terrain detail texture is not ready yet: " << mDetailTextures[i]->getID() << llendl; + LL_DEBUGS() << "cached raw data for terrain detail texture is not ready yet: " << mDetailTextures[i]->getID() << LL_ENDL; return FALSE; } @@ -324,12 +323,12 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, if (x_end > mWidth) { - llwarns << "x end > width" << llendl; + LL_WARNS() << "x end > width" << LL_ENDL; x_end = mWidth; } if (y_end > mWidth) { - llwarns << "y end > width" << llendl; + LL_WARNS() << "y end > width" << LL_ENDL; y_end = mWidth; } @@ -359,7 +358,7 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, if (tex_comps != st_comps) { - llwarns << "Base texture comps != input texture comps" << llendl; + LL_WARNS() << "Base texture comps != input texture comps" << LL_ENDL; return FALSE; } @@ -417,8 +416,8 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, if (st_offset >= st_data_size[tex0] || st_offset >= st_data_size[tex1]) { // SJB: This shouldn't be happening, but does... Rounding error? - //llwarns << "offset 0 [" << tex0 << "] =" << st_offset << " >= size=" << st_data_size[tex0] << llendl; - //llwarns << "offset 1 [" << tex1 << "] =" << st_offset << " >= size=" << st_data_size[tex1] << llendl; + //LL_WARNS() << "offset 0 [" << tex0 << "] =" << st_offset << " >= size=" << st_data_size[tex0] << LL_ENDL; + //LL_WARNS() << "offset 1 [" << tex1 << "] =" << st_offset << " >= size=" << st_data_size[tex1] << LL_ENDL; } else { diff --git a/indra/newview/llvlmanager.cpp b/indra/newview/llvlmanager.cpp index d8de979f56ccfef8a162fee26f955a6fa14cb2bb..895ceed8804e16269eddd79b9511ceddf5a1939f 100755 --- a/indra/newview/llvlmanager.cpp +++ b/indra/newview/llvlmanager.cpp @@ -29,45 +29,49 @@ #include "llvlmanager.h" #include "indra_constants.h" -#include "bitpack.h" #include "patch_code.h" #include "patch_dct.h" #include "llviewerregion.h" #include "llframetimer.h" #include "llsurface.h" +#include "llbitpack.h" + +const char LAND_LAYER_CODE = 'L'; +const char WIND_LAYER_CODE = '7'; +const char CLOUD_LAYER_CODE = '8'; LLVLManager gVLManager; LLVLManager::~LLVLManager() { S32 i; - for (i = 0; i < mPacketData.count(); i++) + for (i = 0; i < mPacketData.size(); i++) { delete mPacketData[i]; } - mPacketData.reset(); + mPacketData.clear(); } -void LLVLManager::addLayerData(LLVLData *vl_datap, const S32 mesg_size) +void LLVLManager::addLayerData(LLVLData *vl_datap, const S32Bytes mesg_size) { if (LAND_LAYER_CODE == vl_datap->mType) { - mLandBits += mesg_size * 8; + mLandBits += mesg_size; } else if (WIND_LAYER_CODE == vl_datap->mType) { - mWindBits += mesg_size * 8; + mWindBits += mesg_size; } else if (CLOUD_LAYER_CODE == vl_datap->mType) { - mCloudBits += mesg_size * 8; + mCloudBits += mesg_size; } else { - llerrs << "Unknown layer type!" << (S32)vl_datap->mType << llendl; + LL_ERRS() << "Unknown layer type!" << (S32)vl_datap->mType << LL_ENDL; } - mPacketData.put(vl_datap); + mPacketData.push_back(vl_datap); } void LLVLManager::unpackData(const S32 num_packets) @@ -75,7 +79,7 @@ void LLVLManager::unpackData(const S32 num_packets) static LLFrameTimer decode_timer; S32 i; - for (i = 0; i < mPacketData.count(); i++) + for (i = 0; i < mPacketData.size(); i++) { LLVLData *datap = mPacketData[i]; @@ -98,35 +102,35 @@ void LLVLManager::unpackData(const S32 num_packets) } } - for (i = 0; i < mPacketData.count(); i++) + for (i = 0; i < mPacketData.size(); i++) { delete mPacketData[i]; } - mPacketData.reset(); + mPacketData.clear(); } void LLVLManager::resetBitCounts() { - mLandBits = mWindBits = mCloudBits = 0; + mLandBits = mWindBits = mCloudBits = (S32Bits)0; } -S32 LLVLManager::getLandBits() const +U32Bits LLVLManager::getLandBits() const { return mLandBits; } -S32 LLVLManager::getWindBits() const +U32Bits LLVLManager::getWindBits() const { return mWindBits; } -S32 LLVLManager::getCloudBits() const +U32Bits LLVLManager::getCloudBits() const { return mCloudBits; } -S32 LLVLManager::getTotalBytes() const +S32Bytes LLVLManager::getTotalBytes() const { return mLandBits + mWindBits + mCloudBits; } @@ -134,12 +138,12 @@ S32 LLVLManager::getTotalBytes() const void LLVLManager::cleanupData(LLViewerRegion *regionp) { S32 cur = 0; - while (cur < mPacketData.count()) + while (cur < mPacketData.size()) { if (mPacketData[cur]->mRegionp == regionp) { delete mPacketData[cur]; - mPacketData.remove(cur); + mPacketData.erase(mPacketData.begin() + cur); } else { diff --git a/indra/newview/llvlmanager.h b/indra/newview/llvlmanager.h index 74b4823a5cf2babb2d0933b4637504bfb8d1e21f..5e7fadc522272eb66a8e8bee86021f180e516a33 100755 --- a/indra/newview/llvlmanager.h +++ b/indra/newview/llvlmanager.h @@ -30,7 +30,6 @@ // This class manages the data coming in for viewer layers from the network. #include "stdtypes.h" -#include "lldarray.h" class LLVLData; class LLViewerRegion; @@ -40,25 +39,25 @@ class LLVLManager public: ~LLVLManager(); - void addLayerData(LLVLData *vl_datap, const S32 mesg_size); + void addLayerData(LLVLData *vl_datap, const S32Bytes mesg_size); void unpackData(const S32 num_packets = 10); - S32 getTotalBytes() const; + S32Bytes getTotalBytes() const; - S32 getLandBits() const; - S32 getWindBits() const; - S32 getCloudBits() const; + U32Bits getLandBits() const; + U32Bits getWindBits() const; + U32Bits getCloudBits() const; void resetBitCounts(); void cleanupData(LLViewerRegion *regionp); protected: - LLDynamicArray<LLVLData *> mPacketData; - U32 mLandBits; - U32 mWindBits; - U32 mCloudBits; + std::vector<LLVLData *> mPacketData; + U32Bits mLandBits; + U32Bits mWindBits; + U32Bits mCloudBits; }; class LLVLData diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c47b6d2335b984fa2c14b6c6720a2c634a272681..04f64a499748ca704a22813e525705a4fa913b97 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -51,7 +51,6 @@ #include "llpolyskeletaldistortion.h" #include "lleditingmotion.h" #include "llemote.h" -//#include "llfirstuse.h" #include "llfloatertools.h" #include "llheadrotmotion.h" #include "llhudeffecttrail.h" @@ -68,6 +67,7 @@ #include "llmutelist.h" #include "llmoveview.h" #include "llnotificationsutil.h" +#include "llphysicsshapebuilderutil.h" #include "llquantize.h" #include "llrand.h" #include "llregionhandle.h" @@ -82,6 +82,7 @@ #include "llviewermenu.h" #include "llviewerobjectlist.h" #include "llviewerparcelmgr.h" +#include "llviewerregion.h" #include "llviewershadermgr.h" #include "llviewerstats.h" #include "llviewerwearable.h" @@ -101,6 +102,7 @@ #include "lldebugmessagebox.h" #include "llsdutil.h" +#include "llscenemonitor.h" #include "llsdserialize.h" extern F32 SPEED_ADJUST_MAX; @@ -116,16 +118,16 @@ using namespace LLAvatarAppearanceDefines; //----------------------------------------------------------------------------- // Global constants //----------------------------------------------------------------------------- -const LLUUID ANIM_AGENT_BODY_NOISE = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad"); //"body_noise" -const LLUUID ANIM_AGENT_BREATHE_ROT = LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8"); //"breathe_rot" -const LLUUID ANIM_AGENT_EDITING = LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb"); //"editing" -const LLUUID ANIM_AGENT_EYE = LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea"); //"eye" -const LLUUID ANIM_AGENT_FLY_ADJUST = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e"); //"fly_adjust" -const LLUUID ANIM_AGENT_HAND_MOTION = LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578"); //"hand_motion" -const LLUUID ANIM_AGENT_HEAD_ROT = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d"); //"head_rot" -const LLUUID ANIM_AGENT_PELVIS_FIX = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b"); //"pelvis_fix" -const LLUUID ANIM_AGENT_TARGET = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55"); //"target" -const LLUUID ANIM_AGENT_WALK_ADJUST = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d"); //"walk_adjust" +const LLUUID ANIM_AGENT_BODY_NOISE = LLUUID("9aa8b0a6-0c6f-9518-c7c3-4f41f2c001ad"); //"body_noise" +const LLUUID ANIM_AGENT_BREATHE_ROT = LLUUID("4c5a103e-b830-2f1c-16bc-224aa0ad5bc8"); //"breathe_rot" +const LLUUID ANIM_AGENT_EDITING = LLUUID("2a8eba1d-a7f8-5596-d44a-b4977bf8c8bb"); //"editing" +const LLUUID ANIM_AGENT_EYE = LLUUID("5c780ea8-1cd1-c463-a128-48c023f6fbea"); //"eye" +const LLUUID ANIM_AGENT_FLY_ADJUST = LLUUID("db95561f-f1b0-9f9a-7224-b12f71af126e"); //"fly_adjust" +const LLUUID ANIM_AGENT_HAND_MOTION = LLUUID("ce986325-0ba7-6e6e-cc24-b17c4b795578"); //"hand_motion" +const LLUUID ANIM_AGENT_HEAD_ROT = LLUUID("e6e8d1dd-e643-fff7-b238-c6b4b056a68d"); //"head_rot" +const LLUUID ANIM_AGENT_PELVIS_FIX = LLUUID("0c5dd2a2-514d-8893-d44d-05beffad208b"); //"pelvis_fix" +const LLUUID ANIM_AGENT_TARGET = LLUUID("0e4896cb-fba4-926c-f355-8720189d5b55"); //"target" +const LLUUID ANIM_AGENT_WALK_ADJUST = LLUUID("829bc85b-02fc-ec41-be2e-74cc6dd7215d"); //"walk_adjust" const LLUUID ANIM_AGENT_PHYSICS_MOTION = LLUUID("7360e029-3cb8-ebc4-863e-212df440d987"); //"physics_motion" @@ -253,7 +255,7 @@ struct LLAppearanceMessageContents }; struct LLVOAvatarChildJoint : public LLInitParam::ChoiceBlock<LLVOAvatarChildJoint> -{ + { Alternative<Lazy<struct LLVOAvatarBoneInfo, IS_A_BLOCK> > bone; Alternative<LLVOAvatarCollisionVolumeInfo> collision_volume; @@ -721,7 +723,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, const BOOL needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); - lldebugs << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << llendl; + LL_DEBUGS() << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << LL_ENDL; mPelvisp = NULL; @@ -774,6 +776,11 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mPelvisFixup = 0.0f; mLastPelvisFixup = 0.0f; + if(LLSceneMonitor::getInstance()->isEnabled()) + { + LLSceneMonitor::getInstance()->freezeAvatar((LLCharacter*)this); + } + mCachedVisualMute = !isSelf(); mCachedVisualMuteUpdateTime = LLFrameTimer::getTotalSeconds() + 5.0; mVisuallyMuteSetting = VISUAL_MUTE_NOT_SET; @@ -796,7 +803,7 @@ void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string c << "RuthTimer " << (U32)mRuthDebugTimer.getElapsedTimeF32() << " Notification " << notification_name << " : " << comment - << llendl; + << LL_ENDL; if (gSavedSettings.getBOOL("DebugAvatarRezTime")) { @@ -813,18 +820,18 @@ void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string c //------------------------------------------------------------------------ LLVOAvatar::~LLVOAvatar() { - if (!mFullyLoaded) - { + if (!mFullyLoaded) + { debugAvatarRezTime("AvatarRezLeftCloudNotification","left after ruth seconds as cloud"); - } - else - { + } + else + { debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding"); - } + } logPendingPhases(); - - lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; + + LL_DEBUGS() << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << LL_ENDL; std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); mAttachmentPoints.clear(); @@ -836,7 +843,7 @@ LLVOAvatar::~LLVOAvatar() getPhases().clearPhases(); - lldebugs << "LLVOAvatar Destructor end" << llendl; + LL_DEBUGS() << "LLVOAvatar Destructor end" << LL_ENDL; } void LLVOAvatar::markDead() @@ -1000,54 +1007,54 @@ void LLVOAvatar::dumpBakedStatus() iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; - llinfos << "Avatar "; + LL_INFOS() << "Avatar "; LLNameValue* firstname = inst->getNVPair("FirstName"); LLNameValue* lastname = inst->getNVPair("LastName"); if( firstname ) { - llcont << firstname->getString(); + LL_CONT << firstname->getString(); } if( lastname ) { - llcont << " " << lastname->getString(); + LL_CONT << " " << lastname->getString(); } - llcont << " " << inst->mID; + LL_CONT << " " << inst->mID; if( inst->isDead() ) { - llcont << " DEAD ("<< inst->getNumRefs() << " refs)"; + LL_CONT << " DEAD ("<< inst->getNumRefs() << " refs)"; } if( inst->isSelf() ) { - llcont << " (self)"; + LL_CONT << " (self)"; } F64 dist_to_camera = (inst->getPositionGlobal() - camera_pos_global).length(); - llcont << " " << dist_to_camera << "m "; + LL_CONT << " " << dist_to_camera << "m "; - llcont << " " << inst->mPixelArea << " pixels"; + LL_CONT << " " << inst->mPixelArea << " pixels"; if( inst->isVisible() ) { - llcont << " (visible)"; + LL_CONT << " (visible)"; } else { - llcont << " (not visible)"; + LL_CONT << " (not visible)"; } if( inst->isFullyBaked() ) { - llcont << " Baked"; + LL_CONT << " Baked"; } else { - llcont << " Unbaked ("; + LL_CONT << " Unbaked ("; for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); @@ -1057,16 +1064,16 @@ void LLVOAvatar::dumpBakedStatus() const ETextureIndex index = baked_dict->mTextureIndex; if (!inst->isTextureDefined(index)) { - llcont << " " << LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mName; + LL_CONT << " " << LLAvatarAppearanceDictionary::getInstance()->getTexture(index)->mName; } } - llcont << " ) " << inst->getUnbakedPixelAreaRank(); + LL_CONT << " ) " << inst->getUnbakedPixelAreaRank(); if( inst->isCulled() ) { - llcont << " culled"; + LL_CONT << " culled"; } } - llcont << llendl; + LL_CONT << LL_ENDL; } } @@ -1107,7 +1114,7 @@ void LLVOAvatar::deleteCachedImages(bool clearAll) { if (LLViewerTexLayerSet::sHasCaches) { - lldebugs << "Deleting layer set caches" << llendl; + LL_DEBUGS() << "Deleting layer set caches" << LL_ENDL; for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { @@ -1207,7 +1214,7 @@ void LLVOAvatar::initInstance(void) registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create ); registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create ); } - + LLAvatarAppearance::initInstance(); // preload specific motions here @@ -1318,7 +1325,7 @@ void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) for (polymesh_map_t::iterator i = mPolyMeshes.begin(); i != mPolyMeshes.end(); ++i) { LLPolyMesh* mesh = i->second; - for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.count(); joint_num++) + for (S32 joint_num = 0; joint_num < mesh->mJointRenderData.size(); joint_num++) { LLVector4a trans; trans.load3( mesh->mJointRenderData[joint_num]->mWorldMatrix->getTranslation().mV); @@ -1646,7 +1653,7 @@ LLViewerObject* LLVOAvatar::lineSegmentIntersectRiggedAttachments(const LLVector return hit; } - + LLVOAvatar* LLVOAvatar::asAvatar() { return this; @@ -1700,14 +1707,14 @@ void LLVOAvatar::buildCharacter() // If we don't have the Ooh morph, use the Kiss morph if (!mOohMorph) { - llwarns << "Missing 'Ooh' morph for lipsync, using fallback." << llendl; + LL_WARNS() << "Missing 'Ooh' morph for lipsync, using fallback." << LL_ENDL; mOohMorph = getVisualParam( "Express_Kiss" ); } // If we don't have the Aah morph, use the Open Mouth morph if (!mAahMorph) { - llwarns << "Missing 'Aah' morph for lipsync, using fallback." << llendl; + LL_WARNS() << "Missing 'Aah' morph for lipsync, using fallback." << LL_ENDL; mAahMorph = getVisualParam( "Express_Open_Mouth" ); } @@ -1735,7 +1742,7 @@ void LLVOAvatar::releaseMeshData() return; } - //llinfos << "Releasing" << llendl; + LL_DEBUGS() << "Releasing mesh data" << LL_ENDL; // cleanup mesh data for (avatar_joint_list_t::iterator iter = mMeshLOD.begin(); @@ -1785,7 +1792,7 @@ void LLVOAvatar::restoreMeshData() { llassert(!isSelf()); - //llinfos << "Restoring" << llendl; + //LL_INFOS() << "Restoring" << LL_ENDL; mMeshValid = TRUE; updateJointLODs(); @@ -1896,7 +1903,7 @@ void LLVOAvatar::updateMeshData() // the case of more than one avatar in the pool (thus > 0 instead of >= 0) if (facep->getGeomIndex() > 0) { - llerrs << "non-zero geom index: " << facep->getGeomIndex() << " in LLVOAvatar::restoreMeshData" << llendl; + LL_ERRS() << "non-zero geom index: " << facep->getGeomIndex() << " in LLVOAvatar::restoreMeshData" << LL_ENDL; } for(S32 k = j ; k < part_index ; k++) @@ -1962,8 +1969,8 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, } } - //llinfos << getRotation() << llendl; - //llinfos << getPosition() << llendl; + //LL_INFOS() << getRotation() << LL_ENDL; + //LL_INFOS() << getPosition() << LL_ENDL; return retval; } @@ -1981,22 +1988,22 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU } if (!result) - { +{ const std::string url = getImageURL(te,uuid); if (!url.empty()) - { - LL_DEBUGS("Avatar") << avString() << "from URL " << url << llendl; + { + LL_DEBUGS("Avatar") << avString() << "from URL " << url << LL_ENDL; result = LLViewerTextureManager::getFetchedTextureFromUrl( url, FTT_SERVER_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); - } - else - { - LL_DEBUGS("Avatar") << avString() << "from host " << uuid << llendl; + } + else + { + LL_DEBUGS("Avatar") << avString() << "from host " << uuid << LL_ENDL; LLHost host = getObjectHost(); result = LLViewerTextureManager::getFetchedTexture( uuid, FTT_HOST_BAKE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); - } } +} return result; } @@ -2014,15 +2021,15 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) return setTETextureCore(te, image); } -static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Avatar Update"); -static LLFastTimer::DeclareTimer FTM_JOINT_UPDATE("Update Joints"); +static LLTrace::BlockTimerStatHandle FTM_AVATAR_UPDATE("Avatar Update"); +static LLTrace::BlockTimerStatHandle FTM_JOINT_UPDATE("Update Joints"); //------------------------------------------------------------------------ // LLVOAvatar::dumpAnimationState() //------------------------------------------------------------------------ void LLVOAvatar::dumpAnimationState() { - llinfos << "==============================================" << llendl; + LL_INFOS() << "==============================================" << LL_ENDL; for (LLVOAvatar::AnimIterator it = mSignaledAnimations.begin(); it != mSignaledAnimations.end(); ++it) { LLUUID id = it->first; @@ -2031,7 +2038,7 @@ void LLVOAvatar::dumpAnimationState() { playtag = "*"; } - llinfos << gAnimLibrary.animationName(id) << playtag << llendl; + LL_INFOS() << gAnimLibrary.animationName(id) << playtag << LL_ENDL; } for (LLVOAvatar::AnimIterator it = mPlayingAnimations.begin(); it != mPlayingAnimations.end(); ++it) { @@ -2039,7 +2046,7 @@ void LLVOAvatar::dumpAnimationState() bool is_signaled = mSignaledAnimations.find(id) != mSignaledAnimations.end(); if (!is_signaled) { - llinfos << gAnimLibrary.animationName(id) << "!S" << llendl; + LL_INFOS() << gAnimLibrary.animationName(id) << "!S" << LL_ENDL; } } } @@ -2049,11 +2056,11 @@ void LLVOAvatar::dumpAnimationState() //------------------------------------------------------------------------ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) { - LLFastTimer t(FTM_AVATAR_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_AVATAR_UPDATE); if (isDead()) { - llinfos << "Warning! Idle on dead avatar" << llendl; + LL_INFOS() << "Warning! Idle on dead avatar" << LL_ENDL; return; } @@ -2071,7 +2078,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) // force asynchronous drawable update if(mDrawable.notNull()) { - LLFastTimer t(FTM_JOINT_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_JOINT_UPDATE); if (mIsSitting && getParent()) { @@ -2184,7 +2191,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) if ( mCurrentGesticulationLevel == 0 ) { gestureString = "/voicelevel1"; } else if ( mCurrentGesticulationLevel == 1 ) { gestureString = "/voicelevel2"; } else if ( mCurrentGesticulationLevel == 2 ) { gestureString = "/voicelevel3"; } - else { llinfos << "oops - CurrentGesticulationLevel can be only 0, 1, or 2" << llendl; } + else { LL_INFOS() << "oops - CurrentGesticulationLevel can be only 0, 1, or 2" << LL_ENDL; } // this is the call that Karl S. created for triggering gestures from within the code. LLGestureMgr::instance().triggerAndReviseString( gestureString ); @@ -2254,13 +2261,13 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) }//if ( voiceEnabled ) } -static LLFastTimer::DeclareTimer FTM_ATTACHMENT_UPDATE("Update Attachments"); +static LLTrace::BlockTimerStatHandle FTM_ATTACHMENT_UPDATE("Update Attachments"); void LLVOAvatar::idleUpdateMisc(bool detailed_update) { if (LLVOAvatar::sJointDebug) { - llinfos << getFullname() << ": joint touches: " << LLJoint::sNumTouches << " updates: " << LLJoint::sNumUpdates << llendl; + LL_INFOS() << getFullname() << ": joint touches: " << LLJoint::sNumTouches << " updates: " << LLJoint::sNumUpdates << LL_ENDL; } LLJoint::sNumUpdates = 0; @@ -2271,7 +2278,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) // update attachments positions if (detailed_update || !sUseImpostors) { - LLFastTimer t(FTM_ATTACHMENT_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_ATTACHMENT_UPDATE); for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) @@ -2550,7 +2557,7 @@ void LLVOAvatar::idleUpdateWindEffect() LLVector3 velocity = getVelocity(); F32 speed = velocity.length(); //RN: velocity varies too much frame to frame for this to work - mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLCriticalDamp::getInterpolant(0.02f)); + mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLSmoothInterpolation::getInterpolant(0.02f)); mLastVel = velocity; LLVector4 wind; wind.setVec(getRegion()->mWind.getVelocityNoisy(getPositionAgent(), 4.f) - velocity); @@ -2573,11 +2580,11 @@ void LLVOAvatar::idleUpdateWindEffect() F32 interp; if (wind.mV[VW] > mWindVec.mV[VW]) { - interp = LLCriticalDamp::getInterpolant(0.2f); + interp = LLSmoothInterpolation::getInterpolant(0.2f); } else { - interp = LLCriticalDamp::getInterpolant(0.4f); + interp = LLSmoothInterpolation::getInterpolant(0.4f); } mWindVec = lerp(mWindVec, wind, interp); @@ -3003,7 +3010,7 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) mTargetRootToHeadOffset = head_offset; } - mCurRootToHeadOffset = lerp(mCurRootToHeadOffset, mTargetRootToHeadOffset, LLCriticalDamp::getInterpolant(0.2f)); + mCurRootToHeadOffset = lerp(mCurRootToHeadOffset, mTargetRootToHeadOffset, LLSmoothInterpolation::getInterpolant(0.2f)); LLVector3 name_position = mRoot->getLastWorldPosition() + (mCurRootToHeadOffset * root_rot); name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av)); @@ -3324,7 +3331,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) removeAnimationData("Walk Speed"); } mMotionController.setTimeStep(time_step); -// llinfos << "Setting timestep to " << time_quantum * pixel_area_scale << llendl; +// LL_INFOS() << "Setting timestep to " << time_quantum * pixel_area_scale << LL_ENDL; } if (getParent() && !mIsSitting) @@ -3544,7 +3551,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // Set the root rotation, but do so incrementally so that it // lags in time by some fixed amount. - //F32 u = LLCriticalDamp::getInterpolant(PELVIS_LAG); + //F32 u = LLSmoothInterpolation::getInterpolant(PELVIS_LAG); F32 pelvis_lag_time = 0.f; if (self_in_mouselook) { @@ -3790,42 +3797,42 @@ void LLVOAvatar::updateVisibility() } else { - llinfos << "Avatar " << this << " updating visiblity" << llendl; + LL_INFOS() << "Avatar " << this << " updating visiblity" << LL_ENDL; } if (visible) { - llinfos << "Visible" << llendl; + LL_INFOS() << "Visible" << LL_ENDL; } else { - llinfos << "Not visible" << llendl; + LL_INFOS() << "Not visible" << LL_ENDL; } /*if (avatar_in_frustum) { - llinfos << "Avatar in frustum" << llendl; + LL_INFOS() << "Avatar in frustum" << LL_ENDL; } else { - llinfos << "Avatar not in frustum" << llendl; + LL_INFOS() << "Avatar not in frustum" << LL_ENDL; }*/ /*if (LLViewerCamera::getInstance()->sphereInFrustum(sel_pos_agent, 2.0f)) { - llinfos << "Sel pos visible" << llendl; + LL_INFOS() << "Sel pos visible" << LL_ENDL; } if (LLViewerCamera::getInstance()->sphereInFrustum(wrist_right_pos_agent, 0.2f)) { - llinfos << "Wrist pos visible" << llendl; + LL_INFOS() << "Wrist pos visible" << LL_ENDL; } if (LLViewerCamera::getInstance()->sphereInFrustum(getPositionAgent(), getMaxScale()*2.f)) { - llinfos << "Agent visible" << llendl; + LL_INFOS() << "Agent visible" << LL_ENDL; }*/ - llinfos << "PA: " << getPositionAgent() << llendl; - /*llinfos << "SPA: " << sel_pos_agent << llendl; - llinfos << "WPA: " << wrist_right_pos_agent << llendl;*/ + LL_INFOS() << "PA: " << getPositionAgent() << LL_ENDL; + /*LL_INFOS() << "SPA: " << sel_pos_agent << LL_ENDL; + LL_INFOS() << "WPA: " << wrist_right_pos_agent << LL_ENDL;*/ for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) @@ -3840,11 +3847,11 @@ void LLVOAvatar::updateVisibility() { if(attached_object->mDrawable->isVisible()) { - llinfos << attachment->getName() << " visible" << llendl; + LL_INFOS() << attachment->getName() << " visible" << LL_ENDL; } else { - llinfos << attachment->getName() << " not visible at " << mDrawable->getWorldPosition() << " and radius " << mDrawable->getRadius() << llendl; + LL_INFOS() << attachment->getName() << " not visible at " << mDrawable->getWorldPosition() << " and radius " << mDrawable->getRadius() << LL_ENDL; } } } @@ -3888,7 +3895,7 @@ bool LLVOAvatar::shouldAlphaMask() //----------------------------------------------------------------------------- // renderSkinned() //----------------------------------------------------------------------------- -U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) +U32 LLVOAvatar::renderSkinned() { U32 num_indices = 0; @@ -3984,19 +3991,19 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) } else { - llinfos << "Avatar " << this << " in render" << llendl; + LL_INFOS() << "Avatar " << this << " in render" << LL_ENDL; } if (!mIsBuilt) { - llinfos << "Not built!" << llendl; + LL_INFOS() << "Not built!" << LL_ENDL; } else if (!gAgent.needsRenderAvatar()) { - llinfos << "Doesn't need avatar render!" << llendl; + LL_INFOS() << "Doesn't need avatar render!" << LL_ENDL; } else { - llinfos << "Rendering!" << llendl; + LL_INFOS() << "Rendering!" << LL_ENDL; } } @@ -4049,12 +4056,6 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) //-------------------------------------------------------------------- // render all geometry attached to the skeleton //-------------------------------------------------------------------- - static LLStat render_stat; - - LLViewerJointMesh::sRenderPass = pass; - - if (pass == AVATAR_RENDER_PASS_SINGLE) - { bool should_alpha_mask = shouldAlphaMask(); LLGLState test(GL_ALPHA_TEST, should_alpha_mask); @@ -4113,13 +4114,6 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) LLGLState test(GL_ALPHA_TEST, !mIsDummy); num_indices += renderTransparent(first_pass); } - } - - LLViewerJointMesh::sRenderPass = AVATAR_RENDER_PASS_SINGLE; - - //llinfos << "Avatar render: " << render_timer.getElapsedTimeF32() << llendl; - - //render_stat.addValue(render_timer.getElapsedTimeF32()*1000.f); return num_indices; } @@ -4162,7 +4156,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) { LLViewerJoint* hair_mesh = getViewerJoint(MESH_ID_HAIR); if (hair_mesh) - { + { num_indices += hair_mesh->render(mAdjustedPixelArea, first_pass, mIsDummy); } first_pass = FALSE; @@ -4172,7 +4166,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } } - + return num_indices; } @@ -4363,9 +4357,9 @@ std::string LLVOAvatar::bakedTextureOriginInfo() return result; } -S32 LLVOAvatar::totalTextureMemForUUIDS(std::set<LLUUID>& ids) +S32Bytes LLVOAvatar::totalTextureMemForUUIDS(std::set<LLUUID>& ids) { - S32 result = 0; + S32Bytes result(0); for (std::set<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it) { LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); @@ -4430,12 +4424,12 @@ void LLVOAvatar::collectTextureUUIDs(std::set<LLUUID>& ids) void LLVOAvatar::releaseOldTextures() { - S32 current_texture_mem = 0; + S32Bytes current_texture_mem; // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE" std::set<LLUUID> baked_texture_ids; collectBakedTextureUUIDs(baked_texture_ids); - S32 new_baked_mem = totalTextureMemForUUIDS(baked_texture_ids); + S32Bytes new_baked_mem = totalTextureMemForUUIDS(baked_texture_ids); std::set<LLUUID> local_texture_ids; collectLocalTextureUUIDs(local_texture_ids); @@ -4444,13 +4438,13 @@ void LLVOAvatar::releaseOldTextures() std::set<LLUUID> new_texture_ids; new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end()); new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end()); - S32 new_total_mem = totalTextureMemForUUIDS(new_texture_ids); + S32Bytes new_total_mem = totalTextureMemForUUIDS(new_texture_ids); //S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); - //LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; + //LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << LL_ENDL; if (!isSelf() && new_total_mem > new_baked_mem) { - llwarns << "extra local textures stored for non-self av" << llendl; + LL_WARNS() << "extra local textures stored for non-self av" << LL_ENDL; } for (std::set<LLUUID>::iterator it = mTextureIDs.begin(); it != mTextureIDs.end(); ++it) { @@ -4538,7 +4532,7 @@ void LLVOAvatar::updateTextures() } else { - llwarns << "getTE( " << texture_index << " ) returned 0" <<llendl; + LL_WARNS() << "getTE( " << texture_index << " ) returned 0" <<LL_ENDL; } LLViewerFetchedTexture *imagep = NULL; @@ -4569,7 +4563,7 @@ void LLVOAvatar::updateTextures() LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " << imagep->getID() << " for avatar " << (isSelf() ? "<myself>" : getID().asString()) - << " on host " << getRegion()->getHost() << llendl; + << " on host " << getRegion()->getHost() << LL_ENDL; } addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level ); @@ -4709,7 +4703,7 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) if (appearance_service_url.empty()) { // Probably a server-side issue if we get here: - llwarns << "AgentAppearanceServiceURL not set - Baked texture requests will fail" << llendl; + LL_WARNS() << "AgentAppearanceServiceURL not set - Baked texture requests will fail" << LL_ENDL; return url; } @@ -4717,7 +4711,7 @@ const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) if (texture_entry != NULL) { url = appearance_service_url + "texture/" + getID().asString() + "/" + texture_entry->mDefaultImageName + "/" + uuid.asString(); - //llinfos << "baked texture url: " << url << llendl; + //LL_INFOS() << "baked texture url: " << url << LL_ENDL; } } return url; @@ -4767,7 +4761,7 @@ void LLVOAvatar::resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos LLVector3 relativePos = gAgent.getPosAgentFromGlobal(outPos) - obj->getPositionAgent(); LLVector3 linearComponent = angularVelocity % relativePos; -// llinfos << "Linear Component of Rotation Velocity " << linearComponent << llendl; +// LL_INFOS() << "Linear Component of Rotation Velocity " << linearComponent << LL_ENDL; mStepObjectVelocity = obj->getVelocity() + linearComponent; } } @@ -4920,7 +4914,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL } else { - llwarns << "Failed to start motion!" << llendl; + LL_WARNS() << "Failed to start motion!" << LL_ENDL; } } else //stop animation @@ -5016,13 +5010,13 @@ LLUUID LLVOAvatar::remapMotionID(const LLUUID& id) //----------------------------------------------------------------------------- BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) { - lldebugs << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << llendl; + LL_DEBUGS() << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << LL_ENDL; LLUUID remap_id = remapMotionID(id); if (remap_id != id) { - lldebugs << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << llendl; + LL_DEBUGS() << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << LL_ENDL; } if (isSelf() && remap_id == ANIM_AGENT_AWAY) @@ -5038,13 +5032,13 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) //----------------------------------------------------------------------------- BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) { - lldebugs << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << llendl; + LL_DEBUGS() << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << LL_ENDL; LLUUID remap_id = remapMotionID(id); if (remap_id != id) { - lldebugs << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << llendl; + LL_DEBUGS() << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << LL_ENDL; } if (isSelf()) @@ -5137,7 +5131,7 @@ void LLVOAvatar::resetSpecificJointPosition( const std::string& name ) } else { - llinfos<<"Did not find "<< name.c_str()<<llendl; + LL_INFOS()<<"Did not find "<< name.c_str()<<LL_ENDL; } } //----------------------------------------------------------------------------- @@ -5289,9 +5283,9 @@ BOOL LLVOAvatar::loadSkeletonNode () { if (!LLAvatarAppearance::loadSkeletonNode()) { - return FALSE; - } - + return FALSE; + } + // ATTACHMENTS { LLAvatarXmlInfo::attachment_info_list_t::iterator iter; @@ -5311,7 +5305,7 @@ BOOL LLVOAvatar::loadSkeletonNode () LLJoint *parentJoint = getJoint(info->mJointName); if (!parentJoint) { - llwarns << "No parent joint by name " << info->mJointName << " found for attachment point " << info->mName << llendl; + LL_WARNS() << "No parent joint by name " << info->mJointName << " found for attachment point " << info->mName << LL_ENDL; delete attachment; continue; } @@ -5335,7 +5329,7 @@ BOOL LLVOAvatar::loadSkeletonNode () { if (group < 0 || group >= 9) { - llwarns << "Invalid group number (" << group << ") for attachment point " << info->mName << llendl; + LL_WARNS() << "Invalid group number (" << group << ") for attachment point " << info->mName << LL_ENDL; } else { @@ -5346,13 +5340,13 @@ BOOL LLVOAvatar::loadSkeletonNode () S32 attachmentID = info->mAttachmentID; if (attachmentID < 1 || attachmentID > 255) { - llwarns << "Attachment point out of range [1-255]: " << attachmentID << " on attachment point " << info->mName << llendl; + LL_WARNS() << "Attachment point out of range [1-255]: " << attachmentID << " on attachment point " << info->mName << LL_ENDL; delete attachment; continue; } if (mAttachmentPoints.find(attachmentID) != mAttachmentPoints.end()) { - llwarns << "Attachment point redefined with id " << attachmentID << " on attachment point " << info->mName << llendl; + LL_WARNS() << "Attachment point redefined with id " << attachmentID << " on attachment point " << info->mName << LL_ENDL; delete attachment; continue; } @@ -5522,10 +5516,10 @@ void LLVOAvatar::updateGL() //----------------------------------------------------------------------------- // updateGeometry() //----------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_UPDATE_AVATAR("Update Avatar"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_AVATAR("Update Avatar"); BOOL LLVOAvatar::updateGeometry(LLDrawable *drawable) { - LLFastTimer ftm(FTM_UPDATE_AVATAR); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_AVATAR); if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR))) { return TRUE; @@ -5538,7 +5532,7 @@ BOOL LLVOAvatar::updateGeometry(LLDrawable *drawable) if (!drawable) { - llerrs << "LLVOAvatar::updateGeometry() called with NULL drawable" << llendl; + LL_ERRS() << "LLVOAvatar::updateGeometry() called with NULL drawable" << LL_ENDL; } return TRUE; @@ -5613,10 +5607,10 @@ void LLVOAvatar::addChild(LLViewerObject *childp) { if (!attachObject(childp)) { - llwarns << "addChild() failed for " + LL_WARNS() << "addChild() failed for " << childp->getID() << " item " << childp->getAttachmentItemID() - << llendl; + << LL_ENDL; // MAINT-3312 backout // mPendingAttachment.push_back(childp); } @@ -5632,7 +5626,7 @@ void LLVOAvatar::removeChild(LLViewerObject *childp) LLViewerObject::removeChild(childp); if (!detachObject(childp)) { - llwarns << "Calling detach on non-attached object " << llendl; + LL_WARNS() << "Calling detach on non-attached object " << LL_ENDL; } } @@ -5644,7 +5638,7 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi // correctly, but putting this check in here to be safe. if (attachmentID & ATTACHMENT_ADD) { - llwarns << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << llendl; + LL_WARNS() << "Got an attachment with ATTACHMENT_ADD mask, removing ( attach pt:" << attachmentID << " )" << LL_ENDL; attachmentID &= ~ATTACHMENT_ADD; } @@ -5652,26 +5646,26 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi if (!attachment) { - llwarns << "Object attachment point invalid: " << attachmentID + LL_WARNS() << "Object attachment point invalid: " << attachmentID << " trying to use 1 (chest)" - << llendl; + << LL_ENDL; attachment = get_if_there(mAttachmentPoints, 1, (LLViewerJointAttachment*)NULL); // Arbitrary using 1 (chest) if (attachment) { - llwarns << "Object attachment point invalid: " << attachmentID + LL_WARNS() << "Object attachment point invalid: " << attachmentID << " on object " << viewer_object->getID() << " attachment item " << viewer_object->getAttachmentItemID() << " falling back to 1 (chest)" - << llendl; + << LL_ENDL; } else { - llwarns << "Object attachment point invalid: " << attachmentID + LL_WARNS() << "Object attachment point invalid: " << attachmentID << " on object " << viewer_object->getID() << " attachment item " << viewer_object->getAttachmentItemID() << "Unable to use fallback attachment point 1 (chest)" - << llendl; + << LL_ENDL; } } @@ -5748,10 +5742,10 @@ void LLVOAvatar::lazyAttach() { if (!attachObject(cur_attachment)) { // Drop it - llwarns << "attachObject() failed for " + LL_WARNS() << "attachObject() failed for " << cur_attachment->getID() << " item " << cur_attachment->getAttachmentItemID() - << llendl; + << LL_ENDL; // MAINT-3312 backout //still_pending.push_back(cur_attachment); } @@ -5834,7 +5828,7 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO ) } } } -} + } //----------------------------------------------------------------------------- // detachObject() @@ -5852,7 +5846,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) mVisualComplexityStale = TRUE; cleanupAttachedMesh( viewer_object ); attachment->removeObject(viewer_object); - lldebugs << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << llendl; + LL_DEBUGS() << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << LL_ENDL; return TRUE; } } @@ -6048,18 +6042,18 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const { const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = tex_iter->second; if (texture_dict->mWearableType == type) - { + { // Thus, you must check to see if the corresponding baked texture is defined. // NOTE: this is a poor substitute if you actually want to know about individual pieces of clothing // this works for detecting a skirt (most important), but is ineffective at any piece of clothing that // gets baked into a texture that always exists (upper or lower). if (texture_dict->mIsUsedByBakedTexture) - { + { const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; return isTextureDefined(LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index)->mTextureIndex); - } + } return FALSE; - } + } } return FALSE; } @@ -6124,7 +6118,7 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL { LLAvatarJointMesh* mesh = (*iter); if (mesh) - { + { mesh->setColor( color ); } } @@ -6132,7 +6126,7 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL } else if (global_color == mTexEyeColor) { -// llinfos << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << llendl; +// LL_INFOS() << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << LL_ENDL; invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet, upload_bake ); } updateMeshTextures(); @@ -6192,9 +6186,9 @@ void LLVOAvatar::updateRezzedStatusTimers() { // load level has decreased. start phase timers for higher load levels. for (S32 i = rez_status+1; i <= mLastRezzedStatus; i++) - { + { startPhase("load_" + LLVOAvatar::rezStatusToString(i)); - } + } } else if (rez_status > mLastRezzedStatus) { @@ -6203,16 +6197,16 @@ void LLVOAvatar::updateRezzedStatusTimers() { stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); stopPhase("first_load_" + LLVOAvatar::rezStatusToString(i), false); - } + } if (rez_status == 3) - { + { // "fully loaded", mark any pending appearance change complete. selfStopPhase("update_appearance_from_cof"); selfStopPhase("wear_inventory_category", false); selfStopPhase("process_initial_wearables_update", false); } } - + mLastRezzedStatus = rez_status; } } @@ -6230,16 +6224,16 @@ void LLVOAvatar::startPhase(const std::string& phase_name) { if (!completed) { - LL_DEBUGS("Avatar") << avString() << "no-op, start when started already for " << phase_name << llendl; + LL_DEBUGS("Avatar") << avString() << "no-op, start when started already for " << phase_name << LL_ENDL; return; } } - LL_DEBUGS("Avatar") << "started phase " << phase_name << llendl; + LL_DEBUGS("Avatar") << "started phase " << phase_name << LL_ENDL; getPhases().startPhase(phase_name); } void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) -{ + { F32 elapsed; bool completed; if (getPhases().getPhaseValues(phase_name, elapsed, completed)) @@ -6249,13 +6243,13 @@ void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) getPhases().stopPhase(phase_name); completed = true; logMetricsTimerRecord(phase_name, elapsed, completed); - LL_DEBUGS("Avatar") << avString() << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; + LL_DEBUGS("Avatar") << avString() << "stopped phase " << phase_name << " elapsed " << elapsed << LL_ENDL; } else { if (err_check) { - LL_DEBUGS("Avatar") << "no-op, stop when stopped already for " << phase_name << llendl; + LL_DEBUGS("Avatar") << "no-op, stop when stopped already for " << phase_name << LL_ENDL; } } } @@ -6263,7 +6257,7 @@ void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) { if (err_check) { - LL_DEBUGS("Avatar") << "no-op, stop when not started for " << phase_name << llendl; + LL_DEBUGS("Avatar") << "no-op, stop when not started for " << phase_name << LL_ENDL; } } } @@ -6271,7 +6265,7 @@ void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) void LLVOAvatar::logPendingPhases() { if (!isAgentAvatarValid()) - { + { return; } @@ -6287,14 +6281,14 @@ void LLVOAvatar::logPendingPhases() if (!completed) { logMetricsTimerRecord(phase_name, elapsed, completed); - } + } } } -} + } //static void LLVOAvatar::logPendingPhasesAllAvatars() -{ + { for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { @@ -6305,14 +6299,14 @@ void LLVOAvatar::logPendingPhasesAllAvatars() } inst->logPendingPhases(); } -} + } void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed) -{ + { if (!isAgentAvatarValid()) - { + { return; - } + } LLSD record; record["timer_name"] = phase_name; @@ -6321,15 +6315,15 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse record["completed"] = completed; U32 grid_x(0), grid_y(0); if (getRegion()) - { + { record["central_bake_version"] = LLSD::Integer(getRegion()->getCentralBakeVersion()); grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); - } + } record["grid_x"] = LLSD::Integer(grid_x); record["grid_y"] = LLSD::Integer(grid_y); record["is_using_server_bakes"] = ((bool) isUsingServerBakes()); record["is_self"] = isSelf(); - + if (isAgentAvatarValid()) { gAgentAvatarp->addMetricsTimerRecord(record); @@ -6537,28 +6531,28 @@ void LLVOAvatar::updateMeshTextures() use_lkg_baked_layer[i], last_id_string.c_str()); } - + for (U32 i=0; i < mBakedTextureDatas.size(); i++) { debugColorizeSubMeshes(i, LLColor4::white); LLViewerTexLayerSet* layerset = getTexLayerSet(i); if (use_lkg_baked_layer[i] && !isUsingLocalAppearance() ) - { + { LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); mBakedTextureDatas[i].mIsUsed = TRUE; debugColorizeSubMeshes(i,LLColor4::red); - + avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); for (; iter != end; ++iter) - { + { LLAvatarJointMesh* mesh = (*iter); if (mesh) - { + { mesh->setTexture( baked_img ); - } + } } } else if (!isUsingLocalAppearance() && is_layer_baked[i]) @@ -6602,7 +6596,7 @@ void LLVOAvatar::updateMeshTextures() if (mesh) { mesh->setLayerSet( layerset ); - } + } } } else @@ -6624,7 +6618,7 @@ void LLVOAvatar::updateMeshTextures() { LLAvatarJointMesh* mesh = (*iter); if (mesh) - { + { mesh->setColor( color ); mesh->setTexture( hair_img ); } @@ -6714,19 +6708,19 @@ void LLVOAvatar::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_com { if (index >= BAKED_NUM_INDICES) { - llwarns << "invalid baked texture index passed to applyMorphMask" << llendl; + LL_WARNS() << "invalid baked texture index passed to applyMorphMask" << LL_ENDL; return; } for (morph_list_t::const_iterator iter = mBakedTextureDatas[index].mMaskedMorphs.begin(); iter != mBakedTextureDatas[index].mMaskedMorphs.end(); ++iter) - { +{ const LLMaskedMorph* maskedMorph = (*iter); LLPolyMorphTarget* morph_target = dynamic_cast<LLPolyMorphTarget*>(maskedMorph->mMorphTarget); if (morph_target) - { + { morph_target->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert); - } +} } } @@ -6883,7 +6877,7 @@ LLBBox LLVOAvatar::getHUDBBox() const const LLViewerObject* attached_object = (*attachment_iter); if (attached_object == NULL) { - llwarns << "HUD attached object is NULL!" << llendl; + LL_WARNS() << "HUD attached object is NULL!" << LL_ENDL; continue; } // initialize bounding box to contain identity orientation and center point for attached object @@ -6972,14 +6966,14 @@ bool LLVOAvatar::visualParamWeightsAreDefault() // we have to not care whether skirt weights are default, if we're not actually wearing a skirt (is_wearing_skirt || !is_skirt_param)) { - //llinfos << "param '" << param->getName() << "'=" << param->getWeight() << " which differs from default=" << param->getDefaultWeight() << llendl; + //LL_INFOS() << "param '" << param->getName() << "'=" << param->getWeight() << " which differs from default=" << param->getDefaultWeight() << LL_ENDL; rtn = false; break; } } } - //llinfos << "params are default ? " << int(rtn) << llendl; + //LL_INFOS() << "params are default ? " << int(rtn) << LL_ENDL; return rtn; } @@ -7009,8 +7003,8 @@ void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value) LLWearableType::getTypeName(LLWearableType::EType(wtype)).c_str() // param_location_name(vparam->getParamLocation()).c_str() ); -} - + } + void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, const LLAppearanceMessageContents& contents) @@ -7024,12 +7018,12 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, outfile.open(fullpath, LL_APR_WB ); apr_file_t* file = outfile.getFileHandle(); if (!file) - { - return; - } + { + return; + } else { - LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << llendl; + LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << LL_ENDL; } apr_file_printf(file, "<header>\n"); @@ -7060,7 +7054,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", i, uuid_str.c_str()); } apr_file_printf(file, "</textures>\n"); -} + } void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) { @@ -7072,12 +7066,12 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe U8 av_u8; mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, av_u8, 0); contents.mAppearanceVersion = av_u8; - LL_DEBUGS("Avatar") << "appversion set by AppearanceData field: " << contents.mAppearanceVersion << llendl; + LL_DEBUGS("Avatar") << "appversion set by AppearanceData field: " << contents.mAppearanceVersion << LL_ENDL; mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0); // For future use: //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); } - + // Parse visual params, if any. S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing @@ -7089,7 +7083,7 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe llassert(param); // if this ever fires, we should do the same as when num_blocks<=1 if (!param) { - llwarns << "No visual params!" << llendl; + LL_WARNS() << "No visual params!" << LL_ENDL; } else { @@ -7119,18 +7113,18 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_blocks != expected_tweakable_count) { - LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << LL_ENDL; } } else { if (drop_visual_params_debug) { - llinfos << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << llendl; + LL_INFOS() << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << LL_ENDL; } else { - LL_DEBUGS("Avatar") << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; + LL_DEBUGS("Avatar") << "AvatarAppearance msg received without any parameters, object: " << getID() << LL_ENDL; } } @@ -7142,7 +7136,7 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe { S32 index = it - contents.mParams.begin(); contents.mParamAppearanceVersion = llround(contents.mParamWeights[index]); - LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << llendl; + LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << LL_ENDL; } } } @@ -7155,8 +7149,8 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 (contents.mParamAppearanceVersion >= 0) && (contents.mAppearanceVersion != contents.mParamAppearanceVersion)) { - llwarns << "inconsistent appearance_version settings - field: " << - contents.mAppearanceVersion << ", param: " << contents.mParamAppearanceVersion << llendl; + LL_WARNS() << "inconsistent appearance_version settings - field: " << + contents.mAppearanceVersion << ", param: " << contents.mParamAppearanceVersion << LL_ENDL; return false; } if (contents.mParamAppearanceVersion >= 0) // use visual param if available. @@ -7173,7 +7167,7 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 } LL_DEBUGS("Avatar") << "appearance version info - field " << contents.mAppearanceVersion << " param: " << contents.mParamAppearanceVersion - << " final: " << appearance_version << llendl; + << " final: " << appearance_version << LL_ENDL; return true; } @@ -7182,13 +7176,13 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { - LL_DEBUGS("Avatar") << "starts" << llendl; + LL_DEBUGS("Avatar") << "starts" << LL_ENDL; bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { - llwarns << "Blocking AvatarAppearance message" << llendl; + LL_WARNS() << "Blocking AvatarAppearance message" << LL_ENDL; return; } @@ -7204,7 +7198,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) S32 appearance_version; if (!resolve_appearance_version(contents, appearance_version)) { - llwarns << "bad appearance version info, discarding" << llendl; + LL_WARNS() << "bad appearance version info, discarding" << LL_ENDL; return; } S32 this_update_cof_version = contents.mCOFVersion; @@ -7215,11 +7209,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { LL_DEBUGS("Avatar") << "this_update_cof_version " << this_update_cof_version << " last_update_request_cof_version " << last_update_request_cof_version - << " my_cof_version " << LLAppearanceMgr::instance().getCOFVersion() << llendl; + << " my_cof_version " << LLAppearanceMgr::instance().getCOFVersion() << LL_ENDL; if (getRegion() && (getRegion()->getCentralBakeVersion()==0)) { - llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; + LL_WARNS() << avString() << "Received AvatarAppearance message for self in non-server-bake region" << LL_ENDL; } if( mFirstTEMessageReceived && (appearance_version == 0)) { @@ -7228,7 +7222,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } else { - LL_DEBUGS("Avatar") << "appearance message received" << llendl; + LL_DEBUGS("Avatar") << "appearance message received" << LL_ENDL; } // Check for stale update. @@ -7236,14 +7230,14 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) && (appearance_version>0) && (this_update_cof_version < last_update_request_cof_version)) { - llwarns << "Stale appearance update, wanted version " << last_update_request_cof_version - << ", got " << this_update_cof_version << llendl; + LL_WARNS() << "Stale appearance update, wanted version " << last_update_request_cof_version + << ", got " << this_update_cof_version << LL_ENDL; return; } if (isSelf() && isEditingAppearance()) { - LL_DEBUGS("Avatar") << "ignoring appearance message while in appearance edit" << llendl; + LL_DEBUGS("Avatar") << "ignoring appearance message while in appearance edit" << LL_ENDL; return; } @@ -7254,7 +7248,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // appearance version, which may cause us to look for baked // textures in the wrong place and flag them as missing // assets. - LL_DEBUGS("Avatar") << "ignoring appearance message due to lack of params" << llendl; + LL_DEBUGS("Avatar") << "ignoring appearance message due to lack of params" << LL_ENDL; return; } @@ -7305,24 +7299,24 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) LLVisualParam* param = contents.mParams[i]; F32 newWeight = contents.mParamWeights[i]; - if (is_first_appearance_message || (param->getWeight() != newWeight)) - { - params_changed = TRUE; - if(is_first_appearance_message) - { - param->setWeight(newWeight, FALSE); - } - else + if (is_first_appearance_message || (param->getWeight() != newWeight)) { - interp_params = TRUE; - param->setAnimationTarget(newWeight, FALSE); + params_changed = TRUE; + if(is_first_appearance_message) + { + param->setWeight(newWeight, FALSE); + } + else + { + interp_params = TRUE; + param->setAnimationTarget(newWeight, FALSE); + } } - } } const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_params != expected_tweakable_count) { - LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_params << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + LL_DEBUGS("Avatar") << "Number of params in AvatarAppearance msg (" << num_params << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << LL_ENDL; } if (params_changed) @@ -7352,13 +7346,13 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) if (visualParamWeightsAreDefault() && mRuthTimer.getElapsedTimeF32() > LOADING_TIMEOUT_SECONDS) { // re-request appearance, hoping that it comes back with a shape next time - llinfos << "Re-requesting AvatarAppearance for object: " << getID() << llendl; + LL_INFOS() << "Re-requesting AvatarAppearance for object: " << getID() << LL_ENDL; LLAvatarPropertiesProcessor::getInstance()->sendAvatarTexturesRequest(getID()); mRuthTimer.reset(); } else { - llinfos << "That's okay, we already have a non-default shape for object: " << getID() << llendl; + LL_INFOS() << "That's okay, we already have a non-default shape for object: " << getID() << LL_ENDL; // we don't really care. } } @@ -7379,30 +7373,32 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } // static -void LLVOAvatar::getAnimLabels( LLDynamicArray<std::string>* labels ) +void LLVOAvatar::getAnimLabels( std::vector<std::string>* labels ) { S32 i; + labels->reserve(gUserAnimStatesCount); for( i = 0; i < gUserAnimStatesCount; i++ ) { - labels->put( LLAnimStateLabels::getStateLabel( gUserAnimStates[i].mName ) ); + labels->push_back( LLAnimStateLabels::getStateLabel( gUserAnimStates[i].mName ) ); } // Special case to trigger away (AFK) state - labels->put( "Away From Keyboard" ); + labels->push_back( "Away From Keyboard" ); } // static -void LLVOAvatar::getAnimNames( LLDynamicArray<std::string>* names ) +void LLVOAvatar::getAnimNames( std::vector<std::string>* names ) { S32 i; + names->reserve(gUserAnimStatesCount); for( i = 0; i < gUserAnimStatesCount; i++ ) { - names->put( std::string(gUserAnimStates[i].mName) ); + names->push_back( std::string(gUserAnimStates[i].mName) ); } // Special case to trigger away (AFK) state - names->put( "enter_away_from_keyboard_state" ); + names->push_back( "enter_away_from_keyboard_state" ); } // static @@ -7410,7 +7406,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture { if (!userdata) return; - //llinfos << "onBakedTextureMasksLoaded: " << src_vi->getID() << llendl; + //LL_INFOS() << "onBakedTextureMasksLoaded: " << src_vi->getID() << LL_ENDL; const LLUUID id = src_vi->getID(); LLTextureMaskData* maskData = (LLTextureMaskData*) userdata; @@ -7424,7 +7420,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture { if (!aux_src->getData()) { - llerrs << "No auxiliary source (morph mask) data for image id " << id << llendl; + LL_ERRS() << "No auxiliary source (morph mask) data for image id " << id << LL_ENDL; return; } @@ -7445,7 +7441,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture /* if( id == head_baked->getID() ) if (self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet) - //llinfos << "onBakedTextureMasksLoaded for head " << id << " discard = " << discard_level << llendl; + //LL_INFOS() << "onBakedTextureMasksLoaded for head " << id << " discard = " << discard_level << LL_ENDL; self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); maskData->mLastDiscardLevel = discard_level; */ BOOL found_texture_id = false; @@ -7476,7 +7472,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture } if (!found_texture_id) { - llinfos << "unexpected image id: " << id << llendl; + LL_INFOS() << "unexpected image id: " << id << LL_ENDL; } self->dirtyMesh(); } @@ -7484,7 +7480,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture { // this can happen when someone uses an old baked texture possibly provided by // viewer-side baked texture caching - llwarns << "Masks loaded callback but NO aux source, id " << id << llendl; + LL_WARNS() << "Masks loaded callback but NO aux source, id " << id << LL_ENDL; } } @@ -7564,7 +7560,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) if (isUsingLocalAppearance()) { - llinfos << "not changing to baked texture while isUsingLocalAppearance" << llendl; + LL_INFOS() << "not changing to baked texture while isUsingLocalAppearance" << LL_ENDL; } else { @@ -7573,12 +7569,12 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) avatar_joint_mesh_list_t::iterator iter = mBakedTextureDatas[i].mJointMeshes.begin(); avatar_joint_mesh_list_t::iterator end = mBakedTextureDatas[i].mJointMeshes.end(); for (; iter != end; ++iter) - { + { LLAvatarJointMesh* mesh = (*iter); if (mesh) - { + { mesh->setTexture( image_baked ); - } + } } } @@ -7602,7 +7598,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) { LLAvatarJointMesh* mesh = (*iter); if (mesh) - { + { mesh->setColor( LLColor4::white ); } } @@ -7621,7 +7617,7 @@ std::string get_sequential_numbered_file_name(const std::string& prefix, file_num_type::iterator it = file_nums.find(prefix); S32 num = 0; if (it != file_nums.end()) - { +{ num = it->second; } file_nums[prefix] = num+1; @@ -7638,7 +7634,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara outprefix = getFullname() + (isSelf()?"_s":"_o"); } if (outprefix.empty()) - { +{ outprefix = getFullname() + (isSelf()?"_s":"_o"); } if (outprefix.empty()) @@ -7657,7 +7653,7 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara } else { - llinfos << "xmlfile write handle obtained : " << fullpath << llendl; + LL_INFOS() << "xmlfile write handle obtained : " << fullpath << LL_ENDL; } apr_file_printf( file, "<?xml version=\"1.0\" encoding=\"US-ASCII\" standalone=\"yes\"?>\n" ); @@ -7667,36 +7663,36 @@ void LLVOAvatar::dumpArchetypeXML(const std::string& prefix, bool group_by_weara if (group_by_wearables) { for (S32 type = LLWearableType::WT_SHAPE; type < LLWearableType::WT_COUNT; type++) - { - const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type); - apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() ); + { + const std::string& wearable_name = LLWearableType::getTypeName((LLWearableType::EType)type); + apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() ); for (LLVisualParam* param = getFirstVisualParam(); param; param = getNextVisualParam()) + { + LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; + if( (viewer_param->getWearableType() == type) && + (viewer_param->isTweakable() ) ) { - LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; - if( (viewer_param->getWearableType() == type) && - (viewer_param->isTweakable() ) ) - { dump_visual_param(file, viewer_param, viewer_param->getWeight()); - } } + } - for (U8 te = 0; te < TEX_NUM_INDICES; te++) - { + for (U8 te = 0; te < TEX_NUM_INDICES; te++) + { if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)te) == type) - { - // MULTIPLE_WEARABLES: extend to multiple wearables? + { + // MULTIPLE_WEARABLES: extend to multiple wearables? LLViewerTexture* te_image = getImage((ETextureIndex)te, 0); - if( te_image ) - { - std::string uuid_str; - te_image->getID().toString( uuid_str ); - apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str()); - } + if( te_image ) + { + std::string uuid_str; + te_image->getID().toString( uuid_str ); + apr_file_printf( file, "\t\t<texture te=\"%i\" uuid=\"%s\"/>\n", te, uuid_str.c_str()); } } } } + } else { // Just dump all params sequentially. @@ -7796,7 +7792,7 @@ void LLVOAvatar::cullAvatarsByPixelArea() if (inst->mCulled != culled) { inst->mCulled = culled; - lldebugs << "avatar " << inst->getID() << (culled ? " start culled" : " start not culled" ) << llendl; + LL_DEBUGS() << "avatar " << inst->getID() << (culled ? " start culled" : " start not culled" ) << LL_ENDL; inst->updateMeshTextures(); } @@ -7817,14 +7813,14 @@ void LLVOAvatar::cullAvatarsByPixelArea() if (gFrameTimeSeconds != sUnbakedUpdateTime) // only update once per frame { sUnbakedUpdateTime = gFrameTimeSeconds; - sUnbakedTime += gFrameIntervalSeconds; + sUnbakedTime += gFrameIntervalSeconds.value(); } if (grey_avatars > 0) { if (gFrameTimeSeconds != sGreyUpdateTime) // only update once per frame { sGreyUpdateTime = gFrameTimeSeconds; - sGreyTime += gFrameIntervalSeconds; + sGreyTime += gFrameIntervalSeconds.value(); } } } @@ -7842,12 +7838,12 @@ void LLVOAvatar::startAppearanceAnimation() // virtual void LLVOAvatar::bodySizeChanged() -{ +{ if (isSelf() && !LLAppearanceMgr::instance().isInUpdateAppearanceFromCOF()) { // notify simulator of change in size // but not if we are in the middle of updating appearance gAgent.sendAgentSetAppearance(); - } +} } BOOL LLVOAvatar::isUsingServerBakes() const @@ -7859,25 +7855,25 @@ BOOL LLVOAvatar::isUsingServerBakes() const F32 wt = appearance_version_param->getWeight(); F32 expect_wt = mUseServerBakes ? 1.0 : 0.0; if (!is_approx_equal(wt,expect_wt)) - { - llwarns << "wt " << wt << " differs from expected " << expect_wt << llendl; +{ + LL_WARNS() << "wt " << wt << " differs from expected " << expect_wt << LL_ENDL; } #endif return mUseServerBakes; -} - + } + void LLVOAvatar::setIsUsingServerBakes(BOOL newval) -{ + { mUseServerBakes = newval; LLVisualParam* appearance_version_param = getVisualParam(11000); llassert(appearance_version_param); appearance_version_param->setWeight(newval ? 1.0 : 0.0, false); -} + } // virtual void LLVOAvatar::removeMissingBakedTextures() -{ + { } //virtual @@ -8148,7 +8144,7 @@ void LLVOAvatar::calculateUpdateRenderCost() if (all_textures.find(image_id) == all_textures.end()) { // attachment texture not previously seen. - llinfos << "attachment_texture: " << image_id.asString() << llendl; + LL_INFOS() << "attachment_texture: " << image_id.asString() << LL_ENDL; all_textures.insert(image_id); } } @@ -8168,7 +8164,7 @@ void LLVOAvatar::calculateUpdateRenderCost() continue; if (all_textures.find(image_id) == all_textures.end()) { - llinfos << "local_texture: " << texture_dict->mName << ": " << image_id << llendl; + LL_INFOS() << "local_texture: " << texture_dict->mName << ": " << image_id << LL_ENDL; all_textures.insert(image_id); } } @@ -8200,10 +8196,10 @@ LLColor4 LLVOAvatar::calcMutedAVColor(F32 value, S32 range_low, S32 range_high) new_color.normalize(); new_color *= 0.7f; // Tone it down a bit - //llinfos << "From value " << std::setprecision(3) << value << " returning color " << new_color + //LL_INFOS() << "From value " << std::setprecision(3) << value << " returning color " << new_color // << " using indexes " << spectrum_index_1 << ", " << spectrum_index_2 // << " and fractBetween " << fractBetween - // << llendl; + // << LL_ENDL; return new_color; } @@ -8272,7 +8268,7 @@ BOOL LLVOAvatar::isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U if( !getImage( te, index ) ) { - llwarns << "getImage( " << te << ", " << index << " ) returned 0" << llendl; + LL_WARNS() << "getImage( " << te << ", " << index << " ) returned 0" << LL_ENDL; return FALSE; } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index cd8a5ecdf2584ecf1ec2d22bc65ac4e33b282ffe..9d0391b42c7a838a3dc417de6349972afd1c7371 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -33,9 +33,8 @@ #include <string> #include <vector> -#include <boost/signals2.hpp> +#include <boost/signals2/trackable.hpp> -#include "imageids.h" // IMG_INVISIBLE #include "llavatarappearance.h" #include "llchat.h" #include "lldrawpoolalpha.h" @@ -74,6 +73,7 @@ struct LLVOAvatarChildJoint; //class LLViewerJoint; struct LLAppearanceMessageContents; struct LLVOAvatarSkeletonInfo; +class LLViewerJointMesh; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLVOAvatar @@ -97,12 +97,12 @@ class LLVOAvatar : public: void* operator new(size_t size) { - return ll_aligned_malloc_16(size); + return LLTrace::MemTrackable<LLViewerObject>::aligned_new<16>(size); } - void operator delete(void* ptr) + void operator delete(void* ptr, size_t size) { - ll_aligned_free_16(ptr); + LLTrace::MemTrackable<LLViewerObject>::aligned_delete<16>(ptr, size); } LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); @@ -129,28 +129,28 @@ class LLVOAvatar : /*virtual*/ void updateGL(); /*virtual*/ LLVOAvatar* asAvatar(); virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, - void **user_data, - U32 block_num, - const EObjectUpdateType update_type, - LLDataPacker *dp); + void **user_data, + U32 block_num, + const EObjectUpdateType update_type, + LLDataPacker *dp); virtual void idleUpdate(LLAgent &agent, const F64 &time); /*virtual*/ BOOL updateLOD(); BOOL updateJointLODs(); void updateLODRiggedAttachments( void ); /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. - S32 totalTextureMemForUUIDS(std::set<LLUUID>& ids); - bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const; - bool allLocalTexturesCompletelyDownloaded() const; - bool allBakedTexturesCompletelyDownloaded() const; - void bakedTextureOriginCounts(S32 &sb_count, S32 &host_count, - S32 &both_count, S32 &neither_count); - std::string bakedTextureOriginInfo(); - void collectLocalTextureUUIDs(std::set<LLUUID>& ids) const; - void collectBakedTextureUUIDs(std::set<LLUUID>& ids) const; - void collectTextureUUIDs(std::set<LLUUID>& ids); - void releaseOldTextures(); + S32Bytes totalTextureMemForUUIDS(std::set<LLUUID>& ids); + bool allTexturesCompletelyDownloaded(std::set<LLUUID>& ids) const; + bool allLocalTexturesCompletelyDownloaded() const; + bool allBakedTexturesCompletelyDownloaded() const; + void bakedTextureOriginCounts(S32 &sb_count, S32 &host_count, + S32 &both_count, S32 &neither_count); + std::string bakedTextureOriginInfo(); + void collectLocalTextureUUIDs(std::set<LLUUID>& ids) const; + void collectBakedTextureUUIDs(std::set<LLUUID>& ids) const; + void collectTextureUUIDs(std::set<LLUUID>& ids); + void releaseOldTextures(); /*virtual*/ void updateTextures(); - LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid); + LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. /*virtual*/ void onShift(const LLVector4a& shift_vector); /*virtual*/ U32 getPartitionType() const; @@ -402,7 +402,7 @@ class LLVOAvatar : VisualMuteSettings getVisualMuteSettings() { return mVisuallyMuteSetting; }; U32 renderRigid(); - U32 renderSkinned(EAvatarRenderPass pass); + U32 renderSkinned(); F32 getLastSkinTime() { return mLastSkinTime; } U32 renderTransparent(BOOL first_pass); void renderCollisionVolumes(); @@ -892,8 +892,8 @@ class LLVOAvatar : std::string getFullname() const; // Returns "FirstName LastName" std::string avString() const; // Frequently used string in log messages "Avatar '<full name'" protected: - static void getAnimLabels(LLDynamicArray<std::string>* labels); - static void getAnimNames(LLDynamicArray<std::string>* names); + static void getAnimLabels(std::vector<std::string>* labels); + static void getAnimNames(std::vector<std::string>* names); private: bool mNameIsSet; std::string mTitle; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 082a85e2171ce436477e2dbe6560492f612bd768..319da1abb5913fd7d8741d6020286a74b99238d2 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -43,6 +43,7 @@ #include "llhudeffecttrail.h" #include "llhudmanager.h" #include "llinventoryfunctions.h" +#include "lllocaltextureobject.h" #include "llnotificationsutil.h" #include "llselectmgr.h" #include "lltoolgrab.h" // for needsRenderBeam @@ -141,9 +142,8 @@ struct LocalTextureData //----------------------------------------------------------------------------- // Static Data //----------------------------------------------------------------------------- -S32 LLVOAvatarSelf::sScratchTexBytes = 0; -LLMap< LLGLenum, LLGLuint*> LLVOAvatarSelf::sScratchTexNames; -LLMap< LLGLenum, F32*> LLVOAvatarSelf::sScratchTexLastBindTime; +S32Bytes LLVOAvatarSelf::sScratchTexBytes(0); +std::map< LLGLenum, LLGLuint*> LLVOAvatarSelf::sScratchTexNames; /********************************************************************************* @@ -165,7 +165,7 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, mMotionController.mIsSelf = TRUE; - lldebugs << "Marking avatar as self " << id << llendl; + LL_DEBUGS() << "Marking avatar as self " << id << LL_ENDL; } // Called periodically for diagnostics, return true when done. @@ -206,7 +206,7 @@ void LLVOAvatarSelf::initInstance() // adds attachment points to mScreen among other things LLVOAvatar::initInstance(); - llinfos << "Self avatar object created. Starting timer." << llendl; + LL_INFOS() << "Self avatar object created. Starting timer." << LL_ENDL; mDebugSelfLoadTimer.reset(); // clear all times to -1 for debugging for (U32 i =0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i) @@ -227,7 +227,7 @@ void LLVOAvatarSelf::initInstance() status &= buildMenus(); if (!status) { - llerrs << "Unable to load user's avatar" << llendl; + LL_ERRS() << "Unable to load user's avatar" << LL_ENDL; return; } @@ -271,7 +271,7 @@ BOOL LLVOAvatarSelf::loadAvatarSelf() // avatar_skeleton.xml if (!buildSkeletonSelf(sAvatarSkeletonInfo)) { - llwarns << "avatar file: buildSkeleton() failed" << llendl; + LL_WARNS() << "avatar file: buildSkeleton() failed" << LL_ENDL; return FALSE; } @@ -602,7 +602,7 @@ LLVOAvatarSelf::~LLVOAvatarSelf() ** ** *********************************************************************************/ -//virtual +// virtual BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent) { // update screen joint size @@ -789,7 +789,10 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys, updateMeshTextures(); // unpack the texture UUIDs to the texture slots + if(mesgsys != NULL) + { retval = unpackTEMessage(mesgsys, _PREHASH_ObjectData, (S32) block_num); + } // need to trigger a few operations to get the avatar to use the new bakes for (U32 i = 0; i < mBakedTextureDatas.size(); i++) @@ -886,9 +889,9 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) // Diagnostic info //LLVector3d pos_from_new_region = getPositionGlobal(); - //llinfos << "pos_from_old_region is " << global_pos_from_old_region + //LL_INFOS() << "pos_from_old_region is " << global_pos_from_old_region // << " while pos_from_new_region is " << pos_from_new_region - // << llendl; + // << LL_ENDL; } if (!regionp || (regionp->getHandle() != mLastRegionHandle)) @@ -896,17 +899,11 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) if (mLastRegionHandle != 0) { ++mRegionCrossingCount; - F64 delta = (F64)mRegionCrossingTimer.getElapsedTimeF32(); - F64 avg = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_AVG); - F64 delta_avg = (delta + avg*(mRegionCrossingCount-1)) / mRegionCrossingCount; - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg); - - F64 max = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_MAX); - max = llmax(delta, max); - LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max); + F64Seconds delta(mRegionCrossingTimer.getElapsedTimeF32()); + record(LLStatViewer::REGION_CROSSING_TIME, delta); // Diagnostics - llinfos << "Region crossing took " << (F32)(delta * 1000.0) << " ms " << llendl; + LL_INFOS() << "Region crossing took " << (F32)(delta * 1000.0).value() << " ms " << LL_ENDL; } if (regionp) { @@ -990,7 +987,7 @@ void LLVOAvatarSelf::idleUpdateTractorBeam() // virtual void LLVOAvatarSelf::restoreMeshData() { - //llinfos << "Restoring" << llendl; + //LL_INFOS() << "Restoring" << LL_ENDL; mMeshValid = TRUE; updateJointLODs(); updateAttachmentVisibility(gAgentCamera.getCameraMode()); @@ -1230,7 +1227,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) // Update COF contents, don't trigger appearance update. if (!isValid()) { - llinfos << "removeItemLinks skipped, avatar is under destruction" << llendl; + LL_INFOS() << "removeItemLinks skipped, avatar is under destruction" << LL_ENDL; } else { @@ -1604,7 +1601,7 @@ void LLVOAvatarSelf::invalidateComposite( LLTexLayerSet* layerset, BOOL upload_r { return; } - // llinfos << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegionName() << llendl; + // LL_INFOS() << "LLVOAvatar::invalidComposite() " << layerset->getBodyRegionName() << LL_ENDL; layer_set->requestUpdate(); layer_set->invalidateMorphMasks(); @@ -1757,7 +1754,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te { if (type >= TEX_NUM_INDICES) { - llerrs << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << llendl; + LL_ERRS() << "Tried to set local texture with invalid type: (" << (U32) type << ", " << index << ")" << LL_ENDL; return; } LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getInstance()->getTEWearableType(type); @@ -1770,7 +1767,7 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te local_tex_obj = getLocalTextureObject(type,index); if (!local_tex_obj) { - llerrs << "Unable to create LocalTextureObject for wearable type & index: (" << (U32) wearable_type << ", " << index << ")" << llendl; + LL_ERRS() << "Unable to create LocalTextureObject for wearable type & index: (" << (U32) wearable_type << ", " << index << ")" << LL_ENDL; return; } @@ -1832,7 +1829,7 @@ void LLVOAvatarSelf::setBakedReady(LLAvatarAppearanceDefines::ETextureIndex type // virtual void LLVOAvatarSelf::dumpLocalTextures() const { - llinfos << "Local Textures:" << llendl; + LL_INFOS() << "Local Textures:" << LL_ENDL; /* ETextureIndex baked_equiv[] = { TEX_UPPER_BAKED, @@ -1856,22 +1853,22 @@ void LLVOAvatarSelf::dumpLocalTextures() const #if LL_RELEASE_FOR_DOWNLOAD // End users don't get to trivially see avatar texture IDs, makes textures // easier to steal. JC - llinfos << "LocTex " << name << ": Baked " << llendl; + LL_INFOS() << "LocTex " << name << ": Baked " << LL_ENDL; #else - llinfos << "LocTex " << name << ": Baked " << getTEImage(baked_equiv)->getID() << llendl; + LL_INFOS() << "LocTex " << name << ": Baked " << getTEImage(baked_equiv)->getID() << LL_ENDL; #endif } else if (local_tex_obj && local_tex_obj->getImage() != NULL) { if (local_tex_obj->getImage()->getID() == IMG_DEFAULT_AVATAR) { - llinfos << "LocTex " << name << ": None" << llendl; + LL_INFOS() << "LocTex " << name << ": None" << LL_ENDL; } else { const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() ); - llinfos << "LocTex " << name << ": " + LL_INFOS() << "LocTex " << name << ": " << "Discard " << image->getDiscardLevel() << ", " << "(" << image->getWidth() << ", " << image->getHeight() << ") " #if !LL_RELEASE_FOR_DOWNLOAD @@ -1880,12 +1877,12 @@ void LLVOAvatarSelf::dumpLocalTextures() const << image->getID() << " " #endif << "Priority: " << image->getDecodePriority() - << llendl; + << LL_ENDL; } } else { - llinfos << "LocTex " << name << ": No LLViewerTexture" << llendl; + LL_INFOS() << "LocTex " << name << ": No LLViewerTexture" << LL_ENDL; } } } @@ -1941,7 +1938,7 @@ void LLVOAvatarSelf::dumpTotalLocalTextureByteCount() { S32 gl_bytes = 0; gAgentAvatarp->getLocalTextureByteCount(&gl_bytes); - llinfos << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << llendl; + LL_INFOS() << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << LL_ENDL; } BOOL LLVOAvatarSelf::getIsCloud() const @@ -1965,12 +1962,12 @@ BOOL LLVOAvatarSelf::getIsCloud() const { if (do_warn) { - llinfos << "Self is clouded due to missing one or more required body parts: " + LL_INFOS() << "Self is clouded due to missing one or more required body parts: " << (shape_count ? "" : "SHAPE ") << (hair_count ? "" : "HAIR ") << (eye_count ? "" : "EYES ") << (skin_count ? "" : "SKIN ") - << llendl; + << LL_ENDL; } return TRUE; } @@ -1979,7 +1976,7 @@ BOOL LLVOAvatarSelf::getIsCloud() const { if (do_warn) { - llinfos << "Self is clouded because of no hair texture" << llendl; + LL_INFOS() << "Self is clouded because of no hair texture" << LL_ENDL; } return TRUE; } @@ -1991,7 +1988,7 @@ BOOL LLVOAvatarSelf::getIsCloud() const { if (do_warn) { - llinfos << "Self is clouded because lower textures not baked" << llendl; + LL_INFOS() << "Self is clouded because lower textures not baked" << LL_ENDL; } return TRUE; } @@ -2001,7 +1998,7 @@ BOOL LLVOAvatarSelf::getIsCloud() const { if (do_warn) { - llinfos << "Self is clouded because upper textures not baked" << llendl; + LL_INFOS() << "Self is clouded because upper textures not baked" << LL_ENDL; } return TRUE; } @@ -2021,14 +2018,14 @@ BOOL LLVOAvatarSelf::getIsCloud() const { if (do_warn) { - llinfos << "Self is clouded because texture at index " << i - << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << llendl; + LL_INFOS() << "Self is clouded because texture at index " << i + << " (texture index is " << texture_data.mTextureIndex << ") is not loaded" << LL_ENDL; } return TRUE; } } - lldebugs << "Avatar de-clouded" << llendl; + LL_DEBUGS() << "Avatar de-clouded" << LL_ENDL; } return FALSE; } @@ -2149,7 +2146,7 @@ void LLVOAvatarSelf::dumpAllTextures() const if (!layerset_buffer) continue; vd_text += verboseDebugDumpLocalTextureDataInfo(layerset); } - LL_DEBUGS("Avatar") << vd_text << llendl; + LL_DEBUGS("Avatar") << vd_text << LL_ENDL; } const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const @@ -2233,7 +2230,7 @@ LLSD LLVOAvatarSelf::metricsData() result["timers"]["ruth"] = mRuthTimer.getElapsedTimeF32(); result["timers"]["invisible"] = mInvisibleTimer.getElapsedTimeF32(); result["timers"]["fully_loaded"] = mFullyLoadedTimer.getElapsedTimeF32(); - result["startup"] = LLStartUp::getPhases().dumpPhases(); + result["startup"] = LLStartUp::getPhases().asLLSD(); return result; } @@ -2351,7 +2348,7 @@ LLSD summarize_by_buckets(std::vector<LLSD> in_records, accum_it != accum.end(); ++accum_it) { LLSD out_record = accum_it->first; - out_record["stats"] = accum_it->second.getData(); + out_record["stats"] = accum_it->second.asLLSD(); result.append(out_record); } return result; @@ -2436,7 +2433,7 @@ class CheckAgentAppearanceServiceResponder: public LLHTTPClient::Responder /* virtual */ void result(const LLSD& content) { - LL_DEBUGS("Avatar") << "status OK" << llendl; + LL_DEBUGS("Avatar") << "status OK" << LL_ENDL; } // Error @@ -2445,7 +2442,7 @@ class CheckAgentAppearanceServiceResponder: public LLHTTPClient::Responder if (isAgentAvatarValid()) { LL_DEBUGS("Avatar") << "failed, will rebake [status:" - << status << "]: " << content << llendl; + << status << "]: " << content << LL_ENDL; forceAppearanceUpdate(); } } @@ -2504,7 +2501,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const // Check if the texture hasn't been baked yet. if (!isTextureDefined(tex_index, 0)) { - lldebugs << "getTEImage( " << (U32) tex_index << " )->getID() == IMG_DEFAULT_AVATAR" << llendl; + LL_DEBUGS() << "getTEImage( " << (U32) tex_index << " )->getID() == IMG_DEFAULT_AVATAR" << LL_ENDL; return FALSE; } @@ -2523,7 +2520,7 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const const ETextureIndex t_index = (*iter); LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(t_index); U32 count = gAgentWearables.getWearableCount(wearable_type); - lldebugs << "Checking index " << (U32) t_index << " count: " << count << llendl; + LL_DEBUGS() << "Checking index " << (U32) t_index << " count: " << count << LL_ENDL; for (U32 wearable_index = 0; wearable_index < count; ++wearable_index) { @@ -2545,11 +2542,11 @@ BOOL LLVOAvatarSelf::canGrabBakedTexture(EBakedTextureIndex baked_index) const asset_id_matches); BOOL can_grab = FALSE; - lldebugs << "item count for asset " << texture_id << ": " << items.count() << llendl; - if (items.count()) + LL_DEBUGS() << "item count for asset " << texture_id << ": " << items.size() << LL_ENDL; + if (items.size()) { // search for full permissions version - for (S32 i = 0; i < items.count(); i++) + for (S32 i = 0; i < items.size(); i++) { LLViewerInventoryItem* itemp = items[i]; if (itemp->getIsFullPerm()) @@ -2660,16 +2657,16 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) /* switch(te) case TEX_HEAD_BAKED: - llinfos << "New baked texture: HEAD" << llendl; */ + LL_INFOS() << "New baked texture: HEAD" << LL_ENDL; */ const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture(te); if (texture_dict->mIsBakedTexture) { debugBakedTextureUpload(texture_dict->mBakedTextureIndex, TRUE); // FALSE for start of upload, TRUE for finish. - llinfos << "New baked texture: " << texture_dict->mName << " UUID: " << uuid <<llendl; + LL_INFOS() << "New baked texture: " << texture_dict->mName << " UUID: " << uuid <<LL_ENDL; } else { - llwarns << "New baked texture: unknown te " << te << llendl; + LL_WARNS() << "New baked texture: unknown te " << te << LL_ENDL; } // dumpAvatarTEs( "setNewBakedTexture() send" ); @@ -2692,7 +2689,7 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) << "RuthTimer " << (U32)mRuthDebugTimer.getElapsedTimeF32() << " SelfLoadTimer " << (U32)mDebugSelfLoadTimer.getElapsedTimeF32() << " Notification " << "AvatarRezSelfBakedDoneNotification" - << llendl; + << LL_ENDL; } else { @@ -2704,7 +2701,7 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) << "RuthTimer " << (U32)mRuthDebugTimer.getElapsedTimeF32() << " SelfLoadTimer " << (U32)mDebugSelfLoadTimer.getElapsedTimeF32() << " Notification " << "AvatarRezSelfBakedUpdateNotification" - << llendl; + << LL_ENDL; } } @@ -2721,11 +2718,11 @@ void LLVOAvatarSelf::outputRezDiagnostics() const } const F32 final_time = mDebugSelfLoadTimer.getElapsedTimeF32(); - LL_DEBUGS("Avatar") << "REZTIME: Myself rez stats:" << llendl; - LL_DEBUGS("Avatar") << "\t Time from avatar creation to load wearables: " << (S32)mDebugTimeWearablesLoaded << llendl; - LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << llendl; - LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << llendl; - LL_DEBUGS("Avatar") << "\t Load time for each texture: " << llendl; + LL_DEBUGS("Avatar") << "REZTIME: Myself rez stats:" << LL_ENDL; + LL_DEBUGS("Avatar") << "\t Time from avatar creation to load wearables: " << (S32)mDebugTimeWearablesLoaded << LL_ENDL; + LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << LL_ENDL; + LL_DEBUGS("Avatar") << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << LL_ENDL; + LL_DEBUGS("Avatar") << "\t Load time for each texture: " << LL_ENDL; for (U32 i = 0; i < LLAvatarAppearanceDefines::TEX_NUM_INDICES; ++i) { std::stringstream out; @@ -2753,10 +2750,10 @@ void LLVOAvatarSelf::outputRezDiagnostics() const LL_DEBUGS("Avatar") << out.str() << LL_ENDL; } } - LL_DEBUGS("Avatar") << "\t Time points for each upload (start / finish)" << llendl; + LL_DEBUGS("Avatar") << "\t Time points for each upload (start / finish)" << LL_ENDL; for (U32 i = 0; i < LLAvatarAppearanceDefines::BAKED_NUM_INDICES; ++i) { - LL_DEBUGS("Avatar") << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << llendl; + LL_DEBUGS("Avatar") << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << LL_ENDL; } for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); @@ -2768,7 +2765,7 @@ void LLVOAvatarSelf::outputRezDiagnostics() const if (!layerset) continue; const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); if (!layerset_buffer) continue; - LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << llendl; + LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << LL_ENDL; } dumpAllTextures(); @@ -2808,11 +2805,11 @@ void LLVOAvatarSelf::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid { if (mInitialBakeIDs[i] == uuid) { - llinfos << "baked texture correctly loaded at login! " << i << llendl; + LL_INFOS() << "baked texture correctly loaded at login! " << i << LL_ENDL; } else { - llwarns << "baked texture does not match id loaded at login!" << i << llendl; + LL_WARNS() << "baked texture does not match id loaded at login!" << i << LL_ENDL; } mInitialBakeIDs[i] = LLUUID::null; } @@ -2848,10 +2845,10 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) LLViewerTexLayerSet* layer_set = gAgentAvatarp->getLayerSet(index); if (layer_set) { - llinfos << "TAT: rebake - matched entry " << (S32)index << llendl; + LL_INFOS() << "TAT: rebake - matched entry " << (S32)index << LL_ENDL; gAgentAvatarp->invalidateComposite(layer_set, TRUE); found = TRUE; - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); + add(LLStatViewer::TEX_REBAKES, 1); } } } @@ -2872,7 +2869,7 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**) void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug) { - llinfos << "TAT: forced full rebake. " << llendl; + LL_INFOS() << "TAT: forced full rebake. " << LL_ENDL; for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { @@ -2887,11 +2884,11 @@ void LLVOAvatarSelf::forceBakeAllTextures(bool slam_for_debug) } invalidateComposite(layer_set, TRUE); - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); + add(LLStatViewer::TEX_REBAKES, 1); } else { - llwarns << "TAT: NO LAYER SET FOR " << (S32)baked_index << llendl; + LL_WARNS() << "TAT: NO LAYER SET FOR " << (S32)baked_index << LL_ENDL; } } @@ -3062,29 +3059,28 @@ BOOL LLVOAvatarSelf::needsRenderBeam() // static void LLVOAvatarSelf::deleteScratchTextures() { - for( LLGLuint* namep = sScratchTexNames.getFirstData(); - namep; - namep = sScratchTexNames.getNextData() ) + for(std::map< LLGLenum, LLGLuint*>::iterator it = sScratchTexNames.begin(), end_it = sScratchTexNames.end(); + it != end_it; + ++it) { - LLImageGL::deleteTextures(1, (U32 *)namep ); + LLImageGL::deleteTextures(1, (U32 *)it->second ); stop_glerror(); } - if( sScratchTexBytes ) + if( sScratchTexBytes.value() ) { - lldebugs << "Clearing Scratch Textures " << (sScratchTexBytes/1024) << "KB" << llendl; + LL_DEBUGS() << "Clearing Scratch Textures " << (S32Kilobytes)sScratchTexBytes << LL_ENDL; - sScratchTexNames.deleteAllData(); - sScratchTexLastBindTime.deleteAllData(); - LLImageGL::sGlobalTextureMemoryInBytes -= sScratchTexBytes; - sScratchTexBytes = 0; + delete_and_clear(sScratchTexNames); + LLImageGL::sGlobalTextureMemory -= sScratchTexBytes; + sScratchTexBytes = S32Bytes(0); } } // static void LLVOAvatarSelf::dumpScratchTextureByteCount() { - llinfos << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << llendl; + LL_INFOS() << "Scratch Texture GL: " << (sScratchTexBytes/1024) << "KB" << LL_ENDL; } void LLVOAvatarSelf::dumpWearableInfo(LLAPRFile& outfile) diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 521c86e1c334214ae6511a3b8939608b122a1111..444175b62e99f458f1c8c6fe682c96e0e08e7fcd 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -30,6 +30,7 @@ #include "llviewertexture.h" #include "llvoavatar.h" +#include <map> struct LocalTextureData; @@ -49,16 +50,6 @@ class LLVOAvatarSelf : **/ public: - void* operator new(size_t size) - { - return ll_aligned_malloc_16(size); - } - - void operator delete(void* ptr) - { - ll_aligned_free_16(ptr); - } - LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); virtual ~LLVOAvatarSelf(); virtual void markDead(); @@ -275,9 +266,8 @@ class LLVOAvatarSelf : public: static void deleteScratchTextures(); private: - static S32 sScratchTexBytes; - static LLMap< LLGLenum, LLGLuint*> sScratchTexNames; - static LLMap< LLGLenum, F32*> sScratchTexLastBindTime; + static S32Bytes sScratchTexBytes; + static std::map< LLGLenum, LLGLuint*> sScratchTexNames; /** Textures ** ** diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 7db19c5c1b0d6a230af6c160c983ad0a7242258a..fd1d57a9d0d367326e216213eeccf1102d0bc4c8 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -29,6 +29,20 @@ #include "llerror.h" #include "llregionhandle.h" #include "llviewercontrol.h" +#include "llviewerobjectlist.h" +#include "lldrawable.h" +#include "llviewerregion.h" +#include "pipeline.h" +#include "llagentcamera.h" +#include "llmemory.h" + +//static variables +U32 LLVOCacheEntry::sMinFrameRange = 0; +F32 LLVOCacheEntry::sNearRadius = 1.0f; +F32 LLVOCacheEntry::sRearFarRadius = 1.0f; +F32 LLVOCacheEntry::sFrontPixelThreshold = 1.0f; +F32 LLVOCacheEntry::sRearPixelThreshold = 1.0f; +BOOL LLVOCachePartition::sNeedsOcclusionCheck = FALSE; BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes) { @@ -46,12 +60,19 @@ BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes) //--------------------------------------------------------------------------- LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp) - : +: LLTrace::MemTrackable<LLVOCacheEntry, 16>("LLVOCacheEntry"), + LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mLocalID(local_id), mCRC(crc), + mUpdateFlags(-1), mHitCount(0), mDupeCount(0), - mCRCChangeCount(0) + mCRCChangeCount(0), + mState(INACTIVE), + mSceneContrib(0.f), + mValid(TRUE), + mParentID(0), + mBSphereRadius(-1.0f) { mBuffer = new U8[dp.getBufferSize()]; mDP.assignBuffer(mBuffer, dp.getBufferSize()); @@ -59,24 +80,40 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & } LLVOCacheEntry::LLVOCacheEntry() - : +: LLTrace::MemTrackable<LLVOCacheEntry, 16>("LLVOCacheEntry"), + LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mLocalID(0), mCRC(0), + mUpdateFlags(-1), mHitCount(0), mDupeCount(0), mCRCChangeCount(0), - mBuffer(NULL) + mBuffer(NULL), + mState(INACTIVE), + mSceneContrib(0.f), + mValid(TRUE), + mParentID(0), + mBSphereRadius(-1.0f) { mDP.assignBuffer(mBuffer, 0); } LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) - : mBuffer(NULL) +: LLTrace::MemTrackable<LLVOCacheEntry, 16>("LLVOCacheEntry"), + LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), + mBuffer(NULL), + mUpdateFlags(-1), + mState(INACTIVE), + mSceneContrib(0.f), + mValid(FALSE), + mParentID(0), + mBSphereRadius(-1.0f) { S32 size = -1; BOOL success; mDP.assignBuffer(mBuffer, 0); + success = check_read(apr_file, &mLocalID, sizeof(U32)); if(success) { @@ -104,7 +141,7 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) // We've got a bogus size, skip reading it. // We won't bother seeking, because the rest of this file // is likely bogus, and will be tossed anyway. - llwarns << "Bogus cache entry, size " << size << ", aborting!" << llendl; + LL_WARNS() << "Bogus cache entry, size " << size << ", aborting!" << LL_ENDL; success = FALSE; } } @@ -132,6 +169,8 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) mDupeCount = 0; mCRCChangeCount = 0; mBuffer = NULL; + mEntry = NULL; + mState = INACTIVE; } } @@ -140,37 +179,156 @@ LLVOCacheEntry::~LLVOCacheEntry() mDP.freeBuffer(); } - -// New CRC means the object has changed. -void LLVOCacheEntry::assignCRC(U32 crc, LLDataPackerBinaryBuffer &dp) +void LLVOCacheEntry::updateEntry(U32 crc, LLDataPackerBinaryBuffer &dp) { - if ( (mCRC != crc) - ||(mDP.getBufferSize() == 0)) + if(mCRC != crc) { mCRC = crc; - mHitCount = 0; mCRCChangeCount++; + } + + mDP.freeBuffer(); + + llassert_always(dp.getBufferSize() > 0); + mBuffer = new U8[dp.getBufferSize()]; + mDP.assignBuffer(mBuffer, dp.getBufferSize()); + mDP = dp; +} + +void LLVOCacheEntry::setParentID(U32 id) +{ + if(mParentID != id) + { + removeAllChildren(); + mParentID = id; + } +} + +void LLVOCacheEntry::removeAllChildren() +{ + if(mChildrenList.empty()) + { + return; + } + + for(vocache_entry_set_t::iterator iter = mChildrenList.begin(); iter != mChildrenList.end(); ++iter) + { + (*iter)->setParentID(0); + } + mChildrenList.clear(); + + return; +} - mDP.freeBuffer(); - mBuffer = new U8[dp.getBufferSize()]; - mDP.assignBuffer(mBuffer, dp.getBufferSize()); - mDP = dp; +//virtual +void LLVOCacheEntry::setOctreeEntry(LLViewerOctreeEntry* entry) +{ + if(!entry && mDP.getBufferSize() > 0) + { + LLUUID fullid; + LLViewerObject::unpackUUID(&mDP, fullid, "ID"); + + LLViewerObject* obj = gObjectList.findObject(fullid); + if(obj && obj->mDrawable) + { + entry = obj->mDrawable->getEntry(); + } } + + LLViewerOctreeEntryData::setOctreeEntry(entry); } -LLDataPackerBinaryBuffer *LLVOCacheEntry::getDP(U32 crc) +void LLVOCacheEntry::setState(U32 state) { - if ( (mCRC != crc) - ||(mDP.getBufferSize() == 0)) + if(state > LOW_BITS) //special states { - //llinfos << "Not getting cache entry, invalid!" << llendl; + mState |= (HIGH_BITS & state); + return; + } + + // + //otherwise LOW_BITS states + // + clearState(LOW_BITS); + mState |= (LOW_BITS & state); + + if(getState() == ACTIVE) + { + const S32 MIN_INTERVAL = 64 + sMinFrameRange; + U32 last_visible = getVisible(); + + setVisible(); + + U32 cur_visible = getVisible(); + if(cur_visible - last_visible > MIN_INTERVAL || + cur_visible < MIN_INTERVAL) + { + mLastCameraUpdated = 0; //reset + } + else + { + mLastCameraUpdated = LLViewerRegion::sLastCameraUpdated; + } + } +} + +void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) +{ + llassert(entry != NULL); + llassert(entry->getParentID() == mLocalID); + llassert(entry->getEntry() != NULL); + + if(!entry || !entry->getEntry() || entry->getParentID() != mLocalID) + { + return; + } + + mChildrenList.insert(entry); + + //update parent bbox + if(getEntry() != NULL && isState(INACTIVE)) + { + updateParentBoundingInfo(entry); + resetVisible(); + } +} + +void LLVOCacheEntry::removeChild(LLVOCacheEntry* entry) +{ + entry->setParentID(0); + + vocache_entry_set_t::iterator iter = mChildrenList.find(entry); + if(iter != mChildrenList.end()) + { + mChildrenList.erase(iter); + } +} + +//remove the first child, and return it. +LLVOCacheEntry* LLVOCacheEntry::getChild() +{ + LLVOCacheEntry* child = NULL; + vocache_entry_set_t::iterator iter = mChildrenList.begin(); + if(iter != mChildrenList.end()) + { + child = *iter; + mChildrenList.erase(iter); + } + + return child; +} + +LLDataPackerBinaryBuffer *LLVOCacheEntry::getDP() +{ + if (mDP.getBufferSize() == 0) + { + //LL_INFOS() << "Not getting cache entry, invalid!" << LL_ENDL; return NULL; } - mHitCount++; + return &mDP; } - void LLVOCacheEntry::recordHit() { mHitCount++; @@ -179,12 +337,12 @@ void LLVOCacheEntry::recordHit() void LLVOCacheEntry::dump() const { - llinfos << "local " << mLocalID + LL_INFOS() << "local " << mLocalID << " crc " << mCRC << " hits " << mHitCount << " dupes " << mDupeCount << " change " << mCRCChangeCount - << llendl; + << LL_ENDL; } BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const @@ -221,49 +379,675 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const return success ; } +//static +void LLVOCacheEntry::updateDebugSettings() +{ + static LLFrameTimer timer; + if(timer.getElapsedTimeF32() < 1.0f) //update frequency once per second. + { + return; + } + timer.reset(); + + //the number of frames invisible objects stay in memory + static LLCachedControl<U32> inv_obj_time(gSavedSettings,"NonvisibleObjectsInMemoryTime"); + sMinFrameRange = inv_obj_time - 1; //make 0 to be the maximum + + //min radius: all objects within this radius remain loaded in memory + static LLCachedControl<F32> min_radius(gSavedSettings,"SceneLoadMinRadius"); + sNearRadius = llmin((F32)min_radius, gAgentCamera.mDrawDistance); //can not exceed the draw distance + sNearRadius = llmax(sNearRadius, 1.f); //minimum value is 1.0m + + //objects within the view frustum whose visible area is greater than this threshold will be loaded + static LLCachedControl<F32> front_pixel_threshold(gSavedSettings,"SceneLoadFrontPixelThreshold"); + sFrontPixelThreshold = front_pixel_threshold; + + //objects out of the view frustum whose visible area is greater than this threshold will remain loaded + static LLCachedControl<F32> rear_pixel_threshold(gSavedSettings,"SceneLoadRearPixelThreshold"); + sRearPixelThreshold = rear_pixel_threshold; + sRearPixelThreshold = llmax(sRearPixelThreshold, sFrontPixelThreshold); //can not be smaller than sFrontPixelThreshold. + + // a percentage of draw distance beyond which all objects outside of view frustum will be unloaded, regardless of pixel threshold + static LLCachedControl<F32> rear_max_radius_frac(gSavedSettings,"SceneLoadRearMaxRadiusFraction"); + sRearFarRadius = llmax(rear_max_radius_frac * gAgentCamera.mDrawDistance / 100.f, 1.0f); //minimum value is 1.0m + sRearFarRadius = llmax(sRearFarRadius, (F32)min_radius); //can not be less than "SceneLoadMinRadius". + sRearFarRadius = llmin(sRearFarRadius, gAgentCamera.mDrawDistance); //can not be more than the draw distance. + + //make the above parameters adaptive to memory usage + //starts to put restrictions from low_mem_bound_MB, apply tightest restrictions when hits high_mem_bound_MB + static LLCachedControl<U32> low_mem_bound_MB(gSavedSettings,"SceneLoadLowMemoryBound"); + static LLCachedControl<U32> high_mem_bound_MB(gSavedSettings,"SceneLoadHighMemoryBound"); + + LLMemory::updateMemoryInfo() ; + U32 allocated_mem = LLMemory::getAllocatedMemKB().value(); + allocated_mem /= 1024; //convert to MB. + if(allocated_mem < low_mem_bound_MB) + { + return; + } + F32 adjust_factor = llmax(0.f, (F32)(high_mem_bound_MB - allocated_mem) / (high_mem_bound_MB - low_mem_bound_MB)); + + sRearFarRadius = llmin(adjust_factor * sRearFarRadius, 96.f); //[0.f, 96.f] + sMinFrameRange = (U32)llclamp(adjust_factor * sMinFrameRange, 10.f, 64.f); //[10, 64] + sNearRadius = llmax(adjust_factor * sNearRadius, 1.0f); +} + +//static +F32 LLVOCacheEntry::getSquaredPixelThreshold(bool is_front) +{ + F32 threshold; + if(is_front) + { + threshold = sFrontPixelThreshold; + } + else + { + threshold = sRearPixelThreshold; + } + + //object projected area threshold + F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); + F32 projection_threshold = pixel_meter_ratio > 0.f ? threshold / pixel_meter_ratio : 0.f; + projection_threshold *= projection_threshold; + + return projection_threshold; +} + +bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, const LLVector4a& local_camera_origin, F32 dist_threshold) +{ + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup(); + if(!group) + { + return false; + } + + //any visible + bool vis = group->isAnyRecentlyVisible(); + + //not ready to remove + if(!vis) + { + S32 cur_vis = llmax(group->getAnyVisible(), (S32)getVisible()); + vis = (cur_vis + sMinFrameRange > LLViewerOctreeEntryData::getCurrentFrame()); + } + + //within the back sphere + if(!vis && !mParentID && !group->isOcclusionState(LLOcclusionCullingGroup::OCCLUDED)) + { + LLVector4a lookAt; + + if(mBSphereRadius > 0.f) + { + lookAt.setSub(mBSphereCenter, local_camera_origin); + dist_threshold += mBSphereRadius; + } + else + { + lookAt.setSub(getPositionGroup(), camera_origin); + dist_threshold += getBinRadius(); + } + + vis = (lookAt.dot3(lookAt).getF32() < dist_threshold * dist_threshold); + } + + return vis; +} + +void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 max_dist) +{ + if(!needs_update && getVisible() >= last_update) + { + return; //no need to update + } + + LLVector4a lookAt; + lookAt.setSub(getPositionGroup(), camera_origin); + F32 distance = lookAt.getLength3().getF32(); + distance -= sNearRadius; + + if(distance <= 0.f) + { + //nearby objects, set a large number + const F32 LARGE_SCENE_CONTRIBUTION = 1000.f; //a large number to force to load the object. + mSceneContrib = LARGE_SCENE_CONTRIBUTION; + } + else + { + F32 rad = getBinRadius(); + max_dist += rad; + + if(distance + sNearRadius < max_dist) + { + mSceneContrib = (rad * rad) / distance; + } + else + { + mSceneContrib = 0.f; //out of draw distance, not to load + } + } + + setVisible(); +} + +void LLVOCacheEntry::saveBoundingSphere() +{ + mBSphereCenter = getPositionGroup(); + mBSphereRadius = getBinRadius(); +} + +void LLVOCacheEntry::setBoundingInfo(const LLVector3& pos, const LLVector3& scale) +{ + LLVector4a center, newMin, newMax; + center.load3(pos.mV); + LLVector4a size; + size.load3(scale.mV); + newMin.setSub(center, size); + newMax.setAdd(center, size); + + setPositionGroup(center); + setSpatialExtents(newMin, newMax); + + if(getNumOfChildren() > 0) //has children + { + updateParentBoundingInfo(); + } + else + { + setBinRadius(llmin(size.getLength3().getF32() * 4.f, 256.f)); + } +} + +//make the parent bounding box to include all children +void LLVOCacheEntry::updateParentBoundingInfo() +{ + if(mChildrenList.empty()) + { + return; + } + + for(vocache_entry_set_t::iterator iter = mChildrenList.begin(); iter != mChildrenList.end(); ++iter) + { + updateParentBoundingInfo(*iter); + } + resetVisible(); +} + +//make the parent bounding box to include this child +void LLVOCacheEntry::updateParentBoundingInfo(const LLVOCacheEntry* child) +{ + const LLVector4a* child_exts = child->getSpatialExtents(); + LLVector4a newMin, newMax; + newMin = child_exts[0]; + newMax = child_exts[1]; + + //move to regional space. + { + const LLVector4a& parent_pos = getPositionGroup(); + newMin.add(parent_pos); + newMax.add(parent_pos); + } + + //update parent's bbox(min, max) + const LLVector4a* parent_exts = getSpatialExtents(); + update_min_max(newMin, newMax, parent_exts[0]); + update_min_max(newMin, newMax, parent_exts[1]); + for(S32 i = 0; i < 4; i++) + { + llclamp(newMin[i], 0.f, 256.f); + llclamp(newMax[i], 0.f, 256.f); + } + setSpatialExtents(newMin, newMax); + + //update parent's bbox center + LLVector4a center; + center.setAdd(newMin, newMax); + center.mul(0.5f); + setPositionGroup(center); + + //update parent's bbox size vector + LLVector4a size; + size.setSub(newMax, newMin); + size.mul(0.5f); + setBinRadius(llmin(size.getLength3().getF32() * 4.f, 256.f)); +} //------------------------------------------------------------------- -//LLVOCache +//LLVOCachePartition //------------------------------------------------------------------- -// Format string used to construct filename for the object cache -static const char OBJECT_CACHE_FILENAME[] = "objects_%d_%d.slc"; +LLVOCacheGroup::~LLVOCacheGroup() +{ + if(mOcclusionState[LLViewerCamera::CAMERA_WORLD] & ACTIVE_OCCLUSION) + { + ((LLVOCachePartition*)mSpatialPartition)->removeOccluder(this); + } +} -const U32 MAX_NUM_OBJECT_ENTRIES = 128 ; -const U32 MIN_ENTRIES_TO_PURGE = 16 ; -const U32 INVALID_TIME = 0 ; -const char* object_cache_dirname = "objectcache"; -const char* header_filename = "object.cache"; +//virtual +void LLVOCacheGroup::handleChildAddition(const OctreeNode* parent, OctreeNode* child) +{ + if (child->getListenerCount() == 0) + { + new LLVOCacheGroup(child, mSpatialPartition); + } + else + { + OCT_ERRS << "LLVOCacheGroup redundancy detected." << LL_ENDL; + } -LLVOCache* LLVOCache::sInstance = NULL; + unbound(); + + ((LLViewerOctreeGroup*)child->getListener(0))->unbound(); +} -//static -LLVOCache* LLVOCache::getInstance() -{ - if(!sInstance) +LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp) +: LLTrace::MemTrackable<LLVOCachePartition>("LLVOCachePartition") +{ + mLODPeriod = 16; + mRegionp = regionp; + mPartitionType = LLViewerRegion::PARTITION_VO_CACHE; + mBackSlectionEnabled = -1; + mIdleHash = 0; + + for(S32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++) { - sInstance = new LLVOCache() ; + mCulledTime[i] = 0; } - return sInstance ; + mCullHistory = -1; + + new LLVOCacheGroup(mOctree, this); } -//static -BOOL LLVOCache::hasInstance() +bool LLVOCachePartition::addEntry(LLViewerOctreeEntry* entry) { - return sInstance != NULL ; + llassert(entry->hasVOCacheEntry()); + + if(!llfinite(entry->getBinRadius()) || !entry->getPositionGroup().isFinite3()) + { + return false; //data corrupted + } + + mOctree->insert(entry); + + return true; } + +void LLVOCachePartition::removeEntry(LLViewerOctreeEntry* entry) +{ + entry->getVOCacheEntry()->setGroup(NULL); -//static -void LLVOCache::destroyClass() + llassert(!entry->getGroup()); +} + +class LLVOCacheOctreeCull : public LLViewerOctreeCull +{ +public: + LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp, + const LLVector3& shift, bool use_object_cache_occlusion, F32 pixel_threshold, LLVOCachePartition* part) + : LLViewerOctreeCull(camera), + mRegionp(regionp), + mPartition(part), + mPixelThreshold(pixel_threshold) + { + mLocalShift = shift; + mUseObjectCacheOcclusion = use_object_cache_occlusion; + mNearRadius = LLVOCacheEntry::sNearRadius; + } + + virtual bool earlyFail(LLViewerOctreeGroup* base_group) + { + if( mUseObjectCacheOcclusion && + base_group->getOctreeNode()->getParent()) //never occlusion cull the root node + { + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group; + if(group->needsUpdate()) + { + //needs to issue new occlusion culling check, perform view culling check first. + return false; + } + + group->checkOcclusion(); + + if (group->isOcclusionState(LLOcclusionCullingGroup::OCCLUDED)) + { + return true; + } + } + + return false; + } + + virtual S32 frustumCheck(const LLViewerOctreeGroup* group) + { +#if 0 + S32 res = AABBInRegionFrustumGroupBounds(group); +#else + S32 res = AABBInRegionFrustumNoFarClipGroupBounds(group); + if (res != 0) + { + res = llmin(res, AABBRegionSphereIntersectGroupExtents(group, mLocalShift)); + } +#endif + + return res; + } + + virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) + { +#if 0 + S32 res = AABBInRegionFrustumObjectBounds(group); +#else + S32 res = AABBInRegionFrustumNoFarClipObjectBounds(group); + if (res != 0) + { + res = llmin(res, AABBRegionSphereIntersectObjectExtents(group, mLocalShift)); + } +#endif + + if(res != 0) + { + //check if the objects projection large enough + const LLVector4a* exts = group->getObjectExtents(); + res = checkProjectionArea(exts[0], exts[1], mLocalShift, mPixelThreshold, mNearRadius); + } + + return res; + } + + virtual void processGroup(LLViewerOctreeGroup* base_group) + { + if( !mUseObjectCacheOcclusion || + !base_group->getOctreeNode()->getParent()) + { + //no occlusion check + if(mRegionp->addVisibleGroup(base_group)) + { + base_group->setVisible(); + } + return; + } + + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group; + if(group->needsUpdate() || !group->isRecentlyVisible())//needs to issue new occlusion culling check. + { + mPartition->addOccluders(group); + group->setVisible(); + return ; //wait for occlusion culling result + } + + if(group->isOcclusionState(LLOcclusionCullingGroup::QUERY_PENDING) || + group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION)) + { + //keep waiting + group->setVisible(); + } + else + { + if(mRegionp->addVisibleGroup(base_group)) + { + base_group->setVisible(); + } + } + } + +private: + LLVOCachePartition* mPartition; + LLViewerRegion* mRegionp; + LLVector3 mLocalShift; //shift vector from agent space to local region space. + F32 mPixelThreshold; + F32 mNearRadius; + bool mUseObjectCacheOcclusion; +}; + +//select objects behind camera +class LLVOCacheOctreeBackCull : public LLViewerOctreeCull +{ +public: + LLVOCacheOctreeBackCull(LLCamera* camera, const LLVector3& shift, LLViewerRegion* regionp, F32 pixel_threshold, bool use_occlusion) + : LLViewerOctreeCull(camera), mRegionp(regionp), mPixelThreshold(pixel_threshold), mUseObjectCacheOcclusion(use_occlusion) + { + mLocalShift = shift; + mSphereRadius = LLVOCacheEntry::sRearFarRadius; + } + + virtual bool earlyFail(LLViewerOctreeGroup* base_group) + { + if( mUseObjectCacheOcclusion && + base_group->getOctreeNode()->getParent()) //never occlusion cull the root node + { + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)base_group; + + if (group->getOcclusionState() > 0) //occlusion state is not clear. + { + return true; + } + } + + return false; + } + + virtual S32 frustumCheck(const LLViewerOctreeGroup* group) + { + const LLVector4a* exts = group->getExtents(); + return backSphereCheck(exts[0], exts[1]); + } + + virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) + { + const LLVector4a* exts = group->getObjectExtents(); + if(backSphereCheck(exts[0], exts[1])) + { + //check if the objects projection large enough + const LLVector4a* exts = group->getObjectExtents(); + return checkProjectionArea(exts[0], exts[1], mLocalShift, mPixelThreshold, mSphereRadius); + } + return false; + } + + virtual void processGroup(LLViewerOctreeGroup* base_group) + { + mRegionp->addVisibleGroup(base_group); + return; + } + +private: + //a sphere around the camera origin, including objects behind camera. + S32 backSphereCheck(const LLVector4a& min, const LLVector4a& max) + { + return AABBSphereIntersect(min, max, mCamera->getOrigin() - mLocalShift, mSphereRadius); + } + +private: + F32 mSphereRadius; + LLViewerRegion* mRegionp; + LLVector3 mLocalShift; //shift vector from agent space to local region space. + F32 mPixelThreshold; + bool mUseObjectCacheOcclusion; +}; + +void LLVOCachePartition::selectBackObjects(LLCamera &camera, F32 pixel_threshold, bool use_occlusion) +{ + if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) + { + return; + } + + if(mBackSlectionEnabled < 0) + { + mBackSlectionEnabled = LLVOCacheEntry::sMinFrameRange - 1; + mBackSlectionEnabled = llmax(mBackSlectionEnabled, (S32)1); + } + + if(!mBackSlectionEnabled) + { + return; + } + + //localize the camera + LLVector3 region_agent = mRegionp->getOriginAgent(); + + LLVOCacheOctreeBackCull culler(&camera, region_agent, mRegionp, pixel_threshold, use_occlusion); + culler.traverse(mOctree); + + mBackSlectionEnabled--; + if(!mRegionp->getNumOfVisibleGroups()) + { + mBackSlectionEnabled = 0; + } + + return; +} + +S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) +{ + static LLCachedControl<bool> use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion"); + + if(!LLViewerRegion::sVOCacheCullingEnabled) + { + return 0; + } + if(mRegionp->isPaused()) + { + return 0; + } + + ((LLViewerOctreeGroup*)mOctree->getListener(0))->rebound(); + + if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) + { + return 0; //no need for those cameras. + } + + if(mCulledTime[LLViewerCamera::sCurCameraID] == LLViewerOctreeEntryData::getCurrentFrame()) + { + return 0; //already culled + } + mCulledTime[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame(); + + if(!mCullHistory && LLViewerRegion::isViewerCameraStatic()) + { + U32 seed = llmax(mLODPeriod >> 1, (U32)4); + if(LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD) + { + if(!(LLViewerOctreeEntryData::getCurrentFrame() % seed)) + { + mIdleHash = (mIdleHash + 1) % seed; + } + } + if(LLViewerOctreeEntryData::getCurrentFrame() % seed != mIdleHash) + { + mFrontCull = FALSE; + + //process back objects selection + selectBackObjects(camera, LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull), + do_occlusion && use_object_cache_occlusion); + return 0; //nothing changed, reduce frequency of culling + } + } + else + { + mBackSlectionEnabled = -1; //reset it. + } + + //localize the camera + LLVector3 region_agent = mRegionp->getOriginAgent(); + camera.calcRegionFrustumPlanes(region_agent, gAgentCamera.mDrawDistance); + + mFrontCull = TRUE; + LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, + LLVOCacheEntry::getSquaredPixelThreshold(mFrontCull), this); + culler.traverse(mOctree); + + if(!sNeedsOcclusionCheck) + { + sNeedsOcclusionCheck = !mOccludedGroups.empty(); + } + return 1; +} + +void LLVOCachePartition::setCullHistory(BOOL has_new_object) { - if(sInstance) + mCullHistory <<= 1; + mCullHistory |= has_new_object; +} + +void LLVOCachePartition::addOccluders(LLViewerOctreeGroup* gp) +{ + LLVOCacheGroup* group = (LLVOCacheGroup*)gp; + + if(!group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION)) { - delete sInstance ; - sInstance = NULL ; + group->setOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION); + mOccludedGroups.insert(group); } } +void LLVOCachePartition::processOccluders(LLCamera* camera) +{ + if(mOccludedGroups.empty()) + { + return; + } + if(LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) + { + return; //no need for those cameras. + } + + LLVector3 region_agent = mRegionp->getOriginAgent(); + LLVector4a shift(region_agent[0], region_agent[1], region_agent[2]); + for(std::set<LLVOCacheGroup*>::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter) + { + LLVOCacheGroup* group = *iter; + if(group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION)) + { + group->doOcclusion(camera, &shift); + group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION); + } + } + + //safe to clear mOccludedGroups here because only the world camera accesses it. + mOccludedGroups.clear(); + sNeedsOcclusionCheck = FALSE; +} + +void LLVOCachePartition::resetOccluders() +{ + if(mOccludedGroups.empty()) + { + return; + } + + for(std::set<LLVOCacheGroup*>::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter) + { + LLVOCacheGroup* group = *iter; + group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION); + } + mOccludedGroups.clear(); + sNeedsOcclusionCheck = FALSE; +} + +void LLVOCachePartition::removeOccluder(LLVOCacheGroup* group) +{ + if(mOccludedGroups.empty()) + { + return; + } + mOccludedGroups.erase(group); +} +//------------------------------------------------------------------- +//LLVOCache +//------------------------------------------------------------------- +// Format string used to construct filename for the object cache +static const char OBJECT_CACHE_FILENAME[] = "objects_%d_%d.slc"; + +const U32 MAX_NUM_OBJECT_ENTRIES = 128 ; +const U32 MIN_ENTRIES_TO_PURGE = 16 ; +const U32 INVALID_TIME = 0 ; +const char* object_cache_dirname = "objectcache"; +const char* header_filename = "object.cache"; + + LLVOCache::LLVOCache(): - mInitialized(FALSE), - mReadOnly(TRUE), + mInitialized(false), + mReadOnly(true), mNumEntries(0), mCacheSize(1) { @@ -291,16 +1075,16 @@ void LLVOCache::initCache(ELLPath location, U32 size, U32 cache_version) { if(!mEnabled) { - llwarns << "Not initializing cache: Cache is currently disabled." << llendl; + LL_WARNS() << "Not initializing cache: Cache is currently disabled." << LL_ENDL; return ; } if(mInitialized) { - llwarns << "Cache already initialized." << llendl; + LL_WARNS() << "Cache already initialized." << LL_ENDL; return ; } - mInitialized = TRUE ; + mInitialized = true; setDirNames(location); if (!mReadOnly) @@ -325,39 +1109,48 @@ void LLVOCache::initCache(ELLPath location, U32 size, U32 cache_version) } } -void LLVOCache::removeCache(ELLPath location) +void LLVOCache::removeCache(ELLPath location, bool started) { + if(started) + { + removeCache(); + return; + } + if(mReadOnly) { - llwarns << "Not removing cache at " << location << ": Cache is currently in read-only mode." << llendl; + LL_WARNS() << "Not removing cache at " << location << ": Cache is currently in read-only mode." << LL_ENDL; return ; - } + } - llinfos << "about to remove the object cache due to settings." << llendl ; + LL_INFOS() << "about to remove the object cache due to settings." << LL_ENDL ; std::string mask = "*"; std::string cache_dir = gDirUtilp->getExpandedFilename(location, object_cache_dirname); - llinfos << "Removing cache at " << cache_dir << llendl; + LL_INFOS() << "Removing cache at " << cache_dir << LL_ENDL; gDirUtilp->deleteFilesInDir(cache_dir, mask); //delete all files LLFile::rmdir(cache_dir); clearCacheInMemory(); - mInitialized = FALSE ; + mInitialized = false; } void LLVOCache::removeCache() { - llassert_always(mInitialized) ; + if(!mInitialized) + { + //OK to remove cache even it is not initialized. + LL_WARNS() << "Object cache is not initialized yet." << LL_ENDL; + } + if(mReadOnly) { - llwarns << "Not clearing object cache: Cache is currently in read-only mode." << llendl; + LL_WARNS() << "Not clearing object cache: Cache is currently in read-only mode." << LL_ENDL; return ; } - llinfos << "about to remove the object cache due to some error." << llendl ; - std::string mask = "*"; - llinfos << "Removing cache at " << mObjectCacheDirName << llendl; + LL_INFOS() << "Removing object cache at " << mObjectCacheDirName << LL_ENDL; gDirUtilp->deleteFilesInDir(mObjectCacheDirName, mask); clearCacheInMemory() ; @@ -366,23 +1159,23 @@ void LLVOCache::removeCache() void LLVOCache::removeEntry(HeaderEntryInfo* entry) { - llassert_always(mInitialized) ; + llassert_always(mInitialized); if(mReadOnly) { - return ; + return; } if(!entry) { - return ; + return; } - header_entry_queue_t::iterator iter = mHeaderEntryQueue.find(entry) ; + header_entry_queue_t::iterator iter = mHeaderEntryQueue.find(entry); if(iter != mHeaderEntryQueue.end()) { - mHandleEntryMap.erase(entry->mHandle) ; - mHeaderEntryQueue.erase(iter) ; - removeFromCache(entry) ; - delete entry ; + mHandleEntryMap.erase(entry->mHandle); + mHeaderEntryQueue.erase(iter); + removeFromCache(entry); + delete entry; mNumEntries = mHandleEntryMap.size() ; } @@ -429,7 +1222,7 @@ void LLVOCache::removeFromCache(HeaderEntryInfo* entry) { if(mReadOnly) { - llwarns << "Not removing cache for handle " << entry->mHandle << ": Cache is currently in read-only mode." << llendl; + LL_WARNS() << "Not removing cache for handle " << entry->mHandle << ": Cache is currently in read-only mode." << LL_ENDL; return ; } @@ -444,7 +1237,7 @@ void LLVOCache::readCacheHeader() { if(!mEnabled) { - llwarns << "Not reading cache header: Cache is currently disabled." << llendl; + LL_WARNS() << "Not reading cache header: Cache is currently disabled." << LL_ENDL; return; } @@ -474,7 +1267,7 @@ void LLVOCache::readCacheHeader() if(!success) //failed { - llwarns << "Error reading cache header entry. (entry_index=" << mNumEntries << ")" << llendl; + LL_WARNS() << "Error reading cache header entry. (entry_index=" << mNumEntries << ")" << LL_ENDL; delete entry ; entry = NULL ; break ; @@ -502,7 +1295,7 @@ void LLVOCache::readCacheHeader() //for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ; success && iter != mHeaderEntryQueue.end(); ++iter) //{ // getObjectCacheFilename((*iter)->mHandle, name) ; - // llinfos << name << llendl ; + // LL_INFOS() << name << LL_ENDL ; //} //----------- } @@ -527,13 +1320,13 @@ void LLVOCache::writeCacheHeader() { if (!mEnabled) { - llwarns << "Not writing cache header: Cache is currently disabled." << llendl; + LL_WARNS() << "Not writing cache header: Cache is currently disabled." << LL_ENDL; return; } if(mReadOnly) { - llwarns << "Not writing cache header: Cache is currently in read-only mode." << llendl; + LL_WARNS() << "Not writing cache header: Cache is currently in read-only mode." << LL_ENDL; return; } @@ -587,7 +1380,7 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca { if(!mEnabled) { - llwarns << "Not reading cache for handle " << handle << "): Cache is currently disabled." << llendl; + LL_WARNS() << "Not reading cache for handle " << handle << "): Cache is currently disabled." << LL_ENDL; return ; } llassert_always(mInitialized); @@ -595,7 +1388,7 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ; if(iter == mHandleEntryMap.end()) //no cache { - llwarns << "No handle map entry for " << handle << llendl; + LL_WARNS() << "No handle map entry for " << handle << LL_ENDL; return ; } @@ -612,7 +1405,7 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca { if(cache_id != id) { - llinfos << "Cache ID doesn't match for this region, discarding"<< llendl; + LL_INFOS() << "Cache ID doesn't match for this region, discarding"<< LL_ENDL; success = false ; } @@ -623,13 +1416,12 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca if(success) { - for (S32 i = 0; i < num_entries; i++) + for (S32 i = 0; i < num_entries && apr_file.eof() != APR_EOF; i++) { - LLVOCacheEntry* entry = new LLVOCacheEntry(&apr_file); + LLPointer<LLVOCacheEntry> entry = new LLVOCacheEntry(&apr_file); if (!entry->getLocalID()) { - llwarns << "Aborting cache file load for " << filename << ", cache file corruption!" << llendl; - delete entry ; + LL_WARNS() << "Aborting cache file load for " << filename << ", cache file corruption!" << LL_ENDL; success = false ; break ; } @@ -665,18 +1457,18 @@ void LLVOCache::purgeEntries(U32 size) mNumEntries = mHandleEntryMap.size() ; } -void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache) +void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled) { if(!mEnabled) { - llwarns << "Not writing cache for handle " << handle << "): Cache is currently disabled." << llendl; + LL_WARNS() << "Not writing cache for handle " << handle << "): Cache is currently disabled." << LL_ENDL; return ; } llassert_always(mInitialized); if(mReadOnly) { - llwarns << "Not writing cache for handle " << handle << "): Cache is currently in read-only mode." << llendl; + LL_WARNS() << "Not writing cache for handle " << handle << "): Cache is currently in read-only mode." << LL_ENDL; return ; } @@ -711,13 +1503,13 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: //update cache header if(!updateEntry(entry)) { - llwarns << "Failed to update cache header index " << entry->mIndex << ". handle = " << handle << llendl; + LL_WARNS() << "Failed to update cache header index " << entry->mIndex << ". handle = " << handle << LL_ENDL; return ; //update failed. } if(!dirty_cache) { - llwarns << "Skipping write to cache for handle " << handle << ": cache not dirty" << llendl; + LL_WARNS() << "Skipping write to cache for handle " << handle << ": cache not dirty" << LL_ENDL; return ; //nothing changed, no need to update. } @@ -738,7 +1530,14 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: for (LLVOCacheEntry::vocache_entry_map_t::const_iterator iter = cache_entry_map.begin(); success && iter != cache_entry_map.end(); ++iter) { - success = iter->second->writeToFile(&apr_file) ; + if(!removal_enabled || iter->second->isValid()) + { + success = iter->second->writeToFile(&apr_file) ; + if(!success) + { + break; + } + } } } } @@ -746,7 +1545,6 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: if(!success) { removeEntry(entry) ; - } return ; diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 14e3b4c79355a94b23827c9b29be224c13a085e7..082f5f0b1d684ebf8bddf7c070b529ca4594031a 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -29,51 +29,199 @@ #include "lluuid.h" #include "lldatapacker.h" -#include "lldlinked.h" #include "lldir.h" - +#include "llvieweroctree.h" +#include "llapr.h" //--------------------------------------------------------------------------- // Cache entries -class LLVOCacheEntry; +class LLCamera; -class LLVOCacheEntry +class LLVOCacheEntry +: public LLViewerOctreeEntryData, + public LLTrace::MemTrackable<LLVOCacheEntry, 16> { +public: + enum + { + //low 16-bit state + INACTIVE = 0x00000000, //not visible + IN_QUEUE = 0x00000001, //in visible queue, object to be created + WAITING = 0x00000002, //object creation request sent + ACTIVE = 0x00000004, //object created, and in rendering pipeline. + + //high 16-bit state + IN_VO_TREE = 0x00010000, //the entry is in the object cache tree. + + LOW_BITS = 0x0000ffff, + HIGH_BITS = 0xffff0000 + }; + + struct CompareVOCacheEntry + { + bool operator()(const LLVOCacheEntry* const& lhs, const LLVOCacheEntry* const& rhs) + { + F32 lpa = lhs->getSceneContribution(); + F32 rpa = rhs->getSceneContribution(); + + //larger pixel area first + if(lpa > rpa) + { + return true; + } + else if(lpa < rpa) + { + return false; + } + else + { + return lhs < rhs; + } + } + }; +protected: + ~LLVOCacheEntry(); public: LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp); LLVOCacheEntry(LLAPRFile* apr_file); - LLVOCacheEntry(); - ~LLVOCacheEntry(); + LLVOCacheEntry(); + + void updateEntry(U32 crc, LLDataPackerBinaryBuffer &dp); + + void clearState(U32 state) {mState &= ~state;} + bool hasState(U32 state) {return mState & state;} + void setState(U32 state); + bool isState(U32 state) {return (mState & LOW_BITS) == state;} + U32 getState() const {return mState & LOW_BITS;} + + bool isAnyVisible(const LLVector4a& camera_origin, const LLVector4a& local_camera_origin, F32 dist_threshold); U32 getLocalID() const { return mLocalID; } U32 getCRC() const { return mCRC; } S32 getHitCount() const { return mHitCount; } S32 getCRCChangeCount() const { return mCRCChangeCount; } + + void calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 dist_threshold); + void setSceneContribution(F32 scene_contrib) {mSceneContrib = scene_contrib;} + F32 getSceneContribution() const { return mSceneContrib;} void dump() const; BOOL writeToFile(LLAPRFile* apr_file) const; - void assignCRC(U32 crc, LLDataPackerBinaryBuffer &dp); - LLDataPackerBinaryBuffer *getDP(U32 crc); + LLDataPackerBinaryBuffer *getDP(); void recordHit(); void recordDupe() { mDupeCount++; } + + /*virtual*/ void setOctreeEntry(LLViewerOctreeEntry* entry); + + void setParentID(U32 id); + U32 getParentID() const {return mParentID;} + bool isChild() const {return mParentID > 0;} + + void addChild(LLVOCacheEntry* entry); + void removeChild(LLVOCacheEntry* entry); + void removeAllChildren(); + LLVOCacheEntry* getChild(); //remove the first child, and return it. + S32 getNumOfChildren() const {return mChildrenList.size();} + + void setBoundingInfo(const LLVector3& pos, const LLVector3& scale); //called from processing object update message + void updateParentBoundingInfo(); + void saveBoundingSphere(); + + void setValid(BOOL valid = TRUE) {mValid = valid;} + BOOL isValid() const {return mValid;} + + void setUpdateFlags(U32 flags) {mUpdateFlags = flags;} + U32 getUpdateFlags() const {return mUpdateFlags;} + + static void updateDebugSettings(); + static F32 getSquaredPixelThreshold(bool is_front); + +private: + void updateParentBoundingInfo(const LLVOCacheEntry* child); public: - typedef std::map<U32, LLVOCacheEntry*> vocache_entry_map_t; + typedef std::map<U32, LLPointer<LLVOCacheEntry> > vocache_entry_map_t; + typedef std::set<LLVOCacheEntry*> vocache_entry_set_t; + typedef std::set<LLVOCacheEntry*, CompareVOCacheEntry> vocache_entry_priority_list_t; + S32 mLastCameraUpdated; protected: U32 mLocalID; + U32 mParentID; U32 mCRC; + U32 mUpdateFlags; //receive from sim S32 mHitCount; S32 mDupeCount; S32 mCRCChangeCount; LLDataPackerBinaryBuffer mDP; U8 *mBuffer; + + F32 mSceneContrib; //projected scene contributuion of this object. + U32 mState; //high 16 bits reserved for special use. + vocache_entry_set_t mChildrenList; //children entries in a linked set. + + BOOL mValid; //if set, this entry is valid, otherwise it is invalid and will be removed. + + LLVector4a mBSphereCenter; //bounding sphere center + F32 mBSphereRadius; //bounding sphere radius + +public: + static U32 sMinFrameRange; + static F32 sNearRadius; + static F32 sRearFarRadius; + static F32 sFrontPixelThreshold; + static F32 sRearPixelThreshold; +}; + +class LLVOCacheGroup : public LLOcclusionCullingGroup +{ +public: + LLVOCacheGroup(OctreeNode* node, LLViewerOctreePartition* part) : LLOcclusionCullingGroup(node, part){} + + //virtual + void handleChildAddition(const OctreeNode* parent, OctreeNode* child); + +protected: + virtual ~LLVOCacheGroup(); +}; + +class LLVOCachePartition : public LLViewerOctreePartition, public LLTrace::MemTrackable<LLVOCachePartition> +{ +public: + LLVOCachePartition(LLViewerRegion* regionp); + + bool addEntry(LLViewerOctreeEntry* entry); + void removeEntry(LLViewerOctreeEntry* entry); + /*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion); + void addOccluders(LLViewerOctreeGroup* gp); + void resetOccluders(); + void processOccluders(LLCamera* camera); + void removeOccluder(LLVOCacheGroup* group); + + void setCullHistory(BOOL has_new_object); + + bool isFrontCull() const {return mFrontCull;} + +private: + void selectBackObjects(LLCamera &camera, F32 projection_area_cutoff, bool use_occlusion); //select objects behind camera. + +public: + static BOOL sNeedsOcclusionCheck; + +private: + BOOL mFrontCull; //the view frustum cull if set, otherwise is back sphere cull. + U32 mCullHistory; + U32 mCulledTime[LLViewerCamera::NUM_CAMERAS]; + std::set<LLVOCacheGroup*> mOccludedGroups; + + S32 mBackSlectionEnabled; //enable to select back objects if > 0. + U32 mIdleHash; }; // //Note: LLVOCache is not thread-safe // -class LLVOCache +class LLVOCache : public LLSingleton<LLVOCache> { private: struct HeaderEntryInfo @@ -106,19 +254,20 @@ class LLVOCache typedef std::set<HeaderEntryInfo*, header_entry_less> header_entry_queue_t; typedef std::map<U64, HeaderEntryInfo*> handle_entry_map_t; private: + friend class LLSingleton<LLVOCache>; LLVOCache() ; public: ~LLVOCache() ; void initCache(ELLPath location, U32 size, U32 cache_version) ; - void removeCache(ELLPath location) ; + void removeCache(ELLPath location, bool started = false) ; void readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) ; - void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache) ; + void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled); void removeEntry(U64 handle) ; - void setReadOnly(BOOL read_only) {mReadOnly = read_only;} + void setReadOnly(bool read_only) {mReadOnly = read_only;} private: void setDirNames(ELLPath location); @@ -134,9 +283,9 @@ class LLVOCache BOOL updateEntry(const HeaderEntryInfo* entry); private: - BOOL mEnabled; - BOOL mInitialized ; - BOOL mReadOnly ; + bool mEnabled; + bool mInitialized ; + bool mReadOnly ; HeaderMetaInfo mMetaInfo; U32 mCacheSize; U32 mNumEntries; @@ -145,12 +294,6 @@ class LLVOCache LLVolatileAPRPool* mLocalAPRFilePoolp ; header_entry_queue_t mHeaderEntryQueue; handle_entry_map_t mHandleEntryMap; - - static LLVOCache* sInstance ; -public: - static LLVOCache* getInstance() ; - static BOOL hasInstance() ; - static void destroyClass() ; }; #endif diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 600b44d371e96e2fec13576bf1f04a0e3cdc303f..b79a48012a83dc21fbc93dc280d193608e8043d7 100755 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -28,7 +28,6 @@ #include "llvograss.h" -#include "imageids.h" #include "llviewercontrol.h" #include "llagentcamera.h" @@ -98,7 +97,7 @@ void LLVOGrass::updateSpecies() if (!sSpeciesTable.count(mSpecies)) { - llinfos << "Unknown grass type, substituting grass type." << llendl; + LL_INFOS() << "Unknown grass type, substituting grass type." << LL_ENDL; SpeciesMap::const_iterator it = sSpeciesTable.begin(); mSpecies = (*it).first; } @@ -120,7 +119,7 @@ void LLVOGrass::initClass() if (!grass_def_grass.parseFile(xml_filename)) { - llerrs << "Failed to parse grass file." << llendl; + LL_ERRS() << "Failed to parse grass file." << LL_ENDL; return; } @@ -132,7 +131,7 @@ void LLVOGrass::initClass() { if (!grass_def->hasName("grass")) { - llwarns << "Invalid grass definition node " << grass_def->getName() << llendl; + LL_WARNS() << "Invalid grass definition node " << grass_def->getName() << LL_ENDL; continue; } F32 F32_val; @@ -144,13 +143,13 @@ void LLVOGrass::initClass() static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id"); if (!grass_def->getFastAttributeS32(species_id_string, species)) { - llwarns << "No species id defined" << llendl; + LL_WARNS() << "No species id defined" << LL_ENDL; continue; } if (species < 0) { - llwarns << "Invalid species id " << species << llendl; + LL_WARNS() << "Invalid species id " << species << LL_ENDL; continue; } @@ -171,7 +170,7 @@ void LLVOGrass::initClass() if (sSpeciesTable.count(species)) { - llinfos << "Grass species " << species << " already defined! Duplicate discarded." << llendl; + LL_INFOS() << "Grass species " << species << " already defined! Duplicate discarded." << LL_ENDL; delete newGrass; continue; } @@ -187,7 +186,7 @@ void LLVOGrass::initClass() std::string name; static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); grass_def->getFastAttributeString(name_string, name); - llwarns << "Incomplete definition of grass " << name << llendl; + LL_WARNS() << "Incomplete definition of grass " << name << LL_ENDL; } } @@ -259,7 +258,7 @@ U32 LLVOGrass::processUpdateMessage(LLMessageSystem *mesgsys, ||(getAcceleration().lengthSquared() > 0.f) ||(getAngularVelocity().lengthSquared() > 0.f)) { - llinfos << "ACK! Moving grass!" << llendl; + LL_INFOS() << "ACK! Moving grass!" << LL_ENDL; setVelocity(LLVector3::zero); setAcceleration(LLVector3::zero); setAngularVelocity(LLVector3::zero); @@ -414,11 +413,11 @@ LLDrawable* LLVOGrass::createDrawable(LLPipeline *pipeline) return mDrawable; } -static LLFastTimer::DeclareTimer FTM_UPDATE_GRASS("Update Grass"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_GRASS("Update Grass"); BOOL LLVOGrass::updateGeometry(LLDrawable *drawable) { - LLFastTimer ftm(FTM_UPDATE_GRASS); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_GRASS); dirtySpatialGroup(); @@ -446,7 +445,7 @@ void LLVOGrass::plantBlades() // This is bad, but not the end of the world. if (!sSpeciesTable.count(mSpecies)) { - llinfos << "Unknown grass species " << mSpecies << llendl; + LL_INFOS() << "Unknown grass species " << mSpecies << LL_ENDL; return; } @@ -605,8 +604,8 @@ U32 LLVOGrass::getPartitionType() const return LLViewerRegion::PARTITION_GRASS; } -LLGrassPartition::LLGrassPartition() -: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW_ARB) +LLGrassPartition::LLGrassPartition(LLViewerRegion* regionp) +: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW_ARB, regionp) { mDrawableType = LLPipeline::RENDER_TYPE_GRASS; mPartitionType = LLViewerRegion::PARTITION_GRASS; @@ -626,9 +625,9 @@ void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count LLViewerCamera* camera = LLViewerCamera::getInstance(); for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { - LLDrawable* drawablep = *i; + LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable(); - if (drawablep->isDead()) + if (!drawablep || drawablep->isDead()) { continue; } @@ -673,11 +672,11 @@ void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count } } -static LLFastTimer::DeclareTimer FTM_REBUILD_GRASS_VB("Grass VB"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_GRASS_VB("Grass VB"); void LLGrassPartition::getGeometry(LLSpatialGroup* group) { - LLFastTimer ftm(FTM_REBUILD_GRASS_VB); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_GRASS_VB); std::sort(mFaceList.begin(), mFaceList.end(), LLFace::CompareDistanceGreater()); @@ -744,8 +743,10 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group) LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(), //facep->getTexture(), buffer, fullbright); - info->mExtents[0] = group->mObjectExtents[0]; - info->mExtents[1] = group->mObjectExtents[1]; + + const LLVector4a* exts = group->getObjectExtents(); + info->mExtents[0] = exts[0]; + info->mExtents[1] = exts[1]; info->mVSize = vsize; draw_vec.push_back(info); //for alpha sorting diff --git a/indra/newview/llvograss.h b/indra/newview/llvograss.h index ff4fa6b00d3c4565aa2745c00dd39a7bd2fd47cb..71d358362d6620d28d6ee3c667e27e16750d40de 100755 --- a/indra/newview/llvograss.h +++ b/indra/newview/llvograss.h @@ -28,7 +28,6 @@ #define LL_LLVOGRASS_H #include "llviewerobject.h" -#include "lldarray.h" #include <map> class LLSurfacePatch; diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index ac2a34ba1e90fdc399a0fd9278a394db58ca2c58..312842a70ffd86921a16a654ddf803ef4468b95f 100755 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -28,12 +28,14 @@ #include "llagent.h" #include "llfloaterreg.h" +#include "llhttpclient.h" #include "llimview.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llpanel.h" #include "llrecentpeople.h" #include "llviewercontrol.h" +#include "llviewerregion.h" #include "llvoicechannel.h" diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index e17da9cecd0bc3c5be81794a53bea7ef3ec05cf8..1e20a814a01d981263178735c74666677bd282f7 100755 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -34,7 +34,6 @@ class LLVOAvatar; #include "lliosocket.h" #include "v3math.h" #include "llframetimer.h" -#include "llviewerregion.h" #include "llcallingcard.h" // for LLFriendObserver #include "llsecapi.h" #include "llcontrol.h" diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 9281334d813146ad4e1738084fc27e65385e1d1a..23a8a61b8526cc2e537a581d8a5980bf3ab35e5d 100755 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -310,7 +310,7 @@ void LLVoiceVisualizer::lipSyncOohAah( F32& ooh, F32& aah ) aah = transfer_aah * sAah[elapsed_aahs]; /* - llinfos << " elapsed frames " << elapsed_frames + LL_INFOS() << " elapsed frames " << elapsed_frames << " ooh " << ooh << " aah " << aah << " transfer ooh" << transfer_ooh @@ -320,7 +320,7 @@ void LLVoiceVisualizer::lipSyncOohAah( F32& ooh, F32& aah ) << " elapsed time " << elapsed_time << " elapsed oohs " << elapsed_oohs << " elapsed aahs " << elapsed_aahs - << llendl; + << LL_ENDL; */ } else @@ -590,7 +590,7 @@ void LLVoiceVisualizer::unpackData(LLMessageSystem *mesgsys, S32 blocknum) S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData); if (size != 1) { - llwarns << "Voice effect with bad size " << size << llendl; + LL_WARNS() << "Voice effect with bad size " << size << LL_ENDL; return; } mesgsys->getBinaryDataFast(_PREHASH_Effect, _PREHASH_TypeData, packed_data, 1, blocknum); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 050d9dd7858ebbcf7edde2efcba339e3f55b6432..09a2003ef871e0c62fd1358c5d94e97d13d57ebd 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -1343,7 +1343,7 @@ void LLVivoxVoiceClient::stateMachine() { // Notify observers to let them know there is problem with voice notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED); - llwarns << "There seems to be problem with connection to voice server. Disabling voice chat abilities." << llendl; + LL_WARNS() << "There seems to be problem with connection to voice server. Disabling voice chat abilities." << LL_ENDL; } // Increase mSpatialJoiningNum only for spatial sessions- it's normal to reach this case for @@ -5824,8 +5824,8 @@ void LLVivoxVoiceClient::expireVoiceFonts() // Give a warning notification if any voice fonts are due to expire. if (will_expire) { - S32 seconds = gSavedSettings.getS32("VoiceEffectExpiryWarningTime"); - args["INTERVAL"] = llformat("%d", seconds / SEC_PER_DAY); + S32Seconds seconds(gSavedSettings.getS32("VoiceEffectExpiryWarningTime")); + args["INTERVAL"] = llformat("%d", LLUnit<S32, LLUnits::Days>(seconds).value()); LLNotificationsUtil::add("VoiceEffectsWillExpire", args); } @@ -6318,7 +6318,7 @@ LLVivoxProtocolParser::~LLVivoxProtocolParser() XML_ParserFree(parser); } -static LLFastTimer::DeclareTimer FTM_VIVOX_PROCESS("Vivox Process"); +static LLTrace::BlockTimerStatHandle FTM_VIVOX_PROCESS("Vivox Process"); // virtual LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( @@ -6328,7 +6328,7 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl( LLSD& context, LLPumpIO* pump) { - LLFastTimer t(FTM_VIVOX_PROCESS); + LL_RECORD_BLOCK_TIME(FTM_VIVOX_PROCESS); LLBufferStream istr(channels, buffer.get()); std::ostringstream ostr; while (istr.good()) diff --git a/indra/newview/llvoinventorylistener.h b/indra/newview/llvoinventorylistener.h index bf14d19b019f0aa44b035babcc3c58c730e2135b..c50c475478a66d90e92b1274d92419ddc75714db 100755 --- a/indra/newview/llvoinventorylistener.h +++ b/indra/newview/llvoinventorylistener.h @@ -30,7 +30,9 @@ #ifndef LL_LLVOINVENTORYLISTENER_H #define LL_LLVOINVENTORYLISTENER_H -#include "llviewerobject.h" +#include "llinventory.h" + +class LLViewerObject; class LLVOInventoryListener { diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 54e27ff4c6cf88141e28155019a841a6fd3f95bf..c1593fa5fcfa9f3ce401689d22ea0403506e9467 100755 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -46,7 +46,7 @@ const F32 MAX_PART_LIFETIME = 120.f; -extern U64 gFrameTime; +extern U64MicrosecondsImplicit gFrameTime; LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL; S32 LLVOPartGroup::sVBSlotCursor = 0; @@ -292,10 +292,10 @@ LLVector3 LLVOPartGroup::getCameraPosition() const return gAgentCamera.getCameraPositionAgent(); } -static LLFastTimer::DeclareTimer FTM_UPDATE_PARTICLES("Update Particles"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_PARTICLES("Update Particles"); BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) { - LLFastTimer ftm(FTM_UPDATE_PARTICLES); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_PARTICLES); dirtySpatialGroup(); @@ -405,7 +405,7 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) facep = drawable->getFace(i); if (!facep) { - llwarns << "No face found for index " << i << "!" << llendl; + LL_WARNS() << "No face found for index " << i << "!" << LL_ENDL; continue; } @@ -451,7 +451,7 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) LLFace* facep = drawable->getFace(i); if (!facep) { - llwarns << "No face found for index " << i << "!" << llendl; + LL_WARNS() << "No face found for index " << i << "!" << LL_ENDL; continue; } facep->setTEOffset(i); @@ -722,8 +722,8 @@ U32 LLVOPartGroup::getPartitionType() const return LLViewerRegion::PARTITION_PARTICLE; } -LLParticlePartition::LLParticlePartition() -: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW_ARB) +LLParticlePartition::LLParticlePartition(LLViewerRegion* regionp) +: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW_ARB, regionp) { mRenderPass = LLRenderPass::PASS_ALPHA; mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES; @@ -732,18 +732,18 @@ LLParticlePartition::LLParticlePartition() mLODPeriod = 1; } -LLHUDParticlePartition::LLHUDParticlePartition() : - LLParticlePartition() +LLHUDParticlePartition::LLHUDParticlePartition(LLViewerRegion* regionp) : + LLParticlePartition(regionp) { mDrawableType = LLPipeline::RENDER_TYPE_HUD_PARTICLES; mPartitionType = LLViewerRegion::PARTITION_HUD_PARTICLE; } -static LLFastTimer::DeclareTimer FTM_REBUILD_PARTICLE_VBO("Particle VBO"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_PARTICLE_VBO("Particle VBO"); void LLParticlePartition::rebuildGeom(LLSpatialGroup* group) { - if (group->isDead() || !group->isState(LLSpatialGroup::GEOM_DIRTY)) + if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY)) { return; } @@ -754,7 +754,7 @@ void LLParticlePartition::rebuildGeom(LLSpatialGroup* group) group->mLastUpdateViewAngle = group->mViewAngle; } - LLFastTimer ftm(FTM_REBUILD_PARTICLE_VBO); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_PARTICLE_VBO); group->clearDrawMap(); @@ -791,9 +791,9 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co LLViewerCamera* camera = LLViewerCamera::getInstance(); for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { - LLDrawable* drawablep = *i; + LLDrawable* drawablep = (LLDrawable*)(*i)->getDrawable(); - if (drawablep->isDead()) + if (!drawablep || drawablep->isDead()) { continue; } @@ -828,11 +828,11 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co } -static LLFastTimer::DeclareTimer FTM_REBUILD_PARTICLE_GEOM("Particle Geom"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_PARTICLE_GEOM("Particle Geom"); void LLParticlePartition::getGeometry(LLSpatialGroup* group) { - LLFastTimer ftm(FTM_REBUILD_PARTICLE_GEOM); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_PARTICLE_GEOM); std::sort(mFaceList.begin(), mFaceList.end(), LLFace::CompareDistanceGreater()); @@ -958,8 +958,10 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group) LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(), //facep->getTexture(), buffer, fullbright); - info->mExtents[0] = group->mObjectExtents[0]; - info->mExtents[1] = group->mObjectExtents[1]; + + const LLVector4a* exts = group->getObjectExtents(); + info->mExtents[0] = exts[0]; + info->mExtents[1] = exts[1]; info->mVSize = vsize; info->mBlendFuncDst = bf_dst; info->mBlendFuncSrc = bf_src; diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 93f0e50336e90e0da161eb85f4a3411502cfd567..07c2f0d44d0c7cd8e2d9719794bf5e54ca343e6b 100755 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -28,11 +28,9 @@ #include "llvosky.h" -#include "imageids.h" #include "llfeaturemanager.h" #include "llviewercontrol.h" #include "llframetimer.h" -#include "timing.h" #include "llagent.h" #include "llagentcamera.h" @@ -1245,7 +1243,7 @@ void LLVOSky::createDummyVertexBuffer() } } -static LLFastTimer::DeclareTimer FTM_RENDER_FAKE_VBO_UPDATE("Fake VBO Update"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_FAKE_VBO_UPDATE("Fake VBO Update"); void LLVOSky::updateDummyVertexBuffer() { @@ -1258,7 +1256,7 @@ void LLVOSky::updateDummyVertexBuffer() return ; } - LLFastTimer t(FTM_RENDER_FAKE_VBO_UPDATE) ; + LL_RECORD_BLOCK_TIME(FTM_RENDER_FAKE_VBO_UPDATE) ; if(!mFace[FACE_DUMMY] || !mFace[FACE_DUMMY]->getVertexBuffer()) createDummyVertexBuffer() ; @@ -1271,11 +1269,11 @@ void LLVOSky::updateDummyVertexBuffer() //---------------------------------- //end of fake vertex buffer updating //---------------------------------- -static LLFastTimer::DeclareTimer FTM_GEO_SKY("Sky Geometry"); +static LLTrace::BlockTimerStatHandle FTM_GEO_SKY("Sky Geometry"); BOOL LLVOSky::updateGeometry(LLDrawable *drawable) { - LLFastTimer ftm(FTM_GEO_SKY); + LL_RECORD_BLOCK_TIME(FTM_GEO_SKY); if (mFace[FACE_REFLECTION] == NULL) { LLDrawPoolWater *poolp = (LLDrawPoolWater*) gPipeline.getPool(LLDrawPool::POOL_WATER); @@ -2146,7 +2144,7 @@ void LLVOSky::updateFog(const F32 distance) // get the water param manager variables float water_fog_density = LLWaterParamManager::getInstance()->getFogDensity(); - LLColor4 water_fog_color = LLDrawPoolWater::sWaterFogColor.mV; + LLColor4 water_fog_color(LLDrawPoolWater::sWaterFogColor.mV); // adjust the color based on depth. We're doing linear approximations float depth_scale = gSavedSettings.getF32("WaterGLFogDepthScale"); diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index 9a5c5831ca9d1e1358c709ea89fcdf71f3ec14ef..79e1921f1bde8189350c098c66ccb49b9a6cc544 100755 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -72,7 +72,7 @@ class LLVertexBufferTerrain : public LLVertexBuffer if ((data_mask & type_mask) != data_mask) { - llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl; + LL_ERRS() << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << LL_ENDL; } if (data_mask & MAP_NORMAL) @@ -212,7 +212,7 @@ LLDrawable *LLVOSurfacePatch::createDrawable(LLPipeline *pipeline) return mDrawable; } -static LLFastTimer::DeclareTimer FTM_UPDATE_TERRAIN("Update Terrain"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_TERRAIN("Update Terrain"); void LLVOSurfacePatch::updateGL() { @@ -224,7 +224,7 @@ void LLVOSurfacePatch::updateGL() BOOL LLVOSurfacePatch::updateGeometry(LLDrawable *drawable) { - LLFastTimer ftm(FTM_UPDATE_TERRAIN); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_TERRAIN); dirtySpatialGroup(TRUE); @@ -291,7 +291,7 @@ void LLVOSurfacePatch::updateFaceSize(S32 idx) { if (idx != 0) { - llwarns << "Terrain partition requested invalid face!!!" << llendl; + LL_WARNS() << "Terrain partition requested invalid face!!!" << LL_ENDL; return; } @@ -1056,8 +1056,8 @@ U32 LLVOSurfacePatch::getPartitionType() const return LLViewerRegion::PARTITION_TERRAIN; } -LLTerrainPartition::LLTerrainPartition() -: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, GL_DYNAMIC_DRAW_ARB) +LLTerrainPartition::LLTerrainPartition(LLViewerRegion* regionp) +: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, GL_DYNAMIC_DRAW_ARB, regionp) { mOcclusionEnabled = FALSE; mInfiniteFarClip = TRUE; @@ -1070,10 +1070,10 @@ LLVertexBuffer* LLTerrainPartition::createVertexBuffer(U32 type_mask, U32 usage) return new LLVertexBufferTerrain(); } -static LLFastTimer::DeclareTimer FTM_REBUILD_TERRAIN_VB("Terrain VB"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_TERRAIN_VB("Terrain VB"); void LLTerrainPartition::getGeometry(LLSpatialGroup* group) { - LLFastTimer ftm(FTM_REBUILD_TERRAIN_VB); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_TERRAIN_VB); LLVertexBuffer* buffer = group->mVertexBuffer; diff --git a/indra/newview/llvosurfacepatch.h b/indra/newview/llvosurfacepatch.h index 7b53219be85f085e353611524ccec7c04a9a18cb..3383b16dd9488320d5a0fc50f46e59e72e20262b 100755 --- a/indra/newview/llvosurfacepatch.h +++ b/indra/newview/llvosurfacepatch.h @@ -33,6 +33,8 @@ class LLSurfacePatch; class LLDrawPool; class LLVector2; +class LLFacePool; +class LLFace; class LLVOSurfacePatch : public LLStaticViewerObject { diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index b82c4fe76989a026ab6cc949941f08f870ac4c37..66c0ace79d731f16be341f288238ff1f52b777d3 100755 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -112,7 +112,7 @@ void LLVOTree::initClass() if (!tree_def_tree.parseFile(xml_filename)) { - llerrs << "Failed to parse tree file." << llendl; + LL_ERRS() << "Failed to parse tree file." << LL_ENDL; } LLXmlTreeNode* rootp = tree_def_tree.getRoot(); @@ -123,7 +123,7 @@ void LLVOTree::initClass() { if (!tree_def->hasName("tree")) { - llwarns << "Invalid tree definition node " << tree_def->getName() << llendl; + LL_WARNS() << "Invalid tree definition node " << tree_def->getName() << LL_ENDL; continue; } F32 F32_val; @@ -138,19 +138,19 @@ void LLVOTree::initClass() static LLStdStringHandle species_id_string = LLXmlTree::addAttributeString("species_id"); if (!tree_def->getFastAttributeS32(species_id_string, species)) { - llwarns << "No species id defined" << llendl; + LL_WARNS() << "No species id defined" << LL_ENDL; continue; } if (species < 0) { - llwarns << "Invalid species id " << species << llendl; + LL_WARNS() << "Invalid species id " << species << LL_ENDL; continue; } if (sSpeciesTable.count(species)) { - llwarns << "Tree species " << species << " already defined! Duplicate discarded." << llendl; + LL_WARNS() << "Tree species " << species << " already defined! Duplicate discarded." << LL_ENDL; continue; } @@ -241,7 +241,7 @@ void LLVOTree::initClass() std::string name; static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name"); tree_def->getFastAttributeString(name_string, name); - llwarns << "Incomplete definition of tree " << name << llendl; + LL_WARNS() << "Incomplete definition of tree " << name << LL_ENDL; } } @@ -284,7 +284,7 @@ U32 LLVOTree::processUpdateMessage(LLMessageSystem *mesgsys, ||(getAcceleration().lengthSquared() > 0.f) ||(getAngularVelocity().lengthSquared() > 0.f)) { - llinfos << "ACK! Moving tree!" << llendl; + LL_INFOS() << "ACK! Moving tree!" << LL_ENDL; setVelocity(LLVector3::zero); setAcceleration(LLVector3::zero); setAngularVelocity(LLVector3::zero); @@ -480,11 +480,11 @@ LLDrawable* LLVOTree::createDrawable(LLPipeline *pipeline) const S32 LEAF_INDICES = 24; const S32 LEAF_VERTICES = 16; -static LLFastTimer::DeclareTimer FTM_UPDATE_TREE("Update Tree"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_TREE("Update Tree"); BOOL LLVOTree::updateGeometry(LLDrawable *drawable) { - LLFastTimer ftm(FTM_UPDATE_TREE); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_TREE); if(mTrunkLOD >= sMAX_NUM_TREE_LOD_LEVELS) //do not display the tree. { @@ -698,8 +698,8 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) slices = sLODSlices[lod]; F32 base_radius = 0.65f; F32 top_radius = base_radius * sSpeciesTable[mSpecies]->mTaper; - //llinfos << "Species " << ((U32) mSpecies) << ", taper = " << sSpeciesTable[mSpecies].mTaper << llendl; - //llinfos << "Droop " << mDroop << ", branchlength: " << mBranchLength << llendl; + //LL_INFOS() << "Species " << ((U32) mSpecies) << ", taper = " << sSpeciesTable[mSpecies].mTaper << LL_ENDL; + //LL_INFOS() << "Droop " << mDroop << ", branchlength: " << mBranchLength << LL_ENDL; F32 angle = 0; F32 angle_inc = 360.f/(slices-1); F32 z = 0.f; @@ -1168,8 +1168,8 @@ U32 LLVOTree::getPartitionType() const return LLViewerRegion::PARTITION_TREE; } -LLTreePartition::LLTreePartition() -: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW_ARB) +LLTreePartition::LLTreePartition(LLViewerRegion* regionp) +: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW_ARB, regionp) { mDrawableType = LLPipeline::RENDER_TYPE_TREE; mPartitionType = LLViewerRegion::PARTITION_TREE; diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h index 6137ae412d9341199cce99908dc30c355d2ca46f..c862de823051744272648ab08daa73a4e0237a46 100755 --- a/indra/newview/llvotree.h +++ b/indra/newview/llvotree.h @@ -28,7 +28,6 @@ #define LL_LLVOTREE_H #include "llviewerobject.h" -#include "lldarray.h" #include "xform.h" class LLFace; diff --git a/indra/newview/llvotreenew.h b/indra/newview/llvotreenew.h deleted file mode 100755 index 0bb07008caa8c4fcae1f0ae25b5c9e9c00d122d8..0000000000000000000000000000000000000000 --- a/indra/newview/llvotreenew.h +++ /dev/null @@ -1,218 +0,0 @@ -/** - * @file llvotreenew.h - * @brief LLVOTreeNew class header file - * - * $LicenseInfo:firstyear=2003&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLVOTREENEW_H -#define LL_LLVOTREENEW_H - -#include "llviewerobject.h" -#include "lldarray.h" -#include "xform.h" - -#include "lltreeparams.h" -#include "llstrider.h" -#include "v2math.h" -#include "v3math.h" -#include "llviewertexture.h" - -class LLFace; -class LLDrawPool; - -// number of static arrays created -const U8 MAX_SPECIES = 16; // max species of trees -const U8 MAX_PARTS = 15; // trunk, 2 or 3 branches per species? -const U8 MAX_RES = 6; // max # cross sections for a branch curve -const U8 MAX_FLARE = 6; // max # cross sections for flare of trunk -const U8 MAX_LEVELS = 3; - -// initial vertex array allocations -const U32 NUM_INIT_VERTS = 5000; // number of vertices/normals/texcoords -const U32 NUM_INIT_INDICES = 15000; // number of indices to vert array (3 vertices per triangle, roughly 3x) -const U32 NUM_TIMES_TO_DOUBLE = 2; // if we go over initial allocations, num times to double each step - -// for finding the closest parts... - -// the parts are searched based on: -const F32 MAX_LOBES_DIFF = 2; -const F32 MAX_LOBEDEPTH_DIFF = .3f; -const F32 MAX_CURVEBACK_DIFF = 20.0f; -const F32 MAX_CURVE_DIFF = 15.0f; -const F32 MAX_CURVE_V_DIFF = 20.0f; - -const F32 CURVEV_DIVIDER = 10.0f; // curveV/CURVEV_DIVIDER = # branch variances... -const U8 MAX_VARS = 3; // max number of variations of branches - -const U8 MAX_RAND_NUMS = 100; // max number of rand numbers to pregenerate and store - -// texture params -const F32 WIDTH_OF_BARK = .48f; - -class LLVOTreeNew : public LLViewerObject -{ -public: - - // Some random number generators using the pre-generated random numbers - // return +- negPos - static S32 llrand_signed(S32 negPos) - { - return (ll_rand((U32)negPos * 2) - negPos); - }; - - static S32 llrand_signed(S32 negPos, U32 index) - { - return lltrunc((sRandNums[index % MAX_RAND_NUMS] * (negPos * 2.0f) - negPos)); - }; - - static S32 llrand_unsigned(S32 pos, U32 index) - { - return lltrunc((sRandNums[index % MAX_RAND_NUMS] * pos)); - }; - - // return +- negPos - static F32 llfrand_signed(F32 negPos) - { - return (ll_frand(negPos * 2.0f) - negPos); - }; - - static F32 llfrand_signed(F32 negPos, U32 index) - { - return (sRandNums[index % MAX_RAND_NUMS] * negPos * 2.0f) - negPos; - }; - - static F32 llfrand_unsigned(F32 pos, U32 index) - { - return sRandNums[index % MAX_RAND_NUMS] * pos; - }; - - // return between 0-pos - static F32 llfrand_unsigned(F32 pos) - { - return ll_frand(pos); - }; - - static void cleanupTextures() {}; // not needed anymore - - struct TreePart - { - F32 mRadius; // scale x/y - F32 mLength; // scale z - F32 mCurve; - F32 mCurveV; - F32 mCurveRes; - F32 mCurveBack; - U8 mLobes; - F32 mLobeDepth; - U8 mLevel; - U32 mNumTris; - U8 mVertsPerSection; - U8 mNumVariants; - - // first index into the drawpool arrays for this particular branch - U32 mIndiceIndex[MAX_VARS]; - U32 mOffsets[MAX_VARS][MAX_RES]; // offsets for the partial branch pieces - // local section frames for this branch - LLMatrix4 mFrames[MAX_VARS][(MAX_RES*(MAX_RES + 1))/2]; // (0...n) + (1...n) + ... + (n-1..n) - LLDynamicArray<LLVector3> mFaceNormals; - - }; - - LLVOTreeNew(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); - virtual ~LLVOTreeNew(); - - /*virtual*/ - U32 processUpdateMessage(LLMessageSystem *mesgsys, - void **user_data, - U32 block_num, const EObjectUpdateType update_type, - LLDataPacker *dp); - - /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); - - /*virtual*/ void render(LLAgent &agent); - /*virtual*/ void updateTextures(); - - /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); - - F32 CalcZStep(TreePart *part, U8 section); - - void createPart(U8 level, F32 length, F32 radius, LLStrider<LLVector3> &vertices, LLStrider<LLVector3> &normals, - LLStrider<LLVector2> &tex_coords, U32 *indices, - U32 &curVertexIndex, U32 &curTexCoordIndex, - U32 &curNormalIndex, U32 &curIndiceIndex); - - S32 findSimilarPart(U8 level); - - F32 CalculateSectionRadius(U8 level, F32 y, F32 stemLength, F32 stemRadius); - //F32 CalculateVerticalAttraction(U8 level, LLMatrix4 §ionFrame); - - void createSection(LLMatrix4 &frame, TreePart *part, F32 sectionRadius, F32 stemZ, - LLStrider<LLVector3> &vertices, LLStrider<LLVector2> &tex_coords, U32 *indices, - U32 &curVertexIndex, U32 &curTexCoordIndex, U32 &curIndiceIndex, U8 curSection, BOOL firstBranch); - - void genIndicesAndFaceNormalsForLastSection(TreePart *part, U8 numVerts, LLStrider<LLVector3> &vertices, U32 curVertexIndex, U32 *indices, U32 &curIndiceIndex, BOOL firstBranch); - - void genVertexNormals(TreePart *part, LLStrider<LLVector3> &normals, U8 numSections, U32 curNormalOffset); - - void drawTree(LLDrawPool &draw_pool, const LLMatrix4 &frame, U8 level, F32 offsetChild, F32 curLength, F32 parentLength, F32 curRadius, F32 parentRadius, U8 part, U8 variant, U8 startSection); - void drawTree(LLDrawPool &draw_pool); - - - //LLTreeParams mParams; - U8 mSpecies; - LLPointer<LLViewerTexture> mTreeImagep; - LLMatrix4 mTrunkFlareFrames[MAX_FLARE]; - F32 mSegSplitsError[3]; - U32 mRandOffset[MAX_LEVELS]; - - U32 mNumTrisDrawn; - U32 mTotalIndices; - U32 mTotalVerts; - - static void initClass(); - - // tree params - static LLTreeParams sParameters; - - // next indexes used to drawpool arrays - static U32 sNextVertexIndex[MAX_SPECIES]; - static U32 sNextIndiceIndex[MAX_SPECIES]; - - // tree parts - static U32 sNextPartIndex[MAX_PARTS]; - static TreePart sTreeParts[MAX_SPECIES][MAX_PARTS]; - - // species images - static LLUUID sTreeImageIDs[MAX_SPECIES]; - - // random numbers - static F32 sRandNums[MAX_RAND_NUMS]; - - // usage data - static U32 sTreePartsUsed[MAX_SPECIES][MAX_PARTS][MAX_VARS]; - - -}; - -#endif diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c233221e5f33c639147287184b57e93666fe9840..d1108020ff0170af9902002141604a1ea7c142b3 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -47,7 +47,6 @@ #include "message.h" #include "llpluginclassmedia.h" // for code in the mediaEvent handler #include "object_flags.h" -#include "llagentconstants.h" #include "lldrawable.h" #include "lldrawpoolavatar.h" #include "lldrawpoolbump.h" @@ -97,9 +96,9 @@ S32 LLVOVolume::mRenderComplexity_current = 0; LLPointer<LLObjectMediaDataClient> LLVOVolume::sObjectMediaClient = NULL; LLPointer<LLObjectMediaNavigateClient> LLVOVolume::sObjectMediaNavigateClient = NULL; -static LLFastTimer::DeclareTimer FTM_GEN_TRIANGLES("Generate Triangles"); -static LLFastTimer::DeclareTimer FTM_GEN_VOLUME("Generate Volumes"); -static LLFastTimer::DeclareTimer FTM_VOLUME_TEXTURES("Volume Textures"); +static LLTrace::BlockTimerStatHandle FTM_GEN_TRIANGLES("Generate Triangles"); +static LLTrace::BlockTimerStatHandle FTM_GEN_VOLUME("Generate Volumes"); +static LLTrace::BlockTimerStatHandle FTM_VOLUME_TEXTURES("Volume Textures"); extern BOOL gGLDebugLoggingEnabled; @@ -393,8 +392,8 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, BOOL res = LLVolumeMessage::unpackVolumeParams(&volume_params, *dp); if (!res) { - llwarns << "Bogus volume parameters in object " << getID() << llendl; - llwarns << getRegion()->getOriginGlobal() << llendl; + LL_WARNS() << "Bogus volume parameters in object " << getID() << LL_ENDL; + LL_WARNS() << getRegion()->getOriginGlobal() << LL_ENDL; } volume_params.setSculptID(sculpt_id, sculpt_type); @@ -408,14 +407,14 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, { // There's something bogus in the data that we're unpacking. dp->dumpBufferToLog(); - llwarns << "Flushing cache files" << llendl; + LL_WARNS() << "Flushing cache files" << LL_ENDL; - if(LLVOCache::hasInstance() && getRegion()) + if(LLVOCache::instanceExists() && getRegion()) { LLVOCache::getInstance()->removeEntry(getRegion()->getHandle()) ; } - llwarns << "Bogus TE data in " << getID() << llendl; + LL_WARNS() << "Bogus TE data in " << getID() << LL_ENDL; } else { @@ -563,9 +562,9 @@ void LLVOVolume::animateTextures() tex_mat.setIdentity(); LLVector3 trans ; - trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f)); - tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); - + trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f)); + tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f)); + LLVector3 scale(scale_s, scale_t, 1.f); LLQuaternion quat; quat.setQuat(rot, 0, 0, -1.f); @@ -667,7 +666,7 @@ BOOL LLVOVolume::isVisible() const void LLVOVolume::updateTextureVirtualSize(bool forced) { - LLFastTimer ftm(FTM_VOLUME_TEXTURES); + LL_RECORD_BLOCK_TIME(FTM_VOLUME_TEXTURES); // Update the pixel area of all faces if(!forced) @@ -1142,11 +1141,11 @@ void LLVOVolume::sculpt() if ( low_sculpty_discard_warning_count < 10 || (low_sculpty_discard_warning_count % interval) == 0) { // Log first 10 time, then decreasing intervals afterwards otherwise this can flood the logs - llwarns << "WARNING!!: Current discard for sculpty " << mSculptTexture->getID() + LL_WARNS() << "WARNING!!: Current discard for sculpty " << mSculptTexture->getID() << " at " << current_discard << " is less than -2." << " Hit this " << low_sculpty_discard_warning_count << " times" - << llendl; + << LL_ENDL; } low_sculpty_discard_warning_count++; @@ -1161,11 +1160,11 @@ void LLVOVolume::sculpt() if ( high_sculpty_discard_warning_count < 10 || (high_sculpty_discard_warning_count % interval) == 0) { // Log first 10 time, then decreasing intervals afterwards otherwise this can flood the logs - llwarns << "WARNING!!: Current discard for sculpty " << mSculptTexture->getID() + LL_WARNS() << "WARNING!!: Current discard for sculpty " << mSculptTexture->getID() << " at " << current_discard << " is more than than allowed max of " << MAX_DISCARD_LEVEL << ". Hit this " << high_sculpty_discard_warning_count << " times" - << llendl; + << LL_ENDL; } high_sculpty_discard_warning_count++; @@ -1299,10 +1298,8 @@ BOOL LLVOVolume::calcLOD() mLOD = cur_detail; return TRUE; } - else - { - return FALSE; - } + + return FALSE; } BOOL LLVOVolume::updateLOD() @@ -1625,18 +1622,18 @@ void LLVOVolume::updateRelativeXform(bool force_identity) } } -static LLFastTimer::DeclareTimer FTM_GEN_FLEX("Generate Flexies"); -static LLFastTimer::DeclareTimer FTM_UPDATE_PRIMITIVES("Update Primitives"); -static LLFastTimer::DeclareTimer FTM_UPDATE_RIGGED_VOLUME("Update Rigged"); +static LLTrace::BlockTimerStatHandle FTM_GEN_FLEX("Generate Flexies"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_PRIMITIVES("Update Primitives"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_RIGGED_VOLUME("Update Rigged"); BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) { - LLFastTimer t(FTM_UPDATE_PRIMITIVES); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_PRIMITIVES); if (mDrawable->isState(LLDrawable::REBUILD_RIGGED)) { { - LLFastTimer t(FTM_UPDATE_RIGGED_VOLUME); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_RIGGED_VOLUME); updateRiggedVolume(); } genBBoxes(FALSE); @@ -1647,7 +1644,7 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) { BOOL res; { - LLFastTimer t(FTM_GEN_FLEX); + LL_RECORD_BLOCK_TIME(FTM_GEN_FLEX); res = mVolumeImpl->doUpdateGeometry(drawable); } updateFaceFlags(); @@ -1677,14 +1674,14 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) if (mVolumeChanged) { - LLFastTimer ftm(FTM_GEN_VOLUME); + LL_RECORD_BLOCK_TIME(FTM_GEN_VOLUME); LLVolumeParams volume_params = getVolume()->getParams(); setVolume(volume_params, 0); drawable->setState(LLDrawable::REBUILD_VOLUME); } { - LLFastTimer t(FTM_GEN_TRIANGLES); + LL_RECORD_BLOCK_TIME(FTM_GEN_TRIANGLES); regenFaces(); genBBoxes(FALSE); } @@ -1703,7 +1700,7 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) old_volumep = NULL ; { - LLFastTimer ftm(FTM_GEN_VOLUME); + LL_RECORD_BLOCK_TIME(FTM_GEN_VOLUME); LLVolumeParams volume_params = getVolume()->getParams(); setVolume(volume_params, 0); } @@ -1726,7 +1723,7 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) drawable->setState(LLDrawable::REBUILD_VOLUME); // for face->genVolumeTriangles() { - LLFastTimer t(FTM_GEN_TRIANGLES); + LL_RECORD_BLOCK_TIME(FTM_GEN_TRIANGLES); if (new_num_faces != old_num_faces || mNumFaces != (S32)getNumTEs()) { regenFaces(); @@ -1751,7 +1748,7 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) { compiled = TRUE; // All it did was move or we changed the texture coordinate offset - LLFastTimer t(FTM_GEN_TRIANGLES); + LL_RECORD_BLOCK_TIME(FTM_GEN_TRIANGLES); genBBoxes(FALSE); } @@ -2177,7 +2174,7 @@ void LLVOVolume::updateObjectMediaData(const LLSD &media_data_array, const std:: if ( (S32)fetched_version > mLastFetchedMediaVersion) { mLastFetchedMediaVersion = fetched_version; - //llinfos << "updating:" << this->getID() << " " << ll_pretty_print_sd(media_data_array) << llendl; + //LL_INFOS() << "updating:" << this->getID() << " " << ll_pretty_print_sd(media_data_array) << LL_ENDL; LLSD::array_const_iterator iter = media_data_array.beginArray(); LLSD::array_const_iterator end = media_data_array.endArray(); @@ -2205,7 +2202,7 @@ void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool m LL_DEBUGS("MediaOnAPrim") << "BEFORE: texture_index = " << texture_index << " hasMedia = " << te->hasMedia() << " : " - << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << llendl; + << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << LL_ENDL; std::string previous_url; LLMediaEntry* mep = te->getMediaData(); @@ -2247,7 +2244,7 @@ void LLVOVolume::syncMediaData(S32 texture_index, const LLSD &media_data, bool m LL_DEBUGS("MediaOnAPrim") << "AFTER: texture_index = " << texture_index << " hasMedia = " << te->hasMedia() << " : " - << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << llendl; + << ((NULL == te->getMediaData()) ? "NULL MEDIA DATA" : ll_pretty_print_sd(te->getMediaData()->asLLSD())) << LL_ENDL; } void LLVOVolume::mediaNavigateBounceBack(U8 texture_index) @@ -3684,7 +3681,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& { LLVector4a local_start = start; LLVector4a local_end = end; - + if (transform) { LLVector3 v_start(start.getF32ptr()); @@ -3696,7 +3693,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& local_start.load3(v_start.mV); local_end.load3(v_end.mV); } - + LLVector4a p; LLVector4a n; LLVector2 tc; @@ -3912,8 +3909,8 @@ void LLVOVolume::updateRiggedVolume() } -static LLFastTimer::DeclareTimer FTM_SKIN_RIGGED("Skin"); -static LLFastTimer::DeclareTimer FTM_RIGGED_OCTREE("Octree"); +static LLTrace::BlockTimerStatHandle FTM_SKIN_RIGGED("Skin"); +static LLTrace::BlockTimerStatHandle FTM_RIGGED_OCTREE("Octree"); void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, const LLVolume* volume) { @@ -3974,7 +3971,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons if( pos && weight && dst_face.mExtents ) { - LLFastTimer t(FTM_SKIN_RIGGED); + LL_RECORD_BLOCK_TIME(FTM_SKIN_RIGGED); for (U32 j = 0; j < dst_face.mNumVertices; ++j) { @@ -4037,7 +4034,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons } { - LLFastTimer t(FTM_RIGGED_OCTREE); + LL_RECORD_BLOCK_TIME(FTM_RIGGED_OCTREE); delete dst_face.mOctree; dst_face.mOctree = NULL; @@ -4061,8 +4058,8 @@ U32 LLVOVolume::getPartitionType() const return LLViewerRegion::PARTITION_VOLUME; } -LLVolumePartition::LLVolumePartition() -: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW_ARB) +LLVolumePartition::LLVolumePartition(LLViewerRegion* regionp) +: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW_ARB, regionp) { mLODPeriod = 32; mDepthMask = FALSE; @@ -4072,8 +4069,8 @@ LLVolumePartition::LLVolumePartition() mBufferUsage = GL_DYNAMIC_DRAW_ARB; } -LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep) -: LLSpatialBridge(drawablep, TRUE, LLVOVolume::VERTEX_DATA_MASK) +LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep, LLViewerRegion* regionp) +: LLSpatialBridge(drawablep, TRUE, LLVOVolume::VERTEX_DATA_MASK, regionp) { mDepthMask = FALSE; mLODPeriod = 32; @@ -4110,16 +4107,16 @@ bool can_batch_texture(LLFace* facep) return true; } -static LLFastTimer::DeclareTimer FTM_REGISTER_FACE("Register Face"); +static LLTrace::BlockTimerStatHandle FTM_REGISTER_FACE("Register Face"); void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 type) { - LLFastTimer t(FTM_REGISTER_FACE); + LL_RECORD_BLOCK_TIME(FTM_REGISTER_FACE); if (type == LLRenderPass::PASS_ALPHA && facep->getTextureEntry()->getMaterialParams().notNull() && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_TANGENT)) { LL_WARNS("RenderMaterials") << "Oh no! No binormals for this alpha blended face!" << LL_ENDL; } - + if (facep->getViewerObject()->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects) { return; @@ -4138,7 +4135,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, if (!fullbright && type != LLRenderPass::PASS_GLOW && !facep->getVertexBuffer()->hasDataType(LLVertexBuffer::TYPE_NORMAL)) { - llwarns << "Non fullbright face has no normals!" << llendl; + LL_WARNS() << "Non fullbright face has no normals!" << LL_ENDL; return; } @@ -4169,11 +4166,11 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U8 bump = (type == LLRenderPass::PASS_BUMP || type == LLRenderPass::PASS_POST_BUMP) ? facep->getTextureEntry()->getBumpmap() : 0; U8 shiny = facep->getTextureEntry()->getShiny(); - + LLViewerTexture* tex = facep->getTexture(); U8 index = facep->getTextureIndex(); - + LLMaterial* mat = facep->getTextureEntry()->getMaterialParams().get(); LLMaterialID mat_id = facep->getTextureEntry()->getMaterialID(); @@ -4229,7 +4226,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_vec[idx]->mMaterial == mat && draw_vec[idx]->mMaterialID == mat_id && draw_vec[idx]->mFullbright == fullbright && - draw_vec[idx]->mBump == bump && + draw_vec[idx]->mBump == bump && (!mat || (draw_vec[idx]->mShiny == shiny)) && // need to break batches when a material is shared, but legacy settings are different draw_vec[idx]->mTextureMatrix == tex_mat && draw_vec[idx]->mModelMatrix == model_mat && @@ -4255,7 +4252,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, U32 offset = facep->getIndicesStart(); U32 count = facep->getIndicesCount(); LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset, tex, - facep->getVertexBuffer(), fullbright, bump); + facep->getVertexBuffer(), fullbright, bump); draw_info->mGroup = group; draw_info->mVSize = facep->getVirtualSize(); draw_vec.push_back(draw_info); @@ -4341,9 +4338,9 @@ void LLVolumeGeometryManager::getGeometry(LLSpatialGroup* group) } -static LLFastTimer::DeclareTimer FTM_REBUILD_VOLUME_VB("Volume VB"); -static LLFastTimer::DeclareTimer FTM_REBUILD_VOLUME_FACE_LIST("Build Face List"); -static LLFastTimer::DeclareTimer FTM_REBUILD_VOLUME_GEN_DRAW_INFO("Gen Draw Info"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_VOLUME_VB("Volume VB"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_VOLUME_FACE_LIST("Build Face List"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_VOLUME_GEN_DRAW_INFO("Gen Draw Info"); static LLDrawPoolAvatar* get_avatar_drawpool(LLViewerObject* vobj) { @@ -4383,22 +4380,22 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) group->mLastUpdateViewAngle = group->mViewAngle; - if (!group->isState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::ALPHA_DIRTY)) + if (!group->hasState(LLSpatialGroup::GEOM_DIRTY | LLSpatialGroup::ALPHA_DIRTY)) { - if (group->isState(LLSpatialGroup::MESH_DIRTY) && !LLPipeline::sDelayVBUpdate) + if (group->hasState(LLSpatialGroup::MESH_DIRTY) && !LLPipeline::sDelayVBUpdate) { rebuildMesh(group); } return; } - LLFastTimer ftm(FTM_REBUILD_VOLUME_VB); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_VOLUME_VB); group->mBuilt = 1.f; LLVOAvatar* pAvatarVO = NULL; - LLSpatialBridge* bridge = group->mSpatialPartition->asBridge(); + LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge(); if (bridge) { if (bridge->mAvatar.isNull()) @@ -4425,7 +4422,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) group->mSurfaceArea = 0; //cache object box size since it might be used for determining visibility - group->mObjectBoxSize = group->mObjectBounds[1].getLength3().getF32(); + const LLVector4a* bounds = group->getObjectBounds(); + group->mObjectBoxSize = bounds[1].getLength3().getF32(); group->clearDrawMap(); @@ -4433,13 +4431,13 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) const U32 MAX_FACE_COUNT = 4096; - static LLFace** fullbright_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64); - static LLFace** bump_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64); - static LLFace** simple_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64); - static LLFace** norm_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*), 64); - static LLFace** spec_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*), 64); - static LLFace** normspec_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*), 64); - static LLFace** alpha_faces = (LLFace**) ll_aligned_malloc(MAX_FACE_COUNT*sizeof(LLFace*),64); + static LLFace** fullbright_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*)); + static LLFace** bump_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*)); + static LLFace** simple_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*)); + static LLFace** norm_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*)); + static LLFace** spec_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*)); + static LLFace** normspec_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*)); + static LLFace** alpha_faces = (LLFace**) ll_aligned_malloc<64>(MAX_FACE_COUNT*sizeof(LLFace*)); U32 fullbright_count = 0; U32 bump_count = 0; @@ -4450,10 +4448,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) U32 normspec_count = 0; - U32 useage = group->mSpatialPartition->mBufferUsage; + U32 useage = group->getSpatialPartition()->mBufferUsage; - U32 max_vertices = (gSavedSettings.getS32("RenderMaxVBOSize")*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask); - U32 max_total = (gSavedSettings.getS32("RenderMaxNodeSize")*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask); + U32 max_vertices = (gSavedSettings.getS32("RenderMaxVBOSize")*1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask); + U32 max_total = (gSavedSettings.getS32("RenderMaxNodeSize")*1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask); max_vertices = llmin(max_vertices, (U32) 65535); U32 cur_total = 0; @@ -4463,14 +4461,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { - LLFastTimer t(FTM_REBUILD_VOLUME_FACE_LIST); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_VOLUME_FACE_LIST); //get all the faces into a list for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { - LLDrawable* drawablep = *drawable_iter; + LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable(); - if (drawablep->isDead() || drawablep->isState(LLDrawable::FORCE_INVISIBLE) ) + if (!drawablep || drawablep->isDead() || drawablep->isState(LLDrawable::FORCE_INVISIBLE) ) { continue; } @@ -4568,7 +4566,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) for ( int i=0; i<jointCnt; ++i ) { std::string lookingForJoint = pSkinData->mJointNames[i].c_str(); - //llinfos<<"joint name "<<lookingForJoint.c_str()<<llendl; + //LL_INFOS()<<"joint name "<<lookingForJoint.c_str()<<LL_ENDL; LLJoint* pJoint = pAvatarVO->getJoint( lookingForJoint ); if ( pJoint && pJoint->getId() != currentId ) { @@ -4675,67 +4673,67 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } else { - if (type == LLDrawPool::POOL_ALPHA) - { - if (te->getColor().mV[3] > 0.f) - { - if (te->getFullbright()) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA); - } - else - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA); - } - } - } - else if (te->getShiny()) + if (type == LLDrawPool::POOL_ALPHA) + { + if (te->getColor().mV[3] > 0.f) { if (te->getFullbright()) { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY); + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA); } else { - if (LLPipeline::sRenderDeferred) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); - } - else - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SHINY); - } + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA); } } + } + else if (te->getShiny()) + { + if (te->getFullbright()) + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY); + } else { - if (te->getFullbright()) + if (LLPipeline::sRenderDeferred) { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT); + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); } else { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SHINY); } } + } + else + { + if (te->getFullbright()) + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT); + } + else + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_SIMPLE); + } + } - - if (LLPipeline::sRenderDeferred) + + if (LLPipeline::sRenderDeferred) + { + if (type != LLDrawPool::POOL_ALPHA && !te->getFullbright()) { - if (type != LLDrawPool::POOL_ALPHA && !te->getFullbright()) + if (te->getBumpmap()) { - if (te->getBumpmap()) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_BUMP); - } - else - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_SIMPLE); - } + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_BUMP); + } + else + { + pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_DEFERRED_SIMPLE); } } } } + } continue; } @@ -5003,10 +5001,13 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) //drawables have been rebuilt, clear rebuild status for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { - LLDrawable* drawablep = *drawable_iter; + LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable(); + if(drawablep) + { drawablep->clearState(LLDrawable::REBUILD_ALL); } } + } group->mLastUpdateTime = gFrameTimeSeconds; group->mBuilt = 1.f; @@ -5040,15 +5041,15 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } } -static LLFastTimer::DeclareTimer FTM_REBUILD_MESH_FLUSH("Flush Mesh"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_MESH_FLUSH("Flush Mesh"); void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) { llassert(group); - if (group && group->isState(LLSpatialGroup::MESH_DIRTY) && !group->isState(LLSpatialGroup::GEOM_DIRTY)) + if (group && group->hasState(LLSpatialGroup::MESH_DIRTY) && !group->hasState(LLSpatialGroup::GEOM_DIRTY)) { - LLFastTimer ftm(FTM_REBUILD_VOLUME_VB); - LLFastTimer t(FTM_REBUILD_VOLUME_GEN_DRAW_INFO); //make sure getgeometryvolume shows up in the right place in timers + LL_RECORD_BLOCK_TIME(FTM_REBUILD_VOLUME_VB); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_VOLUME_GEN_DRAW_INFO); //make sure getgeometryvolume shows up in the right place in timers group->mBuilt = 1.f; @@ -5061,9 +5062,9 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { - LLDrawable* drawablep = *drawable_iter; + LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable(); - if (!drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL) && !drawablep->isState(LLDrawable::RIGGED) ) + if (drawablep && !drawablep->isDead() && drawablep->isState(LLDrawable::REBUILD_ALL) && !drawablep->isState(LLDrawable::RIGGED) ) { LLVOVolume* vobj = drawablep->getVOVolume(); vobj->preRebuild(); @@ -5111,7 +5112,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) } { - LLFastTimer t(FTM_REBUILD_MESH_FLUSH); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_MESH_FLUSH); for (LLVertexBuffer** iter = locked_buffer, ** end_iter = locked_buffer+buffer_count; iter != end_iter; ++iter) { (*iter)->flush(); @@ -5129,10 +5130,14 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) //if not all buffers are unmapped if(num_mapped_vertex_buffer != LLVertexBuffer::sMappedCount) { - llwarns << "Not all mapped vertex buffers are unmapped!" << llendl ; + LL_WARNS() << "Not all mapped vertex buffers are unmapped!" << LL_ENDL ; for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { - LLDrawable* drawablep = *drawable_iter; + LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable(); + if(!drawablep) + { + continue; + } for (S32 i = 0; i < drawablep->getNumFaces(); ++i) { LLFace* face = drawablep->getFace(i); @@ -5184,11 +5189,11 @@ struct CompareBatchBreakerModified } }; -static LLFastTimer::DeclareTimer FTM_GEN_DRAW_INFO_SORT("Draw Info Face Sort"); -static LLFastTimer::DeclareTimer FTM_GEN_DRAW_INFO_FACE_SIZE("Face Sizing"); -static LLFastTimer::DeclareTimer FTM_GEN_DRAW_INFO_ALLOCATE("Allocate VB"); -static LLFastTimer::DeclareTimer FTM_GEN_DRAW_INFO_FIND_VB("Find VB"); -static LLFastTimer::DeclareTimer FTM_GEN_DRAW_INFO_RESIZE_VB("Resize VB"); +static LLTrace::BlockTimerStatHandle FTM_GEN_DRAW_INFO_SORT("Draw Info Face Sort"); +static LLTrace::BlockTimerStatHandle FTM_GEN_DRAW_INFO_FACE_SIZE("Face Sizing"); +static LLTrace::BlockTimerStatHandle FTM_GEN_DRAW_INFO_ALLOCATE("Allocate VB"); +static LLTrace::BlockTimerStatHandle FTM_GEN_DRAW_INFO_FIND_VB("Find VB"); +static LLTrace::BlockTimerStatHandle FTM_GEN_DRAW_INFO_RESIZE_VB("Resize VB"); @@ -5196,7 +5201,7 @@ static LLFastTimer::DeclareTimer FTM_GEN_DRAW_INFO_RESIZE_VB("Resize VB"); void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace** faces, U32 face_count, BOOL distance_sort, BOOL batch_textures, BOOL no_materials) { - LLFastTimer t(FTM_REBUILD_VOLUME_GEN_DRAW_INFO); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_VOLUME_GEN_DRAW_INFO); U32 buffer_usage = group->mBufferUsage; @@ -5222,11 +5227,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac #endif //calculate maximum number of vertices to store in a single buffer - U32 max_vertices = (gSavedSettings.getS32("RenderMaxVBOSize")*1024)/LLVertexBuffer::calcVertexSize(group->mSpatialPartition->mVertexDataMask); + U32 max_vertices = (gSavedSettings.getS32("RenderMaxVBOSize")*1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask); max_vertices = llmin(max_vertices, (U32) 65535); { - LLFastTimer t(FTM_GEN_DRAW_INFO_SORT); + LL_RECORD_BLOCK_TIME(FTM_GEN_DRAW_INFO_SORT); if (!distance_sort) { //sort faces by things that break batches @@ -5311,7 +5316,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac U32 texture_count = 0; { - LLFastTimer t(FTM_GEN_DRAW_INFO_FACE_SIZE); + LL_RECORD_BLOCK_TIME(FTM_GEN_DRAW_INFO_FACE_SIZE); if (batch_textures) { U8 cur_tex = 0; @@ -5434,7 +5439,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac LLVertexBuffer* buffer = NULL; { - LLFastTimer t(FTM_GEN_DRAW_INFO_ALLOCATE); + LL_RECORD_BLOCK_TIME(FTM_GEN_DRAW_INFO_ALLOCATE); buffer = createVertexBuffer(mask, buffer_usage); buffer->allocateBuffer(geom_count, index_count, TRUE); } @@ -5458,7 +5463,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac if (batch_textures && facep->getTextureIndex() == 255) { - llerrs << "Invalid texture index." << llendl; + LL_ERRS() << "Invalid texture index." << LL_ENDL; } { @@ -5483,7 +5488,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac if (!facep->getGeometryVolume(*volume, te_idx, vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true)) { - llwarns << "Failed to get geometry for face!" << llendl; + LL_WARNS() << "Failed to get geometry for face!" << LL_ENDL; } if (drawablep->isState(LLDrawable::ANIMATED_CHILD)) @@ -5495,7 +5500,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac index_offset += facep->getGeomCount(); indices_index += facep->getIndicesCount(); - + //append face to appropriate render batch BOOL force_simple = facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA; @@ -5719,7 +5724,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac } else { - registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); + registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); } if (LLPipeline::sRenderDeferred && !hud_group && LLPipeline::sRenderBump && use_legacy_bump) { //if this is the deferred render and a bump map is present, register in post deferred bump @@ -5741,10 +5746,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac } else { - registerFace(group, facep, LLRenderPass::PASS_SIMPLE); - } + registerFace(group, facep, LLRenderPass::PASS_SIMPLE); } } + } if (!gPipeline.canUseVertexShaders() && @@ -5789,7 +5794,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count) { //initialize to default usage for this partition - U32 usage = group->mSpatialPartition->mBufferUsage; + U32 usage = group->getSpatialPartition()->mBufferUsage; //clear off any old faces mFaceList.clear(); @@ -5798,9 +5803,9 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter) { - LLDrawable* drawablep = *drawable_iter; + LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable(); - if (drawablep->isDead()) + if (!drawablep || drawablep->isDead()) { continue; } @@ -5838,7 +5843,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun group->mBufferUsage = usage; } -LLHUDPartition::LLHUDPartition() +LLHUDPartition::LLHUDPartition(LLViewerRegion* regionp) : LLBridgePartition(regionp) { mPartitionType = LLViewerRegion::PARTITION_HUD; mDrawableType = LLPipeline::RENDER_TYPE_HUD; diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp index 21595ee0bcfcddd176f61bed301b5217f3032d0f..e3419af10d2b2273a59ef90e1cb71303ca0f5af9 100755 --- a/indra/newview/llvowater.cpp +++ b/indra/newview/llvowater.cpp @@ -28,7 +28,6 @@ #include "llvowater.h" -#include "imageids.h" #include "llviewercontrol.h" #include "lldrawable.h" @@ -124,11 +123,11 @@ LLDrawable *LLVOWater::createDrawable(LLPipeline *pipeline) return mDrawable; } -static LLFastTimer::DeclareTimer FTM_UPDATE_WATER("Update Water"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_WATER("Update Water"); BOOL LLVOWater::updateGeometry(LLDrawable *drawable) { - LLFastTimer ftm(FTM_UPDATE_WATER); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_WATER); LLFace *face; if (drawable->getNumFaces() < 1) @@ -298,15 +297,15 @@ U32 LLVOVoidWater::getPartitionType() const return LLViewerRegion::PARTITION_VOIDWATER; } -LLWaterPartition::LLWaterPartition() -: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW_ARB) +LLWaterPartition::LLWaterPartition(LLViewerRegion* regionp) +: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW_ARB, regionp) { mInfiniteFarClip = TRUE; mDrawableType = LLPipeline::RENDER_TYPE_WATER; mPartitionType = LLViewerRegion::PARTITION_WATER; } -LLVoidWaterPartition::LLVoidWaterPartition() +LLVoidWaterPartition::LLVoidWaterPartition(LLViewerRegion* regionp) : LLWaterPartition(regionp) { mOcclusionEnabled = FALSE; mDrawableType = LLPipeline::RENDER_TYPE_VOIDWATER; diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index e7435b6860a962c96c3d7672454627409c933fcd..90bc6509a6f479c64518289ecfb225463e85dc9f 100755 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -301,11 +301,11 @@ void LLVOWLSky::restoreGL() gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_ALL, TRUE); } -static LLFastTimer::DeclareTimer FTM_GEO_SKY("Windlight Sky Geometry"); +static LLTrace::BlockTimerStatHandle FTM_GEO_SKY("Windlight Sky Geometry"); BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) { - LLFastTimer ftm(FTM_GEO_SKY); + LL_RECORD_BLOCK_TIME(FTM_GEO_SKY); LLStrider<LLVector3> vertices; LLStrider<LLVector2> texCoords; LLStrider<U16> indices; @@ -321,7 +321,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) if(!success) { - llerrs << "Failed updating WindLight sky geometry." << llendl; + LL_ERRS() << "Failed updating WindLight sky geometry." << LL_ENDL; } buildFanBuffer(vertices, texCoords, indices); @@ -345,7 +345,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) // round up to a whole number of segments const U32 strips_segments = (total_stacks+stacks_per_seg-1) / stacks_per_seg; - llinfos << "WL Skydome strips in " << strips_segments << " batches." << llendl; + LL_INFOS() << "WL Skydome strips in " << strips_segments << " batches." << LL_ENDL; mStripsVerts.resize(strips_segments, NULL); @@ -384,7 +384,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) if(!success) { - llerrs << "Failed updating WindLight sky geometry." << llendl; + LL_ERRS() << "Failed updating WindLight sky geometry." << LL_ENDL; } // fill it @@ -394,7 +394,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable) segment->flush(); } - llinfos << "completed in " << llformat("%.2f", timer.getElapsedTimeF32()) << "seconds" << llendl; + LL_INFOS() << "completed in " << llformat("%.2f", timer.getElapsedTimeF32().value()) << "seconds" << LL_ENDL; } #else mStripsVerts = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB); @@ -786,7 +786,7 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable) if(!success) { - llerrs << "Failed updating star geometry." << llendl; + LL_ERRS() << "Failed updating star geometry." << LL_ENDL; } // *TODO: fix LLStrider with a real prefix increment operator so it can be @@ -795,7 +795,7 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable) if (mStarVertices.size() < getStarsNumVerts()) { - llerrs << "Star reference geometry insufficient." << llendl; + LL_ERRS() << "Star reference geometry insufficient." << LL_ENDL; } for (U32 vtx = 0; vtx < getStarsNumVerts(); ++vtx) diff --git a/indra/newview/llwatchdog.cpp b/indra/newview/llwatchdog.cpp index 4f582fc2dbd7d6f534cba1d3256ba42a4640730c..7b5bcf4db0179f5b50e142dd4e14de5e502b8f84 100755 --- a/indra/newview/llwatchdog.cpp +++ b/indra/newview/llwatchdog.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "llwatchdog.h" +#include "llthread.h" const U32 WATCHDOG_SLEEP_TIME_USEC = 1000000; @@ -221,7 +222,7 @@ void LLWatchdog::run() if(current_run_delta > (WATCHDOG_SLEEP_TIME_USEC * TIME_ELAPSED_MULTIPLIER)) { - llinfos << "Watchdog thread delayed: resetting entries." << llendl; + LL_INFOS() << "Watchdog thread delayed: resetting entries." << LL_ENDL; std::for_each(mSuspects.begin(), mSuspects.end(), std::mem_fun(&LLWatchdogEntry::reset) @@ -243,7 +244,7 @@ void LLWatchdog::run() mTimer->stop(); } - llinfos << "Watchdog detected error:" << llendl; + LL_INFOS() << "Watchdog detected error:" << LL_ENDL; mKillerCallback(); } } diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 72d628fb88fbd8f2b713c066fd0e36c3a9d7ec0a..c854e1fc666a5e14adf54acfa935bb96522a82e9 100755 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -89,7 +89,7 @@ void LLWaterParamManager::loadAllPresets() void LLWaterParamManager::loadPresetsFromDir(const std::string& dir) { - LL_INFOS2("AppInit", "Shaders") << "Loading water presets from " << dir << LL_ENDL; + LL_INFOS("AppInit", "Shaders") << "Loading water presets from " << dir << LL_ENDL; LLDirIterator dir_iter(dir, "*.xml"); while (1) @@ -103,7 +103,7 @@ void LLWaterParamManager::loadPresetsFromDir(const std::string& dir) std::string path = gDirUtilp->add(dir, file); if (!loadPreset(path)) { - llwarns << "Error loading water preset from " << path << llendl; + LL_WARNS() << "Error loading water preset from " << path << LL_ENDL; } } } @@ -119,7 +119,7 @@ bool LLWaterParamManager::loadPreset(const std::string& path) return false; } - LL_DEBUGS2("AppInit", "Shaders") << "Loading water " << name << LL_ENDL; + LL_DEBUGS("AppInit", "Shaders") << "Loading water " << name << LL_ENDL; LLSD params_data; LLPointer<LLSDParser> parser = new LLSDXMLParser(); @@ -201,7 +201,7 @@ void LLWaterParamManager::applyParams(const LLSD& params, bool interpolate) { if (params.size() == 0) { - llwarns << "Undefined water params" << llendl; + LL_WARNS() << "Undefined water params" << LL_ENDL; return; } @@ -215,11 +215,11 @@ void LLWaterParamManager::applyParams(const LLSD& params, bool interpolate) } } -static LLFastTimer::DeclareTimer FTM_UPDATE_WATERPARAM("Update Water Params"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_WATERPARAM("Update Water Params"); void LLWaterParamManager::update(LLViewerCamera * cam) { - LLFastTimer ftm(FTM_UPDATE_WATERPARAM); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_WATERPARAM); // update the shaders and the menu propagateParameters(); diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index c196d70617d7d69aade31e05ea392cd6b3afbc3b..ca60b79f9d8d66fac93f532add58f558f486b58e 100755 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -558,7 +558,7 @@ LLWearableItemTypeNameComparator::ETypeListOrder LLWearableItemTypeNameComparato if(const_it == mWearableOrder.end()) { - llwarns<<"Absent information about order rang of items of "<<LLAssetType::getDesc(item_type)<<" type"<<llendl; + LL_WARNS()<<"Absent information about order rang of items of "<<LLAssetType::getDesc(item_type)<<" type"<<LL_ENDL; return ORDER_RANK_UNKNOWN; } @@ -572,7 +572,7 @@ bool LLWearableItemTypeNameComparator::sortAssetTypeByName(LLAssetType::EType it if(const_it == mWearableOrder.end()) { - llwarns<<"Absent information about sorting items of "<<LLAssetType::getDesc(item_type)<<" type"<<llendl; + LL_WARNS()<<"Absent information about sorting items of "<<LLAssetType::getDesc(item_type)<<" type"<<LL_ENDL; return true; } @@ -588,7 +588,7 @@ bool LLWearableItemTypeNameComparator::sortWearableTypeByName(LLAssetType::EType if(const_it == mWearableOrder.end()) { - llwarns<<"Absent information about sorting items of "<<LLAssetType::getDesc(item_type)<<" type"<<llendl; + LL_WARNS()<<"Absent information about sorting items of "<<LLAssetType::getDesc(item_type)<<" type"<<LL_ENDL; return true; } @@ -648,7 +648,7 @@ void LLWearableItemsList::addNewItem(LLViewerInventoryItem* item, bool rearrange { if (!item) { - llwarns << "No inventory item. Couldn't create flat list item." << llendl; + LL_WARNS() << "No inventory item. Couldn't create flat list item." << LL_ENDL; llassert(item != NULL); } @@ -659,7 +659,7 @@ void LLWearableItemsList::addNewItem(LLViewerInventoryItem* item, bool rearrange bool is_item_added = addItem(list_item, item->getUUID(), ADD_BOTTOM, rearrange); if (!is_item_added) { - llwarns << "Couldn't add flat list item." << llendl; + LL_WARNS() << "Couldn't add flat list item." << LL_ENDL; llassert(is_item_added); } } @@ -825,7 +825,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu { if (!menu) { - llwarns << "Invalid menu" << llendl; + LL_WARNS() << "Invalid menu" << LL_ENDL; return; } @@ -846,7 +846,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu if (!item) { - llwarns << "Invalid item" << llendl; + LL_WARNS() << "Invalid item" << LL_ENDL; // *NOTE: the logic below may not work in this case continue; } @@ -919,7 +919,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu if (mask & MASK_UNKNOWN) { - llwarns << "Non-wearable items passed." << llendl; + LL_WARNS() << "Non-wearable items passed." << LL_ENDL; } U32 num_visible_items = 0; @@ -1026,7 +1026,7 @@ bool LLWearableItemsList::ContextMenu::canAddWearables(const uuid_vec_t& item_id } else { - llwarns << "Unexpected wearable type" << llendl; + LL_WARNS() << "Unexpected wearable type" << LL_ENDL; return false; } } diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index a8a5ef311781dff230fb936a6a02c5d6f119ffa9..58a00c5be02742927f70f52b5d01ffebb04dbe7d 100755 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -258,7 +258,7 @@ class LLWearableListItemComparator : public LLFlatListView::ItemComparator if (!wearable_item1 || !wearable_item2) { - llwarning("item1 and item2 cannot be null", 0); + LL_WARNS() << "item1 and item2 cannot be null" << LL_ENDL; return true; } diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index ef1a953f59d5c2d7ec47115dd50edc17fd57e8a0..608589312908dd2c85707b7309d4606395f7e382 100755 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -148,7 +148,6 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID { LLFile::remove(std::string(filename)); } - LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); LL_WARNS("Wearable") << "Wearable download failed: " << LLAssetStorage::getErrorString( status ) << " " << uuid << LL_ENDL; switch( status ) @@ -217,7 +216,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearable, const std::string& new_name) { - lldebugs << "LLWearableList::createCopy()" << llendl; + LL_DEBUGS() << "LLWearableList::createCopy()" << LL_ENDL; LLViewerWearable *wearable = generateNewWearable(); wearable->copyDataFrom(old_wearable); @@ -236,7 +235,7 @@ LLViewerWearable* LLWearableList::createCopy(const LLViewerWearable* old_wearabl LLViewerWearable* LLWearableList::createNewWearable( LLWearableType::EType type, LLAvatarAppearance *avatarp ) { - lldebugs << "LLWearableList::createNewWearable()" << llendl; + LL_DEBUGS() << "LLWearableList::createNewWearable()" << LL_ENDL; LLViewerWearable *wearable = generateNewWearable(); wearable->setType( type, avatarp ); diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 83337b386dec52fae4b8463f94d637d950e43260..665671a38f46e2ece0c128fd5c3a4ce59fce1f82 100755 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -121,7 +121,7 @@ void LLWeb::loadURLExternal(const std::string& url, bool async, const std::strin if(gSavedSettings.getBOOL("DisableExternalBrowser")) { // Don't open an external browser under any circumstances. - llwarns << "Blocked attempt to open external browser." << llendl; + LL_WARNS() << "Blocked attempt to open external browser." << LL_ENDL; return; } diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 69255af1792c7f8e0662b25c6ed5d36750562901..0cf0e7b9c07bdbe419b940a8c07e2ee1405af1b9 100755 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -80,7 +80,7 @@ class LLWebProfileResponders::ConfigResponder : public LLHTTPClient::Responder if (status != 200) { - llwarns << "Failed to get upload config (" << status << ")" << llendl; + LL_WARNS() << "Failed to get upload config (" << status << ")" << LL_ENDL; LLWebProfile::reportImageUploadStatus(false); return; } @@ -89,7 +89,7 @@ class LLWebProfileResponders::ConfigResponder : public LLHTTPClient::Responder Json::Reader reader; if (!reader.parse(body, root)) { - llwarns << "Failed to parse upload config: " << reader.getFormatedErrorMessages() << llendl; + LL_WARNS() << "Failed to parse upload config: " << reader.getFormatedErrorMessages() << LL_ENDL; LLWebProfile::reportImageUploadStatus(false); return; } @@ -112,7 +112,7 @@ class LLWebProfileResponders::ConfigResponder : public LLHTTPClient::Responder config["caption"] = data.get("caption", "").asString(); // Do the actual image upload using the configuration. - LL_DEBUGS("Snapshots") << "Got upload config, POSTing image to " << upload_url << ", config=[" << config << "]" << llendl; + LL_DEBUGS("Snapshots") << "Got upload config, POSTing image to " << upload_url << ", config=[" << config << "]" << LL_ENDL; LLWebProfile::post(mImagep, config, upload_url); } @@ -135,7 +135,7 @@ class LLWebProfileResponders::PostImageRedirectResponder : public LLHTTPClient:: { if (status != 200) { - llwarns << "Failed to upload image: " << status << " " << reason << llendl; + LL_WARNS() << "Failed to upload image: " << status << " " << reason << LL_ENDL; LLWebProfile::reportImageUploadStatus(false); return; } @@ -144,8 +144,8 @@ class LLWebProfileResponders::PostImageRedirectResponder : public LLHTTPClient:: std::stringstream strstrm; strstrm << istr.rdbuf(); const std::string body = strstrm.str(); - llinfos << "Image uploaded." << llendl; - LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << body << "]" << llendl; + LL_INFOS() << "Image uploaded." << LL_ENDL; + LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << body << "]" << LL_ENDL; LLWebProfile::reportImageUploadStatus(true); } }; @@ -168,13 +168,13 @@ class LLWebProfileResponders::PostImageResponder : public LLHTTPClient::Responde LLSD headers = LLViewerMedia::getHeaders(); headers["Cookie"] = LLWebProfile::getAuthCookie(); const std::string& redir_url = content["location"]; - LL_DEBUGS("Snapshots") << "Got redirection URL: " << redir_url << llendl; + LL_DEBUGS("Snapshots") << "Got redirection URL: " << redir_url << LL_ENDL; LLHTTPClient::get(redir_url, new LLWebProfileResponders::PostImageRedirectResponder(), headers); } else { - llwarns << "Unexpected POST status: " << status << " " << reason << llendl; - LL_DEBUGS("Snapshots") << "headers: [" << content << "]" << llendl; + LL_WARNS() << "Unexpected POST status: " << status << " " << reason << LL_ENDL; + LL_DEBUGS("Snapshots") << "headers: [" << content << "]" << LL_ENDL; LLWebProfile::reportImageUploadStatus(false); } } @@ -201,7 +201,7 @@ void LLWebProfile::uploadImage(LLPointer<LLImageFormatted> image, const std::str config_url += "?caption=" + LLURI::escape(caption); config_url += "&add_loc=" + std::string(add_location ? "1" : "0"); - LL_DEBUGS("Snapshots") << "Requesting " << config_url << llendl; + LL_DEBUGS("Snapshots") << "Requesting " << config_url << LL_ENDL; LLSD headers = LLViewerMedia::getHeaders(); headers["Cookie"] = getAuthCookie(); LLHTTPClient::get(config_url, new LLWebProfileResponders::ConfigResponder(image), headers); @@ -210,7 +210,7 @@ void LLWebProfile::uploadImage(LLPointer<LLImageFormatted> image, const std::str // static void LLWebProfile::setAuthCookie(const std::string& cookie) { - LL_DEBUGS("Snapshots") << "Setting auth cookie: " << cookie << llendl; + LL_DEBUGS("Snapshots") << "Setting auth cookie: " << cookie << LL_ENDL; sAuthCookie = cookie; } @@ -219,7 +219,7 @@ void LLWebProfile::post(LLPointer<LLImageFormatted> image, const LLSD& config, c { if (dynamic_cast<LLImagePNG*>(image.get()) == 0) { - llwarns << "Image to upload is not a PNG" << llendl; + LL_WARNS() << "Image to upload is not a PNG" << LL_ENDL; llassert(dynamic_cast<LLImagePNG*>(image.get()) != 0); return; } diff --git a/indra/newview/llwind.h b/indra/newview/llwind.h index 3b57f07124d2ad0563c046e8324028b969b56daa..e73d1baa588da75f146607985366fe7991ef4777 100755 --- a/indra/newview/llwind.h +++ b/indra/newview/llwind.h @@ -35,6 +35,8 @@ class LLVector3; class LLBitPack; class LLGroupHeader; +const F32 WIND_SCALE_HACK = 2.0f; // hack to make wind speeds more realistic + class LLWind { diff --git a/indra/newview/llwindebug.h b/indra/newview/llwindebug.h index 3837825d31a795359206a2a28cf8acbaf55c033c..6f274c6f162d400339ce4f12573c07c3fa20425f 100755 --- a/indra/newview/llwindebug.h +++ b/indra/newview/llwindebug.h @@ -28,6 +28,7 @@ #define LL_LLWINDEBUG_H #include "stdtypes.h" +#include "llwin32headerslean.h" #include <dbghelp.h> class LLWinDebug: diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp index 4c0cb7c0f475325ed1b20c5c815a2eefa68f1272..e9b0baf612dad51ebde4f470287ec2f5269c29f6 100755 --- a/indra/newview/llwldaycycle.cpp +++ b/indra/newview/llwldaycycle.cpp @@ -46,7 +46,7 @@ LLWLDayCycle::~LLWLDayCycle() void LLWLDayCycle::loadDayCycle(const LLSD& day_data, LLWLParamKey::EScope scope) { - lldebugs << "Loading day cycle (day_data.size() = " << day_data.size() << ", scope = " << scope << ")" << llendl; + LL_DEBUGS() << "Loading day cycle (day_data.size() = " << day_data.size() << ", scope = " << scope << ")" << LL_ENDL; mTimeMap.clear(); // add each key frame @@ -128,7 +128,7 @@ LLSD LLWLDayCycle::loadDayCycleFromPath(const std::string& file_path) void LLWLDayCycle::saveDayCycle(const std::string & fileName) { std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName)); - //llinfos << "Saving WindLight settings to " << pathName << llendl; + //LL_INFOS() << "Saving WindLight settings to " << pathName << LL_ENDL; save(pathName); } @@ -154,7 +154,7 @@ LLSD LLWLDayCycle::asLLSD() day_data.append(key); } - lldebugs << "Dumping day cycle (" << mTimeMap.size() << ") to LLSD: " << day_data << llendl; + LL_DEBUGS() << "Dumping day cycle (" << mTimeMap.size() << ") to LLSD: " << day_data << LL_ENDL; return day_data; } @@ -169,7 +169,7 @@ bool LLWLDayCycle::getSkyRefs(std::map<LLWLParamKey, LLWLParamSet>& refs) const const LLWLParamKey& key = iter->second; if (!wl_mgr.getParamSet(key, refs[key])) { - llwarns << "Cannot find sky [" << key.name << "] referenced by a day cycle" << llendl; + LL_WARNS() << "Cannot find sky [" << key.name << "] referenced by a day cycle" << LL_ENDL; result = false; } } @@ -192,7 +192,7 @@ bool LLWLDayCycle::getSkyMap(LLSD& sky_map) const void LLWLDayCycle::clearKeyframes() { - lldebugs << "Clearing key frames" << llendl; + LL_DEBUGS() << "Clearing key frames" << LL_ENDL; mTimeMap.clear(); } @@ -209,18 +209,18 @@ bool LLWLDayCycle::addKeyframe(F32 newTime, LLWLParamKey frame) if(mTimeMap.find(newTime) == mTimeMap.end()) { mTimeMap.insert(std::pair<F32, LLWLParamKey>(newTime, frame)); - lldebugs << "Adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << llendl; + LL_DEBUGS() << "Adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << LL_ENDL; return true; } // otherwise, don't add, and return error - llwarns << "Error adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << llendl; + LL_WARNS() << "Error adding key frame (" << newTime << ", " << frame.toLLSD() << ")" << LL_ENDL; return false; } bool LLWLDayCycle::changeKeyframeTime(F32 oldTime, F32 newTime) { - lldebugs << "Changing key frame time (" << oldTime << " => " << newTime << ")" << llendl; + LL_DEBUGS() << "Changing key frame time (" << oldTime << " => " << newTime << ")" << LL_ENDL; // just remove and add back LLWLParamKey frame = mTimeMap[oldTime]; @@ -228,7 +228,7 @@ bool LLWLDayCycle::changeKeyframeTime(F32 oldTime, F32 newTime) bool stat = removeKeyframe(oldTime); if(stat == false) { - lldebugs << "Failed to change key frame time (" << oldTime << " => " << newTime << ")" << llendl; + LL_DEBUGS() << "Failed to change key frame time (" << oldTime << " => " << newTime << ")" << LL_ENDL; return stat; } @@ -237,7 +237,7 @@ bool LLWLDayCycle::changeKeyframeTime(F32 oldTime, F32 newTime) bool LLWLDayCycle::changeKeyframeParam(F32 time, LLWLParamKey key) { - lldebugs << "Changing key frame param (" << time << ", " << key.toLLSD() << ")" << llendl; + LL_DEBUGS() << "Changing key frame param (" << time << ", " << key.toLLSD() << ")" << LL_ENDL; // just remove and add back // make sure param exists @@ -245,7 +245,7 @@ bool LLWLDayCycle::changeKeyframeParam(F32 time, LLWLParamKey key) bool stat = LLWLParamManager::getInstance()->getParamSet(key, tmp); if(stat == false) { - lldebugs << "Failed to change key frame param (" << time << ", " << key.toLLSD() << ")" << llendl; + LL_DEBUGS() << "Failed to change key frame param (" << time << ", " << key.toLLSD() << ")" << LL_ENDL; return stat; } @@ -256,7 +256,7 @@ bool LLWLDayCycle::changeKeyframeParam(F32 time, LLWLParamKey key) bool LLWLDayCycle::removeKeyframe(F32 time) { - lldebugs << "Removing key frame (" << time << ")" << llendl; + LL_DEBUGS() << "Removing key frame (" << time << ")" << LL_ENDL; // look for the time. If there, erase it std::map<F32, LLWLParamKey>::iterator mIt = mTimeMap.find(time); @@ -295,7 +295,7 @@ bool LLWLDayCycle::getKeyedParam(F32 time, LLWLParamSet& param) } // return error if not found - lldebugs << "Key " << time << " not found" << llendl; + LL_DEBUGS() << "Key " << time << " not found" << LL_ENDL; return false; } @@ -310,7 +310,7 @@ bool LLWLDayCycle::getKeyedParamName(F32 time, std::string & name) } // return error if not found - lldebugs << "Key " << time << " not found" << llendl; + LL_DEBUGS() << "Key " << time << " not found" << LL_ENDL; return false; } @@ -322,7 +322,7 @@ bool LLWLDayCycle::hasReferencesTo(const LLWLParamKey& keyframe) const void LLWLDayCycle::removeReferencesTo(const LLWLParamKey& keyframe) { - lldebugs << "Removing references to key frame " << keyframe.toLLSD() << llendl; + LL_DEBUGS() << "Removing references to key frame " << keyframe.toLLSD() << LL_ENDL; F32 keytime; bool might_exist; do diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index ce9f61c0afedcfcb42c059737ba88d64ba7fb1f7..91ea10d43d1e8e4e7f19560caff63f43b0450ffe 100755 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -128,12 +128,12 @@ void LLWLParamManager::clearParamSetsOfScope(LLWLParamKey::EScope scope) // side effect: applies changes to all internal structures! std::map<LLWLParamKey, LLWLParamSet> LLWLParamManager::finalizeFromDayCycle(LLWLParamKey::EScope scope) { - lldebugs << "mDay before finalizing:" << llendl; + LL_DEBUGS() << "mDay before finalizing:" << LL_ENDL; { for (std::map<F32, LLWLParamKey>::iterator iter = mDay.mTimeMap.begin(); iter != mDay.mTimeMap.end(); ++iter) { LLWLParamKey& key = iter->second; - lldebugs << iter->first << "->" << key.name << llendl; + LL_DEBUGS() << iter->first << "->" << key.name << LL_ENDL; } } @@ -219,12 +219,12 @@ std::map<LLWLParamKey, LLWLParamSet> LLWLParamManager::finalizeFromDayCycle(LLWL final_references[new_key] = iter->second; } - lldebugs << "mDay after finalizing:" << llendl; + LL_DEBUGS() << "mDay after finalizing:" << LL_ENDL; { for (std::map<F32, LLWLParamKey>::iterator iter = mDay.mTimeMap.begin(); iter != mDay.mTimeMap.end(); ++iter) { LLWLParamKey& key = iter->second; - lldebugs << iter->first << "->" << key.name << llendl; + LL_DEBUGS() << iter->first << "->" << key.name << LL_ENDL; } } @@ -272,7 +272,7 @@ void LLWLParamManager::loadAllPresets() void LLWLParamManager::loadPresetsFromDir(const std::string& dir) { - LL_INFOS2("AppInit", "Shaders") << "Loading sky presets from " << dir << LL_ENDL; + LL_INFOS("AppInit", "Shaders") << "Loading sky presets from " << dir << LL_ENDL; LLDirIterator dir_iter(dir, "*.xml"); while (1) @@ -286,7 +286,7 @@ void LLWLParamManager::loadPresetsFromDir(const std::string& dir) std::string path = gDirUtilp->add(dir, file); if (!loadPreset(path)) { - llwarns << "Error loading sky preset from " << path << llendl; + LL_WARNS() << "Error loading sky preset from " << path << LL_ENDL; } } } @@ -302,7 +302,7 @@ bool LLWLParamManager::loadPreset(const std::string& path) return false; } - LL_DEBUGS2("AppInit", "Shaders") << "Loading sky " << name << LL_ENDL; + LL_DEBUGS("AppInit", "Shaders") << "Loading sky " << name << LL_ENDL; LLSD params_data; LLPointer<LLSDParser> parser = new LLSDXMLParser(); @@ -364,11 +364,11 @@ void LLWLParamManager::updateShaderUniforms(LLGLSLShader * shader) } -static LLFastTimer::DeclareTimer FTM_UPDATE_WLPARAM("Update Windlight Params"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_WLPARAM("Update Windlight Params"); void LLWLParamManager::propagateParameters(void) { - LLFastTimer ftm(FTM_UPDATE_WLPARAM); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_WLPARAM); LLVector4 sunDir; LLVector4 moonDir; @@ -439,7 +439,7 @@ void LLWLParamManager::propagateParameters(void) void LLWLParamManager::update(LLViewerCamera * cam) { - LLFastTimer ftm(FTM_UPDATE_WLPARAM); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_WLPARAM); // update clouds, sun, and general mCurParams.updateCloudScrolling(); @@ -577,7 +577,7 @@ void LLWLParamManager::removeParamSet(const LLWLParamKey& key, bool delete_from_ if (key.scope == LLEnvKey::SCOPE_REGION) { - llwarns << "Removing region skies not supported" << llendl; + LL_WARNS() << "Removing region skies not supported" << LL_ENDL; llassert(key.scope == LLEnvKey::SCOPE_LOCAL); return; } @@ -677,7 +677,7 @@ void LLWLParamManager::initSingleton() if (!LLDayCycleManager::instance().getPreset(preferred_day, mDay)) { // Fall back to default. - llwarns << "No day cycle named " << preferred_day << ", falling back to defaults" << llendl; + LL_WARNS() << "No day cycle named " << preferred_day << ", falling back to defaults" << LL_ENDL; mDay.loadDayCycleFromFile("Default.xml"); // *TODO: Fix user preferences accordingly. @@ -687,7 +687,7 @@ void LLWLParamManager::initSingleton() std::string sky = LLEnvManagerNew::instance().getSkyPresetName(); if (!getParamSet(LLWLParamKey(sky, LLWLParamKey::SCOPE_LOCAL), mCurParams)) { - llwarns << "No sky preset named " << sky << ", falling back to defaults" << llendl; + LL_WARNS() << "No sky preset named " << sky << ", falling back to defaults" << LL_ENDL; getParamSet(LLWLParamKey("Default", LLWLParamKey::SCOPE_LOCAL), mCurParams); // *TODO: Fix user preferences accordingly. diff --git a/indra/newview/llwlparamset.cpp b/indra/newview/llwlparamset.cpp index 8529a4614b5e08698b9291882df9b32ca65128b8..066cb9a0ace352fa61aca7f4204323633b77d652 100755 --- a/indra/newview/llwlparamset.cpp +++ b/indra/newview/llwlparamset.cpp @@ -60,11 +60,11 @@ LLWLParamSet::LLWLParamSet(void) : mCloudScrollXOffset(0.f), mCloudScrollYOffset(0.f) {} -static LLFastTimer::DeclareTimer FTM_WL_PARAM_UPDATE("WL Param Update"); +static LLTrace::BlockTimerStatHandle FTM_WL_PARAM_UPDATE("WL Param Update"); void LLWLParamSet::update(LLGLSLShader * shader) const { - LLFastTimer t(FTM_WL_PARAM_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_WL_PARAM_UPDATE); LLSD::map_const_iterator i = mParamValues.beginMap(); std::vector<LLStaticHashedString>::const_iterator n = mParamHashedNames.begin(); for(;(i != mParamValues.endMap()) && (n != mParamHashedNames.end());++i, n++) diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 85614f397c02a3ee269bed82713f6b59378896df..1ef2cfff8a601a3d707e5698ad4b814b4c73bc9e 100755 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -55,7 +55,7 @@ #include "message.h" #include "pipeline.h" #include "llappviewer.h" // for do_disconnect() - +#include "llscenemonitor.h" #include <deque> #include <queue> #include <map> @@ -110,6 +110,7 @@ LLWorld::LLWorld() : gGL.getTexUnit(0)->bind(mDefaultWaterTexturep); mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); + LLViewerRegion::sVOCacheCullingEnabled = gSavedSettings.getBOOL("RequestFullRegionCache") && gSavedSettings.getBOOL("ObjectCacheEnabled"); } @@ -122,10 +123,7 @@ void LLWorld::destroyClass() LLViewerRegion* region_to_delete = *region_it++; removeRegion(region_to_delete->getHost()); } - if(LLVOCache::hasInstance()) - { - LLVOCache::getInstance()->destroyClass() ; - } + LLViewerPartSim::getInstance()->destroyClass(); mDefaultWaterTexturep = NULL ; @@ -133,12 +131,17 @@ void LLWorld::destroyClass() { mEdgeWaterObjects[i] = NULL; } + + //make all visible drawbles invisible. + LLDrawable::incrementVisible(); + + LLSceneMonitor::deleteSingleton(); } LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) { - llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl; + LL_INFOS() << "Add region with handle: " << region_handle << " on host " << host << LL_ENDL; LLViewerRegion *regionp = getRegionFromHandle(region_handle); std::string seedUrl; if (regionp) @@ -148,19 +151,19 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) if (host == old_host && regionp->isAlive()) { // This is a duplicate for the same host and it's alive, don't bother. - llinfos << "Region already exists and is alive, using existing region" << llendl; + LL_INFOS() << "Region already exists and is alive, using existing region" << LL_ENDL; return regionp; } if (host != old_host) { - llwarns << "LLWorld::addRegion exists, but old host " << old_host + LL_WARNS() << "LLWorld::addRegion exists, but old host " << old_host << " does not match new host " << host - << ", removing old region and creating new" << llendl; + << ", removing old region and creating new" << LL_ENDL; } if (!regionp->isAlive()) { - llwarns << "LLWorld::addRegion exists, but isn't alive. Removing old region and creating new" << llendl; + LL_WARNS() << "LLWorld::addRegion exists, but isn't alive. Removing old region and creating new" << LL_ENDL; } // Save capabilities seed URL @@ -172,7 +175,7 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) } else { - llinfos << "Region does not exist, creating new one" << llendl; + LL_INFOS() << "Region does not exist, creating new one" << LL_ENDL; } U32 iindex = 0; @@ -180,8 +183,8 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) from_region_handle(region_handle, &iindex, &jindex); S32 x = (S32)(iindex/mWidth); S32 y = (S32)(jindex/mWidth); - llinfos << "Adding new region (" << x << ":" << y << ")" - << " on host: " << host << llendl; + LL_INFOS() << "Adding new region (" << x << ":" << y << ")" + << " on host: " << host << LL_ENDL; LLVector3d origin_global; @@ -194,7 +197,7 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) getRegionWidthInMeters() ); if (!regionp) { - llerrs << "Unable to create new region!" << llendl; + LL_ERRS() << "Unable to create new region!" << LL_ENDL; } if ( !seedUrl.empty() ) @@ -232,7 +235,7 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) neighborp = getRegionFromHandle(adj_handle); if (neighborp) { - //llinfos << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << llendl; + //LL_INFOS() << "Connecting " << region_x << ":" << region_y << " -> " << adj_x << ":" << adj_y << LL_ENDL; regionp->connectNeighbor(neighborp, dir); } } @@ -250,7 +253,7 @@ void LLWorld::removeRegion(const LLHost &host) LLViewerRegion *regionp = getRegion(host); if (!regionp) { - llwarns << "Trying to remove region that doesn't exist!" << llendl; + LL_WARNS() << "Trying to remove region that doesn't exist!" << LL_ENDL; return; } @@ -260,21 +263,21 @@ void LLWorld::removeRegion(const LLHost &host) iter != mRegionList.end(); ++iter) { LLViewerRegion* reg = *iter; - llwarns << "RegionDump: " << reg->getName() + LL_WARNS() << "RegionDump: " << reg->getName() << " " << reg->getHost() << " " << reg->getOriginGlobal() - << llendl; + << LL_ENDL; } - llwarns << "Agent position global " << gAgent.getPositionGlobal() + LL_WARNS() << "Agent position global " << gAgent.getPositionGlobal() << " agent " << gAgent.getPositionAgent() - << llendl; + << LL_ENDL; - llwarns << "Regions visited " << gAgent.getRegionsVisited() << llendl; + LL_WARNS() << "Regions visited " << gAgent.getRegionsVisited() << LL_ENDL; - llwarns << "gFrameTimeSeconds " << gFrameTimeSeconds << llendl; + LL_WARNS() << "gFrameTimeSeconds " << gFrameTimeSeconds << LL_ENDL; - llwarns << "Disabling region " << regionp->getName() << " that agent is in!" << llendl; + LL_WARNS() << "Disabling region " << regionp->getName() << " that agent is in!" << LL_ENDL; LLAppViewer::instance()->forceDisconnect(LLTrans::getString("YouHaveBeenDisconnected")); regionp->saveObjectCache() ; //force to save objects here in case that the object cache is about to be destroyed. @@ -282,7 +285,7 @@ void LLWorld::removeRegion(const LLHost &host) } from_region_handle(regionp->getHandle(), &x, &y); - llinfos << "Removing region " << x << ":" << y << llendl; + LL_INFOS() << "Removing region " << x << ":" << y << LL_ENDL; mRegionList.remove(regionp); mActiveRegionList.remove(regionp); @@ -628,7 +631,8 @@ void LLWorld::updateVisibilities() if (part) { LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); - if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1])) + const LLVector4a* bounds = group->getBounds(); + if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1])) { mCulledRegionList.erase(curiter); mVisibleRegionList.push_back(regionp); @@ -651,7 +655,8 @@ void LLWorld::updateVisibilities() if (part) { LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); - if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1])) + const LLVector4a* bounds = group->getBounds(); + if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1])) { regionp->calculateCameraDistance(); regionp->getLand().updatePatchVisibilities(gAgent); @@ -670,24 +675,75 @@ void LLWorld::updateVisibilities() LLViewerCamera::getInstance()->setFar(cur_far_clip); } +static LLTrace::SampleStatHandle<> sNumActiveCachedObjects("numactivecachedobjects", "Number of objects loaded from cache"); + void LLWorld::updateRegions(F32 max_update_time) { LLTimer update_timer; - BOOL did_one = FALSE; + mNumOfActiveCachedObjects = 0; - // Perform idle time updates for the regions (and associated surfaces) + if(LLViewerCamera::getInstance()->isChanged()) + { + LLViewerRegion::sLastCameraUpdated = LLViewerOctreeEntryData::getCurrentFrame() + 1; + } + LLViewerRegion::calcNewObjectCreationThrottle(); + if(LLViewerRegion::isNewObjectCreationThrottleDisabled()) + { + max_update_time = llmax(max_update_time, 1.0f); //seconds, loosen the time throttle. + } + + F32 max_time = llmin((F32)(max_update_time - update_timer.getElapsedTimeF32()), max_update_time * 0.25f); + //update the self avatar region + LLViewerRegion* self_regionp = gAgent.getRegion(); + if(self_regionp) + { + self_regionp->idleUpdate(max_time); + } + + //sort regions by its mLastUpdate + //smaller mLastUpdate first to make sure every region has chance to get updated. + LLViewerRegion::region_priority_list_t region_list; for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter) { LLViewerRegion* regionp = *iter; - F32 max_time = max_update_time - update_timer.getElapsedTimeF32(); - if (did_one && max_time <= 0.f) - break; - max_time = llmin(max_time, max_update_time*.1f); - if (regionp->idleUpdate(max_update_time)) + if(regionp != self_regionp) { - did_one = TRUE; + region_list.insert(regionp); } + mNumOfActiveCachedObjects += regionp->getNumOfActiveCachedObjects(); + } + + // Perform idle time updates for the regions (and associated surfaces) + for (LLViewerRegion::region_priority_list_t::iterator iter = region_list.begin(); + iter != region_list.end(); ++iter) + { + if(max_time > 0.f) + { + max_time = llmin((F32)(max_update_time - update_timer.getElapsedTimeF32()), max_update_time * 0.25f); + } + + if(max_time > 0.f) + { + (*iter)->idleUpdate(max_time); + } + else + { + //perform some necessary but very light updates. + (*iter)->lightIdleUpdate(); + } + } + + sample(sNumActiveCachedObjects, mNumOfActiveCachedObjects); + } + +void LLWorld::clearAllVisibleObjects() +{ + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) + { + //clear all cached visible objects. + (*iter)->clearCachedVisibleObjects(); } } @@ -713,7 +769,7 @@ void LLWorld::renderPropertyLines() void LLWorld::updateNetStats() { - F32 bits = 0.f; + F64Bits bits; U32 packets = 0; for (region_list_t::iterator iter = mActiveRegionList.begin(); @@ -721,29 +777,28 @@ void LLWorld::updateNetStats() { LLViewerRegion* regionp = *iter; regionp->updateNetStats(); - bits += regionp->mBitStat.getCurrent(); - packets += llfloor( regionp->mPacketsStat.getCurrent() ); + bits += regionp->mBitsReceived; + packets += llfloor( regionp->mPacketsReceived ); + regionp->mBitsReceived = (F32Bits)0.f; + regionp->mPacketsReceived = 0.f; } S32 packets_in = gMessageSystem->mPacketsIn - mLastPacketsIn; S32 packets_out = gMessageSystem->mPacketsOut - mLastPacketsOut; S32 packets_lost = gMessageSystem->mDroppedPackets - mLastPacketsLost; - S32 actual_in_bits = gMessageSystem->mPacketRing.getAndResetActualInBits(); - S32 actual_out_bits = gMessageSystem->mPacketRing.getAndResetActualOutBits(); - LLViewerStats::getInstance()->mActualInKBitStat.addValue(actual_in_bits/1024.f); - LLViewerStats::getInstance()->mActualOutKBitStat.addValue(actual_out_bits/1024.f); - LLViewerStats::getInstance()->mKBitStat.addValue(bits/1024.f); - LLViewerStats::getInstance()->mPacketsInStat.addValue(packets_in); - LLViewerStats::getInstance()->mPacketsOutStat.addValue(packets_out); - LLViewerStats::getInstance()->mPacketsLostStat.addValue(gMessageSystem->mDroppedPackets); + F64Bits actual_in_bits(gMessageSystem->mPacketRing.getAndResetActualInBits()); + F64Bits actual_out_bits(gMessageSystem->mPacketRing.getAndResetActualOutBits()); + + add(LLStatViewer::MESSAGE_SYSTEM_DATA_IN, actual_in_bits); + add(LLStatViewer::MESSAGE_SYSTEM_DATA_OUT, actual_out_bits); + add(LLStatViewer::ACTIVE_MESSAGE_DATA_RECEIVED, bits); + add(LLStatViewer::PACKETS_IN, packets_in); + add(LLStatViewer::PACKETS_OUT, packets_out); + add(LLStatViewer::PACKETS_LOST, packets_lost); if (packets_in) { - LLViewerStats::getInstance()->mPacketsLostPercentStat.addValue(100.f*((F32)packets_lost/(F32)packets_in)); - } - else - { - LLViewerStats::getInstance()->mPacketsLostPercentStat.addValue(0.f); + sample(LLStatViewer::PACKETS_LOST_PERCENT, LLUnits::Ratio::fromValue((F32)packets_lost/(F32)packets_in)); } mLastPacketsIn = gMessageSystem->mPacketsIn; @@ -754,8 +809,8 @@ void LLWorld::updateNetStats() void LLWorld::printPacketsLost() { - llinfos << "Simulators:" << llendl; - llinfos << "----------" << llendl; + LL_INFOS() << "Simulators:" << LL_ENDL; + LL_INFOS() << "----------" << LL_ENDL; LLCircuitData *cdp = NULL; for (region_list_t::iterator iter = mActiveRegionList.begin(); @@ -767,8 +822,8 @@ void LLWorld::printPacketsLost() { LLVector3d range = regionp->getCenterGlobal() - gAgent.getPositionGlobal(); - llinfos << regionp->getHost() << ", range: " << range.length() - << " packets lost: " << cdp->getPacketsLost() << llendl; + LL_INFOS() << regionp->getHost() << ", range: " << range.length() + << " packets lost: " << cdp->getPacketsLost() << LL_ENDL; } } } @@ -824,7 +879,7 @@ void LLWorld::updateWaterObjects() } if (mRegionList.empty()) { - llwarns << "No regions!" << llendl; + LL_WARNS() << "No regions!" << LL_ENDL; return; } @@ -974,12 +1029,12 @@ LLViewerTexture* LLWorld::getDefaultWaterTexture() return mDefaultWaterTexturep; } -void LLWorld::setSpaceTimeUSec(const U64 space_time_usec) +void LLWorld::setSpaceTimeUSec(const U64MicrosecondsImplicit space_time_usec) { mSpaceTimeUSec = space_time_usec; } -U64 LLWorld::getSpaceTimeUSec() const +U64MicrosecondsImplicit LLWorld::getSpaceTimeUSec() const { return mSpaceTimeUSec; } @@ -1019,7 +1074,7 @@ void LLWorld::disconnectRegions() continue; } - llinfos << "Sending AgentQuitCopy to: " << regionp->getHost() << llendl; + LL_INFOS() << "Sending AgentQuitCopy to: " << regionp->getHost() << LL_ENDL; msg->newMessageFast(_PREHASH_AgentQuitCopy); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -1030,11 +1085,11 @@ void LLWorld::disconnectRegions() } } -static LLFastTimer::DeclareTimer FTM_ENABLE_SIMULATOR("Enable Sim"); +static LLTrace::BlockTimerStatHandle FTM_ENABLE_SIMULATOR("Enable Sim"); void process_enable_simulator(LLMessageSystem *msg, void **user_data) { - LLFastTimer t(FTM_ENABLE_SIMULATOR); + LL_RECORD_BLOCK_TIME(FTM_ENABLE_SIMULATOR); // enable the appropriate circuit for this simulator and // add its values into the gSimulator structure U64 handle; @@ -1053,7 +1108,7 @@ void process_enable_simulator(LLMessageSystem *msg, void **user_data) LLWorld::getInstance()->addRegion(handle, sim); // give the simulator a message it can use to get ip and port - llinfos << "simulator_enable() Enabling " << sim << " with code " << msg->getOurCircuitCode() << llendl; + LL_INFOS() << "simulator_enable() Enabling " << sim << " with code " << msg->getOurCircuitCode() << LL_ENDL; msg->newMessageFast(_PREHASH_UseCircuitCode); msg->nextBlockFast(_PREHASH_CircuitCode); msg->addU32Fast(_PREHASH_Code, msg->getOurCircuitCode()); @@ -1081,7 +1136,7 @@ class LLEstablishAgentCommunication : public LLHTTPNode !input["body"].has("sim-ip-and-port") || !input["body"].has("seed-capability")) { - llwarns << "invalid parameters" << llendl; + LL_WARNS() << "invalid parameters" << LL_ENDL; return; } @@ -1090,8 +1145,8 @@ class LLEstablishAgentCommunication : public LLHTTPNode LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(sim); if (!regionp) { - llwarns << "Got EstablishAgentCommunication for unknown region " - << sim << llendl; + LL_WARNS() << "Got EstablishAgentCommunication for unknown region " + << sim << LL_ENDL; return; } regionp->setSeedCapability(input["body"]["seed-capability"]); @@ -1104,7 +1159,7 @@ void process_disable_simulator(LLMessageSystem *mesgsys, void **user_data) { LLHost host = mesgsys->getSender(); - //llinfos << "Disabling simulator with message from " << host << llendl; + //LL_INFOS() << "Disabling simulator with message from " << host << LL_ENDL; LLWorld::getInstance()->removeRegion(host); mesgsys->disableCircuit(host); @@ -1117,8 +1172,8 @@ void process_region_handshake(LLMessageSystem* msg, void** user_data) LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(host); if (!regionp) { - llwarns << "Got region handshake for unknown region " - << host << llendl; + LL_WARNS() << "Got region handshake for unknown region " + << host << LL_ENDL; return; } @@ -1156,6 +1211,7 @@ void send_agent_pause() } gObjectList.mWasPaused = TRUE; + LLViewerStats::instance().getRecording().stop(); } @@ -1185,8 +1241,8 @@ void send_agent_resume() gMessageSystem->sendReliable(regionp->getHost()); } - // Reset the FPS counter to avoid an invalid fps - LLViewerStats::getInstance()->mFPSStat.start(); + // Resume data collection to ignore invalid rates + LLViewerStats::instance().getRecording().resume(); LLAppViewer::instance()->resumeMainloopTimeout(); } @@ -1246,13 +1302,13 @@ void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positi { LLViewerRegion* regionp = *iter; const LLVector3d& origin_global = regionp->getOriginGlobal(); - S32 count = regionp->mMapAvatars.count(); + S32 count = regionp->mMapAvatars.size(); for (S32 i = 0; i < count; i++) { - LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global); + LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.at(i), origin_global); if(dist_vec_squared(pos_global, relative_to) <= radius_squared) { - LLUUID uuid = regionp->mMapAvatarIDs.get(i); + LLUUID uuid = regionp->mMapAvatarIDs.at(i); // if this avatar doesn't already exist in the list, add it if(uuid.notNull() && avatar_ids != NULL && std::find(avatar_ids->begin(), avatar_ids->end(), uuid) == avatar_ids->end()) { diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index d0b001ba443fef1022ae957ace3144d2923e7c5e..b2d84180648ddfadc41c3ce0185f9354153451d8 100755 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -141,11 +141,13 @@ class LLWorld : public LLSingleton<LLWorld> void waterHeightRegionInfo(std::string const& sim_name, F32 water_height); void shiftRegions(const LLVector3& offset); - void setSpaceTimeUSec(const U64 space_time_usec); - U64 getSpaceTimeUSec() const; + void setSpaceTimeUSec(const U64MicrosecondsImplicit space_time_usec); + U64MicrosecondsImplicit getSpaceTimeUSec() const; void getInfo(LLSD& info); + U32 getNumOfActiveCachedObjects() const {return mNumOfActiveCachedObjects;} + void clearAllVisibleObjects(); public: typedef std::list<LLViewerRegion*> region_list_t; const region_list_t& getRegionList() const { return mActiveRegionList; } @@ -187,8 +189,8 @@ class LLWorld : public LLSingleton<LLWorld> S32 mLastPacketsIn; S32 mLastPacketsOut; S32 mLastPacketsLost; - - U64 mSpaceTimeUSec; + U32 mNumOfActiveCachedObjects; + U64MicrosecondsImplicit mSpaceTimeUSec; BOOL mClassicCloudsEnabled; diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index d514b2f14c3eafd5c6291a59f68536f27cac3a52..1a168e4b4d4f76ee6d25499d00d45491e2c5085a 100755 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -38,6 +38,18 @@ #include "llviewertexture.h" #include "llgltexture.h" +// map item types +const U32 MAP_ITEM_TELEHUB = 0x01; +const U32 MAP_ITEM_PG_EVENT = 0x02; +const U32 MAP_ITEM_MATURE_EVENT = 0x03; +//const U32 MAP_ITEM_POPULAR = 0x04; // No longer supported, 2009-03-02 KLW +//const U32 MAP_ITEM_AGENT_COUNT = 0x05; +const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06; +const U32 MAP_ITEM_LAND_FOR_SALE = 0x07; +const U32 MAP_ITEM_CLASSIFIED = 0x08; +const U32 MAP_ITEM_ADULT_EVENT = 0x09; +const U32 MAP_ITEM_LAND_FOR_SALE_ADULT = 0x0a; + // Description of objects like hubs, events, land for sale, people and more (TBD). // Note: we don't store a "type" in there so we need to store instances of this class in // well known objects (i.e. list of objects which type is "well known"). diff --git a/indra/newview/llworldmapmessage.cpp b/indra/newview/llworldmapmessage.cpp index 8307d323362b8348026a7fbbafb21f0af216b0c6..865292fa90f38eeec1e09c054329577a0cefd710 100755 --- a/indra/newview/llworldmapmessage.cpp +++ b/indra/newview/llworldmapmessage.cpp @@ -156,7 +156,7 @@ void LLWorldMapMessage::processMapBlockReply(LLMessageSystem* msg, void**) // There's only one flag that we ever use here if (agent_flags != LAYER_FLAG) { - llwarns << "Invalid map image type returned! layer = " << agent_flags << llendl; + LL_WARNS() << "Invalid map image type returned! layer = " << agent_flags << LL_ENDL; return; } diff --git a/indra/newview/llworldmapmessage.h b/indra/newview/llworldmapmessage.h index 12b6ef47920d57748f98d72aaa09a0418983dc4c..ac1ea1607c793d6370d3f3e95cd4f414c9889a26 100755 --- a/indra/newview/llworldmapmessage.h +++ b/indra/newview/llworldmapmessage.h @@ -27,6 +27,8 @@ #ifndef LL_LLWORLDMAPMESSAGE_H #define LL_LLWORLDMAPMESSAGE_H +#include "boost/function.hpp" + // Handling of messages (send and process) as well as SLURL callback if necessary class LLMessageSystem; diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 786e4f2de632507fe18f45f1826a7a5d60eca0f4..a770352f86dc8bbbb624583903f19943639fadd1 100755 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -302,8 +302,8 @@ void LLWorldMapView::draw() mVisibleRegions.clear(); // animate pan if necessary - sPanX = lerp(sPanX, sTargetPanX, LLCriticalDamp::getInterpolant(0.1f)); - sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(0.1f)); + sPanX = lerp(sPanX, sTargetPanX, LLSmoothInterpolation::getInterpolant(0.1f)); + sPanY = lerp(sPanY, sTargetPanY, LLSmoothInterpolation::getInterpolant(0.1f)); const S32 width = getRect().getWidth(); const S32 height = getRect().getHeight(); @@ -1713,7 +1713,7 @@ BOOL LLWorldMapView::handleHover( S32 x, S32 y, MASK mask ) { gViewerWindow->setCursor( UI_CURSOR_CROSS ); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLWorldMapView" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLWorldMapView" << LL_ENDL; return TRUE; } } diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 0da70d398b06ca0b35e50a7c40cc737b3efa1491..8e164337b657d76ae0b1c239dc09b91f9fb8f41b 100755 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -25,6 +25,8 @@ */ #include "llviewerprecompiledheaders.h" +// include this to get winsock2 because openssl attempts to include winsock1 +#include "llwin32headerslean.h" #include <openssl/x509_vfy.h> #include <openssl/ssl.h> #include "llsecapi.h" @@ -307,7 +309,7 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) } if(!mCurlRequest->isValid()) { - llwarns << "mCurlRequest is invalid." << llendl ; + LL_WARNS() << "mCurlRequest is invalid." << LL_ENDL ; delete mCurlRequest ; mCurlRequest = NULL ; @@ -373,7 +375,7 @@ bool LLXMLRPCTransaction::Impl::process() { if(!mCurlRequest || !mCurlRequest->isValid()) { - llwarns << "transaction failed." << llendl ; + LL_WARNS() << "transaction failed." << LL_ENDL ; delete mCurlRequest ; mCurlRequest = NULL ; @@ -423,10 +425,10 @@ bool LLXMLRPCTransaction::Impl::process() // appropriate setCurlStatus(result); - llwarns << "LLXMLRPCTransaction CURL error " - << mCurlCode << ": " << mCurlRequest->getErrorString() << llendl; - llwarns << "LLXMLRPCTransaction request URI: " - << mURI << llendl; + LL_WARNS() << "LLXMLRPCTransaction CURL error " + << mCurlCode << ": " << mCurlRequest->getErrorString() << LL_ENDL; + LL_WARNS() << "LLXMLRPCTransaction request URI: " + << mURI << LL_ENDL; } return true; @@ -460,12 +462,12 @@ bool LLXMLRPCTransaction::Impl::process() { setStatus(LLXMLRPCTransaction::StatusXMLRPCError); - llwarns << "LLXMLRPCTransaction XMLRPC " + LL_WARNS() << "LLXMLRPCTransaction XMLRPC " << (hasError ? "error " : "fault ") << faultCode << ": " - << faultString << llendl; - llwarns << "LLXMLRPCTransaction request URI: " - << mURI << llendl; + << faultString << LL_ENDL; + LL_WARNS() << "LLXMLRPCTransaction request URI: " + << mURI << LL_ENDL; } return true; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 5da8a78b1b423ed43a30dc6e4007364297a4d64e..21ccec5c0a333d14f2ee7899ca4bd7dd159f6f93 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -30,7 +30,6 @@ // library includes #include "llaudioengine.h" // For debugging. -#include "imageids.h" #include "llerror.h" #include "llviewercontrol.h" #include "llfasttimer.h" @@ -40,7 +39,6 @@ #include "llprimitive.h" #include "llvolume.h" #include "material_codes.h" -#include "timing.h" #include "v3color.h" #include "llui.h" #include "llglheaders.h" @@ -87,6 +85,7 @@ #include "llviewerregion.h" // for audio debugging. #include "llviewerwindow.h" // For getSpinAxis #include "llvoavatarself.h" +#include "llvocache.h" #include "llvoground.h" #include "llvosky.h" #include "llvotree.h" @@ -114,6 +113,8 @@ #include "llfloatertools.h" #include "llpanelface.h" #include "llpathfindingpathtool.h" +#include "llscenemonitor.h" +#include "llprogressview.h" #ifdef _DEBUG // Debug indices is disabled for now for debug performance - djs 4/24/02 @@ -204,6 +205,7 @@ BOOL LLPipeline::CameraOffset; F32 LLPipeline::CameraMaxCoF; F32 LLPipeline::CameraDoFResScale; F32 LLPipeline::RenderAutoHideSurfaceAreaLimit; +LLTrace::EventStatHandle<S64> LLPipeline::sStatBatchSize("renderbatchsize"); const F32 BACKLIGHT_DAY_MAGNITUDE_AVATAR = 0.2f; const F32 BACKLIGHT_NIGHT_MAGNITUDE_AVATAR = 0.1f; @@ -226,40 +228,40 @@ BOOL gDebugPipeline = FALSE; LLPipeline gPipeline; const LLMatrix4* gGLLastMatrix = NULL; -LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY("Render Geometry"); -LLFastTimer::DeclareTimer FTM_RENDER_GRASS("Grass"); -LLFastTimer::DeclareTimer FTM_RENDER_INVISIBLE("Invisible"); -LLFastTimer::DeclareTimer FTM_RENDER_OCCLUSION("Occlusion"); -LLFastTimer::DeclareTimer FTM_RENDER_SHINY("Shiny"); -LLFastTimer::DeclareTimer FTM_RENDER_SIMPLE("Simple"); -LLFastTimer::DeclareTimer FTM_RENDER_TERRAIN("Terrain"); -LLFastTimer::DeclareTimer FTM_RENDER_TREES("Trees"); -LLFastTimer::DeclareTimer FTM_RENDER_UI("UI"); -LLFastTimer::DeclareTimer FTM_RENDER_WATER("Water"); -LLFastTimer::DeclareTimer FTM_RENDER_WL_SKY("Windlight Sky"); -LLFastTimer::DeclareTimer FTM_RENDER_ALPHA("Alpha Objects"); -LLFastTimer::DeclareTimer FTM_RENDER_CHARACTERS("Avatars"); -LLFastTimer::DeclareTimer FTM_RENDER_BUMP("Bump"); -LLFastTimer::DeclareTimer FTM_RENDER_MATERIALS("Materials"); -LLFastTimer::DeclareTimer FTM_RENDER_FULLBRIGHT("Fullbright"); -LLFastTimer::DeclareTimer FTM_RENDER_GLOW("Glow"); -LLFastTimer::DeclareTimer FTM_GEO_UPDATE("Geo Update"); -LLFastTimer::DeclareTimer FTM_PIPELINE_CREATE("Pipeline Create"); -LLFastTimer::DeclareTimer FTM_POOLRENDER("RenderPool"); -LLFastTimer::DeclareTimer FTM_POOLS("Pools"); -LLFastTimer::DeclareTimer FTM_DEFERRED_POOLRENDER("RenderPool (Deferred)"); -LLFastTimer::DeclareTimer FTM_DEFERRED_POOLS("Pools (Deferred)"); -LLFastTimer::DeclareTimer FTM_POST_DEFERRED_POOLRENDER("RenderPool (Post)"); -LLFastTimer::DeclareTimer FTM_POST_DEFERRED_POOLS("Pools (Post)"); -LLFastTimer::DeclareTimer FTM_RENDER_BLOOM_FBO("First FBO"); -LLFastTimer::DeclareTimer FTM_STATESORT("Sort Draw State"); -LLFastTimer::DeclareTimer FTM_PIPELINE("Pipeline"); -LLFastTimer::DeclareTimer FTM_CLIENT_COPY("Client Copy"); -LLFastTimer::DeclareTimer FTM_RENDER_DEFERRED("Deferred Shading"); - - -static LLFastTimer::DeclareTimer FTM_STATESORT_DRAWABLE("Sort Drawables"); -static LLFastTimer::DeclareTimer FTM_STATESORT_POSTSORT("Post Sort"); +LLTrace::BlockTimerStatHandle FTM_RENDER_GEOMETRY("Render Geometry"); +LLTrace::BlockTimerStatHandle FTM_RENDER_GRASS("Grass"); +LLTrace::BlockTimerStatHandle FTM_RENDER_INVISIBLE("Invisible"); +LLTrace::BlockTimerStatHandle FTM_RENDER_OCCLUSION("Occlusion"); +LLTrace::BlockTimerStatHandle FTM_RENDER_SHINY("Shiny"); +LLTrace::BlockTimerStatHandle FTM_RENDER_SIMPLE("Simple"); +LLTrace::BlockTimerStatHandle FTM_RENDER_TERRAIN("Terrain"); +LLTrace::BlockTimerStatHandle FTM_RENDER_TREES("Trees"); +LLTrace::BlockTimerStatHandle FTM_RENDER_UI("UI"); +LLTrace::BlockTimerStatHandle FTM_RENDER_WATER("Water"); +LLTrace::BlockTimerStatHandle FTM_RENDER_WL_SKY("Windlight Sky"); +LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA("Alpha Objects"); +LLTrace::BlockTimerStatHandle FTM_RENDER_CHARACTERS("Avatars"); +LLTrace::BlockTimerStatHandle FTM_RENDER_BUMP("Bump"); +LLTrace::BlockTimerStatHandle FTM_RENDER_MATERIALS("Render Materials"); +LLTrace::BlockTimerStatHandle FTM_RENDER_FULLBRIGHT("Fullbright"); +LLTrace::BlockTimerStatHandle FTM_RENDER_GLOW("Glow"); +LLTrace::BlockTimerStatHandle FTM_GEO_UPDATE("Geo Update"); +LLTrace::BlockTimerStatHandle FTM_PIPELINE_CREATE("Pipeline Create"); +LLTrace::BlockTimerStatHandle FTM_POOLRENDER("RenderPool"); +LLTrace::BlockTimerStatHandle FTM_POOLS("Pools"); +LLTrace::BlockTimerStatHandle FTM_DEFERRED_POOLRENDER("RenderPool (Deferred)"); +LLTrace::BlockTimerStatHandle FTM_DEFERRED_POOLS("Pools (Deferred)"); +LLTrace::BlockTimerStatHandle FTM_POST_DEFERRED_POOLRENDER("RenderPool (Post)"); +LLTrace::BlockTimerStatHandle FTM_POST_DEFERRED_POOLS("Pools (Post)"); +LLTrace::BlockTimerStatHandle FTM_RENDER_BLOOM_FBO("First FBO"); +LLTrace::BlockTimerStatHandle FTM_STATESORT("Sort Draw State"); +LLTrace::BlockTimerStatHandle FTM_PIPELINE("Pipeline"); +LLTrace::BlockTimerStatHandle FTM_CLIENT_COPY("Client Copy"); +LLTrace::BlockTimerStatHandle FTM_RENDER_DEFERRED("Deferred Shading"); + + +static LLTrace::BlockTimerStatHandle FTM_STATESORT_DRAWABLE("Sort Drawables"); +static LLTrace::BlockTimerStatHandle FTM_STATESORT_POSTSORT("Post Sort"); static LLStaticHashedString sTint("tint"); static LLStaticHashedString sAmbiance("ambiance"); @@ -429,17 +431,9 @@ bool addDeferredAttachments(LLRenderTarget& target) LLPipeline::LLPipeline() : mBackfaceCull(FALSE), - mBatchCount(0), mMatrixOpCount(0), mTextureMatrixOps(0), - mMaxBatchSize(0), - mMinBatchSize(0), - mMeanBatchSize(0), - mTrianglesDrawn(0), mNumVisibleNodes(0), - mVerticesRelit(0), - mLightingChanges(0), - mGeometryChanges(0), mNumVisibleFaces(0), mInitialized(FALSE), @@ -485,7 +479,7 @@ void LLPipeline::connectRefreshCachedSettingsSafe(const std::string name) LLPointer<LLControlVariable> cntrl_ptr = gSavedSettings.getControl(name); if ( cntrl_ptr.isNull() ) { - llwarns << "Global setting name not found:" << name << llendl; + LL_WARNS() << "Global setting name not found:" << name << LL_ENDL; } else { @@ -523,7 +517,6 @@ void LLPipeline::init() getPool(LLDrawPool::POOL_MATERIALS); getPool(LLDrawPool::POOL_GLOW); - LLViewerStats::getInstance()->mTrianglesDrawnStat.reset(); resetFrameStats(); if (gSavedSettings.getBOOL("DisableAllRenderFeatures")) @@ -709,11 +702,11 @@ void LLPipeline::cleanup() if (!mTerrainPools.empty()) { - llwarns << "Terrain Pools not cleaned up" << llendl; + LL_WARNS() << "Terrain Pools not cleaned up" << LL_ENDL; } if (!mTreePools.empty()) { - llwarns << "Tree Pools not cleaned up" << llendl; + LL_WARNS() << "Tree Pools not cleaned up" << LL_ENDL; } delete mAlphaPool; @@ -779,7 +772,7 @@ void LLPipeline::destroyGL() } } -static LLFastTimer::DeclareTimer FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture"); +static LLTrace::BlockTimerStatHandle FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture"); //static void LLPipeline::throttleNewMemoryAllocation(BOOL disable) @@ -801,7 +794,7 @@ void LLPipeline::throttleNewMemoryAllocation(BOOL disable) void LLPipeline::resizeScreenTexture() { - LLFastTimer ft(FTM_RESIZE_SCREEN_TEXTURE); + LL_RECORD_BLOCK_TIME(FTM_RESIZE_SCREEN_TEXTURE); if (gPipeline.canUseVertexShaders() && assertInitialized()) { GLuint resX = gViewerWindow->getWorldViewWidthRaw(); @@ -922,7 +915,7 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY) releaseScreenBuffers(); } - llwarns << "Unable to allocate screen buffer at any resolution!" << llendl; + LL_WARNS() << "Unable to allocate screen buffer at any resolution!" << LL_ENDL; } return ret; @@ -964,7 +957,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (!mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; if (!mOcclusionDepth.allocate(resX/occlusion_divisor, resY/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false; if (!addDeferredAttachments(mDeferredScreen)) return false; - + GLuint screenFormat = GL_RGBA16; if (gGLManager.mIsATI) { @@ -1083,7 +1076,7 @@ void LLPipeline::updateRenderDeferred() { BOOL deferred = ((RenderDeferred && LLRenderTarget::sUseFBO && - LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && + LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && LLPipeline::sRenderBump && VertexShaderEnable && RenderAvatarVP && @@ -1300,7 +1293,7 @@ void LLPipeline::createGLBuffers() for (U32 i = 0; i < 3; i++) { - mGlow[i].allocate(512,glow_res, GL_RGBA,FALSE,FALSE); + mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE,FALSE); } allocateScreenBuffer(resX,resY); @@ -1537,7 +1530,7 @@ void LLPipeline::unloadShaders() void LLPipeline::assertInitializedDoError() { - llerrs << "LLPipeline used when uninitialized." << llendl; + LL_ERRS() << "LLPipeline used when uninitialized." << LL_ENDL; } //============================================================================ @@ -1580,18 +1573,18 @@ S32 LLPipeline::setLightingDetail(S32 level) return mLightingDetail; } -class LLOctreeDirtyTexture : public LLOctreeTraveler<LLDrawable> +class LLOctreeDirtyTexture : public OctreeTraveler { public: const std::set<LLViewerFetchedTexture*>& mTextures; LLOctreeDirtyTexture(const std::set<LLViewerFetchedTexture*>& textures) : mTextures(textures) { } - virtual void visit(const LLOctreeNode<LLDrawable>* node) + virtual void visit(const OctreeNode* node) { LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); - if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty()) + if (!group->hasState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty()) { for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i) { @@ -1722,7 +1715,7 @@ LLDrawPool *LLPipeline::findPool(const U32 type, LLViewerTexture *tex0) default: llassert(0); - llerrs << "Invalid Pool Type in LLPipeline::findPool() type=" << type << llendl; + LL_ERRS() << "Invalid Pool Type in LLPipeline::findPool() type=" << type << LL_ENDL; break; } @@ -1768,7 +1761,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima { alpha = alpha || (imagep->getComponents() == 4 && imagep->getType() != LLViewerTexture::MEDIA_TEXTURE) || (imagep->getComponents() == 2); } - + if (alpha && mat) { switch (mat->getDiffuseAlphaMode()) @@ -1814,11 +1807,9 @@ void LLPipeline::addPool(LLDrawPool *new_poolp) void LLPipeline::allocDrawable(LLViewerObject *vobj) { - LLDrawable *drawable = new LLDrawable(); + LLDrawable *drawable = new LLDrawable(vobj); vobj->mDrawable = drawable; - drawable->mVObjp = vobj; - //encompass completely sheared objects by taking //the most extreme point possible (<1,1,0.5>) drawable->setRadius(LLVector3(1,1,0.5f).scaleVec(vobj->getScale()).length()); @@ -1830,15 +1821,15 @@ void LLPipeline::allocDrawable(LLViewerObject *vobj) } -static LLFastTimer::DeclareTimer FTM_UNLINK("Unlink"); -static LLFastTimer::DeclareTimer FTM_REMOVE_FROM_MOVE_LIST("Movelist"); -static LLFastTimer::DeclareTimer FTM_REMOVE_FROM_SPATIAL_PARTITION("Spatial Partition"); -static LLFastTimer::DeclareTimer FTM_REMOVE_FROM_LIGHT_SET("Light Set"); -static LLFastTimer::DeclareTimer FTM_REMOVE_FROM_HIGHLIGHT_SET("Highlight Set"); +static LLTrace::BlockTimerStatHandle FTM_UNLINK("Unlink"); +static LLTrace::BlockTimerStatHandle FTM_REMOVE_FROM_MOVE_LIST("Movelist"); +static LLTrace::BlockTimerStatHandle FTM_REMOVE_FROM_SPATIAL_PARTITION("Spatial Partition"); +static LLTrace::BlockTimerStatHandle FTM_REMOVE_FROM_LIGHT_SET("Light Set"); +static LLTrace::BlockTimerStatHandle FTM_REMOVE_FROM_HIGHLIGHT_SET("Highlight Set"); void LLPipeline::unlinkDrawable(LLDrawable *drawable) { - LLFastTimer t(FTM_UNLINK); + LL_RECORD_BLOCK_TIME(FTM_UNLINK); assertInitialized(); @@ -1847,7 +1838,7 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable) // Based on flags, remove the drawable from the queues that it's on. if (drawablep->isState(LLDrawable::ON_MOVE_LIST)) { - LLFastTimer t(FTM_REMOVE_FROM_MOVE_LIST); + LL_RECORD_BLOCK_TIME(FTM_REMOVE_FROM_MOVE_LIST); LLDrawable::drawable_vector_t::iterator iter = std::find(mMovedList.begin(), mMovedList.end(), drawablep); if (iter != mMovedList.end()) { @@ -1857,19 +1848,19 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable) if (drawablep->getSpatialGroup()) { - LLFastTimer t(FTM_REMOVE_FROM_SPATIAL_PARTITION); - if (!drawablep->getSpatialGroup()->mSpatialPartition->remove(drawablep, drawablep->getSpatialGroup())) + LL_RECORD_BLOCK_TIME(FTM_REMOVE_FROM_SPATIAL_PARTITION); + if (!drawablep->getSpatialGroup()->getSpatialPartition()->remove(drawablep, drawablep->getSpatialGroup())) { #ifdef LL_RELEASE_FOR_DOWNLOAD - llwarns << "Couldn't remove object from spatial group!" << llendl; + LL_WARNS() << "Couldn't remove object from spatial group!" << LL_ENDL; #else - llerrs << "Couldn't remove object from spatial group!" << llendl; + LL_ERRS() << "Couldn't remove object from spatial group!" << LL_ENDL; #endif } } { - LLFastTimer t(FTM_REMOVE_FROM_LIGHT_SET); + LL_RECORD_BLOCK_TIME(FTM_REMOVE_FROM_LIGHT_SET); mLights.erase(drawablep); for (light_set_t::iterator iter = mNearbyLights.begin(); @@ -1884,7 +1875,7 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable) } { - LLFastTimer t(FTM_REMOVE_FROM_HIGHLIGHT_SET); + LL_RECORD_BLOCK_TIME(FTM_REMOVE_FROM_HIGHLIGHT_SET); HighlightItem item(drawablep); mHighlightSet.erase(item); @@ -1913,7 +1904,7 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable) //static void LLPipeline::removeMutedAVsLights(LLVOAvatar* muted_avatar) { - LLFastTimer t(FTM_REMOVE_FROM_LIGHT_SET); + LL_RECORD_BLOCK_TIME(FTM_REMOVE_FROM_LIGHT_SET); for (light_set_t::iterator iter = gPipeline.mNearbyLights.begin(); iter != gPipeline.mNearbyLights.end(); iter++) { @@ -1941,7 +1932,7 @@ U32 LLPipeline::addObject(LLViewerObject *vobj) void LLPipeline::createObjects(F32 max_dtime) { - LLFastTimer ftm(FTM_PIPELINE_CREATE); + LL_RECORD_BLOCK_TIME(FTM_PIPELINE_CREATE); LLTimer update_timer; @@ -1973,7 +1964,7 @@ void LLPipeline::createObject(LLViewerObject* vobj) } else { - llerrs << "Redundant drawable creation!" << llendl; + LL_ERRS() << "Redundant drawable creation!" << LL_ENDL; } llassert(drawablep); @@ -2004,17 +1995,7 @@ void LLPipeline::resetFrameStats() { assertInitialized(); - LLViewerStats::getInstance()->mTrianglesDrawnStat.addValue(mTrianglesDrawn/1000.f); - - if (mBatchCount > 0) - { - mMeanBatchSize = gPipeline.mTrianglesDrawn/gPipeline.mBatchCount; - } - mTrianglesDrawn = 0; sCompiles = 0; - mVerticesRelit = 0; - mLightingChanges = 0; - mGeometryChanges = 0; mNumVisibleFaces = 0; if (mOldRenderDebugMask != mRenderDebugMask) @@ -2022,7 +2003,6 @@ void LLPipeline::resetFrameStats() gObjectList.clearDebugText(); mOldRenderDebugMask = mRenderDebugMask; } - } //external functions for asynchronous updating @@ -2034,7 +2014,7 @@ void LLPipeline::updateMoveDampedAsync(LLDrawable* drawablep) } if (!drawablep) { - llerrs << "updateMove called with NULL drawablep" << llendl; + LL_ERRS() << "updateMove called with NULL drawablep" << LL_ENDL; return; } if (drawablep->isState(LLDrawable::EARLY_MOVE)) @@ -2064,7 +2044,7 @@ void LLPipeline::updateMoveNormalAsync(LLDrawable* drawablep) } if (!drawablep) { - llerrs << "updateMove called with NULL drawablep" << llendl; + LL_ERRS() << "updateMove called with NULL drawablep" << LL_ENDL; return; } if (drawablep->isState(LLDrawable::EARLY_MOVE)) @@ -2121,12 +2101,14 @@ void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list) } } -static LLFastTimer::DeclareTimer FTM_OCTREE_BALANCE("Balance Octree"); -static LLFastTimer::DeclareTimer FTM_UPDATE_MOVE("Update Move"); +static LLTrace::BlockTimerStatHandle FTM_OCTREE_BALANCE("Balance Octree"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_MOVE("Update Move"); +static LLTrace::BlockTimerStatHandle FTM_RETEXTURE("Retexture"); +static LLTrace::BlockTimerStatHandle FTM_MOVED_LIST("Moved List"); void LLPipeline::updateMove() { - LLFastTimer t(FTM_UPDATE_MOVE); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_MOVE); if (FreezeTime) { @@ -2136,8 +2118,7 @@ void LLPipeline::updateMove() assertInitialized(); { - static LLFastTimer::DeclareTimer ftm("Retexture"); - LLFastTimer t(ftm); + LL_RECORD_BLOCK_TIME(FTM_RETEXTURE); for (LLDrawable::drawable_set_t::iterator iter = mRetexturedList.begin(); iter != mRetexturedList.end(); ++iter) @@ -2152,14 +2133,13 @@ void LLPipeline::updateMove() } { - static LLFastTimer::DeclareTimer ftm("Moved List"); - LLFastTimer t(ftm); + LL_RECORD_BLOCK_TIME(FTM_MOVED_LIST); updateMovedList(mMovedList); } //balance octrees { - LLFastTimer ot(FTM_OCTREE_BALANCE); + LL_RECORD_BLOCK_TIME(FTM_OCTREE_BALANCE); for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) @@ -2173,6 +2153,13 @@ void LLPipeline::updateMove() part->mOctree->balance(); } } + + //balance the VO Cache tree + LLVOCachePartition* vo_part = region->getVOCachePartition(); + if(vo_part) + { + vo_part->mOctree->balance(); + } } } } @@ -2242,9 +2229,9 @@ void check_references(LLSpatialGroup* group, LLDrawable* drawable) { for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { - if (drawable == *i) + if (drawable == (LLDrawable*)(*i)->getDrawable()) { - llerrs << "LLDrawable deleted while actively reference by LLPipeline." << llendl; + LL_ERRS() << "LLDrawable deleted while actively reference by LLPipeline." << LL_ENDL; } } } @@ -2255,7 +2242,7 @@ void check_references(LLDrawable* drawable, LLFace* face) { if (drawable->getFace(i) == face) { - llerrs << "LLFace deleted while actively referenced by LLPipeline." << llendl; + LL_ERRS() << "LLFace deleted while actively referenced by LLPipeline." << LL_ENDL; } } } @@ -2264,10 +2251,13 @@ void check_references(LLSpatialGroup* group, LLFace* face) { for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { - LLDrawable* drawable = *i; + LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable(); + if(drawable) + { check_references(drawable, face); } } +} void LLPipeline::checkReferences(LLFace* face) { @@ -2328,7 +2318,7 @@ void LLPipeline::checkReferences(LLDrawable* drawable) { if (drawable == *iter) { - llerrs << "LLDrawable deleted while actively referenced by LLPipeline." << llendl; + LL_ERRS() << "LLDrawable deleted while actively referenced by LLPipeline." << LL_ENDL; } } } @@ -2345,7 +2335,7 @@ void check_references(LLSpatialGroup* group, LLDrawInfo* draw_info) LLDrawInfo* params = *j; if (params == draw_info) { - llerrs << "LLDrawInfo deleted while actively referenced by LLPipeline." << llendl; + LL_ERRS() << "LLDrawInfo deleted while actively referenced by LLPipeline." << LL_ENDL; } } } @@ -2387,7 +2377,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group) { if (group == *iter) { - llerrs << "LLSpatialGroup deleted while actively referenced by LLPipeline." << llendl; + LL_ERRS() << "LLSpatialGroup deleted while actively referenced by LLPipeline." << LL_ENDL; } } @@ -2395,7 +2385,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group) { if (group == *iter) { - llerrs << "LLSpatialGroup deleted while actively referenced by LLPipeline." << llendl; + LL_ERRS() << "LLSpatialGroup deleted while actively referenced by LLPipeline." << LL_ENDL; } } @@ -2403,7 +2393,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group) { if (group == *iter) { - llerrs << "LLSpatialGroup deleted while actively referenced by LLPipeline." << llendl; + LL_ERRS() << "LLSpatialGroup deleted while actively referenced by LLPipeline." << LL_ENDL; } } } @@ -2444,7 +2434,7 @@ BOOL LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3& min = LLVector3(X,X,X); max = LLVector3(-X,-X,-X); - U32 saved_camera_id = LLViewerCamera::sCurCameraID; + LLViewerCamera::eCameraID saved_camera_id = LLViewerCamera::sCurCameraID; LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; BOOL res = TRUE; @@ -2475,11 +2465,16 @@ BOOL LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3& return res; } -static LLFastTimer::DeclareTimer FTM_CULL("Object Culling"); +static LLTrace::BlockTimerStatHandle FTM_CULL("Object Culling"); void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip, LLPlane* planep) { - LLFastTimer t(FTM_CULL); + static LLCachedControl<bool> use_occlusion(gSavedSettings,"UseOcclusion"); + static bool can_use_occlusion = LLGLSLShader::sNoFixedFunction + && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") + && gGLManager.mHasOcclusionQuery; + + LL_RECORD_BLOCK_TIME(FTM_CULL); grabReferences(result); @@ -2596,6 +2591,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl } } } + + //scan the VO Cache tree + LLVOCachePartition* vo_part = region->getVOCachePartition(); + if(vo_part) + { + bool do_occlusion_cull = can_use_occlusion && use_occlusion && !gUseWireframe/* && !gViewerWindow->getProgressView()->getVisible()*/; + vo_part->cull(camera, do_occlusion_cull); + } } if (bound_shader) @@ -2670,15 +2673,16 @@ void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera) return; } + const LLVector4a* bounds = group->getBounds(); if (sMinRenderSize > 0.f && - llmax(llmax(group->mBounds[1][0], group->mBounds[1][1]), group->mBounds[1][2]) < sMinRenderSize) + llmax(llmax(bounds[1][0], bounds[1][1]), bounds[1][2]) < sMinRenderSize) { return; } assertInitialized(); - if (!group->mSpatialPartition->mRenderByGroup) + if (!group->getSpatialPartition()->mRenderByGroup) { //render by drawable sCull->pushDrawableGroup(group); } @@ -2782,7 +2786,8 @@ void LLPipeline::doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderT void LLPipeline::doOcclusion(LLCamera& camera) { - if (LLPipeline::sUseOcclusion > 1 && sCull->hasOcclusionGroups()) + if (LLPipeline::sUseOcclusion > 1 && !LLSpatialPartition::sTeleportRequested && + (sCull->hasOcclusionGroups() || LLVOCachePartition::sNeedsOcclusionCheck)) { LLVertexBuffer::unbind(); @@ -2828,6 +2833,17 @@ void LLPipeline::doOcclusion(LLCamera& camera) group->clearOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION); } + //apply occlusion culling to object cache tree + for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + { + LLVOCachePartition* vo_part = (*iter)->getVOCachePartition(); + if(vo_part) + { + vo_part->processOccluders(&camera); + } + } + if (bind_shader) { if (LLPipeline::sShadowRender) @@ -2850,19 +2866,18 @@ BOOL LLPipeline::updateDrawableGeom(LLDrawable* drawablep, BOOL priority) if (update_complete && assertInitialized()) { drawablep->setState(LLDrawable::BUILT); - mGeometryChanges++; } return update_complete; } -static LLFastTimer::DeclareTimer FTM_SEED_VBO_POOLS("Seed VBO Pool"); +static LLTrace::BlockTimerStatHandle FTM_SEED_VBO_POOLS("Seed VBO Pool"); -static LLFastTimer::DeclareTimer FTM_UPDATE_GL("Update GL"); +static LLTrace::BlockTimerStatHandle FTM_UPDATE_GL("Update GL"); void LLPipeline::updateGL() { { - LLFastTimer t(FTM_UPDATE_GL); + LL_RECORD_BLOCK_TIME(FTM_UPDATE_GL); while (!LLGLUpdate::sGLQ.empty()) { LLGLUpdate* glu = LLGLUpdate::sGLQ.front(); @@ -2873,12 +2888,12 @@ void LLPipeline::updateGL() } { //seed VBO Pools - LLFastTimer t(FTM_SEED_VBO_POOLS); + LL_RECORD_BLOCK_TIME(FTM_SEED_VBO_POOLS); LLVertexBuffer::seedPools(); } } -static LLFastTimer::DeclareTimer FTM_REBUILD_PRIORITY_GROUPS("Rebuild Priority Groups"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_PRIORITY_GROUPS("Rebuild Priority Groups"); void LLPipeline::clearRebuildGroups() { @@ -2938,9 +2953,55 @@ void LLPipeline::clearRebuildGroups() mGroupQ2Locked = false; } +void LLPipeline::clearRebuildDrawables() +{ + // Clear all drawables on the priority build queue, + for (LLDrawable::drawable_list_t::iterator iter = mBuildQ1.begin(); + iter != mBuildQ1.end(); ++iter) + { + LLDrawable* drawablep = *iter; + if (drawablep && !drawablep->isDead()) + { + drawablep->clearState(LLDrawable::IN_REBUILD_Q2); + drawablep->clearState(LLDrawable::IN_REBUILD_Q1); + } + } + mBuildQ1.clear(); + + // clear drawables on the non-priority build queue + for (LLDrawable::drawable_list_t::iterator iter = mBuildQ2.begin(); + iter != mBuildQ2.end(); ++iter) + { + LLDrawable* drawablep = *iter; + if (!drawablep->isDead()) + { + drawablep->clearState(LLDrawable::IN_REBUILD_Q2); + } + } + mBuildQ2.clear(); + + //clear all moving bridges + for (LLDrawable::drawable_vector_t::iterator iter = mMovedBridge.begin(); + iter != mMovedBridge.end(); ++iter) + { + LLDrawable *drawablep = *iter; + drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD); + } + mMovedBridge.clear(); + + //clear all moving drawables + for (LLDrawable::drawable_vector_t::iterator iter = mMovedList.begin(); + iter != mMovedList.end(); ++iter) + { + LLDrawable *drawablep = *iter; + drawablep->clearState(LLDrawable::EARLY_MOVE | LLDrawable::MOVE_UNDAMPED | LLDrawable::ON_MOVE_LIST | LLDrawable::ANIMATED_CHILD); + } + mMovedList.clear(); +} + void LLPipeline::rebuildPriorityGroups() { - LLFastTimer t(FTM_REBUILD_PRIORITY_GROUPS); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_PRIORITY_GROUPS); LLTimer update_timer; assertInitialized(); @@ -2962,7 +3023,7 @@ void LLPipeline::rebuildPriorityGroups() } -static LLFastTimer::DeclareTimer FTM_REBUILD_GROUPS("Rebuild Groups"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_GROUPS("Rebuild Groups"); void LLPipeline::rebuildGroups() { @@ -2971,7 +3032,7 @@ void LLPipeline::rebuildGroups() return; } - LLFastTimer t(FTM_REBUILD_GROUPS); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_GROUPS); mGroupQ2Locked = true; // Iterate through some drawables on the non-priority build queue S32 size = (S32) mGroupQ2.size(); @@ -2994,7 +3055,7 @@ void LLPipeline::rebuildGroups() { group->rebuildGeom(); - if (group->mSpatialPartition->mRenderByGroup) + if (group->getSpatialPartition()->mRenderByGroup) { count++; } @@ -3015,7 +3076,7 @@ void LLPipeline::updateGeom(F32 max_dtime) LLTimer update_timer; LLPointer<LLDrawable> drawablep; - LLFastTimer t(FTM_GEO_UPDATE); + LL_RECORD_BLOCK_TIME(FTM_GEO_UPDATE); assertInitialized(); @@ -3063,7 +3124,7 @@ void LLPipeline::updateGeom(F32 max_dtime) S32 count = 0; - max_dtime = llmax(update_timer.getElapsedTimeF32()+0.001f, max_dtime); + max_dtime = llmax(update_timer.getElapsedTimeF32()+0.001f, F32SecondsImplicit(max_dtime)); LLSpatialGroup* last_group = NULL; LLSpatialBridge* last_bridge = NULL; @@ -3147,13 +3208,13 @@ void LLPipeline::markMoved(LLDrawable *drawablep, BOOL damped_motion) { if (!drawablep) { - //llerrs << "Sending null drawable to moved list!" << llendl; + //LL_ERRS() << "Sending null drawable to moved list!" << LL_ENDL; return; } if (drawablep->isDead()) { - llwarns << "Marking NULL or dead drawable moved!" << llendl; + LL_WARNS() << "Marking NULL or dead drawable moved!" << LL_ENDL; return; } @@ -3208,9 +3269,9 @@ void LLPipeline::markShift(LLDrawable *drawablep) } } -static LLFastTimer::DeclareTimer FTM_SHIFT_DRAWABLE("Shift Drawable"); -static LLFastTimer::DeclareTimer FTM_SHIFT_OCTREE("Shift Octree"); -static LLFastTimer::DeclareTimer FTM_SHIFT_HUD("Shift HUD"); +static LLTrace::BlockTimerStatHandle FTM_SHIFT_DRAWABLE("Shift Drawable"); +static LLTrace::BlockTimerStatHandle FTM_SHIFT_OCTREE("Shift Octree"); +static LLTrace::BlockTimerStatHandle FTM_SHIFT_HUD("Shift HUD"); void LLPipeline::shiftObjects(const LLVector3 &offset) { @@ -3223,7 +3284,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset) offseta.load3(offset.mV); { - LLFastTimer t(FTM_SHIFT_DRAWABLE); + LL_RECORD_BLOCK_TIME(FTM_SHIFT_DRAWABLE); for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin(); iter != mShiftList.end(); iter++) @@ -3241,7 +3302,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset) { - LLFastTimer t(FTM_SHIFT_OCTREE); + LL_RECORD_BLOCK_TIME(FTM_SHIFT_OCTREE); for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { @@ -3258,7 +3319,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset) } { - LLFastTimer t(FTM_SHIFT_HUD); + LL_RECORD_BLOCK_TIME(FTM_SHIFT_HUD); LLHUDText::shiftAll(offset); LLHUDNameTag::shiftAll(offset); } @@ -3292,10 +3353,10 @@ void LLPipeline::markPartitionMove(LLDrawable* drawable) } } -static LLFastTimer::DeclareTimer FTM_PROCESS_PARTITIONQ("PartitionQ"); +static LLTrace::BlockTimerStatHandle FTM_PROCESS_PARTITIONQ("PartitionQ"); void LLPipeline::processPartitionQ() { - LLFastTimer t(FTM_PROCESS_PARTITIONQ); + LL_RECORD_BLOCK_TIME(FTM_PROCESS_PARTITIONQ); for (LLDrawable::drawable_list_t::iterator iter = mPartitionQ.begin(); iter != mPartitionQ.end(); ++iter) { LLDrawable* drawable = *iter; @@ -3317,23 +3378,23 @@ void LLPipeline::markMeshDirty(LLSpatialGroup* group) void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority) { - if (group && !group->isDead() && group->mSpatialPartition) + if (group && !group->isDead() && group->getSpatialPartition()) { - if (group->mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_HUD) + if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD) { priority = TRUE; } if (priority) { - if (!group->isState(LLSpatialGroup::IN_BUILD_Q1)) + if (!group->hasState(LLSpatialGroup::IN_BUILD_Q1)) { llassert_always(!mGroupQ1Locked); mGroupQ1.push_back(group); group->setState(LLSpatialGroup::IN_BUILD_Q1); - if (group->isState(LLSpatialGroup::IN_BUILD_Q2)) + if (group->hasState(LLSpatialGroup::IN_BUILD_Q2)) { LLSpatialGroup::sg_vector_t::iterator iter = std::find(mGroupQ2.begin(), mGroupQ2.end(), group); if (iter != mGroupQ2.end()) @@ -3344,7 +3405,7 @@ void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority) } } } - else if (!group->isState(LLSpatialGroup::IN_BUILD_Q2 | LLSpatialGroup::IN_BUILD_Q1)) + else if (!group->hasState(LLSpatialGroup::IN_BUILD_Q2 | LLSpatialGroup::IN_BUILD_Q1)) { llassert_always(!mGroupQ2Locked); mGroupQ2.push_back(group); @@ -3383,7 +3444,7 @@ void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags f } } -static LLFastTimer::DeclareTimer FTM_RESET_DRAWORDER("Reset Draw Order"); +static LLTrace::BlockTimerStatHandle FTM_RESET_DRAWORDER("Reset Draw Order"); void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) { @@ -3397,11 +3458,11 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) LLPipeline::END_RENDER_TYPES)) { //clear faces from face pools - LLFastTimer t(FTM_RESET_DRAWORDER); + LL_RECORD_BLOCK_TIME(FTM_RESET_DRAWORDER); gPipeline.resetDrawOrders(); } - LLFastTimer ftm(FTM_STATESORT); + LL_RECORD_BLOCK_TIME(FTM_STATESORT); //LLVertexBuffer::unbind(); @@ -3419,7 +3480,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) group->setVisible(); for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { - markVisible(*i, camera); + markVisible((LLDrawable*)(*i)->getDrawable(), camera); } if (!sDelayVBUpdate) @@ -3485,7 +3546,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result) } { - LLFastTimer ftm(FTM_STATESORT_DRAWABLE); + LL_RECORD_BLOCK_TIME(FTM_STATESORT_DRAWABLE); for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) { @@ -3506,8 +3567,7 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera) { for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { - LLDrawable* drawablep = *i; - stateSort(drawablep, camera); + stateSort((LLDrawable*)(*i)->getDrawable(), camera); } if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD) @@ -3608,7 +3668,6 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) } } - mNumVisibleFaces += drawablep->getNumFaces(); } @@ -3621,7 +3680,10 @@ void forAllDrawables(LLCullResult::sg_iterator begin, { for (LLSpatialGroup::element_iter j = (*i)->getDataBegin(); j != (*i)->getDataEnd(); ++j) { - func(*j); + if((*j)->hasDrawable()) + { + func((LLDrawable*)(*j)->getDrawable()); + } } } } @@ -3814,11 +3876,11 @@ void renderSoundHighlights(LLDrawable* drawablep) void LLPipeline::postSort(LLCamera& camera) { - LLFastTimer ftm(FTM_STATESORT_POSTSORT); + LL_RECORD_BLOCK_TIME(FTM_STATESORT_POSTSORT); assertInitialized(); - llpushcallstacks ; + LL_PUSH_CALLSTACKS(); //rebuild drawable geometry for (LLCullResult::sg_iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i) { @@ -3829,12 +3891,12 @@ void LLPipeline::postSort(LLCamera& camera) group->rebuildGeom(); } } - llpushcallstacks ; + LL_PUSH_CALLSTACKS(); //rebuild groups sCull->assertDrawMapsEmpty(); rebuildPriorityGroups(); - llpushcallstacks ; + LL_PUSH_CALLSTACKS(); //build render map @@ -3849,7 +3911,7 @@ void LLPipeline::postSort(LLCamera& camera) continue; } - if (group->isState(LLSpatialGroup::NEW_DRAWINFO) && group->isState(LLSpatialGroup::GEOM_DIRTY)) + if (group->hasState(LLSpatialGroup::NEW_DRAWINFO) && group->hasState(LLSpatialGroup::GEOM_DIRTY)) { //no way this group is going to be drawable without a rebuild group->rebuildGeom(); } @@ -3887,7 +3949,7 @@ void LLPipeline::postSort(LLCamera& camera) if (alpha != group->mDrawMap.end()) { //store alpha groups for sorting - LLSpatialBridge* bridge = group->mSpatialPartition->asBridge(); + LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge(); if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD) { if (bridge) @@ -3945,7 +4007,7 @@ void LLPipeline::postSort(LLCamera& camera) std::sort(sCull->beginAlphaGroups(), sCull->endAlphaGroups(), LLSpatialGroup::CompareDepthGreater()); } - llpushcallstacks ; + LL_PUSH_CALLSTACKS(); // only render if the flag is set. The flag is only set if we are in edit mode or the toggle is set in the menus if (LLFloaterReg::instanceVisible("beacons") && !sShadowRender) { @@ -3998,7 +4060,7 @@ void LLPipeline::postSort(LLCamera& camera) forAllVisibleDrawables(renderSoundHighlights); } } - llpushcallstacks ; + LL_PUSH_CALLSTACKS(); // If managing your telehub, draw beacons at telehub and currently selected spawnpoint. if (LLFloaterTelehub::renderBeacons()) { @@ -4033,41 +4095,14 @@ void LLPipeline::postSort(LLCamera& camera) } } - /*static LLFastTimer::DeclareTimer FTM_TRANSFORM_WAIT("Transform Fence"); - static LLFastTimer::DeclareTimer FTM_TRANSFORM_DO_WORK("Transform Work"); - if (use_transform_feedback) - { //using transform feedback, wait for transform feedback to complete - LLFastTimer t(FTM_TRANSFORM_WAIT); - - S32 done = 0; - //glGetQueryivARB(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, GL_CURRENT_QUERY, &count); - - glGetQueryObjectivARB(mMeshDirtyQueryObject, GL_QUERY_RESULT_AVAILABLE, &done); - - while (!done) - { - { - LLFastTimer t(FTM_TRANSFORM_DO_WORK); - F32 max_time = llmin(gFrameIntervalSeconds*10.f, 1.f); - //do some useful work while we wait - LLAppViewer::getTextureCache()->update(max_time); // unpauses the texture cache thread - LLAppViewer::getImageDecodeThread()->update(max_time); // unpauses the image thread - LLAppViewer::getTextureFetch()->update(max_time); // unpauses the texture fetch thread - } - glGetQueryObjectivARB(mMeshDirtyQueryObject, GL_QUERY_RESULT_AVAILABLE, &done); - } - - mTransformFeedbackPrimitives = 0; - }*/ - //LLSpatialGroup::sNoDelete = FALSE; - llpushcallstacks ; + LL_PUSH_CALLSTACKS(); } void render_hud_elements() { - LLFastTimer t(FTM_RENDER_UI); + LL_RECORD_BLOCK_TIME(FTM_RENDER_UI); gPipeline.disableLights(); LLGLDisable fog(GL_FOG); @@ -4234,9 +4269,9 @@ void LLPipeline::renderHighlights() } if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && !mFaceSelectImagep) - { - mFaceSelectImagep = LLViewerTextureManager::getFetchedTexture(IMG_FACE_SELECT); - } + { + mFaceSelectImagep = LLViewerTextureManager::getFetchedTexture(IMG_FACE_SELECT); + } if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::DIFFUSE_MAP)) { @@ -4249,14 +4284,14 @@ void LLPipeline::renderHighlights() LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { - llerrs << "Bad face on selection" << llendl; + LL_ERRS() << "Bad face on selection" << LL_ENDL; return; } facep->renderSelected(mFaceSelectImagep, color); } } - + if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED)) { // Paint 'em red! @@ -4297,7 +4332,7 @@ void LLPipeline::renderHighlights() LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { - llerrs << "Bad face on selection" << llendl; + LL_ERRS() << "Bad face on selection" << LL_ENDL; return; } @@ -4327,7 +4362,7 @@ void LLPipeline::renderHighlights() LLFace *facep = mSelectedFaces[i]; if (!facep || facep->getDrawable()->isDead()) { - llerrs << "Bad face on selection" << llendl; + LL_ERRS() << "Bad face on selection" << LL_ENDL; return; } @@ -4346,7 +4381,7 @@ U32 LLPipeline::sCurRenderPoolType = 0 ; void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) { - LLFastTimer t(FTM_RENDER_GEOMETRY); + LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY); assertInitialized(); @@ -4381,7 +4416,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) { if (!verify()) { - llerrs << "Pipeline verification failed!" << llendl; + LL_ERRS() << "Pipeline verification failed!" << LL_ENDL; } } @@ -4433,7 +4468,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) } { - LLFastTimer t(FTM_POOLS); + LL_RECORD_BLOCK_TIME(FTM_POOLS); // HACK: don't calculate local lights if we're rendering the HUD! // Removing this check will cause bad flickering when there are @@ -4469,7 +4504,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) pool_set_t::iterator iter2 = iter1; if (hasRenderType(poolp->getType()) && poolp->getNumPasses() > 0) { - LLFastTimer t(FTM_POOLRENDER); + LL_RECORD_BLOCK_TIME(FTM_POOLRENDER); gGLLastMatrix = NULL; gGL.loadMatrix(gGLModelView); @@ -4598,9 +4633,9 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) { LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderGeomDeferred"); - LLFastTimer t(FTM_RENDER_GEOMETRY); + LL_RECORD_BLOCK_TIME(FTM_RENDER_GEOMETRY); - LLFastTimer t2(FTM_DEFERRED_POOLS); + LL_RECORD_BLOCK_TIME(FTM_DEFERRED_POOLS); LLGLEnable cull(GL_CULL_FACE); @@ -4642,7 +4677,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) pool_set_t::iterator iter2 = iter1; if (hasRenderType(poolp->getType()) && poolp->getNumDeferredPasses() > 0) { - LLFastTimer t(FTM_DEFERRED_POOLRENDER); + LL_RECORD_BLOCK_TIME(FTM_DEFERRED_POOLRENDER); gGLLastMatrix = NULL; gGL.loadMatrix(gGLModelView); @@ -4694,7 +4729,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion) { - LLFastTimer t(FTM_POST_DEFERRED_POOLS); + LL_RECORD_BLOCK_TIME(FTM_POST_DEFERRED_POOLS); U32 cur_type = 0; LLGLEnable cull(GL_CULL_FACE); @@ -4728,7 +4763,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion) pool_set_t::iterator iter2 = iter1; if (hasRenderType(poolp->getType()) && poolp->getNumPostDeferredPasses() > 0) { - LLFastTimer t(FTM_POST_DEFERRED_POOLRENDER); + LL_RECORD_BLOCK_TIME(FTM_POST_DEFERRED_POOLRENDER); gGLLastMatrix = NULL; gGL.loadMatrix(gGLModelView); @@ -4865,10 +4900,8 @@ void LLPipeline::addTrianglesDrawn(S32 index_count, U32 render_type) count = index_count/3; } - mTrianglesDrawn += count; - mBatchCount++; - mMaxBatchSize = llmax(mMaxBatchSize, count); - mMinBatchSize = llmin(mMinBatchSize, count); + record(sStatBatchSize, count); + add(LLStatViewer::TRIANGLES_DRAWN, LLUnits::Triangles::fromValue(count)); if (LLPipeline::sRenderFrameTest) { @@ -5286,7 +5319,7 @@ void LLPipeline::renderDebug() { DebugBlip& blip = *iter; - blip.mAge += gFrameIntervalSeconds; + blip.mAge += gFrameIntervalSeconds.value(); if (blip.mAge > 2.f) { mDebugBlips.erase(iter++); @@ -5296,7 +5329,7 @@ void LLPipeline::renderDebug() iter++; } - blip.mPosition.mV[2] += gFrameIntervalSeconds*2.f; + blip.mPosition.mV[2] += gFrameIntervalSeconds.value()*2.f; gGL.color4fv(blip.mColor.mV); gGL.vertex3fv(blip.mPosition.mV); @@ -5351,9 +5384,10 @@ void LLPipeline::renderDebug() fudge.splat(0.25f); //SG_OCCLUSION_FUDGE LLVector4a size; - size.setAdd(fudge, group->mBounds[1]); - - drawBox(group->mBounds[0], size); + const LLVector4a* bounds = group->getBounds(); + size.setAdd(fudge, bounds[1]); + + drawBox(bounds[0], size); } } @@ -5595,7 +5629,7 @@ void LLPipeline::renderDebug() continue; } - LLSpatialBridge* bridge = group->mSpatialPartition->asBridge(); + LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge(); if (bridge && (!bridge->mDrawable || bridge->mDrawable->isDead())) { @@ -5635,11 +5669,11 @@ void LLPipeline::renderDebug() } } -static LLFastTimer::DeclareTimer FTM_REBUILD_POOLS("Rebuild Pools"); +static LLTrace::BlockTimerStatHandle FTM_REBUILD_POOLS("Rebuild Pools"); void LLPipeline::rebuildPools() { - LLFastTimer t(FTM_REBUILD_POOLS); + LL_RECORD_BLOCK_TIME(FTM_REBUILD_POOLS); assertInitialized(); @@ -5682,7 +5716,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if (mSimplePool) { llassert(0); - llwarns << "Ignoring duplicate simple pool." << llendl; + LL_WARNS() << "Ignoring duplicate simple pool." << LL_ENDL; } else { @@ -5694,7 +5728,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if (mAlphaMaskPool) { llassert(0); - llwarns << "Ignoring duplicate alpha mask pool." << llendl; + LL_WARNS() << "Ignoring duplicate alpha mask pool." << LL_ENDL; break; } else @@ -5707,7 +5741,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if (mFullbrightAlphaMaskPool) { llassert(0); - llwarns << "Ignoring duplicate alpha mask pool." << llendl; + LL_WARNS() << "Ignoring duplicate alpha mask pool." << LL_ENDL; break; } else @@ -5720,7 +5754,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if (mGrassPool) { llassert(0); - llwarns << "Ignoring duplicate grass pool." << llendl; + LL_WARNS() << "Ignoring duplicate grass pool." << LL_ENDL; } else { @@ -5732,7 +5766,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if (mFullbrightPool) { llassert(0); - llwarns << "Ignoring duplicate simple pool." << llendl; + LL_WARNS() << "Ignoring duplicate simple pool." << LL_ENDL; } else { @@ -5744,7 +5778,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if (mInvisiblePool) { llassert(0); - llwarns << "Ignoring duplicate simple pool." << llendl; + LL_WARNS() << "Ignoring duplicate simple pool." << LL_ENDL; } else { @@ -5756,7 +5790,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if (mGlowPool) { llassert(0); - llwarns << "Ignoring duplicate glow pool." << llendl; + LL_WARNS() << "Ignoring duplicate glow pool." << LL_ENDL; } else { @@ -5776,7 +5810,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if (mBumpPool) { llassert(0); - llwarns << "Ignoring duplicate bump pool." << llendl; + LL_WARNS() << "Ignoring duplicate bump pool." << LL_ENDL; } else { @@ -5787,7 +5821,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if (mMaterialsPool) { llassert(0); - llwarns << "Ignorning duplicate materials pool." << llendl; + LL_WARNS() << "Ignorning duplicate materials pool." << LL_ENDL; } else { @@ -5798,7 +5832,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if( mAlphaPool ) { llassert(0); - llwarns << "LLPipeline::addPool(): Ignoring duplicate Alpha pool" << llendl; + LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Alpha pool" << LL_ENDL; } else { @@ -5813,7 +5847,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if( mSkyPool ) { llassert(0); - llwarns << "LLPipeline::addPool(): Ignoring duplicate Sky pool" << llendl; + LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Sky pool" << LL_ENDL; } else { @@ -5825,7 +5859,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if( mWaterPool ) { llassert(0); - llwarns << "LLPipeline::addPool(): Ignoring duplicate Water pool" << llendl; + LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Water pool" << LL_ENDL; } else { @@ -5837,7 +5871,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if( mGroundPool ) { llassert(0); - llwarns << "LLPipeline::addPool(): Ignoring duplicate Ground Pool" << llendl; + LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate Ground Pool" << LL_ENDL; } else { @@ -5849,7 +5883,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) if( mWLSkyPool ) { llassert(0); - llwarns << "LLPipeline::addPool(): Ignoring duplicate WLSky Pool" << llendl; + LL_WARNS() << "LLPipeline::addPool(): Ignoring duplicate WLSky Pool" << LL_ENDL; } else { @@ -5859,7 +5893,7 @@ void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp ) default: llassert(0); - llwarns << "Invalid Pool Type in LLPipeline::addPool()" << llendl; + LL_WARNS() << "Invalid Pool Type in LLPipeline::addPool()" << LL_ENDL; break; } } @@ -5943,7 +5977,7 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp ) llassert( poolp == mBumpPool ); mBumpPool = NULL; break; - + case LLDrawPool::POOL_MATERIALS: llassert(poolp == mMaterialsPool); mMaterialsPool = NULL; @@ -5974,7 +6008,7 @@ void LLPipeline::removeFromQuickLookup( LLDrawPool* poolp ) default: llassert(0); - llwarns << "Invalid Pool Type in LLPipeline::removeFromQuickLookup() type=" << poolp->getType() << llendl; + LL_WARNS() << "Invalid Pool Type in LLPipeline::removeFromQuickLookup() type=" << poolp->getType() << LL_ENDL; break; } } @@ -6019,7 +6053,7 @@ void LLPipeline::setupAvatarLights(BOOL for_edit) } mHWLightColors[1] = diffuse; - + light->setDiffuse(diffuse); light->setAmbient(LLColor4::black); light->setSpecular(LLColor4::black); @@ -6224,7 +6258,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) { if (farthest_light->fade >= 0.f) { - farthest_light->fade = -gFrameIntervalSeconds; + farthest_light->fade = -(gFrameIntervalSeconds.value()); } } else @@ -6234,6 +6268,13 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) } } + //mark nearby lights not-removable. + for (light_set_t::iterator iter = mNearbyLights.begin(); + iter != mNearbyLights.end(); iter++) + { + const Light* light = &(*iter); + ((LLViewerOctreeEntryData*) light->drawable)->setVisible(); + } } } @@ -6328,12 +6369,12 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) if (fade >= 0.f) { fade = fade / LIGHT_FADE_TIME; - ((Light*) (&(*iter)))->fade += gFrameIntervalSeconds; + ((Light*) (&(*iter)))->fade += gFrameIntervalSeconds.value(); } else { fade = 1.f + fade / LIGHT_FADE_TIME; - ((Light*) (&(*iter)))->fade -= gFrameIntervalSeconds; + ((Light*) (&(*iter)))->fade -= gFrameIntervalSeconds.value(); } fade = llclamp(fade,0.f,1.f); light_color *= fade; @@ -6645,28 +6686,28 @@ void LLPipeline::findReferences(LLDrawable *drawablep) assertInitialized(); if (mLights.find(drawablep) != mLights.end()) { - llinfos << "In mLights" << llendl; + LL_INFOS() << "In mLights" << LL_ENDL; } if (std::find(mMovedList.begin(), mMovedList.end(), drawablep) != mMovedList.end()) { - llinfos << "In mMovedList" << llendl; + LL_INFOS() << "In mMovedList" << LL_ENDL; } if (std::find(mShiftList.begin(), mShiftList.end(), drawablep) != mShiftList.end()) { - llinfos << "In mShiftList" << llendl; + LL_INFOS() << "In mShiftList" << LL_ENDL; } if (mRetexturedList.find(drawablep) != mRetexturedList.end()) { - llinfos << "In mRetexturedList" << llendl; + LL_INFOS() << "In mRetexturedList" << LL_ENDL; } if (std::find(mBuildQ1.begin(), mBuildQ1.end(), drawablep) != mBuildQ1.end()) { - llinfos << "In mBuildQ1" << llendl; + LL_INFOS() << "In mBuildQ1" << LL_ENDL; } if (std::find(mBuildQ2.begin(), mBuildQ2.end(), drawablep) != mBuildQ2.end()) { - llinfos << "In mBuildQ2" << llendl; + LL_INFOS() << "In mBuildQ2" << LL_ENDL; } S32 count; @@ -6674,7 +6715,7 @@ void LLPipeline::findReferences(LLDrawable *drawablep) count = gObjectList.findReferences(drawablep); if (count) { - llinfos << "In other drawables: " << count << " references" << llendl; + LL_INFOS() << "In other drawables: " << count << " references" << LL_ENDL; } } @@ -6695,7 +6736,7 @@ BOOL LLPipeline::verify() if (!ok) { - llwarns << "Pipeline verify failed!" << llendl; + LL_WARNS() << "Pipeline verify failed!" << LL_ENDL; } return ok; } @@ -6833,11 +6874,11 @@ void LLPipeline::toggleRenderTypeControl(void* data) U32 bit = (1<<type); if (gPipeline.hasRenderType(type)) { - llinfos << "Toggling render type mask " << std::hex << bit << " off" << std::dec << llendl; + LL_INFOS() << "Toggling render type mask " << std::hex << bit << " off" << std::dec << LL_ENDL; } else { - llinfos << "Toggling render type mask " << std::hex << bit << " on" << std::dec << llendl; + LL_INFOS() << "Toggling render type mask " << std::hex << bit << " on" << std::dec << LL_ENDL; } gPipeline.toggleRenderType(type); } @@ -6863,11 +6904,11 @@ void LLPipeline::toggleRenderDebug(void* data) U32 bit = (U32)(intptr_t)data; if (gPipeline.hasRenderDebugMask(bit)) { - llinfos << "Toggling render debug mask " << std::hex << bit << " off" << std::dec << llendl; + LL_INFOS() << "Toggling render debug mask " << std::hex << bit << " off" << std::dec << LL_ENDL; } else { - llinfos << "Toggling render debug mask " << std::hex << bit << " on" << std::dec << llendl; + LL_INFOS() << "Toggling render debug mask " << std::hex << bit << " on" << std::dec << LL_ENDL; } gPipeline.mRenderDebugMask ^= bit; } @@ -6916,7 +6957,7 @@ void LLPipeline::popRenderDebugFeatureMask() { if (mRenderDebugFeatureStack.empty()) { - llerrs << "Depleted render feature stack." << llendl; + LL_ERRS() << "Depleted render feature stack." << LL_ENDL; } mRenderDebugFeatureMask = mRenderDebugFeatureStack.top(); @@ -7343,16 +7384,30 @@ void LLPipeline::resetVertexBuffers() mResetVertexBuffers = true; } -static LLFastTimer::DeclareTimer FTM_RESET_VB("Reset VB"); +static LLTrace::BlockTimerStatHandle FTM_RESET_VB("Reset VB"); -void LLPipeline::doResetVertexBuffers() +void LLPipeline::doResetVertexBuffers(bool forced) { if (!mResetVertexBuffers) { return; } + if(!forced && LLSpatialPartition::sTeleportRequested) + { + if(gAgent.getTeleportState() != LLAgent::TELEPORT_NONE) + { + return; //wait for teleporting to finish + } + else + { + //teleporting aborted + LLSpatialPartition::sTeleportRequested = FALSE; + mResetVertexBuffers = false; + return; + } + } - LLFastTimer t(FTM_RESET_VB); + LL_RECORD_BLOCK_TIME(FTM_RESET_VB); mResetVertexBuffers = false; mCubeVB = NULL; @@ -7370,6 +7425,13 @@ void LLPipeline::doResetVertexBuffers() } } } + if(LLSpatialPartition::sTeleportRequested) + { + LLSpatialPartition::sTeleportRequested = FALSE; + + LLWorld::getInstance()->clearAllVisibleObjects(); + clearRebuildDrawables(); + } resetDrawOrders(); @@ -7392,7 +7454,7 @@ void LLPipeline::doResetVertexBuffers() if (LLVertexBuffer::sGLCount > 0) { - llwarns << "VBO wipe failed -- " << LLVertexBuffer::sGLCount << " buffers remaining." << llendl; + LL_WARNS() << "VBO wipe failed -- " << LLVertexBuffer::sGLCount << " buffers remaining." << LL_ENDL; } LLVertexBuffer::unbind(); @@ -7475,18 +7537,18 @@ void validate_framebuffer_object() break; case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: // frame buffer not OK: probably means unsupported depth buffer format - llerrs << "Framebuffer Incomplete Missing Attachment." << llendl; + LL_ERRS() << "Framebuffer Incomplete Missing Attachment." << LL_ENDL; break; case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: // frame buffer not OK: probably means unsupported depth buffer format - llerrs << "Framebuffer Incomplete Attachment." << llendl; + LL_ERRS() << "Framebuffer Incomplete Attachment." << LL_ENDL; break; case GL_FRAMEBUFFER_UNSUPPORTED: /* choose different formats */ - llerrs << "Framebuffer unsupported." << llendl; + LL_ERRS() << "Framebuffer unsupported." << LL_ENDL; break; default: - llerrs << "Unknown framebuffer status." << llendl; + LL_ERRS() << "Unknown framebuffer status." << LL_ENDL; break; } } @@ -7496,7 +7558,7 @@ void LLPipeline::bindScreenToTexture() } -static LLFastTimer::DeclareTimer FTM_RENDER_BLOOM("Bloom"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_BLOOM("Bloom"); void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) { @@ -7521,7 +7583,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) LLVector2 tc2((F32) mScreen.getWidth()*2, (F32) mScreen.getHeight()*2); - LLFastTimer ftm(FTM_RENDER_BLOOM); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BLOOM); gGL.color4f(1,1,1,1); LLGLDepthTest depth(GL_FALSE); LLGLDisable blend(GL_BLEND); @@ -7537,13 +7599,13 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) gGL.loadIdentity(); LLGLDisable test(GL_ALPHA_TEST); - + gGL.setColorMask(true, true); glClearColor(0,0,0,0); - + { { - LLFastTimer ftm(FTM_RENDER_BLOOM_FBO); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BLOOM_FBO); mGlow[2].bindTarget(); mGlow[2].clear(); } @@ -7611,7 +7673,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) for (S32 i = 0; i < kernel; i++) { { - LLFastTimer ftm(FTM_RENDER_BLOOM_FBO); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BLOOM_FBO); mGlow[i%2].bindTarget(); mGlow[i%2].clear(); } @@ -7653,7 +7715,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) /*if (LLRenderTarget::sUseFBO) { - LLFastTimer ftm(FTM_RENDER_BLOOM_FBO); + LL_RECORD_BLOCK_TIME(FTM_RENDER_BLOOM_FBO); glBindFramebuffer(GL_FRAMEBUFFER, 0); }*/ @@ -7751,7 +7813,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) } else if (transition_time < 1.f) { //currently in a transition, continue interpolating - transition_time += 1.f/CameraFocusTransitionTime*gFrameIntervalSeconds; + transition_time += 1.f/CameraFocusTransitionTime*gFrameIntervalSeconds.value(); transition_time = llmin(transition_time, 1.f); F32 t = cosf(transition_time*F_PI+F_PI)*0.5f+0.5f; @@ -7887,7 +7949,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) mScreen.bindTexture(0, channel); gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); } - + if (!LLViewerCamera::getInstance()->cameraUnderWater()) { shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 2.2); @@ -7935,7 +7997,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) { mScreen.bindTexture(0, channel); } - + if (!LLViewerCamera::getInstance()->cameraUnderWater()) { shader->uniform1f(LLShaderMgr::GLOBAL_GAMMA, 2.2); @@ -8153,11 +8215,11 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) } -static LLFastTimer::DeclareTimer FTM_BIND_DEFERRED("Bind Deferred"); +static LLTrace::BlockTimerStatHandle FTM_BIND_DEFERRED("Bind Deferred"); void LLPipeline::bindDeferredShader(LLGLSLShader& shader, U32 light_index, U32 noise_map) { - LLFastTimer t(FTM_BIND_DEFERRED); + LL_RECORD_BLOCK_TIME(FTM_BIND_DEFERRED); if (noise_map == 0xFFFFFFFF) { @@ -8378,16 +8440,16 @@ LLVector4 pow4fsrgb(LLVector4 v, F32 f) return v; } -static LLFastTimer::DeclareTimer FTM_GI_TRACE("Trace"); -static LLFastTimer::DeclareTimer FTM_GI_GATHER("Gather"); -static LLFastTimer::DeclareTimer FTM_SUN_SHADOW("Shadow Map"); -static LLFastTimer::DeclareTimer FTM_SOFTEN_SHADOW("Shadow Soften"); -static LLFastTimer::DeclareTimer FTM_EDGE_DETECTION("Find Edges"); -static LLFastTimer::DeclareTimer FTM_LOCAL_LIGHTS("Local Lights"); -static LLFastTimer::DeclareTimer FTM_ATMOSPHERICS("Atmospherics"); -static LLFastTimer::DeclareTimer FTM_FULLSCREEN_LIGHTS("Fullscreen Lights"); -static LLFastTimer::DeclareTimer FTM_PROJECTORS("Projectors"); -static LLFastTimer::DeclareTimer FTM_POST("Post"); +static LLTrace::BlockTimerStatHandle FTM_GI_TRACE("Trace"); +static LLTrace::BlockTimerStatHandle FTM_GI_GATHER("Gather"); +static LLTrace::BlockTimerStatHandle FTM_SUN_SHADOW("Shadow Map"); +static LLTrace::BlockTimerStatHandle FTM_SOFTEN_SHADOW("Shadow Soften"); +static LLTrace::BlockTimerStatHandle FTM_EDGE_DETECTION("Find Edges"); +static LLTrace::BlockTimerStatHandle FTM_LOCAL_LIGHTS("Local Lights"); +static LLTrace::BlockTimerStatHandle FTM_ATMOSPHERICS("Atmospherics"); +static LLTrace::BlockTimerStatHandle FTM_FULLSCREEN_LIGHTS("Fullscreen Lights"); +static LLTrace::BlockTimerStatHandle FTM_PROJECTORS("Projectors"); +static LLTrace::BlockTimerStatHandle FTM_POST("Post"); void LLPipeline::renderDeferredLighting() @@ -8398,7 +8460,7 @@ void LLPipeline::renderDeferredLighting() } { - LLFastTimer ftm(FTM_RENDER_DEFERRED); + LL_RECORD_BLOCK_TIME(FTM_RENDER_DEFERRED); LLViewerCamera* camera = LLViewerCamera::getInstance(); { @@ -8454,7 +8516,7 @@ void LLPipeline::renderDeferredLighting() { mDeferredLight.bindTarget(); { //paint shadow/SSAO light map (direct lighting lightmap) - LLFastTimer ftm(FTM_SUN_SHADOW); + LL_RECORD_BLOCK_TIME(FTM_SUN_SHADOW); bindDeferredShader(gDeferredSunProgram, 0); mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); glClearColor(1,1,1,1); @@ -8498,7 +8560,7 @@ void LLPipeline::renderDeferredLighting() if (RenderDeferredSSAO) { //soften direct lighting lightmap - LLFastTimer ftm(FTM_SOFTEN_SHADOW); + LL_RECORD_BLOCK_TIME(FTM_SOFTEN_SHADOW); //blur lightmap mScreen.bindTarget(); glClearColor(1,1,1,1); @@ -8573,7 +8635,7 @@ void LLPipeline::renderDeferredLighting() if (RenderDeferredAtmospheric) { //apply sunlight contribution - LLFastTimer ftm(FTM_ATMOSPHERICS); + LL_RECORD_BLOCK_TIME(FTM_ATMOSPHERICS); bindDeferredShader(LLPipeline::sUnderWaterRender ? gDeferredSoftenWaterProgram : gDeferredSoftenProgram); { LLGLDepthTest depth(GL_FALSE); @@ -8710,7 +8772,7 @@ void LLPipeline::renderDeferredLighting() col.mV[1] = powf(col.mV[1], 2.2f); col.mV[2] = powf(col.mV[2], 2.2f);*/ - LLFastTimer ftm(FTM_LOCAL_LIGHTS); + LL_RECORD_BLOCK_TIME(FTM_LOCAL_LIGHTS); gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c); gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s); gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV); @@ -8751,7 +8813,7 @@ void LLPipeline::renderDeferredLighting() for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter) { - LLFastTimer ftm(FTM_PROJECTORS); + LL_RECORD_BLOCK_TIME(FTM_PROJECTORS); LLDrawable* drawablep = *iter; LLVOVolume* volume = drawablep->getVOVolume(); @@ -8808,12 +8870,12 @@ void LLPipeline::renderDeferredLighting() while (!fullscreen_lights.empty()) { - LLFastTimer ftm(FTM_FULLSCREEN_LIGHTS); + LL_RECORD_BLOCK_TIME(FTM_FULLSCREEN_LIGHTS); light[count] = fullscreen_lights.front(); fullscreen_lights.pop_front(); col[count] = light_colors.front(); light_colors.pop_front(); - + /*col[count].mV[0] = powf(col[count].mV[0], 2.2f); col[count].mV[1] = powf(col[count].mV[1], 2.2f); col[count].mV[2] = powf(col[count].mV[2], 2.2f);*/ @@ -8845,7 +8907,7 @@ void LLPipeline::renderDeferredLighting() for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter) { - LLFastTimer ftm(FTM_PROJECTORS); + LL_RECORD_BLOCK_TIME(FTM_PROJECTORS); LLDrawable* drawablep = *iter; LLVOVolume* volume = drawablep->getVOVolume(); @@ -9006,7 +9068,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) } { - LLFastTimer ftm(FTM_RENDER_DEFERRED); + LL_RECORD_BLOCK_TIME(FTM_RENDER_DEFERRED); LLViewerCamera* camera = LLViewerCamera::getInstance(); @@ -9063,7 +9125,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) { mDeferredLight.bindTarget(); { //paint shadow/SSAO light map (direct lighting lightmap) - LLFastTimer ftm(FTM_SUN_SHADOW); + LL_RECORD_BLOCK_TIME(FTM_SUN_SHADOW); bindDeferredShader(gDeferredSunProgram); mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); glClearColor(1,1,1,1); @@ -9121,7 +9183,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) if (RenderDeferredAtmospheric) { //apply sunlight contribution - LLFastTimer ftm(FTM_ATMOSPHERICS); + LL_RECORD_BLOCK_TIME(FTM_ATMOSPHERICS); bindDeferredShader(gDeferredSoftenProgram); { LLGLDepthTest depth(GL_FALSE); @@ -9258,7 +9320,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) col.mV[1] = powf(col.mV[1], 2.2f); col.mV[2] = powf(col.mV[2], 2.2f);*/ - LLFastTimer ftm(FTM_LOCAL_LIGHTS); + LL_RECORD_BLOCK_TIME(FTM_LOCAL_LIGHTS); gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c); gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s); gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV); @@ -9299,7 +9361,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) for (LLDrawable::drawable_list_t::iterator iter = spot_lights.begin(); iter != spot_lights.end(); ++iter) { - LLFastTimer ftm(FTM_PROJECTORS); + LL_RECORD_BLOCK_TIME(FTM_PROJECTORS); LLDrawable* drawablep = *iter; LLVOVolume* volume = drawablep->getVOVolume(); @@ -9356,7 +9418,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) while (!fullscreen_lights.empty()) { - LLFastTimer ftm(FTM_FULLSCREEN_LIGHTS); + LL_RECORD_BLOCK_TIME(FTM_FULLSCREEN_LIGHTS); light[count] = fullscreen_lights.front(); fullscreen_lights.pop_front(); col[count] = light_colors.front(); @@ -9394,7 +9456,7 @@ void LLPipeline::renderDeferredLightingToRT(LLRenderTarget* target) for (LLDrawable::drawable_list_t::iterator iter = fullscreen_spot_lights.begin(); iter != fullscreen_spot_lights.end(); ++iter) { - LLFastTimer ftm(FTM_PROJECTORS); + LL_RECORD_BLOCK_TIME(FTM_PROJECTORS); LLDrawable* drawablep = *iter; LLVOVolume* volume = drawablep->getVOVolume(); @@ -10095,13 +10157,13 @@ glh::matrix4f scale_translate_to_fit(const LLVector3 min, const LLVector3 max) return ret; } -static LLFastTimer::DeclareTimer FTM_SHADOW_RENDER("Render Shadows"); -static LLFastTimer::DeclareTimer FTM_SHADOW_ALPHA("Alpha Shadow"); -static LLFastTimer::DeclareTimer FTM_SHADOW_SIMPLE("Simple Shadow"); +static LLTrace::BlockTimerStatHandle FTM_SHADOW_RENDER("Render Shadows"); +static LLTrace::BlockTimerStatHandle FTM_SHADOW_ALPHA("Alpha Shadow"); +static LLTrace::BlockTimerStatHandle FTM_SHADOW_SIMPLE("Simple Shadow"); void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& shadow_cam, LLCullResult &result, BOOL use_shader, BOOL use_occlusion, U32 target_width) { - LLFastTimer t(FTM_SHADOW_RENDER); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_RENDER); //clip out geometry on the same side of water as the camera S32 occlude = LLPipeline::sUseOcclusion; @@ -10176,7 +10238,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gGL.diffuseColor4f(1,1,1,1); gGL.setColorMask(false, false); - LLFastTimer ftm(FTM_SHADOW_SIMPLE); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_SIMPLE); gGL.getTexUnit(0)->disable(); for (U32 i = 0; i < sizeof(types)/sizeof(U32); ++i) @@ -10202,7 +10264,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera } { - LLFastTimer ftm(FTM_SHADOW_ALPHA); + LL_RECORD_BLOCK_TIME(FTM_SHADOW_ALPHA); gDeferredShadowAlphaMaskProgram.bind(); gDeferredShadowAlphaMaskProgram.uniform1f(LLShaderMgr::DEFERRED_SHADOW_TARGET_WIDTH, (float)target_width); @@ -10255,10 +10317,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera LLPipeline::sShadowRender = FALSE; } -static LLFastTimer::DeclareTimer FTM_VISIBLE_CLOUD("Visible Cloud"); +static LLTrace::BlockTimerStatHandle FTM_VISIBLE_CLOUD("Visible Cloud"); BOOL LLPipeline::getVisiblePointCloud(LLCamera& camera, LLVector3& min, LLVector3& max, std::vector<LLVector3>& fp, LLVector3 light_dir) { - LLFastTimer t(FTM_VISIBLE_CLOUD); + LL_RECORD_BLOCK_TIME(FTM_VISIBLE_CLOUD); //get point cloud of intersection of frust and min, max if (getVisibleExtents(camera, min, max)) @@ -10461,7 +10523,7 @@ void LLPipeline::generateHighlight(LLCamera& camera) if (!mHighlightSet.empty()) { - F32 transition = gFrameIntervalSeconds/RenderHighlightFadeTime; + F32 transition = gFrameIntervalSeconds.value()/RenderHighlightFadeTime; LLGLDisable test(GL_ALPHA_TEST); LLGLDepthTest depth(GL_FALSE); @@ -10505,7 +10567,7 @@ void LLPipeline::generateHighlight(LLCamera& camera) } -static LLFastTimer::DeclareTimer FTM_GEN_SUN_SHADOW("Gen Sun Shadow"); +static LLTrace::BlockTimerStatHandle FTM_GEN_SUN_SHADOW("Gen Sun Shadow"); void LLPipeline::generateSunShadow(LLCamera& camera) { @@ -10514,7 +10576,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) return; } - LLFastTimer t(FTM_GEN_SUN_SHADOW); + LL_RECORD_BLOCK_TIME(FTM_GEN_SUN_SHADOW); BOOL skip_avatar_update = FALSE; if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson) @@ -10735,7 +10797,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) mShadowFrustPoints[j].clear(); } - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+j; + LLViewerCamera::sCurCameraID = (LLViewerCamera::eCameraID)(LLViewerCamera::CAMERA_SHADOW0+j); //restore render matrices glh_set_current_modelview(saved_view); @@ -11111,12 +11173,14 @@ void LLPipeline::generateSunShadow(LLCamera& camera) if (gen_shadow) { - F32 fade_amt = gFrameIntervalSeconds * llmax(LLViewerCamera::getInstance()->getVelocityStat()->getCurrentPerSec(), 1.f); + LLTrace::CountStatHandle<>* velocity_stat = LLViewerCamera::getVelocityStat(); + F32 fade_amt = gFrameIntervalSeconds.value() + * llmax(LLTrace::get_frame_recording().getLastRecording().getSum(*velocity_stat) / LLTrace::get_frame_recording().getLastRecording().getDuration().value(), 1.0); //update shadow targets for (U32 i = 0; i < 2; i++) { //for each current shadow - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW4+i; + LLViewerCamera::sCurCameraID = (LLViewerCamera::eCameraID)(LLViewerCamera::CAMERA_SHADOW4+i); if (mShadowSpotLight[i].notNull() && (mShadowSpotLight[i] == mTargetShadowSpotLight[0] || @@ -11235,7 +11299,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera) static LLCullResult result[2]; - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_SHADOW0+i+4; + LLViewerCamera::sCurCameraID = (LLViewerCamera::eCameraID)(LLViewerCamera::CAMERA_SHADOW0 + i + 4); renderShadow(view[i+4], proj[i+4], shadow_cam, result[i], FALSE, FALSE, target_width); @@ -11285,7 +11349,7 @@ void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL textu LLSpatialGroup* group = *i; if (!group->isDead() && (!sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && - gPipeline.hasRenderType(group->mSpatialPartition->mDrawableType) && + gPipeline.hasRenderType(group->getSpatialPartition()->mDrawableType) && group->mDrawMap.find(type) != group->mDrawMap.end()) { pass->renderGroup(group,type,mask,texture); @@ -11293,11 +11357,11 @@ void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL textu } } -static LLFastTimer::DeclareTimer FTM_IMPOSTOR_MARK_VISIBLE("Impostor Mark Visible"); -static LLFastTimer::DeclareTimer FTM_IMPOSTOR_SETUP("Impostor Setup"); -static LLFastTimer::DeclareTimer FTM_IMPOSTOR_BACKGROUND("Impostor Background"); -static LLFastTimer::DeclareTimer FTM_IMPOSTOR_ALLOCATE("Impostor Allocate"); -static LLFastTimer::DeclareTimer FTM_IMPOSTOR_RESIZE("Impostor Resize"); +static LLTrace::BlockTimerStatHandle FTM_IMPOSTOR_MARK_VISIBLE("Impostor Mark Visible"); +static LLTrace::BlockTimerStatHandle FTM_IMPOSTOR_SETUP("Impostor Setup"); +static LLTrace::BlockTimerStatHandle FTM_IMPOSTOR_BACKGROUND("Impostor Background"); +static LLTrace::BlockTimerStatHandle FTM_IMPOSTOR_ALLOCATE("Impostor Allocate"); +static LLTrace::BlockTimerStatHandle FTM_IMPOSTOR_RESIZE("Impostor Resize"); void LLPipeline::generateImpostor(LLVOAvatar* avatar) { @@ -11363,7 +11427,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) LLViewerCamera* viewer_camera = LLViewerCamera::getInstance(); { - LLFastTimer t(FTM_IMPOSTOR_MARK_VISIBLE); + LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_MARK_VISIBLE); markVisible(avatar->mDrawable, *viewer_camera); LLVOAvatar::sUseImpostors = FALSE; @@ -11393,7 +11457,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) U32 resX = 0; { - LLFastTimer t(FTM_IMPOSTOR_SETUP); + LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_SETUP); const LLVector4a* ext = avatar->mDrawable->getSpatialExtents(); LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset()); @@ -11450,7 +11514,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) if (!avatar->mImpostor.isComplete()) { - LLFastTimer t(FTM_IMPOSTOR_ALLOCATE); + LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_ALLOCATE); if (LLPipeline::sRenderDeferred) @@ -11469,7 +11533,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) } else if(resX != avatar->mImpostor.getWidth() || resY != avatar->mImpostor.getHeight()) { - LLFastTimer t(FTM_IMPOSTOR_RESIZE); + LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_RESIZE); avatar->mImpostor.resize(resX,resY); } @@ -11531,8 +11595,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) LLDrawPoolAvatar::sMinimumAlpha = old_alpha; { //create alpha mask based on depth buffer (grey out if muted) - LLFastTimer t(FTM_IMPOSTOR_BACKGROUND); - + LL_RECORD_BLOCK_TIME(FTM_IMPOSTOR_BACKGROUND); if (LLPipeline::sRenderDeferred) { GLuint buff = GL_COLOR_ATTACHMENT0; @@ -11671,7 +11734,7 @@ void LLPipeline::setRenderTypeMask(U32 type, ...) if (type > END_RENDER_TYPES) { - llerrs << "Invalid render type." << llendl; + LL_ERRS() << "Invalid render type." << LL_ENDL; } } @@ -11692,7 +11755,7 @@ BOOL LLPipeline::hasAnyRenderType(U32 type, ...) const if (type > END_RENDER_TYPES) { - llerrs << "Invalid render type." << llendl; + LL_ERRS() << "Invalid render type." << LL_ENDL; } return FALSE; @@ -11709,7 +11772,7 @@ void LLPipeline::popRenderTypeMask() { if (mRenderTypeEnableStack.empty()) { - llerrs << "Depleted render type stack." << llendl; + LL_ERRS() << "Depleted render type stack." << LL_ENDL; } memcpy(mRenderTypeEnabled, mRenderTypeEnableStack.top().data(), sizeof(mRenderTypeEnabled)); @@ -11740,7 +11803,7 @@ void LLPipeline::andRenderTypeMask(U32 type, ...) if (type > END_RENDER_TYPES) { - llerrs << "Invalid render type." << llendl; + LL_ERRS() << "Invalid render type." << LL_ENDL; } for (U32 i = 0; i < LLPipeline::NUM_RENDER_TYPES; ++i) @@ -11765,7 +11828,7 @@ void LLPipeline::clearRenderTypeMask(U32 type, ...) if (type > END_RENDER_TYPES) { - llerrs << "Invalid render type." << llendl; + LL_ERRS() << "Invalid render type." << LL_ENDL; } } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 1c7154d413ba069549b37f6b9649c940f1064cd4..ce2f4b17b16eef2303f0a3b43315e055d7288075 100755 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -29,8 +29,6 @@ #include "llcamera.h" #include "llerror.h" -#include "lldarrayptr.h" -#include "lldqueueptr.h" #include "lldrawpool.h" #include "llspatialpartition.h" #include "m4math.h" @@ -43,28 +41,16 @@ #include <stack> -#include <stack> - -#include <stack> - class LLViewerTexture; -class LLEdge; class LLFace; class LLViewerObject; -class LLAgent; -class LLDisplayPrimitive; class LLTextureEntry; -class LLRenderFunc; -class LLCubeMap; class LLCullResult; class LLVOAvatar; class LLVOPartGroup; class LLGLSLShader; -class LLCurlRequest; class LLDrawPoolAlpha; -class LLMeshResponder; - typedef enum e_avatar_skinning_method { SKIN_METHOD_SOFTWARE, @@ -84,26 +70,26 @@ glh::matrix4f gl_ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, glh::matrix4f gl_perspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar); glh::matrix4f gl_lookat(LLVector3 eye, LLVector3 center, LLVector3 up); -extern LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY; -extern LLFastTimer::DeclareTimer FTM_RENDER_GRASS; -extern LLFastTimer::DeclareTimer FTM_RENDER_INVISIBLE; -extern LLFastTimer::DeclareTimer FTM_RENDER_OCCLUSION; -extern LLFastTimer::DeclareTimer FTM_RENDER_SHINY; -extern LLFastTimer::DeclareTimer FTM_RENDER_SIMPLE; -extern LLFastTimer::DeclareTimer FTM_RENDER_TERRAIN; -extern LLFastTimer::DeclareTimer FTM_RENDER_TREES; -extern LLFastTimer::DeclareTimer FTM_RENDER_UI; -extern LLFastTimer::DeclareTimer FTM_RENDER_WATER; -extern LLFastTimer::DeclareTimer FTM_RENDER_WL_SKY; -extern LLFastTimer::DeclareTimer FTM_RENDER_ALPHA; -extern LLFastTimer::DeclareTimer FTM_RENDER_CHARACTERS; -extern LLFastTimer::DeclareTimer FTM_RENDER_BUMP; -extern LLFastTimer::DeclareTimer FTM_RENDER_MATERIALS; -extern LLFastTimer::DeclareTimer FTM_RENDER_FULLBRIGHT; -extern LLFastTimer::DeclareTimer FTM_RENDER_GLOW; -extern LLFastTimer::DeclareTimer FTM_STATESORT; -extern LLFastTimer::DeclareTimer FTM_PIPELINE; -extern LLFastTimer::DeclareTimer FTM_CLIENT_COPY; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_GEOMETRY; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_GRASS; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_INVISIBLE; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_OCCLUSION; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_SHINY; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_SIMPLE; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_TERRAIN; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_TREES; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_UI; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_WATER; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_WL_SKY; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_CHARACTERS; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_BUMP; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_MATERIALS; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_FULLBRIGHT; +extern LLTrace::BlockTimerStatHandle FTM_RENDER_GLOW; +extern LLTrace::BlockTimerStatHandle FTM_STATESORT; +extern LLTrace::BlockTimerStatHandle FTM_PIPELINE; +extern LLTrace::BlockTimerStatHandle FTM_CLIENT_COPY; class LLPipeline @@ -115,7 +101,7 @@ class LLPipeline void destroyGL(); void restoreGL(); void resetVertexBuffers(); - void doResetVertexBuffers(); + void doResetVertexBuffers(bool forced = false); void resizeScreenTexture(); void releaseGLBuffers(); void releaseLUTBuffers(); @@ -259,6 +245,7 @@ class LLPipeline void rebuildPriorityGroups(); void rebuildGroups(); void clearRebuildGroups(); + void clearRebuildDrawables(); //calculate pixel area of given box from vantage point of given camera static F32 calcPixelArea(LLVector3 center, LLVector3 size, LLCamera& camera); @@ -557,23 +544,14 @@ class LLPipeline LLQuaternion mFlyCamRotation; BOOL mBackfaceCull; - S32 mBatchCount; S32 mMatrixOpCount; S32 mTextureMatrixOps; - S32 mMaxBatchSize; - S32 mMinBatchSize; - S32 mMeanBatchSize; - S32 mTrianglesDrawn; S32 mNumVisibleNodes; - S32 mVerticesRelit; S32 mDebugTextureUploadCost; S32 mDebugSculptUploadCost; S32 mDebugMeshUploadCost; - S32 mLightingChanges; - S32 mGeometryChanges; - S32 mNumVisibleFaces; static S32 sCompiles; @@ -609,6 +587,8 @@ class LLPipeline static F32 sMinRenderSize; static BOOL sRenderingHUDs; + static LLTrace::EventStatHandle<S64> sStatBatchSize; + //screen texture U32 mScreenWidth; U32 mScreenHeight; diff --git a/indra/llcommon/roles_constants.h b/indra/newview/roles_constants.h similarity index 100% rename from indra/llcommon/roles_constants.h rename to indra/newview/roles_constants.h diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 94c187e21a78b3f306e29e3f413c2824b20a8eac..d4df1ee71c56ebae2c22edc5963e1b619c894648 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -234,6 +234,7 @@ with the same filename but different name <texture name="Home_Off" file_name="navbar/Home_Off.png" preload="false" /> + <texture name="Horizontal Drag Handle" file_name="widgets/horizontal_drag_handle.png" scale.left="8" scale.right="120" scale.bottom="1" scale.top="6" scale_type="scale_outer"/> <texture name="Icon_Close_Foreground" file_name="windows/Icon_Close_Foreground.png" preload="true" /> <texture name="Icon_Close_Press" file_name="windows/Icon_Close_Press.png" preload="true" /> @@ -652,6 +653,7 @@ with the same filename but different name <texture name="Unread_Chiclet" file_name="bottomtray/Unread_Chiclet.png" preload="false" /> <texture name="UpArrow_Off" file_name="icons/UpArrow_Off.png" preload="false" /> + <texture name="Vertical Drag Handle" file_name="widgets/vertical_drag_handle.png" scale.left="2" scale.right="7" scale.bottom="8" scale.top="120" scale_type="scale_outer"/> <texture name="Volume_Background" file_name="windows/Volume_Background.png" preload="false" scale.left="6" scale.top="33" scale.right="63" scale.bottom="10" /> @@ -781,6 +783,4 @@ with the same filename but different name <texture name="Camera_Drag_Dot" file_name="world/CameraDragDot.png"/> <texture name="NavBar Separator" file_name="navbar/separator.png"/> - <texture name="Horizontal Drag Handle" file_name="widgets/horizontal_drag_handle.png"/> - <texture name="Vertical Drag Handle" file_name="widgets/vertical_drag_handle.png"/> </textures> diff --git a/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png b/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png index 642eac406553f2d704edf23cc04a9eba2272ca43..5f5a33be42831857a1087c4d6c90ead2b9770baf 100644 Binary files a/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png and b/indra/newview/skins/default/textures/widgets/horizontal_drag_handle.png differ diff --git a/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png b/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png index b06b70cf36630d0dd7d43fa66fc5777c9db37805..2ce5208c21bb54812f5cd6ff2dd44e24d7c38294 100644 Binary files a/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png and b/indra/newview/skins/default/textures/widgets/vertical_drag_handle.png differ diff --git a/indra/newview/skins/default/xui/da/floater_lagmeter.xml b/indra/newview/skins/default/xui/da/floater_lagmeter.xml deleted file mode 100755 index 149d174c34aab9d3b862f91af2cb669b44e131cb..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/da/floater_lagmeter.xml +++ /dev/null @@ -1,151 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="LAG METER"> - <floater.string name="max_title_msg"> - Lag mÃ¥ler - </floater.string> - <floater.string name="max_width_px"> - 360 - </floater.string> - <floater.string name="min_title_msg"> - Lag - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - Klient - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - Normal, vindue i baggrund - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - Klients billeder/sek under [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - Klients billeder/sek mellem [CLIENT_FRAME_RATE_CRITICAL] og [CLIENT_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - Mulig Ã¥rsag: 'Vis afstand' sat for højt i grafik indstillinger - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - Mulig Ã¥rsag: Billeder hentes - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - Mulig Ã¥rsag: For mange billeder i hukommelse - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - Mulig Ã¥rsag: For mange komplekse objekter i scenariet - </floater.string> - <floater.string name="network_text_msg"> - Netværk - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - Forbindelsen mister over [NETWORK_PACKET_LOSS_CRITICAL]% pakker - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - Forbindelsen mister [NETWORK_PACKET_LOSS_WARNING]%-[NETWORK_PACKET_LOSS_CRITICAL]% pakker - </floater.string> - <floater.string name="network_performance_normal_msg"> - Normal - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - Forbindelsens ping tider er over [NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_ping_warning_msg"> - Forbindelsens ping tider er [NETWORK_PING_WARNING]-[NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - Muligvis dÃ¥rlig forbindelse eller 'bÃ¥ndbredde' sat for højt i netværksopsætning. - </floater.string> - <floater.string name="network_ping_cause_msg"> - Muligvis dÃ¥rlig forbindelse eller fil delings program. - </floater.string> - <floater.string name="server_text_msg"> - Server - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - Simulator framerate er under [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - Simulator framerate er mellem [SERVER_FRAME_RATE_CRITICAL] og [SERVER_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="server_physics_cause_msg"> - Mulig Ã¥rsag: For mange fysiske objekter - </floater.string> - <floater.string name="server_scripts_cause_msg"> - Mulig Ã¥rsag: For mange objekter med script - </floater.string> - <floater.string name="server_net_cause_msg"> - Mulig Ã¥rsag: For meget netværks trafik - </floater.string> - <floater.string name="server_agent_cause_msg"> - Mulig Ã¥rsag: For mange avatarer i bevægelse i regionen - </floater.string> - <floater.string name="server_images_cause_msg"> - Mulig Ã¥rsag: For mange billed udregninger - </floater.string> - <floater.string name="server_generic_cause_msg"> - Mulig Ã¥rsag: Simulator belastning for stor - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button label="" label_selected="" name="client_lagmeter" tool_tip="Status for klient lag"/> - <text name="client"> - Klient - </text> - <text name="client_text"> - Normal - </text> - <button label="" label_selected="" name="network_lagmeter" tool_tip="Network lag status"/> - <text name="network"> - Netværk - </text> - <text name="network_text"> - Normal - </text> - <button label="" label_selected="" name="server_lagmeter" tool_tip="Status for server lag"/> - <text name="server"> - Server - </text> - <text name="server_text"> - Normal - </text> - <button label=">>" name="minimize" tool_tip="Ændre størrelse"/> -</floater> diff --git a/indra/newview/skins/default/xui/da/sidepanel_inventory.xml b/indra/newview/skins/default/xui/da/sidepanel_inventory.xml index b3293b981edb5cab589584fb857d621f93b8aa3f..b4b494cafa82e23abc5e01156d96218fd3851ab6 100755 --- a/indra/newview/skins/default/xui/da/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/da/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="Ting" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <panel name="button_panel"> <layout_stack name="button_panel_ls"> <layout_panel name="info_btn_lp"> diff --git a/indra/newview/skins/default/xui/de/floater_lagmeter.xml b/indra/newview/skins/default/xui/de/floater_lagmeter.xml deleted file mode 100755 index 45ff37c14753d6f2fc886de9e23c5b8f58fe9cf5..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/de/floater_lagmeter.xml +++ /dev/null @@ -1,151 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="LAG METER"> - <floater.string name="max_title_msg"> - Lag-Anzeige - </floater.string> - <floater.string name="max_width_px"> - 350 - </floater.string> - <floater.string name="min_title_msg"> - Lag - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - Client - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - Normal, Fenster im Hintergrund - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - Client-Frame-Rate unter [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - Client-Frame-Rate zwischen [CLIENT_FRAME_RATE_CRITICAL] und [CLIENT_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - Mögliche Ursache: Sichtweite zu groß - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - Mögliche Ursache: Bilder werden geladen - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - Mögliche Ursache: Zu viele Bilder im Speicher - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - Mögliche Ursache: Zu viele komplexe Objekte in der Szene - </floater.string> - <floater.string name="network_text_msg"> - Netzwerk - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - Paketverlust der Verbindung übersteigt [NETWORK_PACKET_LOSS_CRITICAL]% - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - Paketverlust der Verbindung liegt bei [NETWORK_PACKET_LOSS_WARNING]%-[NETWORK_PACKET_LOSS_CRITICAL]% - </floater.string> - <floater.string name="network_performance_normal_msg"> - Normal - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - Ping-Zeit der Verbindung übersteigt [NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_ping_warning_msg"> - Ping-Zeit der Verbindung liegt bei [NETWORK_PING_WARNING]-[NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - Möglicherweise schlechte Verbindung oder zu hoher Wert für „Bandbreite“. - </floater.string> - <floater.string name="network_ping_cause_msg"> - Möglicherweise schlechte Verbindung oder File-Sharing-Anwendung. - </floater.string> - <floater.string name="server_text_msg"> - Server - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - Simulator-Frame-Rate liegt unter [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - Simulator-Frame-Rate liegt zwischen [SERVER_FRAME_RATE_CRITICAL] und [SERVER_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="server_physics_cause_msg"> - Mögliche Ursache: Zu viele physische Objekte - </floater.string> - <floater.string name="server_scripts_cause_msg"> - Mögliche Ursache: Zu viele geskriptete Objekte - </floater.string> - <floater.string name="server_net_cause_msg"> - Mögliche Ursache: Zu viel Netzwerktraffic - </floater.string> - <floater.string name="server_agent_cause_msg"> - Mögliche Ursache: Zu viele Personen in Bewegung in der Region - </floater.string> - <floater.string name="server_images_cause_msg"> - Mögliche Ursache: Zu viele Bildberechnungen - </floater.string> - <floater.string name="server_generic_cause_msg"> - Mögliche Ursache: Zu hohe Simulator-Last - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button name="client_lagmeter" tool_tip="Client-Lag-Status"/> - <text name="client"> - Client - </text> - <text name="client_text"> - Normal - </text> - <button name="network_lagmeter" tool_tip="Netzwerk-Lag-Status"/> - <text name="network"> - Netzwerk - </text> - <text name="network_text"> - Normal - </text> - <button name="server_lagmeter" tool_tip="Server-Lag-Status"/> - <text name="server"> - Server - </text> - <text name="server_text"> - Normal - </text> - <button label=">> " name="minimize" tool_tip="Fenstergröße ändern"/> -</floater> diff --git a/indra/newview/skins/default/xui/de/sidepanel_inventory.xml b/indra/newview/skins/default/xui/de/sidepanel_inventory.xml index 18aad64f964dbf8058b93b98d676e510301b4a66..2585c5dc90c19e7dd2d4fa3a91489aa6a640194d 100755 --- a/indra/newview/skins/default/xui/de/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/de/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="Sonstiges" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <layout_stack name="inventory_layout_stack"> <layout_panel name="inbox_layout_panel"> <panel label="" name="marketplace_inbox"> diff --git a/indra/newview/skins/default/xui/en/floater_conversation_preview.xml b/indra/newview/skins/default/xui/en/floater_conversation_preview.xml index 764b9d8385096446416f0e3aadfe5156b9a59dd6..99ad59a7a3fa67de772d30fb387accc52397f707 100755 --- a/indra/newview/skins/default/xui/en/floater_conversation_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_conversation_preview.xml @@ -2,7 +2,6 @@ <floater legacy_header_height="18" can_resize="true" - default_tab_group="1" help_topic="conversation_preview" height="391" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_fast_timers.xml b/indra/newview/skins/default/xui/en/floater_fast_timers.xml index 77adb5524e7b073931d9e38744c46734ed250029..671f116df3647e162443008c3d977cee9b01bc45 100755 --- a/indra/newview/skins/default/xui/en/floater_fast_timers.xml +++ b/indra/newview/skins/default/xui/en/floater_fast_timers.xml @@ -16,6 +16,27 @@ width="700"> <string name="pause" >Pause</string> <string name="run">Run</string> + <combo_box name="time_scale_combo" + follows="left|top" + left="10" + top="5" + width="150" + height="20"> + <item label="2x Average"/> + <item label="Max"/> + <item label="Recent Max"/> + <item label="100ms"/> + </combo_box> + <combo_box name="metric_combo" + follows="left|top" + left_pad="10" + top="5" + width="150" + height="20"> + <item label="Time"/> + <item label="Number of Calls"/> + <item label="Hz"/> + </combo_box> <button follows="top|right" name="pause_btn" left="-200" @@ -24,4 +45,52 @@ height="40" label="Pause" font="SansSerifHuge"/> + <layout_stack name="legend_stack" + orientation="horizontal" + left="0" + top="50" + right="695" + bottom="500" + follows="all"> + <layout_panel name="legend_panel" + auto_resize="false" + user_resize="true" + width="220" + height="450" + min_width="100"> + <panel top="0" + left="0" + width="220" + height="440" + name="legend" + follows="all"/> + </layout_panel> + <layout_panel name="timers_panel" + auto_resize="true" + user_resize="true" + height="450" + width="475" + min_width="100"> + <layout_stack name="timer_bars_stack" + orientation="vertical" + left="0" + top="0" + width="475" + height="445" + follows="all"> + <layout_panel name="bars_panel" + auto_resize="true" + user_resize="true" + top="0" + width="475" + height="210"/> + <layout_panel name="lines_panel" + auto_resize="false" + user_resize="true" + width="475" + min_height="50" + height="240"/> + </layout_stack> + </layout_panel> + </layout_stack> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 7076de55e320e3c2ca1789a97e90d0f912847b06..dad81aca4f379579aa7e91b27b42dae843cf097a 100755 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater background_visible="true" - default_tab_group="1" height="355" help_topic="floater_im_box" layout="topleft" @@ -213,7 +212,6 @@ min_width="230"> <layout_stack animate="true" - default_tab_group="2" follows="all" orientation="vertical" name="translate_and_chat_stack" diff --git a/indra/newview/skins/default/xui/en/floater_joystick.xml b/indra/newview/skins/default/xui/en/floater_joystick.xml index 59f6a9434c4ac5661411b878b34c9874b0b2c765..259acccb682a8fd3fb1a58cbc3d58c715f086dcb 100755 --- a/indra/newview/skins/default/xui/en/floater_joystick.xml +++ b/indra/newview/skins/default/xui/en/floater_joystick.xml @@ -197,18 +197,18 @@ name="JoystickFlycamEnabled" width="60" /> <stat_view - height="250" + height="270" label="Joystick Monitor" layout="topleft" left="359" name="axis_view" show_label="true" - top="142" + top="135" width="200"> <stat_bar bar_max="2" bar_min="-2" - height="0" + show_bar="true" label="Axis 0" label_spacing="1" layout="topleft" @@ -220,6 +220,7 @@ <stat_bar bar_max="2" bar_min="-2" + show_bar="true" label="Axis 1" label_spacing="1" layout="topleft" @@ -228,6 +229,7 @@ <stat_bar bar_max="2" bar_min="-2" + show_bar="true" label="Axis 2" label_spacing="1" layout="topleft" @@ -236,6 +238,7 @@ <stat_bar bar_max="2" bar_min="-2" + show_bar="true" label="Axis 3" label_spacing="1" layout="topleft" @@ -244,6 +247,7 @@ <stat_bar bar_max="2" bar_min="-2" + show_bar="true" label="Axis 4" label_spacing="1" layout="topleft" @@ -253,6 +257,7 @@ bar_max="2" bar_min="-2" label="Axis 5" + show_bar="true" label_spacing="1" layout="topleft" name="axis5" diff --git a/indra/newview/skins/default/xui/en/floater_lagmeter.xml b/indra/newview/skins/default/xui/en/floater_lagmeter.xml deleted file mode 100755 index b24c745bdd0bc67fc0cbf085af4fbd09335b8238..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/en/floater_lagmeter.xml +++ /dev/null @@ -1,336 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<floater - legacy_header_height="18" - height="170" - layout="topleft" - name="floater_lagmeter" - help_topic="floater_lagmeter" - save_rect="true" - title="LAG METER" - width="350"> - <floater.string - name="max_title_msg"> - Lag Meter - </floater.string> - <floater.string - name="max_width_px"> - 360 - </floater.string> - <floater.string - name="min_title_msg"> - Lag - </floater.string> - <floater.string - name="min_width_px"> - 90 - </floater.string> - <floater.string - name="client_text_msg"> - Client - </floater.string> - <floater.string - name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string - name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string - name="client_frame_time_window_bg_msg"> - Normal, window in background - </floater.string> - <floater.string - name="client_frame_time_critical_msg"> - Client frame rate below [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string - name="client_frame_time_warning_msg"> - Client frame rate between [CLIENT_FRAME_RATE_CRITICAL] and [CLIENT_FRAME_RATE_WARNING] - </floater.string> - <floater.string - name="client_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string - name="client_draw_distance_cause_msg"> - Possible cause: Draw distance set too high - </floater.string> - <floater.string - name="client_texture_loading_cause_msg"> - Possible cause: Images loading - </floater.string> - <floater.string - name="client_texture_memory_cause_msg"> - Possible cause: Too many images in memory - </floater.string> - <floater.string - name="client_complex_objects_cause_msg"> - Possible cause: Too many complex objects in scene - </floater.string> - <floater.string - name="network_text_msg"> - Network - </floater.string> - <floater.string - name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string - name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string - name="network_packet_loss_critical_msg"> - Connection is dropping over [NETWORK_PACKET_LOSS_CRITICAL]% of packets - </floater.string> - <floater.string - name="network_packet_loss_warning_msg"> - Connection is dropping [NETWORK_PACKET_LOSS_WARNING]%-[NETWORK_PACKET_LOSS_CRITICAL]% of packets - </floater.string> - <floater.string - name="network_performance_normal_msg"> - Normal - </floater.string> - <floater.string - name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string - name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string - name="network_ping_critical_msg"> - Connection ping time is over [NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string - name="network_ping_warning_msg"> - Connection ping time is [NETWORK_PING_WARNING]-[NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string - name="network_packet_loss_cause_msg"> - Possible bad connection or 'Bandwidth' pref too high. - </floater.string> - <floater.string - name="network_ping_cause_msg"> - Possible bad connection or file-sharing app. - </floater.string> - <floater.string - name="server_text_msg"> - Server - </floater.string> - <floater.string - name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string - name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string - name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string - name="server_frame_time_critical_msg"> - Simulator framerate below [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string - name="server_frame_time_warning_msg"> - Simulator framerate between [SERVER_FRAME_RATE_CRITICAL] and [SERVER_FRAME_RATE_WARNING] - </floater.string> - <floater.string - name="server_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string - name="server_physics_cause_msg"> - Possible Cause: Too many physical objects - </floater.string> - <floater.string - name="server_scripts_cause_msg"> - Possible Cause: Too many scripted objects - </floater.string> - <floater.string - name="server_net_cause_msg"> - Possible Cause: Too much network traffic - </floater.string> - <floater.string - name="server_agent_cause_msg"> - Possible Cause: Too many moving people in region - </floater.string> - <floater.string - name="server_images_cause_msg"> - Possible Cause: Too many image calculations - </floater.string> - <floater.string - name="server_generic_cause_msg"> - Possible Cause: Simulator load too heavy - </floater.string> - <floater.string - name="smaller_label"> - >> - </floater.string> - <floater.string - name="bigger_label"> - << - </floater.string> - <button - follows="top|left" - height="16" - image_selected="lag_status_good.tga" - image_unselected="lag_status_good.tga" - layout="topleft" - left="8" - name="client_lagmeter" - tab_stop="false" - tool_tip="Client lag status" - top="24" - width="16" /> - <text - type="string" - length="1" - follows="left|top" - font="SansSerif" - height="16" - layout="topleft" - left_pad="3" - name="client" - top_delta="0" - width="128"> - Client - </text> - <text - invisiblity_control="LagMeterShrunk" - type="string" - length="1" - bottom="40" - follows="left|top" - font="SansSerif" - height="16" - layout="topleft" - left="110" - name="client_text" - right="-10"> - Normal - </text> - <text - invisiblity_control="LagMeterShrunk" - bottom="56" - follows="left|top" - height="16" - layout="topleft" - left="40" - name="client_lag_cause" - right="-32" /> - <button - follows="top|left" - height="16" - image_selected="lag_status_good.tga" - image_unselected="lag_status_good.tga" - layout="topleft" - left="8" - name="network_lagmeter" - tab_stop="false" - tool_tip="Network lag status" - top="64" - width="16" /> - <text - type="string" - length="1" - follows="left|top" - font="SansSerif" - height="16" - layout="topleft" - left_pad="3" - name="network" - top_delta="0" - width="128"> - Network - </text> - <text - invisiblity_control="LagMeterShrunk" - type="string" - length="1" - bottom="80" - follows="left|top" - font="SansSerif" - height="16" - layout="topleft" - left="110" - name="network_text" - right="-10"> - Normal - </text> - <text - invisiblity_control="LagMeterShrunk" - bottom="96" - follows="left|top" - height="16" - layout="topleft" - left="40" - name="network_lag_cause" - right="-32" /> - <button - follows="top|left" - height="16" - image_selected="lag_status_good.tga" - image_unselected="lag_status_good.tga" - layout="topleft" - left="8" - name="server_lagmeter" - tab_stop="false" - tool_tip="Server lag status" - top="104" - width="16" /> - <text - type="string" - length="1" - follows="left|top" - font="SansSerif" - height="16" - layout="topleft" - left_pad="3" - name="server" - top_delta="0" - width="60"> - Server - </text> - <text - invisiblity_control="LagMeterShrunk" - type="string" - length="1" - bottom="120" - follows="left|top" - font="SansSerif" - height="16" - layout="topleft" - left="110" - name="server_text" - right="-10"> - Normal - </text> - <text - invisiblity_control="LagMeterShrunk" - bottom="136" - follows="left|top" - height="16" - layout="topleft" - left="40" - name="server_lag_cause" - right="-32" /> - <button - follows="left|top" - height="20" - label=">>" - layout="topleft" - left="10" - name="minimize" - tool_tip="Toggle floater size" - top_delta="24" - width="40"> - <button.commit_callback - function="LagMeter.ClickShrink" /> - </button> -</floater> diff --git a/indra/newview/skins/default/xui/en/floater_model_preview.xml b/indra/newview/skins/default/xui/en/floater_model_preview.xml index 9fa416012cabf57b3d37f6bbe437fda5d2f0ae22..a4acd1df78448e3893d0d822a0d27577e9171881 100755 --- a/indra/newview/skins/default/xui/en/floater_model_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_model_preview.xml @@ -212,7 +212,7 @@ follows="top|left" height="20" layout="topleft" - left="222" + left="225" name="lod_mode_high" top_delta="0" visible="false" @@ -342,7 +342,7 @@ follows="top|left" height="20" layout="topleft" - left="222" + left="225" name="lod_mode_medium" top_delta="0" width="130"> @@ -470,7 +470,7 @@ follows="top|left" height="20" layout="topleft" - left="222" + left="225" name="lod_mode_low" top_delta="0" width="130"> @@ -598,7 +598,7 @@ follows="top|left" height="20" layout="topleft" - left="222" + left="225" name="lod_mode_lowest" top_delta="0" width="130"> diff --git a/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml b/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml new file mode 100644 index 0000000000000000000000000000000000000000..71ff961c59fa61b18da75514f1afd8d39680e254 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_scene_load_stats.xml @@ -0,0 +1,446 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater legacy_header_height="18" + can_resize="true" + height="400" + layout="topleft" + name="Scene Load Statistics" + save_rect="true" + save_visibility="true" + title="SCENE LOAD STATISTICS" + width="260"> + <button follows="top|left" + top="20" + bottom="60" + left="10" + width="100" + label="Pause" + name="playpause"/> + <scroll_container follows="top|left|bottom|right" + bottom="400" + layout="topleft" + left="0" + name="statistics_scroll" + reserve_scroll_corner="true" + top="60" + width="260"> + <container_view follows="top|left|bottom|right" + height="378" + layout="topleft" + left="2" + name="statistics_view" + top="20" + width="245" > +<!--Basic Section--> + <stat_view name="basic" + label="Basic" + show_label="true" + setting="OpenDebugStatBasic"> + <stat_bar name="frame difference" + label="Frame Pixel Difference" + orientation="horizontal" + unit_label="%" + stat="FramePixelDifference" + bar_max="100" + tick_spacing="10" + unit_scale="100" + precision="0"/> + <stat_bar name="bandwidth" + label="UDP Data Received" + orientation="horizontal" + unit_label="kbps" + stat="activemessagedatareceived" + bar_max="5000" + tick_spacing="500" + precision="0"/> + <stat_bar name="packet_loss" + label="Packet Loss" + orientation="horizontal" + unit_label=" %" + stat="packetslostpercentstat" + bar_max="5" + tick_spacing="0.5" + precision="3" + show_bar="false" + show_mean="true"/> + </stat_view> +<!--Advanced Section--> + <stat_view name="advanced" + label="Advanced" + show_label="true" + setting="OpenDebugStatAdvanced"> + <stat_view name="render" + label="Render" + show_label="true" + setting="OpenDebugStatRender"> + <stat_bar name="objs" + label="Total Objects" + orientation="horizontal" + unit_label="" + stat="numobjectsstat" + bar_max="50000" + tick_spacing="5000" + precision="0" + show_bar="false"/> + <stat_bar name="newobjs" + label="New Objects" + orientation="horizontal" + unit_label="/sec" + stat="numnewobjectsstat" + bar_max="2000" + tick_spacing="200" + show_bar="false"/> + <stat_bar name="object_cache_hits" + label="Object Cache Hit Rate" + orientation="horizontal" + stat="object_cache_hits" + bar_max="100" + unit_label="%" + tick_spacing="20" + show_history="true" + show_bar="false"/> + </stat_view> +<!--Texture Stats--> + <stat_view name="texture" + label="Texture" + show_label="true"> + <stat_bar name="texture_cache_hits" + label="Cache Hit Rate" + orientation="horizontal" + stat="texture_cache_hits" + bar_max="100.f" + unit_label="%" + tick_spacing="20" + show_history="true" + show_bar="false"/> + <stat_bar name="texture_cache_read_latency" + label="Cache Read Latency" + orientation="horizontal" + unit_label="msec" + stat="texture_cache_read_latency" + bar_max="1000.f" + tick_spacing="100" + show_history="true" + show_bar="false"/> + <stat_bar name="numimagesstat" + label="Count" + orientation="horizontal" + stat="numimagesstat" + bar_max="8000.f" + tick_spacing="2000.f" + show_bar="false"/> + <stat_bar name="numrawimagesstat" + label="Raw Count" + orientation="horizontal" + stat="numrawimagesstat" + bar_max="8000.f" + tick_spacing="2000.f" + show_bar="false"/> + </stat_view> +<!--Network Stats--> + <stat_view name="network" + label="Network" + show_label="true" + setting="OpenDebugStatNet"> + <stat_bar name="packetsinstat" + label="Packets In" + orientation="horizontal" + stat="packetsinstat" + unit_label="/sec" + bar_max="1024.f" + tick_spacing="128.f" + precision="1" + show_bar="false"/> + <stat_bar name="packetsoutstat" + label="Packets Out" + orientation="horizontal" + stat="packetsoutstat" + unit_label="/sec" + bar_max="1024.f" + tick_spacing="128.f" + precision="1" + show_bar="false"/> + <stat_bar name="objectdatareceived" + label="Objects" + orientation="horizontal" + stat="objectdatareceived" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + precision="1" + show_bar="false"/> + <stat_bar name="texturedatareceived" + label="Texture" + orientation="horizontal" + stat="texturedatareceived" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + precision="1" + show_bar="false"/> + <stat_bar name="assetudpdatareceived" + label="Asset" + orientation="horizontal" + stat="assetudpdatareceived" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + precision="1" + show_bar="false"/> + <stat_bar name="layersdatareceived" + label="Layers" + orientation="horizontal" + stat="layersdatareceived" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + precision="1" + show_bar="false"/> + <stat_bar name="messagedatain" + label="Actual In" + orientation="horizontal" + stat="messagedatain" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + precision="1" + show_bar="false"/> + <stat_bar name="messagedataout" + label="Actual Out" + orientation="horizontal" + stat="messagedataout" + unit_label="kbps" + bar_max="1024.f" + tick_spacing="128.f" + precision="1" + show_bar="false"/> + <stat_bar name="vfspendingoperations" + label="VFS Pending Operations" + orientation="horizontal" + stat="vfspendingoperations" + unit_label=" Ops." + show_bar="false"/> + </stat_view> + </stat_view> +<!--Sim Stats--> + <stat_view name="sim" + label="Simulator" + show_label="true" + setting="OpenDebugStatSim"> + <stat_bar name="simobjects" + label="Objects" + orientation="horizontal" + stat="simobjects" + precision="0" + bar_max="30000.f" + tick_spacing="5000.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simactiveobjects" + label="Active Objects" + orientation="horizontal" + stat="simactiveobjects" + precision="0" + bar_max="5000.f" + tick_spacing="750.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simactivescripts" + label="Active Scripts" + orientation="horizontal" + stat="simactivescripts" + precision="0" + bar_max="15000.f" + tick_spacing="1875.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="siminpps" + label="Packets In" + orientation="horizontal" + stat="siminpps" + unit_label="pps" + precision="0" + bar_max="2000.f" + tick_spacing="250.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simoutpps" + label="Packets Out" + orientation="horizontal" + stat="simoutpps" + unit_label="pps" + precision="0" + bar_max="2000.f" + tick_spacing="250.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simpendingdownloads" + label="Pending Downloads" + orientation="horizontal" + stat="simpendingdownloads" + precision="0" + bar_max="800.f" + tick_spacing="100.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simpendinguploads" + label="Pending Uploads" + orientation="horizontal" + stat="simpendinguploads" + precision="0" + bar_max="100.f" + tick_spacing="25.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simtotalunackedbytes" + label="Total Unacked Bytes" + orientation="horizontal" + stat="simtotalunackedbytes" + unit_label="kb" + precision="1" + bar_max="100000.f" + tick_spacing="25000.f" + show_bar="false" + show_mean="false"/> + <stat_view name="simperf" + label="Time (ms)" + show_label="true"> + <stat_bar name="simframemsec" + label="Total Frame Time" + orientation="horizontal" + stat="simframemsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simnetmsec" + label="Net Time" + orientation="horizontal" + stat="simnetmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsimphysicsmsec" + label="Physics Time" + orientation="horizontal" + stat="simsimphysicsmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsimothermsec" + label="Simulation Time" + orientation="horizontal" + stat="simsimothermsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simagentmsec" + label="Agent Time" + orientation="horizontal" + stat="simagentmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simimagesmsec" + label="Images Time" + orientation="horizontal" + stat="simimagesmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simscriptmsec" + label="Script Time" + orientation="horizontal" + stat="simscriptmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsparemsec" + label="Spare Time" + orientation="horizontal" + stat="simsparemsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> +<!--2nd level time blocks under 'Details' second--> + <stat_view name="timedetails" + label="Time Details (ms)" + show_label="true"> + <stat_bar name="simsimphysicsstepmsec" + label=" Physics Step" + orientation="horizontal" + stat="simsimphysicsstepmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsimphysicsshapeupdatemsec" + label=" Update Phys Shapes" + orientation="horizontal" + stat="simsimphysicsshapeupdatemsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsimphysicsothermsec" + label=" Physics Other" + orientation="horizontal" + stat="simsimphysicsothermsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simsleepmsec" + label=" Sleep Time" + orientation="horizontal" + stat="simsleepmsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + <stat_bar name="simpumpiomsec" + label=" Pump IO" + orientation="horizontal" + stat="simpumpiomsec" + unit_label="ms" + precision="3" + bar_max="40.f" + tick_spacing="10.f" + show_bar="false" + show_mean="false"/> + </stat_view> + </stat_view> + </stat_view> + </container_view> + </scroll_container> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_stats.xml b/indra/newview/skins/default/xui/en/floater_stats.xml index f9eb16d2241290aab668e9686151bf9a85954ce9..bee570d5d01dbb2794cacc5e3e710b38b5f22cf1 100755 --- a/indra/newview/skins/default/xui/en/floater_stats.xml +++ b/indra/newview/skins/default/xui/en/floater_stats.xml @@ -1,927 +1,339 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<floater - legacy_header_height="18" - can_resize="true" - height="400" - layout="topleft" - name="Statistics" - help_topic="statistics" - save_rect="true" - save_visibility="true" - title="STATISTICS" - width="260"> - <scroll_container - follows="top|left|bottom|right" - height="380" - layout="topleft" - left="0" - name="statistics_scroll" - reserve_scroll_corner="true" - top="20" - width="260"> - <container_view - follows="top|left|bottom|right" - height="378" - layout="topleft" - left="2" - name="statistics_view" - top="20" - width="245" > - <!--Basic Section--> - <stat_view - name="basic" - label="Basic" - show_label="true" - setting="OpenDebugStatBasic"> - <stat_bar - name="fps" - label="FPS" - unit_label="fps" - stat="fpsstat" - bar_min="0" - bar_max="60" - tick_spacing="6" - label_spacing="12" - precision="1" - show_bar="true" - show_history="true"> - </stat_bar> - <stat_bar - name="bandwidth" - label="Bandwidth" - unit_label="kbps" - stat="kbitstat" - bar_min="0" - bar_max="5000" - tick_spacing="500" - label_spacing="1000" - precision="0" - show_bar="true" - show_history="false"> - </stat_bar> - <stat_bar - name="packet_loss" - label="Packet Loss" - unit_label=" %" - stat="packetslostpercentstat" - bar_min="0" - bar_max="5" - tick_spacing="0.5" - label_spacing="1" - precision="3" - show_per_sec="false" - show_bar="false" - show_mean="true"> - </stat_bar> - <stat_bar - name="ping" - label="Ping Sim" - unit_label="msec" - stat="simpingstat" - bar_min="0" - bar_max="5000" - tick_spacing="500" - label_spacing="1000" - precision="0" - show_bar="false" - show_per_sec="false" - show_mean="false"> - </stat_bar> - </stat_view> - <!--Advanced Section--> - <stat_view - name="advanced" - label="Advanced" - show_label="true" - setting="OpenDebugStatAdvanced"> - <stat_view - name="render" - label="Render" - show_label="true" - setting="OpenDebugStatRender"> - <stat_bar - name="ktrisframe" - label="KTris Drawn per Frame" - unit_label="/fr" - stat="trianglesdrawnstat" - bar_min="0" - bar_max="10000" - tick_spacing="1000" - label_spacing="2000" - precision="0" - show_per_sec="false" - show_bar="false"> - </stat_bar> - <stat_bar - name="ktrissec" - label="KTris Drawn per Sec" - unit_label="/sec" - stat="trianglesdrawnstat" - bar_min="0" - bar_max="200000" - tick_spacing="25000" - label_spacing="50000" - precision="0" - show_bar="false"> - </stat_bar> - <stat_bar - name="objs" - label="Total Objects" - unit_label="" - stat="numobjectsstat" - bar_min="0" - bar_max="50000" - tick_spacing="5000" - label_spacing="10000" - precision="0" - show_per_sec="false" - show_bar="false"> - </stat_bar> - <stat_bar - name="newobjs" - label="New Objects" - unit_label="/sec" - stat="numnewobjectsstat" - bar_min="0" - bar_max="2000" - tick_spacing="200" - label_spacing="400" - show_per_sec="true" - show_bar="false"> - </stat_bar> - <stat_bar - name="object_cache_hits" - label="Object Cache Hit Rate" - stat="object_cache_hits" - bar_min="0" - bar_max="100" - unit_label="%" - tick_spacing="20" - label_spacing="20" - show_history="true" - show_per_sec="false" - show_bar="false"> - </stat_bar> - </stat_view> - <!--Texture Stats--> - <stat_view - name="texture" - label="Texture" - show_label="true"> - <stat_bar - name="texture_cache_hits" - label="Cache Hit Rate" - stat="texture_cache_hits" - bar_min="0.f" - bar_max="100.f" - unit_label="%" - tick_spacing="20" - label_spacing="20" - show_history="true" - show_per_sec="false" - show_bar="false"> - </stat_bar> - <stat_bar - name="texture_cache_read_latency" - label="Cache Read Latency" - unit_label="msec" - stat="texture_cache_read_latency" - bar_min="0.f" - bar_max="1000.f" - tick_spacing="100" - label_spacing="200" - show_history="true" - show_per_sec="false" - show_bar="false"> - </stat_bar> - <stat_bar - name="numimagesstat" - label="Count" - stat="numimagesstat" - bar_min="0.f" - bar_max="8000.f" - tick_spacing="2000.f" - label_spacing="4000.f" - show_per_sec="false" - show_bar="false"> - </stat_bar> - - <stat_bar - name="numrawimagesstat" - label="Raw Count" - stat="numrawimagesstat" - bar_min="0.f" - bar_max="8000.f" - tick_spacing="2000.f" - label_spacing="4000.f" - show_per_sec="false" - show_bar="false"> - </stat_bar> - - <stat_bar - name="gltexmemstat" - label="GL Mem" - stat="gltexmemstat" - bar_min="0.f" - bar_max="400.f" - tick_spacing="100.f" - label_spacing="200.f" - precision="1" - show_per_sec="false" - show_bar="false"> - </stat_bar> - - <stat_bar - name="formattedmemstat" - label="Formatted Mem" - stat="formattedmemstat" - bar_min="0.f" - bar_max="400.f" - tick_spacing="100.f" - label_spacing="200.f" - precision="1" - show_per_sec="false" - show_bar="false"> - </stat_bar> - - <stat_bar - name="rawmemstat" - label="Raw Mem" - stat="rawmemstat" - bar_min="0.f" - bar_max="400.f" - tick_spacing="100.f" - label_spacing="200.f" - precision="1" - show_per_sec="false" - show_bar="false"> - </stat_bar> - - <stat_bar - name="glboundmemstat" - label="Bound Mem" - stat="glboundmemstat" - bar_min="0.f" - bar_max="400.f" - tick_spacing="100.f" - label_spacing="200.f" - precision="1" - show_per_sec="false" - show_bar="false"> - </stat_bar> - </stat_view> - <!--Network Stats--> - <stat_view - name="network" - label="Network" - show_label="true" - setting="OpenDebugStatNet"> - <stat_bar - name="packetsinstat" - label="Packets In" - stat="packetsinstat" - unit_label="/sec" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false"> - </stat_bar> - - <stat_bar - name="packetsoutstat" - label="Packets Out" - stat="packetsoutstat" - unit_label="/sec" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" > - </stat_bar> - - <stat_bar - name="objectkbitstat" - label="Objects" - stat="objectkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" > - </stat_bar> - - <stat_bar - name="texturekbitstat" - label="Texture" - stat="texturekbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" > - </stat_bar> - - <stat_bar - name="assetkbitstat" - label="Asset" - stat="assetkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" > - </stat_bar> - - <stat_bar - name="layerskbitstat" - label="Layers" - stat="layerskbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" > - </stat_bar> - - <stat_bar - name="actualinkbitstat" - label="Actual In" - stat="actualinkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" - show_history="false" > - </stat_bar> - - <stat_bar - name="actualoutkbitstat" - label="Actual Out" - stat="actualoutkbitstat" - unit_label="kbps" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - precision="1" - show_bar="false" - show_history="false"> - </stat_bar> - - <stat_bar - name="vfspendingoperations" - label="VFS Pending Operations" - stat="vfspendingoperations" - unit_label=" Ops." - show_per_sec="false" - show_bar="false" > - </stat_bar> - </stat_view> - </stat_view> - <!--Sim Stats--> - <stat_view - name="sim" - label="Simulator" - show_label="true" - setting="OpenDebugStatSim"> - <stat_bar - name="simtimedilation" - label="Time Dilation" - stat="simtimedilation" - precision="3" - bar_min="0.f" - bar_max="1.f" - tick_spacing="0.16666f" - label_spacing="0.33333f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simfps" - label="Sim FPS" - stat="simfps" - precision="1" - bar_min="0.f" - bar_max="45.f" - tick_spacing="7.5f" - label_spacing="15.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simphysicsfps" - label="Physics FPS" - stat="simphysicsfps" - precision="1" - bar_min="0.f" - bar_max="45.f" - tick_spacing="7.5.f" - label_spacing="15.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_view - name="physicsdetail" - label="Physics Details" - show_label="true"> - <stat_bar - name="physicspinnedtasks" - label="Pinned Objects" - stat="physicspinnedtasks" - precision="0" - bar_min="0.f" - bar_max="500.f" - tick_spacing="50.f" - label_spacing="100.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="physicslodtasks" - label="Low LOD Objects" - stat="physicslodtasks" - precision="0" - bar_min="0.f" - bar_max="500.f" - tick_spacing="50.f" - label_spacing="100.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="physicsmemoryallocated" - label="Memory Allocated" - stat="physicsmemoryallocated" - unit_label="MB" - precision="1" - bar_min="0.f" - bar_max="1024.f" - tick_spacing="128.f" - label_spacing="256.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - </stat_view> - - <stat_bar - name="simagentups" - label="Agent Updates/Sec" - stat="simagentups" - precision="1" - bar_min="0.f" - bar_max="100.f" - tick_spacing="25.f" - label_spacing="50.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simmainagents" - label="Main Agents" - stat="simmainagents" - precision="0" - bar_min="0.f" - bar_max="80.f" - tick_spacing="10.f" - label_spacing="40.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simchildagents" - label="Child Agents" - stat="simchildagents" - precision="0" - bar_min="0.f" - bar_max="40.f" - tick_spacing="5.f" - label_spacing="10.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simobjects" - label="Objects" - stat="simobjects" - precision="0" - bar_min="0.f" - bar_max="30000.f" - tick_spacing="5000.f" - label_spacing="10000.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simactiveobjects" - label="Active Objects" - stat="simactiveobjects" - precision="0" - bar_min="0.f" - bar_max="5000.f" - tick_spacing="750.f" - label_spacing="1250.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simactivescripts" - label="Active Scripts" - stat="simactivescripts" - precision="0" - bar_min="0.f" - bar_max="15000.f" - tick_spacing="1875.f" - label_spacing="3750.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - <stat_bar - name="simpctscriptsrun" - label="Scripts Run" - unit_label=" %" - stat="simpctscriptsrun" - bar_min="0" - bar_max="100" - tick_spacing="10" - label_spacing="20" - precision="3" - show_per_sec="false" - show_bar="false" - show_mean="true"> - </stat_bar> - - <stat_bar - name="simscripteps" - label="Script Events" - stat="simscripteps" - unit_label="eps" - precision="0" - bar_min="0.f" - bar_max="5000.f" - tick_spacing="750.f" - label_spacing="1250.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_view - name="simpathfinding" - label="Pathfinding" - show_label="true"> - <stat_bar - name="simsimaistepmsec" - label=" AI Step Time" - stat="simsimaistepmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - <stat_bar - name="simsimskippedsilhouettesteps" - label=" Skipped Silhouette Steps" - stat="simsimskippedsilhouettesteps" - unit_label="/sec" - precision="0" - bar_min="0" - bar_max="45" - tick_spacing="4" - label_spacing="8" - show_per_sec="false" - show_bar="false"> - </stat_bar> - <stat_bar - name="simsimpctsteppedcharacters" - label=" Characters Updated" - unit_label=" %" - stat="simsimpctsteppedcharacters" - bar_min="0" - bar_max="100" - tick_spacing="10" - label_spacing="20" - precision="1" - show_per_sec="false" - show_bar="false" - show_mean="true"> - </stat_bar> +<floater legacy_header_height="18" + can_resize="true" + height="400" + layout="topleft" + name="Statistics" + help_topic="statistics" + save_rect="true" + save_visibility="true" + title="STATISTICS" + width="260"> + <scroll_container follows="all" + height="380" + layout="topleft" + left="0" + name="statistics_scroll" + reserve_scroll_corner="true" + top="20" + width="260"> + <container_view follows="all" + height="378" + layout="topleft" + left="2" + name="statistics_view" + top="20" + width="245" > + <stat_view name="basic" + label="Basic" + setting="OpenDebugStatBasic"> + <stat_bar name="fps" + label="FPS" + unit_label="fps" + stat="FPS" + decimal_digits="1" + show_bar="true" + show_history="true"/> + <stat_bar name="bandwidth" + label="UDP Data Received" + stat="activemessagedatareceived" + show_bar="true"/> + <stat_bar name="packet_loss" + label="Packet Loss" + stat="packetslostpercentstat"/> + <stat_bar name="ping" + label="Ping Sim" + stat="simpingstat"/> + </stat_view> + + <stat_view name="advanced" + label="Advanced" + setting="OpenDebugStatAdvanced"> + <stat_view name="render" + label="Render" + setting="OpenDebugStatRender"> + <stat_bar name="ktrisframe" + label="KTris per Frame" + unit_label="ktris/fr" + stat="trianglesdrawnperframestat"/> + <stat_bar name="ktrissec" + label="KTris per Sec" + stat="trianglesdrawnstat"/> + <stat_bar name="objs" + label="Total Objects" + stat="numobjectsstat"/> + <stat_bar name="objs" + label="Cached Objects" + stat="numactivecachedobjects"/> + <stat_bar name="newobjs" + label="New Objects" + stat="numnewobjectsstat"/> + <stat_bar name="object_cache_hits" + label="Object Cache Hit Rate" + stat="object_cache_hits" + show_history="true"/> + <stat_bar name="occlusion_queries" + label="Occlusion Queries Performed" + stat="occlusion_queries"/> + <stat_bar name="occluded" + label="Objects Occluded" + stat="occluded_objects"/> + <stat_bar name="unoccluded" + label="Object Unoccluded" + stat="unoccluded_objects"/> + </stat_view> + <stat_view name="texture" + label="Texture"> + <stat_bar name="texture_cache_hits" + label="Cache Hit Rate" + stat="texture_cache_hits" + show_history="true"/> + <stat_bar name="texture_cache_read_latency" + label="Cache Read Latency" + stat="texture_cache_read_latency" + show_history="true"/> + <stat_bar name="numimagesstat" + label="Count" + stat="numimagesstat"/> + <stat_bar name="numrawimagesstat" + label="Raw Count" + stat="numrawimagesstat"/> + <stat_bar name="gltexmemstat" + label="GL Mem" + stat="gltexmemstat"/> + <stat_bar name="formattedmemstat" + label="Formatted Mem" + stat="formattedmemstat"/> + <stat_bar name="rawmemstat" + label="Raw Mem" + stat="rawmemstat"/> + <stat_bar name="glboundmemstat" + label="Bound Mem" + stat="glboundmemstat"/> </stat_view> - - <stat_bar - name="siminpps" - label="Packets In" - stat="siminpps" - unit_label="pps" - precision="0" - bar_min="0.f" - bar_max="2000.f" - tick_spacing="250.f" - label_spacing="1000.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simoutpps" - label="Packets Out" - stat="simoutpps" - unit_label="pps" - precision="0" - bar_min="0.f" - bar_max="2000.f" - tick_spacing="250.f" - label_spacing="1000.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simpendingdownloads" - label="Pending Downloads" - stat="simpendingdownloads" - precision="0" - bar_min="0.f" - bar_max="800.f" - tick_spacing="100.f" - label_spacing="200.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simpendinguploads" - label="Pending Uploads" - stat="simpendinguploads" - precision="0" - bar_min="0.f" - bar_max="100.f" - tick_spacing="25.f" - label_spacing="50.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simtotalunackedbytes" - label="Total Unacked Bytes" - stat="simtotalunackedbytes" - unit_label="kb" - precision="1" - bar_min="0.f" - bar_max="100000.f" - tick_spacing="25000.f" - label_spacing="50000.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_view - name="simperf" - label="Time (ms)" - show_label="true"> - <stat_bar - name="simframemsec" - label="Total Frame Time" - stat="simframemsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simnetmsec" - label="Net Time" - stat="simnetmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simsimphysicsmsec" - label="Physics Time" - stat="simsimphysicsmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simsimothermsec" - label="Simulation Time" - stat="simsimothermsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simagentmsec" - label="Agent Time" - stat="simagentmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simimagesmsec" - label="Images Time" - stat="simimagesmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simscriptmsec" - label="Script Time" - stat="simscriptmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - - <stat_bar - name="simsparemsec" - label="Spare Time" - stat="simsparemsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - <!--2nd level time blocks under 'Details' second--> - <stat_view - name="timedetails" - label="Time Details (ms)" - show_label="true"> - <stat_bar - name="simsimphysicsstepmsec" - label=" Physics Step" - stat="simsimphysicsstepmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - <stat_bar - name="simsimphysicsshapeupdatemsec" - label=" Update Phys Shapes" - stat="simsimphysicsshapeupdatemsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - <stat_bar - name="simsimphysicsothermsec" - label=" Physics Other" - stat="simsimphysicsothermsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - <stat_bar - name="simsleepmsec" - label=" Sleep Time" - stat="simsleepmsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - <stat_bar - name="simpumpiomsec" - label=" Pump IO" - stat="simpumpiomsec" - unit_label="ms" - precision="3" - bar_min="0.f" - bar_max="40.f" - tick_spacing="10.f" - label_spacing="20.f" - show_per_sec="false" - show_bar="false" - show_mean="false" > - </stat_bar> - </stat_view> - </stat_view> - </stat_view> - </container_view> - </scroll_container> + <stat_view name="memory" + label="Memory Usage"> + <stat_bar name="LLTrace" + label="LLTrace" + stat="LLTrace"/> + <stat_bar name="LLView" + label="UI" + stat="LLView"/> + <stat_bar name="LLFontFreetype" + label="Fonts" + stat="LLFontFreetype"/> + <stat_bar name="LLInventoryObject" + label="Inventory" + stat="LLInventoryObject"/> + <stat_bar name="LLViewerObject" + label="Viewer Objects" + stat="LLViewerObject"/> + <stat_bar name="LLViewerOctreeGroup" + label="Octree Group Data" + stat="LLViewerOctreeGroup"/> + <stat_bar name="LLViewerOctreeEntry" + label="Octree Data" + stat="LLViewerOctreeEntry"/> + <stat_bar name="LLVOCacheEntry" + label="Viewer Object Cache" + stat="LLVOCacheEntry"/> + <stat_bar name="LLDrawable" + label="Drawables" + stat="LLDrawable"/> + <stat_bar name="LLFace" + label="Face Data" + stat="LLFace"/> + <stat_bar name="LLDrawInfo" + label="Draw Info" + stat="LLDrawInfo"/> + <stat_bar name="LLTexture" + label="Texture Data" + stat="LLTexture"/> + <stat_bar name="LLImage" + label="Image Data" + stat="LLImage"/> + <stat_bar name="LLImageGL" + label="GL Image Data" + stat="LLImageGL"/> + <stat_bar name="LLVertexBuffer" + label="Vertex Buffers" + stat="LLVertexBuffer"/> + </stat_view> + <stat_view name="network" + label="Network" + setting="OpenDebugStatNet"> + <stat_bar name="packetsinstat" + label="Packets In" + stat="Packets In" + decimal_digits="1"/> + <stat_bar name="packetsoutstat" + label="Packets Out" + stat="packetsoutstat" + decimal_digits="1"/> + <stat_bar name="objectdatareceived" + label="Objects" + stat="objectdatareceived" + decimal_digits="1"/> + <stat_bar name="texturedatareceived" + label="Texture" + stat="texturedatareceived" + decimal_digits="1"/> + <stat_bar name="assetudpdatareceived" + label="Asset" + stat="assetudpdatareceived" + decimal_digits="1"/> + <stat_bar name="layersdatareceived" + label="Layers" + stat="layersdatareceived" + decimal_digits="1"/> + <stat_bar name="messagedatain" + label="Actual In" + stat="messagedatain" + decimal_digits="1"/> + <stat_bar name="messagedataout" + label="Actual Out" + stat="messagedataout" + decimal_digits="1" + show_history="false"/> + <stat_bar name="vfspendingoperations" + label="VFS Pending Operations" + stat="vfspendingoperations" + unit_label="Ops."/> + </stat_view> + </stat_view> + + <stat_view name="sim" + label="Simulator" + setting="OpenDebugStatSim"> + <stat_bar name="simtimedilation" + label="Time Dilation" + stat="simtimedilation"/> + <stat_bar name="simfps" + label="Sim FPS" + stat="simfps" + decimal_digits="1" + bar_max="45" /> + <stat_bar name="simphysicsfps" + label="Physics FPS" + stat="simphysicsfps" + decimal_digits="1" + bar_max="45" /> + <stat_view name="physicsdetail" + label="Physics Details"> + <stat_bar name="physicspinnedtasks" + label="Pinned Objects" + stat="physicspinnedtasks"/> + <stat_bar name="physicslodtasks" + label="Low LOD Objects" + stat="physicslodtasks"/> + <stat_bar name="physicsmemoryallocated" + label="Memory Allocated" + stat="physicsmemoryallocated" + decimal_digits="1"/> + </stat_view> + <stat_bar name="simagentups" + label="Agent Updates/Sec" + stat="simagentups" + decimal_digits="1"/> + <stat_bar name="simmainagents" + label="Main Agents" + stat="simmainagents"/> + <stat_bar name="simchildagents" + label="Child Agents" + stat="simchildagents"/> + <stat_bar name="simobjects" + label="Objects" + stat="simobjects"/> + <stat_bar name="simactiveobjects" + label="Active Objects" + stat="simactiveobjects"/> + <stat_bar name="simactivescripts" + label="Active Scripts" + stat="simactivescripts"/> + <stat_bar name="simpctscriptsrun" + label="Scripts Run" + stat="simpctscriptsrun"/> + <stat_bar name="simscripteps" + label="Script Events" + stat="simscripteps" + unit_label="eps"/> + <stat_view name="simpathfinding" + label="Pathfinding"> + <stat_bar name="simsimaistepmsec" + label="AI Step Time" + stat="simsimaistepmsec"/> + <stat_bar name="simsimskippedsilhouettesteps" + label="Skipped Silhouette Steps" + stat="simsimskippedsilhouettesteps" + unit_label="/sec"/> + <stat_bar name="simsimpctsteppedcharacters" + stat="simsimpctsteppedcharacters" + decimal_digits="1"/> + </stat_view> + <stat_bar name="siminpps" + label="Packets In" + stat="siminpps" + unit_label="pkt/sec"/> + <stat_bar name="simoutpps" + label="Packets Out" + stat="simoutpps" + unit_label="pkt/sec"/> + <stat_bar name="simpendingdownloads" + label="Pending Downloads" + stat="simpendingdownloads"/> + <stat_bar name="simpendinguploads" + label="Pending Uploads" + stat="simpendinguploads"/> + <stat_bar name="simtotalunackedbytes" + label="Total Unacked Data" + stat="simtotalunackedbytes" + decimal_digits="1"/> + <stat_view name="simperf" + label="Time"> + <stat_bar name="simframemsec" + label="Total Frame Time" + stat="simframemsec"/> + <stat_bar name="simnetmsec" + label="Net Time" + stat="simnetmsec"/> + <stat_bar name="simsimphysicsmsec" + label="Physics Time" + stat="simsimphysicsmsec"/> + <stat_bar name="simsimothermsec" + label="Simulation Time" + stat="simsimothermsec"/> + <stat_bar name="simagentmsec" + label="Agent Time" + stat="simagentmsec"/> + <stat_bar name="simimagesmsec" + label="Images Time" + stat="simimagesmsec"/> + <stat_bar name="simscriptmsec" + label="Script Time" + stat="simscriptmsec"/> + <stat_bar name="simsparemsec" + label="Spare Time" + stat="simsparemsec"/> + <stat_view name="timedetails" + label="Time Details"> + <stat_bar name="simsimphysicsstepmsec" + label="Physics Step" + stat="simsimphysicsstepmsec"/> + <stat_bar name="simsimphysicsshapeupdatemsec" + label="Update Phys Shapes" + stat="simsimphysicsshapeupdatemsec"/> + <stat_bar name="simsimphysicsothermsec" + label="Physics Other" + stat="simsimphysicsothermsec"/> + <stat_bar name="simsleepmsec" + label="Sleep Time" + stat="simsleepmsec"/> + <stat_bar name="simpumpiomsec" + label="Pump IO" + stat="simpumpiomsec"/> + </stat_view> + </stat_view> + </stat_view> + </container_view> + </scroll_container> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml index d8211c24a72744f149cdc82c4126fcc79c251654..bc19d6e79f5d70c134c092a52516d7b5c686e9cf 100755 --- a/indra/newview/skins/default/xui/en/floater_toybox.xml +++ b/indra/newview/skins/default/xui/en/floater_toybox.xml @@ -4,7 +4,6 @@ can_dock="false" can_minimize="false" can_resize="false" - default_tab_group="1" height="375" help_topic="toybox" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index d91b4243b2938704c835904185b1070bcfad52b5..ec20c25f14ea1e9187c215f6d0d93788d7a80711 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1507,6 +1507,14 @@ function="Floater.Toggle" parameter="stats" /> </menu_item_check> + <menu_item_call + label="Scene Load Statistics" + name="Scene Load Statistics" + shortcut="control|shift|2"> + <on_click + function="Floater.Show" + parameter="scene_load_stats" /> + </menu_item_call> <menu_item_check label="Show Draw Weight for Avatars" name="Avatar Rendering Cost"> @@ -2113,6 +2121,16 @@ function="Advanced.ToggleConsole" parameter="scene view" /> </menu_item_check> + <menu_item_check + label="Scene Loading Monitor" + name="Scene Loading Monitor"> + <menu_item_check.on_check + function="Advanced.CheckConsole" + parameter="scene monitor" /> + <menu_item_check.on_click + function="Advanced.ToggleConsole" + parameter="scene monitor" /> + </menu_item_check> <menu_item_call enabled="false" visible="false" @@ -2893,6 +2911,16 @@ function="ToggleControl" parameter="RenderHoverGlowEnable" /> </menu_item_check> + <menu_item_separator /> + + <menu_item_call + enabled="true" + label="Clear Cache Immediately" + name="Cache Clear"> + <menu_item_call.on_click + function="Develop.ClearCache" /> + </menu_item_call> + </menu> <menu diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray_lite.xml b/indra/newview/skins/default/xui/en/panel_bottomtray_lite.xml index 27a27473d81985399b0e49cc2da154428b95c86a..1c0b205c4f6668f4406e42c5f9bf9e964e55f72f 100755 --- a/indra/newview/skins/default/xui/en/panel_bottomtray_lite.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray_lite.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel - default_tab_group="2" mouse_opaque="true" background_visible="true" bg_alpha_color="DkGray" diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml index 1c882bb099aa48ee30e1fe944fc8d58b9b883837..0518688f45ab4ae166253df7b9602b06bf731396 100755 --- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel - default_tab_group="1" follows="all" height="423" label="Things" @@ -57,7 +56,6 @@ left="7" name="inventory filter tabs" tab_height="30" - tab_group="1" tab_position="top" tab_min_width="100" top_pad="10" diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml index 19143cef89835b3c1a0e62e5b400576149f2216e..1e43db08f782a36ee2c1c9611f78b487885cd2c6 100755 --- a/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel - default_tab_group="1" follows="left|bottom|right" height="25" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml index b61f110e32f92c067c86769694fc33e0fcfe5e3e..3f13cea58e8d4639df0b7e11c80b1ad317c372b7 100755 --- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml @@ -12,32 +12,32 @@ name="outfit_edit" top="0" width="320"> - <string - name="No Outfit" - value="No Outfit"/> - <string - name="unsaved_changes" - value="Unsaved Changes"/> - <string - name="now_editing" - value="Now Editing"/> - <string - name="folder_view_off" - value="Hierarchy_View_Disabled" - translate="false"/> - <string - name="folder_view_on" - value="Hierarchy_View_On" - translate="false"/> - <string - name="list_view_off" - value="List_View_Disabled" - translate="false"/> - <string - name="list_view_on" - value="List_View_On" - translate="false"/> - + <string + name="No Outfit" + value="No Outfit"/> + <string + name="unsaved_changes" + value="Unsaved Changes"/> + <string + name="now_editing" + value="Now Editing"/> + <string + name="folder_view_off" + value="Hierarchy_View_Disabled" + translate="false"/> + <string + name="folder_view_on" + value="Hierarchy_View_On" + translate="false"/> + <string + name="list_view_off" + value="List_View_Disabled" + translate="false"/> + <string + name="list_view_on" + value="List_View_On" + translate="false"/> + <panel.string name="not_available"> (N\A) @@ -47,475 +47,466 @@ (unknown) </panel.string> - <!-- Wearables filtering strings --> - <string name="Filter.All" value="All"/> - <string name="Filter.Clothes/Body" value="Clothes/Body"/> - <string name="Filter.Objects" value="Objects"/> - <string name="Filter.Clothing" value="Clothing"/> - <string name="Filter.Bodyparts" value="Body parts"/> + <!-- Wearables filtering strings --> + <string name="Filter.All" value="All"/> + <string name="Filter.Clothes/Body" value="Clothes/Body"/> + <string name="Filter.Objects" value="Objects"/> + <string name="Filter.Clothing" value="Clothing"/> + <string name="Filter.Bodyparts" value="Body parts"/> + + <string + name="replace_body_part" + value="Click to replace your existing shape"/> - <string - name="replace_body_part" - value="Click to replace your existing shape"/> - - <button - follows="top|left" - height="24" - image_hover_unselected="BackButton_Over" - image_pressed="BackButton_Press" - image_unselected="BackButton_Off" - layout="topleft" - name="back_btn" - left="5" - tab_stop="false" - top="1" - width="30" - use_draw_context_alpha="false" /> - <text - follows="top|left|right" - font="SansSerifHugeBold" - height="26" - layout="topleft" - left_pad="10" - name="title" - text_color="LtGray" - top="0" - value="Edit Outfit" - use_ellipses="true" - width="275" /> + <button + follows="top|left" + height="24" + image_hover_unselected="BackButton_Over" + image_pressed="BackButton_Press" + image_unselected="BackButton_Off" + layout="topleft" + name="back_btn" + left="5" + tab_stop="false" + top="1" + width="30" + use_draw_context_alpha="false" /> + <text + follows="top|left|right" + font="SansSerifHugeBold" + height="26" + layout="topleft" + left_pad="10" + name="title" + text_color="LtGray" + top="0" + value="Edit Outfit" + use_ellipses="true" + width="275" /> -<!-- "HEADER WITH ICON, STATUS TEXT AND OUTFIT NAME" --> - <panel - background_visible="true" - bg_alpha_color="DkGray2" - bevel_style="none" - follows="top|left|right" - height="40" - layout="topleft" - left="6" - name="header_panel" - top_pad="5" - width="311"> - <icon - follows="left|top" - height="31" - image_name="Shirt_Large" - left="2" - mouse_opaque="false" - name="outfit_icon" - top="2" - scale_image="true" - visible="true" - width="31" /> - <panel - bevel_style="none" - follows="top|left|right" - height="37" - layout="topleft" - left_pad="5" - name="outfit_name_and_status" - top="2" - width="270"> - <text - follows="top|left|right" - font="SansSerifSmallBold" - height="13" - layout="topleft" - name="status" - text_color="EmphasisColor" - top="2" - value="Now editing..." - use_ellipses="true" - width="245" /> - <text - follows="bottom|left|right" - font="SansSerifLargeBold" - height="18" - layout="topleft" - name="curr_outfit_name" - parse_urls="false" - text_color="LtGray" - top_pad="2" - value="[Current Outfit]" - use_ellipses="true" - width="245" /> - <loading_indicator - follows="right|top" - height="24" - layout="topleft" - right="-2" - name="edit_outfit_loading_indicator" - top="6" - width="24" /> - </panel> - </panel> + <!-- "HEADER WITH ICON, STATUS TEXT AND OUTFIT NAME" --> + <panel + background_visible="true" + bg_alpha_color="DkGray2" + bevel_style="none" + follows="top|left|right" + height="40" + layout="topleft" + left="6" + name="header_panel" + top_pad="5" + width="311"> + <icon + follows="left|top" + height="31" + image_name="Shirt_Large" + left="2" + mouse_opaque="false" + name="outfit_icon" + top="2" + scale_image="true" + visible="true" + width="31" /> + <panel + bevel_style="none" + follows="top|left|right" + height="37" + layout="topleft" + left_pad="5" + name="outfit_name_and_status" + top="2" + width="270"> + <text + follows="top|left|right" + font="SansSerifSmallBold" + height="13" + layout="topleft" + name="status" + text_color="EmphasisColor" + top="2" + value="Now editing..." + use_ellipses="true" + width="245" /> + <text + follows="bottom|left|right" + font="SansSerifLargeBold" + height="18" + layout="topleft" + name="curr_outfit_name" + parse_urls="false" + text_color="LtGray" + top_pad="2" + value="[Current Outfit]" + use_ellipses="true" + width="245" /> + <loading_indicator + follows="right|top" + height="24" + layout="topleft" + right="-2" + name="edit_outfit_loading_indicator" + top="6" + width="24" /> + </panel> + </panel> -<!-- LIST OF WEARABLES (CURRENT OUTFIT/ WEARABLES TO ADD) --> -<!-- *NOTE: border_size is used to calculate space between layout panels and also to calculate resize bar's height. + <!-- LIST OF WEARABLES (CURRENT OUTFIT/ WEARABLES TO ADD) --> + <!-- *NOTE: border_size is used to calculate space between layout panels and also to calculate resize bar's height. Required height for dragbar (icon in spec) is 10, so resizebar height should be 10 px. It is calculated as border_size + 2*UIResizeBarOverlap --> - <layout_stack - animate="true" - border_size="8" - clip="false" - default_tab_group="2" - follows="all" - height="465" - width="313" - layout="topleft" - orientation="vertical" - name="im_panels" - tab_group="1" - top_pad="5" - left="5"> - <layout_panel - layout="topleft" - height="187" - min_height="155" - name="outfit_wearables_panel" - width="313" - auto_resize="true" - user_resize="true"> + <layout_stack + animate="true" + border_size="8" + clip="false" + default_tab_group="2" + follows="all" + height="465" + width="313" + layout="topleft" + orientation="vertical" + name="im_panels" + tab_group="1" + top_pad="5" + left="5"> + <layout_panel + layout="topleft" + height="187" + min_height="155" + name="outfit_wearables_panel" + width="313" + auto_resize="true" + user_resize="true"> - <layout_stack - animate="true" - border_size="0" - follows="all" - height="185" - width="313" - orientation="vertical" - layout="topleft" - name="filter_panels" - top="0" - left="0"> - <layout_panel - auto_resize="true" - background_visible="false" - layout="topleft" - height="154" - name="add_button_and_combobox" - width="311" - visible="true"> + <layout_stack + animate="true" + border_size="0" + follows="all" + height="185" + width="313" + orientation="vertical" + layout="topleft" + name="filter_panels" + top="0" + left="0"> + <layout_panel + auto_resize="true" + background_visible="false" + layout="topleft" + height="154" + name="add_button_and_combobox" + width="311" + visible="true"> - <!-- List containing items from the COF and Base outfit --> - <panel - background_visible="false" - class="cof_wearables" - filename="panel_cof_wearables.xml" - follows="all" - height="129" - layout="topleft" - left="1" - name="cof_wearables_list" - top="0" - width="311" /> + <!-- List containing items from the COF and Base outfit --> + <panel + background_visible="false" + class="cof_wearables" + filename="panel_cof_wearables.xml" + follows="all" + height="129" + layout="topleft" + left="1" + name="cof_wearables_list" + top="0" + width="311" /> - <button - follows="left|bottom" - height="22" - image_pressed="PushButton_Press" - image_pressed_selected="PushButton_Selected_Press" - image_selected="PushButton_Selected_Press" - is_toggle="true" - label="Add More..." - layout="topleft" - left="2" - name="show_add_wearables_btn" - top_pad="2" - tool_tip="Open/Close" - width="125" /> + <button + follows="left|bottom" + height="22" + image_pressed="PushButton_Press" + image_pressed_selected="PushButton_Selected_Press" + image_selected="PushButton_Selected_Press" + is_toggle="true" + label="Add More..." + layout="topleft" + left="2" + name="show_add_wearables_btn" + top_pad="2" + tool_tip="Open/Close" + width="125" /> - <combo_box - follows="left|right|bottom" - height="22" - layout="topleft" - left_pad="5" - name="list_view_filter_combobox" - top_delta="0" - visible="false" - width="152"/> - <combo_box - follows="left|right|bottom" - height="22" - layout="topleft" - left_delta="0" - name="folder_view_filter_combobox" - top_delta="0" - visible="false" - width="152"/> - - <button - follows="bottom|right" - height="22" - image_overlay="Search_Icon" - image_pressed="PushButton_Press" - image_pressed_selected="PushButton_Selected_Press" - image_selected="PushButton_Selected_Press" - is_toggle="true" - layout="topleft" - name="filter_button" - right="-5" - top_delta="0" - visible="false" - width="20" /> - </layout_panel> + <combo_box + follows="left|right|bottom" + height="22" + layout="topleft" + left_pad="5" + name="list_view_filter_combobox" + top_delta="0" + visible="false" + width="152"/> + <combo_box + follows="left|right|bottom" + height="22" + layout="topleft" + left_delta="0" + name="folder_view_filter_combobox" + top_delta="0" + visible="false" + width="152"/> - <layout_panel - auto_resize="false" - background_visible="true" - bg_alpha_color="DkGray2" - height="30" - name="filter_panel" - width="311" - visible="false"> + <button + follows="bottom|right" + height="22" + image_overlay="Search_Icon" + image_pressed="PushButton_Press" + image_pressed_selected="PushButton_Selected_Press" + image_selected="PushButton_Selected_Press" + is_toggle="true" + layout="topleft" + name="filter_button" + right="-5" + top_delta="0" + visible="false" + width="20" /> + </layout_panel> - <filter_editor - background_image="TextField_Search_Off" - enabled="true" - follows="left|right|top" - label="Filter Inventory Wearables" - layout="topleft" - left="5" - width="290" - height="25" - name="look_item_filter" - search_button_visible="true" - text_color="black" - visible="true"/> - - </layout_panel> - </layout_stack> - </layout_panel> + <layout_panel + auto_resize="false" + background_visible="true" + bg_alpha_color="DkGray2" + height="30" + name="filter_panel" + width="311" + visible="false"> + <filter_editor + background_image="TextField_Search_Off" + enabled="true" + follows="left|right|top" + label="Filter Inventory Wearables" + layout="topleft" + left="5" + width="290" + height="25" + name="look_item_filter" + search_button_visible="true" + text_color="black" + visible="true"/> - <layout_panel - background_visible="false" - bg_alpha_color="DkGray2" - auto_resize="true" - default_tab_group="3" - height="450" - min_height="80" - name="add_wearables_panel" - width="313" - tab_group="2" - user_resize="true" - visible="false"> + </layout_panel> + </layout_stack> + </layout_panel> + + + <layout_panel background_visible="false" + bg_alpha_color="DkGray2" + auto_resize="true" + height="450" + min_height="80" + name="add_wearables_panel" + width="313" + tab_group="2" + user_resize="true" + visible="false"> <!-- this icon represent dragbar between layout panels. This is a workaround implemented in EXT-7255 becouse of an issue with layout stack (EXT-7471) --> - <icon - follows="left|top|right" - height="10" - image_name="Dragbar" - left="0" - top_pad="-9" - width="313" /> + <icon follows="left|top|right" + height="10" + image_name="Dragbar" + left="0" + top_pad="-9" + width="313" /> + <inventory_panel allow_multi_select="true" + background_visible="false" + border="false" + follows="left|top|right|bottom" + height="418" + layout="topleft" + left="0" + mouse_opaque="false" + name="folder_view" + top_pad="0" + width="313" + visible="false"/> + <panel name="filtered_wearables_panel" + background_opaque="true" + background_visible="false" + layout="topleft" + follows="left|top|right|bottom" + border="false" + height="418" + left="0" + mouse_opaque="false" + width="310" + top_delta="0" + visible="true"> + <wearable_items_list color="0.107 0.107 0.107 1" + name="list_view" + allow_select="true" + layout="topleft" + follows="all" + multi_select="true" + width="313" + height="418" + left="0" + top="0"/> + </panel> + <button follows="bottom|left" + height="22" + left="2" + label="Wear Item" + layout="topleft" + name="plus_btn" + top_pad="5" + width="130" /> + </layout_panel> + </layout_stack> - <inventory_panel - allow_multi_select="true" - background_visible="false" - border="false" - follows="left|top|right|bottom" - height="418" - layout="topleft" - left="0" - mouse_opaque="false" - name="folder_view" - top_pad="0" - width="313" - visible="false"/> - <panel - name="filtered_wearables_panel" - background_opaque="true" - background_visible="false" - layout="topleft" - follows="left|top|right|bottom" - border="false" - height="418" - left="0" - mouse_opaque="false" - width="310" - top_delta="0" - visible="true"> - <wearable_items_list - color="0.107 0.107 0.107 1" - name="list_view" - allow_select="true" - layout="topleft" - follows="all" - multi_select="true" - width="313" - height="418" - left="0" - top="0"/> - </panel> - <button - follows="bottom|left" - height="22" - left="2" - label="Wear Item" - layout="topleft" - name="plus_btn" - top_pad="5" - width="130" /> - </layout_panel> - </layout_stack> + <!-- BUTTON BAR --> + <panel + background_visible="true" + bevel_style="none" + follows="bottom|left|right" + height="27" + layout="topleft" + left="5" + name="no_add_wearables_button_bar" + top_pad="0" + width="313"> + <menu_button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Left_Over" + image_overlay="OptionsMenu_Off" + image_selected="Toolbar_Left_Selected" + image_unselected="Toolbar_Left_Off" + layout="topleft" + left="0" + name="gear_menu_btn" + top="1" + width="31" /> + <icon + follows="bottom|left|right" + height="25" + image_name="Toolbar_Middle_Off" + layout="topleft" + left_pad="1" + name="dummy_right_icon" + width="250" /> + <button + follows="bottom|right" + height="25" + image_hover_unselected="Toolbar_Right_Over" + image_overlay="Shop" + image_selected="Toolbar_Right_Selected" + image_unselected="Toolbar_Right_Off" + layout="topleft" + left_pad="1" + name="shop_btn_1" + top="1" + tool_tip="Visit the SL Marketplace. You can also select something you are wearing, then click here to see more things like it" + width="31" /> + </panel> - <!-- BUTTON BAR --> - <panel - background_visible="true" - bevel_style="none" - follows="bottom|left|right" - height="27" - layout="topleft" - left="5" - name="no_add_wearables_button_bar" - top_pad="0" - width="313"> - <menu_button - follows="bottom|left" - height="25" - image_hover_unselected="Toolbar_Left_Over" - image_overlay="OptionsMenu_Off" - image_selected="Toolbar_Left_Selected" - image_unselected="Toolbar_Left_Off" - layout="topleft" - left="0" - name="gear_menu_btn" - top="1" - width="31" /> - <icon - follows="bottom|left|right" - height="25" - image_name="Toolbar_Middle_Off" - layout="topleft" - left_pad="1" - name="dummy_right_icon" - width="250" /> - <button - follows="bottom|right" - height="25" - image_hover_unselected="Toolbar_Right_Over" - image_overlay="Shop" - image_selected="Toolbar_Right_Selected" - image_unselected="Toolbar_Right_Off" - layout="topleft" - left_pad="1" - name="shop_btn_1" - top="1" - tool_tip="Visit the SL Marketplace. You can also select something you are wearing, then click here to see more things like it" - width="31" /> - </panel> - - - <!-- BUTTON BAR - WEARABLES ADDING MODE --> - <panel - background_visible="true" - bevel_style="none" - follows="left|right|bottom" - height="27" - layout="topleft" - left="5" - name="add_wearables_button_bar" - top_delta="0" - visible="false" - width="313"> - <menu_button - follows="bottom|left" - height="25" - image_hover_unselected="Toolbar_Left_Over" - image_overlay="OptionsMenu_Off" - image_selected="Toolbar_Left_Selected" - image_unselected="Toolbar_Left_Off" - layout="topleft" - left="0" - name="wearables_gear_menu_btn" - top="1" - width="31" /> - <button - follows="bottom|left" - height="25" - image_hover_unselected="Toolbar_Middle_Over" - image_overlay="Hierarchy_View_Disabled" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" - is_toggle="true" - layout="topleft" - left_pad="1" - name="folder_view_btn" - top="1" - width="31" /> - <button - follows="bottom|left" - height="25" - image_hover_unselected="Toolbar_Middle_Over" - image_overlay="List_View_On" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" - is_toggle="true" - layout="topleft" - left_pad="1" - name="list_view_btn" - top="1" - width="31" /> - <icon - follows="bottom|left|right" - height="25" - image_name="Toolbar_Middle_Off" - layout="topleft" - left_pad="1" - name="dummy_right_icon" - width="186" > - </icon> - <button - follows="bottom|right" - height="25" - image_hover_unselected="Toolbar_Right_Over" - image_overlay="Shop" - image_selected="Toolbar_Right_Selected" - image_unselected="Toolbar_Right_Off" - layout="topleft" - left_pad="1" - name="shop_btn_2" - top="1" - tool_tip="Visit the SL Marketplace. You can also select something you are wearing, then click here to see more things like it" - width="31" /> - </panel> + <!-- BUTTON BAR - WEARABLES ADDING MODE --> + <panel + background_visible="true" + bevel_style="none" + follows="left|right|bottom" + height="27" + layout="topleft" + left="5" + name="add_wearables_button_bar" + top_delta="0" + visible="false" + width="313"> + <menu_button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Left_Over" + image_overlay="OptionsMenu_Off" + image_selected="Toolbar_Left_Selected" + image_unselected="Toolbar_Left_Off" + layout="topleft" + left="0" + name="wearables_gear_menu_btn" + top="1" + width="31" /> + <button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="Hierarchy_View_Disabled" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + is_toggle="true" + layout="topleft" + left_pad="1" + name="folder_view_btn" + top="1" + width="31" /> + <button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="List_View_On" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + is_toggle="true" + layout="topleft" + left_pad="1" + name="list_view_btn" + top="1" + width="31" /> + <icon + follows="bottom|left|right" + height="25" + image_name="Toolbar_Middle_Off" + layout="topleft" + left_pad="1" + name="dummy_right_icon" + width="186" > + </icon> + <button + follows="bottom|right" + height="25" + image_hover_unselected="Toolbar_Right_Over" + image_overlay="Shop" + image_selected="Toolbar_Right_Selected" + image_unselected="Toolbar_Right_Off" + layout="topleft" + left_pad="1" + name="shop_btn_2" + top="1" + tool_tip="Visit the SL Marketplace. You can also select something you are wearing, then click here to see more things like it" + width="31" /> + </panel> - <!-- SAVE AND REVERT BUTTONS --> - <panel - follows="left|right|bottom" - height="30" - layout="topleft" - left="4" - top_pad="2" - name="save_revert_button_bar" - width="300"> - <layout_stack - follows="bottom|left|right" - height="23" - layout="topleft" - mouse_opaque="false" - name="button_bar_ls" - left="0" - orientation="horizontal" - top="0" - width="313"> - <layout_panel - follows="bottom|left|right" - height="23" - layout="bottomleft" - left="0" - mouse_opaque="false" - name="save_btn_lp" - auto_resize="true" - width="156"> - <button + <!-- SAVE AND REVERT BUTTONS --> + <panel + follows="left|right|bottom" + height="30" + layout="topleft" + left="4" + top_pad="2" + name="save_revert_button_bar" + width="300"> + <layout_stack + follows="bottom|left|right" + height="23" + layout="topleft" + mouse_opaque="false" + name="button_bar_ls" + left="0" + orientation="horizontal" + top="0" + width="313"> + <layout_panel + follows="bottom|left|right" + height="23" + layout="bottomleft" + left="0" + mouse_opaque="false" + name="save_btn_lp" + auto_resize="true" + width="156"> + <button follows="bottom|left|right" height="23" label="Save" @@ -524,7 +515,7 @@ It is calculated as border_size + 2*UIResizeBarOverlap name="save_btn" top="0" width="155" /> - <button + <button follows="bottom|right" height="23" name="save_flyout_btn" @@ -539,17 +530,17 @@ It is calculated as border_size + 2*UIResizeBarOverlap image_pressed_selected="SegmentedBtn_Right_Selected_Press" image_overlay="Arrow_Small_Up" width="20"/> - </layout_panel> - <layout_panel - follows="bottom|left|right" - height="23" - layout="bottomleft" - left_pad="3" - mouse_opaque="false" - name="revert_btn_lp" - auto_resize="true" - width="147"> - <button + </layout_panel> + <layout_panel + follows="bottom|left|right" + height="23" + layout="bottomleft" + left_pad="3" + mouse_opaque="false" + name="revert_btn_lp" + auto_resize="true" + width="147"> + <button follows="bottom|left|right" height="23" left="0" @@ -559,7 +550,7 @@ It is calculated as border_size + 2*UIResizeBarOverlap top="0" tool_tip="Revert to last saved version" width="147" /> - </layout_panel> - </layout_stack> - </panel> + </layout_panel> + </layout_stack> + </panel> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index d2caf63052a046df11a5fb66e3775508ba473218..2d4665c12813940c84eebe4b6806fb4f25ef3efc 100755 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <!-- Side tray panel --> <panel - default_tab_group="1" follows="all" height="449" label="People" @@ -60,7 +59,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M layout="topleft" left="3" name="tabs" - tab_group="1" tab_min_width="70" tab_height="30" tab_position="top" diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index 14bd34948041110ae0017d92c0a2552cfea123f0..d3e24a19efd5502edb580a39aeed4e1891b12ab4 100755 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -12,17 +12,19 @@ follows="all" layout="topleft" left="0" - name="sidepanel__inventory_panel" + name="sidepanel_inventory_panel" top="0" label="" height="570" visible="true" + default_tab_group="1" width="330"> - <layout_stack + <layout_stack follows="left|right|top|bottom" layout="topleft" left="0" top="0" + tab_group="1" orientation="vertical" name="inventory_layout_stack" height="535" @@ -75,7 +77,7 @@ <button control_name="InventoryInboxToggleState" label="Received items" - font="SansSerifMedium" + font="SansSerifMedium" name="inbox_btn" height="35" width="308" @@ -116,61 +118,56 @@ background_opaque="true" tool_tip="Drag and drop items to your inventory to use them" > - <text - name="inbox_inventory_placeholder" - type="string" - follows="all" - layout="topleft" - top="0" - left="0" - width="308" - height="200" - wrap="true" - halign="center"> - Purchases from the marketplace will be delivered here. - </text> + <text name="inbox_inventory_placeholder" + type="string" + follows="all" + layout="topleft" + top="0" + left="0" + width="308" + height="200" + wrap="true" + halign="center"> +Purchases from the marketplace will be delivered here. + </text> </panel> </panel> </layout_panel> </layout_stack> - <panel - follows="bottom|left|right" - height="30" - layout="topleft" - name="button_panel" - left="9" - top_pad="7" - width="308"> - <layout_stack - follows="bottom|left|right" - height="23" - layout="topleft" - mouse_opaque="false" - name="button_panel_ls" - left="0" - orientation="horizontal" - top="0" - width="308"> - <layout_panel - follows="bottom|left|right" - height="23" - layout="bottomleft" - left="0" - mouse_opaque="false" - name="info_btn_lp" - auto_resize="true" - width="101"> - <button - enabled="true" - follows="bottom|left|right" - height="23" - label="Profile" - layout="topleft" - left="1" - name="info_btn" - tool_tip="Show object profile" - top="0" - width="100" /> + <panel follows="bottom|left|right" + height="30" + layout="topleft" + name="button_panel" + left="9" + top_pad="7" + width="308"> + <layout_stack follows="bottom|left|right" + height="23" + layout="topleft" + mouse_opaque="false" + name="button_panel_ls" + left="0" + orientation="horizontal" + top="0" + width="308"> + <layout_panel follows="bottom|left|right" + height="23" + layout="bottomleft" + left="0" + mouse_opaque="false" + name="info_btn_lp" + auto_resize="true" + width="101"> + <button enabled="true" + follows="bottom|left|right" + height="23" + label="Profile" + layout="topleft" + left="1" + name="info_btn" + tool_tip="Show object profile" + top="0" + width="100" /> </layout_panel> <layout_panel follows="bottom|left|right" diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index a0ad694f529922cd9f3c72f56d2bedd5724031dd..3d129e09cc28a9b6f0fdf056f5249e6b13b6de02 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2462,6 +2462,7 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. <!-- compile queue--> <string name="CompileQueueDownloadedCompiling">Downloaded, now compiling</string> + <string name="CompileQueueServiceUnavailable">Script compilation service not available</string> <string name="CompileQueueScriptNotFound">Script not found on server.</string> <string name="CompileQueueProblemDownloading">Problem downloading</string> <string name="CompileQueueInsufficientPermDownload">Insufficient permissions to download a script.</string> diff --git a/indra/newview/skins/default/xui/en/widgets/avatar_icon.xml b/indra/newview/skins/default/xui/en/widgets/avatar_icon.xml index 4d69dda7eb4457d0cd3793744ef3691502097fb8..7f8fac04d0e6c5d85201f47e1bd0e21fa0ad137c 100755 --- a/indra/newview/skins/default/xui/en/widgets/avatar_icon.xml +++ b/indra/newview/skins/default/xui/en/widgets/avatar_icon.xml @@ -1,7 +1,9 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<avatar_icon - name="avatar_icon" - default_icon_name="Generic_Person_Large" - use_draw_context_alpha="false"> -</avatar_icon> +<avatar_icon name="avatar_icon" + default_icon_name="Generic_Person_Large" + use_draw_context_alpha="false" + symbol_hpad = "2" + symbol_vpad = "1" + symbol_size = "5"/> + diff --git a/indra/newview/skins/default/xui/en/widgets/floater.xml b/indra/newview/skins/default/xui/en/widgets/floater.xml index 97a5ae7d4e575451496c357d644206b4a582a03c..807b67d1125f8469fc031be0913e16a83dbf6755 100755 --- a/indra/newview/skins/default/xui/en/widgets/floater.xml +++ b/indra/newview/skins/default/xui/en/widgets/floater.xml @@ -2,7 +2,6 @@ <!-- See also settings.xml UIFloater* settings for configuration --> <floater name="floater" - positioning="none" layout="topleft" bg_opaque_color="FloaterFocusBackgroundColor" bg_alpha_color="FloaterDefaultBackgroundColor" diff --git a/indra/newview/skins/default/xui/es/floater_lagmeter.xml b/indra/newview/skins/default/xui/es/floater_lagmeter.xml deleted file mode 100755 index 227689a1947d9a71f5f4d1cb9da78ef726a041fc..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/es/floater_lagmeter.xml +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="MEDIDOR DEL LAG"> - <floater.string name="max_title_msg"> - Medidor del lag - </floater.string> - <floater.string name="max_width_px"> - 360 - </floater.string> - <floater.string name="min_title_msg"> - Lag - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - Cliente - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - Normal, ventana en segundo plano - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - Frames del cliente valorados por debajo de [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - Frames del cliente valorados entre [CLIENT_FRAME_RATE_CRITICAL] y [CLIENT_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - Posible causa: distancia de dibujo fijada muy alta - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - Posible causa: imágenes cargándose - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - Posible causa: demasiadas imágenes en la memoria - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - Posible causa: demasiados objetos complejos en la escena - </floater.string> - <floater.string name="network_text_msg"> - Red - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - La conexión deja caer más del [NETWORK_PACKET_LOSS_CRITICAL]% de los paquetes - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - La conexión deja caer [NETWORK_PACKET_LOSS_WARNING]%-[NETWORK_PACKET_LOSS_CRITICAL]% de los paquetes - </floater.string> - <floater.string name="network_performance_normal_msg"> - Normal - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - El tiempo de conexión -ping- supera los [NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_ping_warning_msg"> - El tiempo de conexión -ping- es de [NETWORK_PING_WARNING]-[NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - Quizá una mala conexión o un ancho de banda fijado demasiado alto. - </floater.string> - <floater.string name="network_ping_cause_msg"> - Quizá una mala conexión o una aplicación de archivos compartidos. - </floater.string> - <floater.string name="server_text_msg"> - Servidor - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - Frecuencia (framerate) por debajo de [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - Frecuencia (framerate) entre [SERVER_FRAME_RATE_CRITICAL] y [SERVER_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="server_physics_cause_msg"> - Posible causa: demasiados objetos fÃsicos - </floater.string> - <floater.string name="server_scripts_cause_msg"> - Posible causa: demasiados objetos con script - </floater.string> - <floater.string name="server_net_cause_msg"> - Posible causa: demasiado tráfico en la red - </floater.string> - <floater.string name="server_agent_cause_msg"> - Posible causa: demasiada gente moviéndose en la región - </floater.string> - <floater.string name="server_images_cause_msg"> - Posible causa: demasiados cálculos de imáganes - </floater.string> - <floater.string name="server_generic_cause_msg"> - Posible causa: carga del simulador muy pesada - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button label="" label_selected="" name="client_lagmeter" tool_tip="Estado del lag del cliente"/> - <text name="client"> - Cliente - </text> - <text font="SansSerifSmall" name="client_text"> - Normal - </text> - <text left="30" name="client_lag_cause" right="-10"/> - <button label="" label_selected="" name="network_lagmeter" tool_tip="Estado del lag de la red"/> - <text name="network"> - Red - </text> - <text font="SansSerifSmall" name="network_text"> - Normal - </text> - <text left="30" name="network_lag_cause" right="-10"/> - <button label="" label_selected="" name="server_lagmeter" tool_tip="Estado del lag del servidor"/> - <text name="server"> - Servidor - </text> - <text font="SansSerifSmall" name="server_text"> - Normal - </text> - <text left="30" name="server_lag_cause" right="-32"/> - <button label=">>" name="minimize" tool_tip="Cambia el tamaño de la ventana"/> -</floater> diff --git a/indra/newview/skins/default/xui/es/sidepanel_inventory.xml b/indra/newview/skins/default/xui/es/sidepanel_inventory.xml index f68dcc65e390e14f882d10371beee57737e58013..9ce14c856f3b27ffafd1a98426aa967f395a4984 100755 --- a/indra/newview/skins/default/xui/es/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/es/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="Cosas" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <layout_stack name="inventory_layout_stack"> <layout_panel name="inbox_layout_panel"> <panel label="" name="marketplace_inbox"> diff --git a/indra/newview/skins/default/xui/fr/floater_lagmeter.xml b/indra/newview/skins/default/xui/fr/floater_lagmeter.xml deleted file mode 100755 index 39a861d8bd2b5b175d98426efacc4d2512c9f5f8..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/fr/floater_lagmeter.xml +++ /dev/null @@ -1,151 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="MESURE DU LAG"> - <floater.string name="max_title_msg"> - Mesure du lag - </floater.string> - <floater.string name="max_width_px"> - 360 - </floater.string> - <floater.string name="min_title_msg"> - Lag - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - Client - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - Normal, fenêtre en arrière-plan - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - Taux de défilement [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - Taux de défilement entre [CLIENT_FRAME_RATE_CRITICAL] et [CLIENT_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - Cause possible : limite d'affichage trop élevée - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - Cause possible : images en cours de chargement - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - Cause possible : trop d'images en mémoire - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - Cause possible : trop d'objets complexes - </floater.string> - <floater.string name="network_text_msg"> - Réseau - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - La connexion perd plus de [NETWORK_PACKET_LOSS_CRITICAL] % de paquets - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - La connexion perd entre [NETWORK_PACKET_LOSS_WARNING] % et [NETWORK_PACKET_LOSS_CRITICAL] % de paquets - </floater.string> - <floater.string name="network_performance_normal_msg"> - Normal - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - Connexion ping > [NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_ping_warning_msg"> - Connexion ping entre [NETWORK_PING_WARNING] et [NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - Mauvaise connexion possible ou réglage de la bande passante trop élevé. - </floater.string> - <floater.string name="network_ping_cause_msg"> - Mauvaise connexion possible ou app. de partage des fichiers - </floater.string> - <floater.string name="server_text_msg"> - Serveur - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - Défilement du simulateur < [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - Défilement simulateur entre [SERVER_FRAME_RATE_CRITICAL] et [SERVER_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="server_physics_cause_msg"> - Cause possible : trop d'objets physiques - </floater.string> - <floater.string name="server_scripts_cause_msg"> - Cause possible : trop d'objets scriptés - </floater.string> - <floater.string name="server_net_cause_msg"> - Cause possible : trop de trafic réseau - </floater.string> - <floater.string name="server_agent_cause_msg"> - Cause possible : trop de personnes en mouvement - </floater.string> - <floater.string name="server_images_cause_msg"> - Cause possible : trop de calculs d'images - </floater.string> - <floater.string name="server_generic_cause_msg"> - Cause possible : charge simulateur trop lourde - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button name="client_lagmeter" tool_tip="Statut du lag client"/> - <text name="client"> - Client - </text> - <text name="client_text"> - Normal - </text> - <button name="network_lagmeter" tool_tip="Statut du lag réseau"/> - <text name="network"> - Réseau - </text> - <text name="network_text"> - Normal - </text> - <button name="server_lagmeter" tool_tip="Statut du lag serveur"/> - <text name="server"> - Serveur - </text> - <text name="server_text"> - Normal - </text> - <button label=">>" name="minimize" tool_tip="Activer/désactiver la taille du floater"/> -</floater> diff --git a/indra/newview/skins/default/xui/fr/sidepanel_inventory.xml b/indra/newview/skins/default/xui/fr/sidepanel_inventory.xml index 1b9c8326799883a2d5423be00fffb56507475b4b..ec7dd8c095d0d758cd567ab4ba67aa0b54eb95a4 100755 --- a/indra/newview/skins/default/xui/fr/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/fr/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="Choses" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <layout_stack name="inventory_layout_stack"> <layout_panel name="inbox_layout_panel"> <panel label="" name="marketplace_inbox"> diff --git a/indra/newview/skins/default/xui/it/floater_lagmeter.xml b/indra/newview/skins/default/xui/it/floater_lagmeter.xml deleted file mode 100755 index f7b2b1ab4a402cb60d0fd64d3819129f52120a4b..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/it/floater_lagmeter.xml +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="MISURATORE LAG"> - <floater.string name="max_title_msg"> - Misuratore del lag - </floater.string> - <floater.string name="max_width_px"> - 360 - </floater.string> - <floater.string name="min_title_msg"> - Lag - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - Programma in locale - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - Normale, finestra sullo sfondo - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - Velocità dei frame al di sotto di [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - Velocità dei frame tra [CLIENT_FRAME_RATE_CRITICAL] e [CLIENT_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - Normale - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - Possibile causa: Campo visivo impostato troppo alto - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - Possibile causa: Caricamento immagini - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - Possibile causa: Troppe immagini in memoria - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - Possibile causa: Troppi oggetti complessi intorno - </floater.string> - <floater.string name="network_text_msg"> - Network - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - La connessione sta calando al di sotto del [NETWORK_PACKET_LOSS_CRITICAL]% di pacchetti - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - La connessione sta calando tra il [NETWORK_PACKET_LOSS_WARNING]% e il [NETWORK_PACKET_LOSS_CRITICAL]% di pacchetti - </floater.string> - <floater.string name="network_performance_normal_msg"> - Normale - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - Il tempo di ping della connessione è al di sopra di [NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_ping_warning_msg"> - Il tempo di ping della connessione è tra [NETWORK_PING_WARNING]-[NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - Possibile cattiva connessione o la larghezza di banda impostata nelle preferenze troppo alta. - </floater.string> - <floater.string name="network_ping_cause_msg"> - Possibile cattiva connessione o l'apertura di un programma di scambio files. - </floater.string> - <floater.string name="server_text_msg"> - Server - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - Velocità dei frame al di sotto di [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - Velocità dei frame tra [SERVER_FRAME_RATE_CRITICAL] e [SERVER_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - Normale - </floater.string> - <floater.string name="server_physics_cause_msg"> - Possibile causa: troppi oggetti fisici - </floater.string> - <floater.string name="server_scripts_cause_msg"> - Possibile causa: troppi oggetti scriptati - </floater.string> - <floater.string name="server_net_cause_msg"> - Possibile causa: eccessivo traffico sulla rete - </floater.string> - <floater.string name="server_agent_cause_msg"> - Possibile causa: troppi residenti in movimento nella regione - </floater.string> - <floater.string name="server_images_cause_msg"> - Possibile causa: troppe elaborazioni di immagini - </floater.string> - <floater.string name="server_generic_cause_msg"> - Possibile causa: carico eccessivo del simulatore - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button label="" label_selected="" name="client_lagmeter" tool_tip="Stato del lag del programma in locale"/> - <text name="client"> - Client - </text> - <text font="SansSerifSmall" left="145" name="client_text"> - Normale - </text> - <text left="30" name="client_lag_cause" right="-10"/> - <button label="" label_selected="" name="network_lagmeter" tool_tip="Stato del lag del network"/> - <text name="network"> - Rete - </text> - <text font="SansSerifSmall" name="network_text"> - Normale - </text> - <text left="30" name="network_lag_cause" right="-10"/> - <button label="" label_selected="" name="server_lagmeter" tool_tip="Stato del lag del server"/> - <text name="server"> - Server - </text> - <text font="SansSerifSmall" name="server_text"> - Normale - </text> - <text left="30" name="server_lag_cause" right="-32"/> - <button label=">>" name="minimize" tool_tip="Cambia dimensioni floater"/> -</floater> diff --git a/indra/newview/skins/default/xui/it/sidepanel_inventory.xml b/indra/newview/skins/default/xui/it/sidepanel_inventory.xml index 5ac0961bd754b5be842130b6c4edefd08835538d..907857bf5a28a72869efa4c101d81c93705b05b7 100755 --- a/indra/newview/skins/default/xui/it/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/it/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="Cose" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <layout_stack name="inventory_layout_stack"> <layout_panel name="inbox_layout_panel"> <panel label="" name="marketplace_inbox"> diff --git a/indra/newview/skins/default/xui/ja/floater_lagmeter.xml b/indra/newview/skins/default/xui/ja/floater_lagmeter.xml deleted file mode 100755 index e3546cd83754744f7265847ac9780806d4158a5e..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/ja/floater_lagmeter.xml +++ /dev/null @@ -1,151 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="ラグメーター"> - <floater.string name="max_title_msg"> - ラグ メーター - </floater.string> - <floater.string name="max_width_px"> - 350 - </floater.string> - <floater.string name="min_title_msg"> - ラグ - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - クライアント - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - ノーマルã€ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã¯èƒŒæ™¯ã« - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - クライアント フレームレート < [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - クライアント フレームレート: [CLIENT_FRAME_RATE_CRITICAL] ~ [CLIENT_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - ノーマル - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - 考ãˆã‚‰ã‚Œã‚‹åŽŸå› : æç”»è·é›¢ã®è¨å®šãŒå¤§ãã™ãŽã‚‹ - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - 考ãˆã‚‰ã‚Œã‚‹åŽŸå› : ç”»åƒã®ãƒãƒ¼ãƒ‰ä¸ - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - 考ãˆã‚‰ã‚Œã‚‹åŽŸå› : メモリ内ã®ç”»åƒæ•°ãŒå¤šã™ãŽã‚‹ - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - 考ãˆã‚‰ã‚Œã‚‹åŽŸå› : ç”»é¢ã«å«ã¾ã‚Œã‚‹è¤‡é›‘ãªã‚ªãƒ–ジェクトãŒå¤šã™ãŽã‚‹ - </floater.string> - <floater.string name="network_text_msg"> - ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯ - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - 接続ã§ãƒ‰ãƒãƒƒãƒ—ã•ã‚Œã‚‹ãƒ‘ケットã®å‰²åˆ: > [NETWORK_PACKET_LOSS_CRITICAL] - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - 接続ã§ãƒ‰ãƒãƒƒãƒ—ã•ã‚Œã‚‹ãƒ‘ケットã®å‰²åˆ:[NETWORK_PACKET_LOSS_WARNING] ~ [NETWORK_PACKET_LOSS_CRITICAL] - </floater.string> - <floater.string name="network_performance_normal_msg"> - ノーマル - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - 接続㮠ping 時間: > [NETWORK_PING_CRITICAL] ミリ秒 - </floater.string> - <floater.string name="network_ping_warning_msg"> - 接続㮠ping 時間: [NETWORK_PING_WARNING] ~ [NETWORK_PING_CRITICAL] ミリ秒 - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - 接続ä¸è‰¯ã«ãªã£ã¦ã„ã‚‹ã‹ã€å¸¯åŸŸå¹…è¨å®šãŒé«˜ã™ãŽã¾ã™ã€‚ - </floater.string> - <floater.string name="network_ping_cause_msg"> - 接続ä¸è‰¯ã«ãªã£ã¦ã„ã‚‹ã‹ã€ãƒ•ã‚¡ã‚¤ãƒ«å…±æœ‰ã‚¢ãƒ—リケーションã«å•é¡ŒãŒã‚ã‚Šã¾ã™ã€‚ - </floater.string> - <floater.string name="server_text_msg"> - サーãƒãƒ¼ - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - シミュレーターã®ãƒ•ãƒ¬ãƒ¼ãƒ レート: < [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - シミュレーターã®ãƒ•ãƒ¬ãƒ¼ãƒ レート: [SERVER_FRAME_RATE_CRITICAL] ~ [SERVER_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - ノーマル - </floater.string> - <floater.string name="server_physics_cause_msg"> - 考ãˆã‚‰ã‚Œã‚‹åŽŸå› : 物ç†çš„オブジェクトãŒå¤šã™ãŽã‚‹ - </floater.string> - <floater.string name="server_scripts_cause_msg"> - 考ãˆã‚‰ã‚Œã‚‹åŽŸå› : スクリプトをå«ã‚€ã‚ªãƒ–ジェクトãŒå¤šã™ãŽã‚‹ - </floater.string> - <floater.string name="server_net_cause_msg"> - 考ãˆã‚‰ã‚Œã‚‹åŽŸå› : ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯ トラフィックéŽå¤§ - </floater.string> - <floater.string name="server_agent_cause_msg"> - 考ãˆã‚‰ã‚Œã‚‹åŽŸå› : 地域内ã«ã¦å‹•ã„ã¦ã„ã‚‹ã‚¢ãƒã‚¿ãƒ¼ãŒå¤šã™ãŽã‚‹ - </floater.string> - <floater.string name="server_images_cause_msg"> - 考ãˆã‚‰ã‚Œã‚‹åŽŸå› : ç”»åƒè¨ˆç®—ãŒå¤šã™ãŽã‚‹ - </floater.string> - <floater.string name="server_generic_cause_msg"> - 考ãˆã‚‰ã‚Œã‚‹åŽŸå› : シミュレーターã®éŽè² è· - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button name="client_lagmeter" tool_tip="クライアント ラグ ステータス"/> - <text name="client"> - クライアント - </text> - <text name="client_text"> - ノーマル - </text> - <button name="network_lagmeter" tool_tip="ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯ ラグ ステータス"/> - <text name="network"> - ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯ - </text> - <text name="network_text"> - ノーマル - </text> - <button name="server_lagmeter" tool_tip="サーãƒãƒ¼ ラグ ステータス"/> - <text name="server"> - サーãƒãƒ¼ - </text> - <text name="server_text"> - ノーマル - </text> - <button label=">> " name="minimize" tool_tip="フãƒãƒ¼ã‚¿ãƒ¼ã®ã‚µã‚¤ã‚ºã‚’トグル"/> -</floater> diff --git a/indra/newview/skins/default/xui/ja/sidepanel_inventory.xml b/indra/newview/skins/default/xui/ja/sidepanel_inventory.xml index 51d6d48f90aad1a93597759a8ab6a3f2174d2481..32e84ce5429f182cb76a519a53bb4551c4a1f24b 100755 --- a/indra/newview/skins/default/xui/ja/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/ja/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="ã‚‚ã®" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <layout_stack name="inventory_layout_stack"> <layout_panel name="inbox_layout_panel"> <panel label="" name="marketplace_inbox"> diff --git a/indra/newview/skins/default/xui/pl/floater_lagmeter.xml b/indra/newview/skins/default/xui/pl/floater_lagmeter.xml deleted file mode 100755 index 8038550bcb30637ac063dfd4edf0ea17ae6dd2d0..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/pl/floater_lagmeter.xml +++ /dev/null @@ -1,151 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="POMIAR LAGÓW"> - <floater.string name="max_title_msg"> - Pomiar lagów - </floater.string> - <floater.string name="max_width_px"> - 360 - </floater.string> - <floater.string name="min_title_msg"> - Lag - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - Klient - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - W normie, okno w tle - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - Ilość klatek na sekundÄ™ klienta poniżej [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - Ilość klatek na sekundÄ™ pomiÄ™dzy [CLIENT_FRAME_RATE_CRITICAL] i [CLIENT_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - W normie - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - Przyczyna: dystans rysowania jest za wysoki - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - Przyczyna: Å‚adowanie obrazu - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - Przyczyna: za dużo obrazów w pamiÄ™ci - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - Przyczyna: za dużo zÅ‚ożonych obiektów - </floater.string> - <floater.string name="network_text_msg"> - Sieć - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - Utrata pakietów przekracza [NETWORK_PACKET_LOSS_CRITICAL]% - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - Utrata pakietów przekracza [NETWORK_PACKET_LOSS_WARNING]%-[NETWORK_PACKET_LOSS_CRITICAL]% - </floater.string> - <floater.string name="network_performance_normal_msg"> - W normie - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - Fatalny ping - [NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_ping_warning_msg"> - Wolny ping - [NETWORK_PING_WARNING]-[NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - ZÅ‚e poÅ‚Ä…czenie lub przepustowość. - </floater.string> - <floater.string name="network_ping_cause_msg"> - ZÅ‚e poÅ‚Ä…czenie lub aplikacja współdzielÄ…ca pliki. - </floater.string> - <floater.string name="server_text_msg"> - Serwer - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - Ilość klatek na sekundÄ™ poniżej [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - Ilość klatek na sekundÄ™ pomiÄ™dzy [SERVER_FRAME_RATE_CRITICAL] i [SERVER_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - W normie - </floater.string> - <floater.string name="server_physics_cause_msg"> - Przyczyna: za dużo obiektów fizycznych - </floater.string> - <floater.string name="server_scripts_cause_msg"> - Przyczyna: za dużo obieków skryptowanych - </floater.string> - <floater.string name="server_net_cause_msg"> - Przyczyna: za duży ruch w sieci - </floater.string> - <floater.string name="server_agent_cause_msg"> - Przyczyna: za dużo poruszajÄ…cych siÄ™ awatarów w regionie - </floater.string> - <floater.string name="server_images_cause_msg"> - Przyczyna: za dużo kalkulacji obrazu - </floater.string> - <floater.string name="server_generic_cause_msg"> - Przyczyna: symulator Å‚aduje siÄ™ zbyt powoli - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button label="" label_selected="" name="client_lagmeter" tool_tip="Status lagów klienta"/> - <text name="client"> - Klient - </text> - <text name="client_text"> - W normie - </text> - <button label="" label_selected="" name="network_lagmeter" tool_tip="Network lag status"/> - <text name="network"> - Sieć - </text> - <text name="network_text"> - W normie - </text> - <button label="" label_selected="" name="server_lagmeter" tool_tip="Server lag status"/> - <text name="server"> - Serwer - </text> - <text name="server_text"> - W normie - </text> - <button label=">>" name="minimize" tool_tip="ZÅ‚Ä…cz rozmiar pliku xml"/> -</floater> diff --git a/indra/newview/skins/default/xui/pl/sidepanel_inventory.xml b/indra/newview/skins/default/xui/pl/sidepanel_inventory.xml index c2e50473a5e41c3ff01968728e8d542183be178f..1034a06f1fca18c61feeea7b1500ab8b554b84ec 100755 --- a/indra/newview/skins/default/xui/pl/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/pl/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="Rzeczy" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <panel name="button_panel"> <layout_stack name="button_panel_ls"> <layout_panel name="info_btn_lp"> diff --git a/indra/newview/skins/default/xui/pt/floater_lagmeter.xml b/indra/newview/skins/default/xui/pt/floater_lagmeter.xml deleted file mode 100755 index 9932318293fea64443288e00255d8f79d31296f4..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/pt/floater_lagmeter.xml +++ /dev/null @@ -1,154 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="LAG - Ãndice"> - <floater.string name="max_title_msg"> - Medidor de Atraso - </floater.string> - <floater.string name="max_width_px"> - 360 - </floater.string> - <floater.string name="min_title_msg"> - Atraso - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - Cliente - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - Normal, janela por baixo - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - Taxa de quadros do Cliente abaixo de [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - Taxa de quadros do Cliente entre [CLIENT_FRAME_RATE_CRITICAL] e [CLIENT_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - Causa possÃvel: Distância de desenho ajustada muito alta - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - Causa possÃvel: Carregamento de Imagens - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - Causa possÃvel: Muitas imagens na memória - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - Causa possÃvel: Muitos objetos complexos na cena - </floater.string> - <floater.string name="network_text_msg"> - Rede - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - Conexão está caindo para cerca de [NETWORK_PACKET_LOSS_CRITICAL]% de pacotes - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - Conexão está caindo [NETWORK_PACKET_LOSS_WARNING]%-[NETWORK_PACKET_LOSS_CRITICAL]% de pacotes - </floater.string> - <floater.string name="network_performance_normal_msg"> - Normal - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - Tempo de conexão de ping é cerca de [NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_ping_warning_msg"> - Tempo de conexão de ping é [NETWORK_PING_WARNING]-[NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - PossÃvel conexão ruim ou 'Largura de Banda' escolhida muito alta. - </floater.string> - <floater.string name="network_ping_cause_msg"> - PossÃvel conexão ruim ou aplicativos compartilhando arquivos. - </floater.string> - <floater.string name="server_text_msg"> - Servidor - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - Taxa de quadros abaixo de [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - Taxa de quadros entre [SERVER_FRAME_RATE_CRITICAL] e [SERVER_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="server_physics_cause_msg"> - Causa possÃvel: Muitos objetos fÃsicos - </floater.string> - <floater.string name="server_scripts_cause_msg"> - Causa possÃvel: Muitos objetos com scripts - </floater.string> - <floater.string name="server_net_cause_msg"> - Causa possÃvel: Muito tráfego na rede - </floater.string> - <floater.string name="server_agent_cause_msg"> - Causa possÃvel: Muitas pessoas se movendo na região - </floater.string> - <floater.string name="server_images_cause_msg"> - Causa possÃvel: Muitos cálculos de imagem - </floater.string> - <floater.string name="server_generic_cause_msg"> - Causa possÃvel: Carga no simulador muito pesada - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button label="" label_selected="" name="client_lagmeter" tool_tip="Status de atraso no Cliente"/> - <text name="client"> - Cliente - </text> - <text font="SansSerifSmall" name="client_text"> - Normal - </text> - <text left="30" name="client_lag_cause" right="-10"/> - <button label="" label_selected="" name="network_lagmeter" tool_tip="Status de atraso na rede"/> - <text name="network"> - Rede - </text> - <text font="SansSerifSmall" name="network_text"> - Normal - </text> - <text left="30" name="network_lag_cause" right="-10"/> - <button label="" label_selected="" name="server_lagmeter" tool_tip="Status de atraso no servidor"/> - <text name="server"> - Servidor - </text> - <text font="SansSerifSmall" name="server_text"> - Normal - </text> - <text left="30" name="server_lag_cause" right="-32"/> - <button label=">>" name="minimize" tool_tip="Alternar o tamanho da janela"/> -</floater> diff --git a/indra/newview/skins/default/xui/pt/sidepanel_inventory.xml b/indra/newview/skins/default/xui/pt/sidepanel_inventory.xml index 7908ea5f3a44430d3064d71d52c781766c61ed53..c44345323ff203072e3a949ee1a127a54112c21b 100755 --- a/indra/newview/skins/default/xui/pt/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/pt/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="Coisas" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <layout_stack name="inventory_layout_stack"> <layout_panel name="inbox_layout_panel"> <panel label="" name="marketplace_inbox"> diff --git a/indra/newview/skins/default/xui/ru/floater_lagmeter.xml b/indra/newview/skins/default/xui/ru/floater_lagmeter.xml deleted file mode 100755 index c420006a03c394e955f543a1bdae6486bd0a2832..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/ru/floater_lagmeter.xml +++ /dev/null @@ -1,151 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="УРОВЕÐЬ ЛÐГОВ"> - <floater.string name="max_title_msg"> - Уровень лагов - </floater.string> - <floater.string name="max_width_px"> - 360 - </floater.string> - <floater.string name="min_title_msg"> - Лаг - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - Клиент - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - Ðормально, окно в фоне - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - ЧаÑтота кадров клиента ниже [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - ЧаÑтота кадров клиента от [CLIENT_FRAME_RATE_CRITICAL] до [CLIENT_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - Ðормально - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - Ð’Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°Ñ Ð¿Ñ€Ð¸Ñ‡Ð¸Ð½Ð°: дальноÑÑ‚ÑŒ отриÑовки Ñлишком велика - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - Ð’Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°Ñ Ð¿Ñ€Ð¸Ñ‡Ð¸Ð½Ð°: загрузка изображений - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - Ð’Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°Ñ Ð¿Ñ€Ð¸Ñ‡Ð¸Ð½Ð°: Ñлишком много изображений в памÑти - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - Ð’Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°Ñ Ð¿Ñ€Ð¸Ñ‡Ð¸Ð½Ð°: Ñлишком много Ñложных объектов в Ñцене - </floater.string> - <floater.string name="network_text_msg"> - Сеть - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - Сеть терÑет более [NETWORK_PACKET_LOSS_CRITICAL]% пакетов - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - Сеть терÑет [NETWORK_PACKET_LOSS_WARNING]–[NETWORK_PACKET_LOSS_CRITICAL]% пакетов - </floater.string> - <floater.string name="network_performance_normal_msg"> - Ðормально - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - Пинг ÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ Ð±Ð¾Ð»ÐµÐµ [NETWORK_PING_CRITICAL] Ð¼Ñ - </floater.string> - <floater.string name="network_ping_warning_msg"> - Пинг ÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ [NETWORK_PING_WARNING]–[NETWORK_PING_CRITICAL] Ð¼Ñ - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - Возможно, плохое Ñоединение, или параметр «Ширина канала» Ñлишком велик. - </floater.string> - <floater.string name="network_ping_cause_msg"> - Возможно, плохое Ñоединение или еÑÑ‚ÑŒ работающие файлообменные программы. - </floater.string> - <floater.string name="server_text_msg"> - Сервер - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - ЧаÑтота кадров Ñервера ниже [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - ЧаÑтота кадров Ñервера [SERVER_FRAME_RATE_CRITICAL]–[SERVER_FRAME_RATE_WARNING] - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - Ðормально - </floater.string> - <floater.string name="server_physics_cause_msg"> - Ð’Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°Ñ Ð¿Ñ€Ð¸Ñ‡Ð¸Ð½Ð°: Ñлишком много физичеÑких объектов - </floater.string> - <floater.string name="server_scripts_cause_msg"> - Ð’Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°Ñ Ð¿Ñ€Ð¸Ñ‡Ð¸Ð½Ð°: Ñлишком много Ñкриптовых объектов - </floater.string> - <floater.string name="server_net_cause_msg"> - Ð’Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°Ñ Ð¿Ñ€Ð¸Ñ‡Ð¸Ð½Ð°: Ñлишком большой Ñетевой трафик - </floater.string> - <floater.string name="server_agent_cause_msg"> - Ð’Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°Ñ Ð¿Ñ€Ð¸Ñ‡Ð¸Ð½Ð°: Ñлишком много людей в регионе - </floater.string> - <floater.string name="server_images_cause_msg"> - Ð’Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°Ñ Ð¿Ñ€Ð¸Ñ‡Ð¸Ð½Ð°: Ñлишком много изображений - </floater.string> - <floater.string name="server_generic_cause_msg"> - Ð’Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°Ñ Ð¿Ñ€Ð¸Ñ‡Ð¸Ð½Ð°: Ñервер Ñильно загружен - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button name="client_lagmeter" tool_tip="Уровень лагов клиента"/> - <text name="client"> - Клиент - </text> - <text name="client_text"> - Ðормально - </text> - <button name="network_lagmeter" tool_tip="Уровень лагов Ñети"/> - <text name="network"> - Сеть - </text> - <text name="network_text"> - Ðормально - </text> - <button name="server_lagmeter" tool_tip="Уровень лагов Ñервера"/> - <text name="server"> - Сервер - </text> - <text name="server_text"> - Ðормально - </text> - <button label=">>" name="minimize" tool_tip="Переключение размера"/> -</floater> diff --git a/indra/newview/skins/default/xui/ru/sidepanel_inventory.xml b/indra/newview/skins/default/xui/ru/sidepanel_inventory.xml index c106c2de7943defc766a3ab1f64be175f7273cf6..1741f63074c6e67dd07c94f4beec75e93389a9b2 100755 --- a/indra/newview/skins/default/xui/ru/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/ru/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="Вещи" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <layout_stack name="inventory_layout_stack"> <layout_panel name="inbox_layout_panel"> <panel label="" name="marketplace_inbox"> diff --git a/indra/newview/skins/default/xui/tr/floater_lagmeter.xml b/indra/newview/skins/default/xui/tr/floater_lagmeter.xml deleted file mode 100755 index 736c50be90a4a68ef1f2d98e4751017496595b84..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/tr/floater_lagmeter.xml +++ /dev/null @@ -1,151 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="GECÄ°KME ÖLÇER"> - <floater.string name="max_title_msg"> - Gecikme Ölçer - </floater.string> - <floater.string name="max_width_px"> - 360 - </floater.string> - <floater.string name="min_title_msg"> - Gecikme - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - Ä°stemci - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - Normal, pencere alt zeminde - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - Ä°stemci kare hızı [CLIENT_FRAME_RATE_CRITICAL] altında - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - Ä°stemci kare hızı [CLIENT_FRAME_RATE_CRITICAL] ile [CLIENT_FRAME_RATE_WARNING] arasınad - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - Muhtemel neden: Çizme mesafesi çok yüksek - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - Muhtemel neden: Görüntüler yükleniyor - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - Muhtemel neden: Bellekte çok fazla görüntü - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - Muhtemel neden: Sahnede çok fazla karmaşık nesne - </floater.string> - <floater.string name="network_text_msg"> - AÄŸ - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - BaÄŸlantı paketlerin % [NETWORK_PACKET_LOSS_CRITICAL]'sinden fazlasını bırakıyor - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - BaÄŸlantı paketlerin % [NETWORK_PACKET_LOSS_WARNING]%-[NETWORK_PACKET_LOSS_CRITICAL]'sini bırakıyor - </floater.string> - <floater.string name="network_performance_normal_msg"> - Normal - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - BaÄŸlantı ping süresi [NETWORK_PING_CRITICAL] ms.den fazla - </floater.string> - <floater.string name="network_ping_warning_msg"> - BaÄŸlantı ping süresi [NETWORK_PING_WARNING]-[NETWORK_PING_CRITICAL] ms - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - Muhtemel yetersiz baÄŸlantı veya 'Bant GeniÅŸliÄŸi' tercihi çok yüksek. - </floater.string> - <floater.string name="network_ping_cause_msg"> - Muhtemel yetersiz baÄŸlantı veya dosya paylaşım uygulaması. - </floater.string> - <floater.string name="server_text_msg"> - Sunucu - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - Simülatör kare hızı [SERVER_FRAME_RATE_CRITICAL] altında - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - Simülatör kare hızı [SERVER_FRAME_RATE_CRITICAL] ve [SERVER_FRAME_RATE_WARNING] arasında - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - Normal - </floater.string> - <floater.string name="server_physics_cause_msg"> - Muhtemel Neden: Çok fazla fiziki nesne - </floater.string> - <floater.string name="server_scripts_cause_msg"> - Muhtemel Neden: Çok fazla komut dosyalı nesne - </floater.string> - <floater.string name="server_net_cause_msg"> - Muhtemel Neden: Çok fazla aÄŸ trafiÄŸi - </floater.string> - <floater.string name="server_agent_cause_msg"> - Muhtemel Neden: Bölgede hareket eden çok fazla insan var - </floater.string> - <floater.string name="server_images_cause_msg"> - Muhtemel Neden: Çok fazla görüntü hesabı - </floater.string> - <floater.string name="server_generic_cause_msg"> - Muhtemel Neden: Simülatör yükü çok ağır - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button name="client_lagmeter" tool_tip="Ä°stemci gecikme durumu"/> - <text name="client"> - Ä°stemci - </text> - <text name="client_text"> - Normal - </text> - <button name="network_lagmeter" tool_tip="AÄŸ gecikme durumu"/> - <text name="network"> - AÄŸ - </text> - <text name="network_text"> - Normal - </text> - <button name="server_lagmeter" tool_tip="Sunucu gecikme durumu"/> - <text name="server"> - Sunucu - </text> - <text name="server_text"> - Normal - </text> - <button label=">>" name="minimize" tool_tip="Gezdirici büyüklüğünü deÄŸiÅŸtir"/> -</floater> diff --git a/indra/newview/skins/default/xui/tr/sidepanel_inventory.xml b/indra/newview/skins/default/xui/tr/sidepanel_inventory.xml index 938b5a76d83ca146acae7cc8d065d2a60d40928c..3241d52c81405b5eda5cf45a10b496d604550d40 100755 --- a/indra/newview/skins/default/xui/tr/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/tr/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="EÅŸyalar" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <layout_stack name="inventory_layout_stack"> <layout_panel name="inbox_layout_panel"> <panel label="" name="marketplace_inbox"> diff --git a/indra/newview/skins/default/xui/zh/floater_lagmeter.xml b/indra/newview/skins/default/xui/zh/floater_lagmeter.xml deleted file mode 100755 index e9a082288a613601f52677f352c412da33f29ff9..0000000000000000000000000000000000000000 --- a/indra/newview/skins/default/xui/zh/floater_lagmeter.xml +++ /dev/null @@ -1,151 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes"?> -<floater name="floater_lagmeter" title="LAG 測é‡å™¨"> - <floater.string name="max_title_msg"> - Lag 測é‡å™¨ - </floater.string> - <floater.string name="max_width_px"> - 360 - </floater.string> - <floater.string name="min_title_msg"> - å»¶é² - </floater.string> - <floater.string name="min_width_px"> - 90 - </floater.string> - <floater.string name="client_text_msg"> - 客戶端 - </floater.string> - <floater.string name="client_frame_rate_critical_fps"> - 10 - </floater.string> - <floater.string name="client_frame_rate_warning_fps"> - 15 - </floater.string> - <floater.string name="client_frame_time_window_bg_msg"> - æ£å¸¸ï¼Œè¦–窗ä½æ–¼èƒŒæ™¯ - </floater.string> - <floater.string name="client_frame_time_critical_msg"> - 客戶端幀率低於 [CLIENT_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="client_frame_time_warning_msg"> - 客戶端幀率介於 [CLIENT_FRAME_RATE_CRITICAL] å’Œ [CLIENT_FRAME_RATE_WARNING] 之間 - </floater.string> - <floater.string name="client_frame_time_normal_msg"> - æ£å¸¸ - </floater.string> - <floater.string name="client_draw_distance_cause_msg"> - å¯èƒ½åŽŸå› :å¯è¦–è·é›¢è¨å¾—太é - </floater.string> - <floater.string name="client_texture_loading_cause_msg"> - å¯èƒ½åŽŸå› :æ£åœ¨è¼‰å…¥åœ–åƒ - </floater.string> - <floater.string name="client_texture_memory_cause_msg"> - å¯èƒ½åŽŸå› :記憶體裡圖åƒå¤ªå¤š - </floater.string> - <floater.string name="client_complex_objects_cause_msg"> - å¯èƒ½åŽŸå› ï¼šå ´æ™¯å…§è¤‡é›œç‰©ä»¶å¤ªå¤š - </floater.string> - <floater.string name="network_text_msg"> - 網路 - </floater.string> - <floater.string name="network_packet_loss_critical_pct"> - 10 - </floater.string> - <floater.string name="network_packet_loss_warning_pct"> - 5 - </floater.string> - <floater.string name="network_packet_loss_critical_msg"> - 這次連通丟失了至少 [NETWORK_PACKET_LOSS_CRITICAL]% çš„å°åŒ… - </floater.string> - <floater.string name="network_packet_loss_warning_msg"> - 這次連通丟失了 [NETWORK_PACKET_LOSS_WARNING]%-[NETWORK_PACKET_LOSS_CRITICAL]% çš„å°åŒ… - </floater.string> - <floater.string name="network_performance_normal_msg"> - æ£å¸¸ - </floater.string> - <floater.string name="network_ping_critical_ms"> - 600 - </floater.string> - <floater.string name="network_ping_warning_ms"> - 300 - </floater.string> - <floater.string name="network_ping_critical_msg"> - æŽ¢æ¸¬é€£é€šå›žæ‡‰æ™‚é–“è¶…éŽ [NETWORK_PING_CRITICAL] 毫秒 - </floater.string> - <floater.string name="network_ping_warning_msg"> - 探測連通回應時間為 [NETWORK_PING_WARNING]-[NETWORK_PING_CRITICAL] 毫秒 - </floater.string> - <floater.string name="network_packet_loss_cause_msg"> - å¯èƒ½é€£é€šä¸è‰¯ï¼Œæˆ–所è¨çš„åå¥½é€£é€šé »å¯¬éŽé«˜ã€‚ - </floater.string> - <floater.string name="network_ping_cause_msg"> - å¯èƒ½é€£é€šä¸è‰¯ï¼Œæˆ–使用檔案分享應用程å¼ã€‚ - </floater.string> - <floater.string name="server_text_msg"> - 伺æœå™¨ - </floater.string> - <floater.string name="server_frame_rate_critical_fps"> - 20 - </floater.string> - <floater.string name="server_frame_rate_warning_fps"> - 30 - </floater.string> - <floater.string name="server_single_process_max_time_ms"> - 20 - </floater.string> - <floater.string name="server_frame_time_critical_msg"> - 模擬器 framerate 低於 [SERVER_FRAME_RATE_CRITICAL] - </floater.string> - <floater.string name="server_frame_time_warning_msg"> - 模擬器 framerate 介於 [SERVER_FRAME_RATE_CRITICAL] 與 [SERVER_FRAME_RATE_WARNING] 之間 - </floater.string> - <floater.string name="server_frame_time_normal_msg"> - æ£å¸¸ - </floater.string> - <floater.string name="server_physics_cause_msg"> - å¯èƒ½åŽŸå› :太多物ç†ç‰©ä»¶ - </floater.string> - <floater.string name="server_scripts_cause_msg"> - å¯èƒ½åŽŸå› :太多腳本物件 - </floater.string> - <floater.string name="server_net_cause_msg"> - å¯èƒ½åŽŸå› :太多網路æµé‡ - </floater.string> - <floater.string name="server_agent_cause_msg"> - å¯èƒ½åŽŸå› :地å€æœ‰å¤ªå¤šç§»å‹•çš„人 - </floater.string> - <floater.string name="server_images_cause_msg"> - å¯èƒ½åŽŸå› :太多圖åƒè¨ˆç®— - </floater.string> - <floater.string name="server_generic_cause_msg"> - å¯èƒ½åŽŸå› ï¼šæ¨¡æ“¬å™¨è² è¼‰éŽé‡ - </floater.string> - <floater.string name="smaller_label"> - >> - </floater.string> - <floater.string name="bigger_label"> - << - </floater.string> - <button name="client_lagmeter" tool_tip="客戶端 lag 狀態"/> - <text name="client"> - 客戶端 - </text> - <text name="client_text"> - æ£å¸¸ - </text> - <button name="network_lagmeter" tool_tip="網路 lag 狀態"/> - <text name="network"> - 網路 - </text> - <text name="network_text"> - æ£å¸¸ - </text> - <button name="server_lagmeter" tool_tip="伺æœå™¨ lag 狀態"/> - <text name="server"> - 伺æœå™¨ - </text> - <text name="server_text"> - æ£å¸¸ - </text> - <button label=">>" name="minimize" tool_tip="切æ›æµ®å‹•è¦–窗尺寸"/> -</floater> diff --git a/indra/newview/skins/default/xui/zh/sidepanel_inventory.xml b/indra/newview/skins/default/xui/zh/sidepanel_inventory.xml index c8aae1501118cc3a8334c6b42b3a882d02a0e78e..4034a7154fa4822a3c301b6d89a14c4d987d9a40 100755 --- a/indra/newview/skins/default/xui/zh/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/zh/sidepanel_inventory.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <panel label="事物" name="objects panel"> - <panel label="" name="sidepanel__inventory_panel"> + <panel label="" name="sidepanel_inventory_panel"> <layout_stack name="inventory_layout_stack"> <layout_panel name="inbox_layout_panel"> <panel label="" name="marketplace_inbox"> diff --git a/indra/newview/tests/llcapabilitylistener_test.cpp b/indra/newview/tests/llcapabilitylistener_test.cpp index e1cbd28f92b1c35ab3fa05775420adc160db850b..bde991a01e873531f0d6588c4a602b7a72247a54 100755 --- a/indra/newview/tests/llcapabilitylistener_test.cpp +++ b/indra/newview/tests/llcapabilitylistener_test.cpp @@ -134,10 +134,10 @@ namespace tut std::string threw; try { - WrapLL_ERRS capture; + WrapLLErrs capture; regionPump.post(request); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { threw = e.what(); } @@ -181,10 +181,10 @@ namespace tut std::string threw; try { - WrapLL_ERRS capture; + WrapLLErrs capture; regionPump.post(request); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { threw = e.what(); } @@ -243,10 +243,10 @@ namespace tut std::string threw; try { - WrapLL_ERRS capture; + WrapLLErrs capture; regionPump.post(request); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { threw = e.what(); } diff --git a/indra/newview/tests/llsimplestat_test.cpp b/indra/newview/tests/llsimplestat_test.cpp deleted file mode 100755 index b556941f4afdd82caadc5580748a3b1232fdc30d..0000000000000000000000000000000000000000 --- a/indra/newview/tests/llsimplestat_test.cpp +++ /dev/null @@ -1,580 +0,0 @@ -/** - * @file llsimplestats_test.cpp - * @date 2010-10-22 - * @brief Test cases for some of llsimplestat.h - * - * $LicenseInfo:firstyear=2010&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include <tut/tut.hpp> - -#include "lltut.h" -#include "../llsimplestat.h" -#include "llsd.h" -#include "llmath.h" - -// @brief Used as a pointer cast type to get access to LLSimpleStatCounter -class TutStatCounter: public LLSimpleStatCounter -{ -public: - TutStatCounter(); // Not defined - ~TutStatCounter(); // Not defined - void operator=(const TutStatCounter &); // Not defined - - void setRawCount(U32 c) { mCount = c; } - U32 getRawCount() const { return mCount; } -}; - - -namespace tut -{ - struct stat_counter_index - {}; - typedef test_group<stat_counter_index> stat_counter_index_t; - typedef stat_counter_index_t::object stat_counter_index_object_t; - tut::stat_counter_index_t tut_stat_counter_index("stat_counter_test"); - - // Testing LLSimpleStatCounter's external interface - template<> template<> - void stat_counter_index_object_t::test<1>() - { - LLSimpleStatCounter c1; - ensure("Initialized counter is zero", (0 == c1.getCount())); - - ensure("Counter increment return is 1", (1 == ++c1)); - ensure("Counter increment return is 2", (2 == ++c1)); - - ensure("Current counter is 2", (2 == c1.getCount())); - - c1.reset(); - ensure("Counter is 0 after reset", (0 == c1.getCount())); - - ensure("Counter increment return is 1", (1 == ++c1)); - } - - // Testing LLSimpleStatCounter's internal state - template<> template<> - void stat_counter_index_object_t::test<2>() - { - LLSimpleStatCounter c1; - TutStatCounter * tc1 = (TutStatCounter *) &c1; - - ensure("Initialized private counter is zero", (0 == tc1->getRawCount())); - - ++c1; - ++c1; - - ensure("Current private counter is 2", (2 == tc1->getRawCount())); - - c1.reset(); - ensure("Raw counter is 0 after reset", (0 == tc1->getRawCount())); - } - - // Testing LLSimpleStatCounter's wrapping behavior - template<> template<> - void stat_counter_index_object_t::test<3>() - { - LLSimpleStatCounter c1; - TutStatCounter * tc1 = (TutStatCounter *) &c1; - - tc1->setRawCount(U32_MAX); - ensure("Initialized private counter is zero", (U32_MAX == c1.getCount())); - - ensure("Increment of max value wraps to 0", (0 == ++c1)); - } - - // Testing LLSimpleStatMMM's external behavior - template<> template<> - void stat_counter_index_object_t::test<4>() - { - LLSimpleStatMMM<> m1; - typedef LLSimpleStatMMM<>::Value lcl_float; - lcl_float zero(0); - - // Freshly-constructed - ensure("Constructed MMM<> has 0 count", (0 == m1.getCount())); - ensure("Constructed MMM<> has 0 min", (zero == m1.getMin())); - ensure("Constructed MMM<> has 0 max", (zero == m1.getMax())); - ensure("Constructed MMM<> has 0 mean no div-by-zero", (zero == m1.getMean())); - - // Single insert - m1.record(1.0); - ensure("Single insert MMM<> has 1 count", (1 == m1.getCount())); - ensure("Single insert MMM<> has 1.0 min", (1.0 == m1.getMin())); - ensure("Single insert MMM<> has 1.0 max", (1.0 == m1.getMax())); - ensure("Single insert MMM<> has 1.0 mean", (1.0 == m1.getMean())); - - // Second insert - m1.record(3.0); - ensure("2nd insert MMM<> has 2 count", (2 == m1.getCount())); - ensure("2nd insert MMM<> has 1.0 min", (1.0 == m1.getMin())); - ensure("2nd insert MMM<> has 3.0 max", (3.0 == m1.getMax())); - ensure_approximately_equals("2nd insert MMM<> has 2.0 mean", m1.getMean(), lcl_float(2.0), 1); - - // Third insert - m1.record(5.0); - ensure("3rd insert MMM<> has 3 count", (3 == m1.getCount())); - ensure("3rd insert MMM<> has 1.0 min", (1.0 == m1.getMin())); - ensure("3rd insert MMM<> has 5.0 max", (5.0 == m1.getMax())); - ensure_approximately_equals("3rd insert MMM<> has 3.0 mean", m1.getMean(), lcl_float(3.0), 1); - - // Fourth insert - m1.record(1000000.0); - ensure("4th insert MMM<> has 4 count", (4 == m1.getCount())); - ensure("4th insert MMM<> has 1.0 min", (1.0 == m1.getMin())); - ensure("4th insert MMM<> has 100000.0 max", (1000000.0 == m1.getMax())); - ensure_approximately_equals("4th insert MMM<> has 250002.0 mean", m1.getMean(), lcl_float(250002.0), 1); - - // Reset - m1.reset(); - ensure("Reset MMM<> has 0 count", (0 == m1.getCount())); - ensure("Reset MMM<> has 0 min", (zero == m1.getMin())); - ensure("Reset MMM<> has 0 max", (zero == m1.getMax())); - ensure("Reset MMM<> has 0 mean no div-by-zero", (zero == m1.getMean())); - } - - // Testing LLSimpleStatMMM's response to large values - template<> template<> - void stat_counter_index_object_t::test<5>() - { - LLSimpleStatMMM<> m1; - typedef LLSimpleStatMMM<>::Value lcl_float; - lcl_float zero(0); - - // Insert overflowing values - const lcl_float bignum(F32_MAX / 2); - - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(zero); - - ensure("Overflowed MMM<> has 8 count", (8 == m1.getCount())); - ensure("Overflowed MMM<> has 0 min", (zero == m1.getMin())); - ensure("Overflowed MMM<> has huge max", (bignum == m1.getMax())); - ensure("Overflowed MMM<> has fetchable mean", (1.0 == m1.getMean() || true)); - // We should be infinte but not interested in proving the IEEE standard here. - LLSD sd1(m1.getMean()); - // std::cout << "Thingy: " << m1.getMean() << " and as LLSD: " << sd1 << std::endl; - ensure("Overflowed MMM<> produces LLSDable Real", (sd1.isReal())); - } - - // Testing LLSimpleStatMMM<F32>'s external behavior - template<> template<> - void stat_counter_index_object_t::test<6>() - { - LLSimpleStatMMM<F32> m1; - typedef LLSimpleStatMMM<F32>::Value lcl_float; - lcl_float zero(0); - - // Freshly-constructed - ensure("Constructed MMM<F32> has 0 count", (0 == m1.getCount())); - ensure("Constructed MMM<F32> has 0 min", (zero == m1.getMin())); - ensure("Constructed MMM<F32> has 0 max", (zero == m1.getMax())); - ensure("Constructed MMM<F32> has 0 mean no div-by-zero", (zero == m1.getMean())); - - // Single insert - m1.record(1.0); - ensure("Single insert MMM<F32> has 1 count", (1 == m1.getCount())); - ensure("Single insert MMM<F32> has 1.0 min", (1.0 == m1.getMin())); - ensure("Single insert MMM<F32> has 1.0 max", (1.0 == m1.getMax())); - ensure("Single insert MMM<F32> has 1.0 mean", (1.0 == m1.getMean())); - - // Second insert - m1.record(3.0); - ensure("2nd insert MMM<F32> has 2 count", (2 == m1.getCount())); - ensure("2nd insert MMM<F32> has 1.0 min", (1.0 == m1.getMin())); - ensure("2nd insert MMM<F32> has 3.0 max", (3.0 == m1.getMax())); - ensure_approximately_equals("2nd insert MMM<F32> has 2.0 mean", m1.getMean(), lcl_float(2.0), 1); - - // Third insert - m1.record(5.0); - ensure("3rd insert MMM<F32> has 3 count", (3 == m1.getCount())); - ensure("3rd insert MMM<F32> has 1.0 min", (1.0 == m1.getMin())); - ensure("3rd insert MMM<F32> has 5.0 max", (5.0 == m1.getMax())); - ensure_approximately_equals("3rd insert MMM<F32> has 3.0 mean", m1.getMean(), lcl_float(3.0), 1); - - // Fourth insert - m1.record(1000000.0); - ensure("4th insert MMM<F32> has 4 count", (4 == m1.getCount())); - ensure("4th insert MMM<F32> has 1.0 min", (1.0 == m1.getMin())); - ensure("4th insert MMM<F32> has 1000000.0 max", (1000000.0 == m1.getMax())); - ensure_approximately_equals("4th insert MMM<F32> has 250002.0 mean", m1.getMean(), lcl_float(250002.0), 1); - - // Reset - m1.reset(); - ensure("Reset MMM<F32> has 0 count", (0 == m1.getCount())); - ensure("Reset MMM<F32> has 0 min", (zero == m1.getMin())); - ensure("Reset MMM<F32> has 0 max", (zero == m1.getMax())); - ensure("Reset MMM<F32> has 0 mean no div-by-zero", (zero == m1.getMean())); - } - - // Testing LLSimpleStatMMM's response to large values - template<> template<> - void stat_counter_index_object_t::test<7>() - { - LLSimpleStatMMM<F32> m1; - typedef LLSimpleStatMMM<F32>::Value lcl_float; - lcl_float zero(0); - - // Insert overflowing values - const lcl_float bignum(F32_MAX / 2); - - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(zero); - - ensure("Overflowed MMM<F32> has 8 count", (8 == m1.getCount())); - ensure("Overflowed MMM<F32> has 0 min", (zero == m1.getMin())); - ensure("Overflowed MMM<F32> has huge max", (bignum == m1.getMax())); - ensure("Overflowed MMM<F32> has fetchable mean", (1.0 == m1.getMean() || true)); - // We should be infinte but not interested in proving the IEEE standard here. - LLSD sd1(m1.getMean()); - // std::cout << "Thingy: " << m1.getMean() << " and as LLSD: " << sd1 << std::endl; - ensure("Overflowed MMM<F32> produces LLSDable Real", (sd1.isReal())); - } - - // Testing LLSimpleStatMMM<F64>'s external behavior - template<> template<> - void stat_counter_index_object_t::test<8>() - { - LLSimpleStatMMM<F64> m1; - typedef LLSimpleStatMMM<F64>::Value lcl_float; - lcl_float zero(0); - - // Freshly-constructed - ensure("Constructed MMM<F64> has 0 count", (0 == m1.getCount())); - ensure("Constructed MMM<F64> has 0 min", (zero == m1.getMin())); - ensure("Constructed MMM<F64> has 0 max", (zero == m1.getMax())); - ensure("Constructed MMM<F64> has 0 mean no div-by-zero", (zero == m1.getMean())); - - // Single insert - m1.record(1.0); - ensure("Single insert MMM<F64> has 1 count", (1 == m1.getCount())); - ensure("Single insert MMM<F64> has 1.0 min", (1.0 == m1.getMin())); - ensure("Single insert MMM<F64> has 1.0 max", (1.0 == m1.getMax())); - ensure("Single insert MMM<F64> has 1.0 mean", (1.0 == m1.getMean())); - - // Second insert - m1.record(3.0); - ensure("2nd insert MMM<F64> has 2 count", (2 == m1.getCount())); - ensure("2nd insert MMM<F64> has 1.0 min", (1.0 == m1.getMin())); - ensure("2nd insert MMM<F64> has 3.0 max", (3.0 == m1.getMax())); - ensure_approximately_equals("2nd insert MMM<F64> has 2.0 mean", m1.getMean(), lcl_float(2.0), 1); - - // Third insert - m1.record(5.0); - ensure("3rd insert MMM<F64> has 3 count", (3 == m1.getCount())); - ensure("3rd insert MMM<F64> has 1.0 min", (1.0 == m1.getMin())); - ensure("3rd insert MMM<F64> has 5.0 max", (5.0 == m1.getMax())); - ensure_approximately_equals("3rd insert MMM<F64> has 3.0 mean", m1.getMean(), lcl_float(3.0), 1); - - // Fourth insert - m1.record(1000000.0); - ensure("4th insert MMM<F64> has 4 count", (4 == m1.getCount())); - ensure("4th insert MMM<F64> has 1.0 min", (1.0 == m1.getMin())); - ensure("4th insert MMM<F64> has 1000000.0 max", (1000000.0 == m1.getMax())); - ensure_approximately_equals("4th insert MMM<F64> has 250002.0 mean", m1.getMean(), lcl_float(250002.0), 1); - - // Reset - m1.reset(); - ensure("Reset MMM<F64> has 0 count", (0 == m1.getCount())); - ensure("Reset MMM<F64> has 0 min", (zero == m1.getMin())); - ensure("Reset MMM<F64> has 0 max", (zero == m1.getMax())); - ensure("Reset MMM<F64> has 0 mean no div-by-zero", (zero == m1.getMean())); - } - - // Testing LLSimpleStatMMM's response to large values - template<> template<> - void stat_counter_index_object_t::test<9>() - { - LLSimpleStatMMM<F64> m1; - typedef LLSimpleStatMMM<F64>::Value lcl_float; - lcl_float zero(0); - - // Insert overflowing values - const lcl_float bignum(F64_MAX / 2); - - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(zero); - - ensure("Overflowed MMM<F64> has 8 count", (8 == m1.getCount())); - ensure("Overflowed MMM<F64> has 0 min", (zero == m1.getMin())); - ensure("Overflowed MMM<F64> has huge max", (bignum == m1.getMax())); - ensure("Overflowed MMM<F64> has fetchable mean", (1.0 == m1.getMean() || true)); - // We should be infinte but not interested in proving the IEEE standard here. - LLSD sd1(m1.getMean()); - // std::cout << "Thingy: " << m1.getMean() << " and as LLSD: " << sd1 << std::endl; - ensure("Overflowed MMM<F64> produces LLSDable Real", (sd1.isReal())); - } - - // Testing LLSimpleStatMMM<U64>'s external behavior - template<> template<> - void stat_counter_index_object_t::test<10>() - { - LLSimpleStatMMM<U64> m1; - typedef LLSimpleStatMMM<U64>::Value lcl_int; - lcl_int zero(0); - - // Freshly-constructed - ensure("Constructed MMM<U64> has 0 count", (0 == m1.getCount())); - ensure("Constructed MMM<U64> has 0 min", (zero == m1.getMin())); - ensure("Constructed MMM<U64> has 0 max", (zero == m1.getMax())); - ensure("Constructed MMM<U64> has 0 mean no div-by-zero", (zero == m1.getMean())); - - // Single insert - m1.record(1); - ensure("Single insert MMM<U64> has 1 count", (1 == m1.getCount())); - ensure("Single insert MMM<U64> has 1 min", (1 == m1.getMin())); - ensure("Single insert MMM<U64> has 1 max", (1 == m1.getMax())); - ensure("Single insert MMM<U64> has 1 mean", (1 == m1.getMean())); - - // Second insert - m1.record(3); - ensure("2nd insert MMM<U64> has 2 count", (2 == m1.getCount())); - ensure("2nd insert MMM<U64> has 1 min", (1 == m1.getMin())); - ensure("2nd insert MMM<U64> has 3 max", (3 == m1.getMax())); - ensure("2nd insert MMM<U64> has 2 mean", (2 == m1.getMean())); - - // Third insert - m1.record(5); - ensure("3rd insert MMM<U64> has 3 count", (3 == m1.getCount())); - ensure("3rd insert MMM<U64> has 1 min", (1 == m1.getMin())); - ensure("3rd insert MMM<U64> has 5 max", (5 == m1.getMax())); - ensure("3rd insert MMM<U64> has 3 mean", (3 == m1.getMean())); - - // Fourth insert - m1.record(U64L(1000000000000)); - ensure("4th insert MMM<U64> has 4 count", (4 == m1.getCount())); - ensure("4th insert MMM<U64> has 1 min", (1 == m1.getMin())); - ensure("4th insert MMM<U64> has 1000000000000ULL max", (U64L(1000000000000) == m1.getMax())); - ensure("4th insert MMM<U64> has 250000000002ULL mean", (U64L( 250000000002) == m1.getMean())); - - // Reset - m1.reset(); - ensure("Reset MMM<U64> has 0 count", (0 == m1.getCount())); - ensure("Reset MMM<U64> has 0 min", (zero == m1.getMin())); - ensure("Reset MMM<U64> has 0 max", (zero == m1.getMax())); - ensure("Reset MMM<U64> has 0 mean no div-by-zero", (zero == m1.getMean())); - } - - // Testing LLSimpleStatMMM's response to large values - template<> template<> - void stat_counter_index_object_t::test<11>() - { - LLSimpleStatMMM<U64> m1; - typedef LLSimpleStatMMM<U64>::Value lcl_int; - lcl_int zero(0); - - // Insert overflowing values - const lcl_int bignum(U64L(0xffffffffffffffff) / 2); - - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(bignum); - m1.record(zero); - - ensure("Overflowed MMM<U64> has 8 count", (8 == m1.getCount())); - ensure("Overflowed MMM<U64> has 0 min", (zero == m1.getMin())); - ensure("Overflowed MMM<U64> has huge max", (bignum == m1.getMax())); - ensure("Overflowed MMM<U64> has fetchable mean", (zero == m1.getMean() || true)); - } - - // Testing LLSimpleStatCounter's merge() method - template<> template<> - void stat_counter_index_object_t::test<12>() - { - LLSimpleStatCounter c1; - LLSimpleStatCounter c2; - - ++c1; - ++c1; - ++c1; - ++c1; - - ++c2; - ++c2; - c2.merge(c1); - - ensure_equals("4 merged into 2 results in 6", 6, c2.getCount()); - - ensure_equals("Source of merge is undamaged", 4, c1.getCount()); - } - - // Testing LLSimpleStatMMM's merge() method - template<> template<> - void stat_counter_index_object_t::test<13>() - { - LLSimpleStatMMM<> m1; - LLSimpleStatMMM<> m2; - - m1.record(3.5); - m1.record(4.5); - m1.record(5.5); - m1.record(6.5); - - m2.record(5.0); - m2.record(7.0); - m2.record(9.0); - - m2.merge(m1); - - ensure_equals("Count after merge (p1)", 7, m2.getCount()); - ensure_approximately_equals("Min after merge (p1)", F32(3.5), m2.getMin(), 22); - ensure_approximately_equals("Max after merge (p1)", F32(9.0), m2.getMax(), 22); - ensure_approximately_equals("Mean after merge (p1)", F32(41.000/7.000), m2.getMean(), 22); - - - ensure_equals("Source count of merge is undamaged (p1)", 4, m1.getCount()); - ensure_approximately_equals("Source min of merge is undamaged (p1)", F32(3.5), m1.getMin(), 22); - ensure_approximately_equals("Source max of merge is undamaged (p1)", F32(6.5), m1.getMax(), 22); - ensure_approximately_equals("Source mean of merge is undamaged (p1)", F32(5.0), m1.getMean(), 22); - - m2.reset(); - - m2.record(-22.0); - m2.record(-1.0); - m2.record(30.0); - - m2.merge(m1); - - ensure_equals("Count after merge (p2)", 7, m2.getCount()); - ensure_approximately_equals("Min after merge (p2)", F32(-22.0), m2.getMin(), 22); - ensure_approximately_equals("Max after merge (p2)", F32(30.0), m2.getMax(), 22); - ensure_approximately_equals("Mean after merge (p2)", F32(27.000/7.000), m2.getMean(), 22); - - } - - // Testing LLSimpleStatMMM's merge() method when src contributes nothing - template<> template<> - void stat_counter_index_object_t::test<14>() - { - LLSimpleStatMMM<> m1; - LLSimpleStatMMM<> m2; - - m2.record(5.0); - m2.record(7.0); - m2.record(9.0); - - m2.merge(m1); - - ensure_equals("Count after merge (p1)", 3, m2.getCount()); - ensure_approximately_equals("Min after merge (p1)", F32(5.0), m2.getMin(), 22); - ensure_approximately_equals("Max after merge (p1)", F32(9.0), m2.getMax(), 22); - ensure_approximately_equals("Mean after merge (p1)", F32(7.000), m2.getMean(), 22); - - ensure_equals("Source count of merge is undamaged (p1)", 0, m1.getCount()); - ensure_approximately_equals("Source min of merge is undamaged (p1)", F32(0), m1.getMin(), 22); - ensure_approximately_equals("Source max of merge is undamaged (p1)", F32(0), m1.getMax(), 22); - ensure_approximately_equals("Source mean of merge is undamaged (p1)", F32(0), m1.getMean(), 22); - - m2.reset(); - - m2.record(-22.0); - m2.record(-1.0); - - m2.merge(m1); - - ensure_equals("Count after merge (p2)", 2, m2.getCount()); - ensure_approximately_equals("Min after merge (p2)", F32(-22.0), m2.getMin(), 22); - ensure_approximately_equals("Max after merge (p2)", F32(-1.0), m2.getMax(), 22); - ensure_approximately_equals("Mean after merge (p2)", F32(-11.5), m2.getMean(), 22); - } - - // Testing LLSimpleStatMMM's merge() method when dst contributes nothing - template<> template<> - void stat_counter_index_object_t::test<15>() - { - LLSimpleStatMMM<> m1; - LLSimpleStatMMM<> m2; - - m1.record(5.0); - m1.record(7.0); - m1.record(9.0); - - m2.merge(m1); - - ensure_equals("Count after merge (p1)", 3, m2.getCount()); - ensure_approximately_equals("Min after merge (p1)", F32(5.0), m2.getMin(), 22); - ensure_approximately_equals("Max after merge (p1)", F32(9.0), m2.getMax(), 22); - ensure_approximately_equals("Mean after merge (p1)", F32(7.000), m2.getMean(), 22); - - ensure_equals("Source count of merge is undamaged (p1)", 3, m1.getCount()); - ensure_approximately_equals("Source min of merge is undamaged (p1)", F32(5.0), m1.getMin(), 22); - ensure_approximately_equals("Source max of merge is undamaged (p1)", F32(9.0), m1.getMax(), 22); - ensure_approximately_equals("Source mean of merge is undamaged (p1)", F32(7.0), m1.getMean(), 22); - - m1.reset(); - m2.reset(); - - m1.record(-22.0); - m1.record(-1.0); - - m2.merge(m1); - - ensure_equals("Count after merge (p2)", 2, m2.getCount()); - ensure_approximately_equals("Min after merge (p2)", F32(-22.0), m2.getMin(), 22); - ensure_approximately_equals("Max after merge (p2)", F32(-1.0), m2.getMax(), 22); - ensure_approximately_equals("Mean after merge (p2)", F32(-11.5), m2.getMean(), 22); - } - - // Testing LLSimpleStatMMM's merge() method when neither dst nor src contributes - template<> template<> - void stat_counter_index_object_t::test<16>() - { - LLSimpleStatMMM<> m1; - LLSimpleStatMMM<> m2; - - m2.merge(m1); - - ensure_equals("Count after merge (p1)", 0, m2.getCount()); - ensure_approximately_equals("Min after merge (p1)", F32(0), m2.getMin(), 22); - ensure_approximately_equals("Max after merge (p1)", F32(0), m2.getMax(), 22); - ensure_approximately_equals("Mean after merge (p1)", F32(0), m2.getMean(), 22); - - ensure_equals("Source count of merge is undamaged (p1)", 0, m1.getCount()); - ensure_approximately_equals("Source min of merge is undamaged (p1)", F32(0), m1.getMin(), 22); - ensure_approximately_equals("Source max of merge is undamaged (p1)", F32(0), m1.getMax(), 22); - ensure_approximately_equals("Source mean of merge is undamaged (p1)", F32(0), m1.getMean(), 22); - } -} diff --git a/indra/newview/tests/lltexturestatsuploader_test.cpp b/indra/newview/tests/lltexturestatsuploader_test.cpp index cfb2c267cc7ee7e26a78969f8bd9e410334a380c..44385230229bb81382cd5418c986775302f9caad 100755 --- a/indra/newview/tests/lltexturestatsuploader_test.cpp +++ b/indra/newview/tests/lltexturestatsuploader_test.cpp @@ -111,7 +111,7 @@ namespace tut void texturestatsuploader_object_t::test<1>() { LLTextureStatsUploader tsu; - llinfos << &tsu << llendl; + LL_INFOS() << &tsu << LL_ENDL; ensure("have we crashed?", true); } diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index a331d9aa9e5bde8f3582527ef761495fb3b0d3b4..a08e32cb49fc2b0c714a9511814354638fcd380e 100755 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -35,8 +35,38 @@ #include "lluuid.h" #include "llsdutil.h" #include "llregionhandle.h" +#include "lltracethreadrecorder.h" #include "../llvoavatar.h" +namespace LLStatViewer +{ + LLTrace::SampleStatHandle<> FPS_SAMPLE("fpssample"); +} + +void LLVOAvatar::getNearbyRezzedStats(std::vector<S32>& counts) +{ + counts.resize(3); + counts[0] = 0; + counts[1] = 0; + counts[2] = 1; +} + +// static +std::string LLVOAvatar::rezStatusToString(S32 rez_status) +{ + if (rez_status==0) return "cloud"; + if (rez_status==1) return "gray"; + if (rez_status==2) return "textured"; + return "unknown"; +} + +// static +LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) +{ + static LLViewerStats::StatsAccumulator junk; + return junk; +} + static const char * all_keys[] = { "duration", @@ -199,7 +229,19 @@ get_region(const LLSD & sd, U64 region_handle1) namespace tut { struct tst_viewerassetstats_index - {}; + { + tst_viewerassetstats_index() + { + LLTrace::set_master_thread_recorder(&mThreadRecorder); + } + + ~tst_viewerassetstats_index() + { + LLTrace::set_master_thread_recorder(NULL); + } + + LLTrace::ThreadRecorder mThreadRecorder; + }; typedef test_group<tst_viewerassetstats_index> tst_viewerassetstats_index_t; typedef tst_viewerassetstats_index_t::object tst_viewerassetstats_index_object_t; tut::tst_viewerassetstats_index_t tut_tst_viewerassetstats_index("tst_viewerassetstats_test"); @@ -209,24 +251,24 @@ namespace tut void tst_viewerassetstats_index_object_t::test<1>() { // Check that helpers aren't bothered by missing global stats - ensure("Global gViewerAssetStatsMain should be NULL", (NULL == gViewerAssetStatsMain)); + ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats)); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_response_main(LLViewerAssetType::AT_GESTURE, false, false, 12300000ULL); + LLViewerAssetStatsFF::record_response(LLViewerAssetType::AT_GESTURE, false, false, (U64Microseconds)12300000ULL); } // Create a non-global instance and check the structure template<> template<> void tst_viewerassetstats_index_object_t::test<2>() { - ensure("Global gViewerAssetStatsMain should be NULL", (NULL == gViewerAssetStatsMain)); + ensure("Global gViewerAssetStats should be NULL", (NULL == gViewerAssetStats)); LLViewerAssetStats * it = new LLViewerAssetStats(); - ensure("Global gViewerAssetStatsMain should still be NULL", (NULL == gViewerAssetStatsMain)); + ensure("Global gViewerAssetStats should still be NULL", (NULL == gViewerAssetStats)); LLSD sd_full = it->asLLSD(false); @@ -293,16 +335,16 @@ namespace tut template<> template<> void tst_viewerassetstats_index_object_t::test<4>() { - gViewerAssetStatsMain = new LLViewerAssetStats(); - LLViewerAssetStatsFF::set_region_main(region1_handle); + gViewerAssetStats = new LLViewerAssetStats(); + LLViewerAssetStatsFF::set_region(region1_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - LLSD sd = gViewerAssetStatsMain->asLLSD(false); + LLSD sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd["regions"][0]; @@ -316,80 +358,38 @@ namespace tut // Reset and check zeros... // Reset leaves current region in place - gViewerAssetStatsMain->reset(); - sd = gViewerAssetStatsMain->asLLSD(false)["regions"][region1_handle_str]; + gViewerAssetStats->reset(); + sd = gViewerAssetStats->asLLSD(false)["regions"][region1_handle_str]; - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = NULL; + delete gViewerAssetStats; + gViewerAssetStats = NULL; ensure("sd[get_texture_non_temp_udp][enqueued] is reset", (0 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger())); ensure("sd[get_gesture_udp][dequeued] is reset", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); } - // Create two global instances and verify no interactions + // Check multiple region collection template<> template<> void tst_viewerassetstats_index_object_t::test<5>() { - gViewerAssetStatsThread1 = new LLViewerAssetStats(); - gViewerAssetStatsMain = new LLViewerAssetStats(); - LLViewerAssetStatsFF::set_region_main(region1_handle); + gViewerAssetStats = new LLViewerAssetStats(); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::set_region(region1_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - LLSD sd = gViewerAssetStatsThread1->asLLSD(false); - ensure("Other collector is empty", is_no_stats_map(sd)); - sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); - ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); - sd = sd["regions"][0]; + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - // Check a few points on the tree for content - ensure("sd[get_texture_non_temp_udp][enqueued] is 1", (1 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger())); - ensure("sd[get_texture_temp_udp][enqueued] is 0", (0 == sd["get_texture_temp_udp"]["enqueued"].asInteger())); - ensure("sd[get_texture_non_temp_http][enqueued] is 0", (0 == sd["get_texture_non_temp_http"]["enqueued"].asInteger())); - ensure("sd[get_texture_temp_http][enqueued] is 0", (0 == sd["get_texture_temp_http"]["enqueued"].asInteger())); - ensure("sd[get_gesture_udp][dequeued] is 0", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); - - // Reset and check zeros... - // Reset leaves current region in place - gViewerAssetStatsMain->reset(); - sd = gViewerAssetStatsMain->asLLSD(false)["regions"][0]; - - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = NULL; - delete gViewerAssetStatsThread1; - gViewerAssetStatsThread1 = NULL; - - ensure("sd[get_texture_non_temp_udp][enqueued] is reset", (0 == sd["get_texture_non_temp_udp"]["enqueued"].asInteger())); - ensure("sd[get_gesture_udp][dequeued] is reset", (0 == sd["get_gesture_udp"]["dequeued"].asInteger())); - } - - // Check multiple region collection - template<> template<> - void tst_viewerassetstats_index_object_t::test<6>() - { - gViewerAssetStatsMain = new LLViewerAssetStats(); - - LLViewerAssetStatsFF::set_region_main(region1_handle); + LLViewerAssetStatsFF::set_region(region2_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); - - LLViewerAssetStatsFF::set_region_main(region2_handle); - - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - - LLSD sd = gViewerAssetStatsMain->asLLSD(false); + LLSD sd = gViewerAssetStats->asLLSD(false); // std::cout << sd << std::endl; @@ -414,14 +414,14 @@ namespace tut // Reset and check zeros... // Reset leaves current region in place - gViewerAssetStatsMain->reset(); - sd = gViewerAssetStatsMain->asLLSD(false); + gViewerAssetStats->reset(); + sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); sd2 = sd["regions"][0]; - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = NULL; + delete gViewerAssetStats; + gViewerAssetStats = NULL; ensure("sd2[get_texture_non_temp_udp][enqueued] is reset", (0 == sd2["get_texture_non_temp_udp"]["enqueued"].asInteger())); ensure("sd2[get_gesture_udp][enqueued] is reset", (0 == sd2["get_gesture_udp"]["enqueued"].asInteger())); @@ -429,41 +429,41 @@ namespace tut // Check multiple region collection jumping back-and-forth between regions template<> template<> - void tst_viewerassetstats_index_object_t::test<7>() + void tst_viewerassetstats_index_object_t::test<6>() { - gViewerAssetStatsMain = new LLViewerAssetStats(); + gViewerAssetStats = new LLViewerAssetStats(); - LLViewerAssetStatsFF::set_region_main(region1_handle); + LLViewerAssetStatsFF::set_region(region1_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::set_region_main(region2_handle); + LLViewerAssetStatsFF::set_region(region2_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::set_region_main(region1_handle); + LLViewerAssetStatsFF::set_region(region1_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, true, true); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, true, true); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, true, true); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, true, true); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::set_region_main(region2_handle); + LLViewerAssetStatsFF::set_region(region2_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_GESTURE, false, false); - LLSD sd = gViewerAssetStatsMain->asLLSD(false); + LLSD sd = gViewerAssetStats->asLLSD(false); ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); @@ -486,15 +486,15 @@ namespace tut // Reset and check zeros... // Reset leaves current region in place - gViewerAssetStatsMain->reset(); - sd = gViewerAssetStatsMain->asLLSD(false); + gViewerAssetStats->reset(); + sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); sd2 = get_region(sd, region2_handle); ensure("Region2 is present in results", sd2.isMap()); - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = NULL; + delete gViewerAssetStats; + gViewerAssetStats = NULL; ensure_equals("sd2[get_texture_non_temp_udp][enqueued] is reset", sd2["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0); ensure_equals("sd2[get_gesture_udp][enqueued] is reset", sd2["get_gesture_udp"]["enqueued"].asInteger(), 0); @@ -502,38 +502,35 @@ namespace tut // Non-texture assets ignore transport and persistence flags template<> template<> - void tst_viewerassetstats_index_object_t::test<8>() + void tst_viewerassetstats_index_object_t::test<7>() { - gViewerAssetStatsThread1 = new LLViewerAssetStats(); - gViewerAssetStatsMain = new LLViewerAssetStats(); - LLViewerAssetStatsFF::set_region_main(region1_handle); + gViewerAssetStats = new LLViewerAssetStats(); + LLViewerAssetStatsFF::set_region(region1_handle); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_TEXTURE, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_TEXTURE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, false, true); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, true); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, false, true); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, false, true); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, true, false); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, true, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, false); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_BODYPART, true, true); - LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, true, true); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_BODYPART, true, true); + LLViewerAssetStatsFF::record_dequeue(LLViewerAssetType::AT_BODYPART, true, true); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_LSL_BYTECODE, false, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_LSL_BYTECODE, false, true); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, false, true); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_LSL_BYTECODE, true, false); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, false); - LLViewerAssetStatsFF::record_enqueue_main(LLViewerAssetType::AT_LSL_BYTECODE, true, true); + LLViewerAssetStatsFF::record_enqueue(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - LLSD sd = gViewerAssetStatsThread1->asLLSD(false); - ensure("Other collector is empty", is_no_stats_map(sd)); - sd = gViewerAssetStatsMain->asLLSD(false); + LLSD sd = gViewerAssetStats->asLLSD(false); ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = get_region(sd, region1_handle); @@ -551,445 +548,14 @@ namespace tut // Reset and check zeros... // Reset leaves current region in place - gViewerAssetStatsMain->reset(); - sd = get_region(gViewerAssetStatsMain->asLLSD(false), region1_handle); + gViewerAssetStats->reset(); + sd = get_region(gViewerAssetStats->asLLSD(false), region1_handle); ensure("Region1 is present in results", sd.isMap()); - delete gViewerAssetStatsMain; - gViewerAssetStatsMain = NULL; - delete gViewerAssetStatsThread1; - gViewerAssetStatsThread1 = NULL; + delete gViewerAssetStats; + gViewerAssetStats = NULL; ensure_equals("sd[get_texture_non_temp_udp][enqueued] is reset", sd["get_texture_non_temp_udp"]["enqueued"].asInteger(), 0); ensure_equals("sd[get_gesture_udp][dequeued] is reset", sd["get_gesture_udp"]["dequeued"].asInteger(), 0); } - - - // LLViewerAssetStats::merge() basic functions work - template<> template<> - void tst_viewerassetstats_index_object_t::test<9>() - { - LLViewerAssetStats s1; - LLViewerAssetStats s2; - - s1.setRegion(region1_handle); - s2.setRegion(region1_handle); - - s1.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 5000000); - s1.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 6000000); - s1.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 8000000); - s1.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 7000000); - s1.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 9000000); - - s2.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 2000000); - s2.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 3000000); - s2.recordGetServiced(LLViewerAssetType::AT_TEXTURE, true, true, 4000000); - - s2.merge(s1); - - LLSD s2_llsd = get_region(s2.asLLSD(false), region1_handle); - ensure("Region1 is present in results", s2_llsd.isMap()); - - ensure_equals("count after merge", s2_llsd["get_texture_temp_http"]["resp_count"].asInteger(), 8); - ensure_approximately_equals("min after merge", s2_llsd["get_texture_temp_http"]["resp_min"].asReal(), 2.0, 22); - ensure_approximately_equals("max after merge", s2_llsd["get_texture_temp_http"]["resp_max"].asReal(), 9.0, 22); - ensure_approximately_equals("max after merge", s2_llsd["get_texture_temp_http"]["resp_mean"].asReal(), 5.5, 22); - } - - // LLViewerAssetStats::merge() basic functions work without corrupting source data - template<> template<> - void tst_viewerassetstats_index_object_t::test<10>() - { - LLViewerAssetStats s1; - LLViewerAssetStats s2; - - s1.setRegion(region1_handle); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 23289200); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 282900); - - - s2.setRegion(region2_handle); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 6500000); - s2.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 10000); - - { - s2.merge(s1); - - LLSD src = s1.asLLSD(false); - LLSD dst = s2.asLLSD(false); - - ensure_equals("merge src has single region", src["regions"].size(), 1); - ensure_equals("merge dst has dual regions", dst["regions"].size(), 2); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - dst["regions"][1].erase("duration"); - - LLSD s1_llsd = get_region(src, region1_handle); - ensure("Region1 is present in src", s1_llsd.isMap()); - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure("result from src is in dst", llsd_equals(s1_llsd, s2_llsd)); - } - - s1.setRegion(region1_handle); - s2.setRegion(region1_handle); - s1.reset(); - s2.reset(); - - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 23289200); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 282900); - - - s2.setRegion(region1_handle); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 6500000); - s2.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 10000); - - { - s2.merge(s1); - - LLSD src = s1.asLLSD(false); - LLSD dst = s2.asLLSD(false); - - ensure_equals("merge src has single region (p2)", src["regions"].size(), 1); - ensure_equals("merge dst has single region (p2)", dst["regions"].size(), 1); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - - LLSD s1_llsd = get_region(src, region1_handle); - ensure("Region1 is present in src", s1_llsd.isMap()); - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure_equals("src counts okay (enq)", s1_llsd["get_other"]["enqueued"].asInteger(), 4); - ensure_equals("src counts okay (deq)", s1_llsd["get_other"]["dequeued"].asInteger(), 4); - ensure_equals("src resp counts okay", s1_llsd["get_other"]["resp_count"].asInteger(), 2); - ensure_approximately_equals("src respmin okay", s1_llsd["get_other"]["resp_min"].asReal(), 0.2829, 20); - ensure_approximately_equals("src respmax okay", s1_llsd["get_other"]["resp_max"].asReal(), 23.2892, 20); - - ensure_equals("dst counts okay (enq)", s2_llsd["get_other"]["enqueued"].asInteger(), 12); - ensure_equals("src counts okay (deq)", s2_llsd["get_other"]["dequeued"].asInteger(), 11); - ensure_equals("dst resp counts okay", s2_llsd["get_other"]["resp_count"].asInteger(), 4); - ensure_approximately_equals("dst respmin okay", s2_llsd["get_other"]["resp_min"].asReal(), 0.010, 20); - ensure_approximately_equals("dst respmax okay", s2_llsd["get_other"]["resp_max"].asReal(), 23.2892, 20); - } - } - - - // Maximum merges are interesting when one side contributes nothing - template<> template<> - void tst_viewerassetstats_index_object_t::test<11>() - { - LLViewerAssetStats s1; - LLViewerAssetStats s2; - - s1.setRegion(region1_handle); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - // Want to test negative numbers here but have to work in U64 - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - - s2.setRegion(region1_handle); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - { - s2.merge(s1); - - LLSD src = s1.asLLSD(false); - LLSD dst = s2.asLLSD(false); - - ensure_equals("merge src has single region", src["regions"].size(), 1); - ensure_equals("merge dst has single region", dst["regions"].size(), 1); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure_equals("dst counts come from src only", s2_llsd["get_other"]["resp_count"].asInteger(), 3); - - ensure_approximately_equals("dst maximum with count 0 does not contribute to merged maximum", - s2_llsd["get_other"]["resp_max"].asReal(), F64(0.0), 20); - } - - // Other way around - s1.setRegion(region1_handle); - s2.setRegion(region1_handle); - s1.reset(); - s2.reset(); - - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - // Want to test negative numbers here but have to work in U64 - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 0); - - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - { - s1.merge(s2); - - LLSD src = s2.asLLSD(false); - LLSD dst = s1.asLLSD(false); - - ensure_equals("merge src has single region", src["regions"].size(), 1); - ensure_equals("merge dst has single region", dst["regions"].size(), 1); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure_equals("dst counts come from src only (flipped)", s2_llsd["get_other"]["resp_count"].asInteger(), 3); - - ensure_approximately_equals("dst maximum with count 0 does not contribute to merged maximum (flipped)", - s2_llsd["get_other"]["resp_max"].asReal(), F64(0.0), 20); - } - } - - // Minimum merges are interesting when one side contributes nothing - template<> template<> - void tst_viewerassetstats_index_object_t::test<12>() - { - LLViewerAssetStats s1; - LLViewerAssetStats s2; - - s1.setRegion(region1_handle); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 3800000); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 2700000); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 2900000); - - s2.setRegion(region1_handle); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - { - s2.merge(s1); - - LLSD src = s1.asLLSD(false); - LLSD dst = s2.asLLSD(false); - - ensure_equals("merge src has single region", src["regions"].size(), 1); - ensure_equals("merge dst has single region", dst["regions"].size(), 1); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure_equals("dst counts come from src only", s2_llsd["get_other"]["resp_count"].asInteger(), 3); - - ensure_approximately_equals("dst minimum with count 0 does not contribute to merged minimum", - s2_llsd["get_other"]["resp_min"].asReal(), F64(2.7), 20); - } - - // Other way around - s1.setRegion(region1_handle); - s2.setRegion(region1_handle); - s1.reset(); - s2.reset(); - - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s1.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 3800000); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 2700000); - s1.recordGetServiced(LLViewerAssetType::AT_LSL_BYTECODE, true, true, 2900000); - - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetEnqueued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - s2.recordGetDequeued(LLViewerAssetType::AT_LSL_BYTECODE, true, true); - - { - s1.merge(s2); - - LLSD src = s2.asLLSD(false); - LLSD dst = s1.asLLSD(false); - - ensure_equals("merge src has single region", src["regions"].size(), 1); - ensure_equals("merge dst has single region", dst["regions"].size(), 1); - - // Remove time stamps, they're a problem - src.erase("duration"); - src["regions"][0].erase("duration"); - dst.erase("duration"); - dst["regions"][0].erase("duration"); - - LLSD s2_llsd = get_region(dst, region1_handle); - ensure("Region1 is present in dst", s2_llsd.isMap()); - - ensure_equals("dst counts come from src only (flipped)", s2_llsd["get_other"]["resp_count"].asInteger(), 3); - - ensure_approximately_equals("dst minimum with count 0 does not contribute to merged minimum (flipped)", - s2_llsd["get_other"]["resp_min"].asReal(), F64(2.7), 20); - } - } - } diff --git a/indra/newview/tests/llxmlrpclistener_test.cpp b/indra/newview/tests/llxmlrpclistener_test.cpp index 20f913b67083be6aeef3635428f8dbb9b2a35d90..6e9756e7d5305f9b8fd3e0a4b9242ac8d4420ee6 100755 --- a/indra/newview/tests/llxmlrpclistener_test.cpp +++ b/indra/newview/tests/llxmlrpclistener_test.cpp @@ -85,7 +85,7 @@ namespace tut void object::test<1>() { set_test_name("request validation"); - WrapLL_ERRS capture; + WrapLLErrs capture; LLSD request; request["uri"] = uri; std::string threw; @@ -93,7 +93,7 @@ namespace tut { pumps.obtain("LLXMLRPCTransaction").post(request); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { threw = e.what(); } @@ -106,7 +106,7 @@ namespace tut void object::test<2>() { set_test_name("param types validation"); - WrapLL_ERRS capture; + WrapLLErrs capture; LLSD request; request["uri"] = uri; request["method"] = "hello"; @@ -118,7 +118,7 @@ namespace tut { pumps.obtain("LLXMLRPCTransaction").post(request); } - catch (const WrapLL_ERRS::FatalException& e) + catch (const WrapLLErrs::FatalException& e) { threw = e.what(); } diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt index 31e1d89c6839757246ae08e60b6472089281ea8f..62b1d9db6266cdb21b0e7290f3bd0456be7b0870 100755 --- a/indra/test/CMakeLists.txt +++ b/indra/test/CMakeLists.txt @@ -56,7 +56,6 @@ set(test_SOURCE_FILES llstreamtools_tut.cpp lltemplatemessagebuilder_tut.cpp lltut.cpp - lluuidhashmap_tut.cpp message_tut.cpp test.cpp ) diff --git a/indra/test/io.cpp b/indra/test/io.cpp index e776a2a3be4250933678b7038471f3f78f4a5163..97726c2b929d31b43bebf29cd735b8fe830fd52a 100755 --- a/indra/test/io.cpp +++ b/indra/test/io.cpp @@ -44,6 +44,7 @@ #include "llsdrpcclient.h" #include "llsdrpcserver.h" #include "llsdserialize.h" +#include "llcommon.h" #include "lluuid.h" #include "llinstantmessage.h" @@ -876,11 +877,11 @@ namespace tut public: double_construct() { - llinfos << "constructed" << llendl; + LL_INFOS() << "constructed" << LL_ENDL; } ~double_construct() { - llinfos << "destroyed" << llendl; + LL_INFOS() << "destroyed" << LL_ENDL; } }; typedef test_group<double_construct> double_construct_test_group; @@ -937,11 +938,11 @@ namespace tut template<> template<> void fitness_test_object::test<1>() { - lldebugs << "fitness_test_object::test<1>()" << llendl; + LL_DEBUGS() << "fitness_test_object::test<1>()" << LL_ENDL; // Set up the server - //lldebugs << "fitness_test_object::test<1> - setting up server." - // << llendl; + //LL_DEBUGS() << "fitness_test_object::test<1> - setting up server." + // << LL_ENDL; LLPumpIO::chain_t chain; typedef LLCloneIOFactory<LLPipeStringInjector> emitter_t; emitter_t* emitter = new emitter_t( @@ -956,18 +957,18 @@ namespace tut mPump->addChain(chain, NEVER_CHAIN_EXPIRY_SECS); // We need to tickle the pump a little to set up the listen() - //lldebugs << "fitness_test_object::test<1> - initializing server." - // << llendl; + //LL_DEBUGS() << "fitness_test_object::test<1> - initializing server." + // << LL_ENDL; pump_loop(mPump, 0.1f); // Set up the client - //lldebugs << "fitness_test_object::test<1> - connecting client." - // << llendl; + //LL_DEBUGS() << "fitness_test_object::test<1> - connecting client." + // << LL_ENDL; LLSocket::ptr_t client = LLSocket::create(mPool, LLSocket::STREAM_TCP); LLHost server_host("127.0.0.1", SERVER_LISTEN_PORT); bool connected = client->blockingConnect(server_host); ensure("Connected to server", connected); - lldebugs << "connected" << llendl; + LL_DEBUGS() << "connected" << LL_ENDL; // We have connected, since the socket reader does not block, // the first call to read data will return EAGAIN, so we need @@ -987,7 +988,7 @@ namespace tut template<> template<> void fitness_test_object::test<2>() { - lldebugs << "fitness_test_object::test<2>()" << llendl; + LL_DEBUGS() << "fitness_test_object::test<2>()" << LL_ENDL; // Set up the server LLPumpIO::chain_t chain; @@ -1010,7 +1011,7 @@ namespace tut LLHost server_host("127.0.0.1", SERVER_LISTEN_PORT); bool connected = client->blockingConnect(server_host); ensure("Connected to server", connected); - lldebugs << "connected" << llendl; + LL_DEBUGS() << "connected" << LL_ENDL; // We have connected, since the socket reader does not block, // the first call to read data will return EAGAIN, so we need @@ -1030,7 +1031,7 @@ namespace tut template<> template<> void fitness_test_object::test<3>() { - lldebugs << "fitness_test_object::test<3>()" << llendl; + LL_DEBUGS() << "fitness_test_object::test<3>()" << LL_ENDL; // Set up the server LLPumpIO::chain_t chain; @@ -1053,7 +1054,7 @@ namespace tut LLHost server_host("127.0.0.1", SERVER_LISTEN_PORT); bool connected = client->blockingConnect(server_host); ensure("Connected to server", connected); - lldebugs << "connected" << llendl; + LL_DEBUGS() << "connected" << LL_ENDL; // We have connected, since the socket reader does not block, // the first call to read data will return EAGAIN, so we need @@ -1073,7 +1074,7 @@ namespace tut template<> template<> void fitness_test_object::test<4>() { - lldebugs << "fitness_test_object::test<4>()" << llendl; + LL_DEBUGS() << "fitness_test_object::test<4>()" << LL_ENDL; // Set up the server LLPumpIO::chain_t chain; @@ -1096,7 +1097,7 @@ namespace tut LLHost server_host("127.0.0.1", SERVER_LISTEN_PORT); bool connected = client->blockingConnect(server_host); ensure("Connected to server", connected); - lldebugs << "connected" << llendl; + LL_DEBUGS() << "connected" << LL_ENDL; // We have connected, since the socket reader does not block, // the first call to read data will return EAGAIN, so we need @@ -1132,18 +1133,18 @@ namespace tut pump_loop(mPump, 0.1f); U32 count = mPump->runningChains(); ensure_equals("server chain onboard", count, 1); - lldebugs << "** Server is up." << llendl; + LL_DEBUGS() << "** Server is up." << LL_ENDL; // Set up the client LLSocket::ptr_t client = LLSocket::create(mPool, LLSocket::STREAM_TCP); LLHost server_host("127.0.0.1", SERVER_LISTEN_PORT); bool connected = client->blockingConnect(server_host); ensure("Connected to server", connected); - lldebugs << "connected" << llendl; + LL_DEBUGS() << "connected" << LL_ENDL; pump_loop(mPump,0.1f); count = mPump->runningChains(); ensure_equals("server chain onboard", count, 2); - lldebugs << "** Client is connected." << llendl; + LL_DEBUGS() << "** Client is connected." << LL_ENDL; // We have connected, since the socket reader does not block, // the first call to read data will return EAGAIN, so we need @@ -1159,20 +1160,20 @@ namespace tut pump_loop(mPump,0.1f); count = mPump->runningChains(); // ensure_equals("client chain onboard", count, 3); commented out because it fails frequently - appears to be timing sensitive - lldebugs << "** request should have been sent." << llendl; + LL_DEBUGS() << "** request should have been sent." << LL_ENDL; // pump for long enough the the client socket closes, and the // server socket should not be closed yet. pump_loop(mPump,0.2f); count = mPump->runningChains(); ensure_equals("client chain timed out ", count, 2); - lldebugs << "** client chain should be closed." << llendl; + LL_DEBUGS() << "** client chain should be closed." << LL_ENDL; // At this point, the socket should be closed by the timeout pump_loop(mPump,1.0f); count = mPump->runningChains(); ensure_equals("accepted socked close", count, 1); - lldebugs << "** Sleeper should have timed out.." << llendl; + LL_DEBUGS() << "** Sleeper should have timed out.." << LL_ENDL; } } @@ -1187,7 +1188,9 @@ namespace tut mResponsePtr(response) { } - ~LLSimpleRPCResponse() {} + ~LLSimpleRPCResponse() + { + } virtual bool response(LLPumpIO* pump) { *mResponsePtr = mReturnValue; @@ -1302,8 +1305,8 @@ namespace tut LLSD request; request = 1; pump_loop(request); - //llinfos << "request: " << *request << llendl; - //llinfos << "response: " << *mResponse << llendl; + //LL_INFOS() << "request: " << *request << LL_ENDL; + //LL_INFOS() << "response: " << *mResponse << LL_ENDL; ensure_equals("integer request response", mResponse.asInteger(), 1); } @@ -1556,7 +1559,7 @@ namespace tut mResponse->getString(actual); if(actual != expected) { - //llwarns << "iteration " << i << llendl; + //LL_WARNS() << "iteration " << i << LL_ENDL; std::ostringstream e_str; std::string::iterator iter = expected.begin(); std::string::iterator end = expected.end(); @@ -1566,8 +1569,8 @@ namespace tut } e_str << std::endl; llsd_serialize_string(e_str, expected); - llwarns << "expected size: " << expected.size() << llendl; - llwarns << "expected: " << e_str.str() << llendl; + LL_WARNS() << "expected size: " << expected.size() << LL_ENDL; + LL_WARNS() << "expected: " << e_str.str() << LL_ENDL; std::ostringstream a_str; iter = actual.begin(); @@ -1578,8 +1581,8 @@ namespace tut } a_str << std::endl; llsd_serialize_string(a_str, actual); - llwarns << "actual size: " << actual.size() << llendl; - llwarns << "actual: " << a_str.str() << llendl; + LL_WARNS() << "actual size: " << actual.size() << LL_ENDL; + LL_WARNS() << "actual: " << a_str.str() << LL_ENDL; } ensure_equals("binary string request response", actual, expected); delete request; diff --git a/indra/test/llblowfish_tut.cpp b/indra/test/llblowfish_tut.cpp index 2573cab81faf5cae056677098d1a51d0746742b3..96e30f4e1e8cfa509c16a2891fae12bfff67211e 100755 --- a/indra/test/llblowfish_tut.cpp +++ b/indra/test/llblowfish_tut.cpp @@ -65,14 +65,14 @@ namespace tut } if (!fp) { - llwarns << "unabled to open " << filename << llendl; + LL_WARNS() << "unabled to open " << filename << LL_ENDL; return false; } std::string good; good.resize(256); size_t got = fread(&good[0], 1, 256, fp); - lldebugs << "matchFile read " << got << llendl; + LL_DEBUGS() << "matchFile read " << got << LL_ENDL; fclose(fp); good.resize(got); diff --git a/indra/test/lldatapacker_tut.cpp b/indra/test/lldatapacker_tut.cpp index cf2b7870ef73a78fcef99d1ea76290547e6d5cb3..b403660c13e1c983b9abc3be26a49da272a27aac 100755 --- a/indra/test/lldatapacker_tut.cpp +++ b/indra/test/lldatapacker_tut.cpp @@ -349,7 +349,7 @@ namespace tut LLFILE* fp = LLFile::fopen(TEST_FILE_NAME, "w+"); if(!fp) { - llerrs << "File couldnt be open" <<llendl; + LL_ERRS() << "File couldnt be open" << LL_ENDL; return; } @@ -404,7 +404,7 @@ namespace tut LLFILE* fp = LLFile::fopen(TEST_FILE_NAME,"w+"); if(!fp) { - llerrs << "File couldnt be open" <<llendl; + LL_ERRS() << "File couldnt be open" << LL_ENDL; return; } diff --git a/indra/test/llhttpdate_tut.cpp b/indra/test/llhttpdate_tut.cpp index 46684bb9dc0cc425418582944ef411e4378af6f2..ecf734ee9077eab4f4f7d7b7a3b816792292bc63 100755 --- a/indra/test/llhttpdate_tut.cpp +++ b/indra/test/llhttpdate_tut.cpp @@ -29,6 +29,7 @@ #include "lltut.h" #include "lldate.h" +#include "llcommon.h" #include "llframetimer.h" #include <time.h> @@ -38,6 +39,12 @@ namespace tut { struct httpdate_data { + httpdate_data() + { + } + ~httpdate_data() + { + } LLDate some_date; }; typedef test_group<httpdate_data> httpdate_test; diff --git a/indra/test/lliohttpserver_tut.cpp b/indra/test/lliohttpserver_tut.cpp index 2fdc455f45fc01874299a95cc603a8b57ddba7f6..1513446788d1d05196a5b4ea2a5ff683a2837a0f 100755 --- a/indra/test/lliohttpserver_tut.cpp +++ b/indra/test/lliohttpserver_tut.cpp @@ -31,6 +31,7 @@ #include "lliohttpserver.h" #include "llsdhttpserver.h" #include "llsdserialize.h" +#include "llcommon.h" #include "llpipeutil.h" @@ -81,6 +82,10 @@ namespace tut mRoot.addNode("/delayed/echo", new DelayedEcho(this)); mRoot.addNode("/wire/hello", new LLHTTPNodeForPipe<WireHello>); } + + ~HTTPServiceTestData() + { + } LLHTTPNode mRoot; LLHTTPNode::ResponsePtr mResponse; @@ -316,8 +321,8 @@ namespace tut stream << "<integer>42</integer>"; } stream << "</array></llsd>"; - llinfos << "HTTPServiceTestObject::test<7>" - << stream.str().length() << llendl; + LL_INFOS() << "HTTPServiceTestObject::test<7>" + << stream.str().length() << LL_ENDL; std::string result = httpPOST("web/echo", stream.str()); ensure_starts_with("large echo status", result, "HTTP/1.0 200 OK\r\n"); } diff --git a/indra/test/llmessagetemplateparser_tut.cpp b/indra/test/llmessagetemplateparser_tut.cpp index da6d229fb59bbaac9ee9771c0eff438e2cabb0ac..39f834a9fc5a62a6cda30464fc4c6c0b406b9668 100755 --- a/indra/test/llmessagetemplateparser_tut.cpp +++ b/indra/test/llmessagetemplateparser_tut.cpp @@ -171,7 +171,7 @@ namespace tut delete var; - // *NOTE: the parsers call llerrs on invalid input, so we can't really + // *NOTE: the parsers call LL_ERRS() on invalid input, so we can't really // test that :-( } diff --git a/indra/test/llpermissions_tut.cpp b/indra/test/llpermissions_tut.cpp index bc2c87ba46db351af3f15daf5f7cc1548d476330..8d8d47a667d1740b587573ceca027f35c89195cf 100755 --- a/indra/test/llpermissions_tut.cpp +++ b/indra/test/llpermissions_tut.cpp @@ -407,7 +407,7 @@ namespace tut LLFILE* fp = LLFile::fopen("linden_file.dat","w+"); if(!fp) { - llerrs << "file couldn't be opened\n" << llendl; + LL_ERRS() << "file couldn't be opened\n" << LL_ENDL; return; } LLPermissions perm,perm1; @@ -430,7 +430,7 @@ namespace tut fp = LLFile::fopen("linden_file.dat","r+"); if(!fp) { - llerrs << "file couldn't be opened\n" << llendl; + LL_ERRS() << "file couldn't be opened\n" << LL_ENDL; return; } ensure("Permissions import failed", perm1.importFile(fp)); diff --git a/indra/test/llpipeutil.cpp b/indra/test/llpipeutil.cpp index db76a370e01849d68e595a734702762b206eb235..bb706b58d5f56b79c7fb877d9f495d9e375b028a 100755 --- a/indra/test/llpipeutil.cpp +++ b/indra/test/llpipeutil.cpp @@ -170,13 +170,13 @@ LLIOPipe::EStatus LLIOSleeper::process_impl( { if(!mRespond) { - lldebugs << "LLIOSleeper::process_impl() sleeping." << llendl; + LL_DEBUGS() << "LLIOSleeper::process_impl() sleeping." << LL_ENDL; mRespond = true; static const F64 SLEEP_TIME = 2.0; pump->sleepChain(SLEEP_TIME); return STATUS_BREAK; } - lldebugs << "LLIOSleeper::process_impl() responding." << llendl; + LL_DEBUGS() << "LLIOSleeper::process_impl() responding." << LL_ENDL; LLBufferStream ostr(channels, buffer.get()); ostr << "huh? sorry, I was sleeping." << std::endl; return STATUS_DONE; diff --git a/indra/test/llsaleinfo_tut.cpp b/indra/test/llsaleinfo_tut.cpp index 2488af1d7f0dee00843954d62b2e143cb1e43a82..5f4d9186a8001a2079d36b979fe8752570047662 100755 --- a/indra/test/llsaleinfo_tut.cpp +++ b/indra/test/llsaleinfo_tut.cpp @@ -111,7 +111,7 @@ namespace tut LLFILE* fp = LLFile::fopen("linden_file.dat","w+"); if(!fp) { - llerrs << "file could not be opened\n" << llendl; + LL_ERRS() << "file could not be opened\n" << LL_ENDL; return; } @@ -128,7 +128,7 @@ namespace tut if(!fp) { - llerrs << "file coudnt be opened\n" << llendl; + LL_ERRS() << "file coudnt be opened\n" << LL_ENDL; return; } diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp index dde70f98c8fc1f087ce15f1651b93fe588b6143b..01765974ea0e37e27b43a9f026caaffc7583f0d3 100755 --- a/indra/test/lltemplatemessagebuilder_tut.cpp +++ b/indra/test/lltemplatemessagebuilder_tut.cpp @@ -35,7 +35,6 @@ #include "llquaternion.h" #include "lltemplatemessagebuilder.h" #include "lltemplatemessagereader.h" -#include "llversionserver.h" #include "message_prehash.h" #include "u64.h" #include "v3dmath.h" @@ -59,9 +58,9 @@ namespace tut const F32 circuit_timeout=100; start_messaging_system("notafile", 13035, - LL_VERSION_MAJOR, - LL_VERSION_MINOR, - LL_VERSION_PATCH, + 1, + 0, + 0, FALSE, "notasharedsecret", NULL, diff --git a/indra/test/lluuidhashmap_tut.cpp b/indra/test/lluuidhashmap_tut.cpp deleted file mode 100755 index 9712a613f43c1b72178f202f47a4e7b7740f46ef..0000000000000000000000000000000000000000 --- a/indra/test/lluuidhashmap_tut.cpp +++ /dev/null @@ -1,455 +0,0 @@ -/** - * @file lluuidhashmap_tut.cpp - * @author Adroit - * @date 2007-02 - * @brief Test cases for LLUUIDHashMap - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include <tut/tut.hpp> -#include "linden_common.h" -#include "lluuidhashmap.h" -#include "llsdserialize.h" -#include "lldir.h" -#include "stringize.h" -#include <iostream> -#include <fstream> - -namespace tut -{ - class UUIDTableEntry - { - public: - UUIDTableEntry() - { - mID.setNull(); - mValue = 0; - } - - UUIDTableEntry(const LLUUID& id, U32 value) - { - mID = id; - mValue = value; - } - - ~UUIDTableEntry(){}; - - static BOOL uuidEq(const LLUUID &uuid, const UUIDTableEntry &id_pair) - { - if (uuid == id_pair.mID) - { - return TRUE; - } - return FALSE; - } - - const LLUUID& getID() { return mID; } - const U32& getValue() { return mValue; } - - protected: - LLUUID mID; - U32 mValue; - }; - - struct hashmap_test - { - }; - - typedef test_group<hashmap_test> hash_index_t; - typedef hash_index_t::object hash_index_object_t; - tut::hash_index_t tut_hash_index("hashmap_test"); - - // stress test - template<> template<> - void hash_index_object_t::test<1>() - { - set_test_name("stress test"); - // As of 2012-10-10, I (nat) have observed sporadic failures of this - // test: "set/get did not work." The trouble is that since test data - // are randomly generated with every run, it is impossible to debug a - // test failure. One is left with the uneasy suspicion that - // LLUUID::generate() can sometimes produce duplicates even within the - // moderately small number requested here. Since rerunning the test - // generally allows it to pass, it's too easy to shrug and forget it. - // The following code is intended to support reproducing such test - // failures. The idea is that, on test failure, we save the generated - // data to a canonical filename in a temp directory. Then on every - // subsequent run, we check for that filename. If it exists, we reload - // that specific data rather than generating fresh data -- which - // should presumably reproduce the same test failure. But we inform - // the user that to resume normal (random) test runs, s/he need only - // delete that file. And since it's in a temp directory, sooner or - // later the system will clean it up anyway. - const char* tempvar = "TEMP"; - const char* tempdir = getenv(tempvar); // Windows convention - if (! tempdir) - { - tempvar = "TMPDIR"; - tempdir = getenv(tempvar); // Mac convention - } - if (! tempdir) - { - // reset tempvar to the first var we check; it's just a - // recommendation - tempvar = "TEMP"; - tempdir = "/tmp"; // Posix in general - } - std::string savefile(gDirUtilp->add(tempdir, "lluuidhashmap_tut.save.txt")); - const int numElementsToCheck = 32*256*32; - std::vector<LLUUID> idList; - if ((! getenv("TEAMCITY_PROJECT_NAME")) && gDirUtilp->fileExists(savefile)) - { - // This is not a TeamCity build, and we have saved data from a - // previous failed run. Reload that data. - std::ifstream inf(savefile.c_str()); - if (! inf.is_open()) - { - fail(STRINGIZE("Although save file '" << savefile << "' exists, it cannot be opened")); - } - std::string item; - while (std::getline(inf, item)) - { - idList.push_back(LLUUID(item)); - } - std::cout << "Reloaded " << idList.size() << " items from '" << savefile << "'"; - if (idList.size() != numElementsToCheck) - { - std::cout << " (expected " << numElementsToCheck << ")"; - } - std::cout << " -- delete this file to generate new data" << std::endl; - } - else - { - // This is a TeamCity build, or (normal case) savefile does not - // exist: regenerate idList from scratch. - for (int i = 0; i < numElementsToCheck; ++i) - { - LLUUID id; - id.generate(); - idList.push_back(id); - } - } - - LLUUIDHashMap<UUIDTableEntry, 32> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); - int i; - - for (i = 0; i < idList.size(); ++i) - { - UUIDTableEntry entry(idList[i], i); - hashTable.set(idList[i], entry); - } - - try - { - for (i = 0; i < idList.size(); i++) - { - LLUUID idToCheck = idList[i]; - UUIDTableEntry entryToCheck = hashTable.get(idToCheck); - ensure_equals(STRINGIZE("set/get ID (entry " << i << ")").c_str(), - entryToCheck.getID(), idToCheck); - ensure_equals(STRINGIZE("set/get value (ID " << idToCheck << ")").c_str(), - entryToCheck.getValue(), (size_t)i); - } - - for (i = 0; i < idList.size(); i++) - { - LLUUID idToCheck = idList[i]; - if (i % 2 != 0) - { - hashTable.remove(idToCheck); - } - } - - for (i = 0; i < idList.size(); i++) - { - LLUUID idToCheck = idList[i]; - ensure("remove or check did not work", (i % 2 == 0 && hashTable.check(idToCheck)) || (i % 2 != 0 && !hashTable.check(idToCheck))); - } - } - catch (const failure&) - { - // One of the above tests failed. Try to save idList to repro with - // a later run. - std::ofstream outf(savefile.c_str()); - if (! outf.is_open()) - { - // Sigh, don't use fail() here because we want to preserve - // the original test failure. - std::cout << "Cannot open file '" << savefile - << "' to save data -- check and fix " << tempvar << std::endl; - } - else - { - // outf.is_open() - for (int i = 0; i < idList.size(); ++i) - { - outf << idList[i] << std::endl; - } - std::cout << "Saved " << idList.size() << " entries to '" << savefile - << "' -- rerun test to debug with these" << std::endl; - } - // re-raise the same exception -- we WANT this test failure to - // be reported! We just needed to save the data on the way out. - throw; - } - } - - // test removing all but one element. - template<> template<> - void hash_index_object_t::test<2>() - { - LLUUIDHashMap<UUIDTableEntry, 2> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); - const int numElementsToCheck = 5; - std::vector<LLUUID> idList(numElementsToCheck*10); - int i; - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID id; - id.generate(); - UUIDTableEntry entry(id, i); - hashTable.set(id, entry); - idList[i] = id; - } - - ensure("getLength failed", hashTable.getLength() == numElementsToCheck); - - // remove all but the last element - for (i = 0; i < numElementsToCheck-1; i++) - { - LLUUID idToCheck = idList[i]; - hashTable.remove(idToCheck); - } - - // there should only be one element left now. - ensure("getLength failed", hashTable.getLength() == 1); - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID idToCheck = idList[i]; - if (i != numElementsToCheck - 1) - { - ensure("remove did not work", hashTable.check(idToCheck) == FALSE); - } - else - { - UUIDTableEntry entryToCheck = hashTable.get(idToCheck); - ensure("remove did not work", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)i); - } - } - } - - // test overriding of value already set. - template<> template<> - void hash_index_object_t::test<3>() - { - LLUUIDHashMap<UUIDTableEntry, 5> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); - const int numElementsToCheck = 10; - std::vector<LLUUID> idList(numElementsToCheck); - int i; - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID id; - id.generate(); - UUIDTableEntry entry(id, i); - hashTable.set(id, entry); - idList[i] = id; - } - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID id = idList[i]; - // set new entry with value = i+numElementsToCheck - UUIDTableEntry entry(id, i+numElementsToCheck); - hashTable.set(id, entry); - } - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID idToCheck = idList[i]; - UUIDTableEntry entryToCheck = hashTable.get(idToCheck); - ensure("set/get did not work", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)(i+numElementsToCheck)); - } - } - - // test removeAll() - template<> template<> - void hash_index_object_t::test<4>() - { - LLUUIDHashMap<UUIDTableEntry, 5> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); - const int numElementsToCheck = 10; - std::vector<LLUUID> idList(numElementsToCheck); - int i; - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID id; - id.generate(); - UUIDTableEntry entry(id, i); - hashTable.set(id, entry); - idList[i] = id; - } - - hashTable.removeAll(); - ensure("removeAll failed", hashTable.getLength() == 0); - } - - - // test sparse map - force it by creating 256 entries that fall into 256 different nodes - template<> template<> - void hash_index_object_t::test<5>() - { - LLUUIDHashMap<UUIDTableEntry, 2> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); - const int numElementsToCheck = 256; - std::vector<LLUUID> idList(numElementsToCheck); - int i; - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID id; - id.generate(); - // LLUUIDHashMap uses mData[0] to pick the bucket - // overwrite mData[0] so that it ranges from 0 to 255 - id.mData[0] = i; - UUIDTableEntry entry(id, i); - hashTable.set(id, entry); - idList[i] = id; - } - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID idToCheck = idList[i]; - UUIDTableEntry entryToCheck = hashTable.get(idToCheck); - ensure("set/get did not work for sparse map", entryToCheck.getID() == idToCheck && entryToCheck.getValue() == (size_t)i); - } - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID idToCheck = idList[i]; - if (i % 2 != 0) - { - hashTable.remove(idToCheck); - } - } - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID idToCheck = idList[i]; - ensure("remove or check did not work for sparse map", (i % 2 == 0 && hashTable.check(idToCheck)) || (i % 2 != 0 && !hashTable.check(idToCheck))); - } - } - - // iterator - template<> template<> - void hash_index_object_t::test<6>() - { - LLUUIDHashMap<UUIDTableEntry, 2> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); - LLUUIDHashMapIter<UUIDTableEntry, 2> hashIter(&hashTable); - const int numElementsToCheck = 256; - std::vector<LLUUID> idList(numElementsToCheck); - int i; - - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID id; - id.generate(); - // LLUUIDHashMap uses mData[0] to pick the bucket - // overwrite mData[0] so that it ranges from 0 to 255 - // to create a sparse map - id.mData[0] = i; - UUIDTableEntry entry(id, i); - hashTable.set(id, entry); - idList[i] = id; - } - - hashIter.first(); - int numElementsIterated = 0; - while(!hashIter.done()) - { - numElementsIterated++; - UUIDTableEntry tableEntry = *hashIter; - LLUUID id = tableEntry.getID(); - hashIter.next(); - ensure("Iteration failed for sparse map", tableEntry.getValue() < (size_t)numElementsToCheck && idList[tableEntry.getValue()] == tableEntry.getID()); - } - - ensure("iteration count failed", numElementsIterated == numElementsToCheck); - } - - // remove after middle of iteration - template<> template<> - void hash_index_object_t::test<7>() - { - LLUUIDHashMap<UUIDTableEntry, 2> hashTable(UUIDTableEntry::uuidEq, UUIDTableEntry()); - LLUUIDHashMapIter<UUIDTableEntry, 2> hashIter(&hashTable); - const int numElementsToCheck = 256; - std::vector<LLUUID> idList(numElementsToCheck); - int i; - - LLUUID uuidtoSearch; - for (i = 0; i < numElementsToCheck; i++) - { - LLUUID id; - id.generate(); - // LLUUIDHashMap uses mData[0] to pick the bucket - // overwrite mData[0] so that it ranges from 0 to 255 - // to create a sparse map - id.mData[0] = i; - UUIDTableEntry entry(id, i); - hashTable.set(id, entry); - idList[i] = id; - - // pick uuid somewhere in the middle - if (i == 5) - { - uuidtoSearch = id; - } - } - - hashIter.first(); - int numElementsIterated = 0; - while(!hashIter.done()) - { - numElementsIterated++; - UUIDTableEntry tableEntry = *hashIter; - LLUUID id = tableEntry.getID(); - if (uuidtoSearch == id) - { - break; - } - hashIter.next(); - } - - // current iterator implementation will not allow any remove operations - // until ALL elements have been iterated over. this seems to be - // an unnecessary restriction. Iterator should have a method to - // reset() its state so that further operations (inckuding remove) - // can be performed on the HashMap without having to iterate thru - // all the remaining nodes. - -// hashIter.reset(); -// hashTable.remove(uuidtoSearch); -// ensure("remove after iteration reset failed", hashTable.check(uuidtoSearch) == FALSE); - } -} diff --git a/indra/test/manageapr.h b/indra/test/manageapr.h deleted file mode 100755 index 2452fb6ae4f78cd762a1b44e77c11567d9fc367a..0000000000000000000000000000000000000000 --- a/indra/test/manageapr.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file manageapr.h - * @author Nat Goodspeed - * @date 2012-01-13 - * @brief ManageAPR class for simple test programs - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Copyright (c) 2012, Linden Research, Inc. - * $/LicenseInfo$ - */ - -#if ! defined(LL_MANAGEAPR_H) -#define LL_MANAGEAPR_H - -#include "llapr.h" -#include <boost/noncopyable.hpp> - -/** - * Declare a static instance of this class for dead-simple ll_init_apr() at - * program startup, ll_cleanup_apr() at termination. This is recommended for - * use only with simple test programs. Once you start introducing static - * instances of other classes that depend on APR already being initialized, - * the indeterminate static-constructor-order problem rears its ugly head. - */ -class ManageAPR: public boost::noncopyable -{ -public: - ManageAPR() - { - ll_init_apr(); - } - - ~ManageAPR() - { - ll_cleanup_apr(); - } - - static std::string strerror(apr_status_t rv) - { - char errbuf[256]; - apr_strerror(rv, errbuf, sizeof(errbuf)); - return errbuf; - } -}; - -#endif /* ! defined(LL_MANAGEAPR_H) */ diff --git a/indra/test/message_tut.cpp b/indra/test/message_tut.cpp index d971b334752dc1c99e5c7bc80d62f84430a62a10..4c0463c65c438bd28c7e82273636713dd6429856 100755 --- a/indra/test/message_tut.cpp +++ b/indra/test/message_tut.cpp @@ -32,7 +32,6 @@ #include "llapr.h" #include "llmessageconfig.h" #include "llsdserialize.h" -#include "llversionserver.h" #include "message.h" #include "message_prehash.h" @@ -72,9 +71,9 @@ namespace tut // currently test disconnected message system start_messaging_system("notafile", 13035, - LL_VERSION_MAJOR, - LL_VERSION_MINOR, - LL_VERSION_PATCH, + 1, + 0, + 0, FALSE, "notasharedsecret", NULL, diff --git a/indra/test/test.cpp b/indra/test/test.cpp index dc8580fe697a632d9a691bb670db266a8928ddfd..10f71a2843ef69fa42bfcbaad6229beb9aefed96 100755 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -40,6 +40,8 @@ #include "tests/wrapllerrs.h" // RecorderProxy #include "stringize.h" #include "namedtempfile.h" +#include "lltrace.h" +#include "lltracethreadrecorder.h" #include "apr_pools.h" #include "apr_getopt.h" @@ -482,6 +484,8 @@ void wouldHaveCrashed(const std::string& message) tut::fail("llerrs message: " + message); } +static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL; + int main(int argc, char **argv) { // The following line must be executed to initialize Google Mock @@ -512,15 +516,15 @@ int main(int argc, char **argv) ctype_workaround(); #endif - apr_initialize(); - apr_pool_t* pool = NULL; - if(APR_SUCCESS != apr_pool_create(&pool, NULL)) + ll_init_apr(); + + if (!sMasterThreadRecorder) { - std::cerr << "Unable to initialize pool" << std::endl; - return 1; + sMasterThreadRecorder = new LLTrace::ThreadRecorder(); + LLTrace::set_master_thread_recorder(sMasterThreadRecorder); } apr_getopt_t* os = NULL; - if(APR_SUCCESS != apr_getopt_init(&os, pool, argc, argv)) + if(APR_SUCCESS != apr_getopt_init(&os, gAPRPoolp, argc, argv)) { std::cerr << "apr_getopt_init() failed" << std::endl; return 1; @@ -602,7 +606,7 @@ int main(int argc, char **argv) if (LOGFAIL) { LLError::ELevel level = LLError::decodeLevel(LOGFAIL); - replayer.reset(new LLReplayLogReal(level, pool)); + replayer.reset(new LLReplayLogReal(level, gAPRPoolp)); } else { @@ -646,7 +650,7 @@ int main(int argc, char **argv) s.close(); } - apr_terminate(); + ll_cleanup_apr(); int retval = (success ? 0 : 1); return retval; diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp index 884b00f0ccba6f96325047e51614638ffa24eb9d..fa4f5abd284d8a2a683ba8aa7756c136a49c2782 100755 --- a/indra/test_apps/llplugintest/llmediaplugintest.cpp +++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp @@ -37,6 +37,12 @@ #include "llmediaplugintest.h" + +#if LL_WINDOWS +#pragma warning(disable: 4263) +#pragma warning(disable: 4264) +#endif + #if __APPLE__ #include <GLUT/glut.h> #include <CoreFoundation/CoreFoundation.h> @@ -46,10 +52,6 @@ #define GLUI_FREEGLUT #endif -#if LL_WINDOWS -#pragma warning(disable: 4263) -#pragma warning(disable: 4264) -#endif #include "glui.h" diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp index 8f33b2ad58f96b675a667e71dad06df6c5b38fb1..b8408a6fb45bf5ec771382ffc376eff823c534b2 100755 --- a/indra/viewer_components/login/lllogin.cpp +++ b/indra/viewer_components/login/lllogin.cpp @@ -311,7 +311,7 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_para sendProgressEvent("offline", "fail.login", error_response); } catch (...) { - llerrs << "login exception caught" << llendl; + LL_ERRS() << "login exception caught" << LL_ENDL; } } diff --git a/indra/win_crash_logger/llcrashloggerwindows.cpp b/indra/win_crash_logger/llcrashloggerwindows.cpp index 6a272fd16659431b771653ea10f0bd3457d49375..51e70f95b66c99a7d63d5ab7bb954de9a703530b 100644 --- a/indra/win_crash_logger/llcrashloggerwindows.cpp +++ b/indra/win_crash_logger/llcrashloggerwindows.cpp @@ -318,7 +318,7 @@ int LLCrashLoggerWindows::processingLoop() { } } - llinfos << "session ending.." << llendl; + LL_INFOS() << "session ending.." << LL_ENDL; std::string per_run_dir = options["dumpdir"].asString(); std::string per_run_file = per_run_dir + "\\SecondLife.log"; @@ -326,7 +326,7 @@ int LLCrashLoggerWindows::processingLoop() { if (gDirUtilp->fileExists(per_run_dir)) { - LL_INFOS ("CRASHREPORT") << "Copying " << log_file << " to " << per_run_file << llendl; + LL_INFOS ("CRASHREPORT") << "Copying " << log_file << " to " << per_run_file << LL_ENDL; LLFile::copy(log_file, per_run_file); } return 0; @@ -354,19 +354,19 @@ void LLCrashLoggerWindows::OnClientDumpRequest(void* context, { if (!file_path) { - llwarns << "dump with no file path" << llendl; + LL_WARNS() << "dump with no file path" << LL_ENDL; return; } if (!client_info) { - llwarns << "dump with no client info" << llendl; + LL_WARNS() << "dump with no client info" << LL_ENDL; return; } LLCrashLoggerWindows* self = static_cast<LLCrashLoggerWindows*>(context); if (!self) { - llwarns << "dump with no context" << llendl; + LL_WARNS() << "dump with no context" << LL_ENDL; return; } @@ -406,13 +406,13 @@ bool LLCrashLoggerWindows::initCrashServer() if (!mCrashHandler) { //Failed to start the crash server. - llwarns << "Failed to init crash server." << llendl; + LL_WARNS() << "Failed to init crash server." << LL_ENDL; return false; } // Start servicing clients. if (!mCrashHandler->Start()) { - llwarns << "Failed to start crash server." << llendl; + LL_WARNS() << "Failed to start crash server." << LL_ENDL; return false; } @@ -433,7 +433,7 @@ bool LLCrashLoggerWindows::init(void) swprintf(gProductName, L"Second Life"); */ - llinfos << "Loading dialogs" << llendl; + LL_INFOS() << "Loading dialogs" << LL_ENDL; // Initialize global strings LoadString(mhInst, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); @@ -472,7 +472,8 @@ void LLCrashLoggerWindows::gatherPlatformSpecificFiles() bool LLCrashLoggerWindows::mainLoop() { - llinfos << "CrashSubmitBehavior is " << mCrashBehavior << llendl; + LL_INFOS() << "CrashSubmitBehavior is " << mCrashBehavior << LL_ENDL; + // Note: parent hwnd is 0 (the desktop). No dlg proc. See Petzold (5th ed) HexCalc example, Chapter 11, p529 // win_crash_logger.rc has been edited by hand. // Dialogs defined with CLASS "WIN_CRASH_LOGGER" (must be same as szWindowClass) @@ -483,7 +484,7 @@ bool LLCrashLoggerWindows::mainLoop() if (mCrashBehavior == CRASH_BEHAVIOR_ALWAYS_SEND) { - llinfos << "Showing crash report submit progress window." << llendl; + LL_INFOS() << "Showing crash report submit progress window." << LL_ENDL; //ShowWindow(gHwndProgress, SW_SHOW ); Maint-5707 sendCrashLogs(); } @@ -522,7 +523,7 @@ bool LLCrashLoggerWindows::mainLoop() } else { - llwarns << "Unknown crash behavior " << mCrashBehavior << llendl; + LL_WARNS() << "Unknown crash behavior " << mCrashBehavior << LL_ENDL; return 1; } return 0; diff --git a/indra/win_crash_logger/win_crash_logger.cpp b/indra/win_crash_logger/win_crash_logger.cpp index 79b85147250050fe27d1202477b0cb1e1d821349..366edd894b970766a0e621e5067b70c954b9f7d2 100755 --- a/indra/win_crash_logger/win_crash_logger.cpp +++ b/indra/win_crash_logger/win_crash_logger.cpp @@ -34,7 +34,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) { - llinfos << "Starting crash reporter with args" << &lpCmdLine << llendl; + LL_INFOS() << "Starting crash reporter with args" << &lpCmdLine << LL_ENDL; LLCrashLoggerWindows app; app.setHandle(hInstance); app.parseCommandOptions(__argc, __argv); @@ -43,17 +43,17 @@ int APIENTRY WinMain(HINSTANCE hInstance, LLApp::PRIORITY_COMMAND_LINE); if (!(options.has("pid") && options.has("dumpdir"))) { - llwarns << "Insufficient parameters to crash report." << llendl; + LL_WARNS() << "Insufficient parameters to crash report." << LL_ENDL; } if (! app.init()) { - llwarns << "Unable to initialize application." << llendl; - return 1; + LL_WARNS() << "Unable to initialize application." << LL_ENDL; + return -1; } app.processingLoop(); app.mainLoop(); app.cleanup(); - llinfos << "Crash reporter finished normally." << llendl; + LL_INFOS() << "Crash reporter finished normally." << LL_ENDL; return 0; }