From 7378259aa551c395b67e40196487584eaf5e8007 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 15 Jan 2013 14:14:29 -0700 Subject: for SH-3667: Create an extendable recording tied to scene load time --- indra/newview/llagent.cpp | 8 ++++++++ indra/newview/llagent.h | 2 ++ indra/newview/llscenemonitor.cpp | 23 ++++++++++++++++++++++- indra/newview/llscenemonitor.h | 5 +++++ 4 files changed, 37 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 14235bcee4..24c9da8e17 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1046,6 +1046,14 @@ const LLVector3d &LLAgent::getPositionGlobal() const return mPositionGlobal; } +bool LLAgent::isPositionChanged() const +{ + LLVector3d diff; + diff = mPositionGlobal - mLastPositionGlobal; + + return diff.lengthSquared() > 1.0; +} + //----------------------------------------------------------------------------- // getPositionAgent() //----------------------------------------------------------------------------- diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 99904e118c..a1e899b45d 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -250,6 +250,8 @@ public: const LLVector3d &getLastPositionGlobal() const { return mLastPositionGlobal; } void setLastPositionGlobal(const LLVector3d &pos) { mLastPositionGlobal = pos; } + + bool isPositionChanged() const; private: std::set mRegionsVisited; // Stat - what distinct regions has the avatar been to? F64 mDistanceTraveled; // Stat - how far has the avatar moved? diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 4872200f24..7a960f7baa 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -37,6 +37,7 @@ #include "llwindow.h" #include "llpointer.h" #include "llspatialpartition.h" +#include "llagent.h" LLSceneMonitorView* gSceneMonitorView = NULL; @@ -67,7 +68,10 @@ LLSceneMonitor::LLSceneMonitor() : mDiffPixelRatio(0.5f) { mFrames[0] = NULL; - mFrames[1] = NULL; + mFrames[1] = NULL; + + mRecording = new LLTrace::ExtendableRecording(); + mRecording->start(); } LLSceneMonitor::~LLSceneMonitor() @@ -78,6 +82,9 @@ LLSceneMonitor::~LLSceneMonitor() void LLSceneMonitor::destroyClass() { reset(); + + delete mRecording; + mRecording = NULL; } void LLSceneMonitor::reset() @@ -137,6 +144,11 @@ bool LLSceneMonitor::preCapture() return false; } + if(gAgent.isPositionChanged()) + { + mRecording->reset(); + } + if(timer.getElapsedTimeF32() < mSamplingTime) { return false; @@ -388,6 +400,10 @@ void LLSceneMonitor::fetchQueryResult() mDiffResult = count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio); //0.5 -> (front face + back face) + if(mDiffResult > 0.01f) + { + mRecording->extend(); + } //llinfos << count << " : " << mDiffResult << llendl; } //------------------------------------------------------------------------------------------------------------- @@ -454,6 +470,11 @@ void LLSceneMonitorView::draw() num_str = llformat("Sampling time: %.3f seconds", LLSceneMonitor::getInstance()->getSamplingTime()); LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; + + num_str = llformat("Scene Loading time: %.3f seconds", (F32)LLSceneMonitor::getInstance()->getRecording()->getAcceptedRecording().getDuration().value()); + LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, 5, getRect().getHeight() - line_height * lines, color, LLFontGL::LEFT, LLFontGL::TOP); + lines++; LLView::draw(); } diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index 02e3d57d46..93e6c20bb9 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -31,6 +31,7 @@ #include "llmath.h" #include "llfloater.h" #include "llcharacter.h" +#include "lltracerecording.h" class LLCharacter; class LLRenderTarget; @@ -61,6 +62,8 @@ public: bool isEnabled()const {return mEnabled;} bool needsUpdate() const; + LLTrace::ExtendableRecording* getRecording() const {return mRecording;} + private: void freezeScene(); void unfreezeScene(); @@ -86,6 +89,8 @@ private: F32 mDiffPixelRatio; //ratio of pixels used for comparison against the original mDiff size along one dimension std::vector mAvatarPauseHandles; + + LLTrace::ExtendableRecording* mRecording; }; class LLSceneMonitorView : public LLFloater -- cgit v1.2.3 From 970fbdbeb80f20811fb286f6731b854f9b20a76e Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 15 Jan 2013 20:28:05 -0700 Subject: a minor change to LLTrace::ExtendableRecording, make its functions public. --- indra/llcommon/lltracerecording.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra') diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index aa3200e5ad..5105874ba1 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -390,6 +390,7 @@ namespace LLTrace class ExtendableRecording : public LLStopWatchControlsMixin { + public: void extend(); // implementation for LLStopWatchControlsMixin @@ -401,6 +402,8 @@ namespace LLTrace /*virtual*/ void reset(); /*virtual*/ void splitTo(ExtendableRecording& other); /*virtual*/ void splitFrom(ExtendableRecording& other); + + const Recording& getAcceptedRecording() const {return mAcceptedRecording;} private: Recording mAcceptedRecording; Recording mPotentialRecording; -- cgit v1.2.3 From 45a7fe901aa4cd7af14fa1cb894da46a988e3aa2 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 15 Jan 2013 23:01:40 -0700 Subject: for SH-3653: Can we repurpose ObjectUpdateCached:ObjectData:UpdateFlags field to carry spatial+size data? --- indra/newview/llviewerobjectlist.cpp | 4 +- indra/newview/llviewerregion.cpp | 81 ++++++++++++++++-------------------- indra/newview/llviewerregion.h | 35 ++++++++++++++-- 3 files changed, 70 insertions(+), 50 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 0335cd769b..dce963c5c5 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -657,13 +657,15 @@ void LLViewerObjectList::processCachedObjectUpdate(LLMessageSystem *mesgsys, S32 msg_size = 0; U32 id; U32 crc; + U32 flags; mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, id, i); mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_CRC, crc, i); + mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); msg_size += sizeof(U32) * 2; // Lookup data packer and add this id to cache miss lists if necessary. U8 cache_miss_type = LLViewerRegion::CACHE_MISS_TYPE_NONE; - if(!regionp->probeCache(id, crc, cache_miss_type)) + if(!regionp->probeCache(id, crc, flags, cache_miss_type)) { // Cache Miss. recorder.cacheMissEvent(id, update_type, cache_miss_type, msg_size); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 7d2e08c1c6..f44c8ffe46 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1718,9 +1718,26 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) return NULL; } +//estimate weight of cache missed object +F32 LLViewerRegion::calcObjectWeight(U32 flags) +{ + LLVector3 pos((F32)(flags & 0xff), (F32)((flags >> 8) & 0xff), (F32)((flags >> 16) & 0xff) * 16.f); + F32 rad = (F32)((flags >> 24) & 0xff); + + pos += getOriginAgent(); + pos -= LLViewerCamera::getInstance()->getOrigin(); + + return rad * rad / pos.lengthSquared(); +} + +void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight) +{ + mCacheMissList.insert(CacheMissItem(id, miss_type, weight)); +} + // Get data packer for this object, if we have cached data // AND the CRC matches. JC -bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U8 &cache_miss_type) +bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type) { //llassert(mCacheLoaded); This assert failes often, changing to early-out -- davep, 2010/10/18 @@ -1746,15 +1763,14 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U8 &cache_miss_type) else { // llinfos << "CRC miss for " << local_id << llendl; - cache_miss_type = CACHE_MISS_TYPE_CRC; - mCacheMissCRC.put(local_id); + + addCacheMiss(local_id, CACHE_MISS_TYPE_CRC, calcObjectWeight(flags)); } } else { // llinfos << "Cache miss for " << local_id << llendl; - cache_miss_type = CACHE_MISS_TYPE_FULL; - mCacheMissFull.put(local_id); + addCacheMiss(local_id, CACHE_MISS_TYPE_FULL, calcObjectWeight(flags)); } return false; @@ -1762,49 +1778,22 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U8 &cache_miss_type) void LLViewerRegion::addCacheMissFull(const U32 local_id) { - mCacheMissFull.put(local_id); + addCacheMiss(local_id, CACHE_MISS_TYPE_FULL, 100.f); } void LLViewerRegion::requestCacheMisses() { - S32 full_count = mCacheMissFull.count(); - S32 crc_count = mCacheMissCRC.count(); - if (full_count == 0 && crc_count == 0) return; + if (!mCacheMissList.size()) + { + return; + } LLMessageSystem* msg = gMessageSystem; BOOL start_new_message = TRUE; S32 blocks = 0; - S32 i; - - // Send full cache miss updates. For these, we KNOW we don't - // have a viewer object. - for (i = 0; i < full_count; i++) - { - if (start_new_message) - { - msg->newMessageFast(_PREHASH_RequestMultipleObjects); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - start_new_message = FALSE; - } - - msg->nextBlockFast(_PREHASH_ObjectData); - msg->addU8Fast(_PREHASH_CacheMissType, CACHE_MISS_TYPE_FULL); - msg->addU32Fast(_PREHASH_ID, mCacheMissFull[i]); - blocks++; - - if (blocks >= 255) - { - sendReliableMessage(); - start_new_message = TRUE; - blocks = 0; - } - } - - // Send CRC miss updates. For these, we _might_ have a viewer object, - // but probably not. - for (i = 0; i < crc_count; i++) + + //send requests for all cache-missed objects + for (CacheMissItem::cache_miss_list_t::iterator iter = mCacheMissList.begin(); iter != mCacheMissList.end(); ++iter) { if (start_new_message) { @@ -1816,8 +1805,8 @@ void LLViewerRegion::requestCacheMisses() } msg->nextBlockFast(_PREHASH_ObjectData); - msg->addU8Fast(_PREHASH_CacheMissType, CACHE_MISS_TYPE_CRC); - msg->addU32Fast(_PREHASH_ID, mCacheMissCRC[i]); + msg->addU8Fast(_PREHASH_CacheMissType, (*iter).mType); + msg->addU32Fast(_PREHASH_ID, (*iter).mID); blocks++; if (blocks >= 255) @@ -1832,14 +1821,14 @@ void LLViewerRegion::requestCacheMisses() if (!start_new_message) { sendReliableMessage(); - } - mCacheMissFull.reset(); - mCacheMissCRC.reset(); + } mCacheDirty = TRUE ; // llinfos << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << llendl; - LLViewerStatsRecorder::instance().requestCacheMissesEvent(full_count + crc_count); + LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size()); LLViewerStatsRecorder::instance().log(0.2f); + + mCacheMissList.clear(); } void LLViewerRegion::dumpCache() diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 9252923aa3..4f0087ba7c 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -169,6 +169,9 @@ public: const LLVector3d &getOriginGlobal() const; LLVector3 getOriginAgent() const; + //estimate weight of cache missed object + F32 calcObjectWeight(U32 flags); + // Center is at the height of the water table. const LLVector3d &getCenterGlobal() const; LLVector3 getCenterAgent() const; @@ -316,7 +319,7 @@ public: // handle a full update message eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp); LLVOCacheEntry* getCacheEntryForOctree(U32 local_id); - bool probeCache(U32 local_id, U32 crc, U8 &cache_miss_type); + bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type); void requestCacheMisses(); void addCacheMissFull(const U32 local_id); @@ -356,6 +359,7 @@ private: F32 createVisibleObjects(F32 max_time); F32 updateVisibleEntries(F32 max_time); //update visible entries + void addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight); public: struct CompareDistance { @@ -441,8 +445,33 @@ private: BOOL mReleaseNotesRequested; BOOL mDead; //if true, this region is in the process of deleting. - LLDynamicArray mCacheMissFull; - LLDynamicArray mCacheMissCRC; + class CacheMissItem + { + public: + CacheMissItem(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight) : mID(id), mType(miss_type), mWeight(weight){} + + U32 mID; //local object id + LLViewerRegion::eCacheMissType mType; //cache miss type + F32 mWeight; //importance of this object to the current camera. + + struct Compare + { + bool operator()(const CacheMissItem& lhs, const CacheMissItem& rhs) + { + if(lhs.mWeight == rhs.mWeight) //larger weight first + { + return &lhs < &rhs; + } + else + { + return lhs.mWeight > rhs.mWeight; //larger weight first + } + } + }; + + typedef std::set cache_miss_list_t; + }; + CacheMissItem::cache_miss_list_t mCacheMissList; caps_received_signal_t mCapabilitiesReceivedSignal; LLSD mSimulatorFeatures; -- cgit v1.2.3 From 3ed1bee350ed93f81a484a7c073c12708e73e946 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 16 Jan 2013 22:03:48 -0700 Subject: trivial: convert to unix line endings. --- indra/newview/llviewerregion.h | 52 +++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 4f0087ba7c..de14c0fe27 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -445,32 +445,32 @@ private: BOOL mReleaseNotesRequested; BOOL mDead; //if true, this region is in the process of deleting. - class CacheMissItem - { - public: - CacheMissItem(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight) : mID(id), mType(miss_type), mWeight(weight){} - - U32 mID; //local object id - LLViewerRegion::eCacheMissType mType; //cache miss type - F32 mWeight; //importance of this object to the current camera. - - struct Compare - { - bool operator()(const CacheMissItem& lhs, const CacheMissItem& rhs) - { - if(lhs.mWeight == rhs.mWeight) //larger weight first - { - return &lhs < &rhs; - } - else - { - return lhs.mWeight > rhs.mWeight; //larger weight first - } - } - }; - - typedef std::set cache_miss_list_t; - }; + class CacheMissItem + { + public: + CacheMissItem(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight) : mID(id), mType(miss_type), mWeight(weight){} + + U32 mID; //local object id + LLViewerRegion::eCacheMissType mType; //cache miss type + F32 mWeight; //importance of this object to the current camera. + + struct Compare + { + bool operator()(const CacheMissItem& lhs, const CacheMissItem& rhs) + { + if(lhs.mWeight == rhs.mWeight) //larger weight first + { + return &lhs < &rhs; + } + else + { + return lhs.mWeight > rhs.mWeight; //larger weight first + } + } + }; + + typedef std::set cache_miss_list_t; + }; CacheMissItem::cache_miss_list_t mCacheMissList; caps_received_signal_t mCapabilitiesReceivedSignal; -- cgit v1.2.3 From 1e95127e359124d8bcad93d263d6e3c9ae13263b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 16 Jan 2013 22:04:26 -0700 Subject: for SH-3663: Get windlight cloud animation and water animation to stop when pausing world updates --- indra/newview/llscenemonitor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index bafd245aa0..2f1c4e065a 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -38,6 +38,7 @@ #include "llpointer.h" #include "llspatialpartition.h" #include "llagent.h" +#include "pipeline.h" LLSceneMonitorView* gSceneMonitorView = NULL; @@ -209,6 +210,9 @@ void LLSceneMonitor::freezeScene() // freeze everything else gSavedSettings.setBOOL("FreezeTime", TRUE); + + gPipeline.clearRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); } void LLSceneMonitor::unfreezeScene() @@ -218,6 +222,9 @@ void LLSceneMonitor::unfreezeScene() // thaw everything else gSavedSettings.setBOOL("FreezeTime", FALSE); + + gPipeline.setRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_WATER, LLPipeline::RENDER_TYPE_CLOUDS, LLPipeline::END_RENDER_TYPES); } void LLSceneMonitor::capture() -- cgit v1.2.3 From 173806c4b1d18fe0188c1d189e7044fa977268ae Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 24 Jan 2013 17:10:37 -0700 Subject: for SH-3665: more post processing of the frame difference image --- .../class1/interface/twotexturecompareF.glsl | 17 +++++ indra/newview/llscenemonitor.cpp | 76 ++++++++++++++++++++++ indra/newview/llscenemonitor.h | 8 +++ indra/newview/llviewershadermgr.cpp | 1 + 4 files changed, 102 insertions(+) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl index 050114b37e..6eeb2596b2 100644 --- a/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/twotexturecompareF.glsl @@ -31,6 +31,10 @@ out vec4 frag_color; uniform sampler2D tex0; uniform sampler2D tex1; +uniform sampler2D dither_tex; +uniform float dither_scale; +uniform float dither_scale_s; +uniform float dither_scale_t; VARYING vec2 vary_texcoord0; VARYING vec2 vary_texcoord1; @@ -38,4 +42,17 @@ VARYING vec2 vary_texcoord1; void main() { frag_color = abs(texture2D(tex0, vary_texcoord0.xy) - texture2D(tex1, vary_texcoord0.xy)); + + vec2 dither_coord; + dither_coord[0] = vary_texcoord0[0] * dither_scale_s; + dither_coord[1] = vary_texcoord0[1] * dither_scale_t; + vec4 dither_vec = texture(dither_tex, dither_coord.xy); + + for(int i = 0; i < 3; i++) + { + if(frag_color[i] < dither_vec[i] * dither_scale) + { + frag_color[i] = 0.f; + } + } } diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 2f1c4e065a..9de6b52d12 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -86,6 +86,7 @@ void LLSceneMonitor::destroyClass() delete mRecording; mRecording = NULL; + mDitheringTexture = NULL; } void LLSceneMonitor::reset() @@ -108,6 +109,67 @@ void LLSceneMonitor::reset() } } +void LLSceneMonitor::generateDitheringTexture(S32 width, S32 height) +{ +#if 1 + //4 * 4 matrix + mDitherMatrixWidth = 4; + S32 dither_matrix[4][4] = + { + {1, 9, 3, 11}, + {13, 5, 15, 7}, + {4, 12, 2, 10}, + {16, 8, 14, 6} + }; + + mDitherScale = 255.f / 17; +#else + //8 * 8 matrix + mDitherMatrixWidth = 16; + S32 dither_matrix[16][16] = + { + {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64}, + {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32}, + {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56}, + {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24}, + {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62}, + {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30}, + {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54}, + {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22}, + {1, 49, 13, 61, 4, 52, 16, 64, 1, 49, 13, 61, 4, 52, 16, 64}, + {33, 17, 45, 29, 36, 20, 48, 32, 33, 17, 45, 29, 36, 20, 48, 32}, + {9, 57, 5, 53, 12, 60, 8, 56, 9, 57, 5, 53, 12, 60, 8, 56}, + {41, 25, 37, 21, 44, 28, 40, 24, 41, 25, 37, 21, 44, 28, 40, 24}, + {3, 51, 15, 63, 2, 50, 14, 62, 3, 51, 15, 63, 2, 50, 14, 62}, + {35, 19, 47, 31, 34, 18, 46, 30, 35, 19, 47, 31, 34, 18, 46, 30}, + {11, 59, 7, 55, 10, 58, 6, 54, 11, 59, 7, 55, 10, 58, 6, 54}, + {43, 27, 39, 23, 42, 26, 38, 22, 43, 27, 39, 23, 42, 26, 38, 22} + }; + + mDitherScale = 255.f / 65; +#endif + + LLPointer image_raw = new LLImageRaw(mDitherMatrixWidth, mDitherMatrixWidth, 3); + U8* data = image_raw->getData(); + for (S32 i = 0; i < mDitherMatrixWidth; i++) + { + for (S32 j = 0; j < mDitherMatrixWidth; j++) + { + U8 val = dither_matrix[i][j]; + *data++ = val; + *data++ = val; + *data++ = val; + } + } + + mDitheringTexture = LLViewerTextureManager::getLocalTexture(image_raw.get(), FALSE) ; + mDitheringTexture->setAddressMode(LLTexUnit::TAM_WRAP); + mDitheringTexture->setFilteringOption(LLTexUnit::TFO_POINT); + + mDitherScaleS = (F32)width / mDitherMatrixWidth; + mDitherScaleT = (F32)height / mDitherMatrixWidth; +} + void LLSceneMonitor::setDebugViewerVisible(BOOL visible) { mDebugViewerVisible = visible; @@ -287,10 +349,13 @@ void LLSceneMonitor::compare() { mDiff = new LLRenderTarget(); mDiff->allocate(width, height, GL_RGBA, false, false, LLTexUnit::TT_TEXTURE, true); + + generateDitheringTexture(width, height); } else if(mDiff->getWidth() != width || mDiff->getHeight() != height) { mDiff->resize(width, height, GL_RGBA); + generateDitheringTexture(width, height); } mDiff->bindTarget(); @@ -298,6 +363,10 @@ void LLSceneMonitor::compare() gTwoTextureCompareProgram.bind(); + gTwoTextureCompareProgram.uniform1f("dither_scale", mDitherScale); + gTwoTextureCompareProgram.uniform1f("dither_scale_s", mDitherScaleS); + gTwoTextureCompareProgram.uniform1f("dither_scale_t", mDitherScaleT); + gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->bind(mFrames[0]); @@ -308,6 +377,11 @@ void LLSceneMonitor::compare() gGL.getTexUnit(1)->bind(mFrames[1]); gGL.getTexUnit(1)->activate(); + gGL.getTexUnit(2)->activate(); + gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->bind(mDitheringTexture); + gGL.getTexUnit(2)->activate(); + gl_rect_2d_simple_tex(width, height); mDiff->flush(); @@ -318,6 +392,8 @@ void LLSceneMonitor::compare() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(2)->disable(); + gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); mHasNewDiff = TRUE; diff --git a/indra/newview/llscenemonitor.h b/indra/newview/llscenemonitor.h index 93e6c20bb9..709650e206 100644 --- a/indra/newview/llscenemonitor.h +++ b/indra/newview/llscenemonitor.h @@ -35,6 +35,7 @@ class LLCharacter; class LLRenderTarget; +class LLViewerTexture; class LLSceneMonitor : public LLSingleton { @@ -69,6 +70,7 @@ private: void unfreezeScene(); void reset(); bool preCapture(); + void generateDitheringTexture(S32 width, S32 height); private: BOOL mEnabled; @@ -88,6 +90,12 @@ private: F32 mSamplingTime; //time interval to capture frames, in seconds F32 mDiffPixelRatio; //ratio of pixels used for comparison against the original mDiff size along one dimension + LLPointer mDitheringTexture; + S32 mDitherMatrixWidth; + F32 mDitherScale; + F32 mDitherScaleS; + F32 mDitherScaleT; + std::vector mAvatarPauseHandles; LLTrace::ExtendableRecording* mRecording; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 1aa36eafee..dd86ef4f34 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -2723,6 +2723,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() gTwoTextureCompareProgram.bind(); gTwoTextureCompareProgram.uniform1i("tex0", 0); gTwoTextureCompareProgram.uniform1i("tex1", 1); + gTwoTextureCompareProgram.uniform1i("dither_tex", 2); } } -- cgit v1.2.3 From 3660f8b632d1288cefeeff66c3b62522b4bbacbc Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 24 Jan 2013 17:11:33 -0700 Subject: more for SH-3653: Can we repurpose ObjectUpdateCached:ObjectData:UpdateFlags field to carry spatial+size data? --- indra/newview/llviewerregion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 45d43bdf74..e5cb2a1b08 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1724,13 +1724,13 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) //estimate weight of cache missed object F32 LLViewerRegion::calcObjectWeight(U32 flags) { - LLVector3 pos((F32)(flags & 0xff), (F32)((flags >> 8) & 0xff), (F32)((flags >> 16) & 0xff) * 16.f); + LLVector3 pos((F32)(flags & 0xff) + 0.5f, (F32)((flags >> 8) & 0xff) + 0.5f, (F32)((flags >> 16) & 0xff) * 16.f + 8.0f); F32 rad = (F32)((flags >> 24) & 0xff); pos += getOriginAgent(); pos -= LLViewerCamera::getInstance()->getOrigin(); - return rad * rad / pos.lengthSquared(); + return 100.f * rad * rad / pos.lengthSquared(); } void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight) -- cgit v1.2.3 From 8144fa95701122f24c36b8ae2a51a5ce720614a6 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 25 Jan 2013 18:10:35 -0700 Subject: for SH-3781: LLTrace issues --- indra/newview/llscenemonitor.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 9de6b52d12..4eb44bcc00 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -463,6 +463,7 @@ void LLSceneMonitor::calcDiffAggregate() } } +static LLTrace::Measurement<> sFramePixelDiff("FramePixelDifference"); void LLSceneMonitor::fetchQueryResult() { if(!mHasNewQueryResult) @@ -486,6 +487,7 @@ void LLSceneMonitor::fetchQueryResult() if(mDiffResult > 0.01f) { mRecording->extend(); + sFramePixelDiff.sample(mDiffResult); } //llinfos << count << " : " << mDiffResult << llendl; } -- cgit v1.2.3 From bd60fdbe44d9f996686d31cf48a3f2ca664dd301 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 28 Feb 2013 22:49:05 -0700 Subject: for SH-3824: interesting: Ensure viewer can handle object updates from entire region gracefully --- indra/llmessage/lldatapacker.h | 1 + indra/newview/llviewerobject.cpp | 134 +++++++++++++++++++++++++++++++++++ indra/newview/llviewerobject.h | 12 ++++ indra/newview/llviewerobjectlist.cpp | 51 ++++++++++++- indra/newview/llviewerregion.cpp | 134 +++++++++++++++++++++++++++++------ indra/newview/llviewerregion.h | 19 ++++- indra/newview/llvocache.cpp | 28 ++++++-- indra/newview/llvocache.h | 4 ++ 8 files changed, 355 insertions(+), 28 deletions(-) (limited to 'indra') diff --git a/indra/llmessage/lldatapacker.h b/indra/llmessage/lldatapacker.h index b0a638c16e..226752d52e 100644 --- a/indra/llmessage/lldatapacker.h +++ b/indra/llmessage/lldatapacker.h @@ -170,6 +170,7 @@ public: S32 getBufferSize() const { return mBufferSize; } const U8* getBuffer() const { return mBufferp; } void reset() { mCurBufferp = mBufferp; mWriteEnabled = (mCurBufferp != NULL); } + void shift(S32 offset) { reset(); mCurBufferp += offset;} void freeBuffer() { delete [] mBufferp; mBufferp = mCurBufferp = NULL; mBufferSize = 0; mWriteEnabled = FALSE; } void assignBuffer(U8 *bufferp, S32 size) { diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index f5f5bdffbd..e50509374d 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -123,6 +123,7 @@ BOOL LLViewerObject::sUseSharedDrawables(FALSE); // TRUE F64 LLViewerObject::sMaxUpdateInterpolationTime = 3.0; // For motion interpolation: after X seconds with no updates, don't predict object motion F64 LLViewerObject::sPhaseOutUpdateInterpolationTime = 2.0; // For motion interpolation: after Y seconds with no updates, taper off motion prediction +std::map LLViewerObject::sObjectDataMap; static LLFastTimer::DeclareTimer FTM_CREATE_OBJECT("Create Object"); @@ -501,6 +502,8 @@ void LLViewerObject::initVOClasses() LLVOGrass::initClass(); LLVOWater::initClass(); LLVOVolume::initClass(); + + initObjectDataMap(); } void LLViewerObject::cleanupVOClasses() @@ -510,6 +513,118 @@ void LLViewerObject::cleanupVOClasses() LLVOTree::cleanupClass(); LLVOAvatar::cleanupClass(); LLVOVolume::cleanupClass(); + + sObjectDataMap.clear(); +} + +//object data map for compressed && !OUT_TERSE_IMPROVED +//static +void LLViewerObject::initObjectDataMap() +{ + U32 count = 0; + + sObjectDataMap["ID"] = count; //full id //LLUUID + count += sizeof(LLUUID); + + sObjectDataMap["LocalID"] = count; //U32 + count += sizeof(U32); + + sObjectDataMap["PCode"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["State"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["CRC"] = count; //U32 + count += sizeof(U32); + + sObjectDataMap["Material"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["ClickAction"] = count; //U8 + count += sizeof(U8); + + sObjectDataMap["Scale"] = count; //LLVector3 + count += sizeof(LLVector3); + + sObjectDataMap["Pos"] = count; //LLVector3 + count += sizeof(LLVector3); + + sObjectDataMap["Rot"] = count; //LLVector3 + count += sizeof(LLVector3); + + sObjectDataMap["SpecialCode"] = count; //U32 + count += sizeof(U32); + + sObjectDataMap["Owner"] = count; //LLUUID + count += sizeof(LLUUID); + + sObjectDataMap["Omega"] = count; //LLVector3, when SpecialCode & 0x80 is set + count += sizeof(LLVector3); + + //ParentID is after Omega if there is Omega, otherwise is after Owner + sObjectDataMap["ParentID"] = count;//U32, when SpecialCode & 0x20 is set + count += sizeof(U32); + + //------- + //The rest items are not included here + //------- +} + +//static +void LLViewerObject::unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackVector3(value, name.c_str()); + dp->reset(); +} + +//static +void LLViewerObject::unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackUUID(value, name.c_str()); + dp->reset(); +} + +//static +void LLViewerObject::unpackU32(LLDataPackerBinaryBuffer* dp, U32& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackU32(value, name.c_str()); + dp->reset(); +} + +//static +void LLViewerObject::unpackU8(LLDataPackerBinaryBuffer* dp, U8& value, std::string name) +{ + dp->shift(sObjectDataMap[name]); + dp->unpackU8(value, name.c_str()); + dp->reset(); +} + +//static +U32 LLViewerObject::unpackParentID(LLDataPackerBinaryBuffer* dp, U32& parent_id) +{ + dp->shift(sObjectDataMap["SpecialCode"]); + U32 value; + dp->unpackU32(value, "SpecialCode"); + + parent_id = 0; + if(value & 0x20) + { + S32 offset = sObjectDataMap["ParentID"]; + if(!(value & 0x80)) + { + offset -= sizeof(LLVector3); + } + + dp->shift(offset); + dp->unpackU32(parent_id, "ParentID"); + } + dp->reset(); + + return parent_id; } // Replaces all name value pairs with data from \n delimited list @@ -890,6 +1005,25 @@ U32 LLViewerObject::checkMediaURL(const std::string &media_url) return retval; } +//extract spatial information from object update message +//return parent_id +//static +U32 LLViewerObject::extractSpatialExtents(LLDataPackerBinaryBuffer *dp, LLVector3& pos, LLVector3& scale, LLQuaternion& rot) +{ + U32 parent_id = 0; + + LLViewerObject::unpackVector3(dp, scale, "Scale"); + LLViewerObject::unpackVector3(dp, pos, "Pos"); + + LLVector3 vec; + LLViewerObject::unpackVector3(dp, vec, "Rot"); + rot.unpackFromVector3(vec); + + LLViewerObject::unpackParentID(dp, parent_id); + + return parent_id; +} + U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, U32 block_num, diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 20254bfe02..2db30f1e24 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -70,6 +70,7 @@ class LLViewerRegion; class LLViewerObjectMedia; class LLVOInventoryListener; class LLVOAvatar; +class LLDataPackerBinaryBuffer; typedef enum e_object_update_type { @@ -162,6 +163,7 @@ public: INVALID_UPDATE = 0x80000000 }; + static U32 extractSpatialExtents(LLDataPackerBinaryBuffer *dp, LLVector3& pos, LLVector3& scale, LLQuaternion& rot); virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, U32 block_num, @@ -539,6 +541,13 @@ public: friend class LLViewerObjectList; friend class LLViewerMediaList; +public: + static void unpackVector3(LLDataPackerBinaryBuffer* dp, LLVector3& value, std::string name); + static void unpackUUID(LLDataPackerBinaryBuffer* dp, LLUUID& value, std::string name); + static void unpackU32(LLDataPackerBinaryBuffer* dp, U32& value, std::string name); + static void unpackU8(LLDataPackerBinaryBuffer* dp, U8& value, std::string name); + static U32 unpackParentID(LLDataPackerBinaryBuffer* dp, U32& parent_id); + public: //counter-translation void resetChildrenPosition(const LLVector3& offset, BOOL simplified = FALSE) ; @@ -562,6 +571,8 @@ private: // Motion prediction between updates void interpolateLinearMotion(const F64 & time, const F32 & dt); + static void initObjectDataMap(); + public: // // Viewer-side only types - use the LL_PCODE_APP mask. @@ -610,6 +621,7 @@ private: // Grabbed from UPDATE_FLAGS U32 mFlags; + static std::map sObjectDataMap; public: // Sent to sim in UPDATE_FLAGS, received in ObjectPhysicsProperties U8 mPhysicsShapeType; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index dce963c5c5..995c3e7351 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -455,12 +455,54 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, uncompressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compressed_dpbuffer, 0, i); compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length); +#if 0 + if (compressed) + { + if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? + { + U32 flags = 0; + mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); + + if(!(flags & FLAGS_TEMPORARY_ON_REZ)) + { + //bCached = true; + + compressed_dp.unpackU32(local_id, "LocalID"); + //------------- + compressed_dp.unpackUUID(fullid, "ID"); + //if(fullid == LLUUID("1e5183db-8f28-47f1-abe0-23de9f9042b7")) + { + llinfos << fullid << llendl; + } + //------------- + + U32 crc; + compressed_dp.unpackU32(crc, "CRC"); + /*LLViewerRegion::eCacheUpdateResult result = */regionp->cacheFullUpdate(local_id, crc, compressed_dp); + //recorder.cacheFullUpdate(local_id, update_type, result, objectp, msg_size); + + continue; //do not creat LLViewerObject for cacheable object, object cache will do the job. + } + } + } +#endif if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? { - compressed_dp.unpackUUID(fullid, "ID"); - compressed_dp.unpackU32(local_id, "LocalID"); - compressed_dp.unpackU8(pcode, "PCode"); + U32 flags = 0; + mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); + + if(flags & FLAGS_TEMPORARY_ON_REZ) + { + compressed_dp.unpackUUID(fullid, "ID"); + compressed_dp.unpackU32(local_id, "LocalID"); + compressed_dp.unpackU8(pcode, "PCode"); + } + else //send to object cache + { + regionp->cacheFullUpdate(compressed_dp); + continue; + } } else { @@ -594,6 +636,8 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, objectp->mLocalID = local_id; } processUpdateCore(objectp, user_data, i, update_type, &compressed_dp, justCreated); + +#if 0 if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? { U32 flags = 0; @@ -606,6 +650,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, recorder.cacheFullUpdate(local_id, update_type, result, objectp, msg_size); } } +#endif } else { diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index e5cb2a1b08..040b39bc43 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -880,7 +880,7 @@ void LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group) mImpl->mVisibleGroups.insert(group); } -void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) +void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry, bool forced) { if(!sVOCacheCullingEnabled) { @@ -895,7 +895,7 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { return; } - if(!entry->hasState(LLVOCacheEntry::ADD_TO_CACHE_TREE)) + if(!forced && !entry->hasState(LLVOCacheEntry::ADD_TO_CACHE_TREE)) { return; //can not add to vo cache tree. } @@ -1647,14 +1647,91 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) mSimulatorFeatures = sim_features; } -LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) +void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) +{ + if(entry != NULL && !entry->getEntry()) + { + entry->setOctreeEntry(NULL); + } + else + { + return; //not new entry, no post processing. + } + + LLVector3 pos; + LLVector3 scale; + LLQuaternion rot; + U32 parent_id = LLViewerObject::extractSpatialExtents(entry->getDP(), pos, scale, rot); + + entry->setBoundingInfo(pos, scale); + + if(parent_id > 0) //has parent + { + //1, find parent, update position + LLVOCacheEntry* parent = getCacheEntry(parent_id); + + //2, if can not, put into the orphan lists: a parents list and a children list + if(!parent) + { + std::map::iterator iter = mOrphanMap.find(parent_id); + if(iter != mOrphanMap.end()) + { + iter->second.addChild(entry->getLocalID()); + } + else + { + OrphanList o_list(entry->getLocalID()); + mOrphanMap[parent_id] = o_list; + } + + return; + } + else + { + entry->updateBoundingInfo(parent); + } + } + + if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) + { + addToVOCacheTree(entry, true); + } + + if(!parent_id) //a potential parent + { + //find all children and update their bounding info + std::map::iterator iter = mOrphanMap.find(entry->getLocalID()); + if(iter != mOrphanMap.end()) + { + std::set* children = mOrphanMap[parent_id].getChildList(); + for(std::set::iterator child_iter = children->begin(); child_iter != children->end(); ++child_iter) + { + LLVOCacheEntry* child = getCacheEntry(*child_iter); + if(child) + { + child->updateBoundingInfo(entry); + addToVOCacheTree(child); + } + } + + mOrphanMap.erase(entry->getLocalID()); + } + } + + return ; +} + +LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerBinaryBuffer &dp) { - U32 local_id = objectp->getLocalID(); - U32 crc = objectp->getCRC(); eCacheUpdateResult result; + U32 crc; + U32 local_id; - LLVOCacheEntry* entry = getCacheEntry(local_id); + LLViewerObject::unpackU32(&dp, local_id, "LocalID"); + LLViewerObject::unpackU32(&dp, crc, "CRC"); + LLVOCacheEntry* entry = getCacheEntry(local_id); + if (entry) { // we've seen this object before @@ -1668,9 +1745,22 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec { // Update the cache entry LLPointer new_entry = new LLVOCacheEntry(local_id, crc, dp); - replaceCacheEntry(entry, new_entry); - entry = new_entry; - + + //if visible, update it + if(!entry->isState(LLVOCacheEntry::INACTIVE)) + { + replaceCacheEntry(entry, new_entry); + } + else //invisible + { + //remove old entry + killCacheEntry(entry); + entry = new_entry; + + mImpl->mCacheMap[local_id] = entry; + postProcesNewEntry(entry); + } + result = CACHE_UPDATE_CHANGED; } } @@ -1679,17 +1769,21 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec // we haven't seen this object before // Create new entry and add to map result = CACHE_UPDATE_ADDED; - //if (mImpl->mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES) - //{ - // delete mImpl->mCacheMap.begin()->second ; - // mImpl->mCacheMap.erase(mImpl->mCacheMap.begin()); - // result = CACHE_UPDATE_REPLACED; - // - //} entry = new LLVOCacheEntry(local_id, crc, dp); - + mImpl->mCacheMap[local_id] = entry; + + postProcesNewEntry(entry); } + + return result; +} + +LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) +{ + eCacheUpdateResult result = cacheFullUpdate(dp); + + LLVOCacheEntry* entry = mImpl->mCacheMap[objectp->getLocalID()]; if(objectp->mDrawable.notNull() && !entry->getEntry()) { @@ -1754,13 +1848,13 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss // Record a hit entry->recordHit(); cache_miss_type = CACHE_MISS_TYPE_NONE; - + if(entry->getGroup() || !entry->isState(LLVOCacheEntry::INACTIVE)) { return true; } - - addVisibleCacheEntry(entry); + //addVisibleCacheEntry(entry); + addToVOCacheTree(entry, true); return true; } else diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index de14c0fe27..6da8c191a4 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -317,6 +317,7 @@ public: } eCacheUpdateResult; // handle a full update message + eCacheUpdateResult cacheFullUpdate(LLDataPackerBinaryBuffer &dp); eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp); LLVOCacheEntry* getCacheEntryForOctree(U32 local_id); bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type); @@ -347,7 +348,7 @@ public: void getNeighboringRegionsStatus( std::vector& regions ); private: - void addToVOCacheTree(LLVOCacheEntry* entry); + void addToVOCacheTree(LLVOCacheEntry* entry, bool forced = false); LLViewerObject* addNewObject(LLVOCacheEntry* entry); void killObject(LLVOCacheEntry* entry, std::vector& delete_list); LLVOCacheEntry* getCacheEntry(U32 local_id); @@ -360,6 +361,7 @@ private: F32 updateVisibleEntries(F32 max_time); //update visible entries void addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight); + void postProcesNewEntry(LLVOCacheEntry* entry); public: struct CompareDistance { @@ -445,6 +447,21 @@ private: BOOL mReleaseNotesRequested; BOOL mDead; //if true, this region is in the process of deleting. + class OrphanList + { + public: + OrphanList(){} + OrphanList(U32 child_id){addChild(child_id);} + + void addChild(U32 child_id) {mChildList.insert(child_id);} + std::set* getChildList() {return &mChildList;} + + private: + std::set mChildList; + }; + + std::map mOrphanMap; + class CacheMissItem { public: diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 86cfbb1d74..26c3e04b92 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -198,10 +198,8 @@ void LLVOCacheEntry::setOctreeEntry(LLViewerOctreeEntry* entry) if(!entry && mDP.getBufferSize() > 0) { LLUUID fullid; - mDP.reset(); - mDP.unpackUUID(fullid, "ID"); - mDP.reset(); - + LLViewerObject::unpackUUID(&mDP, fullid, "ID"); + LLViewerObject* obj = gObjectList.findObject(fullid); if(obj && obj->mDrawable) { @@ -402,6 +400,28 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector3& camera_origin, bool setVisible(); } +void LLVOCacheEntry::setBoundingInfo(const LLVector3& pos, const LLVector3& scale) +{ + LLVector4a center, newMin, newMax; + center.load3(pos.mV); + LLVector4a size; + size.load3(scale.mV); + newMin.setSub(center, size); + newMax.setAdd(center, size); + + setPositionGroup(center); + setSpatialExtents(newMin, newMax); + setBinRadius(llmin(size.getLength3().getF32() * 4.f, 256.f)); +} + +void LLVOCacheEntry::updateBoundingInfo(LLVOCacheEntry* parent) +{ + //LLVector4a old_pos = getPositionGroup(); + //parent->getPositionRegion() + (getPosition() * parent->getRotation()); + + shift(parent->getPositionGroup()); +} + //------------------------------------------------------------------- //LLVOCachePartition //------------------------------------------------------------------- diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index c631e12739..7c1706e650 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -116,6 +116,10 @@ public: S32 getNumOfChildren() {return mChildrenList.size();} void clearChildrenList() {mChildrenList.clear();} + //called from processing object update message + void setBoundingInfo(const LLVector3& pos, const LLVector3& scale); + void updateBoundingInfo(LLVOCacheEntry* parent); + public: typedef std::map > vocache_entry_map_t; typedef std::set vocache_entry_set_t; -- cgit v1.2.3 From 03b7fb589a9b5628418364c970ea402448f312be Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 4 Mar 2013 11:48:07 -0700 Subject: trivial: convert to unix line endings. --- indra/newview/llviewerregion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 040b39bc43..b287e0da9c 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1692,8 +1692,8 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) } } - if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) - { + if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) + { addToVOCacheTree(entry, true); } -- cgit v1.2.3 From 50b32cf2bdb93fad14770aa0f6b92fb3815ebdf0 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 7 Mar 2013 23:54:11 -0700 Subject: for SH-3937: interesting: implement the new cache probe logic --- indra/newview/llviewerobject.cpp | 16 ----- indra/newview/llviewerobject.h | 3 +- indra/newview/llviewerobjectlist.cpp | 59 ++++++++---------- indra/newview/llviewerobjectlist.h | 2 +- indra/newview/llviewerregion.cpp | 116 +++++++++++++++++++++++++++++------ indra/newview/llviewerregion.h | 11 ++-- indra/newview/llvocache.cpp | 81 +++++------------------- indra/newview/llvocache.h | 26 ++++---- 8 files changed, 161 insertions(+), 153 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e50509374d..bf7590c640 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -328,22 +328,6 @@ void LLViewerObject::deleteTEImages() mTEImages = NULL; } -//if enabled, add this object to vo cache tree when removed from rendering. -void LLViewerObject::EnableToCacheTree(bool enabled) -{ - if(mDrawable.notNull() && mDrawable->getEntry() && mDrawable->getEntry()->hasVOCacheEntry()) - { - if(enabled) - { - ((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->addState(LLVOCacheEntry::ADD_TO_CACHE_TREE); - } - else - { - ((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->clearState(LLVOCacheEntry::ADD_TO_CACHE_TREE); - } - } -} - void LLViewerObject::markDead() { if (!mDead) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 2db30f1e24..eda9692e19 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -137,8 +137,7 @@ public: BOOL isDead() const {return mDead;} BOOL isOrphaned() const { return mOrphaned; } BOOL isParticleSource() const; - void EnableToCacheTree(bool enabled); - + virtual LLVOAvatar* asAvatar(); static void initVOClasses(); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 995c3e7351..4c959447c6 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -446,6 +446,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, LLTimer update_timer; BOOL justCreated = FALSE; S32 msg_size = 0; + bool remove_from_cache = false; //remove from object cache if it is a full-update or terse update if (compressed) { @@ -455,38 +456,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, uncompressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compressed_dpbuffer, 0, i); compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length); -#if 0 - if (compressed) - { - if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? - { - U32 flags = 0; - mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); - - if(!(flags & FLAGS_TEMPORARY_ON_REZ)) - { - //bCached = true; - - compressed_dp.unpackU32(local_id, "LocalID"); - //------------- - compressed_dp.unpackUUID(fullid, "ID"); - //if(fullid == LLUUID("1e5183db-8f28-47f1-abe0-23de9f9042b7")) - { - llinfos << fullid << llendl; - } - //------------- - - U32 crc; - compressed_dp.unpackU32(crc, "CRC"); - /*LLViewerRegion::eCacheUpdateResult result = */regionp->cacheFullUpdate(local_id, crc, compressed_dp); - //recorder.cacheFullUpdate(local_id, update_type, result, objectp, msg_size); - - continue; //do not creat LLViewerObject for cacheable object, object cache will do the job. - } - } - } -#endif if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? { U32 flags = 0; @@ -506,6 +476,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, } else { + remove_from_cache = true; compressed_dp.unpackU32(local_id, "LocalID"); getUUIDFromLocal(fullid, local_id, @@ -535,6 +506,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, } else // OUT_FULL only? { + remove_from_cache = true; mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FullID, fullid, i); mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i); msg_size += sizeof(LLUUID); @@ -542,6 +514,11 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, // llinfos << "Full Update, obj " << local_id << ", global ID" << fullid << "from " << mesgsys->getSender() << llendl; } objectp = findObject(fullid); + + if(remove_from_cache) + { + objectp = regionp->forceToRemoveFromCache(local_id, objectp); + } // This looks like it will break if the local_id of the object doesn't change // upon boundary crossing, but we check for region id matching later... @@ -618,11 +595,11 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, recorder.objectUpdateFailure(local_id, update_type, msg_size); continue; } + justCreated = TRUE; mNumNewObjects++; } - if (objectp->isDead()) { llwarns << "Dead object " << objectp->mID << " in UUID map 1!" << llendl; @@ -1371,7 +1348,7 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep) } } -BOOL LLViewerObjectList::killObject(LLViewerObject *objectp, bool cache_enabled) +BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) { // Don't ever kill gAgentAvatarp, just force it to the agent's region // unless region is NULL which is assumed to mean you are logging out. @@ -1386,7 +1363,6 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp, bool cache_enabled) if (objectp) { - objectp->EnableToCacheTree(cache_enabled); //enable to add to VO cache tree if set. objectp->markDead(); // does the right thing if object already dead return TRUE; } @@ -2113,6 +2089,15 @@ S32 LLViewerObjectList::findReferences(LLDrawable *drawablep) const void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port) { + if(childp->getRegion()) + { + LLVOCacheEntry* entry = childp->getRegion()->getCacheEntry(childp->getLocalID()); + if(entry != NULL && !entry->isTouched()) + { + return; //object cache will take care of this. + } + } + #ifdef ORPHAN_SPAM llinfos << "Orphaning object " << childp->getID() << " with parent " << parent_id << llendl; #endif @@ -2168,6 +2153,12 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) return; } + //search object cache to get orphans + if(objectp->getRegion()) + { + objectp->getRegion()->findOrphans(objectp->getLocalID()); + } + // See if we are a parent of an orphan. // Note: This code is fairly inefficient but it should happen very rarely. // It can be sped up if this is somehow a performance issue... diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index b92be61fae..49931fe75c 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -72,7 +72,7 @@ public: LLViewerObject *replaceObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); // TomY: hack to switch VO instances on the fly - BOOL killObject(LLViewerObject *objectp, bool cache_enabled = false); + BOOL killObject(LLViewerObject *objectp); void killObjects(LLViewerRegion *regionp); // Kill all objects owned by a particular region. void killAllObjects(); void removeDrawable(LLDrawable* drawablep); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b287e0da9c..704b3b644f 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -460,7 +460,11 @@ void LLViewerRegion::saveObjectCache() if(LLVOCache::hasInstance()) { - LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty) ; + //NOTE: !!!!!!!!!! + //set this to be true when support full region cache probe!!!! + BOOL full_region_cache_probe = FALSE; + + LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, full_region_cache_probe) ; mCacheDirty = FALSE; } @@ -744,11 +748,13 @@ void LLViewerRegion::dirtyHeights() void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry) { U32 state = LLVOCacheEntry::INACTIVE; + bool in_vo_tree = false; if(old_entry) { old_entry->copyTo(new_entry); - state = old_entry->getState(); + state = old_entry->getState(); + in_vo_tree = (state == LLVOCacheEntry::INACTIVE && old_entry->getGroup() != NULL); killCacheEntry(old_entry); } @@ -763,7 +769,7 @@ void LLViewerRegion::replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry { mImpl->mWaitingSet.insert(new_entry); } - else if(old_entry && new_entry->getEntry()) + else if(!old_entry || in_vo_tree) { addToVOCacheTree(new_entry); } @@ -880,7 +886,7 @@ void LLViewerRegion::addVisibleGroup(LLviewerOctreeGroup* group) mImpl->mVisibleGroups.insert(group); } -void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry, bool forced) +void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) { if(!sVOCacheCullingEnabled) { @@ -895,10 +901,6 @@ void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry, bool forced) { return; } - if(!forced && !entry->hasState(LLVOCacheEntry::ADD_TO_CACHE_TREE)) - { - return; //can not add to vo cache tree. - } mImpl->mVOCachePartition->addEntry(entry->getEntry()); } @@ -1039,6 +1041,17 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time) { LLVOCacheEntry* vo_entry = (LLVOCacheEntry*)(*i)->getVOCacheEntry(); + if(vo_entry->getParentID() > 0) //is a child + { + LLVOCacheEntry* parent = getCacheEntry(vo_entry->getParentID()); + + //make sure the parent is active + if(!parent || !parent->isState(LLVOCacheEntry::ACTIVE)) + { + continue; + } + } + vo_entry->calcSceneContribution(camera_origin, needs_update, mImpl->mLastCameraUpdate); mImpl->mWaitingList.insert(vo_entry); } @@ -1140,7 +1153,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) } for(S32 i = 0; i < delete_list.size(); i++) { - gObjectList.killObject(delete_list[i]->getVObj(), true); + gObjectList.killObject(delete_list[i]->getVObj()); } delete_list.clear(); @@ -1194,6 +1207,28 @@ LLViewerObject* LLViewerRegion::addNewObject(LLVOCacheEntry* entry) return obj; } +//remove from object cache if the object receives a full-update or terse update +LLViewerObject* LLViewerRegion::forceToRemoveFromCache(U32 local_id, LLViewerObject* objectp) +{ + LLVOCacheEntry* entry = getCacheEntry(local_id); + if (!entry) + { + return objectp; //not in the cache, do nothing. + } + if(!objectp) //object not created + { + entry->setTouched(FALSE); //mark this entry invalid + + //create a new object before delete it from cache. + objectp = gObjectList.processObjectUpdateFromCache(entry, this); + } + + //remove from cache. + killCacheEntry(entry); + + return objectp; +} + // As above, but forcibly do the update. void LLViewerRegion::forceUpdate() { @@ -1647,15 +1682,32 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) mSimulatorFeatures = sim_features; } -void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) +//this is called when the parent is not cacheable. +//move all orphan children out of cache and insert to rendering octree. +void LLViewerRegion::findOrphans(U32 parent_id) +{ + std::map::iterator iter = mOrphanMap.find(parent_id); + if(iter != mOrphanMap.end()) + { + std::set* children = mOrphanMap[parent_id].getChildList(); + for(std::set::iterator child_iter = children->begin(); child_iter != children->end(); ++child_iter) + { + forceToRemoveFromCache(*child_iter, NULL); + } + + mOrphanMap.erase(parent_id); + } +} + +void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) { if(entry != NULL && !entry->getEntry()) { entry->setOctreeEntry(NULL); } - else + else if(entry->getGroup() != NULL) { - return; //not new entry, no post processing. + return; //already in octree, no post processing. } LLVector3 pos; @@ -1667,11 +1719,13 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) if(parent_id > 0) //has parent { + entry->setParentID(parent_id); + //1, find parent, update position LLVOCacheEntry* parent = getCacheEntry(parent_id); - //2, if can not, put into the orphan lists: a parents list and a children list - if(!parent) + //2, if can not, put into the orphan list. + if(!parent || !parent->getGroup()) { std::map::iterator iter = mOrphanMap.find(parent_id); if(iter != mOrphanMap.end()) @@ -1680,6 +1734,24 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) } else { + //check if the parent is an uncacheable object + if(!parent) + { + LLUUID parent_uuid; + LLViewerObjectList::getUUIDFromLocal(parent_uuid, + parent_id, + getHost().getAddress(), + getHost().getPort()); + LLViewerObject *parent_objp = gObjectList.findObject(parent_uuid); + if(parent_objp) + { + //parent is not cacheable, remove child from the cache. + forceToRemoveFromCache(entry->getLocalID(), NULL); + return; + } + } + + //otherwise insert to the orphan list OrphanList o_list(entry->getLocalID()); mOrphanMap[parent_id] = o_list; } @@ -1688,13 +1760,14 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) } else { + //update the child position to the region space. entry->updateBoundingInfo(parent); } } if(!entry->getGroup() && entry->isState(LLVOCacheEntry::INACTIVE)) { - addToVOCacheTree(entry, true); + addToVOCacheTree(entry); } if(!parent_id) //a potential parent @@ -1709,6 +1782,7 @@ void LLViewerRegion::postProcesNewEntry(LLVOCacheEntry* entry) LLVOCacheEntry* child = getCacheEntry(*child_iter); if(child) { + //update the child position to the region space. child->updateBoundingInfo(entry); addToVOCacheTree(child); } @@ -1758,7 +1832,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB entry = new_entry; mImpl->mCacheMap[local_id] = entry; - postProcesNewEntry(entry); + decodeBoundingInfo(entry); } result = CACHE_UPDATE_CHANGED; @@ -1773,7 +1847,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB mImpl->mCacheMap[local_id] = entry; - postProcesNewEntry(entry); + decodeBoundingInfo(entry); } return result; @@ -1784,6 +1858,10 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec eCacheUpdateResult result = cacheFullUpdate(dp); LLVOCacheEntry* entry = mImpl->mCacheMap[objectp->getLocalID()]; + if(!entry) + { + return result; + } if(objectp->mDrawable.notNull() && !entry->getEntry()) { @@ -1853,8 +1931,8 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss { return true; } - //addVisibleCacheEntry(entry); - addToVOCacheTree(entry, true); + + decodeBoundingInfo(entry); return true; } else diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 6da8c191a4..4fc74ee7c3 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -320,9 +320,13 @@ public: eCacheUpdateResult cacheFullUpdate(LLDataPackerBinaryBuffer &dp); eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp); LLVOCacheEntry* getCacheEntryForOctree(U32 local_id); + LLVOCacheEntry* getCacheEntry(U32 local_id); bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type); void requestCacheMisses(); void addCacheMissFull(const U32 local_id); + //remove from object cache if the object receives a full-update or terse update + LLViewerObject* forceToRemoveFromCache(U32 local_id, LLViewerObject* objectp); + void findOrphans(U32 parent_id); void dumpCache(); @@ -348,10 +352,9 @@ public: void getNeighboringRegionsStatus( std::vector& regions ); private: - void addToVOCacheTree(LLVOCacheEntry* entry, bool forced = false); + void addToVOCacheTree(LLVOCacheEntry* entry); LLViewerObject* addNewObject(LLVOCacheEntry* entry); - void killObject(LLVOCacheEntry* entry, std::vector& delete_list); - LLVOCacheEntry* getCacheEntry(U32 local_id); + void killObject(LLVOCacheEntry* entry, std::vector& delete_list); void removeFromVOCacheTree(LLVOCacheEntry* entry); void replaceCacheEntry(LLVOCacheEntry* old_entry, LLVOCacheEntry* new_entry); void killCacheEntry(LLVOCacheEntry* entry); //physically delete the cache entry @@ -361,7 +364,7 @@ private: F32 updateVisibleEntries(F32 max_time); //update visible entries void addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight); - void postProcesNewEntry(LLVOCacheEntry* entry); + void decodeBoundingInfo(LLVOCacheEntry* entry); public: struct CompareDistance { diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 26c3e04b92..a9e0dd39d5 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -59,7 +59,9 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mState(INACTIVE), mRepeatedVisCounter(0), mVisFrameRange(64), - mSceneContrib(0.f) + mSceneContrib(0.f), + mTouched(TRUE), + mParentID(0) { mBuffer = new U8[dp.getBufferSize()]; mDP.assignBuffer(mBuffer, dp.getBufferSize()); @@ -77,7 +79,9 @@ LLVOCacheEntry::LLVOCacheEntry() mState(INACTIVE), mRepeatedVisCounter(0), mVisFrameRange(64), - mSceneContrib(0.f) + mSceneContrib(0.f), + mTouched(TRUE), + mParentID(0) { mDP.assignBuffer(mBuffer, 0); } @@ -88,7 +92,9 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) mState(INACTIVE), mRepeatedVisCounter(0), mVisFrameRange(64), - mSceneContrib(0.f) + mSceneContrib(0.f), + mTouched(FALSE), + mParentID(0) { S32 size = -1; BOOL success; @@ -114,36 +120,6 @@ 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); - - 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)); - - 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)); @@ -229,9 +205,7 @@ void LLVOCacheEntry::copyTo(LLVOCacheEntry* new_entry) void LLVOCacheEntry::setState(U32 state) { - mState &= 0xffff0000; //clear the low 16 bits - state &= 0x0000ffff; //clear the high 16 bits; - mState |= state; + mState = state; if(getState() == ACTIVE) { @@ -298,6 +272,7 @@ LLDataPackerBinaryBuffer *LLVOCacheEntry::getDP() void LLVOCacheEntry::recordHit() { + setTouched(); mHitCount++; } @@ -338,33 +313,6 @@ 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]); - 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]); - 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)); @@ -958,7 +906,7 @@ void LLVOCache::purgeEntries(U32 size) mNumEntries = mHandleEntryMap.size() ; } -void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache) +void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, BOOL full_region_cache_probe) { if(!mEnabled) { @@ -1031,7 +979,10 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: for (LLVOCacheEntry::vocache_entry_map_t::const_iterator iter = cache_entry_map.begin(); success && iter != cache_entry_map.end(); ++iter) { - success = iter->second->writeToFile(&apr_file) ; + if(!full_region_cache_probe || iter->second->isTouched()) + { + success = iter->second->writeToFile(&apr_file) ; + } } } } diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 7c1706e650..a64944f562 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -41,7 +41,7 @@ class LLCamera; class LLVOCacheEntry : public LLViewerOctreeEntryData { public: - enum + enum //low 16-bit state { INACTIVE = 0x00000000, //not visible IN_QUEUE = 0x00000001, //in visible queue, object to be created @@ -49,11 +49,6 @@ public: ACTIVE = 0x00000004 //object created, and in rendering pipeline. }; - enum - { - ADD_TO_CACHE_TREE = 0x00010000, //has parent - }; - struct CompareVOCacheEntry { bool operator()(const LLVOCacheEntry* const& lhs, const LLVOCacheEntry* const& rhs) @@ -84,12 +79,10 @@ public: LLVOCacheEntry(); void setState(U32 state); - void clearState(U32 state) {mState &= ~state;} - void addState(U32 state) {mState |= state;} - bool isState(U32 state) {return (mState & 0xffff) == state;} + //void clearState(U32 state) {mState &= ~state;} + bool isState(U32 state) {return mState == state;} bool hasState(U32 state) {return mState & state;} - U32 getState() const {return (mState & 0xffff);} - U32 getFullState() const {return mState;} + U32 getState() const {return mState;} U32 getLocalID() const { return mLocalID; } U32 getCRC() const { return mCRC; } @@ -111,6 +104,9 @@ public: void copyTo(LLVOCacheEntry* new_entry); //copy variables /*virtual*/ void setOctreeEntry(LLViewerOctreeEntry* entry); + void setParentID(U32 id) {mParentID = id;} + U32 getParentID() const {return mParentID;} + void addChild(LLVOCacheEntry* entry); LLVOCacheEntry* getChild(S32 i) {return mChildrenList[i];} S32 getNumOfChildren() {return mChildrenList.size();} @@ -119,6 +115,9 @@ public: //called from processing object update message void setBoundingInfo(const LLVector3& pos, const LLVector3& scale); void updateBoundingInfo(LLVOCacheEntry* parent); + + void setTouched(BOOL touched = TRUE) {mTouched = touched;} + BOOL isTouched() const {return mTouched;} public: typedef std::map > vocache_entry_map_t; @@ -127,6 +126,7 @@ public: protected: U32 mLocalID; + U32 mParentID; U32 mCRC; S32 mHitCount; S32 mDupeCount; @@ -139,6 +139,8 @@ protected: S32 mRepeatedVisCounter; //number of repeatedly visible within a short time. U32 mState; //high 16 bits reserved for special use. std::vector mChildrenList; //children entries in a linked set. + + BOOL mTouched; //if set, this entry is valid, otherwise it is invalid. }; class LLVOCachePartition : public LLViewerOctreePartition @@ -199,7 +201,7 @@ public: void removeCache(ELLPath location) ; void readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) ; - void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache) ; + void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, BOOL full_region_cache_probe); void removeEntry(U64 handle) ; void setReadOnly(BOOL read_only) {mReadOnly = read_only;} -- cgit v1.2.3 From 81edcde603b82233662d13d58f8b0c7955b5a7e1 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 8 Mar 2013 11:14:03 -0700 Subject: remove some redundant code for SH-3937: interesting: implement the new cache probe logic --- indra/newview/llviewerobjectlist.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 4c959447c6..6202a7b6cc 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -2089,15 +2089,6 @@ S32 LLViewerObjectList::findReferences(LLDrawable *drawablep) const void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip, U32 port) { - if(childp->getRegion()) - { - LLVOCacheEntry* entry = childp->getRegion()->getCacheEntry(childp->getLocalID()); - if(entry != NULL && !entry->isTouched()) - { - return; //object cache will take care of this. - } - } - #ifdef ORPHAN_SPAM llinfos << "Orphaning object " << childp->getID() << " with parent " << parent_id << llendl; #endif -- cgit v1.2.3 From 79dc4a1190a2954a7f1338596aa2d63ea3a96fff Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 11 Mar 2013 11:34:22 -0600 Subject: for SH-3976: interesting: make new object cache be able to handle shadows. --- indra/newview/llvocache.cpp | 9 +-------- indra/newview/llvocache.h | 3 --- 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index a9e0dd39d5..ac97f1b6ce 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -377,8 +377,7 @@ LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp) { mRegionp = regionp; mPartitionType = LLViewerRegion::PARTITION_VO_CACHE; - mVisitedTime = 0; - + new LLviewerOctreeGroup(mOctree); } @@ -445,12 +444,6 @@ S32 LLVOCachePartition::cull(LLCamera &camera) return 0; } - if(mVisitedTime == LLViewerOctreeEntryData::getCurrentFrame()) - { - return 0; //already visited. - } - mVisitedTime = LLViewerOctreeEntryData::getCurrentFrame(); - ((LLviewerOctreeGroup*)mOctree->getListener(0))->rebound(); //localize the camera diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index a64944f562..ca25583922 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -151,9 +151,6 @@ public: void addEntry(LLViewerOctreeEntry* entry); void removeEntry(LLViewerOctreeEntry* entry); /*virtual*/ S32 cull(LLCamera &camera); - -private: - U32 mVisitedTime; }; // -- cgit v1.2.3 From 27bb36b1e796add58f319555bf761e417f7957ef Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 11 Mar 2013 21:23:15 -0600 Subject: for SH-3979: interesting: can not edit objects with new object cache code --- indra/newview/llviewerobject.cpp | 20 +++++++++++++++----- indra/newview/llviewerobject.h | 1 + indra/newview/llviewerobjectlist.cpp | 7 ++++--- indra/newview/llviewerregion.cpp | 18 ++++++++++++++---- indra/newview/llviewerregion.h | 4 ++-- indra/newview/llvocache.cpp | 3 +++ indra/newview/llvocache.h | 4 ++++ 7 files changed, 43 insertions(+), 14 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index bf7590c640..dca159f982 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1838,11 +1838,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, { U32 flags; mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, block_num); - // keep local flags and overwrite remote-controlled flags - mFlags = (mFlags & FLAGS_LOCAL) | flags; - - // ...new objects that should come in selected need to be added to the selected list - mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0); + loadFlags(flags); } } break; @@ -2343,7 +2339,21 @@ BOOL LLViewerObject::isActive() const return TRUE; } +//load flags from cache or from message +void LLViewerObject::loadFlags(U32 flags) +{ + if(flags == (U32)(-1)) + { + return; //invalid + } + + // keep local flags and overwrite remote-controlled flags + mFlags = (mFlags & FLAGS_LOCAL) | flags; + // ...new objects that should come in selected need to be added to the selected list + mCreateSelected = ((flags & FLAGS_CREATE_SELECTED) != 0); + return; +} void LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index eda9692e19..a1f63faf5b 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -511,6 +511,7 @@ public: virtual void updateRegion(LLViewerRegion *regionp); void updateFlags(BOOL physics_changed = FALSE); + void loadFlags(U32 flags); //load flags from cache or from message BOOL setFlags(U32 flag, BOOL state); BOOL setFlagsWithoutUpdate(U32 flag, BOOL state); void setPhysicsShapeType(U8 type); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 6202a7b6cc..873b6e1d03 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -365,7 +365,8 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry* } processUpdateCore(objectp, NULL, 0, OUT_FULL_CACHED, cached_dpp, justCreated, true); - + objectp->loadFlags(entry->getUpdateFlags()); //just in case, reload update flags from cache. + recorder.log(0.2f); LLVOAvatar::cullAvatarsByPixelArea(); @@ -470,7 +471,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, } else //send to object cache { - regionp->cacheFullUpdate(compressed_dp); + regionp->cacheFullUpdate(compressed_dp, flags); continue; } } @@ -623,7 +624,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, if(!(flags & FLAGS_TEMPORARY_ON_REZ)) { bCached = true; - LLViewerRegion::eCacheUpdateResult result = objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp); + LLViewerRegion::eCacheUpdateResult result = objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp, flags); recorder.cacheFullUpdate(local_id, update_type, result, objectp, msg_size); } } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 704b3b644f..c74e7158b6 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1795,7 +1795,7 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) return ; } -LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerBinaryBuffer &dp) +LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerBinaryBuffer &dp, U32 flags) { eCacheUpdateResult result; U32 crc; @@ -1849,14 +1849,16 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLDataPackerB decodeBoundingInfo(entry); } - + entry->setUpdateFlags(flags); + return result; } -LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp) +LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp, U32 flags) { - eCacheUpdateResult result = cacheFullUpdate(dp); + eCacheUpdateResult result = cacheFullUpdate(dp, flags); +#if 0 LLVOCacheEntry* entry = mImpl->mCacheMap[objectp->getLocalID()]; if(!entry) { @@ -1871,6 +1873,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec { addActiveCacheEntry(entry); } +#endif return result; } @@ -1926,7 +1929,14 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss // Record a hit entry->recordHit(); cache_miss_type = CACHE_MISS_TYPE_NONE; + entry->setUpdateFlags(flags); + if(entry->isState(LLVOCacheEntry::ACTIVE)) + { + ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj()->loadFlags(flags); + return true; + } + if(entry->getGroup() || !entry->isState(LLVOCacheEntry::INACTIVE)) { return true; diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 4fc74ee7c3..a903f61cbc 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -317,8 +317,8 @@ public: } eCacheUpdateResult; // handle a full update message - eCacheUpdateResult cacheFullUpdate(LLDataPackerBinaryBuffer &dp); - eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp); + eCacheUpdateResult cacheFullUpdate(LLDataPackerBinaryBuffer &dp, U32 flags); + eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp, U32 flags); LLVOCacheEntry* getCacheEntryForOctree(U32 local_id); LLVOCacheEntry* getCacheEntry(U32 local_id); bool probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss_type); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index ac97f1b6ce..5f112675dc 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -53,6 +53,7 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mLocalID(local_id), mCRC(crc), + mUpdateFlags(-1), mHitCount(0), mDupeCount(0), mCRCChangeCount(0), @@ -72,6 +73,7 @@ LLVOCacheEntry::LLVOCacheEntry() : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mLocalID(0), mCRC(0), + mUpdateFlags(-1), mHitCount(0), mDupeCount(0), mCRCChangeCount(0), @@ -89,6 +91,7 @@ LLVOCacheEntry::LLVOCacheEntry() LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), mBuffer(NULL), + mUpdateFlags(-1), mState(INACTIVE), mRepeatedVisCounter(0), mVisFrameRange(64), diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index ca25583922..64eb876919 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -119,6 +119,9 @@ public: void setTouched(BOOL touched = TRUE) {mTouched = touched;} BOOL isTouched() const {return mTouched;} + void setUpdateFlags(U32 flags) {mUpdateFlags = flags;} + U32 getUpdateFlags() const {return mUpdateFlags;} + public: typedef std::map > vocache_entry_map_t; typedef std::set vocache_entry_set_t; @@ -128,6 +131,7 @@ protected: U32 mLocalID; U32 mParentID; U32 mCRC; + U32 mUpdateFlags; //receive from sim S32 mHitCount; S32 mDupeCount; S32 mCRCChangeCount; -- cgit v1.2.3 From 4624848a6894be669cdb19a82101ea168c407ecd Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 13 Mar 2013 22:31:19 -0600 Subject: revert changes for SH-3653: Can we repurpose ObjectUpdateCached:ObjectData:UpdateFlags field to carry spatial+size data? --- indra/newview/llviewerregion.cpp | 22 +++++----------------- indra/newview/llviewerregion.h | 17 +++-------------- 2 files changed, 8 insertions(+), 31 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index c74e7158b6..bf4bff60d7 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1896,21 +1896,9 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) return NULL; } -//estimate weight of cache missed object -F32 LLViewerRegion::calcObjectWeight(U32 flags) +void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type) { - LLVector3 pos((F32)(flags & 0xff) + 0.5f, (F32)((flags >> 8) & 0xff) + 0.5f, (F32)((flags >> 16) & 0xff) * 16.f + 8.0f); - F32 rad = (F32)((flags >> 24) & 0xff); - - pos += getOriginAgent(); - pos -= LLViewerCamera::getInstance()->getOrigin(); - - return 100.f * rad * rad / pos.lengthSquared(); -} - -void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight) -{ - mCacheMissList.insert(CacheMissItem(id, miss_type, weight)); + mCacheMissList.insert(CacheMissItem(id, miss_type)); } // Get data packer for this object, if we have cached data @@ -1949,13 +1937,13 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss { // llinfos << "CRC miss for " << local_id << llendl; - addCacheMiss(local_id, CACHE_MISS_TYPE_CRC, calcObjectWeight(flags)); + addCacheMiss(local_id, CACHE_MISS_TYPE_CRC); } } else { // llinfos << "Cache miss for " << local_id << llendl; - addCacheMiss(local_id, CACHE_MISS_TYPE_FULL, calcObjectWeight(flags)); + addCacheMiss(local_id, CACHE_MISS_TYPE_FULL); } return false; @@ -1963,7 +1951,7 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss void LLViewerRegion::addCacheMissFull(const U32 local_id) { - addCacheMiss(local_id, CACHE_MISS_TYPE_FULL, 100.f); + addCacheMiss(local_id, CACHE_MISS_TYPE_FULL); } void LLViewerRegion::requestCacheMisses() diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index a903f61cbc..15c2b36e38 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -169,9 +169,6 @@ public: const LLVector3d &getOriginGlobal() const; LLVector3 getOriginAgent() const; - //estimate weight of cache missed object - F32 calcObjectWeight(U32 flags); - // Center is at the height of the water table. const LLVector3d &getCenterGlobal() const; LLVector3 getCenterAgent() const; @@ -363,7 +360,7 @@ private: F32 createVisibleObjects(F32 max_time); F32 updateVisibleEntries(F32 max_time); //update visible entries - void addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight); + void addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type); void decodeBoundingInfo(LLVOCacheEntry* entry); public: struct CompareDistance @@ -468,24 +465,16 @@ private: class CacheMissItem { public: - CacheMissItem(U32 id, LLViewerRegion::eCacheMissType miss_type, F32 weight) : mID(id), mType(miss_type), mWeight(weight){} + CacheMissItem(U32 id, LLViewerRegion::eCacheMissType miss_type) : mID(id), mType(miss_type){} U32 mID; //local object id LLViewerRegion::eCacheMissType mType; //cache miss type - F32 mWeight; //importance of this object to the current camera. struct Compare { bool operator()(const CacheMissItem& lhs, const CacheMissItem& rhs) { - if(lhs.mWeight == rhs.mWeight) //larger weight first - { - return &lhs < &rhs; - } - else - { - return lhs.mWeight > rhs.mWeight; //larger weight first - } + return lhs.mID < rhs.mID; //smaller ID first. } }; -- cgit v1.2.3 From bdf562036a8ce864bf211b7696b1d74334030f4b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 13 Mar 2013 22:38:00 -0600 Subject: for SH-3913: the viewer should notify the region at connect time if it does not have a cache file --- indra/newview/llviewerregion.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index bf4bff60d7..bca2108964 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2164,7 +2164,13 @@ void LLViewerRegion::unpackRegionHandshake() msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("RegionInfo"); - msg->addU32("Flags", 0x0 ); + + U32 flags = 0x00000001; //set the bit 0 to be 1 to ask sim to send all cacheable objects. + if(mImpl->mCacheMap.empty()) + { + flags |= 0x00000002; //set the bit 1 to be 1 to tell sim the cache file is empty, no need to send cache probes. + } + msg->addU32("Flags", flags ); msg->sendReliable(host); } -- cgit v1.2.3 From f59bd5f89ffd2dadbd3d7514cfa8e8cc97172201 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 18 Mar 2013 23:38:23 -0700 Subject: fix for change in LLTrace API --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 4eb44bcc00..9f657887f1 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -487,7 +487,7 @@ void LLSceneMonitor::fetchQueryResult() if(mDiffResult > 0.01f) { mRecording->extend(); - sFramePixelDiff.sample(mDiffResult); + sample(sFramePixelDiff, mDiffResult); } //llinfos << count << " : " << mDiffResult << llendl; } -- cgit v1.2.3 From 041024e8e5d1f27ab77dc4fa2c1e38b8266e7b41 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 19 Mar 2013 11:00:13 -0700 Subject: build fix --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index 9f657887f1..c69f276aa2 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -463,7 +463,7 @@ void LLSceneMonitor::calcDiffAggregate() } } -static LLTrace::Measurement<> sFramePixelDiff("FramePixelDifference"); +static LLTrace::MeasurementStatHandle<> sFramePixelDiff("FramePixelDifference"); void LLSceneMonitor::fetchQueryResult() { if(!mHasNewQueryResult) -- cgit v1.2.3 From 933691ad133b552be3fdd26b0d9d26a09c3a7aa5 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 20 Mar 2013 16:29:48 -0600 Subject: for SH-4004: interesting: need debug option to clear viewer cache while still logged in --- indra/newview/llappviewer.cpp | 8 ++++++++ indra/newview/llappviewer.h | 1 + indra/newview/llviewermenu.cpp | 19 +++++++++++++++++++ indra/newview/llvocache.cpp | 14 +++++++++----- indra/newview/llvocache.h | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 10 ++++++++++ 6 files changed, 48 insertions(+), 6 deletions(-) (limited to 'indra') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0cb7c7b030..dc07c8f13b 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4006,6 +4006,14 @@ void LLAppViewer::purgeCache() gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), "*.*"); } +//purge cache immediately, do not wait until the next login. +void LLAppViewer::purgeCacheImmediate() +{ + LL_INFOS("AppCache") << "Purging Object Cache and Texture Cache immediately..." << LL_ENDL; + LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE); + LLVOCache::getInstance()->removeCache(LL_PATH_CACHE, true); +} + std::string LLAppViewer::getSecondLifeTitle() const { return LLTrans::getString("APP_NAME"); diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 58237d573d..06c06c4af2 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -170,6 +170,7 @@ public: void addOnIdleCallback(const boost::function& cb); // add a callback to fire (once) when idle void purgeCache(); // Clear the local cache. + void purgeCacheImmediate(); //clear local cache immediately. // mute/unmute the system's master audio virtual void setMasterSystemAudioMute(bool mute); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9a0cb432be..d66287f172 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7572,6 +7572,23 @@ void handle_web_browser_test(const LLSD& param) LLWeb::loadURLInternal(url); } +bool callback_clear_cache_immediately(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( option == 0 ) // YES + { + //clear cache + LLAppViewer::instance()->purgeCacheImmediate(); + } + + return false; +} + +void handle_cache_clear_immediately() +{ + LLNotificationsUtil::add("ConfirmClearCache", LLSD(), LLSD(), callback_clear_cache_immediately); +} + void handle_web_content_test(const LLSD& param) { std::string url = param.asString(); @@ -8492,6 +8509,8 @@ void initialize_menus() //Develop (Texture Fetch Debug Console) view_listener_t::addMenu(new LLDevelopTextureFetchDebugger(), "Develop.SetTexFetchDebugger"); + //Develop (clear cache immediately) + commit.add("Develop.ClearCache", boost::bind(&handle_cache_clear_immediately) ); // Admin >Object view_listener_t::addMenu(new LLAdminForceTakeCopy(), "Admin.ForceTakeCopy"); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 5f112675dc..a08e01784c 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -563,13 +563,19 @@ void LLVOCache::initCache(ELLPath location, U32 size, U32 cache_version) } } -void LLVOCache::removeCache(ELLPath location) +void LLVOCache::removeCache(ELLPath location, bool started) { + if(started) + { + removeCache(); + return; + } + if(mReadOnly) { llwarns << "Not removing cache at " << location << ": Cache is currently in read-only mode." << llendl; return ; - } + } llinfos << "about to remove the object cache due to settings." << llendl ; @@ -592,10 +598,8 @@ void LLVOCache::removeCache() return ; } - llinfos << "about to remove the object cache due to some error." << llendl ; - std::string mask = "*"; - llinfos << "Removing cache at " << mObjectCacheDirName << llendl; + llinfos << "Removing object cache at " << mObjectCacheDirName << llendl; gDirUtilp->deleteFilesInDir(mObjectCacheDirName, mask); clearCacheInMemory() ; diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 64eb876919..c26bebb451 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -199,7 +199,7 @@ public: ~LLVOCache() ; void initCache(ELLPath location, U32 size, U32 cache_version) ; - void removeCache(ELLPath location) ; + void removeCache(ELLPath location, bool started = false) ; void readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) ; void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, BOOL full_region_cache_probe); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 5b6a6f908a..7e5b5ed1e9 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2758,6 +2758,16 @@ function="ToggleControl" parameter="RenderHoverGlowEnable" /> + + + + + + Date: Wed, 20 Mar 2013 22:49:45 -0600 Subject: for SH-3918: Viewer should respond to cache probes in order received (don't sort response) --- indra/newview/llviewerregion.cpp | 4 ++++ indra/newview/llviewerregion.h | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index bca2108964..b052c87064 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1898,7 +1898,11 @@ LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) void LLViewerRegion::addCacheMiss(U32 id, LLViewerRegion::eCacheMissType miss_type) { +#if 0 mCacheMissList.insert(CacheMissItem(id, miss_type)); +#else + mCacheMissList.push_back(CacheMissItem(id, miss_type)); +#endif } // Get data packer for this object, if we have cached data diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 15c2b36e38..22936fb103 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -470,6 +470,7 @@ private: U32 mID; //local object id LLViewerRegion::eCacheMissType mType; //cache miss type +#if 0 struct Compare { bool operator()(const CacheMissItem& lhs, const CacheMissItem& rhs) @@ -479,6 +480,9 @@ private: }; typedef std::set cache_miss_list_t; +#else + typedef std::list cache_miss_list_t; +#endif }; CacheMissItem::cache_miss_list_t mCacheMissList; -- cgit v1.2.3 From cf4798b8f90eebaa62dcb8817538f1e3965b6bc9 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 22 Mar 2013 14:00:09 -0700 Subject: BUILDFIX gcc and vc fixes --- indra/llcommon/lltracerecording.cpp | 12 ++++++------ indra/newview/llviewerobjectlist.cpp | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index b70d42b082..f78b7942a7 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -116,12 +116,12 @@ void RecordingBuffers::mergeBuffers( const RecordingBuffers& other) void RecordingBuffers::resetBuffers(RecordingBuffers* other) { - mCountsFloat.write()->reset(other ? other->mCountsFloat : NULL); - mMeasurementsFloat.write()->reset(other ? other->mMeasurementsFloat : NULL); - mCounts.write()->reset(other ? other->mCounts : NULL); - mMeasurements.write()->reset(other ? other->mMeasurements : NULL); - mStackTimers.write()->reset(other ? other->mStackTimers : NULL); - mMemStats.write()->reset(other ? other->mMemStats : NULL); + mCountsFloat.write()->reset(other ? other->mCountsFloat : LLCopyOnWritePointer > >()); + mMeasurementsFloat.write()->reset(other ? other->mMeasurementsFloat : LLCopyOnWritePointer > >()); + mCounts.write()->reset(other ? other->mCounts : LLCopyOnWritePointer > >()); + mMeasurements.write()->reset(other ? other->mMeasurements : LLCopyOnWritePointer > >()); + mStackTimers.write()->reset(other ? other->mStackTimers : LLCopyOnWritePointer >()); + mMemStats.write()->reset(other ? other->mMemStats : LLCopyOnWritePointer >()); } /////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 5ccb19ab2e..922d386818 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -262,7 +262,7 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, // so that the drawable parent is set properly if(msg != NULL) { - findOrphans(objectp, msg->getSenderIP(), msg->getSenderPort()); + findOrphans(objectp, msg->getSenderIP(), msg->getSenderPort()); } else { @@ -451,9 +451,9 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, if (compressed) { - S32 uncompressed_length = 2048; - compressed_dp.reset(); - + S32 uncompressed_length = 2048; + compressed_dp.reset(); + uncompressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data); mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compressed_dpbuffer, 0, i); compressed_dp.assignBuffer(compressed_dpbuffer, uncompressed_length); @@ -626,9 +626,9 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, bCached = true; LLViewerRegion::eCacheUpdateResult result = objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp, flags); recorder.cacheFullUpdate(local_id, update_type, result, objectp, msg_size); + } } #endif - } } else { -- cgit v1.2.3 From 0ddeaa196731299e443d96e9f2797d8247c0de97 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 25 Mar 2013 18:45:42 -0600 Subject: for SH-3927: Interesting: Viewer should send predicted camera position to simulator to control object load order --- indra/newview/llface.cpp | 2 -- indra/newview/llviewercamera.h | 2 +- indra/newview/llviewermessage.cpp | 3 +++ 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 28e4b32793..56619563cf 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -2346,8 +2346,6 @@ F32 LLFace::calcImportanceToCamera(F32 cos_angle_to_view_dir, F32 dist) return 0.f ; } - //F32 camera_relative_speed = camera_moving_speed * (lookAt * LLViewerCamera::getInstance()->getVelocityDir()) ; - S32 i = 0 ; for(i = 0; i < FACE_IMPORTANCE_LEVEL && dist > FACE_IMPORTANCE_TO_CAMERA_OVER_DISTANCE[i][0]; ++i); i = llmin(i, FACE_IMPORTANCE_LEVEL - 1) ; diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index ffec284f72..d7835d8567 100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h @@ -100,7 +100,7 @@ public: BOOL projectPosAgentToScreen(const LLVector3 &pos_agent, LLCoordGL &out_point, const BOOL clamp = TRUE) const; BOOL projectPosAgentToScreenEdge(const LLVector3 &pos_agent, LLCoordGL &out_point) const; - const LLVector3* getVelocityDir() const {return &mVelocityDir;} + LLVector3 getVelocityDir() const {return mVelocityDir;} static LLTrace::CountStatHandle<>* getVelocityStat() {return &sVelocityStat; } static LLTrace::CountStatHandle<>* getAngularVelocityStat() {return &sAngularVelocityStat; } F32 getCosHalfFov() {return mCosHalfCameraFOV;} diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 4b1c9c5574..8dc72ba5b4 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4222,6 +4222,9 @@ void send_agent_update(BOOL force_send, BOOL send_reliable) LLQuaternion head_rotation = gAgent.getHeadRotation(); camera_pos_agent = gAgentCamera.getCameraPositionAgent(); + LLVector3 camera_velocity = LLViewerCamera::getInstance()->getVelocityDir() * LLViewerCamera::getInstance()->getAverageSpeed(); + F32 time_delta = 1.0f; //predict the camera position in 1 second + camera_pos_agent += camera_velocity * time_delta; render_state = gAgent.getRenderState(); -- cgit v1.2.3 From cd46f3d08cef6f43c29447e36c920d10ec184a18 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 25 Mar 2013 20:21:04 -0700 Subject: BUILDFIX gcc fix --- indra/llcommon/llfasttimer.cpp | 2 +- indra/newview/tests/llviewerassetstats_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index fbffe133f1..b40aec4886 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -185,7 +185,7 @@ void TimeBlock::processTimes() U64 cur_time = getCPUClockCount64(); // set up initial tree - for (LLInstanceTracker::instance_iter it = LLInstanceTracker::beginInstances(), end_it = LLInstanceTracker::endInstances(); + for (LLInstanceTracker::instance_iter begin_it = LLInstanceTracker::beginInstances(), end_it = LLInstanceTracker::endInstances(), it = begin_it; it != end_it; ++it) { diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index ecdd78a1da..ae93778534 100644 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -39,7 +39,7 @@ namespace LLStatViewer { - LLTrace::Measurement<> FPS_SAMPLE("fpssample"); + LLTrace::MeasurementStatHandle<> FPS_SAMPLE("fpssample"); } void LLVOAvatar::getNearbyRezzedStats(std::vector& counts) -- cgit v1.2.3 From 51e5997bd6f7f7d66a5843cf1d0b749b143460a8 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 29 Mar 2013 17:54:04 -0600 Subject: delay removing invalid objects from cache in case region is logged out too soon. --- indra/newview/llviewerregion.cpp | 9 +++++---- indra/newview/llviewerregion.h | 1 + indra/newview/llvocache.cpp | 4 ++-- indra/newview/llvocache.h | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d8f9ecf248..ed67d50dfd 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -460,11 +460,10 @@ void LLViewerRegion::saveObjectCache() if(LLVOCache::hasInstance()) { - //NOTE: !!!!!!!!!! - //set this to be true when support full region cache probe!!!! - BOOL full_region_cache_probe = FALSE; + const F32 start_time_threshold = 600.0f; //seconds + bool removal_enabled = mRegionTimer.getElapsedTimeF32() > start_time_threshold; //allow to remove invalid objects from object cache file. - LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, full_region_cache_probe) ; + LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled) ; mCacheDirty = FALSE; } @@ -2176,6 +2175,8 @@ void LLViewerRegion::unpackRegionHandshake() } msg->addU32("Flags", flags ); msg->sendReliable(host); + + mRegionTimer.reset(); //reset region timer. } void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 22936fb103..2248cf5269 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -399,6 +399,7 @@ public: static BOOL sVOCacheCullingEnabled; //vo cache culling enabled or not. private: LLViewerRegionImpl * mImpl; + LLFrameTimer mRegionTimer; F32 mWidth; // Width of region on a side (meters) U64 mHandle; diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index a08e01784c..caa87eb1eb 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -906,7 +906,7 @@ void LLVOCache::purgeEntries(U32 size) mNumEntries = mHandleEntryMap.size() ; } -void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, BOOL full_region_cache_probe) +void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled) { if(!mEnabled) { @@ -979,7 +979,7 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: for (LLVOCacheEntry::vocache_entry_map_t::const_iterator iter = cache_entry_map.begin(); success && iter != cache_entry_map.end(); ++iter) { - if(!full_region_cache_probe || iter->second->isTouched()) + if(!removal_enabled || iter->second->isTouched()) { success = iter->second->writeToFile(&apr_file) ; } diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index c26bebb451..5f2dd63051 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -202,7 +202,7 @@ public: void removeCache(ELLPath location, bool started = false) ; void readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) ; - void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, BOOL full_region_cache_probe); + void writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache, bool removal_enabled); void removeEntry(U64 handle) ; void setReadOnly(BOOL read_only) {mReadOnly = read_only;} -- cgit v1.2.3 From da02b9f69471baa407188e2921b5c56c9b8d9415 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 29 Mar 2013 17:54:55 -0600 Subject: save cache file when first login to a region. --- indra/newview/llviewerregion.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index ed67d50dfd..64cf33a9eb 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -442,6 +442,10 @@ void LLViewerRegion::loadObjectCache() if(LLVOCache::hasInstance()) { LLVOCache::getInstance()->readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap) ; + if (mImpl->mCacheMap.empty()) + { + mCacheDirty = TRUE; + } } } -- cgit v1.2.3 From 449222f5f0dbe2a4bd5cbc397298c02a3f3348b0 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 1 Apr 2013 13:44:08 -0600 Subject: trivial: convert to unix line endings. --- indra/newview/llviewerregion.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 64cf33a9eb..bed047ff0b 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -442,9 +442,9 @@ void LLViewerRegion::loadObjectCache() if(LLVOCache::hasInstance()) { LLVOCache::getInstance()->readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap) ; - if (mImpl->mCacheMap.empty()) - { - mCacheDirty = TRUE; + if (mImpl->mCacheMap.empty()) + { + mCacheDirty = TRUE; } } } -- cgit v1.2.3 From 2bc378c7f4f4356d444f175cc47708bb452c0d2c Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 4 Apr 2013 15:27:00 -0600 Subject: for SH-4053: interesting: visible objects are delayed to appear with new interest list --- indra/newview/llvieweroctree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index cfa24c32ed..3c7c710825 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -528,7 +528,7 @@ void LLviewerOctreeGroup::handleChildAddition(const OctreeNode* parent, OctreeNo unbound(); - //((LLviewerOctreeGroup*)child->getListener(0))->unbound(); + ((LLviewerOctreeGroup*)child->getListener(0))->unbound(); } //virtual -- 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.cpp | 44 ++++++++++++++++++++++++++++++++++++++++ indra/newview/llvieweroctree.h | 11 ++++++++++ 2 files changed, 55 insertions(+) (limited to 'indra') diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index 3c7c710825..158fc4b0a9 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -32,6 +32,7 @@ //static variables definitions //----------------------------------------------------------------------------------- U32 LLViewerOctreeEntryData::sCurVisible = 0; +BOOL LLViewerOctreeDebug::sInDebug = FALSE; //----------------------------------------------------------------------------------- //some global functions definitions @@ -798,3 +799,46 @@ void LLViewerOctreeCull::visit(const OctreeNode* branch) } } +//-------------------------------------------------------------- +//class LLViewerOctreeDebug +//virtual +void LLViewerOctreeDebug::visit(const OctreeNode* branch) +{ +#if 0 + llinfos << "Node: " << (U32)branch << " # Elements: " << branch->getElementCount() << " # Children: " << branch->getChildCount() << llendl; + for (U32 i = 0; i < branch->getChildCount(); i++) + { + llinfos << "Child " << i << " : " << (U32)branch->getChild(i) << llendl; + } +#endif + LLviewerOctreeGroup* group = (LLviewerOctreeGroup*) branch->getListener(0); + processGroup(group); +} + +//virtual +void LLViewerOctreeDebug::processGroup(LLviewerOctreeGroup* group) +{ +#if 0 + const LLVector4a* vec4 = group->getBounds(); + LLVector3 vec[2]; + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + llinfos << "Bounds: " << vec[0] << " : " << vec[1] << llendl; + + vec4 = group->getExtents(); + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + llinfos << "Extents: " << vec[0] << " : " << vec[1] << llendl; + + vec4 = group->getObjectBounds(); + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + llinfos << "ObjectBounds: " << vec[0] << " : " << vec[1] << llendl; + + vec4 = group->getObjectExtents(); + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + llinfos << "ObjectExtents: " << vec[0] << " : " << vec[1] << llendl; +#endif +} +//-------------------------------------------------------------- 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 446849f23c06ab2bda5333ba31e22bd09f1083fb Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 10 Apr 2013 11:32:33 -0600 Subject: trivial: convert to unix line endings. --- indra/newview/llvieweroctree.cpp | 86 ++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index 158fc4b0a9..926d791d1f 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -799,46 +799,46 @@ void LLViewerOctreeCull::visit(const OctreeNode* branch) } } -//-------------------------------------------------------------- -//class LLViewerOctreeDebug -//virtual -void LLViewerOctreeDebug::visit(const OctreeNode* branch) -{ -#if 0 - llinfos << "Node: " << (U32)branch << " # Elements: " << branch->getElementCount() << " # Children: " << branch->getChildCount() << llendl; - for (U32 i = 0; i < branch->getChildCount(); i++) - { - llinfos << "Child " << i << " : " << (U32)branch->getChild(i) << llendl; - } -#endif - LLviewerOctreeGroup* group = (LLviewerOctreeGroup*) branch->getListener(0); - processGroup(group); -} - -//virtual -void LLViewerOctreeDebug::processGroup(LLviewerOctreeGroup* group) -{ -#if 0 - const LLVector4a* vec4 = group->getBounds(); - LLVector3 vec[2]; - vec[0].set(vec4[0].getF32ptr()); - vec[1].set(vec4[1].getF32ptr()); - llinfos << "Bounds: " << vec[0] << " : " << vec[1] << llendl; - - vec4 = group->getExtents(); - vec[0].set(vec4[0].getF32ptr()); - vec[1].set(vec4[1].getF32ptr()); - llinfos << "Extents: " << vec[0] << " : " << vec[1] << llendl; - - vec4 = group->getObjectBounds(); - vec[0].set(vec4[0].getF32ptr()); - vec[1].set(vec4[1].getF32ptr()); - llinfos << "ObjectBounds: " << vec[0] << " : " << vec[1] << llendl; - - vec4 = group->getObjectExtents(); - vec[0].set(vec4[0].getF32ptr()); - vec[1].set(vec4[1].getF32ptr()); - llinfos << "ObjectExtents: " << vec[0] << " : " << vec[1] << llendl; -#endif -} -//-------------------------------------------------------------- +//-------------------------------------------------------------- +//class LLViewerOctreeDebug +//virtual +void LLViewerOctreeDebug::visit(const OctreeNode* branch) +{ +#if 0 + llinfos << "Node: " << (U32)branch << " # Elements: " << branch->getElementCount() << " # Children: " << branch->getChildCount() << llendl; + for (U32 i = 0; i < branch->getChildCount(); i++) + { + llinfos << "Child " << i << " : " << (U32)branch->getChild(i) << llendl; + } +#endif + LLviewerOctreeGroup* group = (LLviewerOctreeGroup*) branch->getListener(0); + processGroup(group); +} + +//virtual +void LLViewerOctreeDebug::processGroup(LLviewerOctreeGroup* group) +{ +#if 0 + const LLVector4a* vec4 = group->getBounds(); + LLVector3 vec[2]; + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + llinfos << "Bounds: " << vec[0] << " : " << vec[1] << llendl; + + vec4 = group->getExtents(); + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + llinfos << "Extents: " << vec[0] << " : " << vec[1] << llendl; + + vec4 = group->getObjectBounds(); + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + llinfos << "ObjectBounds: " << vec[0] << " : " << vec[1] << llendl; + + vec4 = group->getObjectExtents(); + vec[0].set(vec4[0].getF32ptr()); + vec[1].set(vec4[1].getF32ptr()); + llinfos << "ObjectExtents: " << vec[0] << " : " << vec[1] << llendl; +#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') 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 faebbb23f87a855463aba611ca8944ec7f4e0a9c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 10 Apr 2013 15:31:44 -0700 Subject: BUILDFIX: gcc error about type conversion --- indra/llui/llstatbar.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp index d9f3d14ef0..d73cd74651 100644 --- a/indra/llui/llstatbar.cpp +++ b/indra/llui/llstatbar.cpp @@ -421,10 +421,10 @@ void LLStatBar::draw() } else { - gGL.vertex2i(begin, (F32)bar_bottom+offset+1.f); - gGL.vertex2i(begin, (F32)bar_bottom+offset); - gGL.vertex2i(end, (F32)bar_bottom+offset); - gGL.vertex2i(end, (F32)bar_bottom+offset+1.f); + gGL.vertex2f(begin, (F32)bar_bottom+offset+1.f); + gGL.vertex2f(begin, (F32)bar_bottom+offset); + gGL.vertex2f(end, (F32)bar_bottom+offset); + gGL.vertex2f(end, (F32)bar_bottom+offset+1.f); } } gGL.end(); -- cgit v1.2.3 From 7e4c8b94d82680891116bd954289171b8f620bbc Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 10 Apr 2013 20:24:51 -0600 Subject: fix a logout crash --- indra/newview/llscenemonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp index c06d9d2689..15fe77f028 100644 --- a/indra/newview/llscenemonitor.cpp +++ b/indra/newview/llscenemonitor.cpp @@ -523,7 +523,7 @@ void LLSceneMonitor::addMonitorResult() //dump results to a file _scene_monitor_results.csv void LLSceneMonitor::dumpToFile(std::string file_name) { - if(mMonitorResults.empty()) + if(mMonitorResults.empty() || !getRecording()) { return; //nothing to dump } -- cgit v1.2.3 From 81943ecbe53779a226da4bbdf2c8b1ae39eba11b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 11 Apr 2013 11:51:16 -0600 Subject: for SH-4095: add an option to turn off new interest list code --- indra/newview/llviewerregion.cpp | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index bed047ff0b..84e9c8ea9a 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -465,8 +465,8 @@ void LLViewerRegion::saveObjectCache() if(LLVOCache::hasInstance()) { const F32 start_time_threshold = 600.0f; //seconds - bool removal_enabled = mRegionTimer.getElapsedTimeF32() > start_time_threshold; //allow to remove invalid objects from object cache file. - + bool removal_enabled = sVOCacheCullingEnabled && (mRegionTimer.getElapsedTimeF32() > start_time_threshold); //allow to remove invalid objects from object cache file. + LLVOCache::getInstance()->writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled) ; mCacheDirty = FALSE; } @@ -1120,8 +1120,13 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) max_update_time -= update_timer.getElapsedTimeF32(); if(max_update_time < 0.f || mImpl->mCacheMap.empty()) { - return did_update; -} + return did_update; + } + + if(!sVOCacheCullingEnabled) + { + return did_update; + } sCurRegionp = this; @@ -1704,6 +1709,12 @@ void LLViewerRegion::findOrphans(U32 parent_id) void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) { + if(!sVOCacheCullingEnabled) + { + gObjectList.processObjectUpdateFromCache(entry, this); + return; + } + if(entry != NULL && !entry->getEntry()) { entry->setOctreeEntry(NULL); @@ -1882,12 +1893,17 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec } LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) +{ + if(!sVOCacheCullingEnabled) { + return NULL; + } + LLVOCacheEntry* entry = getCacheEntry(local_id); removeFromVOCacheTree(entry); return entry; - } +} LLVOCacheEntry* LLViewerRegion::getCacheEntry(U32 local_id) { @@ -2172,10 +2188,14 @@ void LLViewerRegion::unpackRegionHandshake() msg->addUUID("SessionID", gAgent.getSessionID()); msg->nextBlock("RegionInfo"); - U32 flags = 0x00000001; //set the bit 0 to be 1 to ask sim to send all cacheable objects. - if(mImpl->mCacheMap.empty()) + U32 flags = 0; + if(sVOCacheCullingEnabled) { - flags |= 0x00000002; //set the bit 1 to be 1 to tell sim the cache file is empty, no need to send cache probes. + flags = 0x00000001; //set the bit 0 to be 1 to ask sim to send all cacheable objects. + if(mImpl->mCacheMap.empty()) + { + flags |= 0x00000002; //set the bit 1 to be 1 to tell sim the cache file is empty, no need to send cache probes. + } } msg->addU32("Flags", flags ); msg->sendReliable(host); -- cgit v1.2.3 From 1a820f8df90a21a8614b79f3dc973bb7dc903def Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 11 Apr 2013 15:25:04 -0600 Subject: delay removing pre-fetched textures in case the login process is very long. --- indra/newview/llviewertexturelist.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 0066c09720..0a81c9deb0 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -60,7 +60,7 @@ #include "llxuiparser.h" #include "lltracerecording.h" #include "llviewerdisplay.h" - +#include "llstartup.h" //////////////////////////////////////////////////////////////////////////// void (*LLViewerTextureList::sUUIDCallback)(void **, const LLUUID&) = NULL; @@ -710,7 +710,17 @@ void LLViewerTextureList::updateImagesDecodePriorities() { // Update the decode priority for N images each frame { - static const S32 MAX_PRIO_UPDATES = gSavedSettings.getS32("TextureFetchUpdatePriorities"); // default: 32 + F32 lazy_flush_timeout = 30.f; // stop decoding + F32 max_inactive_time = 20.f; // actually delete + S32 min_refs = 3; // 1 for mImageList, 1 for mUUIDMap, 1 for local reference + if(LLStartUp::getStartupState() < STATE_STARTED) + { + //do not remove pre-fetched images if viewer does not finish logging in. + lazy_flush_timeout = 30000.f; + max_inactive_time = 20000.f; + } + + static const S32 MAX_PRIO_UPDATES = gSavedSettings.getS32("TextureFetchUpdatePriorities"); // default: 32 const size_t max_update_count = llmin((S32) (MAX_PRIO_UPDATES*MAX_PRIO_UPDATES*gFrameIntervalSeconds.value()) + 1, MAX_PRIO_UPDATES); S32 update_counter = llmin(max_update_count, mUUIDMap.size()); uuid_map_t::iterator iter = mUUIDMap.upper_bound(mLastUpdateUUID); @@ -732,15 +742,11 @@ void LLViewerTextureList::updateImagesDecodePriorities() // // Flush formatted images using a lazy flush - // - const F32 LAZY_FLUSH_TIMEOUT = 30.f; // stop decoding - const F32 MAX_INACTIVE_TIME = 20.f; // actually delete - S32 min_refs = 3; // 1 for mImageList, 1 for mUUIDMap, 1 for local reference - + // S32 num_refs = imagep->getNumRefs(); if (num_refs == min_refs) { - if (imagep->getLastReferencedTimer()->getElapsedTimeF32() > LAZY_FLUSH_TIMEOUT) + if (imagep->getLastReferencedTimer()->getElapsedTimeF32() > lazy_flush_timeout) { // Remove the unused image from the image list deleteImage(imagep); @@ -752,7 +758,7 @@ void LLViewerTextureList::updateImagesDecodePriorities() { if(imagep->hasSavedRawImage()) { - if(imagep->getElapsedLastReferencedSavedRawImageTime() > MAX_INACTIVE_TIME) + if(imagep->getElapsedLastReferencedSavedRawImageTime() > max_inactive_time) { imagep->destroySavedRawImage() ; } @@ -769,7 +775,7 @@ void LLViewerTextureList::updateImagesDecodePriorities() } else if(imagep->isInactive()) { - if (imagep->getLastReferencedTimer()->getElapsedTimeF32() > MAX_INACTIVE_TIME) + if (imagep->getLastReferencedTimer()->getElapsedTimeF32() > max_inactive_time) { imagep->setDeletionCandidate() ; } -- cgit v1.2.3 From c05fa390dc57b072da4b69b4e08743fd62bf4ce5 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 11 Apr 2013 15:25:35 -0600 Subject: add LLTrace::MemTrackable to LLVOCachePartition --- indra/newview/llvocache.cpp | 2 ++ indra/newview/llvocache.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index caa87eb1eb..1dd149631a 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -34,6 +34,8 @@ #include "llviewerregion.h" #include "pipeline.h" +LLTrace::MemStatHandle LLVOCachePartition::sMemStat("LLVOCachePartition"); + BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes) { return apr_file->read(src, n_bytes) == n_bytes ; diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 5f2dd63051..4b775a4288 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -147,7 +147,7 @@ protected: BOOL mTouched; //if set, this entry is valid, otherwise it is invalid. }; -class LLVOCachePartition : public LLViewerOctreePartition +class LLVOCachePartition : public LLViewerOctreePartition, public LLTrace::MemTrackable { public: LLVOCachePartition(LLViewerRegion* regionp); @@ -155,6 +155,8 @@ public: void addEntry(LLViewerOctreeEntry* entry); void removeEntry(LLViewerOctreeEntry* entry); /*virtual*/ S32 cull(LLCamera &camera); + + static LLTrace::MemStatHandle sMemStat; }; // -- cgit v1.2.3