diff options
author | Loren Shih <seraph@lindenlab.com> | 2010-06-02 17:30:34 -0400 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2010-06-02 17:30:34 -0400 |
commit | 609c389b899f3924f070dea384337bec4da0f2f4 (patch) | |
tree | 3ef29a1782bbc93462cd5c7c98aba3001087f60c /indra/newview | |
parent | b1514dc19108320fa7d9ecb2879c96bcdc401605 (diff) |
EXT-7526 WIP Add baked texture information to texture view
EXT-7504 WIP Force decloud after timeout using lower res textures
Better formatting for baked texture information.
Also added exponential timeout for sending low res baked textures.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/lltexlayer.cpp | 16 | ||||
-rw-r--r-- | indra/newview/lltexlayer.h | 2 | ||||
-rw-r--r-- | indra/newview/lltextureview.cpp | 113 |
3 files changed, 63 insertions, 68 deletions
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 0c3c052fe3..8798cae7ac 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -87,7 +87,7 @@ LLTexLayerSetBuffer::LLTexLayerSetBuffer(LLTexLayerSet* const owner, mNeedsUpdate(TRUE), mNeedsUpload(FALSE), mUploadPending(FALSE), // Not used for any logic here, just to sync sending of updates - mDebugNumLowresUploads(0), + mNumLowresUploads(0), mTexLayerSet(owner) { LLTexLayerSetBuffer::sGLByteCount += getSize(); @@ -141,12 +141,12 @@ void LLTexLayerSetBuffer::requestUpload() // If we requested a new upload but haven't even uploaded // a low res version of our last upload request, then // keep the timer ticking instead of resetting it. - if (mNeedsUpload && (mDebugNumLowresUploads == 0)) + if (mNeedsUpload && (mNumLowresUploads == 0)) { mNeedsUploadTimer.reset(); } mNeedsUpload = TRUE; - mDebugNumLowresUploads = 0; + mNumLowresUploads = 0; mUploadPending = TRUE; mNeedsUploadTimer.unpause(); } @@ -289,8 +289,12 @@ BOOL LLTexLayerSetBuffer::isReadyToUpload() const const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureTimeout"); if (texture_timeout) { + // The timeout period increases exponentially between every lowres upload in order to prevent + // spamming the server with frequent uploads. + const U32 texture_timeout_threshold = texture_timeout*pow((F32)2.0,(F32)mNumLowresUploads); + // If we hit our timeout and have textures available at even lower resolution, then upload. - const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout; + const BOOL is_upload_textures_timeout = mNeedsUploadTimer.getElapsedTimeF32() >= texture_timeout_threshold; const BOOL has_lower_lod = mTexLayerSet->isLocalTextureDataAvailable(); if (has_lower_lod && is_upload_textures_timeout) return TRUE; } @@ -443,7 +447,7 @@ void LLTexLayerSetBuffer::readBackAndUpload() { // Sending a lower level LOD for the baked texture. // Restart the upload timer. - mDebugNumLowresUploads++; + mNumLowresUploads++; mNeedsUploadTimer.unpause(); mNeedsUploadTimer.reset(); } @@ -2241,7 +2245,7 @@ const std::string LLTexLayerSetBuffer::dumpTextureInfo() const if (!isAgentAvatarValid()) return ""; const BOOL is_high_res = !mNeedsUpload; - const U32 num_low_res = mDebugNumLowresUploads; + const U32 num_low_res = mNumLowresUploads; const U32 upload_time = (U32)mNeedsUploadTimer.getElapsedTimeF32(); const BOOL is_uploaded = !mUploadPending; const std::string local_texture_info = gAgentAvatarp->debugDumpLocalTextureDataInfo(mTexLayerSet); diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h index 313c5f24e1..635568542d 100644 --- a/indra/newview/lltexlayer.h +++ b/indra/newview/lltexlayer.h @@ -360,7 +360,7 @@ private: BOOL mNeedsUpdate; // Whether we need to update our baked textures BOOL mNeedsUpload; // Whether we need to send our baked textures to the server - U32 mDebugNumLowresUploads; // Number of times we've sent a lowres version of our baked textures to the server + U32 mNumLowresUploads; // Number of times we've sent a lowres version of our baked textures to the server BOOL mUploadPending; // Whether we have received back the new baked textures LLUUID mUploadID; // Identifies the current upload process (null if none). Used to avoid overlaps (eg, when the user rapidly makes two changes outside of Face Edit) diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index e96d56da82..377449cc8b 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -65,6 +65,8 @@ LLTextureView *gTextureView = NULL; LLTextureSizeView *gTextureSizeView = NULL; LLTextureSizeView *gTextureCategoryView = NULL; +#define HIGH_PRIORITY 100000000.f + //static std::set<LLViewerFetchedTexture*> LLTextureView::sDebugImages; @@ -415,13 +417,14 @@ void LLAvatarTexBar::draw() if (!avatarp) return; const S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); - const S32 v_offset = (S32)((texture_bar_height + 2.5f) * mTextureView->mNumTextureBars + 2.5f); + const S32 v_offset = 0; + //---------------------------------------------------------------------------- LLGLSUIDefault gls_ui; LLColor4 text_color(1.f, 1.f, 1.f, 1.f); LLColor4 color; - U32 line_num = 6; + U32 line_num = 1; for (LLVOAvatarDefines::LLVOAvatarDictionary::BakedTextures::const_iterator baked_iter = LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); baked_iter != LLVOAvatarDefines::LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); ++baked_iter) @@ -433,7 +436,7 @@ void LLAvatarTexBar::draw() if (!layerset_buffer) continue; std::string text = layerset_buffer->dumpTextureInfo(); LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*line_num, - text_color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); + text_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); line_num++; } const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureTimeout"); @@ -443,7 +446,7 @@ void LLAvatarTexBar::draw() const std::string override_tex_discard_level_str = override_tex_discard_level ? llformat("%d",override_tex_discard_level) : "Disabled"; std::string header_text = llformat("[ Timeout('AvatarBakedTextureTimeout'):%s ] [ LOD_Override('TextureDiscardLevel'):%s ]", texture_timeout_str.c_str(), override_tex_discard_level_str.c_str()); LLFontGL::getFontMonospace()->renderUTF8(header_text, 0, 0, v_offset + line_height*line_num, - text_color, LLFontGL::LEFT, LLFontGL::TOP); + text_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); } BOOL LLAvatarTexBar::handleMouseDown(S32 x, S32 y, MASK mask) @@ -454,7 +457,8 @@ BOOL LLAvatarTexBar::handleMouseDown(S32 x, S32 y, MASK mask) LLRect LLAvatarTexBar::getRequiredRect() { LLRect rect; - rect.mTop = 8; + rect.mTop = 85; + if (!gSavedSettings.getBOOL("DebugAvatarRezTime")) rect.mTop = 0; return rect; } @@ -497,7 +501,7 @@ void LLGLTexMemBar::draw() F32 cache_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getUsage()) ; F32 cache_max_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getMaxUsage()) ; S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); - S32 v_offset = (S32)((texture_bar_height + 2.5f) * mTextureView->mNumTextureBars + 5.0f); + S32 v_offset = (S32)((texture_bar_height + 2.2f) * mTextureView->mNumTextureBars + 2.0f); //---------------------------------------------------------------------------- LLGLSUIDefault gls_ui; LLColor4 text_color(1.f, 1.f, 1.f, 0.75f); @@ -649,7 +653,8 @@ BOOL LLGLTexMemBar::handleMouseDown(S32 x, S32 y, MASK mask) LLRect LLGLTexMemBar::getRequiredRect() { LLRect rect; - rect.mTop = 8; + //rect.mTop = 50; + rect.mTop = 0; return rect; } @@ -808,7 +813,7 @@ void LLTextureView::draw() { S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory() : 0 ; llinfos << imagep->getID() - << "\t" << tex_mem + << "\t" << tex_mem << "\t" << imagep->getBoostLevel() << "\t" << imagep->getDecodePriority() << "\t" << imagep->getWidth() @@ -823,19 +828,6 @@ void LLTextureView::draw() ++debug_count; // for breakpoints } -#if 0 - if (imagep->getDontDiscard()) - { - continue; - } - - if (imagep->isMissingAsset()) - { - continue; - } -#endif - -#define HIGH_PRIORITY 100000000.f F32 pri; if (mOrderFetch) { @@ -854,59 +846,55 @@ void LLTextureView::draw() if (!mOrderFetch) { -#if 1 - if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance()) - { - struct f : public LLSelectedTEFunctor + if (pri < HIGH_PRIORITY && LLSelectMgr::getInstance()) { - LLViewerFetchedTexture* mImage; - f(LLViewerFetchedTexture* image) : mImage(image) {} - virtual bool apply(LLViewerObject* object, S32 te) + struct f : public LLSelectedTEFunctor { - return (mImage == object->getTEImage(te)); + LLViewerFetchedTexture* mImage; + f(LLViewerFetchedTexture* image) : mImage(image) {} + virtual bool apply(LLViewerObject* object, S32 te) + { + return (mImage == object->getTEImage(te)); + } + } func(imagep); + const bool firstonly = true; + bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly); + if (match) + { + pri += 3*HIGH_PRIORITY; } - } func(imagep); - const bool firstonly = true; - bool match = LLSelectMgr::getInstance()->getSelection()->applyToTEs(&func, firstonly); - if (match) - { - pri += 3*HIGH_PRIORITY; } - } -#endif -#if 1 - if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard)) - { - LLSelectNode* hover_node = LLSelectMgr::instance().getHoverNode(); - if (hover_node) + + if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard)) { - LLViewerObject *objectp = hover_node->getObject(); - if (objectp) + LLSelectNode* hover_node = LLSelectMgr::instance().getHoverNode(); + if (hover_node) { - S32 tex_count = objectp->getNumTEs(); - for (S32 i = 0; i < tex_count; i++) + LLViewerObject *objectp = hover_node->getObject(); + if (objectp) { - if (imagep == objectp->getTEImage(i)) + S32 tex_count = objectp->getNumTEs(); + for (S32 i = 0; i < tex_count; i++) { - pri += 2*HIGH_PRIORITY; - break; + if (imagep == objectp->getTEImage(i)) + { + pri += 2*HIGH_PRIORITY; + break; + } } } } } - } -#endif -#if 1 - if (pri > 0.f && pri < HIGH_PRIORITY) - { - if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f || - imagep->mFetchDeltaTime < 0.25f) + + if (pri > 0.f && pri < HIGH_PRIORITY) { - pri += 1*HIGH_PRIORITY; + if (imagep->mLastPacketTimer.getElapsedTimeF32() < 1.f || + imagep->mFetchDeltaTime < 0.25f) + { + pri += 1*HIGH_PRIORITY; + } } } -#endif - } if (pri > 0.0f) { @@ -947,18 +935,21 @@ void LLTextureView::draw() sortChildren(LLTextureBar::sort()); LLGLTexMemBar::Params tmbp; + LLRect tmbr; tmbp.name("gl texmem bar"); + tmbp.rect(tmbr); tmbp.texture_view(this); mGLTexMemBar = LLUICtrlFactory::create<LLGLTexMemBar>(tmbp); - addChild(mGLTexMemBar); + addChildInBack(mGLTexMemBar); LLAvatarTexBar::Params atbp; + LLRect atbr; atbp.name("gl avatartex bar"); atbp.texture_view(this); + atbp.rect(atbr); mAvatarTexBar = LLUICtrlFactory::create<LLAvatarTexBar>(atbp); addChild(mAvatarTexBar); - reshape(getRect().getWidth(), getRect().getHeight(), TRUE); /* |