diff options
Diffstat (limited to 'indra/newview/lltextureview.cpp')
-rw-r--r-- | indra/newview/lltextureview.cpp | 229 |
1 files changed, 172 insertions, 57 deletions
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 43913f3632..b588ff91d1 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -54,12 +54,19 @@ #include "llviewertexture.h" #include "llviewertexturelist.h" #include "llvovolume.h" + +// For avatar texture view +#include "llvoavatarself.h" +#include "lltexlayer.h" + extern F32 texmem_lower_bound_scale; LLTextureView *gTextureView = NULL; LLTextureSizeView *gTextureSizeView = NULL; LLTextureSizeView *gTextureCategoryView = NULL; +#define HIGH_PRIORITY 100000000.f + //static std::set<LLViewerFetchedTexture*> LLTextureView::sDebugImages; @@ -375,6 +382,105 @@ LLRect LLTextureBar::getRequiredRect() //////////////////////////////////////////////////////////////////////////// +class LLAvatarTexBar : public LLView +{ +public: + struct Params : public LLInitParam::Block<Params, LLView::Params> + { + Mandatory<LLTextureView*> texture_view; + Params() + : texture_view("texture_view") + { + S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); + rect(LLRect(0,0,100,line_height * 4)); + } + }; + + LLAvatarTexBar(const Params& p) + : LLView(p), + mTextureView(p.texture_view) + {} + + virtual void draw(); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual LLRect getRequiredRect(); // Return the height of this object, given the set options. + +private: + LLTextureView* mTextureView; +}; + +void LLAvatarTexBar::draw() +{ + if (!gSavedSettings.getBOOL("DebugAvatarRezTime")) return; + + LLVOAvatarSelf* avatarp = gAgentAvatarp; + if (!avatarp) return; + + const S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f); + const S32 v_offset = 0; + const S32 l_offset = 3; + + //---------------------------------------------------------------------------- + LLGLSUIDefault gls_ui; + LLColor4 color; + + 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) + { + const LLVOAvatarDefines::EBakedTextureIndex baked_index = baked_iter->first; + const LLTexLayerSet *layerset = avatarp->debugGetLayerSet(baked_index); + if (!layerset) continue; + const LLTexLayerSetBuffer *layerset_buffer = layerset->getComposite(); + if (!layerset_buffer) continue; + + LLColor4 text_color = LLColor4::white; + + if (layerset_buffer->uploadNeeded()) + { + text_color = LLColor4::red; + } + if (layerset_buffer->uploadInProgress()) + { + text_color = LLColor4::magenta; + } + std::string text = layerset_buffer->dumpTextureInfo(); + LLFontGL::getFontMonospace()->renderUTF8(text, 0, l_offset, v_offset + line_height*line_num, + text_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); + line_num++; + } + const U32 texture_timeout = gSavedSettings.getU32("AvatarBakedTextureUploadTimeout"); + const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); + + LLColor4 header_color(1.f, 1.f, 1.f, 0.9f); + + const std::string texture_timeout_str = texture_timeout ? llformat("%d",texture_timeout) : "Disabled"; + 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('AvatarBakedTextureUploadTimeout'):%s ] [ LOD_Override('TextureDiscardLevel'):%s ]", texture_timeout_str.c_str(), override_tex_discard_level_str.c_str()); + LLFontGL::getFontMonospace()->renderUTF8(header_text, 0, l_offset, v_offset + line_height*line_num, + header_color, LLFontGL::LEFT, LLFontGL::TOP); //, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); + line_num++; + std::string section_text = "Avatar Textures Information:"; + LLFontGL::getFontMonospace()->renderUTF8(section_text, 0, 0, v_offset + line_height*line_num, + header_color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); +} + +BOOL LLAvatarTexBar::handleMouseDown(S32 x, S32 y, MASK mask) +{ + return FALSE; +} + +LLRect LLAvatarTexBar::getRequiredRect() +{ + LLRect rect; + rect.mTop = 100; + if (!gSavedSettings.getBOOL("DebugAvatarRezTime")) rect.mTop = 0; + return rect; +} + +//////////////////////////////////////////////////////////////////////////// + class LLGLTexMemBar : public LLView { public: @@ -412,13 +518,17 @@ 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 + 2.5f); + 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); LLColor4 color; - std::string text; + std::string text = ""; + + LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*6, + text_color, LLFontGL::LEFT, LLFontGL::TOP); + text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB Raw Tot: %d MB Bias: %.2f Cache: %.1f/%.1f MB", total_mem, max_total_mem, @@ -560,7 +670,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; } @@ -640,6 +751,7 @@ LLTextureView::LLTextureView(const LLTextureView::Params& p) setDisplayChildren(TRUE); mGLTexMemBar = 0; + mAvatarTexBar = 0; } LLTextureView::~LLTextureView() @@ -647,6 +759,9 @@ LLTextureView::~LLTextureView() // Children all cleaned up by default view destructor. delete mGLTexMemBar; mGLTexMemBar = 0; + + delete mAvatarTexBar; + mAvatarTexBar = 0; } typedef std::pair<F32,LLViewerFetchedTexture*> decode_pair_t; @@ -684,6 +799,13 @@ void LLTextureView::draw() mGLTexMemBar = 0; } + if (mAvatarTexBar) + { + removeChild(mAvatarTexBar); + mAvatarTexBar->die(); + mAvatarTexBar = 0; + } + typedef std::multiset<decode_pair_t, compare_decode_pair > display_list_t; display_list_t display_image_list; @@ -708,7 +830,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() @@ -723,19 +845,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) { @@ -754,59 +863,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 + { + 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) { - return (mImage == object->getTEImage(te)); + 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) { @@ -847,11 +952,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); /* |