From 14e402cf5e8274caddaf1c763c2e044c53514b1e Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 16 Dec 2010 22:09:49 -0800 Subject: ER-414: Add object update type debug rendering view --- indra/newview/llspatialpartition.cpp | 33 ++++++++++++++++++++++++++++-- indra/newview/llviewerobject.cpp | 24 +++++++++++++++++++++- indra/newview/llviewerobject.h | 8 ++++++++ indra/newview/llviewerobjectlist.cpp | 36 +++++---------------------------- indra/newview/llviewerstatsrecorder.cpp | 7 ++++++- 5 files changed, 73 insertions(+), 35 deletions(-) diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 3dd0e1081e..8adb8c30e0 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2580,11 +2580,40 @@ void renderCrossHairs(LLVector3 position, F32 size, LLColor4 color) void renderUpdateType(LLDrawable* drawablep) { + LLViewerObject* vobj = drawablep->getVObj(); + if (!vobj || OUT_UNKNOWN == vobj->getLastUpdateType()) + { + return; + } + LLGLEnable blend(GL_BLEND); + switch (vobj->getLastUpdateType()) + { + case OUT_FULL: + glColor4f(0,1,0,0.5f); + break; + case OUT_TERSE_IMPROVED: + glColor4f(0,1,1,0.5f); + break; + case OUT_FULL_COMPRESSED: + if (vobj->getLastUpdateCached()) + { + glColor4f(1,0,0,0.5f); + } + else + { + glColor4f(1,1,0,0.5f); + } + break; + case OUT_FULL_CACHED: + glColor4f(0,0,1,0.5f); + break; + default: + llwarns << "Unknown update_type " << vobj->getLastUpdateType() << llendl; + break; + }; S32 num_faces = drawablep->getNumFaces(); if (num_faces) { - LLGLEnable blend(GL_BLEND); - glColor4f(0,1,1,0.5f); for (S32 i = 0; i < num_faces; ++i) { pushVerts(drawablep->getFace(i), LLVertexBuffer::MAP_VERTEX); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 1804fac1b3..3c12cb66b2 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -234,7 +234,9 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mState(0), mMedia(NULL), mClickAction(0), - mAttachmentItemID(LLUUID::null) + mAttachmentItemID(LLUUID::null), + mLastUpdateType(OUT_UNKNOWN), + mLastUpdateCached(FALSE) { if (!is_global) { @@ -5400,6 +5402,26 @@ void LLViewerObject::setAttachmentItemID(const LLUUID &id) mAttachmentItemID = id; } +EObjectUpdateType LLViewerObject::getLastUpdateType() +{ + return mLastUpdateType; +} + +void LLViewerObject::setLastUpdateType(EObjectUpdateType last_update_type) +{ + mLastUpdateType = last_update_type; +} + +BOOL LLViewerObject::getLastUpdateCached() +{ + return mLastUpdateCached; +} + +void LLViewerObject::setLastUpdateCached(BOOL last_update_cached) +{ + mLastUpdateCached = last_update_cached; +} + const LLUUID &LLViewerObject::extractAttachmentItemID() { LLUUID item_id = LLUUID::null; diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index fe670f8827..c83cc06128 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -77,6 +77,7 @@ typedef enum e_object_update_type OUT_TERSE_IMPROVED, OUT_FULL_COMPRESSED, OUT_FULL_CACHED, + OUT_UNKNOWN, } EObjectUpdateType; @@ -696,8 +697,15 @@ public: const LLUUID &getAttachmentItemID() const; void setAttachmentItemID(const LLUUID &id); const LLUUID &extractAttachmentItemID(); // find&set the inventory item ID of the attached object + EObjectUpdateType getLastUpdateType(); + void setLastUpdateType(EObjectUpdateType last_update_type); + BOOL getLastUpdateCached(); + void setLastUpdateCached(BOOL last_update_cached); + private: LLUUID mAttachmentItemID; // ItemID of the associated object is in user inventory. + EObjectUpdateType mLastUpdateType; + BOOL mLastUpdateCached; }; /////////////////// diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 70631f9481..77fbc08ca4 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -564,10 +564,12 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, processUpdateCore(objectp, user_data, i, update_type, &compressed_dp, justCreated); if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only? { - LLViewerRegion::eCacheUpdateResult result = objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp); bCached = true; #if LL_RECORD_VIEWER_STATS + LLViewerRegion::eCacheUpdateResult result = objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp); LLViewerStatsRecorder::instance()->recordCacheFullUpdate(local_id, update_type, result, objectp); + #else + objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp); #endif } } @@ -586,37 +588,9 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, } #if LL_RECORD_VIEWER_STATS LLViewerStatsRecorder::instance()->recordObjectUpdateEvent(local_id, update_type, objectp); - F32 color_strength = llmin(((LLViewerStatsRecorder::instance()->getTimeSinceStart() / 1000.0f) + 128.0f) / 255.0f, 1.0f); - LLColor4 color; - switch (update_type) - { - case OUT_FULL: - color[VGREEN] = color_strength; - break; - case OUT_TERSE_IMPROVED: - color[VGREEN] = color_strength; - color[VBLUE] = color_strength; - break; - case OUT_FULL_COMPRESSED: - color[VRED] = color_strength; - if (!bCached) - { - color[VGREEN] = color_strength; - } - break; - case OUT_FULL_CACHED: - color[VBLUE] = color_strength; - break; - default: - llwarns << "Unknown update_type " << update_type << llendl; - break; - }; - U8 te; - for (te = 0; te < objectp->getNumTEs(); ++te) - { - objectp->setTEColor(te, color); - } #endif + objectp->setLastUpdateType(update_type); + objectp->setLastUpdateCached(bCached); } #if LL_RECORD_VIEWER_STATS diff --git a/indra/newview/llviewerstatsrecorder.cpp b/indra/newview/llviewerstatsrecorder.cpp index a8d1565742..e9d21b4848 100644 --- a/indra/newview/llviewerstatsrecorder.cpp +++ b/indra/newview/llviewerstatsrecorder.cpp @@ -26,6 +26,9 @@ #include "llviewerprecompiledheaders.h" #include "llviewerstatsrecorder.h" + +#if LL_RECORD_VIEWER_STATS + #include "llfile.h" #include "llviewerregion.h" #include "llviewerobject.h" @@ -38,7 +41,6 @@ static const std::string STATS_FILE_NAME("/tmp/viewerstats.csv"); #endif - LLViewerStatsRecorder* LLViewerStatsRecorder::sInstance = NULL; LLViewerStatsRecorder::LLViewerStatsRecorder() : mObjectCacheFile(NULL), @@ -250,4 +252,7 @@ F32 LLViewerStatsRecorder::getTimeSinceStart() return (F32) ((LLTimer::getTotalTime() - mStartTime) / 1000.0); } +#endif + + -- cgit v1.2.3