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.h | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'indra/newview/llvocache.h') diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 14e3b4c793..85538e8043 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -31,34 +31,57 @@ #include "lldatapacker.h" #include "lldlinked.h" #include "lldir.h" - +#include "llvieweroctree.h" //--------------------------------------------------------------------------- // Cache entries class LLVOCacheEntry; -class LLVOCacheEntry +class LLVOCacheEntry : public LLViewerOctreeEntryData { +public: + enum + { + INACTIVE = 0, + WAITING, + ACTIVE + }; + +protected: + ~LLVOCacheEntry(); public: LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp); LLVOCacheEntry(LLAPRFile* apr_file); - LLVOCacheEntry(); - ~LLVOCacheEntry(); + LLVOCacheEntry(); + + void setState(U32 state) {mState = state;} + bool isState(U32 state) {return mState == state;} + U32 getState() const {return mState;} U32 getLocalID() const { return mLocalID; } U32 getCRC() const { return mCRC; } S32 getHitCount() const { return mHitCount; } S32 getCRCChangeCount() const { return mCRCChangeCount; } + S32 getMinVisFrameRange()const; void dump() const; BOOL writeToFile(LLAPRFile* apr_file) const; void assignCRC(U32 crc, LLDataPackerBinaryBuffer &dp); LLDataPackerBinaryBuffer *getDP(U32 crc); + LLDataPackerBinaryBuffer *getDP(); void recordHit(); void recordDupe() { mDupeCount++; } + + /*virtual*/ void setOctreeEntry(LLViewerOctreeEntry* entry); + + void addChild(LLVOCacheEntry* entry); + LLVOCacheEntry* getNextChild(); + S32 getNumOfChildren() {return mChildrenList.size();} + bool isDummy() {return !mBuffer;} public: - typedef std::map vocache_entry_map_t; + typedef std::map > vocache_entry_map_t; + typedef std::set vocache_entry_set_t; protected: U32 mLocalID; @@ -68,6 +91,9 @@ protected: S32 mCRCChangeCount; LLDataPackerBinaryBuffer mDP; U8 *mBuffer; + + U32 mState; + std::vector mChildrenList; //children entries in a linked set. }; // -- 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.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvocache.h') diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 85538e8043..2228e3e43b 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -54,7 +54,7 @@ public: LLVOCacheEntry(LLAPRFile* apr_file); LLVOCacheEntry(); - void setState(U32 state) {mState = state;} + void setState(U32 state); bool isState(U32 state) {return mState == state;} U32 getState() const {return mState;} @@ -92,6 +92,8 @@ protected: LLDataPackerBinaryBuffer mDP; U8 *mBuffer; + S32 mVisFrameRange; + S32 mRepeatedVisCounter; //number of repeatedly visible within a short time. U32 mState; std::vector mChildrenList; //children entries in a linked set. }; -- 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.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/newview/llvocache.h') diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 2228e3e43b..675c12a3eb 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -98,6 +98,19 @@ protected: std::vector mChildrenList; //children entries in a linked set. }; +class LLVOCachePartition : public LLViewerOctreePartition +{ +public: + LLVOCachePartition(LLViewerRegion* regionp); + + void addEntry(LLViewerOctreeEntry* entry); + void removeEntry(LLViewerOctreeEntry* entry); + /*virtual*/ S32 cull(LLCamera &camera); + +private: + U32 mVisitedTime; +}; + // //Note: LLVOCache is not thread-safe // -- 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.h | 69 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 13 deletions(-) (limited to 'indra/newview/llvocache.h') diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 675c12a3eb..ded29dd990 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -36,17 +36,47 @@ //--------------------------------------------------------------------------- // Cache entries class LLVOCacheEntry; +class LLCamera; class LLVOCacheEntry : public LLViewerOctreeEntryData { public: enum { - INACTIVE = 0, - WAITING, - ACTIVE + INACTIVE = 0x00000000, //not visible + IN_QUEUE = 0x00000001, //in visible queue, object to be created + WAITING = 0x00000002, //object creation request sent + ACTIVE = 0x00000004 //object created, and in rendering pipeline. }; + enum + { + CHILD = 0x00010000, //has parent + BRIDGE_CHILD = 0x00020000 //is a child of a spatial bridge. + }; + + struct CompareVOCacheEntry + { + bool operator()(const LLVOCacheEntry* const& lhs, const LLVOCacheEntry* const& rhs) + { + F32 lpa = lhs->getSceneContribution(); + F32 rpa = rhs->getSceneContribution(); + + //larger pixel area first + if(lpa > rpa) + { + return true; + } + else if(lpa < rpa) + { + return false; + } + else + { + return lhs < rhs; + } + } + }; protected: ~LLVOCacheEntry(); public: @@ -55,33 +85,45 @@ public: LLVOCacheEntry(); void setState(U32 state); - bool isState(U32 state) {return mState == state;} - U32 getState() const {return mState;} + bool isState(U32 state) {return (mState & 0xffff) == state;} + U32 getState() const {return (mState & 0xffff);} + U32 getFullState() const {return mState;} + + void setBridgeChild(); + void clearBridgeChild(); + bool isBridgeChild() {return mState & BRIDGE_CHILD;} U32 getLocalID() const { return mLocalID; } U32 getCRC() const { return mCRC; } S32 getHitCount() const { return mHitCount; } S32 getCRCChangeCount() const { return mCRCChangeCount; } - S32 getMinVisFrameRange()const; + S32 getMinVisFrameRange()const; + U32 getParentID(); + + void calcSceneContribution(const LLVector3& camera_origin, bool needs_update, U32 last_update); + void setSceneContribution(F32 scene_contrib) {mSceneContrib = scene_contrib;} + F32 getSceneContribution() const { return mSceneContrib;} void dump() const; BOOL writeToFile(LLAPRFile* apr_file) const; - void assignCRC(U32 crc, LLDataPackerBinaryBuffer &dp); LLDataPackerBinaryBuffer *getDP(U32 crc); LLDataPackerBinaryBuffer *getDP(); void recordHit(); void recordDupe() { mDupeCount++; } + void copy(LLVOCacheEntry* entry); //copy variables /*virtual*/ void setOctreeEntry(LLViewerOctreeEntry* entry); void addChild(LLVOCacheEntry* entry); - LLVOCacheEntry* getNextChild(); - S32 getNumOfChildren() {return mChildrenList.size();} - bool isDummy() {return !mBuffer;} + LLVOCacheEntry* getChild(S32 i) {return mChildrenList[i];} + S32 getNumOfChildren() {return mChildrenList.size();} + void clearChildrenList() {mChildrenList.clear();} + bool isDummy() {return !mBuffer;} public: - typedef std::map > vocache_entry_map_t; - typedef std::set vocache_entry_set_t; + typedef std::map > vocache_entry_map_t; + typedef std::set vocache_entry_set_t; + typedef std::set vocache_entry_priority_list_t; protected: U32 mLocalID; @@ -92,9 +134,10 @@ protected: LLDataPackerBinaryBuffer mDP; U8 *mBuffer; + F32 mSceneContrib; //projected scene contributuion of this object. S32 mVisFrameRange; S32 mRepeatedVisCounter; //number of repeatedly visible within a short time. - U32 mState; + U32 mState; //high 16 bits reserved for special use. std::vector mChildrenList; //children entries in a linked set. }; -- 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.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvocache.h') diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index ded29dd990..4d058ffdac 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -111,7 +111,7 @@ public: void recordHit(); void recordDupe() { mDupeCount++; } - void copy(LLVOCacheEntry* entry); //copy variables + void copyTo(LLVOCacheEntry* new_entry); //copy variables /*virtual*/ void setOctreeEntry(LLViewerOctreeEntry* entry); void addChild(LLVOCacheEntry* entry); -- 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.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llvocache.h') diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 4d058ffdac..f5cc5d2f75 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -98,7 +98,6 @@ public: S32 getHitCount() const { return mHitCount; } S32 getCRCChangeCount() const { return mCRCChangeCount; } S32 getMinVisFrameRange()const; - U32 getParentID(); void calcSceneContribution(const LLVector3& camera_origin, bool needs_update, U32 last_update); void setSceneContribution(F32 scene_contrib) {mSceneContrib = scene_contrib;} @@ -118,7 +117,6 @@ public: LLVOCacheEntry* getChild(S32 i) {return mChildrenList[i];} S32 getNumOfChildren() {return mChildrenList.size();} void clearChildrenList() {mChildrenList.clear();} - bool isDummy() {return !mBuffer;} public: typedef std::map > vocache_entry_map_t; -- 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.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'indra/newview/llvocache.h') diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index f5cc5d2f75..c631e12739 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -51,8 +51,7 @@ public: enum { - CHILD = 0x00010000, //has parent - BRIDGE_CHILD = 0x00020000 //is a child of a spatial bridge. + ADD_TO_CACHE_TREE = 0x00010000, //has parent }; struct CompareVOCacheEntry @@ -85,14 +84,13 @@ public: LLVOCacheEntry(); void setState(U32 state); - bool isState(U32 state) {return (mState & 0xffff) == state;} - U32 getState() const {return (mState & 0xffff);} - U32 getFullState() const {return mState;} - - void setBridgeChild(); - void clearBridgeChild(); - bool isBridgeChild() {return mState & BRIDGE_CHILD;} - + void clearState(U32 state) {mState &= ~state;} + void addState(U32 state) {mState |= state;} + bool isState(U32 state) {return (mState & 0xffff) == state;} + bool hasState(U32 state) {return mState & state;} + U32 getState() const {return (mState & 0xffff);} + U32 getFullState() const {return mState;} + U32 getLocalID() const { return mLocalID; } U32 getCRC() const { return mCRC; } S32 getHitCount() const { return mHitCount; } -- cgit v1.2.3