summaryrefslogtreecommitdiff
path: root/indra/newview/lltextureview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltextureview.cpp')
-rw-r--r--indra/newview/lltextureview.cpp392
1 files changed, 324 insertions, 68 deletions
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index d356bf99ae..ea675c5a6e 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -43,33 +43,34 @@
#include "llimageworker.h"
#include "llrender.h"
-#include "llhoverview.h"
+#include "lltooltip.h"
#include "llselectmgr.h"
#include "lltexlayer.h"
#include "lltexturecache.h"
#include "lltexturefetch.h"
#include "llviewerobject.h"
-#include "llviewerimage.h"
-#include "llviewerimagelist.h"
+#include "llviewertexture.h"
+#include "llviewertexturelist.h"
#include "llappviewer.h"
extern F32 texmem_lower_bound_scale;
LLTextureView *gTextureView = NULL;
+LLTextureSizeView *gTextureSizeView = NULL;
//static
-std::set<LLViewerImage*> LLTextureView::sDebugImages;
+std::set<LLViewerFetchedTexture*> LLTextureView::sDebugImages;
////////////////////////////////////////////////////////////////////////////
-static std::string title_string1a("Tex UUID Area DDis(Req) DecodePri(Fetch) [download] pk/max");
-static std::string title_string1b("Tex UUID Area DDis(Req) Fetch(DecodePri) [download] pk/max");
+static std::string title_string1a("Tex UUID Area DDis(Req) DecodePri(Fetch) [download] pk/max");
+static std::string title_string1b("Tex UUID Area DDis(Req) Fetch(DecodePri) [download] pk/max");
static std::string title_string2("State");
static std::string title_string3("Pkt Bnd");
static std::string title_string4(" W x H (Dis) Mem");
static S32 title_x1 = 0;
-static S32 title_x2 = 440;
+static S32 title_x2 = 460;
static S32 title_x3 = title_x2 + 40;
static S32 title_x4 = title_x3 + 50;
static S32 texture_bar_height = 8;
@@ -79,16 +80,24 @@ static S32 texture_bar_height = 8;
class LLTextureBar : public LLView
{
public:
- LLPointer<LLViewerImage> mImagep;
+ LLPointer<LLViewerFetchedTexture> mImagep;
S32 mHilite;
public:
- LLTextureBar(const std::string& name, const LLRect& r, LLTextureView* texview)
- : LLView(name, r, FALSE),
- mHilite(0),
- mTextureView(texview)
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
{
- }
+ Mandatory<LLTextureView*> texture_view;
+ Params()
+ : texture_view("texture_view")
+ {
+ mouse_opaque(false);
+ }
+ };
+ LLTextureBar(const Params& p)
+ : LLView(p),
+ mHilite(0),
+ mTextureView(p.texture_view)
+ {}
virtual void draw();
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
@@ -101,8 +110,8 @@ public:
{
LLTextureBar* bar1p = (LLTextureBar*)i1;
LLTextureBar* bar2p = (LLTextureBar*)i2;
- LLViewerImage *i1p = bar1p->mImagep;
- LLViewerImage *i2p = bar2p->mImagep;
+ LLViewerFetchedTexture *i1p = bar1p->mImagep;
+ LLViewerFetchedTexture *i2p = bar2p->mImagep;
F32 pri1 = i1p->getDecodePriority(); // i1p->mRequestedDownloadPriority
F32 pri2 = i2p->getDecodePriority(); // i2p->mRequestedDownloadPriority
if (pri1 > pri2)
@@ -120,10 +129,10 @@ public:
{
LLTextureBar* bar1p = (LLTextureBar*)i1;
LLTextureBar* bar2p = (LLTextureBar*)i2;
- LLViewerImage *i1p = bar1p->mImagep;
- LLViewerImage *i2p = bar2p->mImagep;
- U32 pri1 = i1p->mFetchPriority;
- U32 pri2 = i2p->mFetchPriority;
+ LLViewerFetchedTexture *i1p = bar1p->mImagep;
+ LLViewerFetchedTexture *i2p = bar2p->mImagep;
+ U32 pri1 = i1p->getFetchPriority() ;
+ U32 pri2 = i2p->getFetchPriority() ;
if (pri1 > pri2)
return true;
else if (pri2 > pri1)
@@ -307,10 +316,10 @@ void LLTextureBar::draw()
pip_x += pip_width + pip_space;
// we don't want to show bind/resident pips for textures using the default texture
- if (mImagep->getHasGLTexture())
+ if (mImagep->hasGLTexture())
{
// Draw the bound pip
- last_event = mImagep->sLastFrameTime - mImagep->mLastBindTime;
+ last_event = mImagep->getTimePassedSinceLastBound();
if (last_event < 1.f)
{
clr = mImagep->getMissed() ? LLColor4::red : LLColor4::magenta1;
@@ -334,7 +343,7 @@ void LLTextureBar::draw()
// draw the image size at the end
{
std::string num_str = llformat("%3dx%3d (%d) %7d", mImagep->getWidth(), mImagep->getHeight(),
- mImagep->getDiscardLevel(), mImagep->mTextureMemory);
+ mImagep->getDiscardLevel(), mImagep->hasGLTexture() ? mImagep->getTextureMemory() : 0);
LLFontGL::getFontMonospace()->renderUTF8(num_str, 0, title_x4, getRect().getHeight(), color,
LLFontGL::LEFT, LLFontGL::TOP);
}
@@ -366,13 +375,21 @@ LLRect LLTextureBar::getRequiredRect()
class LLGLTexMemBar : public LLView
{
public:
- LLGLTexMemBar(const std::string& name, LLTextureView* texview)
- : LLView(name, FALSE),
- mTextureView(texview)
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
{
- S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
- setRect(LLRect(0,0,100,line_height * 4));
- }
+ 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));
+ }
+ };
+
+ LLGLTexMemBar(const Params& p)
+ : LLView(p),
+ mTextureView(p.texture_view)
+ {}
virtual void draw();
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
@@ -384,13 +401,13 @@ private:
void LLGLTexMemBar::draw()
{
- S32 bound_mem = BYTES_TO_MEGA_BYTES(LLViewerImage::sBoundTextureMemoryInBytes);
- S32 max_bound_mem = LLViewerImage::sMaxBoundTextureMemInMegaBytes;
- S32 total_mem = BYTES_TO_MEGA_BYTES(LLViewerImage::sTotalTextureMemoryInBytes);
- S32 max_total_mem = LLViewerImage::sMaxTotalTextureMemInMegaBytes;
- F32 discard_bias = LLViewerImage::sDesiredDiscardBias;
+ S32 bound_mem = BYTES_TO_MEGA_BYTES(LLViewerTexture::sBoundTextureMemoryInBytes);
+ S32 max_bound_mem = LLViewerTexture::sMaxBoundTextureMemInMegaBytes;
+ S32 total_mem = BYTES_TO_MEGA_BYTES(LLViewerTexture::sTotalTextureMemoryInBytes);
+ S32 max_total_mem = LLViewerTexture::sMaxTotalTextureMemInMegaBytes;
+ F32 discard_bias = LLViewerTexture::sDesiredDiscardBias;
S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
-
+ S32 h_offset = (S32)((texture_bar_height + 2.5f) * mTextureView->mNumTextureBars + 2.5f);
//----------------------------------------------------------------------------
LLGLSUIDefault gls_ui;
F32 text_color[] = {1.f, 1.f, 1.f, 0.75f};
@@ -403,13 +420,13 @@ void LLGLTexMemBar::draw()
max_bound_mem,
discard_bias);
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*3,
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, h_offset + line_height*3,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
//----------------------------------------------------------------------------
S32 bar_left = 380;
S32 bar_width = 200;
- S32 top = line_height*3 - 2;
+ S32 top = line_height*3 - 2 + h_offset;
S32 bottom = top - 6;
S32 left = bar_left;
S32 right = left + bar_width;
@@ -461,49 +478,49 @@ void LLGLTexMemBar::draw()
//----------------------------------------------------------------------------
text = llformat("Textures: Count: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d IW:%d(%d) RAW:%d mRaw:%d mAux:%d CB:%d",
- gImageList.getNumImages(),
+ gTextureList.getNumImages(),
LLAppViewer::getTextureFetch()->getNumRequests(), LLAppViewer::getTextureFetch()->getNumDeletes(),
LLAppViewer::getTextureFetch()->mPacketCount, LLAppViewer::getTextureFetch()->mBadPacketCount,
LLAppViewer::getTextureCache()->getNumReads(), LLAppViewer::getTextureCache()->getNumWrites(),
LLLFSThread::sLocal->getPending(),
LLImageWorker::sCount, LLImageWorker::getWorkerThread()->getNumDeletes(),
- LLImageRaw::sRawImageCount, LLViewerImage::sRawCount, LLViewerImage::sAuxCount,
- gImageList.mCallbackList.size());
+ LLImageRaw::sRawImageCount, LLViewerFetchedTexture::sRawCount, LLViewerFetchedTexture::sAuxCount,
+ gTextureList.mCallbackList.size());
- LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*2,
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, h_offset + line_height*2,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
S32 dx1 = 0;
if (LLAppViewer::getTextureFetch()->mDebugPause)
{
- LLFontGL::getFontMonospace()->renderUTF8(std::string("!"), 0, title_x1, line_height,
+ LLFontGL::getFontMonospace()->renderUTF8(std::string("!"), 0, title_x1, h_offset + line_height,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
dx1 += 8;
}
if (mTextureView->mFreezeView)
{
- LLFontGL::getFontMonospace()->renderUTF8(std::string("*"), 0, title_x1, line_height,
+ LLFontGL::getFontMonospace()->renderUTF8(std::string("*"), 0, title_x1, h_offset + line_height,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
dx1 += 8;
}
if (mTextureView->mOrderFetch)
{
- LLFontGL::getFontMonospace()->renderUTF8(title_string1b, 0, title_x1+dx1, line_height,
+ LLFontGL::getFontMonospace()->renderUTF8(title_string1b, 0, title_x1+dx1, h_offset + line_height,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
}
else
{
- LLFontGL::getFontMonospace()->renderUTF8(title_string1a, 0, title_x1+dx1, line_height,
+ LLFontGL::getFontMonospace()->renderUTF8(title_string1a, 0, title_x1+dx1, h_offset + line_height,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
}
- LLFontGL::getFontMonospace()->renderUTF8(title_string2, 0, title_x2, line_height,
+ LLFontGL::getFontMonospace()->renderUTF8(title_string2, 0, title_x2, h_offset + line_height,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
- LLFontGL::getFontMonospace()->renderUTF8(title_string3, 0, title_x3, line_height,
+ LLFontGL::getFontMonospace()->renderUTF8(title_string3, 0, title_x3, h_offset + line_height,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
- LLFontGL::getFontMonospace()->renderUTF8(title_string4, 0, title_x4, line_height,
+ LLFontGL::getFontMonospace()->renderUTF8(title_string4, 0, title_x4, h_offset + line_height,
text_color, LLFontGL::LEFT, LLFontGL::TOP);
}
@@ -520,9 +537,76 @@ LLRect LLGLTexMemBar::getRequiredRect()
}
////////////////////////////////////////////////////////////////////////////
+class LLGLTexSizeBar
+{
+public:
+ LLGLTexSizeBar(S32 index, S32 left, S32 bottom, S32 right, S32 line_height)
+ {
+ mIndex = index ;
+ mLeft = left ;
+ mBottom = bottom ;
+ mRight = right ;
+ mLineHeight = line_height ;
+ mTopLoaded = 0 ;
+ mTopBound = 0 ;
+ mScale = 1.0f ;
+ }
+
+ void setTop(S32 loaded, S32 bound, F32 scale) {mTopLoaded = loaded ; mTopBound = bound; mScale = scale ;}
+
+ void draw();
+ BOOL handleHover(S32 x, S32 y, MASK mask) ;
+
+private:
+ S32 mIndex ;
+ S32 mLeft ;
+ S32 mBottom ;
+ S32 mRight ;
+ S32 mTopLoaded ;
+ S32 mTopBound ;
+ S32 mLineHeight ;
+ F32 mScale ;
+};
+
+BOOL LLGLTexSizeBar::handleHover(S32 x, S32 y, MASK mask)
+{
+#if !LL_RELEASE_FOR_DOWNLOAD
+ if(y > mBottom && (y < mBottom + (S32)(mTopLoaded * mScale) || y < mBottom + (S32)(mTopBound * mScale)))
+ {
+ LLImageGL::setCurTexSizebar(mIndex);
+ }
+#endif
+ return TRUE ;
+}
+void LLGLTexSizeBar::draw()
+{
+#if !LL_RELEASE_FOR_DOWNLOAD
+ LLGLSUIDefault gls_ui;
+
+ if(LLImageGL::sCurTexSizeBar == mIndex)
+ {
+ F32 text_color[] = {1.f, 1.f, 1.f, 0.75f};
+ std::string text;
+
+ text = llformat("%d", mTopLoaded) ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, mLeft, mBottom + (S32)(mTopLoaded * mScale) + mLineHeight,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ text = llformat("%d", mTopBound) ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, (mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale) + mLineHeight,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ }
+
+ F32 loaded_color[] = {1.0f, 0.0f, 0.0f, 0.75f};
+ F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f};
+ gl_rect_2d(mLeft, mBottom + (S32)(mTopLoaded * mScale), (mLeft + mRight) / 2, mBottom, loaded_color) ;
+ gl_rect_2d((mLeft + mRight) / 2, mBottom + (S32)(mTopBound * mScale), mRight, mBottom, bound_color) ;
+#endif
+}
+////////////////////////////////////////////////////////////////////////////
-LLTextureView::LLTextureView(const std::string& name, const LLRect& rect)
- : LLContainerView(name, rect),
+LLTextureView::LLTextureView(const LLTextureView::Params& p)
+ : LLContainerView(p),
mFreezeView(FALSE),
mOrderFetch(FALSE),
mPrintList(FALSE),
@@ -541,7 +625,7 @@ LLTextureView::~LLTextureView()
mGLTexMemBar = 0;
}
-typedef std::pair<F32,LLViewerImage*> decode_pair_t;
+typedef std::pair<F32,LLViewerFetchedTexture*> decode_pair_t;
struct compare_decode_pair
{
bool operator()(const decode_pair_t& a, const decode_pair_t& b)
@@ -571,18 +655,19 @@ void LLTextureView::draw()
llinfos << "ID\tMEM\tBOOST\tPRI\tWIDTH\tHEIGHT\tDISCARD" << llendl;
}
- for (LLViewerImageList::image_priority_list_t::iterator iter = gImageList.mImageList.begin();
- iter != gImageList.mImageList.end(); )
+ for (LLViewerTextureList::image_priority_list_t::iterator iter = gTextureList.mImageList.begin();
+ iter != gTextureList.mImageList.end(); )
{
- LLPointer<LLViewerImage> imagep = *iter++;
+ LLPointer<LLViewerFetchedTexture> imagep = *iter++;
S32 cur_discard = imagep->getDiscardLevel();
S32 desired_discard = imagep->mDesiredDiscardLevel;
if (mPrintList)
{
+ S32 tex_mem = imagep->hasGLTexture() ? imagep->getTextureMemory() : 0 ;
llinfos << imagep->getID()
- << "\t" << imagep->mTextureMemory
+ << "\t" << tex_mem
<< "\t" << imagep->getBoostLevel()
<< "\t" << imagep->getDecodePriority()
<< "\t" << imagep->getWidth()
@@ -627,8 +712,8 @@ void LLTextureView::draw()
{
struct f : public LLSelectedTEFunctor
{
- LLViewerImage* mImage;
- f(LLViewerImage* image) : mImage(image) {}
+ LLViewerFetchedTexture* mImage;
+ f(LLViewerFetchedTexture* image) : mImage(image) {}
virtual bool apply(LLViewerObject* object, S32 te)
{
return (mImage == object->getTEImage(te));
@@ -645,16 +730,20 @@ void LLTextureView::draw()
#if 1
if (pri < HIGH_PRIORITY && (cur_discard< 0 || desired_discard < cur_discard))
{
- LLViewerObject *objectp = gHoverView->getLastHoverObject();
- 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;
+ }
}
}
}
@@ -685,10 +774,11 @@ void LLTextureView::draw()
static S32 max_count = 50;
S32 count = 0;
+ mNumTextureBars = 0 ;
for (display_list_t::iterator iter = display_image_list.begin();
iter != display_image_list.end(); iter++)
{
- LLViewerImage* imagep = iter->second;
+ LLViewerFetchedTexture* imagep = iter->second;
S32 hilite = 0;
F32 pri = iter->first;
if (pri >= 1 * HIGH_PRIORITY)
@@ -709,13 +799,16 @@ void LLTextureView::draw()
else
sortChildren(LLTextureBar::sort());
- mGLTexMemBar = new LLGLTexMemBar("gl texmem bar", this);
+ LLGLTexMemBar::Params tmbp;
+ tmbp.name("gl texmem bar");
+ tmbp.texture_view(this);
+ mGLTexMemBar = LLUICtrlFactory::create<LLGLTexMemBar>(tmbp);
addChild(mGLTexMemBar);
reshape(getRect().getWidth(), getRect().getHeight(), TRUE);
/*
- count = gImageList.getNumImages();
+ count = gTextureList.getNumImages();
std::string info_string;
info_string = llformat("Global Info:\nTexture Count: %d", count);
mInfoTextp->setText(info_string);
@@ -737,7 +830,7 @@ void LLTextureView::draw()
}
-BOOL LLTextureView::addBar(LLViewerImage *imagep, S32 hilite)
+BOOL LLTextureView::addBar(LLViewerFetchedTexture *imagep, S32 hilite)
{
llassert(imagep);
@@ -746,7 +839,11 @@ BOOL LLTextureView::addBar(LLViewerImage *imagep, S32 hilite)
mNumTextureBars++;
- barp = new LLTextureBar("texture bar", r, this);
+ LLTextureBar::Params tbp;
+ tbp.name("texture bar");
+ tbp.rect(r);
+ tbp.texture_view(this);
+ barp = LLUICtrlFactory::create<LLTextureBar>(tbp);
barp->mImagep = imagep;
barp->mHilite = hilite;
@@ -791,4 +888,163 @@ BOOL LLTextureView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
return FALSE;
}
+//-----------------------------------------------------------------
+LLTextureSizeView::LLTextureSizeView(const LLTextureSizeView::Params& p)
+ : LLView(p)
+{
+ setVisible(FALSE) ;
+
+ mTextureSizeBarWidth = 30 ;
+}
+
+LLTextureSizeView::~LLTextureSizeView()
+{
+ if(mTextureSizeBar.size())
+ {
+ for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++)
+ {
+ delete mTextureSizeBar[i] ;
+ }
+ mTextureSizeBar.clear() ;
+ }
+}
+void LLTextureSizeView::draw()
+{
+#if !LL_RELEASE_FOR_DOWNLOAD
+ if(mTextureSizeBar.size() == 0)
+ {
+ S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+ mTextureSizeBar.resize(LLImageGL::sTextureLoadedCounter.size()) ;
+ mTextureSizeBarRect.set(700, line_height * 2 + 400, 700 + mTextureSizeBar.size() * mTextureSizeBarWidth, line_height * 2) ;
+
+ for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++)
+ {
+ mTextureSizeBar[i] = new LLGLTexSizeBar(i, mTextureSizeBarRect.mLeft + i * mTextureSizeBarWidth ,
+ line_height * 2, mTextureSizeBarRect.mLeft + (i + 1) * mTextureSizeBarWidth, line_height) ;
+ }
+ }
+
+ F32 size_bar_scale = drawTextureSizeDistributionGraph() ;
+ for(U32 i = 0 ; i < mTextureSizeBar.size() ; i++)
+ {
+ mTextureSizeBar[i]->setTop(LLImageGL::sTextureLoadedCounter[i], LLImageGL::sTextureBoundCounter[i], size_bar_scale) ;
+ mTextureSizeBar[i]->draw() ;
+ }
+ LLImageGL::resetCurTexSizebar();
+
+ LLView::draw();
+#endif
+}
+
+BOOL LLTextureSizeView::handleHover(S32 x, S32 y, MASK mask)
+{
+ if(x > mTextureSizeBarRect.mLeft && x < mTextureSizeBarRect.mRight)
+ {
+ mTextureSizeBar[(x - mTextureSizeBarRect.mLeft) / mTextureSizeBarWidth]->handleHover(x, y, mask) ;
+ }
+
+ return TRUE ;
+}
+
+//draw background of texture size bar graph
+F32 LLTextureSizeView::drawTextureSizeDistributionGraph()
+{
+ F32 scale = 1.0f ;
+#if !LL_RELEASE_FOR_DOWNLOAD
+ LLGLSUIDefault gls_ui;
+
+ //scale
+ {
+ S32 count = 0 ;
+ for(U32 i = 0 ; i < LLImageGL::sTextureLoadedCounter.size() ; i++)
+ {
+ if(LLImageGL::sTextureLoadedCounter[i] > count)
+ {
+ count = LLImageGL::sTextureLoadedCounter[i] ;
+ }
+ }
+ if(count > mTextureSizeBarRect.getHeight())
+ {
+ scale = (F32)mTextureSizeBarRect.getHeight() / count ;
+ }
+ }
+
+ S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
+ S32 left = mTextureSizeBarRect.mLeft ;
+ S32 bottom = mTextureSizeBarRect.mBottom ;
+ S32 right = mTextureSizeBarRect.mRight ;
+ S32 top = mTextureSizeBarRect.mTop ;
+
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+ //background rect
+ gl_rect_2d(left - 25, top + 30, right + 100, bottom - 25, LLColor4(0.0f, 0.0f, 0.0f, 0.25f)) ;
+
+ //--------------------------------------------------
+ gGL.color4f(1.0f, 0.5f, 0.5f, 0.75f);
+ gl_line_2d(left, bottom, right, bottom) ; //x axis
+ gl_line_2d(left, bottom, left, top) ; //y axis
+
+ //ruler
+ //--------------------------------------------------
+ gGL.color4f(1.0f, 0.5f, 0.5f, 0.5f);
+ for(S32 i = bottom + 50 ; i <= top ; i += 50)
+ {
+ gl_line_2d(left, i, right, i) ;
+ }
+
+ //texts
+ //--------------------------------------------------
+ F32 text_color[] = {1.f, 1.f, 1.f, 0.75f};
+ std::string text;
+
+ //-------
+ //x axis: size label
+ text = llformat("%d", 0) ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 12, bottom - line_height / 2,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ for(U32 i = 1 ; i < mTextureSizeBar.size() ; i++)
+ {
+ text = llformat("%d", (1 << (i / 2)) + ((i & 1) ? ((1 << (i / 2)) >> 1) : 0)) ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + i * mTextureSizeBarWidth + 12, bottom - line_height / 2,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ }
+ text = llformat("(w + h)/2") ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, right + 10, bottom - line_height / 2,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ //-------
+
+ //y axis: number label
+ for(S32 i = bottom + 50 ; i <= top ; i += 50)
+ {
+ text = llformat("%d", (S32)((i - bottom) / scale)) ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, left - 20, i + line_height / 2 ,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, right + 5, i + line_height / 2 ,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+ }
+
+ //--------------------------------------------------
+ F32 loaded_color[] = {1.0f, 0.0f, 0.0f, 0.75f};
+ gl_rect_2d(left + 70, top + line_height * 2, left + 90, top + line_height, loaded_color) ;
+ text = llformat("Loaded") ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 100, top + line_height * 2,
+ loaded_color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ F32 bound_color[] = {1.0f, 1.0f, 0.0f, 0.75f};
+ gl_rect_2d(left + 170, top + line_height * 2, left + 190, top + line_height, bound_color) ;
+ text = llformat("Bound") ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 200, top + line_height * 2,
+ bound_color, LLFontGL::LEFT, LLFontGL::TOP);
+
+ //--------------------------------------------------
+
+ //title
+ text = llformat("Texture Size Distribution") ;
+ LLFontGL::getFontMonospace()->renderUTF8(text, 0, left + 250, top + line_height * 3,
+ text_color, LLFontGL::LEFT, LLFontGL::TOP);
+
+#endif
+ return scale ;
+}