summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender')
-rwxr-xr-xindra/llrender/llcubemap.cpp2
-rwxr-xr-xindra/llrender/llfontbitmapcache.cpp20
-rwxr-xr-xindra/llrender/llfontbitmapcache.h3
-rwxr-xr-xindra/llrender/llfontfreetype.cpp30
-rwxr-xr-xindra/llrender/llfontfreetype.h6
-rwxr-xr-xindra/llrender/llfontgl.cpp13
-rwxr-xr-xindra/llrender/llfontregistry.cpp54
-rwxr-xr-xindra/llrender/llfontregistry.h5
-rwxr-xr-xindra/llrender/llgl.cpp48
-rwxr-xr-xindra/llrender/llgldbg.cpp82
-rwxr-xr-xindra/llrender/llglheaders.h4
-rwxr-xr-xindra/llrender/llglslshader.cpp32
-rw-r--r--indra/llrender/llgltexture.cpp2
-rw-r--r--indra/llrender/llgltexture.h4
-rwxr-xr-xindra/llrender/llimagegl.cpp205
-rwxr-xr-xindra/llrender/llimagegl.h17
-rwxr-xr-xindra/llrender/llpostprocess.cpp4
-rwxr-xr-xindra/llrender/llrender.cpp91
-rw-r--r--indra/llrender/llrender2dutils.cpp89
-rw-r--r--indra/llrender/llrender2dutils.h5
-rwxr-xr-xindra/llrender/llrendertarget.cpp24
-rwxr-xr-xindra/llrender/llshadermgr.cpp12
-rwxr-xr-xindra/llrender/lltexture.h2
-rwxr-xr-xindra/llrender/llvertexbuffer.cpp201
-rwxr-xr-xindra/llrender/llvertexbuffer.h8
25 files changed, 527 insertions, 436 deletions
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/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>("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<LLPointer<LLImageRaw> >::iterator it = mImageRawVec.begin(), end_it = mImageRawVec.end();
+ it != end_it;
+ ++it)
+ {
+ disclaimMem(**it);
+ }
mImageRawVec.clear();
+
+ for (std::vector<LLPointer<LLImageGL> >::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 <vector>
+#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<LLFontBitmapCache>
{
public:
LLFontBitmapCache();
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 058bef43a5..bde62f89b3 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);
}
}
@@ -101,7 +101,8 @@ LLFontGlyphInfo::LLFontGlyphInfo(U32 index)
}
LLFontFreetype::LLFontFreetype()
-: mFontBitmapCachep(new LLFontBitmapCache),
+: LLTrace::MemTrackable<LLFontFreetype>("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,10 +187,12 @@ 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)
{
- //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]);
}
@@ -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;
@@ -321,7 +325,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 +333,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++)
{
@@ -476,6 +480,7 @@ void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const
}
else
{
+ claimMem(gi);
mCharGlyphInfoMap[wch] = gi;
}
}
@@ -501,7 +506,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
{
@@ -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<LLFontBitmapCache> 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<LLFontFreetype>
{
public:
LLFontFreetype();
@@ -134,7 +134,7 @@ public:
const std::string& getName() const;
- const LLPointer<LLFontBitmapCache> getFontBitmapCache() const;
+ const LLFontBitmapCache* getFontBitmapCache() const;
void setStyle(U8 style);
U8 getStyle() const;
@@ -167,7 +167,7 @@ private:
typedef boost::unordered_map<llwchar, LLFontGlyphInfo*> char_glyph_info_map_t;
mutable char_glyph_info_map_t mCharGlyphInfoMap; // Information about glyph location in bitmap
- mutable LLPointer<LLFontBitmapCache> mFontBitmapCachep;
+ mutable LLFontBitmapCache* mFontBitmapCachep;
mutable S32 mRenderGlyphCount;
mutable S32 mAddGlyphCount;
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index c4f36cabd0..b1ff2f7e07 100755
--- 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"
@@ -97,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
@@ -128,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
{
@@ -275,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.
@@ -1069,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
@@ -1114,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 f5ca8d5b04..d003687415 100755
--- 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)
@@ -198,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;
}
@@ -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;
}
}
@@ -351,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)
@@ -363,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;
}
@@ -377,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;
@@ -410,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;
}
@@ -478,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;
@@ -531,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;
}
@@ -636,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 <<llendl;
+ LL_INFOS() << " file: " << *file_it <<LL_ENDL;
}
}
}
diff --git a/indra/llrender/llfontregistry.h b/indra/llrender/llfontregistry.h
index 059248fbbd..177eb6c8a5 100755
--- 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<class LLXMLNode>);
// 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<LLFontDescriptor,LLFontGL*> font_reg_map_t;
typedef std::map<std::string,F32> font_size_map_t;
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index a157cd94c4..db734bfd1a 100755
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -82,20 +82,20 @@ void APIENTRY gl_debug_callback(GLenum source,
{
if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
{
- llwarns << "----- GL ERROR --------" << llendl;
+ LL_WARNS() << "----- GL ERROR --------" << LL_ENDL;
}
else
{
- llwarns << "----- GL WARNING -------" << llendl;
+ LL_WARNS() << "----- GL WARNING -------" << LL_ENDL;
}
- llwarns << "Type: " << std::hex << type << llendl;
- llwarns << "ID: " << std::hex << id << llendl;
- llwarns << "Severity: " << std::hex << severity << llendl;
- llwarns << "Message: " << message << llendl;
- llwarns << "-----------------------" << llendl;
+ LL_WARNS() << "Type: " << std::hex << type << LL_ENDL;
+ LL_WARNS() << "ID: " << std::hex << id << LL_ENDL;
+ LL_WARNS() << "Severity: " << std::hex << severity << LL_ENDL;
+ LL_WARNS() << "Message: " << message << LL_ENDL;
+ LL_WARNS() << "-----------------------" << LL_ENDL;
if (severity == GL_DEBUG_SEVERITY_HIGH_ARB)
{
- llerrs << "Halting on GL Error" << llendl;
+ LL_ERRS() << "Halting on GL Error" << LL_ENDL;
}
}
#endif
@@ -541,7 +541,7 @@ bool LLGLManager::initGL()
{
std::string ext((const char*) glGetStringi(GL_EXTENSIONS, i));
str << ext << " ";
- LL_DEBUGS("GLExtensions") << ext << llendl;
+ LL_DEBUGS("GLExtensions") << ext << LL_ENDL;
}
{
@@ -1010,7 +1010,7 @@ void LLGLManager::initExtensions()
#endif
#if LL_LINUX || LL_SOLARIS
- llinfos << "initExtensions() checking shell variables to adjust features..." << llendl;
+ LL_INFOS() << "initExtensions() checking shell variables to adjust features..." << LL_ENDL;
// Our extension support for the Linux Client is very young with some
// potential driver gotchas, so offer a semi-secret way to turn it off.
if (getenv("LL_GL_NOEXT"))
@@ -1204,7 +1204,7 @@ void LLGLManager::initExtensions()
}
if (mHasFramebufferObject)
{
- llinfos << "initExtensions() FramebufferObject-related procs..." << llendl;
+ LL_INFOS() << "initExtensions() FramebufferObject-related procs..." << LL_ENDL;
glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) GLH_EXT_GET_PROC_ADDRESS("glIsRenderbuffer");
glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) GLH_EXT_GET_PROC_ADDRESS("glBindRenderbuffer");
glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) GLH_EXT_GET_PROC_ADDRESS("glDeleteRenderbuffers");
@@ -1272,7 +1272,7 @@ void LLGLManager::initExtensions()
if (mHasOcclusionQuery)
{
- llinfos << "initExtensions() OcclusionQuery-related procs..." << llendl;
+ LL_INFOS() << "initExtensions() OcclusionQuery-related procs..." << LL_ENDL;
glGenQueriesARB = (PFNGLGENQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glGenQueriesARB");
glDeleteQueriesARB = (PFNGLDELETEQUERIESARBPROC)GLH_EXT_GET_PROC_ADDRESS("glDeleteQueriesARB");
glIsQueryARB = (PFNGLISQUERYARBPROC)GLH_EXT_GET_PROC_ADDRESS("glIsQueryARB");
@@ -1284,14 +1284,14 @@ void LLGLManager::initExtensions()
}
if (mHasTimerQuery)
{
- llinfos << "initExtensions() TimerQuery-related procs..." << llendl;
+ LL_INFOS() << "initExtensions() TimerQuery-related procs..." << LL_ENDL;
glQueryCounter = (PFNGLQUERYCOUNTERPROC) GLH_EXT_GET_PROC_ADDRESS("glQueryCounter");
glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC) GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjecti64v");
glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC) GLH_EXT_GET_PROC_ADDRESS("glGetQueryObjectui64v");
}
if (mHasPointParameters)
{
- llinfos << "initExtensions() PointParameters-related procs..." << llendl;
+ LL_INFOS() << "initExtensions() PointParameters-related procs..." << LL_ENDL;
glPointParameterfARB = (PFNGLPOINTPARAMETERFARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfARB");
glPointParameterfvARB = (PFNGLPOINTPARAMETERFVARBPROC)GLH_EXT_GET_PROC_ADDRESS("glPointParameterfvARB");
}
@@ -1339,7 +1339,7 @@ void LLGLManager::initExtensions()
}
if (mHasVertexShader)
{
- llinfos << "initExtensions() VertexShader-related procs..." << llendl;
+ LL_INFOS() << "initExtensions() VertexShader-related procs..." << LL_ENDL;
glGetAttribLocationARB = (PFNGLGETATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetAttribLocationARB");
glBindAttribLocationARB = (PFNGLBINDATTRIBLOCATIONARBPROC) GLH_EXT_GET_PROC_ADDRESS("glBindAttribLocationARB");
glGetActiveAttribARB = (PFNGLGETACTIVEATTRIBARBPROC) GLH_EXT_GET_PROC_ADDRESS("glGetActiveAttribARB");
@@ -1440,13 +1440,13 @@ void log_glerror()
GLubyte const * gl_error_msg = gluErrorString(error);
if (NULL != gl_error_msg)
{
- llwarns << "GL Error: " << error << " GL Error String: " << gl_error_msg << llendl ;
+ LL_WARNS() << "GL Error: " << error << " GL Error String: " << gl_error_msg << LL_ENDL ;
}
else
{
// gluErrorString returns NULL for some extensions' error codes.
// you'll probably have to grep for the number in glext.h.
- llwarns << "GL Error: UNKNOWN 0x" << std::hex << error << std::dec << llendl;
+ LL_WARNS() << "GL Error: UNKNOWN 0x" << std::hex << error << std::dec << LL_ENDL;
}
error = glGetError();
}
@@ -1494,7 +1494,7 @@ void do_assert_glerror()
}
else
{
- llerrs << "One or more unhandled GL errors." << llendl;
+ LL_ERRS() << "One or more unhandled GL errors." << LL_ENDL;
}
}
}
@@ -1503,7 +1503,7 @@ void assert_glerror()
{
if (!gGLActive)
{
- //llwarns << "GL used while not active!" << llendl;
+ //LL_WARNS() << "GL used while not active!" << LL_ENDL;
if (gDebugSession)
{
@@ -1787,7 +1787,7 @@ void LLGLState::checkTextureChannels(const std::string& msg)
if (tex != 0)
{
error = TRUE;
- LL_WARNS("RenderState") << "Texture channel " << i << " still has texture " << tex << " bound." << llendl;
+ LL_WARNS("RenderState") << "Texture channel " << i << " still has texture " << tex << " bound." << LL_ENDL;
if (gDebugSession)
{
@@ -1831,7 +1831,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
if (active_texture != GL_TEXTURE0_ARB)
{
- llwarns << "Client active texture corrupted: " << active_texture << llendl;
+ LL_WARNS() << "Client active texture corrupted: " << active_texture << LL_ENDL;
if (gDebugSession)
{
gFailLog << "Client active texture corrupted: " << active_texture << std::endl;
@@ -1842,7 +1842,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
/*glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture);
if (active_texture != GL_TEXTURE0_ARB)
{
- llwarns << "Active texture corrupted: " << active_texture << llendl;
+ LL_WARNS() << "Active texture corrupted: " << active_texture << LL_ENDL;
if (gDebugSession)
{
gFailLog << "Active texture corrupted: " << active_texture << std::endl;
@@ -2339,11 +2339,11 @@ void LLGLNamePool::release(GLuint name)
}
else
{
- llerrs << "Attempted to release a pooled name that is not in use!" << llendl;
+ LL_ERRS() << "Attempted to release a pooled name that is not in use!" << LL_ENDL;
}
}
}
- llerrs << "Attempted to release a non pooled name!" << llendl;
+ LL_ERRS() << "Attempted to release a non pooled name!" << LL_ENDL;
#else
releaseName(name);
#endif
diff --git a/indra/llrender/llgldbg.cpp b/indra/llrender/llgldbg.cpp
index 4b68194db3..0f1d4ae742 100755
--- a/indra/llrender/llgldbg.cpp
+++ b/indra/llrender/llgldbg.cpp
@@ -112,112 +112,112 @@ void llgl_dump()
F32 fv[16];
GLboolean b;
- llinfos << "==========================" << llendl;
- llinfos << "OpenGL State" << llendl;
- llinfos << "==========================" << llendl;
+ LL_INFOS() << "==========================" << LL_ENDL;
+ LL_INFOS() << "OpenGL State" << LL_ENDL;
+ LL_INFOS() << "==========================" << LL_ENDL;
- llinfos << "-----------------------------------" << llendl;
- llinfos << "Current Values" << llendl;
- llinfos << "-----------------------------------" << llendl;
+ LL_INFOS() << "-----------------------------------" << LL_ENDL;
+ LL_INFOS() << "Current Values" << LL_ENDL;
+ LL_INFOS() << "-----------------------------------" << LL_ENDL;
glGetFloatv(GL_CURRENT_COLOR, fv);
- llinfos << "GL_CURRENT_COLOR : " << fv4(fv) << llendl;
+ LL_INFOS() << "GL_CURRENT_COLOR : " << fv4(fv) << LL_ENDL;
glGetFloatv(GL_CURRENT_NORMAL, fv);
- llinfos << "GL_CURRENT_NORMAL : " << fv3(fv) << llendl;
+ LL_INFOS() << "GL_CURRENT_NORMAL : " << fv3(fv) << LL_ENDL;
- llinfos << "-----------------------------------" << llendl;
- llinfos << "Lighting" << llendl;
- llinfos << "-----------------------------------" << llendl;
+ LL_INFOS() << "-----------------------------------" << LL_ENDL;
+ LL_INFOS() << "Lighting" << LL_ENDL;
+ LL_INFOS() << "-----------------------------------" << LL_ENDL;
- llinfos << "GL_LIGHTING : " << boolstr(glIsEnabled(GL_LIGHTING)) << llendl;
+ LL_INFOS() << "GL_LIGHTING : " << boolstr(glIsEnabled(GL_LIGHTING)) << LL_ENDL;
- llinfos << "GL_COLOR_MATERIAL : " << boolstr(glIsEnabled(GL_COLOR_MATERIAL)) << llendl;
+ LL_INFOS() << "GL_COLOR_MATERIAL : " << boolstr(glIsEnabled(GL_COLOR_MATERIAL)) << LL_ENDL;
glGetIntegerv(GL_COLOR_MATERIAL_PARAMETER, (GLint*)&i);
- llinfos << "GL_COLOR_MATERIAL_PARAMETER: " << cmstr(i) << llendl;
+ LL_INFOS() << "GL_COLOR_MATERIAL_PARAMETER: " << cmstr(i) << LL_ENDL;
glGetIntegerv(GL_COLOR_MATERIAL_FACE, (GLint*)&i);
- llinfos << "GL_COLOR_MATERIAL_FACE : " << facestr(i) << llendl;
+ LL_INFOS() << "GL_COLOR_MATERIAL_FACE : " << facestr(i) << LL_ENDL;
fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f;
glGetMaterialfv(GL_FRONT, GL_AMBIENT, fv);
- llinfos << "GL_AMBIENT material : " << fv4(fv) << llendl;
+ LL_INFOS() << "GL_AMBIENT material : " << fv4(fv) << LL_ENDL;
fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f;
glGetMaterialfv(GL_FRONT, GL_DIFFUSE, fv);
- llinfos << "GL_DIFFUSE material : " << fv4(fv) << llendl;
+ LL_INFOS() << "GL_DIFFUSE material : " << fv4(fv) << LL_ENDL;
fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f;
glGetMaterialfv(GL_FRONT, GL_SPECULAR, fv);
- llinfos << "GL_SPECULAR material : " << fv4(fv) << llendl;
+ LL_INFOS() << "GL_SPECULAR material : " << fv4(fv) << LL_ENDL;
fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f;
glGetMaterialfv(GL_FRONT, GL_EMISSION, fv);
- llinfos << "GL_EMISSION material : " << fv4(fv) << llendl;
+ LL_INFOS() << "GL_EMISSION material : " << fv4(fv) << LL_ENDL;
fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f;
glGetMaterialfv(GL_FRONT, GL_SHININESS, fv);
- llinfos << "GL_SHININESS material : " << fv1(fv) << llendl;
+ LL_INFOS() << "GL_SHININESS material : " << fv1(fv) << LL_ENDL;
fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f;
glGetFloatv(GL_LIGHT_MODEL_AMBIENT, fv);
- llinfos << "GL_LIGHT_MODEL_AMBIENT : " << fv4(fv) << llendl;
+ LL_INFOS() << "GL_LIGHT_MODEL_AMBIENT : " << fv4(fv) << LL_ENDL;
glGetBooleanv(GL_LIGHT_MODEL_LOCAL_VIEWER, &b);
- llinfos << "GL_LIGHT_MODEL_LOCAL_VIEWER: " << boolstr(b) << llendl;
+ LL_INFOS() << "GL_LIGHT_MODEL_LOCAL_VIEWER: " << boolstr(b) << LL_ENDL;
glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE, &b);
- llinfos << "GL_LIGHT_MODEL_TWO_SIDE : " << boolstr(b) << llendl;
+ LL_INFOS() << "GL_LIGHT_MODEL_TWO_SIDE : " << boolstr(b) << LL_ENDL;
for (int l=0; l<8; l++)
{
b = glIsEnabled(GL_LIGHT0+l);
- llinfos << "GL_LIGHT" << l << " : " << boolstr(b) << llendl;
+ LL_INFOS() << "GL_LIGHT" << l << " : " << boolstr(b) << LL_ENDL;
if (!b)
continue;
glGetLightfv(GL_LIGHT0+l, GL_AMBIENT, fv);
- llinfos << " GL_AMBIENT light : " << fv4(fv) << llendl;
+ LL_INFOS() << " GL_AMBIENT light : " << fv4(fv) << LL_ENDL;
glGetLightfv(GL_LIGHT0+l, GL_DIFFUSE, fv);
- llinfos << " GL_DIFFUSE light : " << fv4(fv) << llendl;
+ LL_INFOS() << " GL_DIFFUSE light : " << fv4(fv) << LL_ENDL;
glGetLightfv(GL_LIGHT0+l, GL_SPECULAR, fv);
- llinfos << " GL_SPECULAR light : " << fv4(fv) << llendl;
+ LL_INFOS() << " GL_SPECULAR light : " << fv4(fv) << LL_ENDL;
glGetLightfv(GL_LIGHT0+l, GL_POSITION, fv);
- llinfos << " GL_POSITION light : " << fv4(fv) << llendl;
+ LL_INFOS() << " GL_POSITION light : " << fv4(fv) << LL_ENDL;
glGetLightfv(GL_LIGHT0+l, GL_CONSTANT_ATTENUATION, fv);
- llinfos << " GL_CONSTANT_ATTENUATION : " << fv1(fv) << llendl;
+ LL_INFOS() << " GL_CONSTANT_ATTENUATION : " << fv1(fv) << LL_ENDL;
glGetLightfv(GL_LIGHT0+l, GL_QUADRATIC_ATTENUATION, fv);
- llinfos << " GL_QUADRATIC_ATTENUATION : " << fv1(fv) << llendl;
+ LL_INFOS() << " GL_QUADRATIC_ATTENUATION : " << fv1(fv) << LL_ENDL;
glGetLightfv(GL_LIGHT0+l, GL_SPOT_DIRECTION, fv);
- llinfos << " GL_SPOT_DIRECTION : " << fv4(fv) << llendl;
+ LL_INFOS() << " GL_SPOT_DIRECTION : " << fv4(fv) << LL_ENDL;
glGetLightfv(GL_LIGHT0+l, GL_SPOT_EXPONENT, fv);
- llinfos << " GL_SPOT_EXPONENT : " << fv1(fv) << llendl;
+ LL_INFOS() << " GL_SPOT_EXPONENT : " << fv1(fv) << LL_ENDL;
glGetLightfv(GL_LIGHT0+l, GL_SPOT_CUTOFF, fv);
- llinfos << " GL_SPOT_CUTOFF : " << fv1(fv) << llendl;
+ LL_INFOS() << " GL_SPOT_CUTOFF : " << fv1(fv) << LL_ENDL;
}
- llinfos << "-----------------------------------" << llendl;
- llinfos << "Pixel Operations" << llendl;
- llinfos << "-----------------------------------" << llendl;
+ LL_INFOS() << "-----------------------------------" << LL_ENDL;
+ LL_INFOS() << "Pixel Operations" << LL_ENDL;
+ LL_INFOS() << "-----------------------------------" << LL_ENDL;
- llinfos << "GL_ALPHA_TEST : " << boolstr(glIsEnabled(GL_ALPHA_TEST)) << llendl;
- llinfos << "GL_DEPTH_TEST : " << boolstr(glIsEnabled(GL_DEPTH_TEST)) << llendl;
+ LL_INFOS() << "GL_ALPHA_TEST : " << boolstr(glIsEnabled(GL_ALPHA_TEST)) << LL_ENDL;
+ LL_INFOS() << "GL_DEPTH_TEST : " << boolstr(glIsEnabled(GL_DEPTH_TEST)) << LL_ENDL;
glGetBooleanv(GL_DEPTH_WRITEMASK, &b);
- llinfos << "GL_DEPTH_WRITEMASK : " << boolstr(b) << llendl;
+ LL_INFOS() << "GL_DEPTH_WRITEMASK : " << boolstr(b) << LL_ENDL;
- llinfos << "GL_BLEND : " << boolstr(glIsEnabled(GL_BLEND)) << llendl;
- llinfos << "GL_DITHER : " << boolstr(glIsEnabled(GL_DITHER)) << llendl;
+ LL_INFOS() << "GL_BLEND : " << boolstr(glIsEnabled(GL_BLEND)) << LL_ENDL;
+ LL_INFOS() << "GL_DITHER : " << boolstr(glIsEnabled(GL_DITHER)) << LL_ENDL;
}
// End
diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h
index 1bec6d376b..d5dba1508b 100755
--- a/indra/llrender/llglheaders.h
+++ b/indra/llrender/llglheaders.h
@@ -550,9 +550,7 @@ extern PFNGLBINDBUFFERRANGEPROC glBindBufferRange;
// LL_WINDOWS
// windows gl headers depend on things like APIENTRY, so include windows.
-#define WIN32_LEAN_AND_MEAN
-#include <winsock2.h>
-#include <windows.h>
+#include "llwin32headerslean.h"
//----------------------------------------------------------------------------
#include <GL/gl.h>
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 40aff36dac..72c4cd4c8c 100755
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -137,10 +137,10 @@ void LLGLSLShader::finishProfile()
(*iter)->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;
}
}
@@ -708,7 +708,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<string> * uniforms)
unbind();
- LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << llendl;
+ LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL;
return res;
}
@@ -854,7 +854,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();
@@ -1154,7 +1154,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.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 e69b322d60..45592ee077 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;
@@ -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 38764eba23..4330a9891e 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"
@@ -50,9 +51,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;
+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;
@@ -116,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)
@@ -125,7 +126,7 @@ void LLImageGL::checkTexSize(bool forced) const
}
else
{
- llerrs << "Invalid texture bound!" << llendl;
+ LL_ERRS() << "Invalid texture bound!" << LL_ENDL;
}
}
stop_glerror() ;
@@ -149,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 ;
}
}
@@ -199,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;
}
}
@@ -234,28 +235,28 @@ 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;
}
}
//----------------------------------------------------------------------------
-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;
- sBoundTextureMemoryInBytes = sCurBoundTextureMemory;
- sCurBoundTextureMemory = 0;
+ sBoundTextureMemory = sCurBoundTextureMemory;
+ sCurBoundTextureMemory = S32Bytes(0);
}
//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;
+ return LLImageGL::sCurBoundTextureMemory.value();
}
//----------------------------------------------------------------------------
@@ -278,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 ;
}
}
@@ -300,7 +303,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())
{
@@ -353,7 +356,8 @@ BOOL LLImageGL::create(LLPointer<LLImageGL>& dest, const LLImageRaw* imageraw, B
//----------------------------------------------------------------------------
LLImageGL::LLImageGL(BOOL usemipmaps)
- : mSaveData(0)
+: LLTrace::MemTrackable<LLImageGL>("LLImageGL"),
+ mSaveData(0)
{
init(usemipmaps);
setSize(0, 0, 0);
@@ -362,7 +366,8 @@ LLImageGL::LLImageGL(BOOL usemipmaps)
}
LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps)
- : mSaveData(0)
+: LLTrace::MemTrackable<LLImageGL>("LLImageGL"),
+ mSaveData(0)
{
llassert( components <= 4 );
init(usemipmaps);
@@ -372,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>("LLImageGL"),
+ mSaveData(0)
{
init(usemipmaps);
setSize(0, 0, 0);
@@ -386,6 +392,7 @@ LLImageGL::~LLImageGL()
{
LLImageGL::cleanup();
sImageList.erase(this);
+ disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8);
delete [] mPickMask;
mPickMask = NULL;
sCount--;
@@ -397,7 +404,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;
@@ -489,16 +496,17 @@ 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();
}
// pickmask validity depends on old image size, delete it
+ disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8);
delete [] mPickMask;
mPickMask = NULL;
mPickMaskWidth = mPickMaskHeight = 0;
@@ -533,7 +541,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)
@@ -548,12 +556,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;
}
//----------------------------------------------------------------------------
@@ -562,7 +570,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)
{
@@ -615,10 +623,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)
{
@@ -670,7 +678,7 @@ void LLImageGL::setImage(const U8* data_in, BOOL data_hasmips)
}
else
{
-// LLFastTimer t2(FTM_TEMP4);
+// LL_RECORD_BLOCK_TIME(FTM_TEMP4);
if(mFormatSwapBytes)
{
@@ -702,7 +710,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)
{
@@ -794,7 +802,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);
@@ -835,7 +843,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
@@ -884,7 +892,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);
@@ -930,7 +938,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;
}
}
@@ -974,13 +982,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;
}
@@ -994,7 +1002,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);
@@ -1003,28 +1011,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;
}
@@ -1040,7 +1048,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,
@@ -1083,10 +1091,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);
@@ -1131,30 +1139,30 @@ void LLImageGL::deleteTextures(LLTexUnit::eTextureType type, U32 format, S32 mip
default:
{
if (type == LLTexUnit::TT_CUBE_MAP || mip_levels == -1)
- { //unknown internal format or unknown number of mip levels, not safe to reuse
- glDeleteTextures(numTextures, textures);
- }
- else
- {
- for (S32 i = 0; i < numTextures; ++i)
- { //remove texture from VRAM by setting its size to zero
-
- for (S32 j = 0; j <= mip_levels; j++)
+ { //unknown internal format or unknown number of mip levels, not safe to reuse
+ glDeleteTextures(numTextures, textures);
+ }
+ else
{
- gGL.getTexUnit(0)->bindManual(type, textures[i]);
+ for (S32 i = 0; i < numTextures; ++i)
+ { //remove texture from VRAM by setting its size to zero
+
+ for (S32 j = 0; j <= mip_levels; j++)
+ {
+ gGL.getTexUnit(0)->bindManual(type, textures[i]);
U32 internal_type = LLTexUnit::getInternalType(type);
glTexImage2D(internal_type, j, format, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
stop_glerror();
- }
+ }
- llassert(std::find(sDeadTextureList[type][format].begin(),
- sDeadTextureList[type][format].end(), textures[i]) ==
- sDeadTextureList[type][format].end());
+ llassert(std::find(sDeadTextureList[type][format].begin(),
+ sDeadTextureList[type][format].end(), textures[i]) ==
+ sDeadTextureList[type][format].end());
- sDeadTextureList[type][format].push_back(textures[i]);
- }
- }
- }
+ sDeadTextureList[type][format].push_back(textures[i]);
+ }
+ }
+ }
break;
}
}
@@ -1166,10 +1174,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)
@@ -1256,7 +1264,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;
}
}
@@ -1273,13 +1281,13 @@ 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)
{
- 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;
}
@@ -1298,19 +1306,19 @@ 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 ;
}
-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)
{
- 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;
}
@@ -1360,7 +1368,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() ;
@@ -1379,10 +1387,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();
@@ -1422,7 +1430,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)
@@ -1452,15 +1460,17 @@ 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);
stop_glerror();
}
- mTextureMemory = getMipBytes(discard_level);
- sGlobalTextureMemoryInBytes += mTextureMemory;
+ disclaimMem(mTextureMemory);
+ mTextureMemory = (S32Bytes)getMipBytes(discard_level);
+ claimMem(mTextureMemory);
+ sGlobalTextureMemory += mTextureMemory;
mTexelsInGLTexture = getWidth() * getHeight() ;
// mark this as bound at this point, so we don't throw it out immediately
@@ -1471,7 +1481,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)
{
@@ -1509,15 +1519,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;
@@ -1530,7 +1540,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 ;
}
//-----------------------------------------------------------------------------------------------
@@ -1540,8 +1550,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 ;
}
@@ -1552,8 +1562,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 ;
}
@@ -1564,12 +1574,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 ;
@@ -1617,10 +1627,11 @@ void LLImageGL::destroyGLTexture()
{
if (mTexName != 0)
{
- if(mTextureMemory)
+ if(mTextureMemory != S32Bytes(0))
{
- sGlobalTextureMemoryInBytes -= mTextureMemory;
- mTextureMemory = 0;
+ sGlobalTextureMemory -= mTextureMemory;
+ disclaimMem(mTextureMemory);
+ mTextureMemory = (S32Bytes)0;
}
LLImageGL::deleteTextures(mBindTarget, mFormatInternal, mMipLevels, 1, &mTexName);
@@ -1853,7 +1864,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;
@@ -1969,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;
@@ -1986,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 57a052b258..816169a30c 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 "llunits.h"
#include "llrender.h"
class LLTextureAtlas ;
@@ -41,7 +42,7 @@ class LLTextureAtlas ;
#define MEGA_BYTES_TO_BYTES(x) ((x) << 20)
//============================================================================
-class LLImageGL : public LLRefCount
+class LLImageGL : public LLRefCount, public LLTrace::MemTrackable<LLImageGL>
{
friend class LLTexUnit;
public:
@@ -62,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;
@@ -75,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);
@@ -98,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 ;}
@@ -188,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:
@@ -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 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;
diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp
index c0045c8044..84caa045cc 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);
@@ -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 f2f1b62be0..2bd62726d0 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;
}
@@ -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)
{
@@ -275,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;
}
@@ -325,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;
}
@@ -349,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;
}
}
@@ -367,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());
@@ -493,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);
@@ -547,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);
@@ -587,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;
}
}
@@ -625,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;
}
}
@@ -766,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);
@@ -814,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;
}
}
@@ -1383,7 +1388,7 @@ void LLRender::pushMatrix()
}
else
{
- llwarns << "Matrix stack overflow." << llendl;
+ LL_WARNS() << "Matrix stack overflow." << LL_ENDL;
}
}
}
@@ -1399,7 +1404,7 @@ void LLRender::popMatrix()
}
else
{
- llwarns << "Matrix stack underflow." << llendl;
+ LL_WARNS() << "Matrix stack underflow." << LL_ENDL;
}
}
}
@@ -1472,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;
@@ -1484,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));
@@ -1515,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();
@@ -1544,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);
@@ -1602,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;
}
}
@@ -1643,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;
@@ -1651,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;
}
}
}
@@ -1681,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;
}
@@ -1706,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;
}
}
@@ -1742,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;
}
}
@@ -1773,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;
@@ -1785,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 &&
@@ -1804,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;
@@ -1827,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
@@ -1857,7 +1862,7 @@ void LLRender::flush()
if (mCount%4 != 0)
{
count -= (mCount % 4);
- llwarns << "Incomplete quad requested." << llendl;
+ LL_WARNS() << "Incomplete quad requested." << LL_ENDL;
}
}
@@ -1865,8 +1870,10 @@ void LLRender::flush()
{
if (mCount%3 != 0)
{
- count -= (mCount % 3);
- llwarns << "Incomplete triangle requested." << llendl;
+ if (mCount%3 != 0)
+ {
+ LL_ERRS() << "Incomplete triangle rendered." << LL_ENDL;
+ }
}
}
@@ -1874,8 +1881,10 @@ void LLRender::flush()
{
if (mCount%2 != 0)
{
- count -= (mCount % 2);
- llwarns << "Incomplete line requested." << llendl;
+ if (mCount%2 != 0)
+ {
+ LL_ERRS() << "Incomplete line rendered." << LL_ENDL;
+ }
}
}
@@ -1925,7 +1934,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;
}
@@ -1968,7 +1977,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;
}
@@ -2025,7 +2034,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;
}
@@ -2083,7 +2092,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 d3cfbaf03a..14894c53b4 100644
--- a/indra/llrender/llrender2dutils.cpp
+++ b/indra/llrender/llrender2dutils.cpp
@@ -35,6 +35,7 @@
#include "llrect.h"
#include "llgl.h"
#include "lltexture.h"
+#include "llfasttimer.h"
// Project includes
#include "llrender2dutils.h"
@@ -347,17 +348,22 @@ 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 );
}
+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)
{
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 );
@@ -367,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;
}
@@ -385,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;
}
@@ -639,18 +645,24 @@ 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)
+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 (NULL == image)
+ if (!image && !target)
{
- llwarns << "image == NULL; aborting function" << llendl;
+ LL_WARNS() << "image == NULL; aborting function" << LL_ENDL;
return;
}
LLGLSUIDefault gls_ui;
-
- gGL.getTexUnit(0)->bind(image, true);
+ if(image != NULL)
+ {
+ gGL.getTexUnit(0)->bind(image, true);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->bind(target);
+ }
gGL.color4fv(color.mV);
@@ -695,18 +707,25 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
{
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);
-
- gGL.getTexUnit(0)->bind(image, true);
+
+ 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;
@@ -732,7 +751,6 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
}
}
-
void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase )
{
phase = fmod(phase, 1.f);
@@ -1044,6 +1062,8 @@ void gl_rect_2d_simple( S32 width, S32 height )
gGL.end();
}
+static LLTrace::TimeBlock FTM_RENDER_SEGMENTED_RECT ("Render segmented rectangle");
+
void gl_segmented_rect_2d_tex(const S32 left,
const S32 top,
const S32 right,
@@ -1053,6 +1073,8 @@ void gl_segmented_rect_2d_tex(const S32 left,
const S32 border_size,
const U32 edges)
{
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT);
+
S32 width = llabs(right - left);
S32 height = llabs(top - bottom);
@@ -1202,18 +1224,19 @@ void gl_segmented_rect_2d_tex(const S32 left,
gGL.popUIMatrix();
}
-//FIXME: rewrite to use scissor?
-void gl_segmented_rect_2d_fragment_tex(const S32 left,
- const S32 top,
- const S32 right,
- const S32 bottom,
- const S32 texture_width,
- const S32 texture_height,
- const S32 border_size,
- const F32 start_fragment,
- const F32 end_fragment,
- const U32 edges)
+void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
+ const S32 texture_width,
+ const S32 texture_height,
+ const S32 border_size,
+ const F32 start_fragment,
+ const F32 end_fragment,
+ const U32 edges)
{
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT);
+ const S32 left = rect.mLeft;
+ const S32 right = rect.mRight;
+ const S32 top = rect.mTop;
+ const S32 bottom = rect.mBottom;
S32 width = llabs(right - left);
S32 height = llabs(top - bottom);
@@ -1251,9 +1274,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
{
if (start_fragment < middle_start)
{
- u_min = (start_fragment / middle_start) * border_uv_scale.mV[VX];
+ u_min = (start_fragment / middle_start) * border_uv_scale.mV[VX];
u_max = llmin(end_fragment / middle_start, 1.f) * border_uv_scale.mV[VX];
- x_min = (start_fragment / middle_start) * border_width_left;
+ x_min = (start_fragment / middle_start) * border_width_left;
x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left;
// draw bottom left
@@ -1281,7 +1304,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
-
+
// draw top left
gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
@@ -1343,10 +1366,10 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
if (end_fragment > middle_end)
{
- u_min = (1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_uv_scale.mV[VX];
- u_max = (1.f - ((end_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX];
- x_min = width_vec - ((1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_width_right);
- x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right);
+ u_min = 1.f - ((1.f - llmax(0.f, (start_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]);
+ u_max = 1.f - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]);
+ x_min = width_vec - ((1.f - llmax(0.f, (start_fragment - middle_end) / middle_start)) * border_width_right);
+ x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right);
// draw bottom right
gGL.texCoord2f(u_min, 0.f);
@@ -1396,6 +1419,8 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
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)
{
+ LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT);
+
gGL.begin(LLRender::QUADS);
{
// draw bottom left
diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h
index 4884422c58..2b8964742b 100644
--- a/indra/llrender/llrender2dutils.h
+++ b/indra/llrender/llrender2dutils.h
@@ -71,9 +71,10 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4&
void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians, F32 end_radians, S32 steps, const LLColor4& inner_color, const LLColor4& outer_color);
void gl_draw_image(S32 x, S32 y, 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_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
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));
+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));
@@ -105,7 +106,7 @@ typedef enum e_rounded_edge
void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const U32 edges = ROUNDED_RECT_ALL);
-void gl_segmented_rect_2d_fragment_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL);
+void gl_segmented_rect_2d_fragment_tex(const LLRect& rect, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL);
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);
inline void gl_rect_2d( const LLRect& rect, BOOL filled )
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index c0602d79bd..3e7403dc09 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;
}
@@ -139,7 +139,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;
}
}
@@ -181,13 +181,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;
@@ -205,7 +205,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;
}
}
@@ -294,7 +294,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;
}
@@ -305,17 +305,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)
@@ -486,7 +486,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())
{
@@ -554,7 +554,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;
}
@@ -597,7 +597,7 @@ void LLRenderTarget::copyContentsToFramebuffer(LLRenderTarget& source, S32 srcX0
{
if (!source.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;
}
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 63404abeff..7421704853 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 = "";
}
}
@@ -1152,7 +1152,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/lltexture.h b/indra/llrender/lltexture.h
index 093bac20d1..ff711b8004 100755
--- a/indra/llrender/lltexture.h
+++ b/indra/llrender/lltexture.h
@@ -57,10 +57,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.
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 6a7cec3bad..0cfc11ef19 100755
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -26,7 +26,7 @@
#include "linden_common.h"
-#include <boost/static_assert.hpp>
+#include "llfasttimer.h"
#include "llsys.h"
#include "llvertexbuffer.h"
// #include "llrender.h"
@@ -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;
}
}
}
@@ -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<LLVector3>& pos, const std::vector<LLVector3>& norm)
{
- LLFastTimer t(FTM_VB_DRAW_ARRAYS);
+ LL_RECORD_BLOCK_TIME(FTM_VB_DRAW_ARRAYS);
llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
gGL.syncMatrices();
@@ -578,13 +578,13 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& 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;
}
@@ -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);
@@ -823,37 +823,37 @@ 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;
}
{
- LLFastTimer t2(FTM_GL_DRAW_ARRAYS);
- stop_glerror();
+ LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS);
+ stop_glerror();
LLGLSLShader::startProfile();
- glDrawArrays(sGLMode[mode], first, count);
+ glDrawArrays(sGLMode[mode], first, count);
LLGLSLShader::stopProfile(count, mode);
- }
+ }
stop_glerror();
placeFence();
@@ -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>("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);
}
}
@@ -1269,7 +1274,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 +1313,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);
@@ -1329,7 +1334,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 +1343,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 +1498,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)
@@ -1502,11 +1507,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 +1548,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)
@@ -1565,7 +1570,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,
@@ -1585,11 +1590,11 @@ 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;
}
}
- 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);
@@ -1636,25 +1641,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;
}
}
}
@@ -1675,19 +1680,19 @@ 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)
{
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 +1726,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 +1742,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;
}
}
@@ -1754,7 +1759,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 +1771,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 +1795,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);
}
@@ -1815,14 +1820,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;
}
}
}
@@ -1841,12 +1846,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 +1864,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 +1905,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 +1935,7 @@ void LLVertexBuffer::unmapBuffer()
if (mMappedIndexData && mIndexLocked)
{
- LLFastTimer t(FTM_IBO_UNMAP);
+ LL_RECORD_BLOCK_TIME(FTM_IBO_UNMAP);
bindGLIndices();
if(!mMappable)
{
@@ -1967,7 +1972,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
@@ -2018,7 +2023,7 @@ template <class T,S32 type> struct VertexBufferStrider
if (ptr == NULL)
{
- llwarns << "mapIndexBuffer failed!" << llendl;
+ LL_WARNS() << "mapIndexBuffer failed!" << LL_ENDL;
return false;
}
@@ -2034,7 +2039,7 @@ template <class T,S32 type> struct VertexBufferStrider
if (ptr == NULL)
{
- llwarns << "mapVertexBuffer failed!" << llendl;
+ LL_WARNS() << "mapVertexBuffer failed!" << LL_ENDL;
return false;
}
@@ -2044,7 +2049,7 @@ template <class T,S32 type> 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;
}
@@ -2111,13 +2116,13 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4>& 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 +2139,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,10 +2149,10 @@ 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)
{
- 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;
@@ -2166,7 +2171,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,10 +2180,10 @@ 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)
{
- 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 +2235,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;
@@ -2248,20 +2253,20 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
U32 unsatisfied_flag = unsatisfied_mask & (1 << i);
switch (unsatisfied_flag)
{
- case MAP_VERTEX: llinfos << "Missing vert pos" << llendl; break;
- case MAP_NORMAL: llinfos << "Missing normals" << llendl; break;
- case MAP_TEXCOORD0: llinfos << "Missing TC 0" << llendl; break;
- case MAP_TEXCOORD1: llinfos << "Missing TC 1" << llendl; break;
- case MAP_TEXCOORD2: llinfos << "Missing TC 2" << llendl; break;
- case MAP_TEXCOORD3: llinfos << "Missing TC 3" << llendl; break;
- case MAP_COLOR: llinfos << "Missing vert color" << llendl; break;
- case MAP_EMISSIVE: llinfos << "Missing emissive" << llendl; break;
- case MAP_TANGENT: llinfos << "Missing tangent" << llendl; break;
- case MAP_WEIGHT: llinfos << "Missing weight" << llendl; break;
- case MAP_WEIGHT4: llinfos << "Missing weightx4" << llendl; break;
- case MAP_CLOTHWEIGHT: llinfos << "Missing clothweight" << llendl; break;
- case MAP_TEXTURE_INDEX: llinfos << "Missing tex index" << llendl; break;
- default: llinfos << "Missing who effin knows: " << unsatisfied_flag << llendl;
+ case MAP_VERTEX: LL_INFOS() << "Missing vert pos" << LL_ENDL; break;
+ case MAP_NORMAL: LL_INFOS() << "Missing normals" << LL_ENDL; break;
+ case MAP_TEXCOORD0: LL_INFOS() << "Missing TC 0" << LL_ENDL; break;
+ case MAP_TEXCOORD1: LL_INFOS() << "Missing TC 1" << LL_ENDL; break;
+ case MAP_TEXCOORD2: LL_INFOS() << "Missing TC 2" << LL_ENDL; break;
+ case MAP_TEXCOORD3: LL_INFOS() << "Missing TC 3" << LL_ENDL; break;
+ case MAP_COLOR: LL_INFOS() << "Missing vert color" << LL_ENDL; break;
+ case MAP_EMISSIVE: LL_INFOS() << "Missing emissive" << LL_ENDL; break;
+ case MAP_TANGENT: LL_INFOS() << "Missing tangent" << LL_ENDL; break;
+ case MAP_WEIGHT: LL_INFOS() << "Missing weight" << LL_ENDL; break;
+ case MAP_WEIGHT4: LL_INFOS() << "Missing weightx4" << LL_ENDL; break;
+ case MAP_CLOTHWEIGHT: LL_INFOS() << "Missing clothweight" << LL_ENDL; break;
+ case MAP_TEXTURE_INDEX: LL_INFOS() << "Missing tex index" << LL_ENDL; break;
+ default: LL_INFOS() << "Missing who effin knows: " << unsatisfied_flag << LL_ENDL;
}
}
@@ -2302,7 +2307,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;
}
}
@@ -2317,7 +2322,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;
}
}
}
@@ -2393,10 +2398,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..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 <set>
#include <vector>
#include <list>
@@ -98,7 +99,7 @@ public:
//============================================================================
// base class
class LLPrivateMemoryPool;
-class LLVertexBuffer : public LLRefCount
+class LLVertexBuffer : public LLRefCount, public LLTrace::MemTrackable<LLVertexBuffer>
{
public:
class MappedRegion
@@ -112,14 +113,15 @@ public:
};
LLVertexBuffer(const LLVertexBuffer& rhs)
- : mUsage(rhs.mUsage)
+ : LLTrace::MemTrackable<LLVertexBuffer>("LLVertexBuffer"),
+ mUsage(rhs.mUsage)
{
*this = rhs;
}
const LLVertexBuffer& operator=(const LLVertexBuffer& rhs)
{
- llerrs << "Illegal operation!" << llendl;
+ LL_ERRS() << "Illegal operation!" << LL_ENDL;
return *this;
}