summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-11-21 11:21:09 -0700
committerXiaohong Bao <bao@lindenlab.com>2013-11-21 11:21:09 -0700
commitfb29358d70410cba8c8941c289c594d946569e7a (patch)
tree5274487d6a2c345d2f0052accf72e075404f7def /indra/newview
parent3d35f00d63a41fabe61b1c04b227c9e94e81de17 (diff)
parentc14ecc817895d06b04a803a88d00d4ae1c80060a (diff)
Automated merge with http://bitbucket.org/lindenlab/viewer-interesting
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llvieweroctree.cpp4
-rwxr-xr-xindra/newview/llviewerregion.cpp104
-rwxr-xr-xindra/newview/llviewerregion.h5
3 files changed, 51 insertions, 62 deletions
diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp
index 62d34d12b5..201677b3de 100644
--- a/indra/newview/llvieweroctree.cpp
+++ b/indra/newview/llvieweroctree.cpp
@@ -268,6 +268,10 @@ void LLViewerOctreeEntry::removeData(LLViewerOctreeEntryData* data)
{
return;
}
+ if(mData[data->getDataType()] != data)
+ {
+ return;
+ }
mData[data->getDataType()] = NULL;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index f71d0a7a64..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
@@ -923,21 +934,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 +1414,6 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time)
}
std::vector<LLDrawable*> delete_list;
- std::vector<LLVOCacheEntry*> 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 +1429,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 +1461,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;
}
@@ -1490,6 +1469,7 @@ void LLViewerRegion::killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>&
//kill the object.
LLDrawable* drawablep = (LLDrawable*)entry->getEntry()->getDrawable();
llassert(drawablep);
+ llassert(drawablep->getRegion() == this);
if(drawablep && !drawablep->getParent())
{
@@ -1541,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;
}
@@ -2059,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
@@ -2205,7 +2208,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB
mImpl->mCacheMap[local_id] = entry;
decodeBoundingInfo(entry);
- }
+ }
result = CACHE_UPDATE_CHANGED;
}
@@ -2231,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;
}
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 6889db7880..0f27def8a5 100755
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -235,7 +235,7 @@ public:
void addVisibleCacheEntry(LLVOCacheEntry* entry);
void addActiveCacheEntry(LLVOCacheEntry* entry);
void removeActiveCacheEntry(LLVOCacheEntry* entry, LLDrawable* drawablep);
- void killCacheEntry(U32 local_id); //physically delete the cache entry
+ void killCacheEntry(U32 local_id, bool kill_obj = true); //physically delete the cache entry
// Like idleUpdate, but forces everything to complete regardless of
// how long it takes.
@@ -385,8 +385,7 @@ private:
void killObject(LLVOCacheEntry* entry, std::vector<LLDrawable*>& delete_list);
void removeFromVOCacheTree(LLVOCacheEntry* entry);
void replaceVisibleCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry);
- void killCacheEntry(LLVOCacheEntry* entry); //physically delete the cache entry
- void removeDanglingEntry(LLVOCacheEntry* entry);
+ void killCacheEntry(LLVOCacheEntry* entry, bool kill_obj = true); //physically delete the cache entry
void killInvisibleObjects(F32 max_time);
void createVisibleObjects(F32 max_time);
void updateVisibleEntries(F32 max_time); //update visible entries