diff options
-rwxr-xr-x | indra/llcommon/llerror.cpp | 11 | ||||
-rwxr-xr-x | indra/llcommon/llerror.h | 3 | ||||
-rwxr-xr-x | indra/llcommon/tests/llleap_test.cpp | 3 | ||||
-rwxr-xr-x | indra/llcommon/tests/llprocess_test.cpp | 12 | ||||
-rwxr-xr-x | indra/llcommon/tests/llsdserialize_test.cpp | 4 | ||||
-rwxr-xr-x | indra/newview/lldrawable.cpp | 16 | ||||
-rwxr-xr-x | indra/newview/lldrawable.h | 1 | ||||
-rw-r--r-- | indra/newview/llvieweroctree.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvieweroctree.h | 3 | ||||
-rwxr-xr-x | indra/newview/llvocache.cpp | 57 | ||||
-rwxr-xr-x | indra/newview/llvocache.h | 13 | ||||
-rwxr-xr-x | indra/test/manageapr.h | 46 |
12 files changed, 72 insertions, 99 deletions
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 590e236090..a51f8f216a 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -926,10 +926,10 @@ namespace std::ostringstream message_stream; + const_cast<LLError::CallSite&>(site).mTagString += " "; if (show_location && (r->wantsLocation() || level == LLError::LEVEL_ERROR || s.mPrintLocation)) { - message_stream << site.mLocationString; - message_stream << " "; + message_stream << site.mLocationString << " "; } if (show_time && r->wantsTime() && s.mTimeFunction != NULL) @@ -954,7 +954,8 @@ namespace message_stream << message; - r->recordMessage(level, message_stream.str()); + std::string final_message = message_stream.str(); + r->recordMessage(level, final_message); } } } @@ -1158,6 +1159,10 @@ namespace LLError Globals& g = Globals::get(); Settings& s = Settings::get(); + //const_cast<CallSite&>(site).mTagString += " "; + std::string tag_string = site.mTagString; + tag_string += " "; + std::string message = out->str(); if (out == &g.messageStream) { diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index 6eaab450ed..6cac952b7e 100755 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -302,7 +302,8 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG; // See top of file for common usage. ///////////////////////////////// -// this macro uses a one-shot do statement to avoid parsing errors when writing: +// this macro uses a one-shot do statement to avoid parsing errors when writing control flow statements +// without braces: // if (condition) LL_INFOS() << "True" << LLENDL; else LLINFOS() << "False" << LLENDL #define lllog(level, once, ...) \ diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp index 29060d4ef5..9ea822cb8d 100755 --- a/indra/llcommon/tests/llleap_test.cpp +++ b/indra/llcommon/tests/llleap_test.cpp @@ -22,7 +22,6 @@ // other Linden headers #include "../test/lltut.h" #include "../test/namedtempfile.h" -#include "../test/manageapr.h" #include "../test/catch_and_store_what_in.h" #include "wrapllerrs.h" #include "llevents.h" @@ -33,8 +32,6 @@ using boost::assign::list_of; -static ManageAPR manager; - StringVec sv(const StringVec& listof) { return listof; } #if defined(LL_WINDOWS) diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index f188865eb0..709a095105 100755 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -29,7 +29,6 @@ //#include <boost/lambda/bind.hpp> // other Linden headers #include "../test/lltut.h" -#include "../test/manageapr.h" #include "../test/namedtempfile.h" #include "../test/catch_and_store_what_in.h" #include "stringize.h" @@ -46,9 +45,12 @@ #endif //namespace lambda = boost::lambda; - -// static instance of this manages APR init/cleanup -static ManageAPR manager; + std::string apr_strerror_helper(apr_status_t rv) +{ + char errbuf[256]; + apr_strerror(rv, errbuf, sizeof(errbuf)); + return errbuf; +} /***************************************************************************** * Helpers @@ -60,7 +62,7 @@ static ManageAPR manager; #define aprchk(expr) aprchk_(#expr, (expr)) static void aprchk_(const char* call, apr_status_t rv, apr_status_t expected=APR_SUCCESS) { - tut::ensure_equals(STRINGIZE(call << " => " << rv << ": " << manager.strerror(rv)), + tut::ensure_equals(STRINGIZE(call << " => " << rv << ": " << apr_strerror_helper(rv)), rv, expected); } diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index 235008a5ae..b5893135ea 100755 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -56,12 +56,9 @@ namespace lambda = boost::lambda; #include "../llformat.h" #include "../test/lltut.h" -#include "../test/manageapr.h" #include "../test/namedtempfile.h" #include "stringize.h" -static ManageAPR manager; - std::vector<U8> string_to_vector(const std::string& str) { return std::vector<U8>(str.begin(), str.end()); @@ -1723,5 +1720,6 @@ namespace tut "This string\n" "has several\n" "lines."); + } } diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index ad3df55ef1..a480eed2e7 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1058,12 +1058,8 @@ bool LLDrawable::isRecentlyVisible() const if(!vis) { - LLviewerOctreeGroup* group = getGroup(); - if (group && group->isRecentlyVisible()) - { - LLViewerOctreeEntryData::setVisible(); - vis = TRUE ; - } + const U32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. + vis = (sCurVisible - getVisible() < MIN_VIS_FRAME_RANGE); } return vis ; @@ -1140,14 +1136,6 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() return retval; } -//virtual -U32 LLDrawable::getMinFrameRange() const -{ - const U32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. - - return MIN_VIS_FRAME_RANGE ; -} - //======================================= // Spatial Partition Bridging Drawable //======================================= diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index efb3e1d89d..b94f663f21 100755 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -194,7 +194,6 @@ public: LLSpatialPartition* getSpatialPartition(); - virtual U32 getMinFrameRange()const; void removeFromOctree(); void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; } diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index 637505a826..481befdb44 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -409,7 +409,7 @@ bool LLViewerOctreeEntryData::isRecentlyVisible() const return true; } - return (sCurVisible - mEntry->mVisible < getMinFrameRange()); + return false; } void LLViewerOctreeEntryData::setVisible() const diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 7fdb5661d8..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; @@ -327,6 +325,7 @@ public: //virtual BOOL isRecentlyVisible() const; + LLViewerOctreePartition* getSpatialPartition()const {return mSpatialPartition;} static U32 getNewOcclusionQueryObjectName(); static void releaseOcclusionQueryObjectName(U32 name); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 838ac353d1..dc7b907a35 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -238,12 +238,6 @@ void LLVOCacheEntry::setState(U32 state) } } -//virtual -U32 LLVOCacheEntry::getMinFrameRange()const -{ - return mMinFrameRange; -} - void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) { llassert(entry != NULL); @@ -261,6 +255,12 @@ void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) if(getEntry() != NULL && isState(INACTIVE)) { updateParentBoundingInfo(entry); + if(getGroup()) + { + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)getGroup(); + group->unbound(); + ((LLVOCachePartition*)group->getSpatialPartition())->setDirty(); + } } } @@ -365,6 +365,27 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const return success ; } +bool LLVOCacheEntry::isRecentlyVisible() const +{ + bool vis = LLViewerOctreeEntryData::isRecentlyVisible(); + + if(!vis) + { + vis = (sCurVisible - getVisible() < mMinFrameRange); + } + + //combination of projected area and squared distance + if(!vis && !mParentID && mSceneContrib > 0.0311f) //projection angle > 10 (degree) + { + //squared distance + const F32 SQUARED_CUT_OFF_DIST = 256.0; //16m + F32 rad = getBinRadius(); + vis = (rad * rad / mSceneContrib < SQUARED_CUT_OFF_DIST); + } + + return vis; +} + void LLVOCacheEntry::calcSceneContribution(const LLVector3& camera_origin, bool needs_update, U32 last_update) { if(!needs_update && getVisible() >= last_update) @@ -381,8 +402,11 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector3& camera_origin, bool lookAt.setSub(center, origin); F32 squared_dist = lookAt.dot3(lookAt).getF32(); - F32 rad = getBinRadius(); - mSceneContrib = rad * rad / squared_dist; + if(squared_dist > 0.f) + { + F32 rad = getBinRadius(); + mSceneContrib = rad * rad / squared_dist; + } setVisible(); } @@ -479,12 +503,17 @@ LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp) new LLOcclusionCullingGroup(mOctree, this); } +void LLVOCachePartition::setDirty() +{ + mDirty = TRUE; +} + void LLVOCachePartition::addEntry(LLViewerOctreeEntry* entry) { llassert(entry->hasVOCacheEntry()); mOctree->insert(entry); - mDirty = TRUE; + setDirty(); } void LLVOCachePartition::removeEntry(LLViewerOctreeEntry* entry) @@ -609,13 +638,13 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion) } mCulledTime[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame(); - if(!mDirty && !mCullHistory[LLViewerCamera::sCurCameraID] && LLViewerRegion::isViewerCameraStatic()) - { - return 0; //nothing changed, skip culling - } + //if(!mDirty && !mCullHistory[LLViewerCamera::sCurCameraID] && LLViewerRegion::isViewerCameraStatic()) + //{ + // return 0; //nothing changed, skip culling + //} ((LLviewerOctreeGroup*)mOctree->getListener(0))->rebound(); - mCullHistory[LLViewerCamera::sCurCameraID] <<= 2; + mCullHistory[LLViewerCamera::sCurCameraID] <<= 1; //localize the camera LLVector3 region_agent = mRegionp->getOriginAgent(); diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index c448b97b80..4eca083445 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -83,12 +83,14 @@ public: bool hasState(U32 state) {return mState & state;} U32 getState() const {return mState;} + //virtual + bool isRecentlyVisible() const; + U32 getLocalID() const { return mLocalID; } U32 getCRC() const { return mCRC; } S32 getHitCount() const { return mHitCount; } S32 getCRCChangeCount() const { return mCRCChangeCount; } - U32 getMinFrameRange()const; - + 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;} @@ -162,14 +164,13 @@ public: /*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion); void addOccluders(LLviewerOctreeGroup* gp); void resetOccluders(); - - static LLTrace::MemStatHandle sMemStat; - -public: void processOccluders(LLCamera* camera); + + void setDirty(); public: static BOOL sNeedsOcclusionCheck; + static LLTrace::MemStatHandle sMemStat; private: BOOL mDirty; diff --git a/indra/test/manageapr.h b/indra/test/manageapr.h deleted file mode 100755 index 2452fb6ae4..0000000000 --- a/indra/test/manageapr.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file manageapr.h - * @author Nat Goodspeed - * @date 2012-01-13 - * @brief ManageAPR class for simple test programs - * - * $LicenseInfo:firstyear=2012&license=viewerlgpl$ - * Copyright (c) 2012, Linden Research, Inc. - * $/LicenseInfo$ - */ - -#if ! defined(LL_MANAGEAPR_H) -#define LL_MANAGEAPR_H - -#include "llapr.h" -#include <boost/noncopyable.hpp> - -/** - * Declare a static instance of this class for dead-simple ll_init_apr() at - * program startup, ll_cleanup_apr() at termination. This is recommended for - * use only with simple test programs. Once you start introducing static - * instances of other classes that depend on APR already being initialized, - * the indeterminate static-constructor-order problem rears its ugly head. - */ -class ManageAPR: public boost::noncopyable -{ -public: - ManageAPR() - { - ll_init_apr(); - } - - ~ManageAPR() - { - ll_cleanup_apr(); - } - - static std::string strerror(apr_status_t rv) - { - char errbuf[256]; - apr_strerror(rv, errbuf, sizeof(errbuf)); - return errbuf; - } -}; - -#endif /* ! defined(LL_MANAGEAPR_H) */ |