From c0ba626c8009b22310b3923e8170e5db2a021253 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 15 Oct 2012 21:34:29 -0600 Subject: For SH-3333: Design and implement a new object cache system on viewer side --- indra/newview/llviewerregion.cpp | 478 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 441 insertions(+), 37 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 31e3820a21..15c95aa30a 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -70,6 +70,7 @@ #include "stringize.h" #include "llviewercontrol.h" #include "llsdserialize.h" +#include "llvieweroctree.h" #ifdef LL_WINDOWS #pragma warning(disable:4355) @@ -133,7 +134,14 @@ public: // 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. + LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //visible root entries of a linked set. + std::set< LLPointer > mDummyEntries; //dummy vo cache entries, for LLSpatialBridge use. + std::set< LLSpatialGroup* > mVisibleGroups; //visible llspatialgroup + LLVOCachePartition* mVOCachePartition; + // time? // LRU info? @@ -291,7 +299,8 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mCacheLoaded(FALSE), mCacheDirty(FALSE), mReleaseNotesRequested(FALSE), - mCapabilitiesReceived(false) + mCapabilitiesReceived(false), + mDead(FALSE) { mWidth = region_width_meters; mImpl->mOriginGlobal = from_region_handle(handle); @@ -323,17 +332,20 @@ 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(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 = (LLVOCachePartition*)getSpatialPartition(PARTITION_VO_CACHE); } @@ -354,6 +366,12 @@ void LLViewerRegion::initStats() 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 +455,6 @@ void LLViewerRegion::saveObjectCache() mCacheDirty = FALSE; } - for(LLVOCacheEntry::vocache_entry_map_t::iterator iter = mImpl->mCacheMap.begin(); iter != mImpl->mCacheMap.end(); ++iter) - { - delete iter->second; - } mImpl->mCacheMap.clear(); } @@ -718,8 +732,199 @@ void LLViewerRegion::dirtyHeights() } } +void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry) +{ + LLPointer oct_entry; + U32 state = LLVOCacheEntry::INACTIVE; + + if(old_entry) + { + oct_entry = old_entry->getEntry(); + state = old_entry->getState(); + + while(old_entry->getNumOfChildren() > 0) + { + new_entry->addChild(old_entry->getNextChild()); + } + + killCacheEntry(old_entry); + } + + mImpl->mCacheMap[new_entry->getLocalID()] = new_entry; + if(oct_entry.notNull()) + { + new_entry->setOctreeEntry(oct_entry); + } + + if(state == LLVOCacheEntry::ACTIVE) + { + llassert(new_entry->getEntry()->hasDrawable()); + mImpl->mActiveSet.insert(new_entry); + } + else if(state == LLVOCacheEntry::WAITING) + { + mImpl->mWaitingSet.insert(new_entry); + } + else if(old_entry && oct_entry) + { + addToVOCacheTree(new_entry); + } + new_entry->setState(state); +} + +//physically delete the cache entry +void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry) +{ + if(!entry) + { + return; + } + + //1, 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); + } + + //2, kill LLViewerObject if exists + //this should be done by the rendering pipeline automatically. + + //3, remove from mVOCachePartition + if(entry->isState(LLVOCacheEntry::INACTIVE) && entry->getEntry()) + { + removeFromVOCacheTree(entry); + } + + entry->setState(LLVOCacheEntry::INACTIVE); + //4, remove from mCacheMap, real deletion + mImpl->mCacheMap.erase(entry->getLocalID()); +} + +//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::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) + { + return; + } + if(entry->isDummy()) + { + mImpl->mDummyEntries.insert(entry); //keep a copy to prevent from being deleted. + addToVOCacheTree(entry); + } + else if(!drawablep->getParent()) //root node + { + addToVOCacheTree(entry); + mImpl->mVisibleEntries.erase(entry); + } + else //child node + { + LLViewerOctreeEntry* parent_oct_entry = drawablep->getParent()->getEntry(); + if(parent_oct_entry && parent_oct_entry->hasVOCacheEntry()) + { + LLVOCacheEntry* parent = (LLVOCacheEntry*)parent_oct_entry->getVOCacheEntry(); + parent->addChild(entry); + } + } + + mImpl->mActiveSet.erase(entry); + mImpl->mWaitingSet.erase(entry); + entry->setState(LLVOCacheEntry::INACTIVE); +} + +void LLViewerRegion::addVisibleGroup(LLSpatialGroup* group) +{ + if(mDead || group->isEmpty() || group->isDead()) + { + return; + } + + mImpl->mVisibleGroups.insert(group); +} + +void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) +{ + static BOOL vo_cache_culling_enabled = gSavedSettings.getBOOL("ObjectCacheViewCullingEnabled"); + + if(mDead || !entry || !entry->getEntry()) + { + return; + } + llassert(!entry->getGroup()); + + mImpl->mVOCachePartition->addEntry(entry->getEntry()); +} + +void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) +{ + if(mDead || !entry || !entry->getEntry()) + { + return; + } + + mImpl->mVOCachePartition->removeEntry(entry->getEntry()); +} + +//add the visible root entry of a linked set +void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) +{ + if(mDead || !entry || !entry->getNumOfChildren()) + { + return; //no child entries + } + + mImpl->mVisibleEntries.insert(entry); +} + +void LLViewerRegion::clearVisibleGroup(LLSpatialGroup* group) +{ + if(mDead) + { + return; + } + + llassert(!group->getOctreeNode() || group->isEmpty()); + + mImpl->mVisibleGroups.erase(group); +} + BOOL LLViewerRegion::idleUpdate(F32 max_update_time) { + LLTimer update_timer; + // did_update returns TRUE if we did at least one significant update BOOL did_update = mImpl->mLandp->idleUpdate(max_update_time); @@ -729,9 +934,168 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) mParcelOverlay->idleUpdate(); } + if(update_timer.getElapsedTimeF32() > max_update_time) + { + return did_update; + } + + //kill invisible objects + std::vector delete_list; + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin(); + iter != mImpl->mActiveSet.end(); ++iter) + { + if(!(*iter)->isRecentlyVisible()) + { + killObject((*iter), delete_list); + } + } + for(S32 i = 0; i < delete_list.size(); i++) + { + gObjectList.killObject(delete_list[i]->getVObj()); + } + delete_list.clear(); + + bool timeout = false; + S32 new_object_count = 64; //minimum number of new objects to be added + //add childrens of visible objects to the rendering pipeline + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) + { + LLVOCacheEntry* entry = *iter; + LLVOCacheEntry* child = entry->getNextChild(); + while(child != NULL) + { + if(child->isState(LLVOCacheEntry::INACTIVE)) + { + addNewObject(child); + + if(new_object_count-- < 0 && update_timer.getElapsedTimeF32() > max_update_time) + { + timeout = true; + break; + } + } + child = entry->getNextChild(); + } + if(!child) + { + if(entry->isDummy()) + { + mImpl->mDummyEntries.erase(entry); + } + + iter = mImpl->mVisibleEntries.erase(iter); + } + else + { + break; //timeout + } + } + if(timeout) + { + mImpl->mVisibleGroups.clear(); + return did_update; + } + + //add objects in the visible groups to the rendering pipeline + std::set< LLSpatialGroup* >::iterator group_iter = mImpl->mVisibleGroups.begin(); + while(group_iter != mImpl->mVisibleGroups.end()) + { + LLSpatialGroup* group = *group_iter; + if(!group->getOctreeNode() || group->isEmpty()) + { + mImpl->mVisibleGroups.erase(group_iter); + group_iter = mImpl->mVisibleGroups.begin(); + continue; + } + + std::vector entry_list; + for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) + { + //group data contents could change during creating new objects, so copy all contents first. + entry_list.push_back(*i); + } + + for(S32 i = 0; i < entry_list.size(); i++) + { + LLViewerOctreeEntry* entry = entry_list[i]; + if(entry && entry->hasVOCacheEntry()) + { + LLVOCacheEntry* vo_entry = (LLVOCacheEntry*)entry->getVOCacheEntry(); + if(vo_entry->isDummy()) + { + addVisibleCacheEntry(vo_entry); //for LLSpatialBridge. + } + else if(vo_entry->isState(LLVOCacheEntry::INACTIVE)) + { + addNewObject(vo_entry); + if(new_object_count-- < 0 && update_timer.getElapsedTimeF32() > max_update_time) + { + timeout = true; + break; + } + } + } + } + entry_list.clear(); + + if(timeout) + { + break; + } + mImpl->mVisibleGroups.erase(group); + group_iter = mImpl->mVisibleGroups.begin(); + } + mImpl->mVisibleGroups.clear(); + return did_update; } +void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& delete_list) +{ + //kill the object. + LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable(); + llassert(drawablep); + + if(!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->isRecentlyVisible()) + { + //set the parent group visible if any of its children visible. + drawablep->getSpatialGroup()->setVisible(); + return; + } + } + delete_list.push_back(drawablep); + } +} + +LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) +{ + 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 + { + llerrs << "Object is already created." << llendl; + } + return obj; +} // As above, but forcibly do the update. void LLViewerRegion::forceUpdate() @@ -1191,8 +1555,9 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec { U32 local_id = objectp->getLocalID(); U32 crc = objectp->getCRC(); + eCacheUpdateResult result; - LLVOCacheEntry* entry = get_if_there(mImpl->mCacheMap, local_id, (LLVOCacheEntry*)NULL); + LLVOCacheEntry* entry = getCacheEntry(local_id); if (entry) { @@ -1201,41 +1566,79 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec { // Record a hit entry->recordDupe(); - return CACHE_UPDATE_DUPE; + result = CACHE_UPDATE_DUPE; } + else + { + // Update the cache entry + LLPointer new_entry = new LLVOCacheEntry(local_id, crc, dp); + replaceCacheEntry(entry, new_entry); + entry = new_entry; - // Update the cache entry - mImpl->mCacheMap.erase(local_id); - delete entry; + result = CACHE_UPDATE_CHANGED; + } + } + else + { + // we haven't seen this object before + // Create new entry and add to map + result = CACHE_UPDATE_ADDED; + //if (mImpl->mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES) + //{ + // delete mImpl->mCacheMap.begin()->second ; + // mImpl->mCacheMap.erase(mImpl->mCacheMap.begin()); + // result = CACHE_UPDATE_REPLACED; + // + //} entry = new LLVOCacheEntry(local_id, crc, dp); + mImpl->mCacheMap[local_id] = entry; - return CACHE_UPDATE_CHANGED; } - // we haven't seen this object before - - // Create new entry and add to map - eCacheUpdateResult result = CACHE_UPDATE_ADDED; - if (mImpl->mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES) + if(objectp->mDrawable.notNull() && !entry->getEntry()) { - delete mImpl->mCacheMap.begin()->second ; - mImpl->mCacheMap.erase(mImpl->mCacheMap.begin()); - result = CACHE_UPDATE_REPLACED; - + entry->setOctreeEntry(objectp->mDrawable->getEntry()); + } + if(entry->getEntry() && entry->getEntry()->hasDrawable() && entry->isState(LLVOCacheEntry::INACTIVE)) + { + addActiveCacheEntry(entry); } - entry = new LLVOCacheEntry(local_id, crc, dp); - mImpl->mCacheMap[local_id] = entry; return result; } +LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) +{ + static BOOL vo_cache_culling_enabled = gSavedSettings.getBOOL("ObjectCacheViewCullingEnabled"); + + if(!vo_cache_culling_enabled) + { + return NULL; + } + + LLVOCacheEntry* entry = getCacheEntry(local_id); + removeFromVOCacheTree(entry); + + return entry; +} + +LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) +{ + LLVOCacheEntry::vocache_entry_map_t::iterator iter = mImpl->mCacheMap.find(local_id); + if(iter != mImpl->mCacheMap.end()) + { + return iter->second; + } + return NULL; +} + // 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) { //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); if (entry) { @@ -1244,20 +1647,21 @@ LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc, U8 &cache_miss_type) { // Record a hit entry->recordHit(); - cache_miss_type = CACHE_MISS_TYPE_NONE; + cache_miss_type = CACHE_MISS_TYPE_NONE; + return entry->getDP(crc); } else { // llinfos << "CRC miss for " << local_id << llendl; - cache_miss_type = CACHE_MISS_TYPE_CRC; + cache_miss_type = CACHE_MISS_TYPE_CRC; mCacheMissCRC.put(local_id); } } else { // llinfos << "Cache miss for " << local_id << llendl; - cache_miss_type = CACHE_MISS_TYPE_FULL; + cache_miss_type = CACHE_MISS_TYPE_FULL; mCacheMissFull.put(local_id); } -- cgit v1.2.3 From 9bc8028ab52ef5d56fa8a3915d927b5a050d8ead Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 16 Oct 2012 11:40:02 -0600 Subject: Some minor performance tuning-up for SH-3333. --- indra/newview/llviewerregion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 15c95aa30a..0c0522d32f 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1066,7 +1066,7 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& if(child->mDrawable->isRecentlyVisible()) { //set the parent group visible if any of its children visible. - drawablep->getSpatialGroup()->setVisible(); + ((LLViewerOctreeEntryData*)drawablep)->setVisible(); return; } } -- cgit v1.2.3 From 5ae116f89b8459963ccb6ae9125d94ffaa79025e Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 31 Oct 2012 17:05:53 -0600 Subject: for SH-3471: create a simplified version of octree for object cache entries. --- indra/newview/llviewerregion.cpp | 174 ++++++++++++++++++++++++++------------- 1 file changed, 118 insertions(+), 56 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0c0522d32f..1adab15d70 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -86,6 +86,8 @@ 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; +LLViewerRegion* LLViewerRegion::sCurRegionp = NULL; + typedef std::map CapabilityMap; class LLViewerRegionImpl { @@ -139,7 +141,7 @@ public: LLVOCacheEntry::vocache_entry_set_t mWaitingSet; //entries waiting for LLDrawable to be generated. LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //visible root entries of a linked set. std::set< LLPointer > mDummyEntries; //dummy vo cache entries, for LLSpatialBridge use. - std::set< LLSpatialGroup* > mVisibleGroups; //visible llspatialgroup + std::set< LLviewerOctreeGroup* > mVisibleGroups; //visible llspatialgroup LLVOCachePartition* mVOCachePartition; // time? @@ -165,7 +167,7 @@ public: LLCapabilityListener mCapabilityListener; //spatial partitions for objects in this region - std::vector mObjectPartition; + std::vector mObjectPartition; }; // support for secondlife:///app/region/{REGION} SLapps @@ -345,7 +347,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mImpl->mObjectPartition.push_back(new LLVOCachePartition(this)); //PARTITION_VO_CACHE mImpl->mObjectPartition.push_back(NULL); //PARTITION_NONE - mImpl->mVOCachePartition = (LLVOCachePartition*)getSpatialPartition(PARTITION_VO_CACHE); + mImpl->mVOCachePartition = getVOCachePartition(); } @@ -384,12 +386,12 @@ LLViewerRegion::~LLViewerRegion() delete mParcelOverlay; delete mImpl->mLandp; delete mImpl->mEventPoll; - LLHTTPSender::clearSender(mImpl->mHost); - - saveObjectCache(); + LLHTTPSender::clearSender(mImpl->mHost); std::for_each(mImpl->mObjectPartition.begin(), mImpl->mObjectPartition.end(), DeletePointer()); + saveObjectCache(); + delete mImpl; mImpl = NULL; } @@ -865,13 +867,13 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d entry->setState(LLVOCacheEntry::INACTIVE); } -void LLViewerRegion::addVisibleGroup(LLSpatialGroup* group) +void LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group) { - if(mDead || group->isEmpty() || group->isDead()) + if(mDead || group->isEmpty()) { return; } - + group->setVisible(); mImpl->mVisibleGroups.insert(group); } @@ -909,7 +911,7 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) mImpl->mVisibleEntries.insert(entry); } -void LLViewerRegion::clearVisibleGroup(LLSpatialGroup* group) +void LLViewerRegion::clearVisibleGroup(LLviewerOctreeGroup* group) { if(mDead) { @@ -920,44 +922,18 @@ void LLViewerRegion::clearVisibleGroup(LLSpatialGroup* group) mImpl->mVisibleGroups.erase(group); } - -BOOL LLViewerRegion::idleUpdate(F32 max_update_time) -{ - LLTimer update_timer; - - // did_update returns TRUE if we did at least one significant update - BOOL did_update = mImpl->mLandp->idleUpdate(max_update_time); - if (mParcelOverlay) - { - // Hopefully not a significant time sink... - mParcelOverlay->idleUpdate(); - } - - if(update_timer.getElapsedTimeF32() > max_update_time) - { - return did_update; - } - - //kill invisible objects - std::vector delete_list; - for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin(); - iter != mImpl->mActiveSet.end(); ++iter) - { - if(!(*iter)->isRecentlyVisible()) - { - killObject((*iter), delete_list); - } - } - for(S32 i = 0; i < delete_list.size(); i++) +//return time left +F32 LLViewerRegion::addLinkedSetChildren(F32 max_time, S32& max_num_objects) +{ + if(mImpl->mVisibleEntries.empty()) { - gObjectList.killObject(delete_list[i]->getVObj()); + return max_time; } - delete_list.clear(); + LLTimer update_timer; bool timeout = false; - S32 new_object_count = 64; //minimum number of new objects to be added - //add childrens of visible objects to the rendering pipeline + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) { LLVOCacheEntry* entry = *iter; @@ -968,9 +944,9 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) { addNewObject(child); - if(new_object_count-- < 0 && update_timer.getElapsedTimeF32() > max_update_time) + if(max_num_objects-- < 0 && update_timer.getElapsedTimeF32() > max_time) { - timeout = true; + timeout = true; //timeout break; } } @@ -982,7 +958,10 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) { mImpl->mDummyEntries.erase(entry); } - + } + + if(!timeout) + { iter = mImpl->mVisibleEntries.erase(iter); } else @@ -990,17 +969,28 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) break; //timeout } } + if(timeout) { - mImpl->mVisibleGroups.clear(); - return did_update; + return -1.f; } + return max_time - update_timer.getElapsedTimeF32(); //time left +} - //add objects in the visible groups to the rendering pipeline - std::set< LLSpatialGroup* >::iterator group_iter = mImpl->mVisibleGroups.begin(); +F32 LLViewerRegion::addVisibleObjects(F32 max_time, S32& max_num_objects) +{ + if(mImpl->mVisibleGroups.empty()) + { + return max_time; + } + + LLTimer update_timer; + bool timeout = false; + + std::set< LLviewerOctreeGroup* >::iterator group_iter = mImpl->mVisibleGroups.begin(); while(group_iter != mImpl->mVisibleGroups.end()) { - LLSpatialGroup* group = *group_iter; + LLviewerOctreeGroup* group = *group_iter; if(!group->getOctreeNode() || group->isEmpty()) { mImpl->mVisibleGroups.erase(group_iter); @@ -1009,7 +999,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) } std::vector entry_list; - for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) + for (LLviewerOctreeGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { //group data contents could change during creating new objects, so copy all contents first. entry_list.push_back(*i); @@ -1028,7 +1018,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) else if(vo_entry->isState(LLVOCacheEntry::INACTIVE)) { addNewObject(vo_entry); - if(new_object_count-- < 0 && update_timer.getElapsedTimeF32() > max_update_time) + if(max_num_objects-- < 0 && update_timer.getElapsedTimeF32() > max_time) { timeout = true; break; @@ -1044,12 +1034,75 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) } mImpl->mVisibleGroups.erase(group); group_iter = mImpl->mVisibleGroups.begin(); + } + + if(timeout) + { + return -1.0f; } - mImpl->mVisibleGroups.clear(); + return max_time - update_timer.getElapsedTimeF32(); +} + +BOOL LLViewerRegion::idleUpdate(F32 max_update_time) +{ + LLTimer update_timer; + // did_update returns TRUE if we did at least one significant update + BOOL did_update = mImpl->mLandp->idleUpdate(max_update_time); + + if (mParcelOverlay) + { + // Hopefully not a significant time sink... + mParcelOverlay->idleUpdate(); + } + + max_update_time -= update_timer.getElapsedTimeF32(); + if(max_update_time < 0.f) + { + return did_update; + } + + sCurRegionp = this; + + //kill invisible objects + max_update_time = killInvisibleObjects(max_update_time); + + S32 new_object_count = 64; //minimum number of new objects to be added + + //add childrens of visible objects to the rendering pipeline + max_update_time = addLinkedSetChildren(max_update_time, new_object_count); + + //add objects in the visible groups to the rendering pipeline + if(max_update_time > 0.f) + { + addVisibleObjects(max_update_time, new_object_count); + } + + mImpl->mVisibleGroups.clear(); + sCurRegionp = NULL; return did_update; } +F32 LLViewerRegion::killInvisibleObjects(F32 max_time) +{ + std::vector delete_list; + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin(); + iter != mImpl->mActiveSet.end(); ++iter) + { + if(!(*iter)->isRecentlyVisible()) + { + killObject((*iter), delete_list); + } + } + for(S32 i = 0; i < delete_list.size(); i++) + { + gObjectList.killObject(delete_list[i]->getVObj()); + } + delete_list.clear(); + + return max_time; +} + void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& delete_list) { //kill the object. @@ -2189,9 +2242,18 @@ void LLViewerRegion::logActiveCapabilities() const 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; } -- cgit v1.2.3 From 819adb5eb4d7f982121f3dbd82750e05d26864d9 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 1 Nov 2012 00:26:44 -0700 Subject: SH-3405 FIX convert existing stats to lltrace system final removal of remaining LLStat code --- indra/newview/llviewerregion.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 31e3820a21..652e0ee70b 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -291,7 +291,9 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mCacheLoaded(FALSE), mCacheDirty(FALSE), mReleaseNotesRequested(FALSE), - mCapabilitiesReceived(false) + mCapabilitiesReceived(false), + mBitsReceived(0.f), + mPacketsReceived(0.f) { mWidth = region_width_meters; mImpl->mOriginGlobal = from_region_handle(handle); @@ -909,9 +911,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; } -- cgit v1.2.3 From c2859e4663c405950b6f433270ae558852330c76 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 8 Nov 2012 21:36:47 -0700 Subject: for SH-3472: prioritize object loading --- indra/newview/llviewerregion.cpp | 317 ++++++++++++++++++++++++--------------- 1 file changed, 197 insertions(+), 120 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 1adab15d70..24bd68825b 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -100,6 +100,8 @@ public: mSeedCapMaxAttemptsBeforeLogin(MAX_SEED_CAP_ATTEMPTS_BEFORE_LOGIN), mSeedCapAttempts(0), mHttpResponderID(0), + mLastCameraUpdate(0), + mLastCameraOrigin(), // 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 @@ -136,13 +138,14 @@ public: // Misc LLVLComposition *mCompositionp; // Composition layer for the surface - 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. - LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //visible root entries of a linked set. + 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 > mDummyEntries; //dummy vo cache entries, for LLSpatialBridge use. - std::set< LLviewerOctreeGroup* > mVisibleGroups; //visible llspatialgroup - LLVOCachePartition* mVOCachePartition; + std::set< 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. // time? // LRU info? @@ -168,6 +171,9 @@ public: //spatial partitions for objects in this region std::vector mObjectPartition; + + LLVector3 mLastCameraOrigin; + U32 mLastCameraUpdate; }; // support for secondlife:///app/region/{REGION} SLapps @@ -736,27 +742,16 @@ void LLViewerRegion::dirtyHeights() void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry) { - LLPointer oct_entry; U32 state = LLVOCacheEntry::INACTIVE; if(old_entry) { - oct_entry = old_entry->getEntry(); + new_entry->copy(old_entry); state = old_entry->getState(); - - while(old_entry->getNumOfChildren() > 0) - { - new_entry->addChild(old_entry->getNextChild()); - } - killCacheEntry(old_entry); } mImpl->mCacheMap[new_entry->getLocalID()] = new_entry; - if(oct_entry.notNull()) - { - new_entry->setOctreeEntry(oct_entry); - } if(state == LLVOCacheEntry::ACTIVE) { @@ -767,7 +762,7 @@ void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry { mImpl->mWaitingSet.insert(new_entry); } - else if(old_entry && oct_entry) + else if(old_entry && new_entry->getEntry()) { addToVOCacheTree(new_entry); } @@ -790,19 +785,23 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry) else if(entry->isState(LLVOCacheEntry::WAITING)) { mImpl->mWaitingSet.erase(entry); - } - - //2, kill LLViewerObject if exists - //this should be done by the rendering pipeline automatically. - - //3, remove from mVOCachePartition - if(entry->isState(LLVOCacheEntry::INACTIVE) && entry->getEntry()) + } + else if(entry->isState(LLVOCacheEntry::IN_QUEUE)) { + mImpl->mVisibleEntries.erase(entry); + } + else if(entry->isState(LLVOCacheEntry::INACTIVE)) + { + //remove from mVOCachePartition removeFromVOCacheTree(entry); } + //kill LLViewerObject if exists + //this should be done by the rendering pipeline automatically. + entry->setState(LLVOCacheEntry::INACTIVE); - //4, remove from mCacheMap, real deletion + + //remove from mCacheMap, real deletion mImpl->mCacheMap.erase(entry->getLocalID()); } @@ -885,7 +884,10 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { return; } - llassert(!entry->getGroup()); + if(entry->getGroup()) //already in octree. + { + return; + } mImpl->mVOCachePartition->addEntry(entry->getEntry()); } @@ -896,18 +898,31 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) { return; } + if(!entry->getGroup()) + { + return; + } mImpl->mVOCachePartition->removeEntry(entry->getEntry()); } -//add the visible root entry of a linked set +//add the visible entries void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) { - if(mDead || !entry || !entry->getNumOfChildren()) + if(mDead || !entry) { - return; //no child entries + return; } + if(entry->isState(LLVOCacheEntry::IN_QUEUE)) + { + return; + } + + if(entry->isState(LLVOCacheEntry::INACTIVE)) + { + entry->setState(LLVOCacheEntry::IN_QUEUE); + } mImpl->mVisibleEntries.insert(entry); } @@ -922,124 +937,148 @@ void LLViewerRegion::clearVisibleGroup(LLviewerOctreeGroup* group) mImpl->mVisibleGroups.erase(group); } - -//return time left -F32 LLViewerRegion::addLinkedSetChildren(F32 max_time, S32& max_num_objects) + +F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { - if(mImpl->mVisibleEntries.empty()) + if(mImpl->mVisibleGroups.empty() && mImpl->mVisibleEntries.empty()) { return max_time; } LLTimer update_timer; - bool timeout = false; + + 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); + + //process visible entries + max_time *= 0.5f; //only use up to half available time to update entries. for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) { - LLVOCacheEntry* entry = *iter; - LLVOCacheEntry* child = entry->getNextChild(); - while(child != NULL) + LLVOCacheEntry* vo_entry = *iter; + vo_entry->calcSceneContribution(camera_origin, needs_update, mImpl->mLastCameraUpdate); + + if(vo_entry->getState() < LLVOCacheEntry::WAITING && !vo_entry->isDummy()) + { + mImpl->mWaitingList.insert(vo_entry); + } + + LLVOCacheEntry* child; + S32 num_child = vo_entry->getNumOfChildren(); + S32 num_done = 0; + for(S32 i = 0; i < num_child; i++) { - if(child->isState(LLVOCacheEntry::INACTIVE)) + child = vo_entry->getChild(i); + if(child->getState() < LLVOCacheEntry::WAITING) { - addNewObject(child); - - if(max_num_objects-- < 0 && update_timer.getElapsedTimeF32() > max_time) - { - timeout = true; //timeout - break; - } + child->setSceneContribution(vo_entry->getSceneContribution()); + mImpl->mWaitingList.insert(child); } - child = entry->getNextChild(); - } - if(!child) - { - if(entry->isDummy()) + else { - mImpl->mDummyEntries.erase(entry); + num_done++; } } - - if(!timeout) + if(num_done == num_child) { - iter = mImpl->mVisibleEntries.erase(iter); + vo_entry->clearChildrenList(); + } + + if(!vo_entry->getNumOfChildren()) + { + if(vo_entry->isDummy()) + { + mImpl->mDummyEntries.erase(vo_entry); + iter = mImpl->mVisibleEntries.erase(iter); + } + else if(vo_entry->getState() >= LLVOCacheEntry::WAITING) + { + iter = mImpl->mVisibleEntries.erase(iter); + } + else + { + ++iter; + } } else { - break; //timeout + ++iter; } - } - if(timeout) - { - return -1.f; - } - return max_time - update_timer.getElapsedTimeF32(); //time left -} - -F32 LLViewerRegion::addVisibleObjects(F32 max_time, S32& max_num_objects) -{ - if(mImpl->mVisibleGroups.empty()) - { - return max_time; + //if(update_timer.getElapsedTimeF32() > max_time) + //{ + // break; + //} } - LLTimer update_timer; - bool timeout = false; - + //process visible groups std::set< LLviewerOctreeGroup* >::iterator group_iter = mImpl->mVisibleGroups.begin(); - while(group_iter != mImpl->mVisibleGroups.end()) + for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter) { LLviewerOctreeGroup* group = *group_iter; if(!group->getOctreeNode() || group->isEmpty()) { - mImpl->mVisibleGroups.erase(group_iter); - group_iter = mImpl->mVisibleGroups.begin(); continue; } - std::vector entry_list; for (LLviewerOctreeGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { - //group data contents could change during creating new objects, so copy all contents first. - entry_list.push_back(*i); - } - - for(S32 i = 0; i < entry_list.size(); i++) - { - LLViewerOctreeEntry* entry = entry_list[i]; - if(entry && entry->hasVOCacheEntry()) + if((*i)->hasVOCacheEntry()) { - LLVOCacheEntry* vo_entry = (LLVOCacheEntry*)entry->getVOCacheEntry(); + LLVOCacheEntry* vo_entry = (LLVOCacheEntry*)(*i)->getVOCacheEntry(); if(vo_entry->isDummy()) { addVisibleCacheEntry(vo_entry); //for LLSpatialBridge. + continue; } - else if(vo_entry->isState(LLVOCacheEntry::INACTIVE)) - { - addNewObject(vo_entry); - if(max_num_objects-- < 0 && update_timer.getElapsedTimeF32() > max_time) - { - timeout = true; - break; - } - } + + vo_entry->calcSceneContribution(camera_origin, needs_update, mImpl->mLastCameraUpdate); + mImpl->mWaitingList.insert(vo_entry); } } - entry_list.clear(); - if(timeout) - { - break; - } - mImpl->mVisibleGroups.erase(group); - group_iter = mImpl->mVisibleGroups.begin(); - } + //if(update_timer.getElapsedTimeF32() > max_time) + //{ + // break; + //} + } + mImpl->mVisibleGroups.clear(); + + if(needs_update) + { + mImpl->mLastCameraOrigin = camera_origin; + mImpl->mLastCameraUpdate = cur_frame; + } + + return 2.0f * max_time - update_timer.getElapsedTimeF32(); +} + +F32 LLViewerRegion::createVisibleObjects(F32 max_time) +{ + if(mImpl->mWaitingList.empty()) + { + return max_time; + } - if(timeout) + LLTimer update_timer; + S32 max_num_objects = 64; //minimum number of new objects to be added + for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); + iter != mImpl->mWaitingList.end(); ++iter) { - return -1.0f; + LLVOCacheEntry* vo_entry = *iter; + + if(vo_entry->getState() < LLVOCacheEntry::WAITING) + { + addNewObject(vo_entry); + if(max_num_objects-- < 0 && update_timer.getElapsedTimeF32() > max_time) + { + break; + } + } } + mImpl->mWaitingList.clear(); + return max_time - update_timer.getElapsedTimeF32(); } @@ -1057,7 +1096,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) } max_update_time -= update_timer.getElapsedTimeF32(); - if(max_update_time < 0.f) + if(max_update_time < 0.f || mImpl->mCacheMap.empty()) { return did_update; } @@ -1065,20 +1104,14 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) sCurRegionp = this; //kill invisible objects - max_update_time = killInvisibleObjects(max_update_time); - - S32 new_object_count = 64; //minimum number of new objects to be added + max_update_time = killInvisibleObjects(max_update_time); - //add childrens of visible objects to the rendering pipeline - max_update_time = addLinkedSetChildren(max_update_time, new_object_count); - - //add objects in the visible groups to the rendering pipeline - if(max_update_time > 0.f) - { - addVisibleObjects(max_update_time, new_object_count); - } + max_update_time = updateVisibleEntries(max_update_time); + createVisibleObjects(max_update_time); mImpl->mVisibleGroups.clear(); + mImpl->mWaitingList.clear(); + sCurRegionp = NULL; return did_update; } @@ -1687,7 +1720,7 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 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, U8 &cache_miss_type) { //llassert(mCacheLoaded); This assert failes often, changing to early-out -- davep, 2010/10/18 @@ -1702,7 +1735,51 @@ LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc, U8 &cache_miss_type) entry->recordHit(); cache_miss_type = CACHE_MISS_TYPE_NONE; - return entry->getDP(crc); + if(entry->getGroup() || !entry->isState(LLVOCacheEntry::INACTIVE)) + { + return true; + } + + addVisibleCacheEntry(entry); +#if 0 + if(entry->isBridgeChild()) //bridge child + { + addVisibleCacheEntry(entry); + } + else + { + U32 parent_id = entry->getParentID(); + if(parent_id > 0) //has parent + { + LLVOCacheEntry* parent = getCacheEntry(parent_id); + + if(parent) //parent cached + { + parent->addChild(entry); + + if(parent->isState(LLVOCacheEntry::INACTIVE)) + { + //addToVOCacheTree(parent); + addVisibleCacheEntry(parent); + } + else //parent visible + { + addVisibleCacheEntry(parent); + } + } + else //parent not cached. This should not happen, but just in case... + { + addVisibleCacheEntry(entry); + } + } + else //root node + { + //addToVOCacheTree(entry); + addVisibleCacheEntry(entry); + } + } +#endif + return true; } else { @@ -1718,7 +1795,7 @@ LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc, U8 &cache_miss_type) mCacheMissFull.put(local_id); } - return NULL; + return false; } void LLViewerRegion::addCacheMissFull(const U32 local_id) -- cgit v1.2.3 From 551411247b8e4701e4768f61717b644750af83a7 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 20 Nov 2012 21:37:04 -0700 Subject: fix a crash caused by object cache for SH-3333. --- indra/newview/llviewerregion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 24bd68825b..e275b44e92 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -746,7 +746,7 @@ void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry if(old_entry) { - new_entry->copy(old_entry); + old_entry->copyTo(new_entry); state = old_entry->getState(); killCacheEntry(old_entry); } -- cgit v1.2.3 From f2bf13b87768c97ec6a36a183013413bf4b905f0 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 12 Dec 2012 11:00:24 -0700 Subject: fix for SH-3622: crash on LLViewerRegion::updateVisibleEntries --- indra/newview/llviewerregion.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e275b44e92..ab692308b0 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -777,25 +777,25 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry) return; } - //1, remove from active list and waiting list + //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); - } - else if(entry->isState(LLVOCacheEntry::IN_QUEUE)) - { - mImpl->mVisibleEntries.erase(entry); - } - else if(entry->isState(LLVOCacheEntry::INACTIVE)) + 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); + //kill LLViewerObject if exists //this should be done by the rendering pipeline automatically. -- cgit v1.2.3 From e1247d631f24065a31d9668915cb8bc84f3abc7f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 18 Dec 2012 14:36:46 -0700 Subject: fix for SH-3619: some objects are missing --- indra/newview/llviewerregion.cpp | 98 ++++++++++++---------------------------- 1 file changed, 28 insertions(+), 70 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index ab692308b0..33e8348660 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -87,6 +87,7 @@ const F32 CAP_REQUEST_TIMEOUT = 18; const S32 MAX_CAP_REQUEST_ATTEMPTS = 30; LLViewerRegion* LLViewerRegion::sCurRegionp = NULL; +BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; typedef std::map CapabilityMap; @@ -141,7 +142,6 @@ public: 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 > mDummyEntries; //dummy vo cache entries, for LLSpatialBridge use. std::set< LLviewerOctreeGroup* > mVisibleGroups; //visible groupa LLVOCachePartition* mVOCachePartition; LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //must-be-created visible entries wait for objects creation. @@ -841,17 +841,8 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d { return; } - if(entry->isDummy()) - { - mImpl->mDummyEntries.insert(entry); //keep a copy to prevent from being deleted. - addToVOCacheTree(entry); - } - else if(!drawablep->getParent()) //root node - { - addToVOCacheTree(entry); - mImpl->mVisibleEntries.erase(entry); - } - else //child node + + if(drawablep->getParent()) //child object { LLViewerOctreeEntry* parent_oct_entry = drawablep->getParent()->getEntry(); if(parent_oct_entry && parent_oct_entry->hasVOCacheEntry()) @@ -860,7 +851,19 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d parent->addChild(entry); } } + else //insert to vo cache tree. + { + //shift to the local regional space from agent space + const LLVector3 pos = drawablep->getVObj()->getPositionRegion(); + LLVector4a vec(pos[0], pos[1], pos[2]); + LLVector4a shift; + shift.setSub(vec, entry->getPositionGroup()); + entry->shift(shift); + + addToVOCacheTree(entry); + } + mImpl->mVisibleEntries.erase(entry); mImpl->mActiveSet.erase(entry); mImpl->mWaitingSet.erase(entry); entry->setState(LLVOCacheEntry::INACTIVE); @@ -878,7 +881,10 @@ void LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group) void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { - static BOOL vo_cache_culling_enabled = gSavedSettings.getBOOL("ObjectCacheViewCullingEnabled"); + if(!sVOCacheCullingEnabled) + { + return; + } if(mDead || !entry || !entry->getEntry()) { @@ -954,12 +960,13 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) //process visible entries max_time *= 0.5f; //only use up to half available time to update entries. +#if 1 for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) { LLVOCacheEntry* vo_entry = *iter; vo_entry->calcSceneContribution(camera_origin, needs_update, mImpl->mLastCameraUpdate); - if(vo_entry->getState() < LLVOCacheEntry::WAITING && !vo_entry->isDummy()) + if(vo_entry->getState() < LLVOCacheEntry::WAITING) { mImpl->mWaitingList.insert(vo_entry); } @@ -987,12 +994,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) if(!vo_entry->getNumOfChildren()) { - if(vo_entry->isDummy()) - { - mImpl->mDummyEntries.erase(vo_entry); - iter = mImpl->mVisibleEntries.erase(iter); - } - else if(vo_entry->getState() >= LLVOCacheEntry::WAITING) + if(vo_entry->getState() >= LLVOCacheEntry::WAITING) { iter = mImpl->mVisibleEntries.erase(iter); } @@ -1011,6 +1013,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) // break; //} } +#endif //process visible groups std::set< LLviewerOctreeGroup* >::iterator group_iter = mImpl->mVisibleGroups.begin(); @@ -1027,11 +1030,6 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) if((*i)->hasVOCacheEntry()) { LLVOCacheEntry* vo_entry = (LLVOCacheEntry*)(*i)->getVOCacheEntry(); - if(vo_entry->isDummy()) - { - addVisibleCacheEntry(vo_entry); //for LLSpatialBridge. - continue; - } vo_entry->calcSceneContribution(camera_origin, needs_update, mImpl->mLastCameraUpdate); mImpl->mWaitingList.insert(vo_entry); @@ -1118,6 +1116,11 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) F32 LLViewerRegion::killInvisibleObjects(F32 max_time) { + if(!sVOCacheCullingEnabled) + { + return max_time; + } + std::vector delete_list; for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin(); iter != mImpl->mActiveSet.end(); ++iter) @@ -1695,13 +1698,6 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) { - static BOOL vo_cache_culling_enabled = gSavedSettings.getBOOL("ObjectCacheViewCullingEnabled"); - - if(!vo_cache_culling_enabled) - { - return NULL; - } - LLVOCacheEntry* entry = getCacheEntry(local_id); removeFromVOCacheTree(entry); @@ -1741,44 +1737,6 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U8 &cache_miss_type) } addVisibleCacheEntry(entry); -#if 0 - if(entry->isBridgeChild()) //bridge child - { - addVisibleCacheEntry(entry); - } - else - { - U32 parent_id = entry->getParentID(); - if(parent_id > 0) //has parent - { - LLVOCacheEntry* parent = getCacheEntry(parent_id); - - if(parent) //parent cached - { - parent->addChild(entry); - - if(parent->isState(LLVOCacheEntry::INACTIVE)) - { - //addToVOCacheTree(parent); - addVisibleCacheEntry(parent); - } - else //parent visible - { - addVisibleCacheEntry(parent); - } - } - else //parent not cached. This should not happen, but just in case... - { - addVisibleCacheEntry(entry); - } - } - else //root node - { - //addToVOCacheTree(entry); - addVisibleCacheEntry(entry); - } - } -#endif return true; } else -- cgit v1.2.3 From 4e22f3e3ef15e24d7e9e0ad156e60d4cd1b2d5c9 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 18 Dec 2012 23:16:50 -0700 Subject: fix for SH-3624: Object deletion does not work --- indra/newview/llviewerregion.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 33e8348660..c4b6cacae2 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -894,6 +894,10 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { return; } + if(!entry->hasState(LLVOCacheEntry::ADD_TO_CACHE_TREE)) + { + return; //can not add to vo cache tree. + } mImpl->mVOCachePartition->addEntry(entry->getEntry()); } @@ -1132,7 +1136,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) } for(S32 i = 0; i < delete_list.size(); i++) { - gObjectList.killObject(delete_list[i]->getVObj()); + gObjectList.killObject(delete_list[i]->getVObj(), true); } delete_list.clear(); -- cgit v1.2.3 From 6272ca1ad82fd9818a1dd937a890ed982f0bdc4a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 11 Jan 2013 16:52:43 -0800 Subject: SH-3405 WIP convert existing stats to lltrace system more gcc fixes --- indra/newview/llviewerregion.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 7d2e08c1c6..570bf9264c 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1001,7 +1001,10 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { if(vo_entry->getState() >= LLVOCacheEntry::WAITING) { - iter = mImpl->mVisibleEntries.erase(iter); + LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter; + ++next_iter; + mImpl->mVisibleEntries.erase(iter); + iter = next_iter; } else { -- cgit v1.2.3 From 45a7fe901aa4cd7af14fa1cb894da46a988e3aa2 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 15 Jan 2013 23:01:40 -0700 Subject: for SH-3653: Can we repurpose ObjectUpdateCached:ObjectData:UpdateFlags field to carry spatial+size data? --- indra/newview/llviewerregion.cpp | 81 +++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 46 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 7d2e08c1c6..f44c8ffe46 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1718,9 +1718,26 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) return NULL; } +//estimate weight of cache missed object +F32 LLViewerRegion::calcObjectWeight(U32 flags) +{ + LLVector3 pos((F32)(flags & 0xff), (F32)((flags >> 8) & 0xff), (F32)((flags >> 16) & 0xff) * 16.f); + F32 rad = (F32)((flags >> 24) & 0xff); + + pos += getOriginAgent(); + pos -= LLViewerCamera::getInstance()->getOrigin(); + + return rad * rad / pos.lengthSquared(); +} + +void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight) +{ + mCacheMissList.insert(CacheMissItem(id, miss_type, weight)); +} + // Get data packer for this object, if we have cached data // AND the CRC matches. JC -bool LLViewerRegion::probeCache(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 @@ -1746,15 +1763,14 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U8 &cache_miss_type) else { // llinfos << "CRC miss for " << local_id << llendl; - cache_miss_type = CACHE_MISS_TYPE_CRC; - mCacheMissCRC.put(local_id); + + addCacheMiss(local_id, CACHE_MISS_TYPE_CRC, calcObjectWeight(flags)); } } else { // llinfos << "Cache miss for " << local_id << llendl; - cache_miss_type = CACHE_MISS_TYPE_FULL; - mCacheMissFull.put(local_id); + addCacheMiss(local_id, CACHE_MISS_TYPE_FULL, calcObjectWeight(flags)); } return false; @@ -1762,49 +1778,22 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U8 &cache_miss_type) void LLViewerRegion::addCacheMissFull(const U32 local_id) { - mCacheMissFull.put(local_id); + addCacheMiss(local_id, CACHE_MISS_TYPE_FULL, 100.f); } 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) { @@ -1816,8 +1805,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) @@ -1832,14 +1821,14 @@ void LLViewerRegion::requestCacheMisses() if (!start_new_message) { 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); + LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size()); LLViewerStatsRecorder::instance().log(0.2f); + + mCacheMissList.clear(); } void LLViewerRegion::dumpCache() -- cgit v1.2.3 From 3660f8b632d1288cefeeff66c3b62522b4bbacbc Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 24 Jan 2013 17:11:33 -0700 Subject: more for SH-3653: Can we repurpose ObjectUpdateCached:ObjectData:UpdateFlags field to carry spatial+size data? --- indra/newview/llviewerregion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 45d43bdf74..e5cb2a1b08 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1724,13 +1724,13 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) //estimate weight of cache missed object F32 LLViewerRegion::calcObjectWeight(U32 flags) { - LLVector3 pos((F32)(flags & 0xff), (F32)((flags >> 8) & 0xff), (F32)((flags >> 16) & 0xff) * 16.f); + LLVector3 pos((F32)(flags & 0xff) + 0.5f, (F32)((flags >> 8) & 0xff) + 0.5f, (F32)((flags >> 16) & 0xff) * 16.f + 8.0f); F32 rad = (F32)((flags >> 24) & 0xff); pos += getOriginAgent(); pos -= LLViewerCamera::getInstance()->getOrigin(); - return rad * rad / pos.lengthSquared(); + return 100.f * rad * rad / pos.lengthSquared(); } void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight) -- cgit v1.2.3 From bd60fdbe44d9f996686d31cf48a3f2ca664dd301 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 28 Feb 2013 22:49:05 -0700 Subject: for SH-3824: interesting: Ensure viewer can handle object updates from entire region gracefully --- indra/newview/llviewerregion.cpp | 134 +++++++++++++++++++++++++++++++++------ 1 file changed, 114 insertions(+), 20 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e5cb2a1b08..040b39bc43 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -880,7 +880,7 @@ void LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group) mImpl->mVisibleGroups.insert(group); } -void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) +void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry, bool forced) { if(!sVOCacheCullingEnabled) { @@ -895,7 +895,7 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { return; } - if(!entry->hasState(LLVOCacheEntry::ADD_TO_CACHE_TREE)) + if(!forced && !entry->hasState(LLVOCacheEntry::ADD_TO_CACHE_TREE)) { return; //can not add to vo cache tree. } @@ -1647,14 +1647,91 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) mSimulatorFeatures = sim_features; } -LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) +void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) +{ + if(entry != NULL && !entry->getEntry()) + { + entry->setOctreeEntry(NULL); + } + else + { + return; //not new entry, no post processing. + } + + LLVector3 pos; + LLVector3 scale; + LLQuaternion rot; + U32 parent_id = LLViewerObject::extractSpatialExtents(entry->getDP(), pos, scale, rot); + + entry->setBoundingInfo(pos, scale); + + if(parent_id > 0) //has parent + { + //1, find parent, update position + LLVOCacheEntry* parent = getCacheEntry(parent_id); + + //2, if can not, put into the orphan lists: a parents list and a children list + if(!parent) + { + std::map::iterator iter = mOrphanMap.find(parent_id); + if(iter != mOrphanMap.end()) + { + iter->second.addChild(entry->getLocalID()); + } + else + { + OrphanList o_list(entry->getLocalID()); + mOrphanMap[parent_id] = o_list; + } + + return; + } + else + { + entry->updateBoundingInfo(parent); + } + } + + if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) + { + addToVOCacheTree(entry, true); + } + + if(!parent_id) //a potential parent + { + //find all children and update their bounding info + std::map::iterator iter = mOrphanMap.find(entry->getLocalID()); + if(iter != mOrphanMap.end()) + { + std::set* children = mOrphanMap[parent_id].getChildList(); + for(std::set::iterator child_iter = children->begin(); child_iter != children->end(); ++child_iter) + { + LLVOCacheEntry* child = getCacheEntry(*child_iter); + if(child) + { + child->updateBoundingInfo(entry); + addToVOCacheTree(child); + } + } + + mOrphanMap.erase(entry->getLocalID()); + } + } + + return ; +} + +LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerBinaryBuffer &dp) { - U32 local_id = objectp->getLocalID(); - U32 crc = objectp->getCRC(); eCacheUpdateResult result; + U32 crc; + U32 local_id; - LLVOCacheEntry* entry = getCacheEntry(local_id); + LLViewerObject::unpackU32(&dp, local_id, "LocalID"); + LLViewerObject::unpackU32(&dp, crc, "CRC"); + LLVOCacheEntry* entry = getCacheEntry(local_id); + if (entry) { // we've seen this object before @@ -1668,9 +1745,22 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec { // Update the cache entry LLPointer new_entry = new LLVOCacheEntry(local_id, crc, dp); - replaceCacheEntry(entry, new_entry); - entry = new_entry; - + + //if visible, update it + if(!entry->isState(LLVOCacheEntry::INACTIVE)) + { + replaceCacheEntry(entry, new_entry); + } + else //invisible + { + //remove old entry + killCacheEntry(entry); + entry = new_entry; + + mImpl->mCacheMap[local_id] = entry; + postProcesNewEntry(entry); + } + result = CACHE_UPDATE_CHANGED; } } @@ -1679,17 +1769,21 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec // we haven't seen this object before // Create new entry and add to map result = CACHE_UPDATE_ADDED; - //if (mImpl->mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES) - //{ - // delete mImpl->mCacheMap.begin()->second ; - // mImpl->mCacheMap.erase(mImpl->mCacheMap.begin()); - // result = CACHE_UPDATE_REPLACED; - // - //} entry = new LLVOCacheEntry(local_id, crc, dp); - + mImpl->mCacheMap[local_id] = entry; + + postProcesNewEntry(entry); } + + return result; +} + +LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) +{ + eCacheUpdateResult result = cacheFullUpdate(dp); + + LLVOCacheEntry* entry = mImpl->mCacheMap[objectp->getLocalID()]; if(objectp->mDrawable.notNull() && !entry->getEntry()) { @@ -1754,13 +1848,13 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss // Record a hit entry->recordHit(); cache_miss_type = CACHE_MISS_TYPE_NONE; - + if(entry->getGroup() || !entry->isState(LLVOCacheEntry::INACTIVE)) { return true; } - - addVisibleCacheEntry(entry); + //addVisibleCacheEntry(entry); + addToVOCacheTree(entry, true); return true; } else -- cgit v1.2.3 From 03b7fb589a9b5628418364c970ea402448f312be Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 4 Mar 2013 11:48:07 -0700 Subject: trivial: convert to unix line endings. --- indra/newview/llviewerregion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 040b39bc43..b287e0da9c 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1692,8 +1692,8 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) } } - if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) - { + if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) + { addToVOCacheTree(entry, true); } -- cgit v1.2.3 From 50b32cf2bdb93fad14770aa0f6b92fb3815ebdf0 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 7 Mar 2013 23:54:11 -0700 Subject: for SH-3937: interesting: implement the new cache probe logic --- indra/newview/llviewerregion.cpp | 116 ++++++++++++++++++++++++++++++++------- 1 file changed, 97 insertions(+), 19 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b287e0da9c..704b3b644f 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -460,7 +460,11 @@ void LLViewerRegion::saveObjectCache() if(LLVOCache::hasInstance()) { - LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty) ; + //NOTE: !!!!!!!!!! + //set this to be true when support full region cache probe!!!! + BOOL full_region_cache_probe = FALSE; + + LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, full_region_cache_probe) ; mCacheDirty = FALSE; } @@ -744,11 +748,13 @@ void LLViewerRegion::dirtyHeights() void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry) { U32 state = LLVOCacheEntry::INACTIVE; + bool in_vo_tree = false; if(old_entry) { old_entry->copyTo(new_entry); - state = old_entry->getState(); + state = old_entry->getState(); + in_vo_tree = (state == LLVOCacheEntry::INACTIVE && old_entry->getGroup() != NULL); killCacheEntry(old_entry); } @@ -763,7 +769,7 @@ void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry { mImpl->mWaitingSet.insert(new_entry); } - else if(old_entry && new_entry->getEntry()) + else if(!old_entry || in_vo_tree) { addToVOCacheTree(new_entry); } @@ -880,7 +886,7 @@ void LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group) mImpl->mVisibleGroups.insert(group); } -void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry, bool forced) +void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { if(!sVOCacheCullingEnabled) { @@ -895,10 +901,6 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry, bool forced) { return; } - if(!forced && !entry->hasState(LLVOCacheEntry::ADD_TO_CACHE_TREE)) - { - return; //can not add to vo cache tree. - } mImpl->mVOCachePartition->addEntry(entry->getEntry()); } @@ -1039,6 +1041,17 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { LLVOCacheEntry* vo_entry = (LLVOCacheEntry*)(*i)->getVOCacheEntry(); + if(vo_entry->getParentID() > 0) //is a child + { + LLVOCacheEntry* parent = getCacheEntry(vo_entry->getParentID()); + + //make sure the parent is active + if(!parent || !parent->isState(LLVOCacheEntry::ACTIVE)) + { + continue; + } + } + vo_entry->calcSceneContribution(camera_origin, needs_update, mImpl->mLastCameraUpdate); mImpl->mWaitingList.insert(vo_entry); } @@ -1140,7 +1153,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) } for(S32 i = 0; i < delete_list.size(); i++) { - gObjectList.killObject(delete_list[i]->getVObj(), true); + gObjectList.killObject(delete_list[i]->getVObj()); } delete_list.clear(); @@ -1194,6 +1207,28 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) return obj; } +//remove from object cache if the object receives a full-update or terse update +LLViewerObject* LLViewerRegion::forceToRemoveFromCache(U32 local_id, LLViewerObject* objectp) +{ + LLVOCacheEntry* entry = getCacheEntry(local_id); + if (!entry) + { + return objectp; //not in the cache, do nothing. + } + if(!objectp) //object not created + { + entry->setTouched(FALSE); //mark this entry invalid + + //create a new object before delete it from cache. + objectp = gObjectList.processObjectUpdateFromCache(entry, this); + } + + //remove from cache. + killCacheEntry(entry); + + return objectp; +} + // As above, but forcibly do the update. void LLViewerRegion::forceUpdate() { @@ -1647,15 +1682,32 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) mSimulatorFeatures = sim_features; } -void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) +//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) +{ + std::map::iterator iter = mOrphanMap.find(parent_id); + if(iter != mOrphanMap.end()) + { + std::set* children = mOrphanMap[parent_id].getChildList(); + for(std::set::iterator child_iter = children->begin(); child_iter != children->end(); ++child_iter) + { + forceToRemoveFromCache(*child_iter, NULL); + } + + mOrphanMap.erase(parent_id); + } +} + +void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) { if(entry != NULL && !entry->getEntry()) { entry->setOctreeEntry(NULL); } - else + else if(entry->getGroup() != NULL) { - return; //not new entry, no post processing. + return; //already in octree, no post processing. } LLVector3 pos; @@ -1667,11 +1719,13 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) if(parent_id > 0) //has parent { + entry->setParentID(parent_id); + //1, find parent, update position LLVOCacheEntry* parent = getCacheEntry(parent_id); - //2, if can not, put into the orphan lists: a parents list and a children list - if(!parent) + //2, if can not, put into the orphan list. + if(!parent || !parent->getGroup()) { std::map::iterator iter = mOrphanMap.find(parent_id); if(iter != mOrphanMap.end()) @@ -1680,6 +1734,24 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) } else { + //check if the parent is an uncacheable object + if(!parent) + { + LLUUID parent_uuid; + LLViewerObjectList::getUUIDFromLocal(parent_uuid, + parent_id, + getHost().getAddress(), + getHost().getPort()); + LLViewerObject *parent_objp = gObjectList.findObject(parent_uuid); + if(parent_objp) + { + //parent is not cacheable, remove child from the cache. + forceToRemoveFromCache(entry->getLocalID(), NULL); + return; + } + } + + //otherwise insert to the orphan list OrphanList o_list(entry->getLocalID()); mOrphanMap[parent_id] = o_list; } @@ -1688,13 +1760,14 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) } else { + //update the child position to the region space. entry->updateBoundingInfo(parent); } } if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) { - addToVOCacheTree(entry, true); + addToVOCacheTree(entry); } if(!parent_id) //a potential parent @@ -1709,6 +1782,7 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) LLVOCacheEntry* child = getCacheEntry(*child_iter); if(child) { + //update the child position to the region space. child->updateBoundingInfo(entry); addToVOCacheTree(child); } @@ -1758,7 +1832,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB entry = new_entry; mImpl->mCacheMap[local_id] = entry; - postProcesNewEntry(entry); + decodeBoundingInfo(entry); } result = CACHE_UPDATE_CHANGED; @@ -1773,7 +1847,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB mImpl->mCacheMap[local_id] = entry; - postProcesNewEntry(entry); + decodeBoundingInfo(entry); } return result; @@ -1784,6 +1858,10 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec eCacheUpdateResult result = cacheFullUpdate(dp); LLVOCacheEntry* entry = mImpl->mCacheMap[objectp->getLocalID()]; + if(!entry) + { + return result; + } if(objectp->mDrawable.notNull() && !entry->getEntry()) { @@ -1853,8 +1931,8 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss { return true; } - //addVisibleCacheEntry(entry); - addToVOCacheTree(entry, true); + + decodeBoundingInfo(entry); return true; } else -- cgit v1.2.3 From 27bb36b1e796add58f319555bf761e417f7957ef Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 11 Mar 2013 21:23:15 -0600 Subject: for SH-3979: interesting: can not edit objects with new object cache code --- indra/newview/llviewerregion.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 704b3b644f..c74e7158b6 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1795,7 +1795,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) return ; } -LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerBinaryBuffer &dp) +LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerBinaryBuffer &dp, U32 flags) { eCacheUpdateResult result; U32 crc; @@ -1849,14 +1849,16 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB decodeBoundingInfo(entry); } - + entry->setUpdateFlags(flags); + return result; } -LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) +LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp, U32 flags) { - eCacheUpdateResult result = cacheFullUpdate(dp); + eCacheUpdateResult result = cacheFullUpdate(dp, flags); +#if 0 LLVOCacheEntry* entry = mImpl->mCacheMap[objectp->getLocalID()]; if(!entry) { @@ -1871,6 +1873,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec { addActiveCacheEntry(entry); } +#endif return result; } @@ -1926,7 +1929,14 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss // Record a hit entry->recordHit(); cache_miss_type = CACHE_MISS_TYPE_NONE; + entry->setUpdateFlags(flags); + if(entry->isState(LLVOCacheEntry::ACTIVE)) + { + ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj()->loadFlags(flags); + return true; + } + if(entry->getGroup() || !entry->isState(LLVOCacheEntry::INACTIVE)) { return true; -- cgit v1.2.3 From 4624848a6894be669cdb19a82101ea168c407ecd Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 13 Mar 2013 22:31:19 -0600 Subject: revert changes for SH-3653: Can we repurpose ObjectUpdateCached:ObjectData:UpdateFlags field to carry spatial+size data? --- indra/newview/llviewerregion.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c74e7158b6..bf4bff60d7 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1896,21 +1896,9 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) return NULL; } -//estimate weight of cache missed object -F32 LLViewerRegion::calcObjectWeight(U32 flags) +void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type) { - LLVector3 pos((F32)(flags & 0xff) + 0.5f, (F32)((flags >> 8) & 0xff) + 0.5f, (F32)((flags >> 16) & 0xff) * 16.f + 8.0f); - F32 rad = (F32)((flags >> 24) & 0xff); - - pos += getOriginAgent(); - pos -= LLViewerCamera::getInstance()->getOrigin(); - - return 100.f * rad * rad / pos.lengthSquared(); -} - -void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight) -{ - mCacheMissList.insert(CacheMissItem(id, miss_type, weight)); + mCacheMissList.insert(CacheMissItem(id, miss_type)); } // Get data packer for this object, if we have cached data @@ -1949,13 +1937,13 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss { // llinfos << "CRC miss for " << local_id << llendl; - addCacheMiss(local_id, CACHE_MISS_TYPE_CRC, calcObjectWeight(flags)); + addCacheMiss(local_id, CACHE_MISS_TYPE_CRC); } } else { // llinfos << "Cache miss for " << local_id << llendl; - addCacheMiss(local_id, CACHE_MISS_TYPE_FULL, calcObjectWeight(flags)); + addCacheMiss(local_id, CACHE_MISS_TYPE_FULL); } return false; @@ -1963,7 +1951,7 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss void LLViewerRegion::addCacheMissFull(const U32 local_id) { - addCacheMiss(local_id, CACHE_MISS_TYPE_FULL, 100.f); + addCacheMiss(local_id, CACHE_MISS_TYPE_FULL); } void LLViewerRegion::requestCacheMisses() -- cgit v1.2.3 From bdf562036a8ce864bf211b7696b1d74334030f4b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 13 Mar 2013 22:38:00 -0600 Subject: for SH-3913: the viewer should notify the region at connect time if it does not have a cache file --- indra/newview/llviewerregion.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index bf4bff60d7..bca2108964 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2164,7 +2164,13 @@ void LLViewerRegion::unpackRegionHandshake() msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("RegionInfo"); - msg->addU32("Flags", 0x0 ); + + U32 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); } -- cgit v1.2.3 From bbfb7b9ea1dc025d672968e39908b2327d14878a Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 20 Mar 2013 22:49:45 -0600 Subject: for SH-3918: Viewer should respond to cache probes in order received (don't sort response) --- indra/newview/llviewerregion.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index bca2108964..b052c87064 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1898,7 +1898,11 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) 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 } // Get data packer for this object, if we have cached data -- cgit v1.2.3 From 51e5997bd6f7f7d66a5843cf1d0b749b143460a8 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 29 Mar 2013 17:54:04 -0600 Subject: delay removing invalid objects from cache in case region is logged out too soon. --- indra/newview/llviewerregion.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d8f9ecf248..ed67d50dfd 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -460,11 +460,10 @@ void LLViewerRegion::saveObjectCache() if(LLVOCache::hasInstance()) { - //NOTE: !!!!!!!!!! - //set this to be true when support full region cache probe!!!! - BOOL full_region_cache_probe = FALSE; + const F32 start_time_threshold = 600.0f; //seconds + bool removal_enabled = mRegionTimer.getElapsedTimeF32() > start_time_threshold; //allow to remove invalid objects from object cache file. - LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, full_region_cache_probe) ; + LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled) ; mCacheDirty = FALSE; } @@ -2176,6 +2175,8 @@ void LLViewerRegion::unpackRegionHandshake() } msg->addU32("Flags", flags ); msg->sendReliable(host); + + mRegionTimer.reset(); //reset region timer. } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) -- cgit v1.2.3 From da02b9f69471baa407188e2921b5c56c9b8d9415 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 29 Mar 2013 17:54:55 -0600 Subject: save cache file when first login to a region. --- indra/newview/llviewerregion.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index ed67d50dfd..64cf33a9eb 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -442,6 +442,10 @@ void LLViewerRegion::loadObjectCache() if(LLVOCache::hasInstance()) { LLVOCache::getInstance()->readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap) ; + if (mImpl->mCacheMap.empty()) + { + mCacheDirty = TRUE; + } } } -- cgit v1.2.3 From 449222f5f0dbe2a4bd5cbc397298c02a3f3348b0 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 1 Apr 2013 13:44:08 -0600 Subject: trivial: convert to unix line endings. --- indra/newview/llviewerregion.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 64cf33a9eb..bed047ff0b 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -442,9 +442,9 @@ void LLViewerRegion::loadObjectCache() if(LLVOCache::hasInstance()) { LLVOCache::getInstance()->readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap) ; - if (mImpl->mCacheMap.empty()) - { - mCacheDirty = TRUE; + if (mImpl->mCacheMap.empty()) + { + mCacheDirty = TRUE; } } } -- cgit v1.2.3 From 81943ecbe53779a226da4bbdf2c8b1ae39eba11b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 11 Apr 2013 11:51:16 -0600 Subject: for SH-4095: add an option to turn off new interest list code --- indra/newview/llviewerregion.cpp | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index bed047ff0b..84e9c8ea9a 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -465,8 +465,8 @@ void LLViewerRegion::saveObjectCache() if(LLVOCache::hasInstance()) { const F32 start_time_threshold = 600.0f; //seconds - bool removal_enabled = mRegionTimer.getElapsedTimeF32() > start_time_threshold; //allow to remove invalid objects from object cache file. - + 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; } @@ -1120,8 +1120,13 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) max_update_time -= update_timer.getElapsedTimeF32(); if(max_update_time < 0.f || mImpl->mCacheMap.empty()) { - return did_update; -} + return did_update; + } + + if(!sVOCacheCullingEnabled) + { + return did_update; + } sCurRegionp = this; @@ -1704,6 +1709,12 @@ void LLViewerRegion::findOrphans(U32 parent_id) void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) { + if(!sVOCacheCullingEnabled) + { + gObjectList.processObjectUpdateFromCache(entry, this); + return; + } + if(entry != NULL && !entry->getEntry()) { entry->setOctreeEntry(NULL); @@ -1882,12 +1893,17 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec } LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) +{ + if(!sVOCacheCullingEnabled) { + return NULL; + } + LLVOCacheEntry* entry = getCacheEntry(local_id); removeFromVOCacheTree(entry); return entry; - } +} LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) { @@ -2172,10 +2188,14 @@ void LLViewerRegion::unpackRegionHandshake() msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("RegionInfo"); - U32 flags = 0x00000001; //set the bit 0 to be 1 to ask sim to send all cacheable objects. - if(mImpl->mCacheMap.empty()) + U32 flags = 0; + if(sVOCacheCullingEnabled) { - flags |= 0x00000002; //set the bit 1 to be 1 to tell sim the cache file is empty, no need to send cache probes. + 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); -- cgit v1.2.3 From 674df12bc9e81b9b4290f74a96116dbbf1e7f77c Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 17 Apr 2013 23:00:36 -0600 Subject: for SH-4105: interesting: new viewer does not handle orphaned child prims in ObjectUpdateCompressed messages --- indra/newview/llviewerregion.cpp | 105 ++++++++++++++------------------------- 1 file changed, 37 insertions(+), 68 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 84e9c8ea9a..a2ff232d02 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1020,11 +1020,6 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { ++iter; } - - //if(update_timer.getElapsedTimeF32() > max_time) - //{ - // break; - //} } #endif @@ -1046,24 +1041,14 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) if(vo_entry->getParentID() > 0) //is a child { - LLVOCacheEntry* parent = getCacheEntry(vo_entry->getParentID()); - - //make sure the parent is active - if(!parent || !parent->isState(LLVOCacheEntry::ACTIVE)) - { - continue; - } + //child visibility depends on its parent. + continue; } vo_entry->calcSceneContribution(camera_origin, needs_update, mImpl->mLastCameraUpdate); mImpl->mWaitingList.insert(vo_entry); } } - - //if(update_timer.getElapsedTimeF32() > max_time) - //{ - // break; - //} } mImpl->mVisibleGroups.clear(); @@ -1145,6 +1130,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) F32 LLViewerRegion::killInvisibleObjects(F32 max_time) { +#if 1 if(!sVOCacheCullingEnabled) { return max_time; @@ -1164,7 +1150,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) gObjectList.killObject(delete_list[i]->getVObj()); } delete_list.clear(); - +#endif return max_time; } @@ -1694,15 +1680,15 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) //move all orphan children out of cache and insert to rendering octree. void LLViewerRegion::findOrphans(U32 parent_id) { - std::map::iterator iter = mOrphanMap.find(parent_id); + orphan_list_t::iterator iter = mOrphanMap.find(parent_id); if(iter != mOrphanMap.end()) { - std::set* children = mOrphanMap[parent_id].getChildList(); - for(std::set::iterator child_iter = children->begin(); child_iter != children->end(); ++child_iter) + std::vector* children = &mOrphanMap[parent_id]; + for(S32 i = 0; i < children->size(); i++) { - forceToRemoveFromCache(*child_iter, NULL); + forceToRemoveFromCache((*children)[i], NULL); } - + children->clear(); mOrphanMap.erase(parent_id); } } @@ -1727,58 +1713,42 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) LLVector3 pos; LLVector3 scale; LLQuaternion rot; + + //decode spatial info and parent info U32 parent_id = LLViewerObject::extractSpatialExtents(entry->getDP(), pos, scale, rot); - entry->setBoundingInfo(pos, scale); - if(parent_id > 0) //has parent { entry->setParentID(parent_id); - //1, find parent, update position + //1, find the parent in cache LLVOCacheEntry* parent = getCacheEntry(parent_id); - //2, if can not, put into the orphan list. - if(!parent || !parent->getGroup()) + //2, parent is not in the cache, put into the orphan list. + if(!parent) { - std::map::iterator iter = mOrphanMap.find(parent_id); - if(iter != mOrphanMap.end()) + mOrphanMap[parent_id].push_back(entry->getLocalID()); + } + else //parent in cache + { + if(!parent->isState(LLVOCacheEntry::INACTIVE)) { - iter->second.addChild(entry->getLocalID()); + //parent is visible, so is the child. + addVisibleCacheEntry(entry); } - else + else { - //check if the parent is an uncacheable object - if(!parent) - { - LLUUID parent_uuid; - LLViewerObjectList::getUUIDFromLocal(parent_uuid, - parent_id, - getHost().getAddress(), - getHost().getPort()); - LLViewerObject *parent_objp = gObjectList.findObject(parent_uuid); - if(parent_objp) - { - //parent is not cacheable, remove child from the cache. - forceToRemoveFromCache(entry->getLocalID(), NULL); - return; - } - } - - //otherwise insert to the orphan list - OrphanList o_list(entry->getLocalID()); - mOrphanMap[parent_id] = o_list; + parent->addChild(entry); } - - return; - } - else - { - //update the child position to the region space. - entry->updateBoundingInfo(parent); } + + return; } + // + //no parent + // + entry->setBoundingInfo(pos, scale); if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) { addToVOCacheTree(entry); @@ -1787,21 +1757,20 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(!parent_id) //a potential parent { //find all children and update their bounding info - std::map::iterator iter = mOrphanMap.find(entry->getLocalID()); + orphan_list_t::iterator iter = mOrphanMap.find(entry->getLocalID()); if(iter != mOrphanMap.end()) - { - std::set* children = mOrphanMap[parent_id].getChildList(); - for(std::set::iterator child_iter = children->begin(); child_iter != children->end(); ++child_iter) + { + std::vector* orphans = &mOrphanMap[entry->getLocalID()]; + S32 size = orphans->size(); + for(S32 i = 0; i < size; i++) { - LLVOCacheEntry* child = getCacheEntry(*child_iter); + LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); if(child) { - //update the child position to the region space. - child->updateBoundingInfo(entry); - addToVOCacheTree(child); + entry->addChild(child); } } - + orphans->clear(); mOrphanMap.erase(entry->getLocalID()); } } -- cgit v1.2.3 From 6244679b34bfb450bc83fd1ccd8c765028bb6735 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 1 May 2013 10:57:09 -0600 Subject: performance optimization: only scan 32 objects per frame looking for invisibles. --- indra/newview/llviewerregion.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a2ff232d02..57fbaefce3 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1122,7 +1122,6 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) createVisibleObjects(max_update_time); mImpl->mVisibleGroups.clear(); - mImpl->mWaitingList.clear(); sCurRegionp = NULL; return did_update; @@ -1135,16 +1134,40 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) { return max_time; } + if(mImpl->mActiveSet.empty()) + { + return max_time; + } + + static LLVOCacheEntry* last_visited_entry = NULL; + const size_t MAX_UPDATE = 32; std::vector delete_list; - for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.begin(); - iter != mImpl->mActiveSet.end(); ++iter) - { + S32 update_counter = llmin(MAX_UPDATE, mImpl->mActiveSet.size()); + LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(last_visited_entry); + + for(; update_counter > 0; --update_counter, ++iter) + { + if(iter == mImpl->mActiveSet.end()) + { + iter = mImpl->mActiveSet.begin(); + } + if(!(*iter)->isRecentlyVisible()) { killObject((*iter), delete_list); } } + + if(iter == mImpl->mActiveSet.end()) + { + last_visited_entry = NULL; + } + else + { + last_visited_entry = *iter; + } + for(S32 i = 0; i < delete_list.size(); i++) { gObjectList.killObject(delete_list[i]->getVObj()); -- cgit v1.2.3 From 6b81b8629e67d82a7620e48781ded73b6e6126ea Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 5 May 2013 17:45:35 -0700 Subject: Spring cleaning: removed unused .cpp and.h files, and cleaned up header dependencies --- indra/newview/llviewerregion.cpp | 56 ++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 25 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a2ff232d02..e85c566394 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -94,28 +94,29 @@ typedef std::map CapabilityMap; class LLViewerRegionImpl { public: LLViewerRegionImpl(LLViewerRegion * region, LLHost const & host) - : mHost(host), - mCompositionp(NULL), - mEventPoll(NULL), - mSeedCapMaxAttempts(MAX_CAP_REQUEST_ATTEMPTS), - mSeedCapMaxAttemptsBeforeLogin(MAX_SEED_CAP_ATTEMPTS_BEFORE_LOGIN), - mSeedCapAttempts(0), - mHttpResponderID(0), - mLastCameraUpdate(0), - mLastCameraOrigin(), - // 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 - // setRegionNameAndZone() replace the instance. Would that pose - // consistency problems? Can we even request a capability before calling - // setRegionNameAndZone()? - // For testability -- the new Michael Feathers paradigm -- - // LLCapabilityListener binds all the globals it expects to need at - // construction time. - mCapabilityListener(host.getString(), gMessageSystem, *region, - gAgent.getID(), gAgent.getSessionID()) - { - } + : mHost(host), + mCompositionp(NULL), + mEventPoll(NULL), + mSeedCapMaxAttempts(MAX_CAP_REQUEST_ATTEMPTS), + 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 + // setRegionNameAndZone() replace the instance. Would that pose + // consistency problems? Can we even request a capability before calling + // setRegionNameAndZone()? + // For testability -- the new Michael Feathers paradigm -- + // LLCapabilityListener binds all the globals it expects to need at + // construction time. + mCapabilityListener(host.getString(), gMessageSystem, *region, + gAgent.getID(), gAgent.getSessionID()) + {} void buildCapabilityNames(LLSD& capabilityNames); @@ -439,7 +440,7 @@ 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()) @@ -462,7 +463,7 @@ void LLViewerRegion::saveObjectCache() return; } - if(LLVOCache::hasInstance()) + if(LLVOCache::instanceExists()) { 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. @@ -755,7 +756,7 @@ void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry if(old_entry) { - old_entry->copyTo(new_entry); + old_entry->moveTo(new_entry); state = old_entry->getState(); in_vo_tree = (state == LLVOCacheEntry::INACTIVE && old_entry->getGroup() != NULL); killCacheEntry(old_entry); @@ -942,6 +943,11 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) mImpl->mVisibleEntries.insert(entry); } +bool LLViewerRegion::hasVisibleGroup(LLviewerOctreeGroup* group) +{ + return mImpl->mVisibleGroups.find(group) != mImpl->mVisibleGroups.end(); +} + void LLViewerRegion::clearVisibleGroup(LLviewerOctreeGroup* group) { if(mDead) -- cgit v1.2.3 From 7006cbe3a24a88da4182f5930bb0fe712c43ce8c Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 16 May 2013 16:58:04 -0600 Subject: fix for SH-4080: interesting: random crash on Mac --- indra/newview/llviewerregion.cpp | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 2ba0d939be..85da75510b 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -86,7 +86,6 @@ 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; -LLViewerRegion* LLViewerRegion::sCurRegionp = NULL; BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; typedef std::map CapabilityMap; @@ -143,7 +142,7 @@ public: 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< LLviewerOctreeGroup* > mVisibleGroups; //visible groupa + std::set< LLPointer > 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. @@ -943,23 +942,6 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) mImpl->mVisibleEntries.insert(entry); } -bool LLViewerRegion::hasVisibleGroup(LLviewerOctreeGroup* group) -{ - return mImpl->mVisibleGroups.find(group) != mImpl->mVisibleGroups.end(); -} - -void LLViewerRegion::clearVisibleGroup(LLviewerOctreeGroup* group) -{ - if(mDead) - { - return; - } - - llassert(!group->getOctreeNode() || group->isEmpty()); - - mImpl->mVisibleGroups.erase(group); -} - F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { if(mImpl->mVisibleGroups.empty() && mImpl->mVisibleEntries.empty()) @@ -1030,11 +1012,12 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) #endif //process visible groups - std::set< LLviewerOctreeGroup* >::iterator group_iter = mImpl->mVisibleGroups.begin(); + std::set< LLPointer >::iterator group_iter = mImpl->mVisibleGroups.begin(); for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter) { - LLviewerOctreeGroup* group = *group_iter; - if(!group->getOctreeNode() || group->isEmpty()) + LLPointer group = *group_iter; + if(group->getNumRefs() < 3 || //group to be deleted + !group->getOctreeNode() || group->isEmpty()) //group empty { continue; } @@ -1056,7 +1039,6 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) } } } - mImpl->mVisibleGroups.clear(); if(needs_update) { @@ -1119,8 +1101,6 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) return did_update; } - sCurRegionp = this; - //kill invisible objects max_update_time = killInvisibleObjects(max_update_time); @@ -1129,7 +1109,6 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) mImpl->mVisibleGroups.clear(); - sCurRegionp = NULL; return did_update; } -- cgit v1.2.3 From a6dbd8e089b7d0f462a8ed753258a442b1861541 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 5 Jun 2013 18:01:25 -0600 Subject: fix for SH-4227: interesting: long delay between root and child prim loading. --- indra/newview/llviewerregion.cpp | 46 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 85da75510b..b7d8c470b5 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -146,6 +146,7 @@ public: 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 mNonCacheableCreatedList; //list of local ids of all non-cacheable objects // time? // LRU info? @@ -1694,7 +1695,9 @@ void LLViewerRegion::findOrphans(U32 parent_id) std::vector* children = &mOrphanMap[parent_id]; for(S32 i = 0; i < children->size(); i++) { - forceToRemoveFromCache((*children)[i], NULL); + //parent is visible, so is the child. + LLVOCacheEntry* child = getCacheEntry((*children)[i]); + addVisibleCacheEntry(child); } children->clear(); mOrphanMap.erase(parent_id); @@ -1735,7 +1738,16 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) //2, parent is not in the cache, put into the orphan list. if(!parent) { - mOrphanMap[parent_id].push_back(entry->getLocalID()); + //check if parent is non-cacheable and already created + if(isNonCacheableObjectCreated(parent_id)) + { + //parent is visible, so is the child. + addVisibleCacheEntry(entry); + } + else + { + mOrphanMap[parent_id].push_back(entry->getLocalID()); + } } else //parent in cache { @@ -1901,6 +1913,36 @@ void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_ty #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::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 bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type) -- cgit v1.2.3 From 427490edb566edf18da0b879f9d30a04dda0e9e0 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 10 Jun 2013 22:43:29 -0600 Subject: possible fix and new debug code for SH-4241: viewer crash shortly after login in LLViewerRegion::addNewObject --- indra/newview/llviewerregion.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 55137168ee..29528a1117 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -953,6 +953,8 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { return; } + + llassert_always(!entry->getParentID() && !entry->getEntry()->hasDrawable()); mImpl->mVOCachePartition->addEntry(entry->getEntry()); } @@ -993,6 +995,11 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { + if(mDead) + { + return max_time; + } + if(mImpl->mVisibleGroups.empty() && mImpl->mVisibleEntries.empty()) { return max_time; @@ -1100,6 +1107,10 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) F32 LLViewerRegion::createVisibleObjects(F32 max_time) { + if(mDead) + { + return max_time; + } if(mImpl->mWaitingList.empty()) { return max_time; @@ -1120,8 +1131,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) break; } } - } - mImpl->mWaitingList.clear(); + } return max_time - update_timer.getElapsedTimeF32(); } @@ -1156,6 +1166,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) max_update_time = updateVisibleEntries(max_update_time); createVisibleObjects(max_update_time); + mImpl->mWaitingList.clear(); mImpl->mVisibleGroups.clear(); return did_update; -- cgit v1.2.3 From fc88265cffe3553803314c6e895a1e3a3c988171 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 13 Jun 2013 18:47:51 -0600 Subject: fix for SH-4241: viewer crash shortly after login in LLViewerRegion::addNewObject and SH-4261: interesting: crash in LLViewerRegion::addToVOCacheTree --- indra/newview/llviewerregion.cpp | 90 ++++++++++++++++++++++++++++------------ 1 file changed, 64 insertions(+), 26 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 29528a1117..a2fd440895 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -797,21 +797,25 @@ void LLViewerRegion::dirtyHeights() } } -void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry) +void LLViewerRegion::replaceVisibleCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry) { - U32 state = LLVOCacheEntry::INACTIVE; - bool in_vo_tree = false; - - if(old_entry) - { - old_entry->moveTo(new_entry); - state = old_entry->getState(); - in_vo_tree = (state == LLVOCacheEntry::INACTIVE && old_entry->getGroup() != NULL); - killCacheEntry(old_entry); - } - - mImpl->mCacheMap[new_entry->getLocalID()] = new_entry; + //save old entry + old_entry->moveTo(new_entry); + U32 state = old_entry->getState(); + U32 old_parent_id = old_entry->getParentID(); + //kill old entry + killCacheEntry(old_entry); + + //parse new entry + U32 new_parent_id = 0; + LLViewerObject::unpackParentID(new_entry->getDP(), new_parent_id); + + //store new entry + mImpl->mCacheMap[new_entry->getLocalID()] = new_entry; + + //process entry state + new_entry->setState(state); if(state == LLVOCacheEntry::ACTIVE) { llassert(new_entry->getEntry()->hasDrawable()); @@ -821,11 +825,16 @@ void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry { mImpl->mWaitingSet.insert(new_entry); } - else if(!old_entry || in_vo_tree) + + //process parent info + if(!old_parent_id && new_parent_id > 0) //becomes a child { - addToVOCacheTree(new_entry); + new_entry->clearChildrenList(); } - new_entry->setState(state); + new_entry->setParentID(new_parent_id); + + //update the object + gObjectList.processObjectUpdateFromCache(new_entry, this); } //physically delete the cache entry @@ -901,14 +910,17 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d return; } - if(drawablep->getParent()) //child object + if(entry->getParentID() > 0) //is a child { - LLViewerOctreeEntry* parent_oct_entry = drawablep->getParent()->getEntry(); - if(parent_oct_entry && parent_oct_entry->hasVOCacheEntry()) + LLVOCacheEntry* parent = getCacheEntry(entry->getParentID()); + if(parent) { - LLVOCacheEntry* parent = (LLVOCacheEntry*)parent_oct_entry->getVOCacheEntry(); parent->addChild(entry); } + else //parent is not in the cache, put into the orphan list. + { + mOrphanMap[entry->getParentID()].push_back(entry->getLocalID()); + } } else //insert to vo cache tree. { @@ -953,8 +965,12 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { return; } - - llassert_always(!entry->getParentID() && !entry->getEntry()->hasDrawable()); + if(entry->getParentID() > 0) + { + return; //no child prim in cache octree. + } + + llassert(!entry->getEntry()->hasDrawable()); mImpl->mVOCachePartition->addEntry(entry->getEntry()); } @@ -1264,7 +1280,12 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) } else { - llerrs << "Object is already created." << llendl; + //should not hit here any more, but does not hurt either, just put it back to active list + addActiveCacheEntry(entry); + + //object is already created, crash here for debug use. + llwarns << "Object is already created." << llendl; + llassert(!entry->getEntry()->hasDrawable()); } return obj; } @@ -1774,6 +1795,23 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(entry != NULL && !entry->getEntry()) { entry->setOctreeEntry(NULL); + + if(entry->getEntry()->hasDrawable()) //already in the rendering pipeline + { + addActiveCacheEntry(entry); + + //set parent id + U32 parent_id = 0; + LLViewerObject::unpackParentID(entry->getDP(), parent_id); + if(parent_id > 0) + { + entry->setParentID(parent_id); + } + + //update the object + gObjectList.processObjectUpdateFromCache(entry, this); + return; //done + } } else if(entry->getGroup() != NULL) { @@ -1805,8 +1843,8 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) } else { - mOrphanMap[parent_id].push_back(entry->getLocalID()); - } + mOrphanMap[parent_id].push_back(entry->getLocalID()); + } } else //parent in cache { @@ -1885,7 +1923,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB //if visible, update it if(!entry->isState(LLVOCacheEntry::INACTIVE)) { - replaceCacheEntry(entry, new_entry); + replaceVisibleCacheEntry(entry, new_entry); } else //invisible { -- cgit v1.2.3 From 92339583e6454bd6e769a6dcb0ad2eee31abfb1f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 21 Jun 2013 13:02:20 -0600 Subject: for SH-4241: viewer crash shortly after login in LLViewerRegion::addNewObject --- indra/newview/llviewerregion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a2fd440895..c3c791c158 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -992,7 +992,7 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) //add the visible entries void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) { - if(mDead || !entry) + if(mDead || !entry || !entry->getEntry()) { return; } -- cgit v1.2.3 From eb8d0bed7b8b068231efc6c0c30b719b4c171c7f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 24 Jun 2013 23:36:05 -0600 Subject: fix for SH-4264: interesting: Content near edges of screen does not load --- indra/newview/llviewerregion.cpp | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index dd4c7f2aff..d27b37d029 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -910,19 +910,19 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d return; } + bool is_orphan = false; + LLVOCacheEntry* parent = NULL; if(entry->getParentID() > 0) //is a child { - LLVOCacheEntry* parent = getCacheEntry(entry->getParentID()); - if(parent) - { - parent->addChild(entry); - } - else //parent is not in the cache, put into the orphan list. + parent = getCacheEntry(entry->getParentID()); + if(!parent) { + is_orphan = true; mOrphanMap[entry->getParentID()].push_back(entry->getLocalID()); } } - else //insert to vo cache tree. + + if(!is_orphan)//insert to vo cache tree. { //shift to the local regional space from agent space const LLVector3 pos = drawablep->getVObj()->getPositionRegion(); @@ -931,6 +931,11 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d shift.setSub(vec, entry->getPositionGroup()); entry->shift(shift); + if(parent) //is a child + { + entry->shift(parent->getPositionGroup()); + parent->addChild(entry); + } addToVOCacheTree(entry); } @@ -965,10 +970,6 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { return; } - if(entry->getParentID() > 0) - { - return; //no child prim in cache octree. - } llassert(!entry->getEntry()->hasDrawable()); @@ -1102,7 +1103,8 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) if(vo_entry->getParentID() > 0) //is a child { - //child visibility depends on its parent. + //child visibility depends on its parent, force its parent to be visible + addVisibleCacheEntry(getCacheEntry(vo_entry->getParentID())); continue; } @@ -1832,21 +1834,22 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) //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) + //2, parent is not in the cache or not probed, put into the orphan list. + if(!parent || !parent->getEntry()) { //check if parent is non-cacheable and already created - if(isNonCacheableObjectCreated(parent_id)) + if(!parent && isNonCacheableObjectCreated(parent_id)) { //parent is visible, so is the child. addVisibleCacheEntry(entry); } else { + entry->setBoundingInfo(pos, scale); mOrphanMap[parent_id].push_back(entry->getLocalID()); } } - else //parent in cache + else //parent in cache octree or probed { if(!parent->isState(LLVOCacheEntry::INACTIVE)) { @@ -1855,6 +1858,9 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) } else { + entry->setBoundingInfo(pos, scale); + entry->shift(parent->getPositionGroup()); + addToVOCacheTree(entry); parent->addChild(entry); } } @@ -1884,6 +1890,8 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); if(child) { + child->shift(entry->getPositionGroup()); + addToVOCacheTree(child); entry->addChild(child); } } -- cgit v1.2.3 From 2410b48c605e98c5380dd23bbd138e4516ae311d Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 1 Jul 2013 22:05:57 -0600 Subject: revert the changeset 54cf2fe4820a for SH-4264 to fix SH-4315: Interesting: Viewer crash on login on Mac in LLViewerRegion::updateVisibleEntries(float) and SH-4316: Interesting Viewer Crash/freeze on Login to Levy region on Aditi with cleared cache on Windows XP --- indra/newview/llviewerregion.cpp | 42 ++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 25 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d27b37d029..ca2a77c224 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -910,19 +910,19 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d return; } - bool is_orphan = false; - LLVOCacheEntry* parent = NULL; if(entry->getParentID() > 0) //is a child { - parent = getCacheEntry(entry->getParentID()); - if(!parent) + LLVOCacheEntry* parent = getCacheEntry(entry->getParentID()); + if(parent) + { + parent->addChild(entry); + } + else //parent not in cache. { - is_orphan = true; mOrphanMap[entry->getParentID()].push_back(entry->getLocalID()); } } - - if(!is_orphan)//insert to vo cache tree. + else //insert to vo cache tree. { //shift to the local regional space from agent space const LLVector3 pos = drawablep->getVObj()->getPositionRegion(); @@ -931,11 +931,6 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d shift.setSub(vec, entry->getPositionGroup()); entry->shift(shift); - if(parent) //is a child - { - entry->shift(parent->getPositionGroup()); - parent->addChild(entry); - } addToVOCacheTree(entry); } @@ -970,6 +965,10 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { return; } + if(entry->getParentID() > 0) + { + return; //no child prim in cache octree. + } llassert(!entry->getEntry()->hasDrawable()); @@ -1103,8 +1102,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) if(vo_entry->getParentID() > 0) //is a child { - //child visibility depends on its parent, force its parent to be visible - addVisibleCacheEntry(getCacheEntry(vo_entry->getParentID())); + //child visibility depends on its parent. continue; } @@ -1834,22 +1832,21 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) //1, find the parent in cache LLVOCacheEntry* parent = getCacheEntry(parent_id); - //2, parent is not in the cache or not probed, put into the orphan list. - if(!parent || !parent->getEntry()) + //2, parent is not in the cache, put into the orphan list. + if(!parent) { //check if parent is non-cacheable and already created - if(!parent && isNonCacheableObjectCreated(parent_id)) + if(isNonCacheableObjectCreated(parent_id)) { //parent is visible, so is the child. addVisibleCacheEntry(entry); } else { - entry->setBoundingInfo(pos, scale); - mOrphanMap[parent_id].push_back(entry->getLocalID()); + mOrphanMap[parent_id].push_back(entry->getLocalID()); } } - else //parent in cache octree or probed + else //parent in cache. { if(!parent->isState(LLVOCacheEntry::INACTIVE)) { @@ -1858,9 +1855,6 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) } else { - entry->setBoundingInfo(pos, scale); - entry->shift(parent->getPositionGroup()); - addToVOCacheTree(entry); parent->addChild(entry); } } @@ -1890,8 +1884,6 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); if(child) { - child->shift(entry->getPositionGroup()); - addToVOCacheTree(child); entry->addChild(child); } } -- cgit v1.2.3 From e88c469de6b0e800ad9a2c11467d948ad891bdd9 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 2 Jul 2013 17:48:19 -0600 Subject: fix for SH-4264: interesting: Content near edges of screen does not load --- indra/newview/llviewerregion.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index ca2a77c224..b80d87ef07 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -905,11 +905,21 @@ void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep) { - if(mDead) + if(mDead || !entry) { return; } + //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()); @@ -919,18 +929,13 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d } 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. - { - //shift to the local regional space from agent space - const LLVector3 pos = drawablep->getVObj()->getPositionRegion(); - LLVector4a vec(pos[0], pos[1], pos[2]); - LLVector4a shift; - shift.setSub(vec, entry->getPositionGroup()); - entry->shift(shift); - + { + entry->updateParentBoundingInfo(); addToVOCacheTree(entry); } @@ -1843,6 +1848,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) } else { + entry->setBoundingInfo(pos, scale); mOrphanMap[parent_id].push_back(entry->getLocalID()); } } @@ -1855,6 +1861,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) } else { + entry->setBoundingInfo(pos, scale); parent->addChild(entry); } } @@ -2055,7 +2062,7 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss { // Record a hit entry->recordHit(); - cache_miss_type = CACHE_MISS_TYPE_NONE; + cache_miss_type = CACHE_MISS_TYPE_NONE; entry->setUpdateFlags(flags); if(entry->isState(LLVOCacheEntry::ACTIVE)) @@ -2064,7 +2071,11 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss return true; } - if(entry->getGroup() || !entry->isState(LLVOCacheEntry::INACTIVE)) + if(entry->getGroup() || !entry->isState(LLVOCacheEntry::INACTIVE)) //already probed + { + return true; + } + if(entry->getParentID() > 0) //already probed { return true; } -- cgit v1.2.3 From 4cca9ba279f908f206fa5e32adccf1038f05cc7f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 29 Jul 2013 10:15:10 -0600 Subject: fix for SH-4293: texture console takes a while to settle down on Interesting viewer. --- indra/newview/llviewerregion.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b80d87ef07..cd8466d948 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -87,6 +87,7 @@ const F32 CAP_REQUEST_TIMEOUT = 18; const S32 MAX_CAP_REQUEST_ATTEMPTS = 30; BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; +S32 LLViewerRegion::sLastCameraUpdated = 0; typedef std::map CapabilityMap; @@ -992,6 +993,7 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) } mImpl->mVOCachePartition->removeEntry(entry->getEntry()); + entry->mLastCameraUpdated = sLastCameraUpdated; } //add the visible entries @@ -1219,7 +1221,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) iter = mImpl->mActiveSet.begin(); } - if(!(*iter)->isRecentlyVisible()) + if(!(*iter)->isRecentlyVisible() && (*iter)->mLastCameraUpdated != sLastCameraUpdated) { killObject((*iter), delete_list); } -- cgit v1.2.3 From a2e22732f195dc075a733c79f15156752f522a43 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 30 Jul 2013 19:13:45 -0700 Subject: Summer cleaning - removed a lot of llcommon dependencies to speed up build times consolidated most indra-specific constants in llcommon under indra_constants.h fixed issues with operations on mixed unit types (implicit and explicit) made LL_INFOS() style macros variadic in order to subsume other logging methods such as ll_infos added optional tag output to error recorders --- indra/newview/llviewerregion.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b80d87ef07..d4de33cc38 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -85,6 +85,7 @@ 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; @@ -229,7 +230,7 @@ public: 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) { @@ -242,12 +243,12 @@ public: 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; return ; } @@ -256,8 +257,7 @@ public: { 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()) @@ -1616,10 +1616,10 @@ public: S32 target_index = input["body"]["Index"][0]["Prey"].asInteger(); S32 you_index = input["body"]["Index"][0]["You" ].asInteger(); - LLDynamicArray* avatar_locs = ®ion->mMapAvatars; - LLDynamicArray* avatar_ids = ®ion->mMapAvatarIDs; - avatar_locs->reset(); - avatar_ids->reset(); + std::vector* avatar_locs = ®ion->mMapAvatars; + std::vector* 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; @@ -1659,13 +1659,13 @@ public: pos |= y; pos <<= 8; pos |= z; - avatar_locs->put(pos); + avatar_locs->push_back(pos); //llinfos << "next pos: " << x << "," << y << "," << z << ": " << pos << llendl; 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); + avatar_ids->push_back(agent_id); } } if (has_agent_data) @@ -1686,8 +1686,8 @@ LLHTTPRegistration 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. + 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; @@ -1736,10 +1736,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); } } } @@ -2468,7 +2468,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: @@ -2494,7 +2494,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; } } @@ -2510,7 +2510,7 @@ public: 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(); } @@ -2519,7 +2519,7 @@ public: 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 ; } @@ -2532,7 +2532,7 @@ private: 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); } } -- cgit v1.2.3 From 15fe4b3bbaf139960f934b629c236092182ed297 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 30 Jul 2013 22:05:12 -0600 Subject: fix for SH-4297: interesting: viewer-interesting starts loading cached scene late --- indra/newview/llviewerregion.cpp | 64 ++++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 16 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index cd8466d948..65e190a927 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -71,6 +71,7 @@ #include "llviewercontrol.h" #include "llsdserialize.h" #include "llvieweroctree.h" +#include "llviewerdisplay.h" #ifdef LL_WINDOWS #pragma warning(disable:4355) @@ -992,8 +993,7 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) return; } - mImpl->mVOCachePartition->removeEntry(entry->getEntry()); - entry->mLastCameraUpdated = sLastCameraUpdated; + mImpl->mVOCachePartition->removeEntry(entry->getEntry()); } //add the visible entries @@ -1128,7 +1128,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) return 2.0f * max_time - update_timer.getElapsedTimeF32(); } -F32 LLViewerRegion::createVisibleObjects(F32 max_time) +F32 LLViewerRegion::createVisibleObjects(F32 max_time, S32 throttle) { if(mDead) { @@ -1139,8 +1139,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) return max_time; } - LLTimer update_timer; - S32 max_num_objects = 64; //minimum number of new objects to be added + LLTimer update_timer; for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); iter != mImpl->mWaitingList.end(); ++iter) { @@ -1149,7 +1148,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); - if(max_num_objects-- < 0 && update_timer.getElapsedTimeF32() > max_time) + if(throttle > 0 && !(--throttle) && update_timer.getElapsedTimeF32() > max_time) { break; } @@ -1161,6 +1160,8 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) BOOL LLViewerRegion::idleUpdate(F32 max_update_time) { + static LLCachedControl new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle"); + LLTimer update_timer; // did_update returns TRUE if we did at least one significant update @@ -1171,23 +1172,54 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) // Hopefully not a significant time sink... mParcelOverlay->idleUpdate(); } + + if(!sVOCacheCullingEnabled) + { + return did_update; + } + if(mImpl->mCacheMap.empty()) + { + return did_update; + } + + max_update_time -= update_timer.getElapsedTimeF32(); - max_update_time -= update_timer.getElapsedTimeF32(); - if(max_update_time < 0.f || mImpl->mCacheMap.empty()) + //update the throttling number + static S32 throttle = new_object_creation_throttle; + if(LLStartUp::getStartupState() < STATE_STARTED || gTeleportDisplay) { - return did_update; -} + throttle = -1; //cancel the throttling - if(!sVOCacheCullingEnabled) + S32 occlusion = LLPipeline::sUseOcclusion; + LLPipeline::sUseOcclusion = 0; //disable occlusion + + //apply octree cullings here to pick up visible objects because rendering pipeline stops view culling at this moment + mImpl->mVOCachePartition->cull(*LLViewerCamera::getInstance()); + + LLPipeline::sUseOcclusion = occlusion; + } + else if(throttle < 0) //just recoved from the login/teleport screen + { + if(new_object_creation_throttle > 0) + { + throttle = 4096; //a big number + } + } + else + { + throttle = llmax((S32)new_object_creation_throttle, (S32)(throttle >> 1)); + } + + if(max_update_time < 0.f && throttle > 0 && throttle < new_object_creation_throttle * 2) { return did_update; } //kill invisible objects - max_update_time = killInvisibleObjects(max_update_time); + max_update_time = killInvisibleObjects(max_update_time, throttle); max_update_time = updateVisibleEntries(max_update_time); - createVisibleObjects(max_update_time); + createVisibleObjects(max_update_time, throttle); mImpl->mWaitingList.clear(); mImpl->mVisibleGroups.clear(); @@ -1195,7 +1227,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) return did_update; } -F32 LLViewerRegion::killInvisibleObjects(F32 max_time) +F32 LLViewerRegion::killInvisibleObjects(F32 max_time, S32 throttle) { #if 1 if(!sVOCacheCullingEnabled) @@ -1209,7 +1241,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) static LLVOCacheEntry* last_visited_entry = NULL; - const size_t MAX_UPDATE = 32; + const size_t MAX_UPDATE = throttle < 0 ? mImpl->mActiveSet.size() : 64; std::vector delete_list; S32 update_counter = llmin(MAX_UPDATE, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(last_visited_entry); @@ -1823,7 +1855,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) else if(entry->getGroup() != NULL) { return; //already in octree, no post processing. - } + } LLVector3 pos; LLVector3 scale; -- cgit v1.2.3 From 484f4230149e82345eccb38f9d4655b2a3f59984 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 31 Jul 2013 21:43:04 -0600 Subject: fix for SH-4393: Interesting: viewer crash in LLViewerRegion::addNewObject --- indra/newview/llviewerregion.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e28ea6f988..c55ccce47a 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1303,6 +1303,16 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) { + if(!entry || !entry->getEntry()) + { + 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 { -- cgit v1.2.3 From 576b9339977f50edb11a799d7a274610263f9fdc Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 5 Aug 2013 14:48:26 -0600 Subject: fix for SH-4397: Object cache occlusion culling results are not always correct --- indra/newview/llviewerregion.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c55ccce47a..47e59d3c00 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1183,6 +1183,9 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) } max_update_time -= update_timer.getElapsedTimeF32(); + + //reset all occluders + mImpl->mVOCachePartition->resetOccluders(); //update the throttling number static S32 throttle = new_object_creation_throttle; -- cgit v1.2.3 From be8d04c358086d6650fe7a8195949ba6c11096ae Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 6 Aug 2013 18:03:23 -0600 Subject: fix for SH-4398: Interesting: viewer crash in LLVOCacheEntry::updateParentBoundingInfo --- indra/newview/llviewerregion.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 47e59d3c00..49bb05d88e 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -866,8 +866,19 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry) //remove from the forced visible list mImpl->mVisibleEntries.erase(entry); - //kill LLViewerObject if exists - //this should be done by the rendering pipeline automatically. + //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)//disconnect children if has any + { + entry->removeAllChildren(); + } entry->setState(LLVOCacheEntry::INACTIVE); -- cgit v1.2.3 From a2c7b0485576c6bb92f6d0eddc762f5e37d5caac Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 7 Aug 2013 22:53:27 -0600 Subject: more fix for SH-4397: Object cache occlusion culling results are not always correct --- indra/newview/llviewerregion.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 49bb05d88e..117ccdea33 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1204,13 +1204,8 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) { throttle = -1; //cancel the throttling - S32 occlusion = LLPipeline::sUseOcclusion; - LLPipeline::sUseOcclusion = 0; //disable occlusion - //apply octree cullings here to pick up visible objects because rendering pipeline stops view culling at this moment - mImpl->mVOCachePartition->cull(*LLViewerCamera::getInstance()); - - LLPipeline::sUseOcclusion = occlusion; + mImpl->mVOCachePartition->cull(*LLViewerCamera::getInstance(), false); } else if(throttle < 0) //just recoved from the login/teleport screen { -- cgit v1.2.3 From a6711a894c3c32ad24b47e36b2a52225713fd3ed Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 8 Aug 2013 16:45:55 -0600 Subject: fix for SH-4402: interesting: lower FPS with lots of objects in view --- indra/newview/llviewerregion.cpp | 108 ++++++++++++++++++++++++--------------- 1 file changed, 68 insertions(+), 40 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 117ccdea33..cfe765a1cb 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -90,6 +90,7 @@ const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; S32 LLViewerRegion::sLastCameraUpdated = 0; +S32 LLViewerRegion::sNewObjectCreationThrottle = 0; typedef std::map CapabilityMap; @@ -372,7 +373,9 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mCapabilitiesReceived(false), mBitsReceived(0.f), mPacketsReceived(0.f), - mDead(FALSE) + mDead(FALSE), + mLastVisitedEntry(NULL), + mInvisibilityCheckHistory(-1) { mWidth = region_width_meters; mImpl->mOriginGlobal = from_region_handle(handle); @@ -968,6 +971,11 @@ void LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group) mImpl->mVisibleGroups.insert(group); } +U32 LLViewerRegion::getNumOfVisibleGroups() const +{ + return mImpl ? mImpl->mVisibleGroups.size() : 0; +} + void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { if(!sVOCacheCullingEnabled) @@ -1139,7 +1147,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) return 2.0f * max_time - update_timer.getElapsedTimeF32(); } -F32 LLViewerRegion::createVisibleObjects(F32 max_time, S32 throttle) +F32 LLViewerRegion::createVisibleObjects(F32 max_time) { if(mDead) { @@ -1150,6 +1158,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time, S32 throttle) return max_time; } + S32 throttle = sNewObjectCreationThrottle; LLTimer update_timer; for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); iter != mImpl->mWaitingList.end(); ++iter) @@ -1170,9 +1179,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time, S32 throttle) } BOOL LLViewerRegion::idleUpdate(F32 max_update_time) -{ - static LLCachedControl new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle"); - +{ LLTimer update_timer; // did_update returns TRUE if we did at least one significant update @@ -1191,44 +1198,28 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) if(mImpl->mCacheMap.empty()) { return did_update; - } - - max_update_time -= update_timer.getElapsedTimeF32(); + } //reset all occluders mImpl->mVOCachePartition->resetOccluders(); - //update the throttling number - static S32 throttle = new_object_creation_throttle; - if(LLStartUp::getStartupState() < STATE_STARTED || gTeleportDisplay) - { - throttle = -1; //cancel the throttling + max_update_time -= update_timer.getElapsedTimeF32(); + if(sNewObjectCreationThrottle < 0 && (LLStartUp::getStartupState() < STATE_STARTED || gTeleportDisplay)) + { //apply octree cullings here to pick up visible objects because rendering pipeline stops view culling at this moment mImpl->mVOCachePartition->cull(*LLViewerCamera::getInstance(), false); } - else if(throttle < 0) //just recoved from the login/teleport screen - { - if(new_object_creation_throttle > 0) - { - throttle = 4096; //a big number - } - } - else - { - throttle = llmax((S32)new_object_creation_throttle, (S32)(throttle >> 1)); - } - - if(max_update_time < 0.f && throttle > 0 && throttle < new_object_creation_throttle * 2) + else if(max_update_time < 0.f) { return did_update; } //kill invisible objects - max_update_time = killInvisibleObjects(max_update_time, throttle); + max_update_time = killInvisibleObjects(max_update_time); max_update_time = updateVisibleEntries(max_update_time); - createVisibleObjects(max_update_time, throttle); + createVisibleObjects(max_update_time); mImpl->mWaitingList.clear(); mImpl->mVisibleGroups.clear(); @@ -1236,7 +1227,35 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) return did_update; } -F32 LLViewerRegion::killInvisibleObjects(F32 max_time, S32 throttle) +//update the throttling number for new object creation +void LLViewerRegion::calcNewObjectCreationThrottle() +{ + static LLCachedControl new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle"); + + sNewObjectCreationThrottle = new_object_creation_throttle; + if(LLStartUp::getStartupState() < STATE_STARTED || gTeleportDisplay) + { + sNewObjectCreationThrottle = -1; //cancel the throttling + } + else if(sNewObjectCreationThrottle < 0) //just recoved from the login/teleport screen + { + if(new_object_creation_throttle > 0) + { + sNewObjectCreationThrottle = 4096; //a big number + } + } + else + { + sNewObjectCreationThrottle = llmax((S32)new_object_creation_throttle, (S32)(sNewObjectCreationThrottle >> 1)); + } +} + +BOOL LLViewerRegion::isViewerCameraStatic() +{ + return sLastCameraUpdated < LLViewerOctreeEntryData::getCurrentFrame(); +} + +F32 LLViewerRegion::killInvisibleObjects(F32 max_time) { #if 1 if(!sVOCacheCullingEnabled) @@ -1248,12 +1267,16 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time, S32 throttle) return max_time; } - static LLVOCacheEntry* last_visited_entry = NULL; - - const size_t MAX_UPDATE = throttle < 0 ? mImpl->mActiveSet.size() : 64; + size_t max_update = sNewObjectCreationThrottle < 0 ? mImpl->mActiveSet.size() : 64; + if(!mInvisibilityCheckHistory && isViewerCameraStatic()) + { + //history is clean, reduce number of checking + max_update = llmax(max_update / 2, (size_t)8); + } + std::vector delete_list; - S32 update_counter = llmin(MAX_UPDATE, mImpl->mActiveSet.size()); - LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(last_visited_entry); + 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) { @@ -1262,7 +1285,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time, S32 throttle) iter = mImpl->mActiveSet.begin(); } - if(!(*iter)->isRecentlyVisible() && (*iter)->mLastCameraUpdated != sLastCameraUpdated) + if(!(*iter)->isRecentlyVisible() && (*iter)->mLastCameraUpdated < sLastCameraUpdated) { killObject((*iter), delete_list); } @@ -1270,18 +1293,23 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time, S32 throttle) if(iter == mImpl->mActiveSet.end()) { - last_visited_entry = NULL; + mLastVisitedEntry = NULL; } else { - last_visited_entry = *iter; + mLastVisitedEntry = *iter; } - for(S32 i = 0; i < delete_list.size(); i++) + mInvisibilityCheckHistory <<= 2; + if(!delete_list.empty()) { - gObjectList.killObject(delete_list[i]->getVObj()); + mInvisibilityCheckHistory |= 1; + for(S32 i = 0; i < delete_list.size(); i++) + { + gObjectList.killObject(delete_list[i]->getVObj()); + } + delete_list.clear(); } - delete_list.clear(); #endif return max_time; } -- cgit v1.2.3 From 8d3daa141e9ea14f533559843d77ab5c0f715421 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 9 Aug 2013 16:14:19 -0700 Subject: SH-4374 FIX Interesting: Statistics Object cache hit rate is always 100% moved object cache sampling code so that it actually gets executed default values for stats are NaN instead of 0 in many cases --- indra/newview/llviewerregion.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e28ea6f988..34a9767fdf 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1985,6 +1985,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB // 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; -- cgit v1.2.3 From e340009fc59d59e59b2e8d903a884acb76b178eb Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 9 Aug 2013 17:11:19 -0700 Subject: second phase summer cleaning replace llinfos, lldebugs, etc with new LL_INFOS(), LL_DEBUGS(), etc. --- indra/newview/llviewerregion.cpp | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 34a9767fdf..3ad1c6ab0a 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -299,8 +299,8 @@ public: 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) @@ -314,17 +314,17 @@ public: for(iter = content.beginMap(); iter != content.endMap(); ++iter) { regionp->setCapabilityDebug(iter->first, iter->second); - //llinfos<<"BaseCapabilitiesCompleteTracker New Caps "<first<<" "<< iter->second<first<<" "<< iter->second<getRegionImpl()->mCapabilities.size() != regionp->getRegionImpl()->mSecondCapabilitiesTracker.size() ) { - llinfos<<"BaseCapabilitiesCompleteTracker "<<"Sim sent duplicate seed caps that differs in size - most likely content."<getRegionImpl()->mCapabilities.begin(); while (iter!=regionp->getRegionImpl()->mCapabilities.end() ) { - llinfos<<"BaseCapabilitiesCompleteTracker Original "<first<<" "<< iter->second<first<<" "<< iter->second<getEntry()->hasDrawable()); } return obj; @@ -1537,7 +1537,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 @@ -1655,9 +1655,9 @@ public: 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"], @@ -1694,11 +1694,11 @@ public: pos <<= 8; pos |= z; avatar_locs->push_back(pos); - //llinfos << "next pos: " << x << "," << y << "," << z << ": " << pos << llendl; + //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; + //LL_INFOS() << "next agent: " << agent_id.asString() << LL_ENDL; avatar_ids->push_back(agent_id); } } @@ -1719,7 +1719,7 @@ LLHTTPRegistration // the deprecated coarse location handler void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) { - //llinfos << "CoarseLocationUpdate" << llendl; + //LL_INFOS() << "CoarseLocationUpdate" << LL_ENDL; mMapAvatars.clear(); mMapAvatarIDs.clear(); // only matters in a rare case but it's good to be safe. @@ -1747,9 +1747,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) @@ -1800,7 +1800,7 @@ 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; } @@ -2120,14 +2120,14 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss } else { - // llinfos << "CRC miss for " << local_id << llendl; + // LL_INFOS() << "CRC miss for " << local_id << LL_ENDL; addCacheMiss(local_id, CACHE_MISS_TYPE_CRC); } } else { - // llinfos << "Cache miss for " << local_id << llendl; + // LL_INFOS() << "Cache miss for " << local_id << LL_ENDL; addCacheMiss(local_id, CACHE_MISS_TYPE_FULL); } @@ -2182,7 +2182,7 @@ void LLViewerRegion::requestCacheMisses() } mCacheDirty = TRUE ; - // llinfos << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << llendl; + // LL_INFOS() << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << LL_ENDL; LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size()); LLViewerStatsRecorder::instance().log(0.2f); @@ -2217,14 +2217,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; } } @@ -2464,7 +2464,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(); @@ -2483,7 +2483,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, @@ -2518,8 +2518,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, @@ -2620,7 +2620,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); @@ -2665,10 +2665,10 @@ 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) -- cgit v1.2.3 From a9c7cc486f4de721d42279263af33b272e15c830 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 14 Aug 2013 14:55:12 -0600 Subject: remove some code which has nagetive impact on memory footprint. --- indra/newview/llviewerregion.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index cfe765a1cb..5cdf43486e 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1205,12 +1205,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) max_update_time -= update_timer.getElapsedTimeF32(); - if(sNewObjectCreationThrottle < 0 && (LLStartUp::getStartupState() < STATE_STARTED || gTeleportDisplay)) - { - //apply octree cullings here to pick up visible objects because rendering pipeline stops view culling at this moment - mImpl->mVOCachePartition->cull(*LLViewerCamera::getInstance(), false); - } - else if(max_update_time < 0.f) + if(max_update_time < 0.f) { return did_update; } -- cgit v1.2.3 From 28151dd8367d558fa2622832eb3819624e19705d Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 16 Aug 2013 17:58:41 -0600 Subject: fix for SH-4297: interesting: viewer-interesting starts loading cached scene late --- indra/newview/llviewerregion.cpp | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 24c56df8db..ba0402344e 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -72,6 +72,8 @@ #include "llsdserialize.h" #include "llvieweroctree.h" #include "llviewerdisplay.h" +#include "llviewerwindow.h" +#include "llprogressview.h" #ifdef LL_WINDOWS #pragma warning(disable:4355) @@ -90,7 +92,7 @@ const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; S32 LLViewerRegion::sLastCameraUpdated = 0; -S32 LLViewerRegion::sNewObjectCreationThrottle = 0; +S32 LLViewerRegion::sNewObjectCreationThrottle = -1; typedef std::map CapabilityMap; @@ -1205,7 +1207,12 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) max_update_time -= update_timer.getElapsedTimeF32(); - if(max_update_time < 0.f) + if(gViewerWindow->getProgressView()->getVisible()) + { + //in case rendering pipeline is not started yet. + mImpl->mVOCachePartition->cull(*(LLViewerCamera::getInstance()), false); + } + else if(max_update_time < 0.f) { return did_update; } @@ -1226,23 +1233,28 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) void LLViewerRegion::calcNewObjectCreationThrottle() { static LLCachedControl new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle"); + 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 + // - sNewObjectCreationThrottle = new_object_creation_throttle; - if(LLStartUp::getStartupState() < STATE_STARTED || gTeleportDisplay) + if(gViewerWindow->getProgressView()->getVisible()) { - sNewObjectCreationThrottle = -1; //cancel the throttling + sNewObjectCreationThrottle = -2; //cancel the throttling + timer.reset(); } else if(sNewObjectCreationThrottle < 0) //just recoved from the login/teleport screen { - if(new_object_creation_throttle > 0) + if(new_object_creation_throttle > 0 && timer.getElapsedTimeF32() > 2.0f) //wait for two seconds to reset the throttle { - sNewObjectCreationThrottle = 4096; //a big number + sNewObjectCreationThrottle = new_object_creation_throttle; //reset } } - else - { - sNewObjectCreationThrottle = llmax((S32)new_object_creation_throttle, (S32)(sNewObjectCreationThrottle >> 1)); - } } BOOL LLViewerRegion::isViewerCameraStatic() @@ -1295,7 +1307,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) mLastVisitedEntry = *iter; } - mInvisibilityCheckHistory <<= 2; + mInvisibilityCheckHistory <<= 1; if(!delete_list.empty()) { mInvisibilityCheckHistory |= 1; -- cgit v1.2.3 From 612892b45a3413b16e40c49d3bfde77a4ca927fd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 18 Aug 2013 22:30:27 -0700 Subject: SH-4433 WIP: Interesting: Statistics > Ping Sim is always 0 ms continued conversion to units system made units perform type promotion correctly and preserve type in arithmetic e.g. can now do LLVector3 in units added typedefs for remaining common unit types, including implicits --- indra/newview/llviewerregion.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 24c56df8db..61a0ed098a 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -428,14 +428,14 @@ 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 } -- cgit v1.2.3 From 1751650dbcad4ea66b2c3779aa52960ec1640466 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 29 Aug 2013 13:14:56 -0600 Subject: add some debug settings for easier tuning up performance. --- indra/newview/llviewerregion.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index da01c0406a..9c038d54d5 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1233,6 +1233,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) void LLViewerRegion::calcNewObjectCreationThrottle() { static LLCachedControl new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle"); + static LLCachedControl throttle_delay_time(gSavedSettings,"NewObjectCreationThrottleDelayTime"); static LLFrameTimer timer; // @@ -1243,16 +1244,20 @@ void LLViewerRegion::calcNewObjectCreationThrottle() //>0: valid throttling number // - if(gViewerWindow->getProgressView()->getVisible()) + if(gViewerWindow->getProgressView()->getVisible() && throttle_delay_time > 0.f) { sNewObjectCreationThrottle = -2; //cancel the throttling timer.reset(); } - else if(sNewObjectCreationThrottle < 0) //just recoved from the login/teleport screen + else if(sNewObjectCreationThrottle < -1) //just recoved from the login/teleport screen { - if(new_object_creation_throttle > 0 && timer.getElapsedTimeF32() > 2.0f) //wait for two seconds to reset the throttle + 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; + } } } } @@ -1285,6 +1290,8 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); + LLVOCacheEntry::updateBackCullingFactors(); + for(; update_counter > 0; --update_counter, ++iter) { if(iter == mImpl->mActiveSet.end()) -- cgit v1.2.3 From a9d22b0f585cc90ba1bb94a68cc4175b3019b062 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 9 Sep 2013 11:58:52 -0600 Subject: some fix for SH-4416: Interesting: memory footprint is larger when loading from cache while ObjectCacheViewCullingEnabled is enabled than when it's disabled. --- indra/newview/llviewerregion.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 9c038d54d5..7cc4195a3d 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1207,12 +1207,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) max_update_time -= update_timer.getElapsedTimeF32(); - if(gViewerWindow->getProgressView()->getVisible()) - { - //in case rendering pipeline is not started yet. - mImpl->mVOCachePartition->cull(*(LLViewerCamera::getInstance()), false); - } - else if(max_update_time < 0.f) + if(max_update_time < 0.f && !gViewerWindow->getProgressView()->getVisible()) { return did_update; } @@ -1279,7 +1274,8 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) return max_time; } - size_t max_update = sNewObjectCreationThrottle < 0 ? mImpl->mActiveSet.size() : 64; + bool unstable = sNewObjectCreationThrottle < 0; + size_t max_update = unstable ? mImpl->mActiveSet.size() : 64; if(!mInvisibilityCheckHistory && isViewerCameraStatic()) { //history is clean, reduce number of checking @@ -1299,7 +1295,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) iter = mImpl->mActiveSet.begin(); } - if(!(*iter)->isRecentlyVisible() && (*iter)->mLastCameraUpdated < sLastCameraUpdated) + if(!(*iter)->isRecentlyVisible() && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated)) { killObject((*iter), delete_list); } -- cgit v1.2.3 From 19137ac8fcdc8783b317c967a222136b42ff3ed0 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 18 Sep 2013 15:48:52 -0600 Subject: fix for SH-4500: Interesting: Some content on adjacent region not visible after teleport. --- indra/newview/llviewerregion.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 7cc4195a3d..abead17d6f 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1056,9 +1056,6 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) bool needs_update = ((cur_frame - mImpl->mLastCameraUpdate) > 5) && ((camera_origin - mImpl->mLastCameraOrigin).lengthSquared() > 10.f); //process visible entries - max_time *= 0.5f; //only use up to half available time to update entries. - -#if 1 for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) { LLVOCacheEntry* vo_entry = *iter; @@ -1109,7 +1106,6 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) ++iter; } } -#endif //process visible groups std::set< LLPointer >::iterator group_iter = mImpl->mVisibleGroups.begin(); @@ -1146,7 +1142,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) mImpl->mLastCameraUpdate = cur_frame; } - return 2.0f * max_time - update_timer.getElapsedTimeF32(); + return max_time - update_timer.getElapsedTimeF32(); } F32 LLViewerRegion::createVisibleObjects(F32 max_time) @@ -1207,11 +1203,6 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) max_update_time -= update_timer.getElapsedTimeF32(); - if(max_update_time < 0.f && !gViewerWindow->getProgressView()->getVisible()) - { - return did_update; - } - //kill invisible objects max_update_time = killInvisibleObjects(max_update_time); @@ -1954,6 +1945,12 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) { 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); + } } } @@ -1963,11 +1960,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) // //no parent // - entry->setBoundingInfo(pos, scale); - if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) - { - addToVOCacheTree(entry); - } + entry->setBoundingInfo(pos, scale); if(!parent_id) //a potential parent { @@ -1990,6 +1983,10 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) } } + if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) + { + addToVOCacheTree(entry); + } return ; } -- cgit v1.2.3 From ba4f64ed7ad64deeed5f7109f33c796bae0c4423 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 20 Sep 2013 11:40:30 -0600 Subject: fix for SH-4430: Interesting: Light objects behind you are not loaded at login. --- indra/newview/llviewerregion.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index abead17d6f..985f5a0a1f 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -963,14 +963,16 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d entry->setState(LLVOCacheEntry::INACTIVE); } -void LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group) +bool LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group) { if(mDead || group->isEmpty()) { - return; + return false; } - group->setVisible(); + mImpl->mVisibleGroups.insert(group); + + return true; } U32 LLViewerRegion::getNumOfVisibleGroups() const -- cgit v1.2.3 From 456ff3949a28542ecd89ec23b0287b55a166529f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 25 Sep 2013 16:40:05 -0600 Subject: fix for SH-4295: Interesting: Teleporting to previous location leave some objects invisible. --- indra/newview/llviewerregion.cpp | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 985f5a0a1f..24f419b4b1 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1178,6 +1178,61 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) return max_time - update_timer.getElapsedTimeF32(); } +void LLViewerRegion::clearCachedVisibleObjects() +{ + mImpl->mWaitingList.clear(); + mImpl->mVisibleGroups.clear(); + + //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 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; +} + BOOL LLViewerRegion::idleUpdate(F32 max_update_time) { LLTimer update_timer; -- cgit v1.2.3 From 2fad2cc7365803b63bfe2466da2558182a1c25b9 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 26 Sep 2013 22:28:21 -0600 Subject: more optimization for memory footprint. --- indra/newview/llviewerregion.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 24f419b4b1..18232e75c9 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1303,6 +1303,9 @@ void LLViewerRegion::calcNewObjectCreationThrottle() } } } + + //update some LLVOCacheEntry debug setting factors. + LLVOCacheEntry::updateDebugSettings(); } BOOL LLViewerRegion::isViewerCameraStatic() @@ -1332,9 +1335,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) std::vector delete_list; S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); - LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); - - LLVOCacheEntry::updateBackCullingFactors(); + LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); for(; update_counter > 0; --update_counter, ++iter) { -- cgit v1.2.3 From a5a1b81af28b16406687df3550730a436155589f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 1 Oct 2013 10:56:30 -0600 Subject: fix for SH-4521: Interesting viewer crash in Pipeline:RenderDrawPools --- indra/newview/llviewerregion.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 18232e75c9..0c2c2365c7 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1183,6 +1183,9 @@ void LLViewerRegion::clearCachedVisibleObjects() mImpl->mWaitingList.clear(); mImpl->mVisibleGroups.clear(); + //reset all occluders + mImpl->mVOCachePartition->resetOccluders(); + //clean visible entries for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) { -- cgit v1.2.3 From eeb5fb6d35fbc1782dc927ce9fa7357d93b8cc54 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 3 Oct 2013 15:36:23 -0600 Subject: Make the region hand shake flag bit of empry cache independent. --- indra/newview/llviewerregion.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 99db71c2ee..6e9f649d23 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2483,11 +2483,11 @@ void LLViewerRegion::unpackRegionHandshake() 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. - } + 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); -- cgit v1.2.3 From c430673b95823f688c45d0fbda4198595bb41073 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 4 Oct 2013 17:54:24 -0600 Subject: more fix for SH-4521: Interesting viewer crash in Pipeline:RenderDrawPools --- indra/newview/llviewerregion.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 6e9f649d23..2ed7d59ec0 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -377,7 +377,8 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mPacketsReceived(0.f), mDead(FALSE), mLastVisitedEntry(NULL), - mInvisibilityCheckHistory(-1) + mInvisibilityCheckHistory(-1), + mPaused(FALSE) { mWidth = region_width_meters; mImpl->mOriginGlobal = from_region_handle(handle); @@ -1185,6 +1186,7 @@ void LLViewerRegion::clearCachedVisibleObjects() //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();) @@ -1257,9 +1259,13 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) { return did_update; } - + if(mPaused) + { + mPaused = FALSE; //unpause. + } + //reset all occluders - mImpl->mVOCachePartition->resetOccluders(); + mImpl->mVOCachePartition->resetOccluders(); max_update_time -= update_timer.getElapsedTimeF32(); -- cgit v1.2.3 From 17df8988fec3f2ba991ca9e34ff8148253a2fc04 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 7 Oct 2013 13:38:03 -0700 Subject: renamed TraceType to StatType added more MemTrackable types optimized memory usage of LLTrace some more --- indra/newview/llviewerregion.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 6e9f649d23..4b4de583d8 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -148,7 +148,7 @@ public: 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 > mVisibleGroups; //visible groupa + std::set< LLPointer > 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. @@ -963,7 +963,7 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d entry->setState(LLVOCacheEntry::INACTIVE); } -bool LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group) +bool LLViewerRegion::addVisibleGroup(LLViewerOctreeGroup* group) { if(mDead || group->isEmpty()) { @@ -1110,17 +1110,17 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) } //process visible groups - std::set< LLPointer >::iterator group_iter = mImpl->mVisibleGroups.begin(); + std::set< LLPointer >::iterator group_iter = mImpl->mVisibleGroups.begin(); for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter) { - LLPointer group = *group_iter; + LLPointer 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) + for (LLViewerOctreeGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { if((*i)->hasVOCacheEntry()) { -- cgit v1.2.3 From 82c93b52c5d4f31acb52f43b8e82a51ffa3ee584 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 16 Oct 2013 20:06:21 -0600 Subject: fix for SH-4552: Interesting: objects sometimes fail to load after teleport. --- indra/newview/llviewerregion.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index db91b5cd8b..b9c7ded50b 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2096,6 +2096,9 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB } else //invisible { + //copy some contents from old entry + entry->moveTo(new_entry); + //remove old entry killCacheEntry(entry); entry = new_entry; -- cgit v1.2.3 From 2b4dfefda216a0333426ac2a8f06d23ee6ef0aee Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 16 Oct 2013 20:59:13 -0600 Subject: more fix for SH-4552: Interesting: objects sometimes fail to load after teleport. --- indra/newview/llviewerregion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b9c7ded50b..0ad4402dcc 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2097,7 +2097,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB else //invisible { //copy some contents from old entry - entry->moveTo(new_entry); + entry->moveTo(new_entry, true); //remove old entry killCacheEntry(entry); -- cgit v1.2.3 From c8228b65f8a4a94220c92d89d1529ed484f6e84a Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 17 Oct 2013 20:21:17 -0600 Subject: fix for SH-4569: Objects are not culled by size in the distance --- indra/newview/llviewerregion.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0ad4402dcc..13a71b17cf 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1157,6 +1157,8 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) F32 LLViewerRegion::createVisibleObjects(F32 max_time) { + static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); + if(mDead) { return max_time; @@ -1166,6 +1168,11 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) return max_time; } + //object projected area threshold + F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); + F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; + projection_threshold *= projection_threshold; + S32 throttle = sNewObjectCreationThrottle; LLTimer update_timer; for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); @@ -1173,6 +1180,11 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) { LLVOCacheEntry* vo_entry = *iter; + if(vo_entry->getSceneContribution() < projection_threshold) + { + break; + } + if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); -- cgit v1.2.3 From 7bfacf8ca6c7bfdd9b11a2036a914c8f47058a61 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 18 Oct 2013 16:14:40 -0600 Subject: stop other cameras than the world camera to asscee object cache. --- indra/newview/llviewerregion.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 13a71b17cf..e73b4fb62c 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1165,6 +1165,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) } if(mImpl->mWaitingList.empty()) { + mImpl->mVOCachePartition->setCullHistory(FALSE); return max_time; } @@ -1174,6 +1175,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) projection_threshold *= projection_threshold; 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) @@ -1188,6 +1190,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); + has_new_obj = TRUE; if(throttle > 0 && !(--throttle) && update_timer.getElapsedTimeF32() > max_time) { break; @@ -1195,6 +1198,8 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) } } + mImpl->mVOCachePartition->setCullHistory(has_new_obj); + return max_time - update_timer.getElapsedTimeF32(); } -- cgit v1.2.3 From e0ace6d8690b2f60fb9b359f4840081957a3ff25 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 22 Oct 2013 16:07:41 -0600 Subject: fix for various object missing bugs: SH-4552, SH-4564, SH-4573, SH-4568 --- indra/newview/llviewerregion.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e73b4fb62c..d619a2af8b 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1061,15 +1061,19 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) LLTimer update_timer; + const F32 LARGE_SCENE_CONTRIBUTION = 100.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; //process visible entries for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) { LLVOCacheEntry* vo_entry = *iter; - vo_entry->calcSceneContribution(camera_origin, needs_update, mImpl->mLastCameraUpdate); + + //set a large number to force to load this object. + vo_entry->setSceneContribution(LARGE_SCENE_CONTRIBUTION); if(vo_entry->getState() < LLVOCacheEntry::WAITING) { @@ -1084,7 +1088,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) child = vo_entry->getChild(i); if(child->getState() < LLVOCacheEntry::WAITING) { - child->setSceneContribution(vo_entry->getSceneContribution()); + child->setSceneContribution(LARGE_SCENE_CONTRIBUTION); //a large number to force to load the child. mImpl->mWaitingList.insert(child); } else @@ -1140,7 +1144,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) continue; } - vo_entry->calcSceneContribution(camera_origin, needs_update, mImpl->mLastCameraUpdate); + vo_entry->calcSceneContribution(camera_origin, needs_update, last_update); mImpl->mWaitingList.insert(vo_entry); } } -- cgit v1.2.3 From bd8f98ff3d870e17893154ba0d9ecf7396899bec Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 24 Oct 2013 19:48:44 -0600 Subject: add throttle to number of pokes to potential visible objects per frame. --- indra/newview/llviewerregion.cpp | 61 +++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 17 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d619a2af8b..dee52abea7 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1049,6 +1049,8 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { + static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); + if(mDead) { return max_time; @@ -1059,8 +1061,27 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) return max_time; } + if(!sNewObjectCreationThrottle) + { + return max_time; + } + U32 new_obj_count = sNewObjectCreationThrottle; + if(sNewObjectCreationThrottle < 0) + { + new_obj_count = (U32)-1; //maximum + } + else + { + new_obj_count *= 1.5f; //load 50% more for selection + } + LLTimer update_timer; + //object projected area threshold + F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); + F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; + projection_threshold *= projection_threshold; + const F32 LARGE_SCENE_CONTRIBUTION = 100.f; //a large number to force to load the object. const LLVector3 camera_origin = LLViewerCamera::getInstance()->getOrigin(); const U32 cur_frame = LLViewerOctreeEntryData::getCurrentFrame(); @@ -1068,7 +1089,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) U32 last_update = mImpl->mLastCameraUpdate; //process visible entries - for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); new_obj_count > 0 && iter != mImpl->mVisibleEntries.end();) { LLVOCacheEntry* vo_entry = *iter; @@ -1078,6 +1099,10 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) if(vo_entry->getState() < LLVOCacheEntry::WAITING) { mImpl->mWaitingList.insert(vo_entry); + if(!(--new_obj_count)) + { + break; + } } LLVOCacheEntry* child; @@ -1090,6 +1115,11 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { child->setSceneContribution(LARGE_SCENE_CONTRIBUTION); //a large number to force to load the child. mImpl->mWaitingList.insert(child); + + if(!(--new_obj_count)) + { + break; + } } else { @@ -1123,7 +1153,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) //process visible groups std::set< LLPointer >::iterator group_iter = mImpl->mVisibleGroups.begin(); - for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter) + for(; new_obj_count > 0 && group_iter != mImpl->mVisibleGroups.end(); ++group_iter) { LLPointer group = *group_iter; if(group->getNumRefs() < 3 || //group to be deleted @@ -1145,7 +1175,16 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) } vo_entry->calcSceneContribution(camera_origin, needs_update, last_update); - mImpl->mWaitingList.insert(vo_entry); + + if(vo_entry->getSceneContribution() > projection_threshold) + { + mImpl->mWaitingList.insert(vo_entry); + + if(!(--new_obj_count)) + { + break; + } + } } } } @@ -1161,8 +1200,6 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) F32 LLViewerRegion::createVisibleObjects(F32 max_time) { - static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); - if(mDead) { return max_time; @@ -1171,12 +1208,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) { mImpl->mVOCachePartition->setCullHistory(FALSE); return max_time; - } - - //object projected area threshold - F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); - F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; - projection_threshold *= projection_threshold; + } S32 throttle = sNewObjectCreationThrottle; BOOL has_new_obj = FALSE; @@ -1184,12 +1216,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); iter != mImpl->mWaitingList.end(); ++iter) { - LLVOCacheEntry* vo_entry = *iter; - - if(vo_entry->getSceneContribution() < projection_threshold) - { - break; - } + LLVOCacheEntry* vo_entry = *iter; if(vo_entry->getState() < LLVOCacheEntry::WAITING) { -- cgit v1.2.3 From 0857eda4f68d10a3cf46ffe67d5739c0c6d25f76 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 25 Oct 2013 11:46:33 -0600 Subject: revert the changeset 71221dddea16: add throttle to number of pokes to potential visible objects per frame. --- indra/newview/llviewerregion.cpp | 52 ++++++++++++---------------------------- 1 file changed, 15 insertions(+), 37 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index dee52abea7..fdeb65e5a3 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1049,8 +1049,6 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { - static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); - if(mDead) { return max_time; @@ -1065,22 +1063,8 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { return max_time; } - U32 new_obj_count = sNewObjectCreationThrottle; - if(sNewObjectCreationThrottle < 0) - { - new_obj_count = (U32)-1; //maximum - } - else - { - new_obj_count *= 1.5f; //load 50% more for selection - } LLTimer update_timer; - - //object projected area threshold - F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); - F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; - projection_threshold *= projection_threshold; const F32 LARGE_SCENE_CONTRIBUTION = 100.f; //a large number to force to load the object. const LLVector3 camera_origin = LLViewerCamera::getInstance()->getOrigin(); @@ -1089,7 +1073,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) U32 last_update = mImpl->mLastCameraUpdate; //process visible entries - for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); new_obj_count > 0 && iter != mImpl->mVisibleEntries.end();) + for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) { LLVOCacheEntry* vo_entry = *iter; @@ -1099,10 +1083,6 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) if(vo_entry->getState() < LLVOCacheEntry::WAITING) { mImpl->mWaitingList.insert(vo_entry); - if(!(--new_obj_count)) - { - break; - } } LLVOCacheEntry* child; @@ -1115,11 +1095,6 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { child->setSceneContribution(LARGE_SCENE_CONTRIBUTION); //a large number to force to load the child. mImpl->mWaitingList.insert(child); - - if(!(--new_obj_count)) - { - break; - } } else { @@ -1153,7 +1128,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) //process visible groups std::set< LLPointer >::iterator group_iter = mImpl->mVisibleGroups.begin(); - for(; new_obj_count > 0 && group_iter != mImpl->mVisibleGroups.end(); ++group_iter) + for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter) { LLPointer group = *group_iter; if(group->getNumRefs() < 3 || //group to be deleted @@ -1175,16 +1150,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) } vo_entry->calcSceneContribution(camera_origin, needs_update, last_update); - - if(vo_entry->getSceneContribution() > projection_threshold) - { - mImpl->mWaitingList.insert(vo_entry); - - if(!(--new_obj_count)) - { - break; - } - } + mImpl->mWaitingList.insert(vo_entry); } } } @@ -1200,6 +1166,8 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) F32 LLViewerRegion::createVisibleObjects(F32 max_time) { + static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); + if(mDead) { return max_time; @@ -1210,6 +1178,11 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) return max_time; } + //object projected area threshold + F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); + F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; + projection_threshold *= projection_threshold; + S32 throttle = sNewObjectCreationThrottle; BOOL has_new_obj = FALSE; LLTimer update_timer; @@ -1218,6 +1191,11 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) { LLVOCacheEntry* vo_entry = *iter; + if(vo_entry->getSceneContribution() < projection_threshold) + { + break; + } + if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); -- cgit v1.2.3 From d9d696de388ab7ce0626a18ce461ce7e84b86793 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 25 Oct 2013 11:48:59 -0600 Subject: trivial: convert to unix endings. --- indra/newview/llviewerregion.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index fdeb65e5a3..23660dd3ce 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1178,9 +1178,9 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) return max_time; } - //object projected area threshold - F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); - F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; + //object projected area threshold + F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); + F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; projection_threshold *= projection_threshold; S32 throttle = sNewObjectCreationThrottle; @@ -1191,9 +1191,9 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) { LLVOCacheEntry* vo_entry = *iter; - if(vo_entry->getSceneContribution() < projection_threshold) - { - break; + if(vo_entry->getSceneContribution() < projection_threshold) + { + break; } if(vo_entry->getState() < LLVOCacheEntry::WAITING) -- cgit v1.2.3 From 787ff3937d697526284e8d0a812a7353ad916dea Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 30 Oct 2013 11:37:53 -0600 Subject: fix for SH-4584: Interesting: objectprojectionAreaCutOFF hides large objects on adjacent regions. --- indra/newview/llviewerregion.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 23660dd3ce..cbce2674a7 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1071,6 +1071,8 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) 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();) @@ -1149,7 +1151,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) continue; } - vo_entry->calcSceneContribution(camera_origin, needs_update, last_update); + vo_entry->calcSceneContribution(local_origin, needs_update, last_update); mImpl->mWaitingList.insert(vo_entry); } } -- cgit v1.2.3 From 960765e8c7d49a48e66f2e55e980c60645d9ca37 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 30 Oct 2013 23:17:40 -0600 Subject: more fix to reduce number of rendered triangles per frame. --- indra/newview/llviewerregion.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index cbce2674a7..a4b7efc56a 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1359,6 +1359,8 @@ BOOL LLViewerRegion::isViewerCameraStatic() F32 LLViewerRegion::killInvisibleObjects(F32 max_time) { + static LLCachedControl back_sphere_radius(gSavedSettings,"BackShpereCullingRadius"); + #if 1 if(!sVOCacheCullingEnabled) { @@ -1369,6 +1371,10 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) return max_time; } + LLVector4a camera_origin; + camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV); + F32 squared_back_threshold = back_sphere_radius * back_sphere_radius; + bool unstable = sNewObjectCreationThrottle < 0; size_t max_update = unstable ? mImpl->mActiveSet.size() : 64; if(!mInvisibilityCheckHistory && isViewerCameraStatic()) @@ -1388,7 +1394,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) iter = mImpl->mActiveSet.begin(); } - if(!(*iter)->isRecentlyVisible() && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated)) + if(!(*iter)->isAnyVisible(camera_origin, squared_back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated)) { killObject((*iter), delete_list); } @@ -1425,18 +1431,18 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& if(!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->isRecentlyVisible()) - { - //set the parent group visible if any of its children visible. - ((LLViewerOctreeEntryData*)drawablep)->setVisible(); - return; - } - } + //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->isRecentlyVisible()) + // { + // //set the parent group visible if any of its children visible. + // ((LLViewerOctreeEntryData*)drawablep)->setVisible(); + // return; + // } + //} delete_list.push_back(drawablep); } } -- cgit v1.2.3 From ccb921b287b14129918c07072f57078c69ca7e65 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 31 Oct 2013 15:10:10 -0600 Subject: more fix for performance regression. --- indra/newview/llviewerregion.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a4b7efc56a..b3837a41fe 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1299,6 +1299,9 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) mPaused = FALSE; //unpause. } + LLViewerCamera::eCameraID old_camera_id = LLViewerCamera::sCurCameraID; + LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; + //reset all occluders mImpl->mVOCachePartition->resetOccluders(); @@ -1313,6 +1316,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) mImpl->mWaitingList.clear(); mImpl->mVisibleGroups.clear(); + LLViewerCamera::sCurCameraID = old_camera_id; return did_update; } -- cgit v1.2.3 From fc6cd5954b94aa3b49a88b5d8192607c432cd54b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 31 Oct 2013 16:13:29 -0600 Subject: fix for SH-4599: Interesting: objects flicker between LODs while you alt-zoom and SH-4598: Interesting: objects near the edge of the screen flicker --- indra/newview/llviewerregion.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b3837a41fe..f549f6740d 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1435,18 +1435,22 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& if(!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->isRecentlyVisible()) - // { - // //set the parent group visible if any of its children visible. - // ((LLViewerOctreeEntryData*)drawablep)->setVisible(); - // return; - // } - //} + 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) + { + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)child->mDrawable->getGroup(); + if(group && group->isAnyRecentlyVisible()) + { + //set the parent group visible if any of its children visible. + ((LLViewerOctreeEntryData*)drawablep)->setVisible(); + return; + } + } + } delete_list.push_back(drawablep); } } -- cgit v1.2.3 From 0ce7008521b776451c0ce38299fa87c9e64c63cd Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 4 Nov 2013 16:41:06 -0700 Subject: fix for SH-4596: Interesting: MacBook Pro has worse framerate than on Release --- indra/newview/llviewerregion.cpp | 81 ++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 28 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index f549f6740d..fe420fe551 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1047,25 +1047,23 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) mImpl->mVisibleEntries.insert(entry); } -F32 LLViewerRegion::updateVisibleEntries(F32 max_time) +void LLViewerRegion::updateVisibleEntries(F32 max_time) { if(mDead) { - return max_time; + return; } if(mImpl->mVisibleGroups.empty() && mImpl->mVisibleEntries.empty()) { - return max_time; + return; } if(!sNewObjectCreationThrottle) { - return max_time; + return; } - LLTimer update_timer; - const F32 LARGE_SCENE_CONTRIBUTION = 100.f; //a large number to force to load the object. const LLVector3 camera_origin = LLViewerCamera::getInstance()->getOrigin(); const U32 cur_frame = LLViewerOctreeEntryData::getCurrentFrame(); @@ -1163,21 +1161,21 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) mImpl->mLastCameraUpdate = cur_frame; } - return max_time - update_timer.getElapsedTimeF32(); + return; } -F32 LLViewerRegion::createVisibleObjects(F32 max_time) +void LLViewerRegion::createVisibleObjects(F32 max_time) { static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); if(mDead) { - return max_time; + return; } if(mImpl->mWaitingList.empty()) { mImpl->mVOCachePartition->setCullHistory(FALSE); - return max_time; + return; } //object projected area threshold @@ -1211,7 +1209,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time) mImpl->mVOCachePartition->setCullHistory(has_new_obj); - return max_time - update_timer.getElapsedTimeF32(); + return; } void LLViewerRegion::clearCachedVisibleObjects() @@ -1273,12 +1271,31 @@ void LLViewerRegion::clearCachedVisibleObjects() return; } -BOOL LLViewerRegion::idleUpdate(F32 max_update_time) +//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; - // did_update returns TRUE if we did at least one significant update - BOOL did_update = mImpl->mLandp->idleUpdate(max_update_time); + mLastUpdate = LLViewerOctreeEntryData::getCurrentFrame(); + + mImpl->mLandp->idleUpdate(max_update_time); if (mParcelOverlay) { @@ -1288,11 +1305,11 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) if(!sVOCacheCullingEnabled) { - return did_update; + return; } if(mImpl->mCacheMap.empty()) { - return did_update; + return; } if(mPaused) { @@ -1305,19 +1322,22 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) //reset all occluders mImpl->mVOCachePartition->resetOccluders(); - max_update_time -= update_timer.getElapsedTimeF32(); + max_time = max_update_time - update_timer.getElapsedTimeF32(); //kill invisible objects - max_update_time = killInvisibleObjects(max_update_time); - - max_update_time = updateVisibleEntries(max_update_time); - createVisibleObjects(max_update_time); + 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 did_update; + return; } //update the throttling number for new object creation @@ -1361,20 +1381,20 @@ BOOL LLViewerRegion::isViewerCameraStatic() return sLastCameraUpdated < LLViewerOctreeEntryData::getCurrentFrame(); } -F32 LLViewerRegion::killInvisibleObjects(F32 max_time) +void LLViewerRegion::killInvisibleObjects(F32 max_time) { static LLCachedControl back_sphere_radius(gSavedSettings,"BackShpereCullingRadius"); -#if 1 if(!sVOCacheCullingEnabled) { - return max_time; + return; } if(mImpl->mActiveSet.empty()) { - return max_time; + return; } + LLTimer update_timer; LLVector4a camera_origin; camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV); F32 squared_back_threshold = back_sphere_radius * back_sphere_radius; @@ -1402,6 +1422,11 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) { killObject((*iter), delete_list); } + + if(max_time < update_timer.getElapsedTimeF32()) //time out + { + break; + } } if(iter == mImpl->mActiveSet.end()) @@ -1423,8 +1448,8 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) } delete_list.clear(); } -#endif - return max_time; + + return; } void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& delete_list) -- cgit v1.2.3 From 463a8930c8bddd8740478f6400561a48220ee584 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 6 Nov 2013 09:42:06 -0700 Subject: re-organize the code of processing the debug setting "ObjectProjectionAreaCutOff" --- indra/newview/llviewerregion.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index fe420fe551..56e0142dd6 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1166,8 +1166,6 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) void LLViewerRegion::createVisibleObjects(F32 max_time) { - static LLCachedControl projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF"); - if(mDead) { return; @@ -1179,10 +1177,8 @@ void LLViewerRegion::createVisibleObjects(F32 max_time) } //object projected area threshold - F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio(); - F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f; - projection_threshold *= projection_threshold; - + F32 projection_threshold = LLVOCacheEntry::getSquaredObjectScreenAreaThreshold(); + S32 throttle = sNewObjectCreationThrottle; BOOL has_new_obj = FALSE; LLTimer update_timer; -- cgit v1.2.3 From d71cafa4bcecb311bce626a15dd185e4750994ea Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 6 Nov 2013 20:05:28 -0800 Subject: final settings tweaks renamed BackShpereCullingRadius to BackSphereCullingRadius --- indra/newview/llviewerregion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 6ba620964b..8093ce523f 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1379,7 +1379,7 @@ BOOL LLViewerRegion::isViewerCameraStatic() void LLViewerRegion::killInvisibleObjects(F32 max_time) { - static LLCachedControl back_sphere_radius(gSavedSettings,"BackShpereCullingRadius"); + static LLCachedControl back_sphere_radius(gSavedSettings,"BackSphereCullingRadius"); if(!sVOCacheCullingEnabled) { -- cgit v1.2.3 From 83c2098fb99c4a4d33dfa5f4a71ab64ca39b547f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 11 Nov 2013 14:50:32 -0700 Subject: fix for SH-4607: Create new object cache tuning parameters --- indra/newview/llviewerregion.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 8093ce523f..afc00764b8 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1064,7 +1064,7 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) return; } - const F32 LARGE_SCENE_CONTRIBUTION = 100.f; //a large number to force to load the object. + 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); @@ -1126,7 +1126,11 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) } } + // //process visible groups + // + //object projected area threshold + F32 projection_threshold = LLVOCacheEntry::getSquaredPixelThreshold(mImpl->mVOCachePartition->isFrontCull()); std::set< LLPointer >::iterator group_iter = mImpl->mVisibleGroups.begin(); for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter) { @@ -1149,8 +1153,11 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) continue; } - vo_entry->calcSceneContribution(local_origin, needs_update, last_update); - mImpl->mWaitingList.insert(vo_entry); + vo_entry->calcSceneContribution(local_origin, needs_update, last_update); + if(vo_entry->getSceneContribution() > projection_threshold) + { + mImpl->mWaitingList.insert(vo_entry); + } } } } @@ -1175,9 +1182,6 @@ void LLViewerRegion::createVisibleObjects(F32 max_time) mImpl->mVOCachePartition->setCullHistory(FALSE); return; } - - //object projected area threshold - F32 projection_threshold = LLVOCacheEntry::getSquaredObjectScreenAreaThreshold(); S32 throttle = sNewObjectCreationThrottle; BOOL has_new_obj = FALSE; @@ -1187,11 +1191,6 @@ void LLViewerRegion::createVisibleObjects(F32 max_time) { LLVOCacheEntry* vo_entry = *iter; - if(vo_entry->getSceneContribution() < projection_threshold) - { - break; - } - if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); @@ -1379,8 +1378,6 @@ BOOL LLViewerRegion::isViewerCameraStatic() void LLViewerRegion::killInvisibleObjects(F32 max_time) { - static LLCachedControl back_sphere_radius(gSavedSettings,"BackSphereCullingRadius"); - if(!sVOCacheCullingEnabled) { return; @@ -1393,7 +1390,8 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) LLTimer update_timer; LLVector4a camera_origin; camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV); - F32 squared_back_threshold = back_sphere_radius * back_sphere_radius; + F32 squared_back_threshold = LLVOCacheEntry::sRearFarRadius; + squared_back_threshold *= squared_back_threshold; bool unstable = sNewObjectCreationThrottle < 0; size_t max_update = unstable ? mImpl->mActiveSet.size() : 64; -- cgit v1.2.3 From 58ee2a30ce5fb83186392693c7b014aa667e02cf Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 13 Nov 2013 09:40:48 -0700 Subject: more fix for SH-4607: Create new object cache tuning parameters --- indra/newview/llviewerregion.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index afc00764b8..06f9af8751 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1131,6 +1131,8 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) // //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 >::iterator group_iter = mImpl->mVisibleGroups.begin(); for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter) { @@ -1153,7 +1155,7 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) continue; } - vo_entry->calcSceneContribution(local_origin, needs_update, last_update); + vo_entry->calcSceneContribution(local_origin, needs_update, last_update, dist_threshold); if(vo_entry->getSceneContribution() > projection_threshold) { mImpl->mWaitingList.insert(vo_entry); @@ -1389,10 +1391,9 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) LLTimer update_timer; LLVector4a camera_origin; - camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV); - F32 squared_back_threshold = LLVOCacheEntry::sRearFarRadius; - squared_back_threshold *= squared_back_threshold; - + camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV); + F32 back_threshold = LLVOCacheEntry::sRearFarRadius; + bool unstable = sNewObjectCreationThrottle < 0; size_t max_update = unstable ? mImpl->mActiveSet.size() : 64; if(!mInvisibilityCheckHistory && isViewerCameraStatic()) @@ -1411,8 +1412,12 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) { iter = mImpl->mActiveSet.begin(); } + if((*iter)->getParentID() > 0) + { + continue; //skip child objects, they are removed with their parent. + } - if(!(*iter)->isAnyVisible(camera_origin, squared_back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated)) + if(!(*iter)->isAnyVisible(camera_origin, back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated)) { killObject((*iter), delete_list); } -- cgit v1.2.3 From 58b153cf878370643bd61914538a80e6512c7e5c Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 13 Nov 2013 09:51:01 -0700 Subject: fix for SH-4608: Interesting: minimap shows objects loading/uinloading behind your camera when camera is rotated --- indra/newview/llviewerregion.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 06f9af8751..07a470e3bc 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -962,6 +962,7 @@ void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* d else //insert to vo cache tree. { entry->updateParentBoundingInfo(); + entry->saveBoundingSphere(); addToVOCacheTree(entry); } @@ -1391,7 +1392,9 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) LLTimer update_timer; LLVector4a camera_origin; - camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV); + camera_origin.load3(LLViewerCamera::getInstance()->getOrigin().mV); + LLVector4a local_origin; + local_origin.load3((LLViewerCamera::getInstance()->getOrigin() - getOriginAgent()).mV); F32 back_threshold = LLVOCacheEntry::sRearFarRadius; bool unstable = sNewObjectCreationThrottle < 0; @@ -1417,7 +1420,7 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) continue; //skip child objects, they are removed with their parent. } - if(!(*iter)->isAnyVisible(camera_origin, back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated)) + if(!(*iter)->isAnyVisible(camera_origin, local_origin, back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated)) { killObject((*iter), delete_list); } -- cgit v1.2.3 From d41110de20f17f56c0b7b4e62ddfa930cc707ecc Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 14 Nov 2013 11:08:31 -0700 Subject: avoid objects invisiblity checking during login. --- indra/newview/llviewerregion.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index f58eeb7e0b..e3ebd2fc2a 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1383,6 +1383,10 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) { return; } + if(sNewObjectCreationThrottle < 0) + { + return; + } LLTimer update_timer; LLVector4a camera_origin; @@ -1391,12 +1395,11 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) local_origin.load3((LLViewerCamera::getInstance()->getOrigin() - getOriginAgent()).mV); F32 back_threshold = LLVOCacheEntry::sRearFarRadius; - bool unstable = sNewObjectCreationThrottle < 0; - size_t max_update = unstable ? mImpl->mActiveSet.size() : 64; + size_t max_update = 64; if(!mInvisibilityCheckHistory && isViewerCameraStatic()) { //history is clean, reduce number of checking - max_update = llmax(max_update / 2, (size_t)8); + max_update /= 2; } std::vector delete_list; @@ -1414,7 +1417,7 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) continue; //skip child objects, they are removed with their parent. } - if(!(*iter)->isAnyVisible(camera_origin, local_origin, back_threshold) && (unstable || (*iter)->mLastCameraUpdated < sLastCameraUpdated)) + if(!(*iter)->isAnyVisible(camera_origin, local_origin, back_threshold) && (*iter)->mLastCameraUpdated < sLastCameraUpdated) { killObject((*iter), delete_list); } -- cgit v1.2.3 From 4d70e20ede4ad404bf8ddeca2effb1171b471bcc Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 19 Nov 2013 19:33:28 -0700 Subject: fix for SH-4629: Interesting: crash at LLViewerRegion::killObject --- indra/newview/llviewerregion.cpp | 42 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e3ebd2fc2a..f71d0a7a64 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -923,6 +923,21 @@ void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) mImpl->mActiveSet.insert(entry); } +//remove vo entry which is in mImpl->mActiveSet but not in rendering pipeline. +//this is caused by mImpl->mActiveSet failing to remove this entry somehow. +void LLViewerRegion::removeDanglingEntry(LLVOCacheEntry* entry) +{ + if(mDead || !entry) + { + return; + } + + mImpl->mVisibleEntries.erase(entry); + mImpl->mActiveSet.erase(entry); + mImpl->mWaitingSet.erase(entry); + entry->setState(LLVOCacheEntry::INACTIVE); +} + void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep) { if(mDead || !entry) @@ -1403,6 +1418,8 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) } std::vector delete_list; + std::vector dangling_list; + S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); @@ -1417,9 +1434,17 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) continue; //skip child objects, they are removed with their parent. } - if(!(*iter)->isAnyVisible(camera_origin, local_origin, back_threshold) && (*iter)->mLastCameraUpdated < sLastCameraUpdated) + LLVOCacheEntry* vo_entry = *iter; + if(!vo_entry->getEntry() || !vo_entry->getEntry()->getDrawable()) + { + //sometimes mImpl->mActiveSet fails to erase some entry, causing this dangling case. + dangling_list.push_back(vo_entry); + continue; + } + + if(!vo_entry->isAnyVisible(camera_origin, local_origin, back_threshold) && vo_entry->mLastCameraUpdated < sLastCameraUpdated) { - killObject((*iter), delete_list); + killObject(vo_entry, delete_list); } if(max_time < update_timer.getElapsedTimeF32()) //time out @@ -1441,13 +1466,22 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) if(!delete_list.empty()) { mInvisibilityCheckHistory |= 1; - for(S32 i = 0; i < delete_list.size(); i++) + S32 count = delete_list.size(); + for(S32 i = 0; i < count; i++) { gObjectList.killObject(delete_list[i]->getVObj()); } delete_list.clear(); } + if(!dangling_list.empty()) + { + for(S32 i = 0; i < dangling_list.size(); i++) + { + removeDanglingEntry(dangling_list[i]); + } + } + return; } @@ -1457,7 +1491,7 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable(); llassert(drawablep); - if(!drawablep->getParent()) + 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(); -- cgit v1.2.3 From 5979467198e9a8d4c065de908cf48c7d73101cd7 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 20 Nov 2013 11:43:09 -0700 Subject: revert changeset 05606ef22574: fix for SH-4629: Interesting: crash at LLViewerRegion::killObject --- indra/newview/llviewerregion.cpp | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index f71d0a7a64..2eb065c1ef 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -923,21 +923,6 @@ void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) mImpl->mActiveSet.insert(entry); } -//remove vo entry which is in mImpl->mActiveSet but not in rendering pipeline. -//this is caused by mImpl->mActiveSet failing to remove this entry somehow. -void LLViewerRegion::removeDanglingEntry(LLVOCacheEntry* entry) -{ - if(mDead || !entry) - { - return; - } - - mImpl->mVisibleEntries.erase(entry); - mImpl->mActiveSet.erase(entry); - mImpl->mWaitingSet.erase(entry); - entry->setState(LLVOCacheEntry::INACTIVE); -} - void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep) { if(mDead || !entry) @@ -1418,8 +1403,6 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) } std::vector delete_list; - std::vector dangling_list; - S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); @@ -1435,13 +1418,6 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) } LLVOCacheEntry* vo_entry = *iter; - if(!vo_entry->getEntry() || !vo_entry->getEntry()->getDrawable()) - { - //sometimes mImpl->mActiveSet fails to erase some entry, causing this dangling case. - dangling_list.push_back(vo_entry); - continue; - } - if(!vo_entry->isAnyVisible(camera_origin, local_origin, back_threshold) && vo_entry->mLastCameraUpdated < sLastCameraUpdated) { killObject(vo_entry, delete_list); @@ -1474,14 +1450,6 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) delete_list.clear(); } - if(!dangling_list.empty()) - { - for(S32 i = 0; i < dangling_list.size(); i++) - { - removeDanglingEntry(dangling_list[i]); - } - } - return; } -- cgit v1.2.3 From c14ecc817895d06b04a803a88d00d4ae1c80060a Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 21 Nov 2013 11:20:45 -0700 Subject: fix for SH-4629: Interesting: crash at LLViewerRegion::killObject --- indra/newview/llviewerregion.cpp | 72 +++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 27 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 2eb065c1ef..f1ac4328e4 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -847,7 +847,7 @@ void LLViewerRegion::replaceVisibleCacheEntry(LLVOCacheEntry* old_entry, LLVOCac } //physically delete the cache entry -void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry) +void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool kill_obj) { if(!entry) { @@ -857,6 +857,14 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry) //remove from active list and waiting list if(entry->isState(LLVOCacheEntry::ACTIVE)) { + if(kill_obj && entry->getEntry()) + { + LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable(); + if(drawablep) + { + gObjectList.killObject(drawablep->getVObj()); + } + } mImpl->mActiveSet.erase(entry); } else @@ -887,16 +895,19 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry) entry->removeAllChildren(); } - entry->setState(LLVOCacheEntry::INACTIVE); - + if(kill_obj) + { + entry->setState(LLVOCacheEntry::INACTIVE); + } + //remove from mCacheMap, real deletion mImpl->mCacheMap.erase(entry->getLocalID()); } //physically delete the cache entry -void LLViewerRegion::killCacheEntry(U32 local_id) +void LLViewerRegion::killCacheEntry(U32 local_id, bool kill_obj) { - killCacheEntry(getCacheEntry(local_id)); + killCacheEntry(getCacheEntry(local_id), kill_obj); } U32 LLViewerRegion::getNumOfActiveCachedObjects() const @@ -1458,6 +1469,7 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& //kill the object. LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable(); llassert(drawablep); + llassert(drawablep->getRegion() == this); if(drawablep && !drawablep->getParent()) { @@ -1509,12 +1521,21 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) } else { + 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); - - //object is already created, crash here for debug use. - LL_WARNS() << "Object is already created." << LL_ENDL; - llassert(!entry->getEntry()->hasDrawable()); } return obj; } @@ -2027,6 +2048,20 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) 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(), false); + + //change region + obj->setRegion(this); + } + } + addActiveCacheEntry(entry); //set parent id @@ -2173,7 +2208,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB mImpl->mCacheMap[local_id] = entry; decodeBoundingInfo(entry); - } + } result = CACHE_UPDATE_CHANGED; } @@ -2199,23 +2234,6 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec { eCacheUpdateResult result = cacheFullUpdate(dp, flags); -#if 0 - LLVOCacheEntry* entry = mImpl->mCacheMap[objectp->getLocalID()]; - if(!entry) - { - return result; - } - - if(objectp->mDrawable.notNull() && !entry->getEntry()) - { - entry->setOctreeEntry(objectp->mDrawable->getEntry()); - } - if(entry->getEntry() && entry->getEntry()->hasDrawable() && entry->isState(LLVOCacheEntry::INACTIVE)) - { - addActiveCacheEntry(entry); - } -#endif - return result; } -- cgit v1.2.3 From fbd0d85e547ccef688fb0a5dcfbb8a442de25f45 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 21 Nov 2013 17:35:41 -0700 Subject: fix for SH-4633: Idle avatars intermittently vanish from the scene after camming away, and returning to a location. --- indra/newview/llviewerregion.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index f1ac4328e4..bcb7943d7f 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1480,10 +1480,18 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector& 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 group visible if any of its children visible. + //set the parent visible if any of its children visible. ((LLViewerOctreeEntryData*)drawablep)->setVisible(); return; } -- cgit v1.2.3 From 04aece3282025ed0f117a9ade96edc0bf906b3cf Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 22 Nov 2013 20:55:57 -0700 Subject: fix for SH-4635: Interesting: Some objects do not load on the second visit --- indra/newview/llviewerregion.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index bcb7943d7f..939c6dbed1 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -847,7 +847,7 @@ void LLViewerRegion::replaceVisibleCacheEntry(LLVOCacheEntry* old_entry, LLVOCac } //physically delete the cache entry -void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool kill_obj) +void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry) { if(!entry) { @@ -857,14 +857,6 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool kill_obj) //remove from active list and waiting list if(entry->isState(LLVOCacheEntry::ACTIVE)) { - if(kill_obj && entry->getEntry()) - { - LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable(); - if(drawablep) - { - gObjectList.killObject(drawablep->getVObj()); - } - } mImpl->mActiveSet.erase(entry); } else @@ -894,20 +886,15 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool kill_obj) { entry->removeAllChildren(); } - - if(kill_obj) - { - entry->setState(LLVOCacheEntry::INACTIVE); - } //remove from mCacheMap, real deletion mImpl->mCacheMap.erase(entry->getLocalID()); } //physically delete the cache entry -void LLViewerRegion::killCacheEntry(U32 local_id, bool kill_obj) +void LLViewerRegion::killCacheEntry(U32 local_id) { - killCacheEntry(getCacheEntry(local_id), kill_obj); + killCacheEntry(getCacheEntry(local_id)); } U32 LLViewerRegion::getNumOfActiveCachedObjects() const @@ -2063,7 +2050,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(obj) { //remove from old region - old_regionp->killCacheEntry(obj->getLocalID(), false); + old_regionp->killCacheEntry(obj->getLocalID()); //change region obj->setRegion(this); -- cgit v1.2.3 From 4a3e01f8dc1e8cf38183c9be564c7f4fa5dd49d3 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 4 Dec 2013 12:36:28 -0700 Subject: fix for SH-4631: Parts of linked objects are not shown in new release Second Life 3.6.11 --- indra/newview/llviewerregion.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 939c6dbed1..57938f8490 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1535,9 +1535,15 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) return obj; } -//remove from object cache if the object receives a full-update or terse update -LLViewerObject* LLViewerRegion::forceToRemoveFromCache(U32 local_id, LLViewerObject* objectp) +//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) { + if(objectp && update_type != (U32)OUT_TERSE_IMPROVED) + { + return objectp; //no need to access cache + } + LLVOCacheEntry* entry = getCacheEntry(local_id); if (!entry) { @@ -1545,14 +1551,15 @@ LLViewerObject* LLViewerRegion::forceToRemoveFromCache(U32 local_id, LLViewerObj } if(!objectp) //object not created { - entry->setTouched(FALSE); //mark this entry invalid - - //create a new object before delete it from cache. + //create a new object from cache. objectp = gObjectList.processObjectUpdateFromCache(entry, this); } - //remove from cache. - killCacheEntry(entry); + //remove from cache if terse update + if(update_type == (U32)OUT_TERSE_IMPROVED) + { + killCacheEntry(entry); + } return objectp; } -- cgit v1.2.3 From 24a2ba735540f896bb84dfdbaff8644b1d60044b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 5 Dec 2013 17:41:29 -0700 Subject: fix for SH-4631: Parts of linked objects are not shown in new release Second Life 3.6.11 --- indra/newview/llviewerregion.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c3cdfa2901..f9689c7473 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -847,13 +847,18 @@ void LLViewerRegion::replaceVisibleCacheEntry(LLVOCacheEntry* old_entry, LLVOCac } //physically delete the cache entry -void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry) +void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) { if(!entry) { 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)) { @@ -882,9 +887,20 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry) parent->removeChild(entry); } } - else if(entry->getNumOfChildren() > 0)//disconnect children if has any + else if(entry->getNumOfChildren() > 0)//remove children from cache if has any { - entry->removeAllChildren(); + S32 num_child = entry->getNumOfChildren(); + + LLVOCacheEntry* child; + for(S32 i = 0; i < num_child; i++) + { + child = entry->getChild(i); + if(child) + { + child->setParentID(0); //disconnect from parent + killCacheEntry(child, for_rendering); + } + } } //remove from mCacheMap, real deletion @@ -1552,13 +1568,13 @@ LLViewerObject* LLViewerRegion::updateCacheEntry(U32 local_id, LLViewerObject* o if(!objectp) //object not created { //create a new object from cache. - objectp = gObjectList.processObjectUpdateFromCache(entry, this); + objectp = addNewObject(entry); } //remove from cache if terse update if(update_type == (U32)OUT_TERSE_IMPROVED) { - killCacheEntry(entry); + killCacheEntry(entry, true); } return objectp; -- cgit v1.2.3 From 10ae6a779e6726da24acb0ae60bb8f430daf9bdb Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 6 Jan 2014 12:28:36 -0700 Subject: fix for SH-4656: crash at LLVOCacheEntry::updateParentBoundingInfo() line 510 --- indra/newview/llviewerregion.cpp | 328 ++++++++++++++++++--------------------- 1 file changed, 148 insertions(+), 180 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index f9689c7473..ae4306847c 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -806,50 +806,10 @@ void LLViewerRegion::dirtyHeights() } } -void LLViewerRegion::replaceVisibleCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry) -{ - //save old entry - old_entry->moveTo(new_entry); - U32 state = old_entry->getState(); - U32 old_parent_id = old_entry->getParentID(); - - //kill old entry - killCacheEntry(old_entry); - - //parse new entry - U32 new_parent_id = 0; - LLViewerObject::unpackParentID(new_entry->getDP(), new_parent_id); - - //store new entry - mImpl->mCacheMap[new_entry->getLocalID()] = new_entry; - - //process entry state - new_entry->setState(state); - if(state == LLVOCacheEntry::ACTIVE) - { - llassert(new_entry->getEntry()->hasDrawable()); - mImpl->mActiveSet.insert(new_entry); - } - else if(state == LLVOCacheEntry::WAITING) - { - mImpl->mWaitingSet.insert(new_entry); - } - - //process parent info - if(!old_parent_id && new_parent_id > 0) //becomes a child - { - new_entry->clearChildrenList(); - } - new_entry->setParentID(new_parent_id); - - //update the object - gObjectList.processObjectUpdateFromCache(new_entry, this); -} - //physically delete the cache entry void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) { - if(!entry) + if(!entry || !entry->isValid()) { return; } @@ -889,22 +849,18 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) } else if(entry->getNumOfChildren() > 0)//remove children from cache if has any { - S32 num_child = entry->getNumOfChildren(); - - LLVOCacheEntry* child; - for(S32 i = 0; i < num_child; i++) + LLVOCacheEntry* child = entry->getChild(); + while(child != NULL) { - child = entry->getChild(i); - if(child) - { - child->setParentID(0); //disconnect from parent - killCacheEntry(child, for_rendering); - } + killCacheEntry(child, for_rendering); + child = entry->getChild(); } } - //remove from mCacheMap, real deletion - mImpl->mCacheMap.erase(entry->getLocalID()); + //will remove it from the object cache, real deletion + entry->setState(LLVOCacheEntry::INACTIVE); + entry->removeOctreeEntry(); + entry->setValid(FALSE); } //physically delete the cache entry @@ -924,6 +880,10 @@ void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) { return; } + if(entry->isState(LLVOCacheEntry::ACTIVE)) + { + return; //already inserted. + } if(entry->isState(LLVOCacheEntry::WAITING)) { @@ -939,10 +899,14 @@ void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) void LLViewerRegion::removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep) { - if(mDead || !entry) + 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()) @@ -1004,11 +968,7 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) return; } - if(mDead || !entry || !entry->getEntry()) - { - return; - } - if(entry->getGroup()) //already in octree. + if(mDead || !entry || !entry->getEntry() || !entry->isValid()) { return; } @@ -1017,7 +977,14 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) return; //no child prim in cache octree. } - llassert(!entry->getEntry()->hasDrawable()); + if(entry->hasState(LLVOCacheEntry::IN_VO_TREE)) + { + return; //already in the tree. + } + entry->setState(LLVOCacheEntry::IN_VO_TREE); + + llassert_always(!entry->getGroup()); //not in octree. + llassert(!entry->getEntry()->hasDrawable()); //not have drawables mImpl->mVOCachePartition->addEntry(entry->getEntry()); } @@ -1028,10 +995,12 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) { return; } - if(!entry->getGroup()) + + if(!entry->hasState(LLVOCacheEntry::IN_VO_TREE)) { - return; + return; //not in the tree. } + entry->clearState(LLVOCacheEntry::IN_VO_TREE); mImpl->mVOCachePartition->removeEntry(entry->getEntry()); } @@ -1039,7 +1008,7 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) //add the visible entries void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) { - if(mDead || !entry || !entry->getEntry()) + if(mDead || !entry || !entry->getEntry() || !entry->isValid()) { return; } @@ -1053,7 +1022,22 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) { entry->setState(LLVOCacheEntry::IN_QUEUE); } - mImpl->mVisibleEntries.insert(entry); + + if(!entry->isState(LLVOCacheEntry::ACTIVE)) + { + mImpl->mVisibleEntries.insert(entry); + } + + //add all children + if(entry->getNumOfChildren() > 0) + { + LLVOCacheEntry* child = entry->getChild(); + while(child != NULL) + { + addVisibleCacheEntry(child); + child = entry->getChild(); + } + } } void LLViewerRegion::updateVisibleEntries(F32 max_time) @@ -1085,53 +1069,18 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) { LLVOCacheEntry* vo_entry = *iter; - - //set a large number to force to load this object. - vo_entry->setSceneContribution(LARGE_SCENE_CONTRIBUTION); - - if(vo_entry->getState() < LLVOCacheEntry::WAITING) - { - mImpl->mWaitingList.insert(vo_entry); - } - - LLVOCacheEntry* child; - S32 num_child = vo_entry->getNumOfChildren(); - S32 num_done = 0; - for(S32 i = 0; i < num_child; i++) - { - child = vo_entry->getChild(i); - if(child->getState() < LLVOCacheEntry::WAITING) - { - child->setSceneContribution(LARGE_SCENE_CONTRIBUTION); //a large number to force to load the child. - mImpl->mWaitingList.insert(child); - } - else - { - num_done++; - } - } - if(num_done == num_child) - { - vo_entry->clearChildrenList(); - } - - if(!vo_entry->getNumOfChildren()) + + if(vo_entry->isValid() && vo_entry->getState() < LLVOCacheEntry::WAITING) { - if(vo_entry->getState() >= LLVOCacheEntry::WAITING) - { - LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter; - ++next_iter; - mImpl->mVisibleEntries.erase(iter); - iter = next_iter; - } - else - { - ++iter; - } + //set a large number to force to load this object. + vo_entry->setSceneContribution(LARGE_SCENE_CONTRIBUTION); + + mImpl->mWaitingList.insert(vo_entry); + ++iter; } else { - ++iter; + iter = mImpl->mVisibleEntries.erase(iter); } } @@ -1163,6 +1112,10 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) //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) @@ -1240,10 +1193,7 @@ void LLViewerRegion::clearCachedVisibleObjects() parent->addChild(entry); } - LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter; - ++next_iter; - mImpl->mVisibleEntries.erase(iter); - iter = next_iter; + iter = mImpl->mVisibleEntries.erase(iter); } else //parent is not cache-able, leave it. { @@ -2044,8 +1994,7 @@ void LLViewerRegion::findOrphans(U32 parent_id) for(S32 i = 0; i < children->size(); i++) { //parent is visible, so is the child. - LLVOCacheEntry* child = getCacheEntry((*children)[i]); - addVisibleCacheEntry(child); + addVisibleCacheEntry(getCacheEntry((*children)[i])); } children->clear(); mOrphanMap.erase(parent_id); @@ -2059,46 +2008,50 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) gObjectList.processObjectUpdateFromCache(entry, this); return; } + if(!entry || !entry->isValid()) + { + return; + } - if(entry != NULL && !entry->getEntry()) + if(!entry->getEntry()) { entry->setOctreeEntry(NULL); + } - if(entry->getEntry()->hasDrawable()) //already in the rendering pipeline + if(entry->getEntry()->hasDrawable()) //already in the rendering pipeline + { + LLViewerRegion* old_regionp = ((LLDrawable*)entry->getEntry()->getDrawable())->getRegion(); + if(old_regionp != this && old_regionp) { - LLViewerRegion* old_regionp = ((LLDrawable*)entry->getEntry()->getDrawable())->getRegion(); - if(old_regionp != this && old_regionp) + LLViewerObject* obj = ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj(); + if(obj) { - LLViewerObject* obj = ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj(); - if(obj) - { - //remove from old region - old_regionp->killCacheEntry(obj->getLocalID()); + //remove from old region + old_regionp->killCacheEntry(obj->getLocalID()); - //change region - obj->setRegion(this); - } + //change region + obj->setRegion(this); } + } - addActiveCacheEntry(entry); + addActiveCacheEntry(entry); - //set parent id - U32 parent_id = 0; - LLViewerObject::unpackParentID(entry->getDP(), parent_id); - if(parent_id > 0) - { - entry->setParentID(parent_id); - } - - //update the object - gObjectList.processObjectUpdateFromCache(entry, this); - return; //done + //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 } - else if(entry->getGroup() != NULL) - { - return; //already in octree, no post processing. - } + + //must not be active. + llassert_always(!entry->isState(LLVOCacheEntry::ACTIVE)); + removeFromVOCacheTree(entry); //remove from cache octree if it is in. LLVector3 pos; LLVector3 scale; @@ -2107,27 +2060,56 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) //decode spatial info and parent info U32 parent_id = LLViewerObject::extractSpatialExtents(entry->getDP(), pos, scale, rot); - if(parent_id > 0) //has parent + 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) { - //check if parent is non-cacheable and already created - if(isNonCacheableObjectCreated(parent_id)) + if(!same_old_parent) { - //parent is visible, so is the child. - addVisibleCacheEntry(entry); + //check if parent is non-cacheable and already created + if(isNonCacheableObjectCreated(parent_id)) + { + //parent is visible, so is the child. + addVisibleCacheEntry(entry); + } + else + { + entry->setBoundingInfo(pos, scale); + mOrphanMap[parent_id].push_back(entry->getLocalID()); + } } else { entry->setBoundingInfo(pos, scale); - mOrphanMap[parent_id].push_back(entry->getLocalID()); - } + } } else //parent in cache. { @@ -2194,10 +2176,12 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB LLViewerObject::unpackU32(&dp, local_id, "LocalID"); LLViewerObject::unpackU32(&dp, crc, "CRC"); - LLVOCacheEntry* entry = getCacheEntry(local_id); + LLVOCacheEntry* entry = getCacheEntry(local_id, false); if (entry) { + entry->setValid(); + // we've seen this object before if (entry->getCRC() == crc) { @@ -2205,31 +2189,15 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB entry->recordDupe(); result = CACHE_UPDATE_DUPE; } - else + else //CRC changed { // Update the cache entry - LLPointer new_entry = new LLVOCacheEntry(local_id, crc, dp); - - //if visible, update it - if(!entry->isState(LLVOCacheEntry::INACTIVE)) - { - replaceVisibleCacheEntry(entry, new_entry); - } - else //invisible - { - //copy some contents from old entry - entry->moveTo(new_entry, true); - - //remove old entry - killCacheEntry(entry); - entry = new_entry; - - mImpl->mCacheMap[local_id] = entry; - decodeBoundingInfo(entry); - } + entry->updateEntry(crc, dp); + + decodeBoundingInfo(entry); result = CACHE_UPDATE_CHANGED; - } + } } else { @@ -2268,12 +2236,15 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) return entry; } -LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) +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()) { - return iter->second; + if(!valid || iter->second->isValid()) + { + return iter->second; + } } return NULL; } @@ -2323,7 +2294,7 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss { //llassert(mCacheLoaded); This assert failes often, changing to early-out -- davep, 2010/10/18 - LLVOCacheEntry* entry = getCacheEntry(local_id); + LLVOCacheEntry* entry = getCacheEntry(local_id, false); if (entry) { @@ -2341,15 +2312,12 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss return true; } - if(entry->getGroup() || !entry->isState(LLVOCacheEntry::INACTIVE)) //already probed + if(entry->isValid()) { - return true; - } - if(entry->getParentID() > 0) //already probed - { - return true; + return true; //already probed } + entry->setValid(); decodeBoundingInfo(entry); return true; } -- cgit v1.2.3 From 217a85337aa97a445b1d3121182d76524b0a05a6 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 6 Jan 2014 23:00:57 -0700 Subject: fix a compiling error for mac and linux. --- indra/newview/llviewerregion.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index ae4306847c..f7a29cd317 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1080,7 +1080,10 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) } else { - iter = mImpl->mVisibleEntries.erase(iter); + LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter; + ++next_iter; + mImpl->mVisibleEntries.erase(iter); + iter = next_iter; } } @@ -1193,7 +1196,10 @@ void LLViewerRegion::clearCachedVisibleObjects() parent->addChild(entry); } - iter = mImpl->mVisibleEntries.erase(iter); + 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. { -- cgit v1.2.3 From 6a113325521fa68c634cd900de8352c35fe91268 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 8 Jan 2014 11:56:55 -0700 Subject: trivial: convert to unix line endings. --- indra/newview/llviewerregion.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index f7a29cd317..002dac14a7 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1080,9 +1080,9 @@ void LLViewerRegion::updateVisibleEntries(F32 max_time) } else { - LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter; - ++next_iter; - mImpl->mVisibleEntries.erase(iter); + LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter; + ++next_iter; + mImpl->mVisibleEntries.erase(iter); iter = next_iter; } } @@ -1196,9 +1196,9 @@ void LLViewerRegion::clearCachedVisibleObjects() parent->addChild(entry); } - LLVOCacheEntry::vocache_entry_set_t::iterator next_iter = iter; - ++next_iter; - mImpl->mVisibleEntries.erase(iter); + 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. -- cgit v1.2.3 From 87f852ee67c75ac415ce716157bdd9ba94c60441 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 9 Jan 2014 21:17:49 -0700 Subject: fix for SH-4659:crash at LLOcclusionCullingGroup::doOcclusion line 1150 --- indra/newview/llviewerregion.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 002dac14a7..3d8afcceb0 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -980,13 +980,15 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) if(entry->hasState(LLVOCacheEntry::IN_VO_TREE)) { return; //already in the tree. - } - entry->setState(LLVOCacheEntry::IN_VO_TREE); + } llassert_always(!entry->getGroup()); //not in octree. llassert(!entry->getEntry()->hasDrawable()); //not have drawables - mImpl->mVOCachePartition->addEntry(entry->getEntry()); + if(mImpl->mVOCachePartition->addEntry(entry->getEntry())) + { + entry->setState(LLVOCacheEntry::IN_VO_TREE); + } } void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) -- cgit v1.2.3 From b49170b732e6e4b2cf11b40c12b3d75a8709cf5c Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 31 Jan 2014 18:24:55 -0700 Subject: fix some flaws for memory corruption --- indra/newview/llviewerregion.cpp | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 3d8afcceb0..e2143babcf 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1007,37 +1007,36 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) mImpl->mVOCachePartition->removeEntry(entry->getEntry()); } -//add the visible entries -void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) +//add child objects as visible entries +void LLViewerRegion::addVisibleChildCacheEntry(LLVOCacheEntry* parent, LLVOCacheEntry* child) { - if(mDead || !entry || !entry->getEntry() || !entry->isValid()) - { - return; - } - - if(entry->isState(LLVOCacheEntry::IN_QUEUE)) + if(mDead) { return; } - if(entry->isState(LLVOCacheEntry::INACTIVE)) + if(parent && (!parent->isValid() || !parent->isState(LLVOCacheEntry::ACTIVE))) { - entry->setState(LLVOCacheEntry::IN_QUEUE); + return; //parent must be valid and in rendering pipeline } - if(!entry->isState(LLVOCacheEntry::ACTIVE)) + if(child && (!child->getEntry() || !child->isValid() || !child->isState(LLVOCacheEntry::INACTIVE))) { - mImpl->mVisibleEntries.insert(entry); + return; //child must be valid and not in the rendering pipeline } - //add all children - if(entry->getNumOfChildren() > 0) + if(child) { - LLVOCacheEntry* child = entry->getChild(); + child->setState(LLVOCacheEntry::IN_QUEUE); + mImpl->mVisibleEntries.insert(child); + } + else if(parent && parent->getNumOfChildren() > 0) //add all children + { + child = parent->getChild(); while(child != NULL) { - addVisibleCacheEntry(child); - child = entry->getChild(); + addVisibleCacheEntry(NULL, child); + child = parent->getChild(); } } } @@ -2002,7 +2001,7 @@ void LLViewerRegion::findOrphans(U32 parent_id) for(S32 i = 0; i < children->size(); i++) { //parent is visible, so is the child. - addVisibleCacheEntry(getCacheEntry((*children)[i])); + addVisibleChildCacheEntry(NULL, getCacheEntry((*children)[i])); } children->clear(); mOrphanMap.erase(parent_id); @@ -2106,7 +2105,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(isNonCacheableObjectCreated(parent_id)) { //parent is visible, so is the child. - addVisibleCacheEntry(entry); + addVisibleChildCacheEntry(NULL, entry); } else { @@ -2124,7 +2123,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(!parent->isState(LLVOCacheEntry::INACTIVE)) { //parent is visible, so is the child. - addVisibleCacheEntry(entry); + addVisibleCacheEntry(parent, entry); } else { -- cgit v1.2.3 From 2ab11c8e34f2349500aef76cd8372ca889020728 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 31 Jan 2014 18:51:50 -0700 Subject: fix some compiling errors --- indra/newview/llviewerregion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewerregion.cpp') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e2143babcf..1191ec0f28 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1035,7 +1035,7 @@ void LLViewerRegion::addVisibleChildCacheEntry(LLVOCacheEntry* parent, LLVOCache child = parent->getChild(); while(child != NULL) { - addVisibleCacheEntry(NULL, child); + addVisibleChildCacheEntry(NULL, child); child = parent->getChild(); } } @@ -2123,7 +2123,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(!parent->isState(LLVOCacheEntry::INACTIVE)) { //parent is visible, so is the child. - addVisibleCacheEntry(parent, entry); + addVisibleChildCacheEntry(parent, entry); } else { -- cgit v1.2.3