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/llvocache.cpp | 78 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 7 deletions(-) (limited to 'indra/newview/llvocache.cpp') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 7db19c5c1b..17e0ef3bdb 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -29,6 +29,8 @@ #include "llerror.h" #include "llregionhandle.h" #include "llviewercontrol.h" +#include "llviewerobjectlist.h" +#include "lldrawable.h" BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes) { @@ -46,12 +48,13 @@ BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes) //--------------------------------------------------------------------------- LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp) - : + : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mLocalID(local_id), mCRC(crc), mHitCount(0), mDupeCount(0), - mCRCChangeCount(0) + mCRCChangeCount(0), + mState(INACTIVE) { mBuffer = new U8[dp.getBufferSize()]; mDP.assignBuffer(mBuffer, dp.getBufferSize()); @@ -59,19 +62,22 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & } LLVOCacheEntry::LLVOCacheEntry() - : + : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mLocalID(0), mCRC(0), mHitCount(0), mDupeCount(0), mCRCChangeCount(0), - mBuffer(NULL) + mBuffer(NULL), + mState(INACTIVE) { mDP.assignBuffer(mBuffer, 0); } LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) - : mBuffer(NULL) + : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), + mBuffer(NULL), + mState(INACTIVE) { S32 size = -1; BOOL success; @@ -138,8 +144,57 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) LLVOCacheEntry::~LLVOCacheEntry() { mDP.freeBuffer(); + //llassert(mState == INACTIVE); } +//virtual +void LLVOCacheEntry::setOctreeEntry(LLViewerOctreeEntry* entry) +{ + if(!entry && mDP.getBufferSize() > 0) + { + LLUUID fullid; + mDP.reset(); + mDP.unpackUUID(fullid, "ID"); + mDP.reset(); + + LLViewerObject* obj = gObjectList.findObject(fullid); + if(obj && obj->mDrawable) + { + entry = obj->mDrawable->getEntry(); + } + } + + LLViewerOctreeEntryData::setOctreeEntry(entry); +} + +//virtual +S32 LLVOCacheEntry::getMinVisFrameRange()const +{ + const S32 MIN_RANGE = 128; //frames + + return MIN_RANGE; +} + +void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) +{ + llassert(entry != NULL); + + mChildrenList.push_back(entry); +} + +LLVOCacheEntry* LLVOCacheEntry::getNextChild() +{ + S32 size = mChildrenList.size(); + if(!size) + { + return NULL; + } + + LLVOCacheEntry* entry = mChildrenList[size - 1]; + mChildrenList.pop_back(); //remove the entry; + + return entry; +} // New CRC means the object has changed. void LLVOCacheEntry::assignCRC(U32 crc, LLDataPackerBinaryBuffer &dp) @@ -170,6 +225,16 @@ LLDataPackerBinaryBuffer *LLVOCacheEntry::getDP(U32 crc) return &mDP; } +LLDataPackerBinaryBuffer *LLVOCacheEntry::getDP() +{ + if (mDP.getBufferSize() == 0) + { + //llinfos << "Not getting cache entry, invalid!" << llendl; + return NULL; + } + + return &mDP; +} void LLVOCacheEntry::recordHit() { @@ -625,11 +690,10 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca { for (S32 i = 0; i < num_entries; i++) { - LLVOCacheEntry* entry = new LLVOCacheEntry(&apr_file); + LLPointer entry = new LLVOCacheEntry(&apr_file); if (!entry->getLocalID()) { llwarns << "Aborting cache file load for " << filename << ", cache file corruption!" << llendl; - delete entry ; success = false ; break ; } -- 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/llvocache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvocache.cpp') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 17e0ef3bdb..236ce11c7e 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -170,7 +170,7 @@ void LLVOCacheEntry::setOctreeEntry(LLViewerOctreeEntry* entry) //virtual S32 LLVOCacheEntry::getMinVisFrameRange()const { - const S32 MIN_RANGE = 128; //frames + const S32 MIN_RANGE = 64; //frames return MIN_RANGE; } -- cgit v1.2.3 From 87097e546fa9e160264400f6d9d79d536abbb2fa Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 25 Oct 2012 17:00:34 -0600 Subject: more for SH-3333: avoid repeatedly creating/killing a same object from object cache due to occlusion culling. --- indra/newview/llvocache.cpp | 47 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvocache.cpp') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 236ce11c7e..fbab5c60e3 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -54,7 +54,9 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mHitCount(0), mDupeCount(0), mCRCChangeCount(0), - mState(INACTIVE) + mState(INACTIVE), + mRepeatedVisCounter(0), + mVisFrameRange(64) { mBuffer = new U8[dp.getBufferSize()]; mDP.assignBuffer(mBuffer, dp.getBufferSize()); @@ -69,7 +71,9 @@ LLVOCacheEntry::LLVOCacheEntry() mDupeCount(0), mCRCChangeCount(0), mBuffer(NULL), - mState(INACTIVE) + mState(INACTIVE), + mRepeatedVisCounter(0), + mVisFrameRange(64) { mDP.assignBuffer(mBuffer, 0); } @@ -77,7 +81,9 @@ LLVOCacheEntry::LLVOCacheEntry() LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mBuffer(NULL), - mState(INACTIVE) + mState(INACTIVE), + mRepeatedVisCounter(0), + mVisFrameRange(64) { S32 size = -1; BOOL success; @@ -167,12 +173,41 @@ void LLVOCacheEntry::setOctreeEntry(LLViewerOctreeEntry* entry) LLViewerOctreeEntryData::setOctreeEntry(entry); } +void LLVOCacheEntry::setState(U32 state) +{ + mState = state; + + if(mState == ACTIVE) + { + const S32 MIN_REAVTIVE_INTERVAL = 20; + U32 last_visible = getVisible(); + + setVisible(); + + if(getVisible() - last_visible < MIN_REAVTIVE_INTERVAL + mVisFrameRange) + { + mRepeatedVisCounter++; + } + else + { + mRepeatedVisCounter = 0; + mVisFrameRange = 64; + } + + if(mRepeatedVisCounter > 2) + { + //if repeatedly becomes visible immediately after invisible, enlarge the visible frame range + + mRepeatedVisCounter = 0; + mVisFrameRange *= 2; + } + } +} + //virtual S32 LLVOCacheEntry::getMinVisFrameRange()const { - const S32 MIN_RANGE = 64; //frames - - return MIN_RANGE; + return mVisFrameRange; } void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) -- cgit v1.2.3 From e35a220bf7dd47132174c81181d5f59fb0d54c5d Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 29 Oct 2012 17:13:15 -0600 Subject: for SH-3459: interesting store object bounding information in viewer cache --- indra/newview/llvocache.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'indra/newview/llvocache.cpp') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index fbab5c60e3..f389867484 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -89,6 +89,8 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) BOOL success; mDP.assignBuffer(mBuffer, 0); + setOctreeEntry(NULL); + success = check_read(apr_file, &mLocalID, sizeof(U32)); if(success) { @@ -107,6 +109,21 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) success = check_read(apr_file, &mCRCChangeCount, sizeof(S32)); } if(success) + { + LLVector4 pos; + success = check_read(apr_file, (void*)pos.mV, sizeof(LLVector4)); + + LLVector4a pos_; + pos_.load4a(pos.mV); + setPositionGroup(pos_); + } + if(success) + { + F32 rad; + success = check_read(apr_file, &rad, sizeof(F32)); + setBinRadius(rad); + } + if(success) { success = check_read(apr_file, &size, sizeof(S32)); @@ -144,6 +161,7 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) mDupeCount = 0; mCRCChangeCount = 0; mBuffer = NULL; + mEntry = NULL; } } @@ -289,6 +307,11 @@ void LLVOCacheEntry::dump() const BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const { + if(!mEntry) + { + return FALSE; + } + BOOL success; success = check_write(apr_file, (void*)&mLocalID, sizeof(U32)); if(success) @@ -308,6 +331,17 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const success = check_write(apr_file, (void*)&mCRCChangeCount, sizeof(S32)); } if(success) + { + const LLVector4a pos_ = getPositionGroup() ; + LLVector4 pos(pos_[0], pos_[1], pos_[2], pos_[3]); + success = check_write(apr_file, pos.mV, sizeof(LLVector4)); + } + if(success) + { + F32 rad = getBinRadius(); + success = check_write(apr_file, (void*)&rad, sizeof(F32)); + } + if(success) { S32 size = mDP.getBufferSize(); success = check_write(apr_file, (void*)&size, sizeof(S32)); -- 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/llvocache.cpp | 77 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'indra/newview/llvocache.cpp') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index f389867484..d4938fd216 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -31,6 +31,7 @@ #include "llviewercontrol.h" #include "llviewerobjectlist.h" #include "lldrawable.h" +#include "llviewerregion.h" BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes) { @@ -355,6 +356,82 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const return success ; } +//------------------------------------------------------------------- +//LLVOCachePartition +//------------------------------------------------------------------- +LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp) +{ + mRegionp = regionp; + mPartitionType = LLViewerRegion::PARTITION_VO_CACHE; + mVisitedTime = 0; + + new LLviewerOctreeGroup(mOctree); +} + +void LLVOCachePartition::addEntry(LLViewerOctreeEntry* entry) +{ + llassert(entry->hasVOCacheEntry()); + + mOctree->insert(entry); +} + +void LLVOCachePartition::removeEntry(LLViewerOctreeEntry* entry) +{ + entry->getVOCacheEntry()->setGroup(NULL); + + llassert(!entry->getGroup()); +} + +class LLVOCacheOctreeCull : public LLViewerOctreeCull +{ +public: + LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp) : LLViewerOctreeCull(camera), mRegionp(regionp) {} + + virtual S32 frustumCheck(const LLviewerOctreeGroup* group) + { + S32 res = AABBInFrustumNoFarClipGroupBounds(group); + if (res != 0) + { + res = llmin(res, AABBSphereIntersectGroupExtents(group)); + } + return res; + } + + virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group) + { + S32 res = AABBInFrustumNoFarClipObjectBounds(group); + if (res != 0) + { + res = llmin(res, AABBSphereIntersectObjectExtents(group)); + } + return res; + } + + virtual void processGroup(LLviewerOctreeGroup* base_group) + { + mRegionp->addVisibleGroup(base_group); + } + +private: + LLViewerRegion* mRegionp; +}; + +S32 LLVOCachePartition::cull(LLCamera &camera) +{ + if(mVisitedTime == LLViewerOctreeEntryData::getCurrentFrame()) + { + return 0; //already visited. + } + mVisitedTime = LLViewerOctreeEntryData::getCurrentFrame(); + + ((LLviewerOctreeGroup*)mOctree->getListener(0))->rebound(); + + LLVOCacheOctreeCull culler(&camera, mRegionp); + culler.traverse(mOctree); + + return 0; +} + //------------------------------------------------------------------- //LLVOCache //------------------------------------------------------------------- -- cgit v1.2.3 From 8e6341b9194b1fb27d92d8f5e6739390ac882941 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 1 Nov 2012 17:05:26 -0600 Subject: more for SH-3459: interesting store object bounding information in viewer cache --- indra/newview/llvocache.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'indra/newview/llvocache.cpp') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index d4938fd216..db6aa9cd00 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -110,6 +110,17 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) success = check_read(apr_file, &mCRCChangeCount, sizeof(S32)); } if(success) + { + F32 ext[8]; + success = check_read(apr_file, (void*)ext, sizeof(F32) * 8); + + LLVector4a exts[2]; + exts[0].load4a(ext); + exts[1].load4a(&ext[4]); + + setSpatialExtents(exts[0], exts[1]); + } + if(success) { LLVector4 pos; success = check_read(apr_file, (void*)pos.mV, sizeof(LLVector4)); @@ -332,6 +343,17 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const success = check_write(apr_file, (void*)&mCRCChangeCount, sizeof(S32)); } if(success) + { + const LLVector4a* exts = getSpatialExtents() ; + LLVector4 ext(exts[0][0], exts[0][1], exts[0][2], exts[0][3]); + success = check_write(apr_file, ext.mV, sizeof(LLVector4)); + if(success) + { + ext.set(exts[1][0], exts[1][1], exts[1][2], exts[1][3]); + success = check_write(apr_file, ext.mV, sizeof(LLVector4)); + } + } + if(success) { const LLVector4a pos_ = getPositionGroup() ; LLVector4 pos(pos_[0], pos_[1], pos_[2], pos_[3]); -- 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/llvocache.cpp | 136 ++++++++++++++++++++++++++++++++------------ 1 file changed, 100 insertions(+), 36 deletions(-) (limited to 'indra/newview/llvocache.cpp') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index db6aa9cd00..ec8585852b 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -32,6 +32,7 @@ #include "llviewerobjectlist.h" #include "lldrawable.h" #include "llviewerregion.h" +#include "pipeline.h" BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes) { @@ -57,11 +58,24 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mCRCChangeCount(0), mState(INACTIVE), mRepeatedVisCounter(0), - mVisFrameRange(64) + mVisFrameRange(64), + mSceneContrib(0.f) { mBuffer = new U8[dp.getBufferSize()]; mDP.assignBuffer(mBuffer, dp.getBufferSize()); mDP = dp; + + if(dp.getBufferSize() > 0) + { + U32 parent_id = 0; + dp.reset(); + dp.unpackU32(parent_id, "ParentID"); + dp.reset(); + if(parent_id > 0) + { + mState |= CHILD; //is a child + } + } } LLVOCacheEntry::LLVOCacheEntry() @@ -74,7 +88,8 @@ LLVOCacheEntry::LLVOCacheEntry() mBuffer(NULL), mState(INACTIVE), mRepeatedVisCounter(0), - mVisFrameRange(64) + mVisFrameRange(64), + mSceneContrib(0.f) { mDP.assignBuffer(mBuffer, 0); } @@ -84,7 +99,8 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) mBuffer(NULL), mState(INACTIVE), mRepeatedVisCounter(0), - mVisFrameRange(64) + mVisFrameRange(64), + mSceneContrib(0.f) { S32 size = -1; BOOL success; @@ -110,6 +126,10 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) success = check_read(apr_file, &mCRCChangeCount, sizeof(S32)); } if(success) + { + success = check_read(apr_file, &mState, sizeof(U32)); + } + if(success) { F32 ext[8]; success = check_read(apr_file, (void*)ext, sizeof(F32) * 8); @@ -174,6 +194,7 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) mCRCChangeCount = 0; mBuffer = NULL; mEntry = NULL; + mState = 0; } } @@ -203,11 +224,40 @@ void LLVOCacheEntry::setOctreeEntry(LLViewerOctreeEntry* entry) LLViewerOctreeEntryData::setOctreeEntry(entry); } +void LLVOCacheEntry::setBridgeChild() +{ + mState |= BRIDGE_CHILD; +} + +void LLVOCacheEntry::clearBridgeChild() +{ + mState &= ~BRIDGE_CHILD; +} + +void LLVOCacheEntry::copy(LLVOCacheEntry* entry) +{ + //copy LLViewerOctreeEntry + LLViewerOctreeEntry* oct_entry = entry->getEntry(); + if(!oct_entry) + { + setOctreeEntry(oct_entry); + } + + //copy children + S32 num_children = entry->getNumOfChildren(); + for(S32 i = 0; i < num_children; i++) + { + addChild(entry->getChild(i)); + } +} + void LLVOCacheEntry::setState(U32 state) { - mState = state; + mState &= 0xffff0000; //clear the low 16 bits + state &= 0x0000ffff; //clear the high 16 bits; + mState |= state; - if(mState == ACTIVE) + if(getState() == ACTIVE) { const S32 MIN_REAVTIVE_INTERVAL = 20; U32 last_visible = getVisible(); @@ -247,37 +297,6 @@ void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) mChildrenList.push_back(entry); } -LLVOCacheEntry* LLVOCacheEntry::getNextChild() -{ - S32 size = mChildrenList.size(); - if(!size) - { - return NULL; - } - - LLVOCacheEntry* entry = mChildrenList[size - 1]; - mChildrenList.pop_back(); //remove the entry; - - return entry; -} - -// New CRC means the object has changed. -void LLVOCacheEntry::assignCRC(U32 crc, LLDataPackerBinaryBuffer &dp) -{ - if ( (mCRC != crc) - ||(mDP.getBufferSize() == 0)) - { - mCRC = crc; - mHitCount = 0; - mCRCChangeCount++; - - mDP.freeBuffer(); - mBuffer = new U8[dp.getBufferSize()]; - mDP.assignBuffer(mBuffer, dp.getBufferSize()); - mDP = dp; - } -} - LLDataPackerBinaryBuffer *LLVOCacheEntry::getDP(U32 crc) { if ( (mCRC != crc) @@ -343,6 +362,11 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const success = check_write(apr_file, (void*)&mCRCChangeCount, sizeof(S32)); } if(success) + { + U32 state = mState & 0xffff0000; //only store the high 16 bits. + success = check_write(apr_file, (void*)&state, sizeof(U32)); + } + if(success) { const LLVector4a* exts = getSpatialExtents() ; LLVector4 ext(exts[0][0], exts[0][1], exts[0][2], exts[0][3]); @@ -378,6 +402,46 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const return success ; } +void LLVOCacheEntry::calcSceneContribution(const LLVector3& camera_origin, bool needs_update, U32 last_update) +{ + if(!needs_update && getVisible() >= last_update) + { + return; //no need to update + } + + const LLVector4a& center = getPositionGroup(); + + LLVector4a origin; + origin.load3(camera_origin.mV); + + LLVector4a lookAt; + lookAt.setSub(center, origin); + F32 squared_dist = lookAt.dot3(lookAt).getF32(); + + F32 rad = getBinRadius(); + mSceneContrib = rad * rad / squared_dist; + + setVisible(); +} + +U32 LLVOCacheEntry::getParentID() +{ + if(!(mState & CHILD)) + { + return 0; //not a child + } + + U32 parent_id = 0; + LLDataPackerBinaryBuffer* dp = getDP(); + if(dp) + { + dp->reset(); + dp->unpackU32(parent_id, "ParentID"); + dp->reset(); + } + return parent_id; +} + //------------------------------------------------------------------- //LLVOCachePartition //------------------------------------------------------------------- -- 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/llvocache.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvocache.cpp') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index ec8585852b..8ea79dbae6 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -234,20 +234,20 @@ void LLVOCacheEntry::clearBridgeChild() mState &= ~BRIDGE_CHILD; } -void LLVOCacheEntry::copy(LLVOCacheEntry* entry) +void LLVOCacheEntry::copyTo(LLVOCacheEntry* new_entry) { //copy LLViewerOctreeEntry - LLViewerOctreeEntry* oct_entry = entry->getEntry(); - if(!oct_entry) + if(mEntry.notNull()) { - setOctreeEntry(oct_entry); + new_entry->setOctreeEntry(mEntry); + mEntry = NULL; } //copy children - S32 num_children = entry->getNumOfChildren(); + S32 num_children = getNumOfChildren(); for(S32 i = 0; i < num_children; i++) { - addChild(entry->getChild(i)); + new_entry->addChild(getChild(i)); } } -- 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/llvocache.cpp | 49 ++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'indra/newview/llvocache.cpp') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 8ea79dbae6..59645fdbe9 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -424,24 +424,6 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector3& camera_origin, bool setVisible(); } -U32 LLVOCacheEntry::getParentID() -{ - if(!(mState & CHILD)) - { - return 0; //not a child - } - - U32 parent_id = 0; - LLDataPackerBinaryBuffer* dp = getDP(); - if(dp) - { - dp->reset(); - dp->unpackU32(parent_id, "ParentID"); - dp->reset(); - } - return parent_id; -} - //------------------------------------------------------------------- //LLVOCachePartition //------------------------------------------------------------------- @@ -471,24 +453,31 @@ void LLVOCachePartition::removeEntry(LLViewerOctreeEntry* entry) class LLVOCacheOctreeCull : public LLViewerOctreeCull { public: - LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp) : LLViewerOctreeCull(camera), mRegionp(regionp) {} + LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp, const LLVector3& shift) : LLViewerOctreeCull(camera), mRegionp(regionp) + { + mLocalShift = shift; + } virtual S32 frustumCheck(const LLviewerOctreeGroup* group) { - S32 res = AABBInFrustumNoFarClipGroupBounds(group); + //S32 res = AABBInRegionFrustumGroupBounds(group); + + S32 res = AABBInRegionFrustumNoFarClipGroupBounds(group); if (res != 0) { - res = llmin(res, AABBSphereIntersectGroupExtents(group)); + res = llmin(res, AABBRegionSphereIntersectGroupExtents(group, mLocalShift)); } return res; } virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group) { - S32 res = AABBInFrustumNoFarClipObjectBounds(group); + //S32 res = AABBInRegionFrustumObjectBounds(group); + + S32 res = AABBInRegionFrustumNoFarClipObjectBounds(group); if (res != 0) { - res = llmin(res, AABBSphereIntersectObjectExtents(group)); + res = llmin(res, AABBRegionSphereIntersectObjectExtents(group, mLocalShift)); } return res; } @@ -500,10 +489,16 @@ public: private: LLViewerRegion* mRegionp; + LLVector3 mLocalShift; //shift vector from agent space to local region space. }; S32 LLVOCachePartition::cull(LLCamera &camera) { + if(!LLViewerRegion::sVOCacheCullingEnabled) + { + return 0; + } + if(mVisitedTime == LLViewerOctreeEntryData::getCurrentFrame()) { return 0; //already visited. @@ -511,8 +506,12 @@ S32 LLVOCachePartition::cull(LLCamera &camera) mVisitedTime = LLViewerOctreeEntryData::getCurrentFrame(); ((LLviewerOctreeGroup*)mOctree->getListener(0))->rebound(); - - LLVOCacheOctreeCull culler(&camera, mRegionp); + + //localize the camera + LLVector3 region_agent = mRegionp->getOriginAgent(); + camera.calcRegionFrustumPlanes(region_agent); + + LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent); culler.traverse(mOctree); return 0; -- 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/llvocache.cpp | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'indra/newview/llvocache.cpp') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 59645fdbe9..86cfbb1d74 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -64,18 +64,6 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mBuffer = new U8[dp.getBufferSize()]; mDP.assignBuffer(mBuffer, dp.getBufferSize()); mDP = dp; - - if(dp.getBufferSize() > 0) - { - U32 parent_id = 0; - dp.reset(); - dp.unpackU32(parent_id, "ParentID"); - dp.reset(); - if(parent_id > 0) - { - mState |= CHILD; //is a child - } - } } LLVOCacheEntry::LLVOCacheEntry() @@ -224,16 +212,6 @@ void LLVOCacheEntry::setOctreeEntry(LLViewerOctreeEntry* entry) LLViewerOctreeEntryData::setOctreeEntry(entry); } -void LLVOCacheEntry::setBridgeChild() -{ - mState |= BRIDGE_CHILD; -} - -void LLVOCacheEntry::clearBridgeChild() -{ - mState &= ~BRIDGE_CHILD; -} - void LLVOCacheEntry::copyTo(LLVOCacheEntry* new_entry) { //copy LLViewerOctreeEntry -- cgit v1.2.3