From b1baf982b1bd41a150233d0a28d3601226924c65 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 30 Sep 2012 10:41:29 -0700 Subject: SH-3275 WIP Run viewer metrics for object update messages factored out lltrace::sampler into separate file added rudimentary lltrace support to llstatgraph made llstatgraph use param blocks more effectively moves initial set of stats over to lltrace removed windows.h #defines for min and max --- indra/llrender/llglheaders.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 509de51f4d..605b424b35 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -543,6 +543,8 @@ extern PFNGLBINDBUFFERRANGEPROC glBindBufferRange; #define WIN32_LEAN_AND_MEAN #include #include +#undef min +#undef max //---------------------------------------------------------------------------- #include -- cgit v1.2.3 From e6ca5471a2a816a24888ae1b38332531b22b7254 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 17 Oct 2012 00:06:22 -0700 Subject: SH-3275 Update viewer metrics system to be more flexible put template parameter back in LLUnit units added free function operators for mathematical manipulation of unit values converted texture memory tracking to units --- indra/llrender/llimagegl.cpp | 16 ++++++++-------- indra/llrender/llimagegl.h | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index a4d7872ec2..fc1edbe664 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -50,9 +50,9 @@ U32 wpo2(U32 i); U32 LLImageGL::sUniqueCount = 0; U32 LLImageGL::sBindCount = 0; -S32 LLImageGL::sGlobalTextureMemoryInBytes = 0; -S32 LLImageGL::sBoundTextureMemoryInBytes = 0; -S32 LLImageGL::sCurBoundTextureMemory = 0; +LLUnit::Bytes LLImageGL::sGlobalTextureMemory = 0; +LLUnit::Bytes LLImageGL::sBoundTextureMemory = 0; +LLUnit::Bytes LLImageGL::sCurBoundTextureMemory = 0; S32 LLImageGL::sCount = 0; LLImageGL::dead_texturelist_t LLImageGL::sDeadTextureList[LLTexUnit::TT_NONE]; U32 LLImageGL::sCurTexName = 1; @@ -243,7 +243,7 @@ void LLImageGL::updateStats(F32 current_time) { LLFastTimer t(FTM_IMAGE_UPDATE_STATS); sLastFrameTime = current_time; - sBoundTextureMemoryInBytes = sCurBoundTextureMemory; + sBoundTextureMemory = sCurBoundTextureMemory; sCurBoundTextureMemory = 0; } @@ -251,7 +251,7 @@ void LLImageGL::updateStats(F32 current_time) S32 LLImageGL::updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category) { LLImageGL::sCurBoundTextureMemory += mem ; - return LLImageGL::sCurBoundTextureMemory; + return LLImageGL::sCurBoundTextureMemory.value(); } //---------------------------------------------------------------------------- @@ -1395,7 +1395,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ if (old_name != 0) { - sGlobalTextureMemoryInBytes -= mTextureMemory; + sGlobalTextureMemory -= mTextureMemory; LLImageGL::deleteTextures(mBindTarget, mFormatInternal, mMipLevels, 1, &old_name); @@ -1403,7 +1403,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ } mTextureMemory = getMipBytes(discard_level); - sGlobalTextureMemoryInBytes += mTextureMemory; + sGlobalTextureMemory += mTextureMemory; mTexelsInGLTexture = getWidth() * getHeight() ; // mark this as bound at this point, so we don't throw it out immediately @@ -1562,7 +1562,7 @@ void LLImageGL::destroyGLTexture() { if(mTextureMemory) { - sGlobalTextureMemoryInBytes -= mTextureMemory; + sGlobalTextureMemory -= mTextureMemory; mTextureMemory = 0; } diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index cf3c484c79..dfa59f2a34 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -34,6 +34,7 @@ #include "llpointer.h" #include "llrefcount.h" #include "v2math.h" +#include "llunit.h" #include "llrender.h" class LLTextureAtlas ; @@ -245,9 +246,9 @@ public: static F32 sLastFrameTime; // Global memory statistics - static S32 sGlobalTextureMemoryInBytes; // Tracks main memory texmem - static S32 sBoundTextureMemoryInBytes; // Tracks bound texmem for last completed frame - static S32 sCurBoundTextureMemory; // Tracks bound texmem for current frame + static LLUnit::Bytes sGlobalTextureMemory; // Tracks main memory texmem + static LLUnit::Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame + static LLUnit::Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame static U32 sBindCount; // Tracks number of texture binds for current frame static U32 sUniqueCount; // Tracks number of unique texture binds for current frame static BOOL sGlobalUseAnisotropic; -- cgit v1.2.3 From 0bb0bd514b235948c1a21c81ab0e8ab6223b1990 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 8 Nov 2012 23:42:18 -0800 Subject: SH-3499 WIP Ensure asset stats output is correct Finished making LLUnit implicitly convertible to/from scalar integer values cleaned up test code --- indra/llrender/llimagegl.cpp | 6 +++--- indra/llrender/llimagegl.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index fc1edbe664..5361d8e7be 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -50,9 +50,9 @@ U32 wpo2(U32 i); U32 LLImageGL::sUniqueCount = 0; U32 LLImageGL::sBindCount = 0; -LLUnit::Bytes LLImageGL::sGlobalTextureMemory = 0; -LLUnit::Bytes LLImageGL::sBoundTextureMemory = 0; -LLUnit::Bytes LLImageGL::sCurBoundTextureMemory = 0; +LLUnit LLImageGL::sGlobalTextureMemory = 0; +LLUnit LLImageGL::sBoundTextureMemory = 0; +LLUnit LLImageGL::sCurBoundTextureMemory = 0; S32 LLImageGL::sCount = 0; LLImageGL::dead_texturelist_t LLImageGL::sDeadTextureList[LLTexUnit::TT_NONE]; U32 LLImageGL::sCurTexName = 1; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index dfa59f2a34..11555e20c4 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -246,9 +246,9 @@ public: static F32 sLastFrameTime; // Global memory statistics - static LLUnit::Bytes sGlobalTextureMemory; // Tracks main memory texmem - static LLUnit::Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame - static LLUnit::Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame + static LLUnit sGlobalTextureMemory; // Tracks main memory texmem + static LLUnit sBoundTextureMemory; // Tracks bound texmem for last completed frame + static LLUnit sCurBoundTextureMemory; // Tracks bound texmem for current frame static U32 sBindCount; // Tracks number of texture binds for current frame static U32 sUniqueCount; // Tracks number of unique texture binds for current frame static BOOL sGlobalUseAnisotropic; -- cgit v1.2.3 From 9d77e030d9a0d23cebce616631677459eec1612c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 14 Nov 2012 23:52:27 -0800 Subject: SH-3406 WIP convert fast timers to lltrace system cleaning up build moved most includes of windows.h to llwin32headers.h to disable min/max macros, etc streamlined Time class and consolidated functionality in BlockTimer class llfasttimer is no longer included via llstring.h, so had to add it manually in several places --- indra/llrender/llfontgl.cpp | 1 + indra/llrender/llglheaders.h | 6 +----- indra/llrender/llimagegl.cpp | 1 + indra/llrender/llvertexbuffer.cpp | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 4dc2fcd714..d2d929fbf9 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -29,6 +29,7 @@ #include "llfontgl.h" // Linden library includes +#include "llfasttimer.h" #include "llfontfreetype.h" #include "llfontbitmapcache.h" #include "llfontregistry.h" diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 605b424b35..c9ce0d5588 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -540,11 +540,7 @@ extern PFNGLBINDBUFFERRANGEPROC glBindBufferRange; // LL_WINDOWS // windows gl headers depend on things like APIENTRY, so include windows. -#define WIN32_LEAN_AND_MEAN -#include -#include -#undef min -#undef max +#include "llwin32headerslean.h" //---------------------------------------------------------------------------- #include diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 5361d8e7be..751309af20 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -32,6 +32,7 @@ #include "llimagegl.h" #include "llerror.h" +#include "llfasttimer.h" #include "llimage.h" #include "llmath.h" diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 11b2681e52..45baf641fb 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -26,7 +26,7 @@ #include "linden_common.h" -#include +#include "llfasttimer.h" #include "llsys.h" #include "llvertexbuffer.h" // #include "llrender.h" -- cgit v1.2.3 From c978364e1eec987c70769e66d3b9342b321acbc4 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 22 Apr 2013 22:11:41 -0600 Subject: for SH-4133: create a debug tool to show textures in active fetching --- indra/llrender/llrender.cpp | 5 +++++ indra/llrender/lltexture.h | 2 ++ 2 files changed, 7 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 4597d06260..630b9125a2 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -245,6 +245,11 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) return texture->bindDefaultImage(mIndex); } + if(texture->isActiveFetching()) //in debug + { + return texture->bindDebugImage(mIndex); + } + //in audit, replace the selected texture by the default one. if ((mCurrTexture != gl_tex->getTexName()) || forceBind) { diff --git a/indra/llrender/lltexture.h b/indra/llrender/lltexture.h index 569a65c2e0..9033881424 100644 --- a/indra/llrender/lltexture.h +++ b/indra/llrender/lltexture.h @@ -58,10 +58,12 @@ public: virtual S8 getType() const = 0 ; virtual void setKnownDrawSize(S32 width, S32 height) = 0 ; virtual bool bindDefaultImage(const S32 stage = 0) = 0 ; + virtual bool bindDebugImage(const S32 stage = 0) = 0; virtual void forceImmediateUpdate() = 0 ; virtual void setActive() = 0 ; virtual S32 getWidth(S32 discard_level = -1) const = 0 ; virtual S32 getHeight(S32 discard_level = -1) const = 0 ; + virtual bool isActiveFetching() = 0; private: //note: do not make this function public. -- cgit v1.2.3 From 6b81b8629e67d82a7620e48781ded73b6e6126ea Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 5 May 2013 17:45:35 -0700 Subject: Spring cleaning: removed unused .cpp and.h files, and cleaned up header dependencies --- indra/llrender/llfontregistry.cpp | 24 +++++++++++++----------- indra/llrender/llfontregistry.h | 5 +++-- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index b5bdba996f..ef48ffa39a 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -34,13 +34,15 @@ #include "llcontrol.h" #include "lldir.h" #include "llwindow.h" +#include "llxmlnode.h" extern LLControlGroup gSavedSettings; using std::string; using std::map; -bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc); +bool font_desc_init_from_xml(LLXMLNodePtr node, LLFontDescriptor& desc); +bool init_from_xml(LLFontRegistry* registry, LLXMLNodePtr node); LLFontDescriptor::LLFontDescriptor(): mStyle(0) @@ -207,7 +209,7 @@ bool LLFontRegistry::parseFontInfo(const std::string& xml_filename) if (root->hasName("fonts")) { // Expect a collection of children consisting of "font" or "font_size" entries - bool init_succ = initFromXML(root); + bool init_succ = init_from_xml(this, root); success = success || init_succ; } } @@ -230,7 +232,7 @@ std::string currentOsName() #endif } -bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc) +bool font_desc_init_from_xml(LLXMLNodePtr node, LLFontDescriptor& desc) { if (node->hasName("font")) { @@ -263,14 +265,14 @@ bool fontDescInitFromXML(LLXMLNodePtr node, LLFontDescriptor& desc) { if (child_name == currentOsName()) { - fontDescInitFromXML(child, desc); + font_desc_init_from_xml(child, desc); } } } return true; } -bool LLFontRegistry::initFromXML(LLXMLNodePtr node) +bool init_from_xml(LLFontRegistry* registry, LLXMLNodePtr node) { LLXMLNodePtr child; @@ -281,17 +283,17 @@ bool LLFontRegistry::initFromXML(LLXMLNodePtr node) if (child->hasName("font")) { LLFontDescriptor desc; - bool font_succ = fontDescInitFromXML(child, desc); + bool font_succ = font_desc_init_from_xml(child, desc); LLFontDescriptor norm_desc = desc.normalize(); if (font_succ) { // if this is the first time we've seen this font name, // create a new template map entry for it. - const LLFontDescriptor *match_desc = getMatchingFontDesc(desc); + const LLFontDescriptor *match_desc = registry->getMatchingFontDesc(desc); if (match_desc == NULL) { // Create a new entry (with no corresponding font). - mFontMap[norm_desc] = NULL; + registry->mFontMap[norm_desc] = NULL; } // otherwise, find the existing entry and combine data. else @@ -306,8 +308,8 @@ bool LLFontRegistry::initFromXML(LLXMLNodePtr node) desc.getFileNames().end()); LLFontDescriptor new_desc = *match_desc; new_desc.getFileNames() = match_file_names; - mFontMap.erase(*match_desc); - mFontMap[new_desc] = NULL; + registry->mFontMap.erase(*match_desc); + registry->mFontMap[new_desc] = NULL; } } } @@ -318,7 +320,7 @@ bool LLFontRegistry::initFromXML(LLXMLNodePtr node) if (child->getAttributeString("name",size_name) && child->getAttributeF32("size",size_value)) { - mFontSizes[size_name] = size_value; + registry->mFontSizes[size_name] = size_value; } } diff --git a/indra/llrender/llfontregistry.h b/indra/llrender/llfontregistry.h index 059248fbbd..177eb6c8a5 100644 --- a/indra/llrender/llfontregistry.h +++ b/indra/llrender/llfontregistry.h @@ -28,7 +28,7 @@ #ifndef LL_LLFONTREGISTRY_H #define LL_LLFONTREGISTRY_H -#include "llxmlnode.h" +#include "llpointer.h" class LLFontGL; @@ -65,6 +65,7 @@ private: class LLFontRegistry { public: + friend bool init_from_xml(LLFontRegistry*, LLPointer); // create_gl_textures - set to false for test apps with no OpenGL window, // such as llui_libtest LLFontRegistry(bool create_gl_textures); @@ -72,7 +73,6 @@ public: // Load standard font info from XML file(s). bool parseFontInfo(const std::string& xml_filename); - bool initFromXML(LLXMLNodePtr node); // Clear cached glyphs for all fonts. void reset(); @@ -94,6 +94,7 @@ public: const string_vec_t& getUltimateFallbackList() const; private: + LLFontRegistry(const LLFontRegistry& other); // no-copy LLFontGL *createFont(const LLFontDescriptor& desc); typedef std::map font_reg_map_t; typedef std::map font_size_map_t; -- cgit v1.2.3 From 042b7aec26905cdfded007d6507abccb44947d8a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 5 Jun 2013 20:25:21 -0700 Subject: BUILDFIX: fixed llviewerassetstats test and render2dutils changes that were dropped in merge --- indra/llrender/llrender2dutils.cpp | 218 ++++++++++++++++++------------------- 1 file changed, 109 insertions(+), 109 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 9d23a64e4c..fe34c218a8 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -354,10 +354,10 @@ void gl_draw_image( S32 x, S32 y, LLTexture* image, const LLColor4& color, const gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), 0.f, image, color, uv_rect ); } -void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color, const LLRectf& uv_rect) -{ - gl_draw_scaled_rotated_image(x, y, width, height, 0.f, NULL, color, uv_rect, target); -} +void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color, const LLRectf& uv_rect) +{ + gl_draw_scaled_rotated_image(x, y, width, height, 0.f, NULL, color, uv_rect, target); +} void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect) { @@ -645,111 +645,111 @@ void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LL gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), degrees, image, color, uv_rect ); } -void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect, LLRenderTarget* target) -{ - if (!image && !target) - { - llwarns << "image == NULL; aborting function" << llendl; - return; - } - - LLGLSUIDefault gls_ui; - - if(image != NULL) - { - gGL.getTexUnit(0)->bind(image, true); - } - else - { - gGL.getTexUnit(0)->bind(target); - } - - gGL.color4fv(color.mV); - - if (degrees == 0.f) - { - const S32 NUM_VERTICES = 4; // 9 quads - LLVector2 uv[NUM_VERTICES]; - LLVector3 pos[NUM_VERTICES]; - - gGL.begin(LLRender::QUADS); - { - LLVector3 ui_scale = gGL.getUIScale(); - LLVector3 ui_translation = gGL.getUITranslation(); - ui_translation.mV[VX] += x; - ui_translation.mV[VY] += y; - ui_translation.scaleVec(ui_scale); - S32 index = 0; - S32 scaled_width = llround(width * ui_scale.mV[VX]); - S32 scaled_height = llround(height * ui_scale.mV[VY]); - - uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop); - pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f); - index++; - - uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop); - pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f); - index++; - - uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom); - pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY], 0.f); - index++; - - uv[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom); - pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f); - index++; - - gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); - } - gGL.end(); - } - else - { - gGL.pushUIMatrix(); - gGL.translateUI((F32)x, (F32)y, 0.f); - - F32 offset_x = F32(width/2); - F32 offset_y = F32(height/2); - - gGL.translateUI(offset_x, offset_y, 0.f); - - LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); - - if(image != NULL) - { - gGL.getTexUnit(0)->bind(image, true); - } - else - { - gGL.getTexUnit(0)->bind(target); - } - - gGL.color4fv(color.mV); - - gGL.begin(LLRender::QUADS); - { - LLVector3 v; - - v = LLVector3(offset_x, offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); - gGL.vertex2f(v.mV[0], v.mV[1] ); - - v = LLVector3(-offset_x, offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); - gGL.vertex2f(v.mV[0], v.mV[1] ); - - v = LLVector3(-offset_x, -offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); - gGL.vertex2f(v.mV[0], v.mV[1] ); - - v = LLVector3(offset_x, -offset_y, 0.f) * quat; - gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); - gGL.vertex2f(v.mV[0], v.mV[1] ); - } - gGL.end(); - gGL.popUIMatrix(); - } -} +void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect, LLRenderTarget* target) +{ + if (!image && !target) + { + llwarns << "image == NULL; aborting function" << llendl; + return; + } + + LLGLSUIDefault gls_ui; + + if(image != NULL) + { + gGL.getTexUnit(0)->bind(image, true); + } + else + { + gGL.getTexUnit(0)->bind(target); + } + + gGL.color4fv(color.mV); + + if (degrees == 0.f) + { + const S32 NUM_VERTICES = 4; // 9 quads + LLVector2 uv[NUM_VERTICES]; + LLVector3 pos[NUM_VERTICES]; + + gGL.begin(LLRender::QUADS); + { + LLVector3 ui_scale = gGL.getUIScale(); + LLVector3 ui_translation = gGL.getUITranslation(); + ui_translation.mV[VX] += x; + ui_translation.mV[VY] += y; + ui_translation.scaleVec(ui_scale); + S32 index = 0; + S32 scaled_width = llround(width * ui_scale.mV[VX]); + S32 scaled_height = llround(height * ui_scale.mV[VY]); + + uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop); + pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f); + index++; + + uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop); + pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f); + index++; + + uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom); + pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY], 0.f); + index++; + + uv[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom); + pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f); + index++; + + gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); + } + gGL.end(); + } + else + { + gGL.pushUIMatrix(); + gGL.translateUI((F32)x, (F32)y, 0.f); + + F32 offset_x = F32(width/2); + F32 offset_y = F32(height/2); + + gGL.translateUI(offset_x, offset_y, 0.f); + + LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); + + if(image != NULL) + { + gGL.getTexUnit(0)->bind(image, true); + } + else + { + gGL.getTexUnit(0)->bind(target); + } + + gGL.color4fv(color.mV); + + gGL.begin(LLRender::QUADS); + { + LLVector3 v; + + v = LLVector3(offset_x, offset_y, 0.f) * quat; + gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); + gGL.vertex2f(v.mV[0], v.mV[1] ); + + v = LLVector3(-offset_x, offset_y, 0.f) * quat; + gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); + gGL.vertex2f(v.mV[0], v.mV[1] ); + + v = LLVector3(-offset_x, -offset_y, 0.f) * quat; + gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); + gGL.vertex2f(v.mV[0], v.mV[1] ); + + v = LLVector3(offset_x, -offset_y, 0.f) * quat; + gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); + gGL.vertex2f(v.mV[0], v.mV[1] ); + } + gGL.end(); + gGL.popUIMatrix(); + } +} void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase ) { -- cgit v1.2.3 From 9fd3af3c389ed491b515cbb5136b344b069913e4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 13 Jun 2013 15:29:15 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics changed Units macros and argument order to make it more clear optimized units for integer types fixed merging of periodicrecordings...should eliminate duplicate entries in sceneloadmonitor history --- indra/llrender/llimagegl.cpp | 6 +++--- indra/llrender/llimagegl.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 2c3fcfcec1..cb99a651c6 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -51,9 +51,9 @@ U32 wpo2(U32 i); U32 LLImageGL::sUniqueCount = 0; U32 LLImageGL::sBindCount = 0; -LLUnit LLImageGL::sGlobalTextureMemory = 0; -LLUnit LLImageGL::sBoundTextureMemory = 0; -LLUnit LLImageGL::sCurBoundTextureMemory = 0; +LLUnit LLImageGL::sGlobalTextureMemory = 0; +LLUnit LLImageGL::sBoundTextureMemory = 0; +LLUnit LLImageGL::sCurBoundTextureMemory = 0; S32 LLImageGL::sCount = 0; LLImageGL::dead_texturelist_t LLImageGL::sDeadTextureList[LLTexUnit::TT_NONE]; U32 LLImageGL::sCurTexName = 1; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 2b568e5e0f..227ccc90bd 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -246,9 +246,9 @@ public: static F32 sLastFrameTime; // Global memory statistics - static LLUnit sGlobalTextureMemory; // Tracks main memory texmem - static LLUnit sBoundTextureMemory; // Tracks bound texmem for last completed frame - static LLUnit sCurBoundTextureMemory; // Tracks bound texmem for current frame + static LLUnit sGlobalTextureMemory; // Tracks main memory texmem + static LLUnit sBoundTextureMemory; // Tracks bound texmem for last completed frame + static LLUnit sCurBoundTextureMemory; // Tracks bound texmem for current frame static U32 sBindCount; // Tracks number of texture binds for current frame static U32 sUniqueCount; // Tracks number of unique texture binds for current frame static BOOL sGlobalUseAnisotropic; -- cgit v1.2.3 From e40065f82c797eab41006a448c838f4f1089a2e8 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 19 Jul 2013 15:03:05 -0700 Subject: BUILDFIX: #include and dependency cleanup --- indra/llrender/llimagegl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 01ed946d40..1d4be1f53c 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -51,9 +51,9 @@ U32 wpo2(U32 i); U32 LLImageGL::sUniqueCount = 0; U32 LLImageGL::sBindCount = 0; -LLUnit LLImageGL::sGlobalTextureMemory = 0; -LLUnit LLImageGL::sBoundTextureMemory = 0; -LLUnit LLImageGL::sCurBoundTextureMemory = 0; +LLUnit LLImageGL::sGlobalTextureMemory(0); +LLUnit LLImageGL::sBoundTextureMemory(0); +LLUnit LLImageGL::sCurBoundTextureMemory(0); S32 LLImageGL::sCount = 0; LLImageGL::dead_texturelist_t LLImageGL::sDeadTextureList[LLTexUnit::TT_NONE]; U32 LLImageGL::sCurTexName = 1; @@ -249,7 +249,7 @@ void LLImageGL::updateStats(F32 current_time) LLFastTimer t(FTM_IMAGE_UPDATE_STATS); sLastFrameTime = current_time; sBoundTextureMemory = sCurBoundTextureMemory; - sCurBoundTextureMemory = 0; + sCurBoundTextureMemory = LLUnits::Bytes::fromValue(0); } //static -- cgit v1.2.3 From a2e22732f195dc075a733c79f15156752f522a43 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 30 Jul 2013 19:13:45 -0700 Subject: Summer cleaning - removed a lot of llcommon dependencies to speed up build times consolidated most indra-specific constants in llcommon under indra_constants.h fixed issues with operations on mixed unit types (implicit and explicit) made LL_INFOS() style macros variadic in order to subsume other logging methods such as ll_infos added optional tag output to error recorders --- indra/llrender/llpostprocess.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index c0045c8044..e4279ea1e0 100755 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -58,7 +58,7 @@ LLPostProcess::LLPostProcess(void) : /* Do nothing. Needs to be updated to use our current shader system, and to work with the move into llrender. std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); - LL_DEBUGS2("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; + LL_DEBUGS("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; llifstream effectsXML(pathName); -- cgit v1.2.3 From e340009fc59d59e59b2e8d903a884acb76b178eb Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 9 Aug 2013 17:11:19 -0700 Subject: second phase summer cleaning replace llinfos, lldebugs, etc with new LL_INFOS(), LL_DEBUGS(), etc. --- indra/llrender/llcubemap.cpp | 2 +- indra/llrender/llfontfreetype.cpp | 10 ++-- indra/llrender/llfontgl.cpp | 8 +-- indra/llrender/llfontregistry.cpp | 30 +++++------ indra/llrender/llgl.cpp | 48 ++++++++--------- indra/llrender/llgldbg.cpp | 82 ++++++++++++++--------------- indra/llrender/llglslshader.cpp | 32 ++++++------ indra/llrender/llgltexture.h | 2 +- indra/llrender/llimagegl.cpp | 86 +++++++++++++++---------------- indra/llrender/llimagegl.h | 2 +- indra/llrender/llpostprocess.cpp | 2 +- indra/llrender/llrender.cpp | 78 ++++++++++++++-------------- indra/llrender/llrender2dutils.cpp | 10 ++-- indra/llrender/llrendertarget.cpp | 24 ++++----- indra/llrender/llshadermgr.cpp | 12 ++--- indra/llrender/llvertexbuffer.cpp | 102 ++++++++++++++++++------------------- indra/llrender/llvertexbuffer.h | 2 +- 17 files changed, 266 insertions(+), 266 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index 362452d837..77b4019b7c 100755 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -100,7 +100,7 @@ void LLCubeMap::initGL() } else { - llwarns << "Using cube map without extension!" << llendl; + LL_WARNS() << "Using cube map without extension!" << LL_ENDL; } } diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 058bef43a5..4cc5b78b63 100755 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -75,7 +75,7 @@ LLFontManager::LLFontManager() if (error) { // Clean up freetype libs. - llerrs << "Freetype initialization failure!" << llendl; + LL_ERRS() << "Freetype initialization failure!" << LL_ENDL; FT_Done_FreeType(gFTLibrary); } } @@ -189,7 +189,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v if (!mFTFace->charmap) { - //llinfos << " no unicode encoding, set whatever encoding there is..." << llendl; + //LL_INFOS() << " no unicode encoding, set whatever encoding there is..." << LL_ENDL; FT_Set_Charmap(mFTFace, mFTFace->charmaps[0]); } @@ -321,7 +321,7 @@ LLFontGlyphInfo* LLFontFreetype::addGlyph(llwchar wch) const return FALSE; llassert(!mIsFallback); - //lldebugs << "Adding new glyph for " << wch << " to font" << llendl; + //LL_DEBUGS() << "Adding new glyph for " << wch << " to font" << LL_ENDL; FT_UInt glyph_index; @@ -329,7 +329,7 @@ LLFontGlyphInfo* LLFontFreetype::addGlyph(llwchar wch) const glyph_index = FT_Get_Char_Index(mFTFace, wch); if (glyph_index == 0) { - //llinfos << "Trying to add glyph from fallback font!" << llendl; + //LL_INFOS() << "Trying to add glyph from fallback font!" << LL_ENDL; font_vector_t::const_iterator iter; for(iter = mFallbackFonts.begin(); iter != mFallbackFonts.end(); iter++) { @@ -501,7 +501,7 @@ void LLFontFreetype::reset(F32 vert_dpi, F32 horz_dpi) // This is the head of the list - need to rebuild ourself and all fallbacks. if (mFallbackFonts.empty()) { - llwarns << "LLFontGL::reset(), no fallback fonts present" << llendl; + LL_WARNS() << "LLFontGL::reset(), no fallback fonts present" << LL_ENDL; } else { diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index a646a0d35a..ce5757a6ae 100755 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -276,7 +276,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons } if (!fgi) { - llerrs << "Missing Glyph Info" << llendl; + LL_ERRS() << "Missing Glyph Info" << LL_ENDL; break; } // Per-glyph bitmap texture. @@ -1070,7 +1070,7 @@ std::string LLFontGL::getFontPathSystem() system_root = getenv("SystemRoot"); /* Flawfinder: ignore */ if (!system_root) { - llwarns << "SystemRoot not found, attempting to load fonts from default path." << llendl; + LL_WARNS() << "SystemRoot not found, attempting to load fonts from default path." << LL_ENDL; } #endif @@ -1115,12 +1115,12 @@ std::string LLFontGL::getFontPathLocal() LLFontGL::LLFontGL(const LLFontGL &source) { - llerrs << "Not implemented!" << llendl; + LL_ERRS() << "Not implemented!" << LL_ENDL; } LLFontGL &LLFontGL::operator=(const LLFontGL &source) { - llerrs << "Not implemented" << llendl; + LL_ERRS() << "Not implemented" << LL_ENDL; return *this; } diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index 77aa3fcd2c..d003687415 100755 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -200,7 +200,7 @@ bool LLFontRegistry::parseFontInfo(const std::string& xml_filename) if ( root.isNull() || ! root->hasName( "fonts" ) ) { - llwarns << "Bad font info file: " << *path_it << llendl; + LL_WARNS() << "Bad font info file: " << *path_it << LL_ENDL; continue; } @@ -353,10 +353,10 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) bool found_size = nameToSize(norm_desc.getSize(),point_size); if (!found_size) { - llwarns << "createFont unrecognized size " << norm_desc.getSize() << llendl; + LL_WARNS() << "createFont unrecognized size " << norm_desc.getSize() << LL_ENDL; return NULL; } - llinfos << "createFont " << norm_desc.getName() << " size " << norm_desc.getSize() << " style " << ((S32) norm_desc.getStyle()) << llendl; + LL_INFOS() << "createFont " << norm_desc.getName() << " size " << norm_desc.getSize() << " style " << ((S32) norm_desc.getStyle()) << LL_ENDL; F32 fallback_scale = 1.0; // Find corresponding font template (based on same descriptor with no size specified) @@ -365,8 +365,8 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) const LLFontDescriptor *match_desc = getClosestFontTemplate(template_desc); if (!match_desc) { - llwarns << "createFont failed, no template found for " - << norm_desc.getName() << " style [" << ((S32)norm_desc.getStyle()) << "]" << llendl; + LL_WARNS() << "createFont failed, no template found for " + << norm_desc.getName() << " style [" << ((S32)norm_desc.getStyle()) << "]" << LL_ENDL; return NULL; } @@ -379,7 +379,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) // This may not be the best solution, but it at least prevents a crash. if (it != mFontMap.end() && it->second != NULL) { - llinfos << "-- matching font exists: " << nearest_exact_desc.getName() << " size " << nearest_exact_desc.getSize() << " style " << ((S32) nearest_exact_desc.getStyle()) << llendl; + LL_INFOS() << "-- matching font exists: " << nearest_exact_desc.getName() << " size " << nearest_exact_desc.getSize() << " style " << ((S32) nearest_exact_desc.getStyle()) << LL_ENDL; // copying underlying Freetype font, and storing in LLFontGL with requested font descriptor LLFontGL *font = new LLFontGL; @@ -412,7 +412,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) // Load fonts based on names. if (file_names.empty()) { - llwarns << "createFont failed, no file names specified" << llendl; + LL_WARNS() << "createFont failed, no file names specified" << LL_ENDL; return NULL; } @@ -480,7 +480,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) } else { - llwarns << "createFont failed in some way" << llendl; + LL_WARNS() << "createFont failed in some way" << LL_ENDL; } mFontMap[desc] = result; @@ -533,9 +533,9 @@ LLFontGL *LLFontRegistry::getFont(const LLFontDescriptor& desc) LLFontGL *fontp = createFont(desc); if (!fontp) { - llwarns << "getFont failed, name " << desc.getName() + LL_WARNS() << "getFont failed, name " << desc.getName() <<" style=[" << ((S32) desc.getStyle()) << "]" - << " size=[" << desc.getSize() << "]" << llendl; + << " size=[" << desc.getSize() << "]" << LL_ENDL; } return fontp; } @@ -638,28 +638,28 @@ const LLFontDescriptor *LLFontRegistry::getClosestFontTemplate(const LLFontDescr void LLFontRegistry::dump() { - llinfos << "LLFontRegistry dump: " << llendl; + LL_INFOS() << "LLFontRegistry dump: " << LL_ENDL; for (font_size_map_t::iterator size_it = mFontSizes.begin(); size_it != mFontSizes.end(); ++size_it) { - llinfos << "Size: " << size_it->first << " => " << size_it->second << llendl; + LL_INFOS() << "Size: " << size_it->first << " => " << size_it->second << LL_ENDL; } for (font_reg_map_t::iterator font_it = mFontMap.begin(); font_it != mFontMap.end(); ++font_it) { const LLFontDescriptor& desc = font_it->first; - llinfos << "Font: name=" << desc.getName() + LL_INFOS() << "Font: name=" << desc.getName() << " style=[" << ((S32)desc.getStyle()) << "]" << " size=[" << desc.getSize() << "]" << " fileNames=" - << llendl; + << LL_ENDL; for (string_vec_t::const_iterator file_it=desc.getFileNames().begin(); file_it != desc.getFileNames().end(); ++file_it) { - llinfos << " file: " << *file_it <dumpStats(); } - llinfos << "-----------------------------------" << llendl; - llinfos << "Total rendering time: " << llformat("%.4f ms", sTotalTimeElapsed/1000000.f) << llendl; - llinfos << "Total samples drawn: " << llformat("%.4f million", sTotalSamplesDrawn/1000000.f) << llendl; - llinfos << "Total triangles drawn: " << llformat("%.3f million", sTotalTrianglesDrawn/1000000.f) << llendl; + LL_INFOS() << "-----------------------------------" << LL_ENDL; + LL_INFOS() << "Total rendering time: " << llformat("%.4f ms", sTotalTimeElapsed/1000000.f) << LL_ENDL; + LL_INFOS() << "Total samples drawn: " << llformat("%.4f million", sTotalSamplesDrawn/1000000.f) << LL_ENDL; + LL_INFOS() << "Total triangles drawn: " << llformat("%.3f million", sTotalTrianglesDrawn/1000000.f) << LL_ENDL; } void LLGLSLShader::clearStats() @@ -158,11 +158,11 @@ void LLGLSLShader::dumpStats() { if (mDrawCalls > 0) { - llinfos << "=============================================" << llendl; - llinfos << mName << llendl; + LL_INFOS() << "=============================================" << LL_ENDL; + LL_INFOS() << mName << LL_ENDL; for (U32 i = 0; i < mShaderFiles.size(); ++i) { - llinfos << mShaderFiles[i].first << llendl; + LL_INFOS() << mShaderFiles[i].first << LL_ENDL; } for (U32 i = 0; i < mTexture.size(); ++i) { @@ -171,10 +171,10 @@ void LLGLSLShader::dumpStats() if (idx >= 0) { GLint uniform_idx = getUniformLocation(i); - llinfos << mUniformNameMap[uniform_idx] << " - " << std::hex << mTextureMagFilter[i] << "/" << mTextureMinFilter[i] << std::dec << llendl; + LL_INFOS() << mUniformNameMap[uniform_idx] << " - " << std::hex << mTextureMagFilter[i] << "/" << mTextureMinFilter[i] << std::dec << LL_ENDL; } } - llinfos << "=============================================" << llendl; + LL_INFOS() << "=============================================" << LL_ENDL; F32 ms = mTimeElapsed/1000000.f; F32 seconds = ms/1000.f; @@ -190,10 +190,10 @@ void LLGLSLShader::dumpStats() F32 pct_calls = (F32) mDrawCalls/(F32)sTotalDrawCalls*100.f; U32 avg_batch = mTrianglesDrawn/mDrawCalls; - llinfos << "Triangles Drawn: " << mTrianglesDrawn << " " << llformat("(%.2f pct of total, %.3f million/sec)", pct_tris, tris_sec ) << llendl; - llinfos << "Draw Calls: " << mDrawCalls << " " << llformat("(%.2f pct of total, avg %d tris/call)", pct_calls, avg_batch) << llendl; - llinfos << "SamplesDrawn: " << mSamplesDrawn << " " << llformat("(%.2f pct of total, %.3f billion/sec)", pct_samples, samples_sec) << llendl; - llinfos << "Time Elapsed: " << mTimeElapsed << " " << llformat("(%.2f pct of total, %.5f ms)\n", (F32) ((F64)mTimeElapsed/(F64)sTotalTimeElapsed)*100.f, ms) << llendl; + LL_INFOS() << "Triangles Drawn: " << mTrianglesDrawn << " " << llformat("(%.2f pct of total, %.3f million/sec)", pct_tris, tris_sec ) << LL_ENDL; + LL_INFOS() << "Draw Calls: " << mDrawCalls << " " << llformat("(%.2f pct of total, avg %d tris/call)", pct_calls, avg_batch) << LL_ENDL; + LL_INFOS() << "SamplesDrawn: " << mSamplesDrawn << " " << llformat("(%.2f pct of total, %.3f billion/sec)", pct_samples, samples_sec) << LL_ENDL; + LL_INFOS() << "Time Elapsed: " << mTimeElapsed << " " << llformat("(%.2f pct of total, %.5f ms)\n", (F32) ((F64)mTimeElapsed/(F64)sTotalTimeElapsed)*100.f, ms) << LL_ENDL; } } @@ -703,7 +703,7 @@ BOOL LLGLSLShader::mapUniforms(const vector * uniforms) unbind(); - LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << llendl; + LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL; return res; } @@ -849,7 +849,7 @@ S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode) } else { - llerrs << "Texture channel " << index << " texture type corrupted." << llendl; + LL_ERRS() << "Texture channel " << index << " texture type corrupted." << LL_ENDL; } } gGL.getTexUnit(index)->disable(); @@ -1149,7 +1149,7 @@ GLint LLGLSLShader::getUniformLocation(const string& uniform) stop_glerror(); if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.c_str())) { - llerrs << "Uniform does not match." << llendl; + LL_ERRS() << "Uniform does not match." << LL_ENDL; } stop_glerror(); } diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index e69b322d60..6b85f81aee 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -101,7 +101,7 @@ public: LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps) ; LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) ; - virtual void dump(); // debug info to llinfos + virtual void dump(); // debug info to LL_INFOS() virtual const LLUUID& getID() const = 0; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 1d4be1f53c..1d1beafff8 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -117,7 +117,7 @@ void LLImageGL::checkTexSize(bool forced) const BOOL error = FALSE; if (texname != mTexName) { - llinfos << "Bound: " << texname << " Should bind: " << mTexName << " Default: " << LLImageGL::sDefaultGLTexture->getTexName() << llendl; + LL_INFOS() << "Bound: " << texname << " Should bind: " << mTexName << " Default: " << LLImageGL::sDefaultGLTexture->getTexName() << LL_ENDL; error = TRUE; if (gDebugSession) @@ -126,7 +126,7 @@ void LLImageGL::checkTexSize(bool forced) const } else { - llerrs << "Invalid texture bound!" << llendl; + LL_ERRS() << "Invalid texture bound!" << LL_ENDL; } } stop_glerror() ; @@ -150,8 +150,8 @@ void LLImageGL::checkTexSize(bool forced) const } else { - llerrs << "wrong texture size and discard level: width: " << - mWidth << " Height: " << mHeight << " Current Level: " << (S32)mCurrentDiscardLevel << llendl ; + LL_ERRS() << "wrong texture size and discard level: width: " << + mWidth << " Height: " << mHeight << " Current Level: " << (S32)mCurrentDiscardLevel << LL_ENDL ; } } @@ -200,7 +200,7 @@ S32 LLImageGL::dataFormatBits(S32 dataformat) case GL_RGBA: return 32; case GL_BGRA: return 32; // Used for QuickTime media textures on the Mac default: - llerrs << "LLImageGL::Unknown format: " << dataformat << llendl; + LL_ERRS() << "LLImageGL::Unknown format: " << dataformat << LL_ENDL; return 0; } } @@ -235,7 +235,7 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat) case GL_RGBA: return 4; case GL_BGRA: return 4; // Used for QuickTime media textures on the Mac default: - llerrs << "LLImageGL::Unknown format: " << dataformat << llendl; + LL_ERRS() << "LLImageGL::Unknown format: " << dataformat << LL_ENDL; return 0; } } @@ -301,7 +301,7 @@ void LLImageGL::restoreGL() LLImageGL* glimage = *iter; if(glimage->getTexName()) { - llerrs << "tex name is not 0." << llendl ; + LL_ERRS() << "tex name is not 0." << LL_ENDL ; } if (glimage->mSaveData.notNull()) { @@ -490,12 +490,12 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents, S32 discard_leve // Check if dimensions are a power of two! if (!checkSize(width,height)) { - llerrs << llformat("Texture has non power of two dimension: %dx%d",width,height) << llendl; + LL_ERRS() << llformat("Texture has non power of two dimension: %dx%d",width,height) << LL_ENDL; } if (mTexName) { -// llwarns << "Setting Size of LLImageGL with existing mTexName = " << mTexName << llendl; +// LL_WARNS() << "Setting Size of LLImageGL with existing mTexName = " << mTexName << LL_ENDL; destroyGLTexture(); } @@ -534,7 +534,7 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents, S32 discard_leve // virtual void LLImageGL::dump() { - llinfos << "mMaxDiscardLevel " << S32(mMaxDiscardLevel) + LL_INFOS() << "mMaxDiscardLevel " << S32(mMaxDiscardLevel) << " mLastBindTime " << mLastBindTime << " mTarget " << S32(mTarget) << " mBindTarget " << S32(mBindTarget) @@ -549,12 +549,12 @@ void LLImageGL::dump() #if DEBUG_MISS << " mMissed " << mMissed #endif - << llendl; + << LL_ENDL; - llinfos << " mTextureMemory " << mTextureMemory + LL_INFOS() << " mTextureMemory " << mTextureMemory << " mTexNames " << mTexName << " mIsResident " << S32(mIsResident) - << llendl; + << LL_ENDL; } //---------------------------------------------------------------------------- @@ -836,7 +836,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) } else { - llerrs << "Compressed Image has mipmaps but data does not (can not auto generate compressed mips)" << llendl; + LL_ERRS() << "Compressed Image has mipmaps but data does not (can not auto generate compressed mips)" << LL_ENDL; } } else @@ -885,7 +885,7 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) if (gGLManager.mIsDisabled) { - llwarns << "Trying to create a texture while GL is disabled!" << llendl; + LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; return FALSE; } llassert(gGLManager.mInited); @@ -931,7 +931,7 @@ BOOL LLImageGL::preAddToAtlas(S32 discard_level, const LLImageRaw* raw_image) mFormatType = GL_UNSIGNED_BYTE; break; default: - llerrs << "Bad number of components for texture: " << (U32)getComponents() << llendl; + LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL; } } @@ -975,13 +975,13 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 if (mTexName == 0) { // *TODO: Re-enable warning? Ran into thread locking issues? DK 2011-02-18 - //llwarns << "Setting subimage on image without GL texture" << llendl; + //LL_WARNS() << "Setting subimage on image without GL texture" << LL_ENDL; return FALSE; } if (datap == NULL) { // *TODO: Re-enable warning? Ran into thread locking issues? DK 2011-02-18 - //llwarns << "Setting subimage on image with NULL datap" << llendl; + //LL_WARNS() << "Setting subimage on image with NULL datap" << LL_ENDL; return FALSE; } @@ -995,7 +995,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 if (mUseMipMaps) { dump(); - llerrs << "setSubImage called with mipmapped image (not supported)" << llendl; + LL_ERRS() << "setSubImage called with mipmapped image (not supported)" << LL_ENDL; } llassert_always(mCurrentDiscardLevel == 0); llassert_always(x_pos >= 0 && y_pos >= 0); @@ -1004,28 +1004,28 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 (y_pos + height) > getHeight()) { dump(); - llerrs << "Subimage not wholly in target image!" + LL_ERRS() << "Subimage not wholly in target image!" << " x_pos " << x_pos << " y_pos " << y_pos << " width " << width << " height " << height << " getWidth() " << getWidth() << " getHeight() " << getHeight() - << llendl; + << LL_ENDL; } if ((x_pos + width) > data_width || (y_pos + height) > data_height) { dump(); - llerrs << "Subimage not wholly in source image!" + LL_ERRS() << "Subimage not wholly in source image!" << " x_pos " << x_pos << " y_pos " << y_pos << " width " << width << " height " << height << " source_width " << data_width << " source_height " << data_height - << llendl; + << LL_ENDL; } @@ -1041,7 +1041,7 @@ BOOL LLImageGL::setSubImage(const U8* datap, S32 data_width, S32 data_height, S3 datap += (y_pos * data_width + x_pos) * getComponents(); // Update the GL texture BOOL res = gGL.getTexUnit(0)->bindManual(mBindTarget, mTexName); - if (!res) llerrs << "LLImageGL::setSubImage(): bindTexture failed" << llendl; + if (!res) LL_ERRS() << "LLImageGL::setSubImage(): bindTexture failed" << LL_ENDL; stop_glerror(); glTexSubImage2D(mTarget, 0, x_pos, y_pos, @@ -1257,7 +1257,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt intformat = GL_COMPRESSED_ALPHA; break; default: - llwarns << "Could not compress format: " << std::hex << intformat << llendl; + LL_WARNS() << "Could not compress format: " << std::hex << intformat << LL_ENDL; break; } } @@ -1280,7 +1280,7 @@ BOOL LLImageGL::createGLTexture() LLFastTimer t(FTM_CREATE_GL_TEXTURE1); if (gGLManager.mIsDisabled) { - llwarns << "Trying to create a texture while GL is disabled!" << llendl; + LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; return FALSE; } @@ -1299,7 +1299,7 @@ BOOL LLImageGL::createGLTexture() stop_glerror(); if (!mTexName) { - llerrs << "LLImageGL::createGLTexture failed to make an empty texture" << llendl; + LL_ERRS() << "LLImageGL::createGLTexture failed to make an empty texture" << LL_ENDL; } return TRUE ; @@ -1311,7 +1311,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S LLFastTimer t(FTM_CREATE_GL_TEXTURE2); if (gGLManager.mIsDisabled) { - llwarns << "Trying to create a texture while GL is disabled!" << llendl; + LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; return FALSE; } @@ -1361,7 +1361,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S mFormatType = GL_UNSIGNED_BYTE; break; default: - llerrs << "Bad number of components for texture: " << (U32)getComponents() << llendl; + LL_ERRS() << "Bad number of components for texture: " << (U32)getComponents() << LL_ENDL; } calcAlphaChannelOffsetAndStride() ; @@ -1423,7 +1423,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ } if (!mTexName) { - llerrs << "LLImageGL::createGLTexture failed to make texture" << llendl; + LL_ERRS() << "LLImageGL::createGLTexture failed to make texture" << LL_ENDL; } if (mUseMipMaps) @@ -1472,7 +1472,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compressed_ok) const { llassert_always(sAllowReadBackRaw) ; - //llerrs << "should not call this function!" << llendl ; + //LL_ERRS() << "should not call this function!" << LL_ENDL ; if (discard_level < 0) { @@ -1510,15 +1510,15 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre } if(width < glwidth) { - llwarns << "texture size is smaller than it should be." << llendl ; - llwarns << "width: " << width << " glwidth: " << glwidth << " mWidth: " << mWidth << - " mCurrentDiscardLevel: " << (S32)mCurrentDiscardLevel << " discard_level: " << (S32)discard_level << llendl ; + LL_WARNS() << "texture size is smaller than it should be." << LL_ENDL ; + LL_WARNS() << "width: " << width << " glwidth: " << glwidth << " mWidth: " << mWidth << + " mCurrentDiscardLevel: " << (S32)mCurrentDiscardLevel << " discard_level: " << (S32)discard_level << LL_ENDL ; return FALSE ; } if (width <= 0 || width > 2048 || height <= 0 || height > 2048 || ncomponents < 1 || ncomponents > 4) { - llerrs << llformat("LLImageGL::readBackRaw: bogus params: %d x %d x %d",width,height,ncomponents) << llendl; + LL_ERRS() << llformat("LLImageGL::readBackRaw: bogus params: %d x %d x %d",width,height,ncomponents) << LL_ENDL; } LLGLint is_compressed = 0; @@ -1531,7 +1531,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre GLenum error ; while((error = glGetError()) != GL_NO_ERROR) { - llwarns << "GL Error happens before reading back texture. Error code: " << error << llendl ; + LL_WARNS() << "GL Error happens before reading back texture. Error code: " << error << LL_ENDL ; } //----------------------------------------------------------------------------------------------- @@ -1541,8 +1541,8 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre glGetTexLevelParameteriv(mTarget, gl_discard, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, (GLint*)&glbytes); if(!imageraw->allocateDataSize(width, height, ncomponents, glbytes)) { - llwarns << "Memory allocation failed for reading back texture. Size is: " << glbytes << llendl ; - llwarns << "width: " << width << "height: " << height << "components: " << ncomponents << llendl ; + LL_WARNS() << "Memory allocation failed for reading back texture. Size is: " << glbytes << LL_ENDL ; + LL_WARNS() << "width: " << width << "height: " << height << "components: " << ncomponents << LL_ENDL ; return FALSE ; } @@ -1553,8 +1553,8 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre { if(!imageraw->allocateDataSize(width, height, ncomponents)) { - llwarns << "Memory allocation failed for reading back texture." << llendl ; - llwarns << "width: " << width << "height: " << height << "components: " << ncomponents << llendl ; + LL_WARNS() << "Memory allocation failed for reading back texture." << LL_ENDL ; + LL_WARNS() << "width: " << width << "height: " << height << "components: " << ncomponents << LL_ENDL ; return FALSE ; } @@ -1565,12 +1565,12 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre //----------------------------------------------------------------------------------------------- if((error = glGetError()) != GL_NO_ERROR) { - llwarns << "GL Error happens after reading back texture. Error code: " << error << llendl ; + LL_WARNS() << "GL Error happens after reading back texture. Error code: " << error << LL_ENDL ; imageraw->deleteData() ; while((error = glGetError()) != GL_NO_ERROR) { - llwarns << "GL Error happens after reading back texture. Error code: " << error << llendl ; + LL_WARNS() << "GL Error happens after reading back texture. Error code: " << error << LL_ENDL ; } return FALSE ; @@ -1854,7 +1854,7 @@ void LLImageGL::calcAlphaChannelOffsetAndStride() mAlphaOffset < 0 || //unsupported type (mFormatPrimary == GL_BGRA_EXT && mFormatType != GL_UNSIGNED_BYTE)) //unknown situation { - llwarns << "Cannot analyze alpha for image with format type " << std::hex << mFormatType << std::dec << llendl; + LL_WARNS() << "Cannot analyze alpha for image with format type " << std::hex << mFormatType << std::dec << LL_ENDL; mNeedsAlphaAndPickMask = FALSE ; mIsMask = FALSE; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 227ccc90bd..c38b8d3cfa 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -99,7 +99,7 @@ protected: void calcAlphaChannelOffsetAndStride(); public: - virtual void dump(); // debugging info to llinfos + virtual void dump(); // debugging info to LL_INFOS() void setSize(S32 width, S32 height, S32 ncomponents, S32 discard_level = -1); void setComponents(S32 ncomponents) { mComponents = (S8)ncomponents ;} diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index e4279ea1e0..84caa045cc 100755 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -145,7 +145,7 @@ void LLPostProcess::saveEffect(std::string const & effectName) mAllEffects[effectName] = tweaks; std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); - //llinfos << "Saving PostProcess Effects settings to " << pathName << llendl; + //LL_INFOS() << "Saving PostProcess Effects settings to " << pathName << LL_ENDL; llofstream effectsXML(pathName); diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 918f5585a8..c104a93773 100755 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -232,7 +232,7 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) LLImageGL* gl_tex = NULL ; if (texture == NULL || !(gl_tex = texture->getGLTexture())) { - llwarns << "NULL LLTexUnit::bind texture" << llendl; + LL_WARNS() << "NULL LLTexUnit::bind texture" << LL_ENDL; return false; } @@ -280,7 +280,7 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) if(!texture) { - llwarns << "NULL LLTexUnit::bind texture" << llendl; + LL_WARNS() << "NULL LLTexUnit::bind texture" << LL_ENDL; return false; } @@ -330,7 +330,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) if (cubeMap == NULL) { - llwarns << "NULL LLTexUnit::bind cubemap" << llendl; + LL_WARNS() << "NULL LLTexUnit::bind cubemap" << LL_ENDL; return false; } @@ -354,7 +354,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) } else { - llwarns << "Using cube map without extension!" << llendl; + LL_WARNS() << "Using cube map without extension!" << LL_ENDL; return false; } } @@ -372,7 +372,7 @@ bool LLTexUnit::bind(LLRenderTarget* renderTarget, bool bindDepth) { if (renderTarget->hasStencil()) { - llerrs << "Cannot bind a render buffer for sampling. Allocate render target without a stencil buffer if sampling of depth buffer is required." << llendl; + LL_ERRS() << "Cannot bind a render buffer for sampling. Allocate render target without a stencil buffer if sampling of depth buffer is required." << LL_ENDL; } bindManual(renderTarget->getUsage(), renderTarget->getDepth()); @@ -498,7 +498,7 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio { glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gGL.mMaxAnisotropy); - llinfos << "gGL.mMaxAnisotropy: " << gGL.mMaxAnisotropy << llendl ; + LL_INFOS() << "gGL.mMaxAnisotropy: " << gGL.mMaxAnisotropy << LL_ENDL ; gGL.mMaxAnisotropy = llmax(1.f, gGL.mMaxAnisotropy) ; } glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, gGL.mMaxAnisotropy); @@ -552,7 +552,7 @@ void LLTexUnit::setTextureBlendType(eTextureBlendType type) glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB); break; default: - llerrs << "Unknown Texture Blend Type: " << type << llendl; + LL_ERRS() << "Unknown Texture Blend Type: " << type << LL_ENDL; break; } setColorScale(scale_amount); @@ -592,7 +592,7 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src) return GL_CONSTANT_ARB; default: - llwarns << "Unknown eTextureBlendSrc: " << src << ". Using Vertex Color instead." << llendl; + LL_WARNS() << "Unknown eTextureBlendSrc: " << src << ". Using Vertex Color instead." << LL_ENDL; return GL_PRIMARY_COLOR_ARB; } } @@ -630,7 +630,7 @@ GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha) return GL_ONE_MINUS_SRC_ALPHA; default: - llwarns << "Unknown eTextureBlendSrc: " << src << ". Using Source Color or Alpha instead." << llendl; + LL_WARNS() << "Unknown eTextureBlendSrc: " << src << ". Using Source Color or Alpha instead." << LL_ENDL; return (isAlpha) ? GL_SRC_ALPHA: GL_SRC_COLOR; } } @@ -771,7 +771,7 @@ void LLTexUnit::setTextureCombiner(eTextureBlendOp op, eTextureBlendSrc src1, eT break; default: - llwarns << "Unknown eTextureBlendOp: " << op << ". Setting op to replace." << llendl; + LL_WARNS() << "Unknown eTextureBlendOp: " << op << ". Setting op to replace." << LL_ENDL; // Slightly special syntax (no second sources), just set all and return. glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_REPLACE); glTexEnvi(GL_TEXTURE_ENV, src0_enum, source1); @@ -819,7 +819,7 @@ void LLTexUnit::debugTextureUnit(void) if ((GL_TEXTURE0_ARB + mIndex) != activeTexture) { U32 set_unit = (activeTexture - GL_TEXTURE0_ARB); - llwarns << "Incorrect Texture Unit! Expected: " << set_unit << " Actual: " << mIndex << llendl; + LL_WARNS() << "Incorrect Texture Unit! Expected: " << set_unit << " Actual: " << mIndex << LL_ENDL; } } @@ -1388,7 +1388,7 @@ void LLRender::pushMatrix() } else { - llwarns << "Matrix stack overflow." << llendl; + LL_WARNS() << "Matrix stack overflow." << LL_ENDL; } } } @@ -1404,7 +1404,7 @@ void LLRender::popMatrix() } else { - llwarns << "Matrix stack underflow." << llendl; + LL_WARNS() << "Matrix stack underflow." << LL_ENDL; } } } @@ -1477,7 +1477,7 @@ void LLRender::translateUI(F32 x, F32 y, F32 z) { if (mUIOffset.empty()) { - llerrs << "Need to push a UI translation frame before offsetting" << llendl; + LL_ERRS() << "Need to push a UI translation frame before offsetting" << LL_ENDL; } mUIOffset.back().mV[0] += x; @@ -1489,7 +1489,7 @@ void LLRender::scaleUI(F32 x, F32 y, F32 z) { if (mUIScale.empty()) { - llerrs << "Need to push a UI transformation frame before scaling." << llendl; + LL_ERRS() << "Need to push a UI transformation frame before scaling." << LL_ENDL; } mUIScale.back().scaleVec(LLVector3(x,y,z)); @@ -1520,7 +1520,7 @@ void LLRender::popUIMatrix() { if (mUIOffset.empty()) { - llerrs << "UI offset stack blown." << llendl; + LL_ERRS() << "UI offset stack blown." << LL_ENDL; } mUIOffset.pop_back(); mUIScale.pop_back(); @@ -1549,7 +1549,7 @@ void LLRender::loadUIIdentity() { if (mUIOffset.empty()) { - llerrs << "Need to push UI translation frame before clearing offset." << llendl; + LL_ERRS() << "Need to push UI translation frame before clearing offset." << LL_ENDL; } mUIOffset.back().setVec(0,0,0); mUIScale.back().setVec(1,1,1); @@ -1607,7 +1607,7 @@ void LLRender::setSceneBlendType(eBlendType type) blendFunc(BF_ONE, BF_ZERO); break; default: - llerrs << "Unknown Scene Blend Type: " << type << llendl; + LL_ERRS() << "Unknown Scene Blend Type: " << type << LL_ENDL; break; } } @@ -1648,7 +1648,7 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value) if (cur_func != sGLCompareFunc[func]) { - llerrs << "Alpha test function corrupted!" << llendl; + LL_ERRS() << "Alpha test function corrupted!" << LL_ENDL; } F32 ref = 0.f; @@ -1656,7 +1656,7 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value) if (ref != value) { - llerrs << "Alpha test value corrupted!" << llendl; + LL_ERRS() << "Alpha test value corrupted!" << LL_ENDL; } } } @@ -1686,7 +1686,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor, llassert(alpha_dfactor < BF_UNDEF); if (!gGLManager.mHasBlendFuncSeparate) { - LL_WARNS_ONCE("render") << "no glBlendFuncSeparateEXT(), using color-only blend func" << llendl; + LL_WARNS_ONCE("render") << "no glBlendFuncSeparateEXT(), using color-only blend func" << LL_ENDL; blendFunc(color_sfactor, color_dfactor); return; } @@ -1711,7 +1711,7 @@ LLTexUnit* LLRender::getTexUnit(U32 index) } else { - lldebugs << "Non-existing texture unit layer requested: " << index << llendl; + LL_DEBUGS() << "Non-existing texture unit layer requested: " << index << LL_ENDL; return mDummyTexUnit; } } @@ -1747,7 +1747,7 @@ bool LLRender::verifyTexUnitActive(U32 unitToVerify) } else { - llwarns << "TexUnit currently active: " << mCurrTextureUnitIndex << " (expecting " << unitToVerify << ")" << llendl; + LL_WARNS() << "TexUnit currently active: " << mCurrTextureUnitIndex << " (expecting " << unitToVerify << ")" << LL_ENDL; return false; } } @@ -1778,7 +1778,7 @@ void LLRender::begin(const GLuint& mode) } else if (mCount != 0) { - llerrs << "gGL.begin() called redundantly." << llendl; + LL_ERRS() << "gGL.begin() called redundantly." << LL_ENDL; } mMode = mode; @@ -1790,7 +1790,7 @@ void LLRender::end() if (mCount == 0) { return; - //IMM_ERRS << "GL begin and end called with no vertices specified." << llendl; + //IMM_ERRS << "GL begin and end called with no vertices specified." << LL_ENDL; } if ((mMode != LLRender::QUADS && @@ -1809,22 +1809,22 @@ void LLRender::flush() #if 0 if (!glIsEnabled(GL_VERTEX_ARRAY)) { - llerrs << "foo 1" << llendl; + LL_ERRS() << "foo 1" << LL_ENDL; } if (!glIsEnabled(GL_COLOR_ARRAY)) { - llerrs << "foo 2" << llendl; + LL_ERRS() << "foo 2" << LL_ENDL; } if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY)) { - llerrs << "foo 3" << llendl; + LL_ERRS() << "foo 3" << LL_ENDL; } if (glIsEnabled(GL_NORMAL_ARRAY)) { - llerrs << "foo 7" << llendl; + LL_ERRS() << "foo 7" << LL_ENDL; } GLvoid* pointer; @@ -1832,19 +1832,19 @@ void LLRender::flush() glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].v)) { - llerrs << "foo 4" << llendl; + LL_ERRS() << "foo 4" << LL_ENDL; } glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].c)) { - llerrs << "foo 5" << llendl; + LL_ERRS() << "foo 5" << LL_ENDL; } glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].uv)) { - llerrs << "foo 6" << llendl; + LL_ERRS() << "foo 6" << LL_ENDL; } #endif @@ -1860,7 +1860,7 @@ void LLRender::flush() { if (mCount%4 != 0) { - llerrs << "Incomplete quad rendered." << llendl; + LL_ERRS() << "Incomplete quad rendered." << LL_ENDL; } } @@ -1868,7 +1868,7 @@ void LLRender::flush() { if (mCount%3 != 0) { - llerrs << "Incomplete triangle rendered." << llendl; + LL_ERRS() << "Incomplete triangle rendered." << LL_ENDL; } } @@ -1876,7 +1876,7 @@ void LLRender::flush() { if (mCount%2 != 0) { - llerrs << "Incomplete line rendered." << llendl; + LL_ERRS() << "Incomplete line rendered." << LL_ENDL; } } } @@ -1929,7 +1929,7 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) if (mCount > 4094) { - // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + // LL_WARNS() << "GL immediate mode overflow. Some geometry not drawn." << LL_ENDL; return; } @@ -1972,7 +1972,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count) { if (mCount + vert_count > 4094) { - // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + // LL_WARNS() << "GL immediate mode overflow. Some geometry not drawn." << LL_ENDL; return; } @@ -2029,7 +2029,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 v { if (mCount + vert_count > 4094) { - // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + // LL_WARNS() << "GL immediate mode overflow. Some geometry not drawn." << LL_ENDL; return; } @@ -2087,7 +2087,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLCol { if (mCount + vert_count > 4094) { - // llwarns << "GL immediate mode overflow. Some geometry not drawn." << llendl; + // LL_WARNS() << "GL immediate mode overflow. Some geometry not drawn." << LL_ENDL; return; } diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index fe34c218a8..3ac2d0b809 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -348,7 +348,7 @@ void gl_draw_image( S32 x, S32 y, LLTexture* image, const LLColor4& color, const { if (NULL == image) { - llwarns << "image == NULL; aborting function" << llendl; + LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; return; } gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), 0.f, image, color, uv_rect ); @@ -363,7 +363,7 @@ void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, { if (NULL == image) { - llwarns << "image == NULL; aborting function" << llendl; + LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; return; } gl_draw_scaled_rotated_image( x, y, width, height, 0.f, image, color, uv_rect ); @@ -373,7 +373,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border { if (NULL == image) { - llwarns << "image == NULL; aborting function" << llendl; + LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; return; } @@ -391,7 +391,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex if (NULL == image) { - llwarns << "image == NULL; aborting function" << llendl; + LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; return; } @@ -649,7 +649,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre { if (!image && !target) { - llwarns << "image == NULL; aborting function" << llendl; + LL_WARNS() << "image == NULL; aborting function" << LL_ENDL; return; } diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 6e22712b94..a4d77b00d6 100755 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -43,7 +43,7 @@ void check_framebuffer_status() case GL_FRAMEBUFFER_COMPLETE: break; default: - llwarns << "check_framebuffer_status failed -- " << std::hex << status << llendl; + LL_WARNS() << "check_framebuffer_status failed -- " << std::hex << status << LL_ENDL; ll_fail("check_framebuffer_status failed"); break; } @@ -137,7 +137,7 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo { if (!allocateDepth()) { - llwarns << "Failed to allocate depth buffer for render target." << llendl; + LL_WARNS() << "Failed to allocate depth buffer for render target." << LL_ENDL; return false; } } @@ -179,13 +179,13 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) if( offset >= 4 ) { - llwarns << "Too many color attachments" << llendl; + LL_WARNS() << "Too many color attachments" << LL_ENDL; llassert( offset < 4 ); return false; } if( offset > 0 && (mFBO == 0 || !gGLManager.mHasDrawBuffers) ) { - llwarns << "FBO not used or no drawbuffers available; mFBO=" << (U32)mFBO << " gGLManager.mHasDrawBuffers=" << (U32)gGLManager.mHasDrawBuffers << llendl; + LL_WARNS() << "FBO not used or no drawbuffers available; mFBO=" << (U32)mFBO << " gGLManager.mHasDrawBuffers=" << (U32)gGLManager.mHasDrawBuffers << LL_ENDL; llassert( mFBO != 0 ); llassert( gGLManager.mHasDrawBuffers ); return false; @@ -203,7 +203,7 @@ bool LLRenderTarget::addColorAttachment(U32 color_fmt) LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false); if (glGetError() != GL_NO_ERROR) { - llwarns << "Could not allocate color buffer for render target." << llendl; + LL_WARNS() << "Could not allocate color buffer for render target." << LL_ENDL; return false; } } @@ -289,7 +289,7 @@ bool LLRenderTarget::allocateDepth() if (glGetError() != GL_NO_ERROR) { - llwarns << "Unable to allocate depth buffer for render target." << llendl; + LL_WARNS() << "Unable to allocate depth buffer for render target." << LL_ENDL; return false; } @@ -300,17 +300,17 @@ void LLRenderTarget::shareDepthBuffer(LLRenderTarget& target) { if (!mFBO || !target.mFBO) { - llerrs << "Cannot share depth buffer between non FBO render targets." << llendl; + LL_ERRS() << "Cannot share depth buffer between non FBO render targets." << LL_ENDL; } if (target.mDepth) { - llerrs << "Attempting to override existing depth buffer. Detach existing buffer first." << llendl; + LL_ERRS() << "Attempting to override existing depth buffer. Detach existing buffer first." << LL_ENDL; } if (target.mUseDepth) { - llerrs << "Attempting to override existing shared depth buffer. Detach existing buffer first." << llendl; + LL_ERRS() << "Attempting to override existing shared depth buffer. Detach existing buffer first." << LL_ENDL; } if (mDepth) @@ -461,7 +461,7 @@ U32 LLRenderTarget::getTexture(U32 attachment) const { if (attachment > mTex.size()-1) { - llerrs << "Invalid attachment index." << llendl; + LL_ERRS() << "Invalid attachment index." << LL_ENDL; } if (mTex.empty()) { @@ -529,7 +529,7 @@ void LLRenderTarget::copyContents(LLRenderTarget& source, S32 srcX0, S32 srcY0, gGL.flush(); if (!source.mFBO || !mFBO) { - llwarns << "Cannot copy framebuffer contents for non FBO render targets." << llendl; + LL_WARNS() << "Cannot copy framebuffer contents for non FBO render targets." << LL_ENDL; return; } @@ -572,7 +572,7 @@ void LLRenderTarget::copyContentsToFramebuffer(LLRenderTarget& source, S32 srcX0 { if (!source.mFBO) { - llerrs << "Cannot copy framebuffer contents for non FBO render targets." << llendl; + LL_ERRS() << "Cannot copy framebuffer contents for non FBO render targets." << LL_ENDL; } { GLboolean write_depth = mask & GL_DEPTH_BUFFER_BIT ? TRUE : FALSE; diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index fea4ee2819..e7e5327e16 100755 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -584,7 +584,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade { //should NEVER get here -- if major version is 1 and minor version is less than 10, // viewer should never attempt to use shaders, continuing will result in undefined behavior - llerrs << "Unsupported GLSL Version." << llendl; + LL_ERRS() << "Unsupported GLSL Version." << LL_ENDL; } if (minor_version <= 19) @@ -751,7 +751,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade else { //should never get here. Indexed texture rendering requires GLSL 1.30 or later // (for passing integers between vertex and fragment shaders) - llerrs << "Indexed texture rendering requires GLSL 1.30 or later." << llendl; + LL_ERRS() << "Indexed texture rendering requires GLSL 1.30 or later." << LL_ENDL; } } else @@ -824,13 +824,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (i % 128 == 0) { //dump every 128 lines - LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl; + LL_WARNS("ShaderLoading") << "\n" << ostr.str() << LL_ENDL; ostr = std::stringstream(); } } - LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl; + LL_WARNS("ShaderLoading") << "\n" << ostr.str() << LL_ENDL; #else std::string str; @@ -839,7 +839,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (i % 128 == 0) { - LL_WARNS("ShaderLoading") << str << llendl; + LL_WARNS("ShaderLoading") << str << LL_ENDL; str = ""; } } @@ -1150,7 +1150,7 @@ void LLShaderMgr::initAttribsAndUniforms() { if (dupe_check.find(mReservedUniforms[i]) != dupe_check.end()) { - llerrs << "Duplicate reserved uniform name found: " << mReservedUniforms[i] << llendl; + LL_ERRS() << "Duplicate reserved uniform name found: " << mReservedUniforms[i] << LL_ENDL; } dupe_check.insert(mReservedUniforms[i]); } diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 22ea96ee19..ed2ed081e9 100755 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -491,7 +491,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) } else { - llerrs << "Bad client state! " << array[i] << " disabled." << llendl; + LL_ERRS() << "Bad client state! " << array[i] << " disabled." << LL_ENDL; } } } @@ -510,7 +510,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) } else { - llerrs << "Bad client state! " << array[i] << " enabled." << llendl; + LL_ERRS() << "Bad client state! " << array[i] << " enabled." << LL_ENDL; } } } @@ -578,13 +578,13 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos, con if( count == 0 ) { - llwarns << "Called drawArrays with 0 vertices" << llendl; + LL_WARNS() << "Called drawArrays with 0 vertices" << LL_ENDL; return; } if( norm.size() < pos.size() ) { - llwarns << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << llendl; + LL_WARNS() << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << LL_ENDL; return; } @@ -661,7 +661,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of if (start >= (U32) mNumVerts || end >= (U32) mNumVerts) { - llerrs << "Bad vertex buffer draw range: [" << start << ", " << end << "] vs " << mNumVerts << llendl; + LL_ERRS() << "Bad vertex buffer draw range: [" << start << ", " << end << "] vs " << mNumVerts << LL_ENDL; } llassert(mNumIndices >= 0); @@ -669,7 +669,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of if (indices_offset >= (U32) mNumIndices || indices_offset + count > (U32) mNumIndices) { - llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl; + LL_ERRS() << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << LL_ENDL; } if (gDebugGL && !useVBOs()) @@ -679,7 +679,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of { if (idx[i] < start || idx[i] > end) { - llerrs << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << llendl; + LL_ERRS() << "Index out of range: " << idx[i] << " not in [" << start << ", " << end << "]" << LL_ENDL; } } @@ -697,7 +697,7 @@ void LLVertexBuffer::validateRange(U32 start, U32 end, U32 count, U32 indices_of S32 idx = (S32) (v[i][3]+0.25f); if (idx < 0 || idx >= shader->mFeatures.mIndexedTextureChannels) { - llerrs << "Bad texture index found in vertex data stream." << llendl; + LL_ERRS() << "Bad texture index found in vertex data stream." << LL_ENDL; } } } @@ -717,19 +717,19 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi { if (mGLArray != sGLRenderArray) { - llerrs << "Wrong vertex array bound." << llendl; + LL_ERRS() << "Wrong vertex array bound." << LL_ENDL; } } else { if (mGLIndices != sGLRenderIndices) { - llerrs << "Wrong index buffer bound." << llendl; + LL_ERRS() << "Wrong index buffer bound." << LL_ENDL; } if (mGLBuffer != sGLRenderBuffer) { - llerrs << "Wrong vertex buffer bound." << llendl; + LL_ERRS() << "Wrong vertex buffer bound." << LL_ENDL; } } @@ -740,13 +740,13 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi if (elem != mGLIndices) { - llerrs << "Wrong index buffer bound!" << llendl; + LL_ERRS() << "Wrong index buffer bound!" << LL_ENDL; } } if (mode >= LLRender::NUM_MODES) { - llerrs << "Invalid draw mode: " << mode << llendl; + LL_ERRS() << "Invalid draw mode: " << mode << LL_ENDL; return; } @@ -774,32 +774,32 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const if (indices_offset >= (U32) mNumIndices || indices_offset + count > (U32) mNumIndices) { - llerrs << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << llendl; + LL_ERRS() << "Bad index buffer draw range: [" << indices_offset << ", " << indices_offset+count << "]" << LL_ENDL; } if (mGLArray) { if (mGLArray != sGLRenderArray) { - llerrs << "Wrong vertex array bound." << llendl; + LL_ERRS() << "Wrong vertex array bound." << LL_ENDL; } } else { if (mGLIndices != sGLRenderIndices) { - llerrs << "Wrong index buffer bound." << llendl; + LL_ERRS() << "Wrong index buffer bound." << LL_ENDL; } if (mGLBuffer != sGLRenderBuffer) { - llerrs << "Wrong vertex buffer bound." << llendl; + LL_ERRS() << "Wrong vertex buffer bound." << LL_ENDL; } } if (mode >= LLRender::NUM_MODES) { - llerrs << "Invalid draw mode: " << mode << llendl; + LL_ERRS() << "Invalid draw mode: " << mode << LL_ENDL; return; } @@ -823,27 +823,27 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const if (first >= (U32) mNumVerts || first + count > (U32) mNumVerts) { - llerrs << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << llendl; + LL_ERRS() << "Bad vertex buffer draw range: [" << first << ", " << first+count << "]" << LL_ENDL; } if (mGLArray) { if (mGLArray != sGLRenderArray) { - llerrs << "Wrong vertex array bound." << llendl; + LL_ERRS() << "Wrong vertex array bound." << LL_ENDL; } } else { if (mGLBuffer != sGLRenderBuffer || useVBOs() != sVBOActive) { - llerrs << "Wrong vertex buffer bound." << llendl; + LL_ERRS() << "Wrong vertex buffer bound." << LL_ENDL; } } if (mode >= LLRender::NUM_MODES) { - llerrs << "Invalid draw mode: " << mode << llendl; + LL_ERRS() << "Invalid draw mode: " << mode << LL_ENDL; return; } @@ -1269,7 +1269,7 @@ void LLVertexBuffer::updateNumVerts(S32 nverts) if (nverts > 65536) { - llwarns << "Vertex buffer overflow!" << llendl; + LL_WARNS() << "Vertex buffer overflow!" << LL_ENDL; nverts = 65536; } @@ -1308,7 +1308,7 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create) if (nverts < 0 || nindices < 0 || nverts > 65536) { - llerrs << "Bad vertex buffer allocation: " << nverts << " : " << nindices << llendl; + LL_ERRS() << "Bad vertex buffer allocation: " << nverts << " : " << nindices << LL_ENDL; } updateNumVerts(nverts); @@ -1502,11 +1502,11 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo bindGLBuffer(true); if (mFinal) { - llerrs << "LLVertexBuffer::mapVeretxBuffer() called on a finalized buffer." << llendl; + LL_ERRS() << "LLVertexBuffer::mapVeretxBuffer() called on a finalized buffer." << LL_ENDL; } if (!useVBOs() && !mMappedData && !mMappedIndexData) { - llerrs << "LLVertexBuffer::mapVertexBuffer() called on unallocated buffer." << llendl; + LL_ERRS() << "LLVertexBuffer::mapVertexBuffer() called on unallocated buffer." << LL_ENDL; } if (useVBOs()) @@ -1543,7 +1543,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo if (mVertexLocked && map_range) { - llerrs << "Attempted to map a specific range of a buffer that was already mapped." << llendl; + LL_ERRS() << "Attempted to map a specific range of a buffer that was already mapped." << LL_ENDL; } if (!mVertexLocked) @@ -1585,7 +1585,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo if (size < mSize) { - llerrs << "Invalid buffer size." << llendl; + LL_ERRS() << "Invalid buffer size." << LL_ENDL; } } @@ -1636,25 +1636,25 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo { //-------------------- //print out more debug info before crash - llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl; + LL_INFOS() << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << LL_ENDL; GLint size; glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); - llinfos << "GL_ARRAY_BUFFER_ARB size is " << size << llendl; + LL_INFOS() << "GL_ARRAY_BUFFER_ARB size is " << size << LL_ENDL; //-------------------- GLint buff; glGetIntegerv(GL_ARRAY_BUFFER_BINDING_ARB, &buff); if ((GLuint)buff != mGLBuffer) { - llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; + LL_ERRS() << "Invalid GL vertex buffer bound: " << buff << LL_ENDL; } - llerrs << "glMapBuffer returned NULL (no vertex data)" << llendl; + LL_ERRS() << "glMapBuffer returned NULL (no vertex data)" << LL_ENDL; } else { - llerrs << "memory allocation for vertex data failed." << llendl; + LL_ERRS() << "memory allocation for vertex data failed." << LL_ENDL; } } } @@ -1683,11 +1683,11 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range bindGLIndices(true); if (mFinal) { - llerrs << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << llendl; + LL_ERRS() << "LLVertexBuffer::mapIndexBuffer() called on a finalized buffer." << LL_ENDL; } if (!useVBOs() && !mMappedData && !mMappedIndexData) { - llerrs << "LLVertexBuffer::mapIndexBuffer() called on unallocated buffer." << llendl; + LL_ERRS() << "LLVertexBuffer::mapIndexBuffer() called on unallocated buffer." << LL_ENDL; } if (useVBOs()) @@ -1721,7 +1721,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range if (mIndexLocked && map_range) { - llerrs << "Attempted to map a specific range of a buffer that was already mapped." << llendl; + LL_ERRS() << "Attempted to map a specific range of a buffer that was already mapped." << LL_ENDL; } if (!mIndexLocked) @@ -1737,7 +1737,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range if (elem != mGLIndices) { - llerrs << "Wrong index buffer bound!" << llendl; + LL_ERRS() << "Wrong index buffer bound!" << LL_ENDL; } } @@ -1815,14 +1815,14 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff); if ((GLuint)buff != mGLIndices) { - llerrs << "Invalid GL index buffer bound: " << buff << llendl; + LL_ERRS() << "Invalid GL index buffer bound: " << buff << LL_ENDL; } - llerrs << "glMapBuffer returned NULL (no index data)" << llendl; + LL_ERRS() << "glMapBuffer returned NULL (no index data)" << LL_ENDL; } else { - llerrs << "memory allocation for Index data failed. " << llendl; + LL_ERRS() << "memory allocation for Index data failed. " << LL_ENDL; } } } @@ -2018,7 +2018,7 @@ template struct VertexBufferStrider if (ptr == NULL) { - llwarns << "mapIndexBuffer failed!" << llendl; + LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL; return false; } @@ -2034,7 +2034,7 @@ template struct VertexBufferStrider if (ptr == NULL) { - llwarns << "mapVertexBuffer failed!" << llendl; + LL_WARNS() << "mapVertexBuffer failed!" << LL_ENDL; return false; } @@ -2044,7 +2044,7 @@ template struct VertexBufferStrider } else { - llerrs << "VertexBufferStrider could not find valid vertex data." << llendl; + LL_ERRS() << "VertexBufferStrider could not find valid vertex data." << LL_ENDL; } return false; } @@ -2147,7 +2147,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind) LLFastTimer t(FTM_BIND_GL_BUFFER); /*if (sMapped) { - llerrs << "VBO bound while another VBO mapped!" << llendl; + LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL; }*/ glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer); sGLRenderBuffer = mGLBuffer; @@ -2178,7 +2178,7 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind) LLFastTimer t(FTM_BIND_GL_INDICES); /*if (sMapped) { - llerrs << "VBO bound while another VBO mapped!" << llendl; + LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL; }*/ glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices); sGLRenderIndices = mGLIndices; @@ -2230,7 +2230,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) U32 required = 1 << i; if ((data_mask & required) == 0) { - llwarns << "Missing attribute: " << LLShaderMgr::instance()->mReservedAttribs[i] << llendl; + LL_WARNS() << "Missing attribute: " << LLShaderMgr::instance()->mReservedAttribs[i] << LL_ENDL; } required_mask |= required; @@ -2239,7 +2239,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) if ((data_mask & required_mask) != required_mask) { - llwarns << "Shader consumption mismatches data provision." << llendl; + LL_WARNS() << "Shader consumption mismatches data provision." << LL_ENDL; } } } @@ -2271,7 +2271,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) } else { - llerrs << "Invalid GL vertex buffer bound: " << buff << llendl; + LL_ERRS() << "Invalid GL vertex buffer bound: " << buff << LL_ENDL; } } @@ -2286,7 +2286,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) } else { - llerrs << "Invalid GL index buffer bound: " << buff << llendl; + LL_ERRS() << "Invalid GL index buffer bound: " << buff << LL_ENDL; } } } @@ -2362,10 +2362,10 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) U32 mask = 1 << i; if (mask & data_mask && !(mask & mTypeMask)) { //bit set in data_mask, but not set in mTypeMask - llwarns << "Missing required component " << vb_type_name[i] << llendl; + LL_WARNS() << "Missing required component " << vb_type_name[i] << LL_ENDL; } } - llerrs << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << llendl; + LL_ERRS() << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << LL_ENDL; } if (LLGLSLShader::sNoFixedFunction) diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 04806c1d8c..0b4b87f338 100755 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -119,7 +119,7 @@ public: const LLVertexBuffer& operator=(const LLVertexBuffer& rhs) { - llerrs << "Illegal operation!" << llendl; + LL_ERRS() << "Illegal operation!" << LL_ENDL; return *this; } -- cgit v1.2.3 From 26581404e426b00cd0a07c38b5cb858d5d5faa28 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 14 Aug 2013 11:51:49 -0700 Subject: BUILDFIX: added header for numeric_limits support on gcc added convenience types for units F32Seconds, etc. --- indra/llrender/llimagegl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 1d1beafff8..6a45ebc598 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -249,7 +249,7 @@ void LLImageGL::updateStats(F32 current_time) LLFastTimer t(FTM_IMAGE_UPDATE_STATS); sLastFrameTime = current_time; sBoundTextureMemory = sCurBoundTextureMemory; - sCurBoundTextureMemory = LLUnits::Bytes::fromValue(0); + sCurBoundTextureMemory = LLUnits::S32Bytes(0); } //static -- cgit v1.2.3 From 9f7bfa1c3710856cd2b0a0a8a429d6c45b0fcd09 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 15 Aug 2013 00:02:23 -0700 Subject: moved unit types out of LLUnits namespace, since they are prefixed --- indra/llrender/llimagegl.cpp | 8 ++++---- indra/llrender/llimagegl.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 6a45ebc598..b63ee7f9f9 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -51,9 +51,9 @@ U32 wpo2(U32 i); U32 LLImageGL::sUniqueCount = 0; U32 LLImageGL::sBindCount = 0; -LLUnit LLImageGL::sGlobalTextureMemory(0); -LLUnit LLImageGL::sBoundTextureMemory(0); -LLUnit LLImageGL::sCurBoundTextureMemory(0); +S32Bytes LLImageGL::sGlobalTextureMemory(0); +S32Bytes LLImageGL::sBoundTextureMemory(0); +S32Bytes LLImageGL::sCurBoundTextureMemory(0); S32 LLImageGL::sCount = 0; LLImageGL::dead_texturelist_t LLImageGL::sDeadTextureList[LLTexUnit::TT_NONE]; U32 LLImageGL::sCurTexName = 1; @@ -249,7 +249,7 @@ void LLImageGL::updateStats(F32 current_time) LLFastTimer t(FTM_IMAGE_UPDATE_STATS); sLastFrameTime = current_time; sBoundTextureMemory = sCurBoundTextureMemory; - sCurBoundTextureMemory = LLUnits::S32Bytes(0); + sCurBoundTextureMemory = S32Bytes(0); } //static diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index c38b8d3cfa..035d42c3ad 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -246,9 +246,9 @@ public: static F32 sLastFrameTime; // Global memory statistics - static LLUnit sGlobalTextureMemory; // Tracks main memory texmem - static LLUnit sBoundTextureMemory; // Tracks bound texmem for last completed frame - static LLUnit sCurBoundTextureMemory; // Tracks bound texmem for current frame + static S32Bytes sGlobalTextureMemory; // Tracks main memory texmem + static S32Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame + static S32Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame static U32 sBindCount; // Tracks number of texture binds for current frame static U32 sUniqueCount; // Tracks number of unique texture binds for current frame static BOOL sGlobalUseAnisotropic; -- cgit v1.2.3 From 612892b45a3413b16e40c49d3bfde77a4ca927fd Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 18 Aug 2013 22:30:27 -0700 Subject: SH-4433 WIP: Interesting: Statistics > Ping Sim is always 0 ms continued conversion to units system made units perform type promotion correctly and preserve type in arithmetic e.g. can now do LLVector3 in units added typedefs for remaining common unit types, including implicits --- indra/llrender/llgltexture.cpp | 2 +- indra/llrender/llgltexture.h | 2 +- indra/llrender/llimagegl.cpp | 12 ++++++------ indra/llrender/llimagegl.h | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llgltexture.cpp b/indra/llrender/llgltexture.cpp index d06ed5e57b..56e263c5f1 100644 --- a/indra/llrender/llgltexture.cpp +++ b/indra/llrender/llgltexture.cpp @@ -294,7 +294,7 @@ LLTexUnit::eTextureAddressMode LLGLTexture::getAddressMode(void) const return mGLTexturep->getAddressMode() ; } -S32 LLGLTexture::getTextureMemory() const +S32Bytes LLGLTexture::getTextureMemory() const { llassert(mGLTexturep.notNull()) ; diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index 6b85f81aee..45592ee077 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -138,7 +138,7 @@ public: S32 getDiscardLevel() const; S8 getComponents() const; BOOL getBoundRecently() const; - S32 getTextureMemory() const ; + S32Bytes getTextureMemory() const ; LLGLenum getPrimaryFormat() const; BOOL getIsAlphaMask() const ; LLTexUnit::eTextureType getTarget(void) const ; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index b63ee7f9f9..5d46fb290c 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -253,7 +253,7 @@ void LLImageGL::updateStats(F32 current_time) } //static -S32 LLImageGL::updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category) +S32 LLImageGL::updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) { LLImageGL::sCurBoundTextureMemory += mem ; return LLImageGL::sCurBoundTextureMemory.value(); @@ -398,7 +398,7 @@ void LLImageGL::init(BOOL usemipmaps) // so that it is obvious by visual inspection if we forgot to // init a field. - mTextureMemory = 0; + mTextureMemory = (S32Bytes)0; mLastBindTime = 0.f; mPickMask = NULL; @@ -563,7 +563,7 @@ void LLImageGL::forceUpdateBindStats(void) const mLastBindTime = sLastFrameTime; } -BOOL LLImageGL::updateBindStats(S32 tex_mem) const +BOOL LLImageGL::updateBindStats(S32Bytes tex_mem) const { if (mTexName != 0) { @@ -1460,7 +1460,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ stop_glerror(); } - mTextureMemory = getMipBytes(discard_level); + mTextureMemory = (S32Bytes)getMipBytes(discard_level); sGlobalTextureMemory += mTextureMemory; mTexelsInGLTexture = getWidth() * getHeight() ; @@ -1618,10 +1618,10 @@ void LLImageGL::destroyGLTexture() { if (mTexName != 0) { - if(mTextureMemory) + if(mTextureMemory != S32Bytes(0)) { sGlobalTextureMemory -= mTextureMemory; - mTextureMemory = 0; + mTextureMemory = (S32Bytes)0; } LLImageGL::deleteTextures(mBindTarget, mFormatInternal, mMipLevels, 1, &mTexName); diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 035d42c3ad..5e027851f3 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -63,7 +63,7 @@ public: static S32 dataFormatBytes(S32 dataformat, S32 width, S32 height); static S32 dataFormatComponents(S32 dataformat); - BOOL updateBindStats(S32 tex_mem) const ; + BOOL updateBindStats(S32Bytes tex_mem) const ; F32 getTimePassedSinceLastBound(); void forceUpdateBindStats(void) const; @@ -76,7 +76,7 @@ public: static void dirtyTexOptions(); // Sometimes called externally for textures not using LLImageGL (should go away...) - static S32 updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 category) ; + static S32 updateBoundTexMem(const S32Bytes mem, const S32 ncomponents, S32 category) ; static bool checkSize(S32 width, S32 height); @@ -189,7 +189,7 @@ public: public: // Various GL/Rendering options - S32 mTextureMemory; + S32Bytes mTextureMemory; mutable F32 mLastBindTime; // last time this was bound, by discard level private: -- cgit v1.2.3 From a7aed07a5b620977fb74e4070e432eef01d11d3c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 27 Aug 2013 13:41:19 -0700 Subject: broke out llunit.h into llunittype.h and llunits.h for unit declarations changed unit declarations macros to make a lot more sense --- indra/llrender/llimagegl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 5e027851f3..09ea8a1124 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -34,7 +34,7 @@ #include "llpointer.h" #include "llrefcount.h" #include "v2math.h" -#include "llunit.h" +#include "llunits.h" #include "llrender.h" class LLTextureAtlas ; -- cgit v1.2.3 From cbe397ad13665c7bc993e10d8fe1e4a876253378 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 5 Sep 2013 14:04:13 -0700 Subject: changed fast timer over to using macro another attempt to move mem stat into base class --- indra/llrender/llfontgl.cpp | 4 +-- indra/llrender/llimagegl.cpp | 34 +++++++++++----------- indra/llrender/llrender2dutils.cpp | 8 +++--- indra/llrender/llvertexbuffer.cpp | 58 +++++++++++++++++++------------------- 4 files changed, 52 insertions(+), 52 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index ce5757a6ae..b1ff2f7e07 100755 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -98,7 +98,7 @@ BOOL LLFontGL::loadFace(const std::string& filename, F32 point_size, F32 vert_dp return mFontFreetype->loadFace(filename, point_size, vert_dpi, horz_dpi, components, is_fallback); } -static LLFastTimer::DeclareTimer FTM_RENDER_FONTS("Fonts"); +static LLTrace::TimeBlock FTM_RENDER_FONTS("Fonts"); S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const @@ -129,7 +129,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_ellipses) const { - LLFastTimer _(FTM_RENDER_FONTS); + LL_RECORD_BLOCK_TIME(FTM_RENDER_FONTS); if(!sDisplayFont) //do not display texts { diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 5d46fb290c..d66b6d8432 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -242,11 +242,11 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat) //---------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_STATS("Image Stats"); +static LLTrace::TimeBlock FTM_IMAGE_UPDATE_STATS("Image Stats"); // static void LLImageGL::updateStats(F32 current_time) { - LLFastTimer t(FTM_IMAGE_UPDATE_STATS); + LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_STATS); sLastFrameTime = current_time; sBoundTextureMemory = sCurBoundTextureMemory; sCurBoundTextureMemory = S32Bytes(0); @@ -616,10 +616,10 @@ void LLImageGL::setImage(const LLImageRaw* imageraw) setImage(rawdata, FALSE); } -static LLFastTimer::DeclareTimer FTM_SET_IMAGE("setImage"); +static LLTrace::TimeBlock FTM_SET_IMAGE("setImage"); void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) { - LLFastTimer t(FTM_SET_IMAGE); + LL_RECORD_BLOCK_TIME(FTM_SET_IMAGE); bool is_compressed = false; if (mFormatPrimary >= GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && mFormatPrimary <= GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) { @@ -671,7 +671,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) } else { -// LLFastTimer t2(FTM_TEMP4); +// LL_RECORD_BLOCK_TIME(FTM_TEMP4); if(mFormatSwapBytes) { @@ -703,7 +703,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) { stop_glerror(); { -// LLFastTimer t2(FTM_TEMP4); +// LL_RECORD_BLOCK_TIME(FTM_TEMP4); if(mFormatSwapBytes) { @@ -795,7 +795,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) llassert(w > 0 && h > 0 && cur_mip_data); (void)cur_mip_data; { -// LLFastTimer t1(FTM_TEMP4); +// LL_RECORD_BLOCK_TIME(FTM_TEMP4); if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); @@ -1084,10 +1084,10 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_ } // static -static LLFastTimer::DeclareTimer FTM_GENERATE_TEXTURES("generate textures"); +static LLTrace::TimeBlock FTM_GENERATE_TEXTURES("generate textures"); void LLImageGL::generateTextures(LLTexUnit::eTextureType type, U32 format, S32 numTextures, U32 *textures) { - LLFastTimer t(FTM_GENERATE_TEXTURES); + LL_RECORD_BLOCK_TIME(FTM_GENERATE_TEXTURES); bool empty = true; dead_texturelist_t::iterator iter = sDeadTextureList[type].find(format); @@ -1167,10 +1167,10 @@ void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip } // static -static LLFastTimer::DeclareTimer FTM_SET_MANUAL_IMAGE("setManualImage"); +static LLTrace::TimeBlock FTM_SET_MANUAL_IMAGE("setManualImage"); void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels, bool allow_compression) { - LLFastTimer t(FTM_SET_MANUAL_IMAGE); + LL_RECORD_BLOCK_TIME(FTM_SET_MANUAL_IMAGE); bool use_scratch = false; U32* scratch = NULL; if (LLRender::sGLCoreProfile) @@ -1274,10 +1274,10 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt //create an empty GL texture: just create a texture name //the texture is assiciate with some image by calling glTexImage outside LLImageGL -static LLFastTimer::DeclareTimer FTM_CREATE_GL_TEXTURE1("createGLTexture()"); +static LLTrace::TimeBlock FTM_CREATE_GL_TEXTURE1("createGLTexture()"); BOOL LLImageGL::createGLTexture() { - LLFastTimer t(FTM_CREATE_GL_TEXTURE1); + LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE1); if (gGLManager.mIsDisabled) { LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; @@ -1305,10 +1305,10 @@ BOOL LLImageGL::createGLTexture() return TRUE ; } -static LLFastTimer::DeclareTimer FTM_CREATE_GL_TEXTURE2("createGLTexture(raw)"); +static LLTrace::TimeBlock FTM_CREATE_GL_TEXTURE2("createGLTexture(raw)"); BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/, BOOL to_create, S32 category) { - LLFastTimer t(FTM_CREATE_GL_TEXTURE2); + LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE2); if (gGLManager.mIsDisabled) { LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; @@ -1380,10 +1380,10 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S return createGLTexture(discard_level, rawdata, FALSE, usename); } -static LLFastTimer::DeclareTimer FTM_CREATE_GL_TEXTURE3("createGLTexture3(data)"); +static LLTrace::TimeBlock FTM_CREATE_GL_TEXTURE3("createGLTexture3(data)"); BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename) { - LLFastTimer t(FTM_CREATE_GL_TEXTURE3); + LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE3); llassert(data_in); stop_glerror(); diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 3ac2d0b809..14894c53b4 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -1062,7 +1062,7 @@ void gl_rect_2d_simple( S32 width, S32 height ) gGL.end(); } -static LLFastTimer::DeclareTimer FTM_RENDER_SEGMENTED_RECT ("Render segmented rectangle"); +static LLTrace::TimeBlock FTM_RENDER_SEGMENTED_RECT ("Render segmented rectangle"); void gl_segmented_rect_2d_tex(const S32 left, const S32 top, @@ -1073,7 +1073,7 @@ void gl_segmented_rect_2d_tex(const S32 left, const S32 border_size, const U32 edges) { - LLFastTimer _(FTM_RENDER_SEGMENTED_RECT); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT); S32 width = llabs(right - left); S32 height = llabs(top - bottom); @@ -1232,7 +1232,7 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect, const F32 end_fragment, const U32 edges) { - LLFastTimer _(FTM_RENDER_SEGMENTED_RECT); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT); const S32 left = rect.mLeft; const S32 right = rect.mRight; const S32 top = rect.mTop; @@ -1419,7 +1419,7 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect, void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, const LLVector3& width_vec, const LLVector3& height_vec) { - LLFastTimer _(FTM_RENDER_SEGMENTED_RECT); + LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT); gGL.begin(LLRender::QUADS); { diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index ed2ed081e9..b1a5a194be 100755 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -564,10 +564,10 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) } //static -static LLFastTimer::DeclareTimer FTM_VB_DRAW_ARRAYS("drawArrays"); +static LLTrace::TimeBlock FTM_VB_DRAW_ARRAYS("drawArrays"); void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos, const std::vector& norm) { - LLFastTimer t(FTM_VB_DRAW_ARRAYS); + LL_RECORD_BLOCK_TIME(FTM_VB_DRAW_ARRAYS); llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); gGL.syncMatrices(); @@ -812,7 +812,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const placeFence(); } -static LLFastTimer::DeclareTimer FTM_GL_DRAW_ARRAYS("GL draw arrays"); +static LLTrace::TimeBlock FTM_GL_DRAW_ARRAYS("GL draw arrays"); void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); @@ -848,7 +848,7 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const } { - LLFastTimer t2(FTM_GL_DRAW_ARRAYS); + LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS); stop_glerror(); LLGLSLShader::startProfile(); glDrawArrays(sGLMode[mode], first, count); @@ -1329,7 +1329,7 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create) } } -static LLFastTimer::DeclareTimer FTM_SETUP_VERTEX_ARRAY("Setup VAO"); +static LLTrace::TimeBlock FTM_SETUP_VERTEX_ARRAY("Setup VAO"); void LLVertexBuffer::setupVertexArray() { @@ -1338,7 +1338,7 @@ void LLVertexBuffer::setupVertexArray() return; } - LLFastTimer t(FTM_SETUP_VERTEX_ARRAY); + LL_RECORD_BLOCK_TIME(FTM_SETUP_VERTEX_ARRAY); #if GL_ARB_vertex_array_object glBindVertexArray(mGLArray); #endif @@ -1493,8 +1493,8 @@ bool expand_region(LLVertexBuffer::MappedRegion& region, S32 index, S32 count) return true; } -static LLFastTimer::DeclareTimer FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range"); -static LLFastTimer::DeclareTimer FTM_VBO_MAP_BUFFER("VBO Map"); +static LLTrace::TimeBlock FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range"); +static LLTrace::TimeBlock FTM_VBO_MAP_BUFFER("VBO Map"); // Map for data access volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range) @@ -1565,7 +1565,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo if (map_range) { #ifdef GL_ARB_map_buffer_range - LLFastTimer t(FTM_VBO_MAP_BUFFER_RANGE); + LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_BUFFER_RANGE); S32 offset = mOffsets[type] + sTypeSize[type]*index; S32 length = (sTypeSize[type]*count+0xF) & ~0xF; src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, offset, length, @@ -1589,7 +1589,7 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo } } - LLFastTimer t(FTM_VBO_MAP_BUFFER); + LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_BUFFER); src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, 0, mSize, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); @@ -1675,8 +1675,8 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo } -static LLFastTimer::DeclareTimer FTM_VBO_MAP_INDEX_RANGE("IBO Map Range"); -static LLFastTimer::DeclareTimer FTM_VBO_MAP_INDEX("IBO Map"); +static LLTrace::TimeBlock FTM_VBO_MAP_INDEX_RANGE("IBO Map Range"); +static LLTrace::TimeBlock FTM_VBO_MAP_INDEX("IBO Map"); volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { @@ -1754,7 +1754,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range if (map_range) { #ifdef GL_ARB_map_buffer_range - LLFastTimer t(FTM_VBO_MAP_INDEX_RANGE); + LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX_RANGE); S32 offset = sizeof(U16)*index; S32 length = sizeof(U16)*count; src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, @@ -1766,7 +1766,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range else { #ifdef GL_ARB_map_buffer_range - LLFastTimer t(FTM_VBO_MAP_INDEX); + LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX); src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(U16)*mNumIndices, GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); @@ -1790,7 +1790,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range } else { - LLFastTimer t(FTM_VBO_MAP_INDEX); + LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX); map_range = false; src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } @@ -1841,12 +1841,12 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range } } -static LLFastTimer::DeclareTimer FTM_VBO_UNMAP("VBO Unmap"); -static LLFastTimer::DeclareTimer FTM_VBO_FLUSH_RANGE("Flush VBO Range"); +static LLTrace::TimeBlock FTM_VBO_UNMAP("VBO Unmap"); +static LLTrace::TimeBlock FTM_VBO_FLUSH_RANGE("Flush VBO Range"); -static LLFastTimer::DeclareTimer FTM_IBO_UNMAP("IBO Unmap"); -static LLFastTimer::DeclareTimer FTM_IBO_FLUSH_RANGE("Flush IBO Range"); +static LLTrace::TimeBlock FTM_IBO_UNMAP("IBO Unmap"); +static LLTrace::TimeBlock FTM_IBO_FLUSH_RANGE("Flush IBO Range"); void LLVertexBuffer::unmapBuffer() { @@ -1859,7 +1859,7 @@ void LLVertexBuffer::unmapBuffer() if (mMappedData && mVertexLocked) { - LLFastTimer t(FTM_VBO_UNMAP); + LL_RECORD_BLOCK_TIME(FTM_VBO_UNMAP); bindGLBuffer(true); updated_all = mIndexLocked; //both vertex and index buffers done updating @@ -1900,7 +1900,7 @@ void LLVertexBuffer::unmapBuffer() S32 length = sTypeSize[region.mType]*region.mCount; if (gGLManager.mHasMapBufferRange) { - LLFastTimer t(FTM_VBO_FLUSH_RANGE); + LL_RECORD_BLOCK_TIME(FTM_VBO_FLUSH_RANGE); #ifdef GL_ARB_map_buffer_range glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length); #endif @@ -1930,7 +1930,7 @@ void LLVertexBuffer::unmapBuffer() if (mMappedIndexData && mIndexLocked) { - LLFastTimer t(FTM_IBO_UNMAP); + LL_RECORD_BLOCK_TIME(FTM_IBO_UNMAP); bindGLIndices(); if(!mMappable) { @@ -1967,7 +1967,7 @@ void LLVertexBuffer::unmapBuffer() S32 length = sizeof(U16)*region.mCount; if (gGLManager.mHasMapBufferRange) { - LLFastTimer t(FTM_IBO_FLUSH_RANGE); + LL_RECORD_BLOCK_TIME(FTM_IBO_FLUSH_RANGE); #ifdef GL_ARB_map_buffer_range glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length); #endif @@ -2111,13 +2111,13 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 in //---------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_BIND_GL_ARRAY("Bind Array"); +static LLTrace::TimeBlock FTM_BIND_GL_ARRAY("Bind Array"); bool LLVertexBuffer::bindGLArray() { if (mGLArray && sGLRenderArray != mGLArray) { { - LLFastTimer t(FTM_BIND_GL_ARRAY); + LL_RECORD_BLOCK_TIME(FTM_BIND_GL_ARRAY); #if GL_ARB_vertex_array_object glBindVertexArray(mGLArray); #endif @@ -2134,7 +2134,7 @@ bool LLVertexBuffer::bindGLArray() return false; } -static LLFastTimer::DeclareTimer FTM_BIND_GL_BUFFER("Bind Buffer"); +static LLTrace::TimeBlock FTM_BIND_GL_BUFFER("Bind Buffer"); bool LLVertexBuffer::bindGLBuffer(bool force_bind) { @@ -2144,7 +2144,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind) if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive)))) { - LLFastTimer t(FTM_BIND_GL_BUFFER); + LL_RECORD_BLOCK_TIME(FTM_BIND_GL_BUFFER); /*if (sMapped) { LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL; @@ -2166,7 +2166,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind) return ret; } -static LLFastTimer::DeclareTimer FTM_BIND_GL_INDICES("Bind Indices"); +static LLTrace::TimeBlock FTM_BIND_GL_INDICES("Bind Indices"); bool LLVertexBuffer::bindGLIndices(bool force_bind) { @@ -2175,7 +2175,7 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind) bool ret = false; if (useVBOs() && (force_bind || (mGLIndices && (mGLIndices != sGLRenderIndices || !sIBOActive)))) { - LLFastTimer t(FTM_BIND_GL_INDICES); + LL_RECORD_BLOCK_TIME(FTM_BIND_GL_INDICES); /*if (sMapped) { LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL; -- cgit v1.2.3 From 12f0f8cb72f789e21b01b45063dcc5f1f5292087 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 1 Oct 2013 13:46:43 -0700 Subject: changed over to manual naming of MemTrackable stats changed claimMem and disclaimMem behavior to not pass through argument added more mem tracking stats to floater_stats --- indra/llrender/llfontbitmapcache.cpp | 20 +++++++++++++++++++- indra/llrender/llfontbitmapcache.h | 3 ++- indra/llrender/llfontfreetype.cpp | 20 ++++++++++++++++---- indra/llrender/llfontfreetype.h | 6 +++--- indra/llrender/llimagegl.cpp | 18 +++++++++++++++--- indra/llrender/llimagegl.h | 2 +- indra/llrender/llvertexbuffer.cpp | 7 ++++++- indra/llrender/llvertexbuffer.h | 6 ++++-- 8 files changed, 66 insertions(+), 16 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp index c985f6b959..f128636ab2 100755 --- a/indra/llrender/llfontbitmapcache.cpp +++ b/indra/llrender/llfontbitmapcache.cpp @@ -29,7 +29,8 @@ #include "llgl.h" #include "llfontbitmapcache.h" -LLFontBitmapCache::LLFontBitmapCache(): +LLFontBitmapCache::LLFontBitmapCache() +: LLTrace::MemTrackable("LLFontBitmapCache"), mNumComponents(0), mBitmapWidth(0), mBitmapHeight(0), @@ -81,6 +82,7 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32 &pos_x, S32 &pos_y, S32& bitm { // We're out of space in the current image, or no image // has been allocated yet. Make a new one. + mImageRawVec.push_back(new LLImageRaw); mBitmapNum = mImageRawVec.size()-1; LLImageRaw *image_raw = getImageRaw(mBitmapNum); @@ -122,6 +124,9 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32 &pos_x, S32 &pos_y, S32& bitm image_gl->createGLTexture(0, image_raw); gGL.getTexUnit(0)->bind(image_gl); image_gl->setFilteringOption(LLTexUnit::TFO_POINT); // was setMipFilterNearest(TRUE, TRUE); + + claimMem(image_raw); + claimMem(image_gl); } else { @@ -151,7 +156,20 @@ void LLFontBitmapCache::destroyGL() void LLFontBitmapCache::reset() { + for (std::vector >::iterator it = mImageRawVec.begin(), end_it = mImageRawVec.end(); + it != end_it; + ++it) + { + disclaimMem(**it); + } mImageRawVec.clear(); + + for (std::vector >::iterator it = mImageGLVec.begin(), end_it = mImageGLVec.end(); + it != end_it; + ++it) + { + disclaimMem(**it); + } mImageGLVec.clear(); mBitmapWidth = 0; diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index c93b0c7320..75df3a94a7 100755 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -28,10 +28,11 @@ #define LL_LLFONTBITMAPCACHE_H #include +#include "lltrace.h" // Maintain a collection of bitmaps containing rendered glyphs. // Generalizes the single-bitmap logic from LLFontFreetype and LLFontGL. -class LLFontBitmapCache: public LLRefCount +class LLFontBitmapCache : public LLTrace::MemTrackable { public: LLFontBitmapCache(); diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 4cc5b78b63..bde62f89b3 100755 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -101,7 +101,8 @@ LLFontGlyphInfo::LLFontGlyphInfo(U32 index) } LLFontFreetype::LLFontFreetype() -: mFontBitmapCachep(new LLFontBitmapCache), +: LLTrace::MemTrackable("LLFontFreetype"), + mFontBitmapCachep(new LLFontBitmapCache), mValid(FALSE), mAscender(0.f), mDescender(0.f), @@ -126,7 +127,7 @@ LLFontFreetype::~LLFontFreetype() // Delete glyph info std::for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer()); - // mFontBitmapCachep will be cleaned up by LLPointer destructor. + delete mFontBitmapCachep; // mFallbackFonts cleaned up by LLPointer destructor } @@ -186,6 +187,8 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v S32 max_char_height = llround(0.5f + (y_max - y_min)); mFontBitmapCachep->init(components, max_char_width, max_char_height); + claimMem(mFontBitmapCachep); + if (!mFTFace->charmap) { @@ -200,6 +203,7 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v } mName = filename; + claimMem(mName); mPointSize = point_size; mStyle = LLFontGL::NORMAL; @@ -476,6 +480,7 @@ void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const } else { + claimMem(gi); mCharGlyphInfoMap[wch] = gi; } } @@ -517,8 +522,15 @@ void LLFontFreetype::reset(F32 vert_dpi, F32 horz_dpi) void LLFontFreetype::resetBitmapCache() { - for_each(mCharGlyphInfoMap.begin(), mCharGlyphInfoMap.end(), DeletePairedPointer()); + for (char_glyph_info_map_t::iterator it = mCharGlyphInfoMap.begin(), end_it = mCharGlyphInfoMap.end(); + it != end_it; + ++it) + { + disclaimMem(it->second); + delete it->second; + } mCharGlyphInfoMap.clear(); + disclaimMem(mFontBitmapCachep); mFontBitmapCachep->reset(); // Adding default glyph is skipped for fallback fonts here as well as in loadFace(). @@ -540,7 +552,7 @@ const std::string &LLFontFreetype::getName() const return mName; } -const LLPointer LLFontFreetype::getFontBitmapCache() const +const LLFontBitmapCache* LLFontFreetype::getFontBitmapCache() const { return mFontBitmapCachep; } diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h index f1b23f22d5..2963fbd43d 100755 --- a/indra/llrender/llfontfreetype.h +++ b/indra/llrender/llfontfreetype.h @@ -74,7 +74,7 @@ struct LLFontGlyphInfo extern LLFontManager *gFontManagerp; -class LLFontFreetype : public LLRefCount +class LLFontFreetype : public LLRefCount, public LLTrace::MemTrackable { public: LLFontFreetype(); @@ -134,7 +134,7 @@ public: const std::string& getName() const; - const LLPointer getFontBitmapCache() const; + const LLFontBitmapCache* getFontBitmapCache() const; void setStyle(U8 style); U8 getStyle() const; @@ -167,7 +167,7 @@ private: typedef boost::unordered_map char_glyph_info_map_t; mutable char_glyph_info_map_t mCharGlyphInfoMap; // Information about glyph location in bitmap - mutable LLPointer mFontBitmapCachep; + mutable LLFontBitmapCache* mFontBitmapCachep; mutable S32 mRenderGlyphCount; mutable S32 mAddGlyphCount; diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index d66b6d8432..4330a9891e 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -279,8 +279,10 @@ void LLImageGL::destroyGL(BOOL save_state) if (save_state && glimage->isGLTextureCreated() && glimage->mComponents) { glimage->mSaveData = new LLImageRaw; + glimage->claimMem(glimage->mSaveData); if(!glimage->readBackRaw(glimage->mCurrentDiscardLevel, glimage->mSaveData, false)) //necessary, keep it. { + glimage->disclaimMem(glimage->mSaveData); glimage->mSaveData = NULL ; } } @@ -354,7 +356,8 @@ BOOL LLImageGL::create(LLPointer& dest, const LLImageRaw* imageraw, B //---------------------------------------------------------------------------- LLImageGL::LLImageGL(BOOL usemipmaps) - : mSaveData(0) +: LLTrace::MemTrackable("LLImageGL"), + mSaveData(0) { init(usemipmaps); setSize(0, 0, 0); @@ -363,7 +366,8 @@ LLImageGL::LLImageGL(BOOL usemipmaps) } LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) - : mSaveData(0) +: LLTrace::MemTrackable("LLImageGL"), + mSaveData(0) { llassert( components <= 4 ); init(usemipmaps); @@ -373,7 +377,8 @@ LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) } LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps) - : mSaveData(0) +: LLTrace::MemTrackable("LLImageGL"), + mSaveData(0) { init(usemipmaps); setSize(0, 0, 0); @@ -387,6 +392,7 @@ LLImageGL::~LLImageGL() { LLImageGL::cleanup(); sImageList.erase(this); + disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8); delete [] mPickMask; mPickMask = NULL; sCount--; @@ -500,6 +506,7 @@ void LLImageGL::setSize(S32 width, S32 height, S32 ncomponents, S32 discard_leve } // pickmask validity depends on old image size, delete it + disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8); delete [] mPickMask; mPickMask = NULL; mPickMaskWidth = mPickMaskHeight = 0; @@ -1460,7 +1467,9 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ stop_glerror(); } + disclaimMem(mTextureMemory); mTextureMemory = (S32Bytes)getMipBytes(discard_level); + claimMem(mTextureMemory); sGlobalTextureMemory += mTextureMemory; mTexelsInGLTexture = getWidth() * getHeight() ; @@ -1621,6 +1630,7 @@ void LLImageGL::destroyGLTexture() if(mTextureMemory != S32Bytes(0)) { sGlobalTextureMemory -= mTextureMemory; + disclaimMem(mTextureMemory); mTextureMemory = (S32Bytes)0; } @@ -1970,6 +1980,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) return ; } + disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8); delete [] mPickMask; mPickMask = NULL; mPickMaskWidth = mPickMaskHeight = 0; @@ -1987,6 +1998,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) U32 size = pick_width * pick_height; size = (size + 7) / 8; // pixelcount-to-bits mPickMask = new U8[size]; + claimMem(size); mPickMaskWidth = pick_width - 1; mPickMaskHeight = pick_height - 1; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index 09ea8a1124..816169a30c 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -42,7 +42,7 @@ class LLTextureAtlas ; #define MEGA_BYTES_TO_BYTES(x) ((x) << 20) //============================================================================ -class LLImageGL : public LLRefCount +class LLImageGL : public LLRefCount, public LLTrace::MemTrackable { friend class LLTexUnit; public: diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index b1a5a194be..38351dd9ae 100755 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -959,7 +959,8 @@ S32 LLVertexBuffer::determineUsage(S32 usage) return ret_usage; } -LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) : +LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) +: LLTrace::MemTrackable("LLVertexBuffer"), LLRefCount(), mNumVerts(0), @@ -1096,7 +1097,9 @@ void LLVertexBuffer::waitFence() const void LLVertexBuffer::genBuffer(U32 size) { + disclaimMem(mSize); mSize = vbo_block_size(size); + claimMem(mSize); if (mUsage == GL_STREAM_DRAW_ARB) { @@ -1185,7 +1188,9 @@ void LLVertexBuffer::createGLBuffer(U32 size) static int gl_buffer_idx = 0; mGLBuffer = ++gl_buffer_idx; mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); + disclaimMem(mSize); mSize = size; + disclaimMem(mSize); } } diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index 0b4b87f338..92ea3bfc8e 100755 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -34,6 +34,7 @@ #include "v4coloru.h" #include "llstrider.h" #include "llrender.h" +#include "lltrace.h" #include #include #include @@ -98,7 +99,7 @@ public: //============================================================================ // base class class LLPrivateMemoryPool; -class LLVertexBuffer : public LLRefCount +class LLVertexBuffer : public LLRefCount, public LLTrace::MemTrackable { public: class MappedRegion @@ -112,7 +113,8 @@ public: }; LLVertexBuffer(const LLVertexBuffer& rhs) - : mUsage(rhs.mUsage) + : LLTrace::MemTrackable("LLVertexBuffer"), + mUsage(rhs.mUsage) { *this = rhs; } -- cgit v1.2.3 From 754e8752a9b9a2e75d425a10cb8a0a6f85ad4bf5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 3 Oct 2013 14:30:34 -0700 Subject: added initial memory usage tracking for lltrace --- indra/llrender/llvertexbuffer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 0cfc11ef19..968b796d6b 100755 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -1190,7 +1190,7 @@ void LLVertexBuffer::createGLBuffer(U32 size) mMappedData = (U8*)ALLOCATE_MEM(sPrivatePoolp, size); disclaimMem(mSize); mSize = size; - disclaimMem(mSize); + claimMem(mSize); } } @@ -2272,10 +2272,10 @@ void LLVertexBuffer::setBuffer(U32 data_mask) if (unsatisfied_mask & (1 << TYPE_INDEX)) { - llinfos << "Missing indices" << llendl; + LL_INFOS() << "Missing indices" << LL_ENDL; } - llerrs << "Shader consumption mismatches data provision." << llendl; + LL_ERRS() << "Shader consumption mismatches data provision." << LL_ENDL; } } } -- cgit v1.2.3 From 17df8988fec3f2ba991ca9e34ff8148253a2fc04 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 7 Oct 2013 13:38:03 -0700 Subject: renamed TraceType to StatType added more MemTrackable types optimized memory usage of LLTrace some more --- indra/llrender/lltexture.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/lltexture.h b/indra/llrender/lltexture.h index ff711b8004..9fca8b8cd3 100755 --- a/indra/llrender/lltexture.h +++ b/indra/llrender/lltexture.h @@ -33,6 +33,8 @@ #define LL_TEXTURE_H #include "llrefcount.h" +#include "lltrace.h" + class LLImageGL ; class LLTexUnit ; class LLFontGL ; @@ -40,7 +42,7 @@ class LLFontGL ; // //this is an abstract class as the parent for the class LLGLTexture // -class LLTexture : public virtual LLRefCount +class LLTexture : public virtual LLRefCount, public LLTrace::MemTrackable { friend class LLTexUnit ; friend class LLFontGL ; @@ -49,7 +51,9 @@ protected: virtual ~LLTexture(); public: - LLTexture(){} + LLTexture() + : LLTrace::MemTrackable("LLTexture") + {} // //interfaces to access LLGLTexture -- cgit v1.2.3 From 1acceb3633c0f0c4fdf29b17d77d67c8a9b71986 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 14 Oct 2013 10:18:41 -0700 Subject: changed ll_aligned_(malloc|free) to take alignment size as a template argument --- indra/llrender/llvertexbuffer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 2a36a3b96f..3bbbccbad1 100755 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -202,7 +202,7 @@ volatile U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) glBufferDataARB(mType, size, 0, mUsage); if (mUsage != GL_DYNAMIC_COPY_ARB) { //data will be provided by application - ret = (U8*) ll_aligned_malloc(64, size); + ret = (U8*) ll_aligned_malloc<64>(size); } } else @@ -310,7 +310,7 @@ void LLVBOPool::cleanup() if (r.mClientData) { - ll_aligned_free(64, (void*) r.mClientData); + ll_aligned_free<64>((void*) r.mClientData); } l.pop_front(); -- cgit v1.2.3 From 697d2e720ba75e142a4d56ae8794bab8d7698dad Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 15 Oct 2013 20:24:42 -0700 Subject: renamed TimeBlock to BlockTimerStatHandle --- indra/llrender/llfontgl.cpp | 2 +- indra/llrender/llimagegl.cpp | 14 +++++++------- indra/llrender/llrender2dutils.cpp | 2 +- indra/llrender/llvertexbuffer.cpp | 28 ++++++++++++++-------------- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index b1ff2f7e07..1d181b476a 100755 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -98,7 +98,7 @@ BOOL LLFontGL::loadFace(const std::string& filename, F32 point_size, F32 vert_dp return mFontFreetype->loadFace(filename, point_size, vert_dpi, horz_dpi, components, is_fallback); } -static LLTrace::TimeBlock FTM_RENDER_FONTS("Fonts"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_FONTS("Fonts"); S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index f2a660cda5..b2507af08b 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -242,7 +242,7 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat) //---------------------------------------------------------------------------- -static LLTrace::TimeBlock FTM_IMAGE_UPDATE_STATS("Image Stats"); +static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_STATS("Image Stats"); // static void LLImageGL::updateStats(F32 current_time) { @@ -623,7 +623,7 @@ void LLImageGL::setImage(const LLImageRaw* imageraw) setImage(rawdata, FALSE); } -static LLTrace::TimeBlock FTM_SET_IMAGE("setImage"); +static LLTrace::BlockTimerStatHandle FTM_SET_IMAGE("setImage"); void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips) { LL_RECORD_BLOCK_TIME(FTM_SET_IMAGE); @@ -1091,7 +1091,7 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_ } // static -static LLTrace::TimeBlock FTM_GENERATE_TEXTURES("generate textures"); +static LLTrace::BlockTimerStatHandle FTM_GENERATE_TEXTURES("generate textures"); void LLImageGL::generateTextures(LLTexUnit::eTextureType type, U32 format, S32 numTextures, U32 *textures) { LL_RECORD_BLOCK_TIME(FTM_GENERATE_TEXTURES); @@ -1184,7 +1184,7 @@ void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip } // static -static LLTrace::TimeBlock FTM_SET_MANUAL_IMAGE("setManualImage"); +static LLTrace::BlockTimerStatHandle FTM_SET_MANUAL_IMAGE("setManualImage"); void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void *pixels, bool allow_compression) { LL_RECORD_BLOCK_TIME(FTM_SET_MANUAL_IMAGE); @@ -1291,7 +1291,7 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt //create an empty GL texture: just create a texture name //the texture is assiciate with some image by calling glTexImage outside LLImageGL -static LLTrace::TimeBlock FTM_CREATE_GL_TEXTURE1("createGLTexture()"); +static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE1("createGLTexture()"); BOOL LLImageGL::createGLTexture() { LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE1); @@ -1322,7 +1322,7 @@ BOOL LLImageGL::createGLTexture() return TRUE ; } -static LLTrace::TimeBlock FTM_CREATE_GL_TEXTURE2("createGLTexture(raw)"); +static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE2("createGLTexture(raw)"); BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/, BOOL to_create, S32 category) { LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE2); @@ -1397,7 +1397,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S return createGLTexture(discard_level, rawdata, FALSE, usename); } -static LLTrace::TimeBlock FTM_CREATE_GL_TEXTURE3("createGLTexture3(data)"); +static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE3("createGLTexture3(data)"); BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename) { LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE3); diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 14894c53b4..79db777f4b 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -1062,7 +1062,7 @@ void gl_rect_2d_simple( S32 width, S32 height ) gGL.end(); } -static LLTrace::TimeBlock FTM_RENDER_SEGMENTED_RECT ("Render segmented rectangle"); +static LLTrace::BlockTimerStatHandle FTM_RENDER_SEGMENTED_RECT ("Render segmented rectangle"); void gl_segmented_rect_2d_tex(const S32 left, const S32 top, diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 3bbbccbad1..cb12f1fba2 100755 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -569,7 +569,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) } //static -static LLTrace::TimeBlock FTM_VB_DRAW_ARRAYS("drawArrays"); +static LLTrace::BlockTimerStatHandle FTM_VB_DRAW_ARRAYS("drawArrays"); void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos, const std::vector& norm) { LL_RECORD_BLOCK_TIME(FTM_VB_DRAW_ARRAYS); @@ -817,7 +817,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const placeFence(); } -static LLTrace::TimeBlock FTM_GL_DRAW_ARRAYS("GL draw arrays"); +static LLTrace::BlockTimerStatHandle FTM_GL_DRAW_ARRAYS("GL draw arrays"); void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); @@ -1348,7 +1348,7 @@ void LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create) } } -static LLTrace::TimeBlock FTM_SETUP_VERTEX_ARRAY("Setup VAO"); +static LLTrace::BlockTimerStatHandle FTM_SETUP_VERTEX_ARRAY("Setup VAO"); void LLVertexBuffer::setupVertexArray() { @@ -1512,8 +1512,8 @@ bool expand_region(LLVertexBuffer::MappedRegion& region, S32 index, S32 count) return true; } -static LLTrace::TimeBlock FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range"); -static LLTrace::TimeBlock FTM_VBO_MAP_BUFFER("VBO Map"); +static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range"); +static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_BUFFER("VBO Map"); // Map for data access volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range) @@ -1694,8 +1694,8 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo } -static LLTrace::TimeBlock FTM_VBO_MAP_INDEX_RANGE("IBO Map Range"); -static LLTrace::TimeBlock FTM_VBO_MAP_INDEX("IBO Map"); +static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_INDEX_RANGE("IBO Map Range"); +static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_INDEX("IBO Map"); volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { @@ -1860,12 +1860,12 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range } } -static LLTrace::TimeBlock FTM_VBO_UNMAP("VBO Unmap"); -static LLTrace::TimeBlock FTM_VBO_FLUSH_RANGE("Flush VBO Range"); +static LLTrace::BlockTimerStatHandle FTM_VBO_UNMAP("VBO Unmap"); +static LLTrace::BlockTimerStatHandle FTM_VBO_FLUSH_RANGE("Flush VBO Range"); -static LLTrace::TimeBlock FTM_IBO_UNMAP("IBO Unmap"); -static LLTrace::TimeBlock FTM_IBO_FLUSH_RANGE("Flush IBO Range"); +static LLTrace::BlockTimerStatHandle FTM_IBO_UNMAP("IBO Unmap"); +static LLTrace::BlockTimerStatHandle FTM_IBO_FLUSH_RANGE("Flush IBO Range"); void LLVertexBuffer::unmapBuffer() { @@ -2130,7 +2130,7 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 in //---------------------------------------------------------------------------- -static LLTrace::TimeBlock FTM_BIND_GL_ARRAY("Bind Array"); +static LLTrace::BlockTimerStatHandle FTM_BIND_GL_ARRAY("Bind Array"); bool LLVertexBuffer::bindGLArray() { if (mGLArray && sGLRenderArray != mGLArray) @@ -2153,7 +2153,7 @@ bool LLVertexBuffer::bindGLArray() return false; } -static LLTrace::TimeBlock FTM_BIND_GL_BUFFER("Bind Buffer"); +static LLTrace::BlockTimerStatHandle FTM_BIND_GL_BUFFER("Bind Buffer"); bool LLVertexBuffer::bindGLBuffer(bool force_bind) { @@ -2178,7 +2178,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind) return ret; } -static LLTrace::TimeBlock FTM_BIND_GL_INDICES("Bind Indices"); +static LLTrace::BlockTimerStatHandle FTM_BIND_GL_INDICES("Bind Indices"); bool LLVertexBuffer::bindGLIndices(bool force_bind) { -- cgit v1.2.3 From c35801ef1c56b6c84063f47b490a8d2220b77ca7 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 5 Nov 2013 19:26:23 -0800 Subject: fixed focus issue on inventory --- indra/llrender/llrender2dutils.cpp | 383 ++++++++++++++++++++----------------- indra/llrender/llrender2dutils.h | 4 +- indra/llrender/lluiimage.cpp | 50 ++--- indra/llrender/lluiimage.h | 18 +- 4 files changed, 237 insertions(+), 218 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 79db777f4b..df5d79a436 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -369,7 +369,7 @@ void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, gl_draw_scaled_rotated_image( x, y, width, height, 0.f, image, color, uv_rect ); } -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect) +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_rect, bool scale_inner) { if (NULL == image) { @@ -382,10 +382,10 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border F32 border_height_fraction = (F32)border_height / (F32)image->getHeight(0); LLRectf scale_rect(border_width_fraction, 1.f - border_height_fraction, 1.f - border_width_fraction, border_height_fraction); - gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect); + gl_draw_scaled_image_with_border(x, y, width, height, image, color, solid_color, uv_rect, scale_rect, scale_inner); } -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect) +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color, BOOL solid_color, const LLRectf& uv_outer_rect, const LLRectf& center_rect, bool scale_inner) { stop_glerror(); @@ -395,56 +395,6 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex return; } - // add in offset of current image to current UI translation - const LLVector3 ui_scale = gGL.getUIScale(); - const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); - - F32 uv_width = uv_outer_rect.getWidth(); - F32 uv_height = uv_outer_rect.getHeight(); - - // shrink scaling region to be proportional to clipped image region - LLRectf uv_center_rect( - uv_outer_rect.mLeft + (center_rect.mLeft * uv_width), - uv_outer_rect.mBottom + (center_rect.mTop * uv_height), - uv_outer_rect.mLeft + (center_rect.mRight * uv_width), - uv_outer_rect.mBottom + (center_rect.mBottom * uv_height)); - - F32 image_width = image->getWidth(0); - F32 image_height = image->getHeight(0); - - S32 image_natural_width = llround(image_width * uv_width); - S32 image_natural_height = llround(image_height * uv_height); - - LLRectf draw_center_rect( uv_center_rect.mLeft * image_width, - uv_center_rect.mTop * image_height, - uv_center_rect.mRight * image_width, - uv_center_rect.mBottom * image_height); - - { // scale fixed region of image to drawn region - draw_center_rect.mRight += width - image_natural_width; - draw_center_rect.mTop += height - image_natural_height; - - F32 border_shrink_width = llmax(0.f, draw_center_rect.mLeft - draw_center_rect.mRight); - F32 border_shrink_height = llmax(0.f, draw_center_rect.mBottom - draw_center_rect.mTop); - - F32 shrink_width_ratio = center_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - center_rect.getWidth())); - F32 shrink_height_ratio = center_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - center_rect.getHeight())); - - F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); - - draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * shrink_scale * ui_scale.mV[VX]); - draw_center_rect.mTop = llround(ui_translation.mV[VY] + lerp((F32)height, (F32)draw_center_rect.mTop, shrink_scale) * ui_scale.mV[VY]); - draw_center_rect.mRight = llround(ui_translation.mV[VX] + lerp((F32)width, (F32)draw_center_rect.mRight, shrink_scale) * ui_scale.mV[VX]); - draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * shrink_scale * ui_scale.mV[VY]); - } - - LLRectf draw_outer_rect(ui_translation.mV[VX], - ui_translation.mV[VY] + height * ui_scale.mV[VY], - ui_translation.mV[VX] + width * ui_scale.mV[VX], - ui_translation.mV[VY]); - - LLGLSUIDefault gls_ui; - if (solid_color) { if (LLGLSLShader::sNoFixedFunction) @@ -458,174 +408,247 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex } } - gGL.getTexUnit(0)->bind(image, true); + if (center_rect.mLeft == 0.f + && center_rect.mRight == 1.f + && center_rect.mBottom == 0.f + && center_rect.mTop == 1.f) + { + gl_draw_scaled_image(x, y, width, height, image, color, uv_outer_rect); + } + else + { + // add in offset of current image to current UI translation + const LLVector3 ui_scale = gGL.getUIScale(); + const LLVector3 ui_translation = (gGL.getUITranslation() + LLVector3(x, y, 0.f)).scaledVec(ui_scale); + + F32 uv_width = uv_outer_rect.getWidth(); + F32 uv_height = uv_outer_rect.getHeight(); + + // shrink scaling region to be proportional to clipped image region + LLRectf uv_center_rect( uv_outer_rect.mLeft + (center_rect.mLeft * uv_width), + uv_outer_rect.mBottom + (center_rect.mTop * uv_height), + uv_outer_rect.mLeft + (center_rect.mRight * uv_width), + uv_outer_rect.mBottom + (center_rect.mBottom * uv_height)); + + F32 image_width = image->getWidth(0); + F32 image_height = image->getHeight(0); + + S32 image_natural_width = llround(image_width * uv_width); + S32 image_natural_height = llround(image_height * uv_height); + + LLRectf draw_center_rect( uv_center_rect.mLeft * image_width, + uv_center_rect.mTop * image_height, + uv_center_rect.mRight * image_width, + uv_center_rect.mBottom * image_height); + + if (scale_inner) + { + // scale center region of image to drawn region + draw_center_rect.mRight += width - image_natural_width; + draw_center_rect.mTop += height - image_natural_height; + + const F32 border_shrink_width = llmax(0.f, draw_center_rect.mLeft - draw_center_rect.mRight); + const F32 border_shrink_height = llmax(0.f, draw_center_rect.mBottom - draw_center_rect.mTop); - gGL.color4fv(color.mV); + const F32 shrink_width_ratio = center_rect.getWidth() == 1.f ? 0.f : border_shrink_width / ((F32)image_natural_width * (1.f - center_rect.getWidth())); + const F32 shrink_height_ratio = center_rect.getHeight() == 1.f ? 0.f : border_shrink_height / ((F32)image_natural_height * (1.f - center_rect.getHeight())); + + const F32 border_shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); + draw_center_rect.mLeft *= border_shrink_scale; + draw_center_rect.mTop = lerp((F32)height, (F32)draw_center_rect.mTop, border_shrink_scale); + draw_center_rect.mRight = lerp((F32)width, (F32)draw_center_rect.mRight, border_shrink_scale); + draw_center_rect.mBottom *= border_shrink_scale; + } + else + { + // keep center region of image at fixed scale, but in same relative position + F32 scale_factor = llmin((F32)width / draw_center_rect.getWidth(), (F32)height / draw_center_rect.getHeight(), 1.f); + F32 scaled_width = draw_center_rect.getWidth() * scale_factor; + F32 scaled_height = draw_center_rect.getHeight() * scale_factor; + draw_center_rect.setCenterAndSize(uv_center_rect.getCenterX() * width, uv_center_rect.getCenterY() * height, scaled_width, scaled_height); + } + + draw_center_rect.mLeft = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * ui_scale.mV[VX]); + draw_center_rect.mTop = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mTop * ui_scale.mV[VY]); + draw_center_rect.mRight = llround(ui_translation.mV[VX] + (F32)draw_center_rect.mRight * ui_scale.mV[VX]); + draw_center_rect.mBottom = llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * ui_scale.mV[VY]); + + LLRectf draw_outer_rect(ui_translation.mV[VX], + ui_translation.mV[VY] + height * ui_scale.mV[VY], + ui_translation.mV[VX] + width * ui_scale.mV[VX], + ui_translation.mV[VY]); + + LLGLSUIDefault gls_ui; + + gGL.getTexUnit(0)->bind(image, true); + + gGL.color4fv(color.mV); - const S32 NUM_VERTICES = 9 * 4; // 9 quads - LLVector2 uv[NUM_VERTICES]; - LLVector3 pos[NUM_VERTICES]; + const S32 NUM_VERTICES = 9 * 4; // 9 quads + LLVector2 uv[NUM_VERTICES]; + LLVector3 pos[NUM_VERTICES]; - S32 index = 0; + S32 index = 0; - gGL.begin(LLRender::QUADS); - { - // draw bottom left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; + gGL.begin(LLRender::QUADS); + { + // draw bottom left + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - // draw bottom middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); - index++; + // draw bottom middle + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - // draw bottom right - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; + // draw bottom right + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - // draw left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + // draw left + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - // draw middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); - index++; + // draw middle + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - // draw right - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + // draw right + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - // draw top left - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + // draw top left + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f); + index++; - // draw top middle - uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); - index++; + // draw top middle + uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f); + index++; - // draw top right - uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + // draw top right + uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f); + index++; - uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); - pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); - index++; + uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop); + pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f); + index++; - gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); + gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES); + } + gGL.end(); } - gGL.end(); if (solid_color) { diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index 2b8964742b..cce3b4ed51 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -75,8 +75,8 @@ void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), LLRenderTarget* target = NULL); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); -void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f)); +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); +void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f ); diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp index b954b66350..6f1fae92cd 100644 --- a/indra/llrender/lluiimage.cpp +++ b/indra/llrender/lluiimage.cpp @@ -38,11 +38,9 @@ LLUIImage::LLUIImage(const std::string& name, LLPointer image) mImage(image), mScaleRegion(0.f, 1.f, 1.f, 0.f), mClipRegion(0.f, 1.f, 1.f, 0.f), - mUniformScaling(TRUE), - mNoClip(TRUE), - mImageLoaded(NULL) -{ -} + mImageLoaded(NULL), + mScaleStyle(SCALE_INNER) +{} LLUIImage::~LLUIImage() { @@ -52,44 +50,35 @@ LLUIImage::~LLUIImage() void LLUIImage::setClipRegion(const LLRectf& region) { mClipRegion = region; - mNoClip = mClipRegion.mLeft == 0.f - && mClipRegion.mRight == 1.f - && mClipRegion.mBottom == 0.f - && mClipRegion.mTop == 1.f; } void LLUIImage::setScaleRegion(const LLRectf& region) { mScaleRegion = region; - mUniformScaling = mScaleRegion.mLeft == 0.f - && mScaleRegion.mRight == 1.f - && mScaleRegion.mBottom == 0.f - && mScaleRegion.mTop == 1.f; +} + +void LLUIImage::setScaleStyle(LLUIImage::EScaleStyle style) +{ + mScaleStyle = style; } //TODO: move drawing implementation inside class void LLUIImage::draw(S32 x, S32 y, const LLColor4& color) const { - gl_draw_scaled_image(x, y, getWidth(), getHeight(), mImage, color, mClipRegion); + draw(x, y, getWidth(), getHeight(), color); } void LLUIImage::draw(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const { - if (mUniformScaling) - { - gl_draw_scaled_image(x, y, width, height, mImage, color, mClipRegion); - } - else - { - gl_draw_scaled_image_with_border( - x, y, - width, height, - mImage, - color, - FALSE, - mClipRegion, - mScaleRegion); - } + gl_draw_scaled_image_with_border( + x, y, + width, height, + mImage, + color, + FALSE, + mClipRegion, + mScaleRegion, + mScaleStyle == SCALE_INNER); } void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& color) const @@ -101,7 +90,8 @@ void LLUIImage::drawSolid(S32 x, S32 y, S32 width, S32 height, const LLColor4& c color, TRUE, mClipRegion, - mScaleRegion); + mScaleRegion, + mScaleStyle == SCALE_INNER); } void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& color, S32 border_width) const diff --git a/indra/llrender/lluiimage.h b/indra/llrender/lluiimage.h index 7817ba1c7b..6f47385eb0 100644 --- a/indra/llrender/lluiimage.h +++ b/indra/llrender/lluiimage.h @@ -42,6 +42,12 @@ extern const LLColor4 UI_VERTEX_COLOR; class LLUIImage : public LLRefCount { public: + enum EScaleStyle + { + SCALE_INNER, + SCALE_OUTER + }; + typedef boost::signals2::signal image_loaded_signal_t; LLUIImage(const std::string& name, LLPointer image); @@ -49,6 +55,7 @@ public: void setClipRegion(const LLRectf& region); void setScaleRegion(const LLRectf& region); + void setScaleStyle(EScaleStyle style); LLPointer getImage() { return mImage; } const LLPointer& getImage() const { return mImage; } @@ -83,12 +90,11 @@ public: protected: image_loaded_signal_t* mImageLoaded; - std::string mName; - LLRectf mScaleRegion; - LLRectf mClipRegion; - LLPointer mImage; - BOOL mUniformScaling; - BOOL mNoClip; + std::string mName; + LLRectf mScaleRegion; + LLRectf mClipRegion; + LLPointer mImage; + EScaleStyle mScaleStyle; }; namespace LLInitParam -- cgit v1.2.3