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/llvieweroctree.h | 274 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 indra/newview/llvieweroctree.h (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h new file mode 100644 index 0000000000..c063e96ea5 --- /dev/null +++ b/indra/newview/llvieweroctree.h @@ -0,0 +1,274 @@ +/** + * @file llvieweroctree.h + * @brief LLViewerObjectOctree.cpp header file, defining all supporting classes. + * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_VIEWEROCTREE_H +#define LL_VIEWEROCTREE_H + +#include +#include + +#include "v2math.h" +#include "v3math.h" +#include "v4math.h" +#include "m4math.h" +#include "llvector4a.h" +#include "llquaternion.h" +#include "lloctree.h" +#include "llcamera.h" + +class LLViewerOctreeEntryData; +class LLviewerOctreeGroup; +class LLViewerOctreeEntry; + +typedef LLOctreeListener OctreeListener; +typedef LLTreeNode TreeNode; +typedef LLOctreeNode OctreeNode; +typedef LLOctreeRoot OctreeRoot; +typedef LLOctreeTraveler OctreeTraveler; + +S32 AABBSphereIntersect(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &rad); +S32 AABBSphereIntersectR2(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &radius_squared); + +S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &rad); +S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared); + +//defines data needed for octree of an entry +LL_ALIGN_PREFIX(16) +class LLViewerOctreeEntry : public LLRefCount +{ + friend class LLViewerOctreeEntryData; + +public: + typedef enum + { + LLDRAWABLE = 0, + LLVOCACHEENTRY, + NUM_DATA_TYPE + }eEntryDataType_t; + + ~LLViewerOctreeEntry(); +public: + LLViewerOctreeEntry(); + + void nullGroup(); //called by group handleDestruction() only + void setGroup(LLviewerOctreeGroup* group); + void removeData(LLViewerOctreeEntryData* data); + + LLViewerOctreeEntryData* getData(U32 data_type)const {return mData[data_type];} + bool hasData(U32 data_type)const {return mData[data_type] != NULL;} + + LLViewerOctreeEntryData* getDrawable() const {return mData[LLDRAWABLE];} + bool hasDrawable() const {return mData[LLDRAWABLE] != NULL;} + LLViewerOctreeEntryData* getVOCacheEntry() const {return mData[LLVOCACHEENTRY];} + bool hasVOCacheEntry() const {return mData[LLVOCACHEENTRY] != NULL;} + + const LLVector4a* getSpatialExtents() const {return mExtents;} + const LLVector4a& getPositionGroup() const {return mPositionGroup;} + LLviewerOctreeGroup* getGroup()const {return mGroup;} + + F32 getBinRadius() const {return mBinRadius;} + S32 getBinIndex() const {return mBinIndex; } + void setBinIndex(S32 index) const {mBinIndex = index; } + +private: + void addData(LLViewerOctreeEntryData* data); + +private: + LLViewerOctreeEntryData* mData[NUM_DATA_TYPE]; //do not use LLPointer here. + LLviewerOctreeGroup* mGroup; + + //aligned members + LL_ALIGN_16(LLVector4a mExtents[2]); + LL_ALIGN_16(LLVector4a mPositionGroup); + F32 mBinRadius; + mutable S32 mBinIndex; + mutable U32 mVisible; + +} LL_ALIGN_POSTFIX(16); + +//defines an abstract class for entry data +LL_ALIGN_PREFIX(16) +class LLViewerOctreeEntryData : public LLRefCount +{ +protected: + ~LLViewerOctreeEntryData(); + +public: + LLViewerOctreeEntryData(const LLViewerOctreeEntryData& rhs) + { + *this = rhs; + } + LLViewerOctreeEntryData(LLViewerOctreeEntry::eEntryDataType_t data_type); + + LLViewerOctreeEntry::eEntryDataType_t getDataType() const {return mDataType;} + LLViewerOctreeEntry* getEntry() {return mEntry;} + + virtual void setOctreeEntry(LLViewerOctreeEntry* entry); + + virtual S32 getMinVisFrameRange()const = 0; + + F32 getBinRadius() const {return mEntry->getBinRadius();} + const LLVector4a* getSpatialExtents() const; + LLviewerOctreeGroup* getGroup()const; + const LLVector4a& getPositionGroup() const; + + void setBinRadius(F32 rad) {mEntry->mBinRadius = rad;} + void setSpatialExtents(const LLVector3& min, const LLVector3& max); + void setSpatialExtents(const LLVector4a& min, const LLVector4a& max); + void setPositionGroup(const LLVector4a& pos); + + virtual void setGroup(LLviewerOctreeGroup* group); + void shift(const LLVector4a &shift_vector); + + U32 getVisible() const {return mEntry ? mEntry->mVisible : 0;} + void setVisible() const; + virtual bool isVisible() const; + virtual bool isRecentlyVisible() const; + + static S32 getCurrentFrame() { return sCurVisible; } + +protected: + LLVector4a& getGroupPosition() {return mEntry->mPositionGroup;} + void initVisible(U32 visible) {mEntry->mVisible = visible;} + + static void incrementVisible() {sCurVisible++;} +protected: + LLPointer mEntry; + LLViewerOctreeEntry::eEntryDataType_t mDataType; + static U32 sCurVisible; // Counter for what value of mVisible means currently visible +}LL_ALIGN_POSTFIX(16); + + +//defines an octree group for an octree node, which contains multiple entries. +LL_ALIGN_PREFIX(16) +class LLviewerOctreeGroup : public LLOctreeListener +{ + friend class LLViewerOctreeCull; +protected: + ~LLviewerOctreeGroup(); + +public: + enum + { + CLEAN = 0x00000000, + DIRTY = 0x00000001, + OBJECT_DIRTY = 0x00000002, + SKIP_FRUSTUM_CHECK = 0x00000004, + INVALID_STATE = 0x00000008, + }; + +public: + LLviewerOctreeGroup(OctreeNode* node); + LLviewerOctreeGroup(const LLviewerOctreeGroup& rhs) + { + *this = rhs; + } + + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + + bool removeFromGroup(LLViewerOctreeEntryData* data); + bool removeFromGroup(LLViewerOctreeEntry* entry); + + virtual void unbound(); + virtual void rebound(); + + virtual BOOL isVisible() const; + virtual BOOL isRecentlyVisible() const = 0; + + U32 getState() {return mState; } + bool isDirty() const {return mState & DIRTY;} + bool hasState(U32 state) const {return mState & state;} + void setState(U32 state) {mState |= state;} + void clearState(U32 state) {mState &= ~state;} + + //LISTENER FUNCTIONS + virtual void handleInsertion(const TreeNode* node, LLViewerOctreeEntry* obj); + virtual void handleRemoval(const TreeNode* node, LLViewerOctreeEntry* obj); + virtual void handleDestruction(const TreeNode* node); + virtual void handleStateChange(const TreeNode* node); + virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); + virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child); + + OctreeNode* getOctreeNode() {return mOctreeNode;} + LLviewerOctreeGroup* getParent(); + + const LLVector4a* getBounds() const {return mBounds;} + const LLVector4a* getExtents() const {return mExtents;} + const LLVector4a* getObjectBounds() const {return mObjectBounds;} + const LLVector4a* getObjectExtents() const {return mObjectExtents;} + +private: + virtual bool boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut); + +protected: + U32 mState; + OctreeNode* mOctreeNode; + + LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects) + LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node + LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children + LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node + +}LL_ALIGN_POSTFIX(16); + +class LLViewerOctreeCull : public OctreeTraveler +{ +public: + LLViewerOctreeCull(LLCamera* camera) + : mCamera(camera), mRes(0) { } + + virtual bool earlyFail(LLviewerOctreeGroup* group); + virtual void traverse(const OctreeNode* n); + + S32 AABBInFrustumNoFarClipGroupBounds(const LLviewerOctreeGroup* group); + S32 AABBSphereIntersectGroupExtents(const LLviewerOctreeGroup* group); + S32 AABBInFrustumNoFarClipObjectBounds(const LLviewerOctreeGroup* group); + S32 AABBSphereIntersectObjectExtents(const LLviewerOctreeGroup* group); + S32 AABBInFrustumGroupBounds(const LLviewerOctreeGroup* group); + S32 AABBInFrustumObjectBounds(const LLviewerOctreeGroup* group); + + virtual S32 frustumCheck(const LLviewerOctreeGroup* group) = 0; + virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group) = 0; + + virtual bool checkObjects(const OctreeNode* branch, const LLviewerOctreeGroup* group); + virtual void preprocess(LLviewerOctreeGroup* group); + virtual void processGroup(LLviewerOctreeGroup* group); + virtual void visit(const OctreeNode* branch); + +protected: + LLCamera *mCamera; + S32 mRes; +}; + +#endif \ No newline at end of file -- 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/llvieweroctree.h | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index c063e96ea5..498ec3e75d 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -37,8 +37,9 @@ #include "llvector4a.h" #include "llquaternion.h" #include "lloctree.h" -#include "llcamera.h" +#include "llviewercamera.h" +class LLViewerRegion; class LLViewerOctreeEntryData; class LLviewerOctreeGroup; class LLViewerOctreeEntry; @@ -181,6 +182,9 @@ public: }; public: + typedef LLOctreeNode::element_iter element_iter; + typedef LLOctreeNode::element_list element_list; + LLviewerOctreeGroup(OctreeNode* node); LLviewerOctreeGroup(const LLviewerOctreeGroup& rhs) { @@ -203,8 +207,10 @@ public: virtual void unbound(); virtual void rebound(); - virtual BOOL isVisible() const; - virtual BOOL isRecentlyVisible() const = 0; + void setVisible(); + BOOL isVisible() const; + virtual BOOL isRecentlyVisible() const; + bool isEmpty() const { return mOctreeNode->isEmpty(); } U32 getState() {return mState; } bool isDirty() const {return mState & DIRTY;} @@ -228,20 +234,43 @@ public: const LLVector4a* getObjectBounds() const {return mObjectBounds;} const LLVector4a* getObjectExtents() const {return mObjectExtents;} + //octree wrappers to make code more readable + element_list& getData() { return mOctreeNode->getData(); } + element_iter getDataBegin() { return mOctreeNode->getDataBegin(); } + element_iter getDataEnd() { return mOctreeNode->getDataEnd(); } + U32 getElementCount() const { return mOctreeNode->getElementCount(); } + private: virtual bool boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut); protected: U32 mState; - OctreeNode* mOctreeNode; - + OctreeNode* mOctreeNode; + LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects) LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node +public: + S32 mVisible[LLViewerCamera::NUM_CAMERAS]; }LL_ALIGN_POSTFIX(16); +class LLViewerOctreePartition +{ +public: + LLViewerOctreePartition(); + virtual ~LLViewerOctreePartition(); + + // Cull on arbitrary frustum + virtual S32 cull(LLCamera &camera) = 0; + +public: + U32 mPartitionType; + OctreeNode* mOctree; + LLViewerRegion* mRegionp; // the region this partition belongs to. +}; + class LLViewerOctreeCull : public OctreeTraveler { public: -- 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/llvieweroctree.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 498ec3e75d..b89014119c 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -135,7 +135,7 @@ public: const LLVector4a* getSpatialExtents() const; LLviewerOctreeGroup* getGroup()const; const LLVector4a& getPositionGroup() const; - + void setBinRadius(F32 rad) {mEntry->mBinRadius = rad;} void setSpatialExtents(const LLVector3& min, const LLVector3& max); void setSpatialExtents(const LLVector4a& min, const LLVector4a& max); @@ -247,9 +247,9 @@ protected: U32 mState; OctreeNode* mOctreeNode; - LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects) - LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node - LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children + LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects) + LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node + LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node public: -- 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/llvieweroctree.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index b89014119c..f6ad3ac327 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -280,13 +280,26 @@ public: virtual bool earlyFail(LLviewerOctreeGroup* group); virtual void traverse(const OctreeNode* n); - S32 AABBInFrustumNoFarClipGroupBounds(const LLviewerOctreeGroup* group); + //agent space group cull + S32 AABBInFrustumNoFarClipGroupBounds(const LLviewerOctreeGroup* group); S32 AABBSphereIntersectGroupExtents(const LLviewerOctreeGroup* group); - S32 AABBInFrustumNoFarClipObjectBounds(const LLviewerOctreeGroup* group); - S32 AABBSphereIntersectObjectExtents(const LLviewerOctreeGroup* group); S32 AABBInFrustumGroupBounds(const LLviewerOctreeGroup* group); + + //agent space object set cull + S32 AABBInFrustumNoFarClipObjectBounds(const LLviewerOctreeGroup* group); + S32 AABBSphereIntersectObjectExtents(const LLviewerOctreeGroup* group); S32 AABBInFrustumObjectBounds(const LLviewerOctreeGroup* group); + //local region space group cull + S32 AABBInRegionFrustumNoFarClipGroupBounds(const LLviewerOctreeGroup* group); + S32 AABBInRegionFrustumGroupBounds(const LLviewerOctreeGroup* group); + S32 AABBRegionSphereIntersectGroupExtents(const LLviewerOctreeGroup* group, const LLVector3& shift); + + //local region space object set cull + S32 AABBInRegionFrustumNoFarClipObjectBounds(const LLviewerOctreeGroup* group); + S32 AABBInRegionFrustumObjectBounds(const LLviewerOctreeGroup* group); + S32 AABBRegionSphereIntersectObjectExtents(const LLviewerOctreeGroup* group, const LLVector3& shift); + virtual S32 frustumCheck(const LLviewerOctreeGroup* group) = 0; virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group) = 0; -- cgit v1.2.3 From 7cc37d949e9319a5b60641ff8453a0fed763d817 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 9 Jan 2013 22:43:10 -0700 Subject: fix the merge errors from the changeset 3eadda9666cf --- indra/newview/llvieweroctree.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index f6ad3ac327..5bcaeb85da 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -94,6 +94,16 @@ public: S32 getBinIndex() const {return mBinIndex; } void setBinIndex(S32 index) const {mBinIndex = index; } + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } + private: void addData(LLViewerOctreeEntryData* data); @@ -238,8 +248,9 @@ public: element_list& getData() { return mOctreeNode->getData(); } element_iter getDataBegin() { return mOctreeNode->getDataBegin(); } element_iter getDataEnd() { return mOctreeNode->getDataEnd(); } - U32 getElementCount() const { return mOctreeNode->getElementCount(); } - + U32 getElementCount() const { return mOctreeNode->getElementCount(); } + bool hasElement(LLViewerOctreeEntryData* data); + private: virtual bool boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut); -- cgit v1.2.3 From 0c3df70dffdc6b19abaa91bfd14f2d08a66e95dd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 9 Jan 2013 23:15:32 -0800 Subject: added newline to fix gcc builds --- indra/newview/llvieweroctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 5bcaeb85da..a35c551949 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -324,4 +324,4 @@ protected: S32 mRes; }; -#endif \ No newline at end of file +#endif -- cgit v1.2.3 From b4967dfa4f3817c890644cb9a545264b65fd747a Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 4 Apr 2013 15:48:15 -0600 Subject: add debug code for LLViewerOctree --- indra/newview/llvieweroctree.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index a35c551949..21cc934d77 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -324,4 +324,15 @@ protected: S32 mRes; }; +//scan the octree, output the info of each node for debug use. +class LLViewerOctreeDebug : public OctreeTraveler +{ +public: + virtual void processGroup(LLviewerOctreeGroup* group); + virtual void visit(const OctreeNode* branch); + +public: + static BOOL sInDebug; +}; + #endif -- cgit v1.2.3 From dd1ad64fc45503ed816824d3631c82eeff22c286 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 10 Apr 2013 11:40:11 -0600 Subject: trivial: convert to unix line endings. --- indra/newview/llvieweroctree.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 21cc934d77..b6faf4c7ba 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -324,15 +324,15 @@ protected: S32 mRes; }; -//scan the octree, output the info of each node for debug use. -class LLViewerOctreeDebug : public OctreeTraveler -{ -public: - virtual void processGroup(LLviewerOctreeGroup* group); - virtual void visit(const OctreeNode* branch); - -public: - static BOOL sInDebug; +//scan the octree, output the info of each node for debug use. +class LLViewerOctreeDebug : public OctreeTraveler +{ +public: + virtual void processGroup(LLviewerOctreeGroup* group); + virtual void visit(const OctreeNode* branch); + +public: + static BOOL sInDebug; }; #endif -- 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/llvieweroctree.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index b6faf4c7ba..2f601d66f3 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -78,9 +78,6 @@ public: void setGroup(LLviewerOctreeGroup* group); void removeData(LLViewerOctreeEntryData* data); - LLViewerOctreeEntryData* getData(U32 data_type)const {return mData[data_type];} - bool hasData(U32 data_type)const {return mData[data_type] != NULL;} - LLViewerOctreeEntryData* getDrawable() const {return mData[LLDRAWABLE];} bool hasDrawable() const {return mData[LLDRAWABLE] != NULL;} LLViewerOctreeEntryData* getVOCacheEntry() const {return mData[LLVOCACHEENTRY];} -- cgit v1.2.3 From 16616ae48d86da75b3809fa6be6c846a9d420603 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 23 May 2013 18:25:21 -0600 Subject: for SH-4145: Interesting: Implement occlusion culling for object cache --- indra/newview/llvieweroctree.h | 99 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 93 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index b6faf4c7ba..ed77e4bb7e 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -43,6 +43,7 @@ class LLViewerRegion; class LLViewerOctreeEntryData; class LLviewerOctreeGroup; class LLViewerOctreeEntry; +class LLViewerOctreePartition; typedef LLOctreeListener OctreeListener; typedef LLTreeNode TreeNode; @@ -50,6 +51,18 @@ typedef LLOctreeNode OctreeNode; typedef LLOctreeRoot OctreeRoot; typedef LLOctreeTraveler OctreeTraveler; +#if LL_OCTREE_PARANOIA_CHECK +#define assert_octree_valid(x) x->validate() +#define assert_states_valid(x) ((LLviewerOctreeGroup*) x->mSpatialPartition->mOctree->getListener(0))->checkStates() +#else +#define assert_octree_valid(x) +#define assert_states_valid(x) +#endif + +// get index buffer for binary encoded axis vertex buffer given a box at center being viewed by given camera +U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center); +U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center); + S32 AABBSphereIntersect(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &rad); S32 AABBSphereIntersectR2(const LLVector4a& min, const LLVector4a& max, const LLVector3 &origin, const F32 &radius_squared); @@ -181,14 +194,15 @@ class LLviewerOctreeGroup : public LLOctreeListener protected: ~LLviewerOctreeGroup(); -public: +public: enum { CLEAN = 0x00000000, DIRTY = 0x00000001, OBJECT_DIRTY = 0x00000002, SKIP_FRUSTUM_CHECK = 0x00000004, - INVALID_STATE = 0x00000008, + DEAD = 0x00000008, + INVALID_STATE = 0x00000010, }; public: @@ -216,6 +230,8 @@ public: virtual void unbound(); virtual void rebound(); + + BOOL isDead() { return hasState(DEAD); } void setVisible(); BOOL isVisible() const; @@ -251,9 +267,11 @@ public: U32 getElementCount() const { return mOctreeNode->getElementCount(); } bool hasElement(LLViewerOctreeEntryData* data); +protected: + void checkStates(); private: - virtual bool boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut); - + virtual bool boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& maxOut); + protected: U32 mState; OctreeNode* mOctreeNode; @@ -261,12 +279,76 @@ protected: LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects) LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children - LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node + LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node public: - S32 mVisible[LLViewerCamera::NUM_CAMERAS]; + S32 mVisible[LLViewerCamera::NUM_CAMERAS]; + }LL_ALIGN_POSTFIX(16); +//octree group which has capability to support occlusion culling +//LL_ALIGN_PREFIX(16) +class LLOcclusionCullingGroup : public LLviewerOctreeGroup +{ +public: + typedef enum + { + OCCLUDED = 0x00010000, + QUERY_PENDING = 0x00020000, + ACTIVE_OCCLUSION = 0x00040000, + DISCARD_QUERY = 0x00080000, + EARLY_FAIL = 0x00100000, + } eOcclusionState; + + typedef enum + { + STATE_MODE_SINGLE = 0, //set one node + STATE_MODE_BRANCH, //set entire branch + STATE_MODE_DIFF, //set entire branch as long as current state is different + STATE_MODE_ALL_CAMERAS, //used for occlusion state, set state for all cameras + } eSetStateMode; + +public: + LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part); + LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLviewerOctreeGroup(rhs) + { + *this = rhs; + } + ~LLOcclusionCullingGroup(); + + void setOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); + void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); + void checkOcclusion(); //read back last occlusion query (if any) + void doOcclusion(LLCamera* camera); //issue occlusion query + BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } + + BOOL needsUpdate(); + + //virtual + void handleChildAddition(const OctreeNode* parent, OctreeNode* child); + + static U32 getNewOcclusionQueryObjectName(); + static void releaseOcclusionQueryObjectName(U32 name); + +protected: + void releaseOcclusionQueryObjectNames(); + +private: + BOOL earlyFail(LLCamera* camera); + +protected: + U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS]; + U32 mOcclusionIssued[LLViewerCamera::NUM_CAMERAS]; + + S32 mLODHash; + + LLViewerOctreePartition* mSpatialPartition; + U32 mOcclusionQuery[LLViewerCamera::NUM_CAMERAS]; + +public: + static std::set sPendingQueries; +};//LL_ALIGN_POSTFIX(16); + class LLViewerOctreePartition { public: @@ -275,11 +357,16 @@ public: // Cull on arbitrary frustum virtual S32 cull(LLCamera &camera) = 0; + BOOL isOcclusionEnabled(); public: U32 mPartitionType; + U32 mDrawableType; OctreeNode* mOctree; LLViewerRegion* mRegionp; // the region this partition belongs to. + BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed + U32 mLODSeed; + U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed) }; class LLViewerOctreeCull : public OctreeTraveler -- cgit v1.2.3 From 6827febd3027decb1bd8da013b6af413114239a9 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 28 May 2013 14:55:37 -0600 Subject: change the way to handle creating/destroying a same object repeatedly --- indra/newview/llvieweroctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 1d3533e95c..0a96676be1 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -149,7 +149,7 @@ public: virtual void setOctreeEntry(LLViewerOctreeEntry* entry); - virtual S32 getMinVisFrameRange()const = 0; + virtual S32 getMinFrameRange()const = 0; F32 getBinRadius() const {return mEntry->getBinRadius();} const LLVector4a* getSpatialExtents() const; -- cgit v1.2.3 From 9ed2f4d3cb02d5161bd8bb77cb7befa7feedf2d9 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 17 Jun 2013 15:24:15 -0600 Subject: add a debug setting "InvisibleObjectsInMemoryTime" to adjust the time invisible objects stay in memory. --- indra/newview/llvieweroctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 0a96676be1..7f2ca6ed2d 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -149,7 +149,7 @@ public: virtual void setOctreeEntry(LLViewerOctreeEntry* entry); - virtual S32 getMinFrameRange()const = 0; + virtual U32 getMinFrameRange()const = 0; F32 getBinRadius() const {return mEntry->getBinRadius();} const LLVector4a* getSpatialExtents() const; -- cgit v1.2.3 From d95d69cbc4063fae1d93ce2f0c4d22d3ef9c8edd Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 24 Jun 2013 11:42:32 -0600 Subject: fix for SH-4284: interesting: viewer does not render cacheable objects on far corner of region when camera moves --- indra/newview/llvieweroctree.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 7f2ca6ed2d..e210d8f478 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -320,6 +320,7 @@ public: BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } BOOL needsUpdate(); + U32 getLastOcclusionIssuedTime(); //virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); -- cgit v1.2.3 From 88fee7f87fc4a987a05002fedfcae11d6b42ba59 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 26 Jun 2013 17:08:03 -0600 Subject: more fix for SH-4284: interesting: viewer does not render cacheable objects on far corner of region when camera moves --- indra/newview/llvieweroctree.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index e210d8f478..980a67367c 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -316,7 +316,7 @@ public: void setOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); void checkOcclusion(); //read back last occlusion query (if any) - void doOcclusion(LLCamera* camera); //issue occlusion query + void doOcclusion(LLCamera* camera, const LLVector3* region_agent = NULL); //issue occlusion query BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } BOOL needsUpdate(); @@ -332,7 +332,7 @@ protected: void releaseOcclusionQueryObjectNames(); private: - BOOL earlyFail(LLCamera* camera); + BOOL earlyFail(LLCamera* camera, const LLVector4a* bounds); protected: U32 mOcclusionState[LLViewerCamera::NUM_CAMERAS]; -- 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/llvieweroctree.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 980a67367c..7c85231ce0 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -317,14 +317,17 @@ public: void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); void checkOcclusion(); //read back last occlusion query (if any) void doOcclusion(LLCamera* camera, const LLVector3* region_agent = NULL); //issue occlusion query - BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } - + BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } + BOOL needsUpdate(); U32 getLastOcclusionIssuedTime(); //virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); + //virtual + BOOL isRecentlyVisible() const; + static U32 getNewOcclusionQueryObjectName(); static void releaseOcclusionQueryObjectName(U32 name); -- 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/llvieweroctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 7c85231ce0..7fdb5661d8 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -357,7 +357,7 @@ public: virtual ~LLViewerOctreePartition(); // Cull on arbitrary frustum - virtual S32 cull(LLCamera &camera) = 0; + virtual S32 cull(LLCamera &camera, bool do_occlusion) = 0; BOOL isOcclusionEnabled(); public: -- cgit v1.2.3 From 31bf481a7b5f079d95be6a44a45502bb957e0941 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 21 Aug 2013 10:19:44 -0600 Subject: fix some objects not rendered when login process is very long --- indra/newview/llvieweroctree.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 7fdb5661d8..0cd0206223 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -327,6 +327,7 @@ public: //virtual BOOL isRecentlyVisible() const; + LLViewerOctreePartition* getSpatialPartition()const {return mSpatialPartition;} static U32 getNewOcclusionQueryObjectName(); static void releaseOcclusionQueryObjectName(U32 name); -- cgit v1.2.3 From 7b5618aeaeb4df31bd3f9436e067b26fb5be866b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 22 Aug 2013 12:22:34 -0600 Subject: fix for SH-4400: Interesting: Side effect 1 of unloading culled objects. --- indra/newview/llvieweroctree.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 0cd0206223..e610db96eb 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -149,8 +149,6 @@ public: virtual void setOctreeEntry(LLViewerOctreeEntry* entry); - virtual U32 getMinFrameRange()const = 0; - F32 getBinRadius() const {return mEntry->getBinRadius();} const LLVector4a* getSpatialExtents() const; LLviewerOctreeGroup* getGroup()const; -- cgit v1.2.3 From cbe397ad13665c7bc993e10d8fe1e4a876253378 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 5 Sep 2013 14:04:13 -0700 Subject: changed fast timer over to using macro another attempt to move mem stat into base class --- indra/newview/llvieweroctree.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index e610db96eb..342d149491 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -210,15 +210,15 @@ public: *this = rhs; } - void* operator new(size_t size) - { - return ll_aligned_malloc_16(size); - } - - void operator delete(void* ptr) - { - ll_aligned_free_16(ptr); - } + //void* operator new(size_t size) + //{ + // return ll_aligned_malloc_16(size); + //} + + //void operator delete(void* ptr) + //{ + // ll_aligned_free_16(ptr); + //} bool removeFromGroup(LLViewerOctreeEntryData* data); bool removeFromGroup(LLViewerOctreeEntry* entry); -- cgit v1.2.3 From f04fe8010ab1a0c980ecd197f37da66a7fda0ad6 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 9 Sep 2013 11:25:10 -0600 Subject: cancel redundant memory alignments for some base classes to get better memory performance --- indra/newview/llvieweroctree.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index e610db96eb..97dc1d4a0a 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -70,7 +70,7 @@ S32 AABBSphereIntersect(const LLVector3& min, const LLVector3& max, const LLVect S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVector3 &origin, const F32 &radius_squared); //defines data needed for octree of an entry -LL_ALIGN_PREFIX(16) +//LL_ALIGN_PREFIX(16) class LLViewerOctreeEntry : public LLRefCount { friend class LLViewerOctreeEntryData; @@ -128,10 +128,10 @@ private: mutable S32 mBinIndex; mutable U32 mVisible; -} LL_ALIGN_POSTFIX(16); +} ;//LL_ALIGN_POSTFIX(16); //defines an abstract class for entry data -LL_ALIGN_PREFIX(16) +//LL_ALIGN_PREFIX(16) class LLViewerOctreeEntryData : public LLRefCount { protected: @@ -178,11 +178,11 @@ protected: LLPointer mEntry; LLViewerOctreeEntry::eEntryDataType_t mDataType; static U32 sCurVisible; // Counter for what value of mVisible means currently visible -}LL_ALIGN_POSTFIX(16); +};//LL_ALIGN_POSTFIX(16); //defines an octree group for an octree node, which contains multiple entries. -LL_ALIGN_PREFIX(16) +//LL_ALIGN_PREFIX(16) class LLviewerOctreeGroup : public LLOctreeListener { friend class LLViewerOctreeCull; @@ -279,7 +279,7 @@ protected: public: S32 mVisible[LLViewerCamera::NUM_CAMERAS]; -}LL_ALIGN_POSTFIX(16); +};//LL_ALIGN_POSTFIX(16); //octree group which has capability to support occlusion culling //LL_ALIGN_PREFIX(16) -- cgit v1.2.3 From 504c645ab6f13d0df35c714534d714e28f9e7534 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 9 Sep 2013 15:54:33 -0600 Subject: fix a login crash --- indra/newview/llvieweroctree.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 5e3cac260a..97dc1d4a0a 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -210,15 +210,15 @@ public: *this = rhs; } - //void* operator new(size_t size) - //{ - // return ll_aligned_malloc_16(size); - //} - - //void operator delete(void* ptr) - //{ - // ll_aligned_free_16(ptr); - //} + void* operator new(size_t size) + { + return ll_aligned_malloc_16(size); + } + + void operator delete(void* ptr) + { + ll_aligned_free_16(ptr); + } bool removeFromGroup(LLViewerOctreeEntryData* data); bool removeFromGroup(LLViewerOctreeEntry* entry); -- cgit v1.2.3 From 605060ea022670f4ff6f8850f79495032095b58e Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 12 Sep 2013 16:40:18 -0600 Subject: fix for SH-4477: Interesting: objects on adjacent region are not visible. #3 and SH-4457: Interesting: nearby content on adjacent region is not visible. --- indra/newview/llvieweroctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 97dc1d4a0a..bc3c7cbfa2 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -314,7 +314,7 @@ public: void setOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); void checkOcclusion(); //read back last occlusion query (if any) - void doOcclusion(LLCamera* camera, const LLVector3* region_agent = NULL); //issue occlusion query + void doOcclusion(LLCamera* camera, const LLVector4a* shift = NULL); //issue occlusion query BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } BOOL needsUpdate(); -- cgit v1.2.3 From 053d97db1b283ca2548dc1f64756ddfc5166158f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 25 Sep 2013 19:12:35 -0700 Subject: better memory usage for LLTrace (tighter packing of recording arrays) removed complicated and unnecessary fast timer gapless handoff logic (it should be gapless anyway) improved MemTrackable API, better separation of shadow and footprint added memory usage stats to floater_stats.xml --- indra/newview/llvieweroctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index bc3c7cbfa2..6ebd1d6da1 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -135,7 +135,7 @@ private: class LLViewerOctreeEntryData : public LLRefCount { protected: - ~LLViewerOctreeEntryData(); + virtual ~LLViewerOctreeEntryData(); public: LLViewerOctreeEntryData(const LLViewerOctreeEntryData& rhs) -- cgit v1.2.3 From 50c8c0fc7869f3babdfd1bb6c8dd72eefdba812d Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 2 Oct 2013 17:55:16 -0600 Subject: fix for SH-4521: Interesting viewer crash in Pipeline:RenderDrawPools --- indra/newview/llvieweroctree.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 6ebd1d6da1..174af5e22f 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -83,7 +83,9 @@ public: NUM_DATA_TYPE }eEntryDataType_t; - ~LLViewerOctreeEntry(); +protected: + virtual ~LLViewerOctreeEntry(); + public: LLViewerOctreeEntry(); @@ -187,7 +189,7 @@ class LLviewerOctreeGroup : public LLOctreeListener { friend class LLViewerOctreeCull; protected: - ~LLviewerOctreeGroup(); + virtual ~LLviewerOctreeGroup(); public: enum @@ -303,13 +305,15 @@ public: STATE_MODE_ALL_CAMERAS, //used for occlusion state, set state for all cameras } eSetStateMode; +protected: + virtual ~LLOcclusionCullingGroup(); + public: LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part); LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLviewerOctreeGroup(rhs) { *this = rhs; - } - ~LLOcclusionCullingGroup(); + } void setOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); void clearOcclusionState(U32 state, S32 mode = STATE_MODE_SINGLE); -- cgit v1.2.3 From b0aa408a665ce61ff374f99e421812482fe53848 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 4 Oct 2013 11:09:29 -0600 Subject: fix for SH-4544: Interesting: Shadows from platforms above the camera flicker --- indra/newview/llvieweroctree.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 174af5e22f..90870baaea 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -233,6 +233,7 @@ public: void setVisible(); BOOL isVisible() const; virtual BOOL isRecentlyVisible() const; + S32 getVisible(LLViewerCamera::eCameraID id) const {return mVisible[id];} bool isEmpty() const { return mOctreeNode->isEmpty(); } U32 getState() {return mState; } @@ -278,7 +279,7 @@ protected: LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node -public: + S32 mAnyVisible; //latest visible to any camera S32 mVisible[LLViewerCamera::NUM_CAMERAS]; };//LL_ALIGN_POSTFIX(16); @@ -330,6 +331,7 @@ public: //virtual BOOL isRecentlyVisible() const; LLViewerOctreePartition* getSpatialPartition()const {return mSpatialPartition;} + BOOL isAnyRecentlyVisible() const; static U32 getNewOcclusionQueryObjectName(); static void releaseOcclusionQueryObjectName(U32 name); -- 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/llvieweroctree.h | 90 +++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 54 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 174af5e22f..1eaa1b931e 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -41,7 +41,7 @@ class LLViewerRegion; class LLViewerOctreeEntryData; -class LLviewerOctreeGroup; +class LLViewerOctreeGroup; class LLViewerOctreeEntry; class LLViewerOctreePartition; @@ -53,7 +53,7 @@ typedef LLOctreeTraveler OctreeTraveler; #if LL_OCTREE_PARANOIA_CHECK #define assert_octree_valid(x) x->validate() -#define assert_states_valid(x) ((LLviewerOctreeGroup*) x->mSpatialPartition->mOctree->getListener(0))->checkStates() +#define assert_states_valid(x) ((LLViewerOctreeGroup*) x->mSpatialPartition->mOctree->getListener(0))->checkStates() #else #define assert_octree_valid(x) #define assert_states_valid(x) @@ -71,7 +71,7 @@ S32 AABBSphereIntersectR2(const LLVector3& min, const LLVector3& max, const LLVe //defines data needed for octree of an entry //LL_ALIGN_PREFIX(16) -class LLViewerOctreeEntry : public LLRefCount +class LLViewerOctreeEntry : public LLRefCount, public LLTrace::MemTrackable { friend class LLViewerOctreeEntryData; @@ -90,7 +90,7 @@ public: LLViewerOctreeEntry(); void nullGroup(); //called by group handleDestruction() only - void setGroup(LLviewerOctreeGroup* group); + void setGroup(LLViewerOctreeGroup* group); void removeData(LLViewerOctreeEntryData* data); LLViewerOctreeEntryData* getDrawable() const {return mData[LLDRAWABLE];} @@ -100,28 +100,18 @@ public: const LLVector4a* getSpatialExtents() const {return mExtents;} const LLVector4a& getPositionGroup() const {return mPositionGroup;} - LLviewerOctreeGroup* getGroup()const {return mGroup;} + LLViewerOctreeGroup* getGroup()const {return mGroup;} F32 getBinRadius() const {return mBinRadius;} S32 getBinIndex() const {return mBinIndex; } void setBinIndex(S32 index) const {mBinIndex = index; } - void* operator new(size_t size) - { - return ll_aligned_malloc_16(size); - } - - void operator delete(void* ptr) - { - ll_aligned_free_16(ptr); - } - private: void addData(LLViewerOctreeEntryData* data); private: LLViewerOctreeEntryData* mData[NUM_DATA_TYPE]; //do not use LLPointer here. - LLviewerOctreeGroup* mGroup; + LLViewerOctreeGroup* mGroup; //aligned members LL_ALIGN_16(LLVector4a mExtents[2]); @@ -153,7 +143,7 @@ public: F32 getBinRadius() const {return mEntry->getBinRadius();} const LLVector4a* getSpatialExtents() const; - LLviewerOctreeGroup* getGroup()const; + LLViewerOctreeGroup* getGroup()const; const LLVector4a& getPositionGroup() const; void setBinRadius(F32 rad) {mEntry->mBinRadius = rad;} @@ -161,7 +151,7 @@ public: void setSpatialExtents(const LLVector4a& min, const LLVector4a& max); void setPositionGroup(const LLVector4a& pos); - virtual void setGroup(LLviewerOctreeGroup* group); + virtual void setGroup(LLViewerOctreeGroup* group); void shift(const LLVector4a &shift_vector); U32 getVisible() const {return mEntry ? mEntry->mVisible : 0;} @@ -185,11 +175,12 @@ protected: //defines an octree group for an octree node, which contains multiple entries. //LL_ALIGN_PREFIX(16) -class LLviewerOctreeGroup : public LLOctreeListener +class LLViewerOctreeGroup +: public LLOctreeListener, public LLTrace::MemTrackable { friend class LLViewerOctreeCull; protected: - virtual ~LLviewerOctreeGroup(); + virtual ~LLViewerOctreeGroup(); public: enum @@ -206,22 +197,13 @@ public: typedef LLOctreeNode::element_iter element_iter; typedef LLOctreeNode::element_list element_list; - LLviewerOctreeGroup(OctreeNode* node); - LLviewerOctreeGroup(const LLviewerOctreeGroup& rhs) + LLViewerOctreeGroup(OctreeNode* node); + LLViewerOctreeGroup(const LLViewerOctreeGroup& rhs) + : LLTrace::MemTrackable("LLViewerOctreeGroup") { *this = rhs; } - void* operator new(size_t size) - { - return ll_aligned_malloc_16(size); - } - - void operator delete(void* ptr) - { - ll_aligned_free_16(ptr); - } - bool removeFromGroup(LLViewerOctreeEntryData* data); bool removeFromGroup(LLViewerOctreeEntry* entry); @@ -250,7 +232,7 @@ public: virtual void handleChildRemoval(const OctreeNode* parent, const OctreeNode* child); OctreeNode* getOctreeNode() {return mOctreeNode;} - LLviewerOctreeGroup* getParent(); + LLViewerOctreeGroup* getParent(); const LLVector4a* getBounds() const {return mBounds;} const LLVector4a* getExtents() const {return mExtents;} @@ -285,7 +267,7 @@ public: //octree group which has capability to support occlusion culling //LL_ALIGN_PREFIX(16) -class LLOcclusionCullingGroup : public LLviewerOctreeGroup +class LLOcclusionCullingGroup : public LLViewerOctreeGroup { public: typedef enum @@ -310,7 +292,7 @@ protected: public: LLOcclusionCullingGroup(OctreeNode* node, LLViewerOctreePartition* part); - LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLviewerOctreeGroup(rhs) + LLOcclusionCullingGroup(const LLOcclusionCullingGroup& rhs) : LLViewerOctreeGroup(rhs) { *this = rhs; } @@ -379,35 +361,35 @@ public: LLViewerOctreeCull(LLCamera* camera) : mCamera(camera), mRes(0) { } - virtual bool earlyFail(LLviewerOctreeGroup* group); + virtual bool earlyFail(LLViewerOctreeGroup* group); virtual void traverse(const OctreeNode* n); //agent space group cull - S32 AABBInFrustumNoFarClipGroupBounds(const LLviewerOctreeGroup* group); - S32 AABBSphereIntersectGroupExtents(const LLviewerOctreeGroup* group); - S32 AABBInFrustumGroupBounds(const LLviewerOctreeGroup* group); + S32 AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group); + S32 AABBSphereIntersectGroupExtents(const LLViewerOctreeGroup* group); + S32 AABBInFrustumGroupBounds(const LLViewerOctreeGroup* group); //agent space object set cull - S32 AABBInFrustumNoFarClipObjectBounds(const LLviewerOctreeGroup* group); - S32 AABBSphereIntersectObjectExtents(const LLviewerOctreeGroup* group); - S32 AABBInFrustumObjectBounds(const LLviewerOctreeGroup* group); + S32 AABBInFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group); + S32 AABBSphereIntersectObjectExtents(const LLViewerOctreeGroup* group); + S32 AABBInFrustumObjectBounds(const LLViewerOctreeGroup* group); //local region space group cull - S32 AABBInRegionFrustumNoFarClipGroupBounds(const LLviewerOctreeGroup* group); - S32 AABBInRegionFrustumGroupBounds(const LLviewerOctreeGroup* group); - S32 AABBRegionSphereIntersectGroupExtents(const LLviewerOctreeGroup* group, const LLVector3& shift); + S32 AABBInRegionFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group); + S32 AABBInRegionFrustumGroupBounds(const LLViewerOctreeGroup* group); + S32 AABBRegionSphereIntersectGroupExtents(const LLViewerOctreeGroup* group, const LLVector3& shift); //local region space object set cull - S32 AABBInRegionFrustumNoFarClipObjectBounds(const LLviewerOctreeGroup* group); - S32 AABBInRegionFrustumObjectBounds(const LLviewerOctreeGroup* group); - S32 AABBRegionSphereIntersectObjectExtents(const LLviewerOctreeGroup* group, const LLVector3& shift); + S32 AABBInRegionFrustumNoFarClipObjectBounds(const LLViewerOctreeGroup* group); + S32 AABBInRegionFrustumObjectBounds(const LLViewerOctreeGroup* group); + S32 AABBRegionSphereIntersectObjectExtents(const LLViewerOctreeGroup* group, const LLVector3& shift); - virtual S32 frustumCheck(const LLviewerOctreeGroup* group) = 0; - virtual S32 frustumCheckObjects(const LLviewerOctreeGroup* group) = 0; + virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0; + virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0; - virtual bool checkObjects(const OctreeNode* branch, const LLviewerOctreeGroup* group); - virtual void preprocess(LLviewerOctreeGroup* group); - virtual void processGroup(LLviewerOctreeGroup* group); + virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group); + virtual void preprocess(LLViewerOctreeGroup* group); + virtual void processGroup(LLViewerOctreeGroup* group); virtual void visit(const OctreeNode* branch); protected: @@ -419,7 +401,7 @@ protected: class LLViewerOctreeDebug : public OctreeTraveler { public: - virtual void processGroup(LLviewerOctreeGroup* group); + virtual void processGroup(LLViewerOctreeGroup* group); virtual void visit(const OctreeNode* branch); public: -- 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/llvieweroctree.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index e673bb6349..6ea6130413 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -362,9 +362,11 @@ class LLViewerOctreeCull : public OctreeTraveler public: LLViewerOctreeCull(LLCamera* camera) : mCamera(camera), mRes(0) { } - - virtual bool earlyFail(LLViewerOctreeGroup* group); + virtual void traverse(const OctreeNode* n); + +protected: + virtual bool earlyFail(LLViewerOctreeGroup* group); //agent space group cull S32 AABBInFrustumNoFarClipGroupBounds(const LLViewerOctreeGroup* group); @@ -389,6 +391,7 @@ public: virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0; virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0; + bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 projection_cutoff); virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group); virtual void preprocess(LLViewerOctreeGroup* group); virtual void processGroup(LLViewerOctreeGroup* group); -- 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/llvieweroctree.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 6ea6130413..611f285c8e 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -156,6 +156,7 @@ public: U32 getVisible() const {return mEntry ? mEntry->mVisible : 0;} void setVisible() const; + void resetVisible() const; virtual bool isVisible() const; virtual bool isRecentlyVisible() const; -- 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/llvieweroctree.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 611f285c8e..b03047cbbe 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -217,6 +217,7 @@ public: BOOL isVisible() const; virtual BOOL isRecentlyVisible() const; S32 getVisible(LLViewerCamera::eCameraID id) const {return mVisible[id];} + S32 getAnyVisible() const {return mAnyVisible;} bool isEmpty() const { return mOctreeNode->isEmpty(); } U32 getState() {return mState; } -- 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/llvieweroctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index b03047cbbe..20eb18278f 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -393,7 +393,7 @@ protected: virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0; virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0; - bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 projection_cutoff); + bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_squared_radius); virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group); virtual void preprocess(LLViewerOctreeGroup* group); virtual void processGroup(LLViewerOctreeGroup* group); -- cgit v1.2.3 From 7c7c043e38de95cc96554ebc6913973f43eed980 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 14 Nov 2013 18:07:40 -0700 Subject: fix for SH-4609: Interesting: Occluded objects are loaded at login --- indra/newview/llvieweroctree.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 20eb18278f..d73772b84e 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -305,6 +305,7 @@ public: void checkOcclusion(); //read back last occlusion query (if any) void doOcclusion(LLCamera* camera, const LLVector4a* shift = NULL); //issue occlusion query BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } + U32 getOcclusionState() const { return mOcclusionState[LLViewerCamera::sCurCameraID];} BOOL needsUpdate(); U32 getLastOcclusionIssuedTime(); -- cgit v1.2.3 From 29476d29c4c78a6417c45090bdc6ea14c8251d73 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 3 Dec 2013 10:52:22 -0800 Subject: SH-4606 FIX Interesting: Small objects do not load until they are very close. increased SceneLoadMinRadius to 32 changes logic so that falloff starts at SceneLoadMinRadius added timing to pixel threshold calculation --- indra/newview/llvieweroctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index d73772b84e..0f32e0dcc4 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -394,7 +394,7 @@ protected: virtual S32 frustumCheck(const LLViewerOctreeGroup* group) = 0; virtual S32 frustumCheckObjects(const LLViewerOctreeGroup* group) = 0; - bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_squared_radius); + bool checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_radius); virtual bool checkObjects(const OctreeNode* branch, const LLViewerOctreeGroup* group); virtual void preprocess(LLViewerOctreeGroup* group); virtual void processGroup(LLViewerOctreeGroup* group); -- 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/llvieweroctree.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llvieweroctree.h') diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 0f32e0dcc4..219ec7e8da 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -140,6 +140,7 @@ public: LLViewerOctreeEntry* getEntry() {return mEntry;} virtual void setOctreeEntry(LLViewerOctreeEntry* entry); + void removeOctreeEntry(); F32 getBinRadius() const {return mEntry->getBinRadius();} const LLVector4a* getSpatialExtents() const; -- cgit v1.2.3