From 8d20480c5f77fe1fab8149d3cda79bdd61e77656 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 28 Oct 2021 18:06:21 +0000 Subject: SL-16148 SL-16244 SL-16270 SL-16253 Remove most BlockTimers, remove LLMemTracked, introduce alignas, hook most/all reamining allocs, disable synchronous occlusion, and convert frequently accessed LLSingletons to LLSimpleton --- indra/llrender/llfontbitmapcache.cpp | 18 +-------- indra/llrender/llfontbitmapcache.h | 2 +- indra/llrender/llfontfreetype.cpp | 9 +---- indra/llrender/llfontfreetype.h | 2 +- indra/llrender/llfontgl.cpp | 4 +- indra/llrender/llgl.cpp | 1 + indra/llrender/llimagegl.cpp | 43 +++++---------------- indra/llrender/llimagegl.h | 2 +- indra/llrender/llrender2dutils.cpp | 8 ++-- indra/llrender/lltexture.h | 3 +- indra/llrender/llvertexbuffer.cpp | 72 ++++++++++-------------------------- indra/llrender/llvertexbuffer.h | 5 +-- 12 files changed, 42 insertions(+), 127 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp index f128636ab2..c71e24c83a 100644 --- a/indra/llrender/llfontbitmapcache.cpp +++ b/indra/llrender/llfontbitmapcache.cpp @@ -30,8 +30,7 @@ #include "llfontbitmapcache.h" LLFontBitmapCache::LLFontBitmapCache() -: LLTrace::MemTrackable("LLFontBitmapCache"), - mNumComponents(0), +: mNumComponents(0), mBitmapWidth(0), mBitmapHeight(0), mBitmapNum(-1), @@ -124,9 +123,6 @@ 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 { @@ -156,20 +152,8 @@ void LLFontBitmapCache::destroyGL() void LLFontBitmapCache::reset() { - for (std::vector >::iterator it = mImageRawVec.begin(), end_it = mImageRawVec.end(); - it != end_it; - ++it) - { - disclaimMem(**it); - } mImageRawVec.clear(); - for (std::vector >::iterator it = mImageGLVec.begin(), end_it = mImageGLVec.end(); - it != end_it; - ++it) - { - disclaimMem(**it); - } mImageGLVec.clear(); mBitmapWidth = 0; diff --git a/indra/llrender/llfontbitmapcache.h b/indra/llrender/llfontbitmapcache.h index 75df3a94a7..7de3a6b56f 100644 --- a/indra/llrender/llfontbitmapcache.h +++ b/indra/llrender/llfontbitmapcache.h @@ -32,7 +32,7 @@ // Maintain a collection of bitmaps containing rendered glyphs. // Generalizes the single-bitmap logic from LLFontFreetype and LLFontGL. -class LLFontBitmapCache : public LLTrace::MemTrackable +class LLFontBitmapCache { public: LLFontBitmapCache(); diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index e18161e53c..e964d1586f 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -104,8 +104,7 @@ LLFontGlyphInfo::LLFontGlyphInfo(U32 index) } LLFontFreetype::LLFontFreetype() -: LLTrace::MemTrackable("LLFontFreetype"), - mFontBitmapCachep(new LLFontBitmapCache), +: mFontBitmapCachep(new LLFontBitmapCache), mAscender(0.f), mDescender(0.f), mLineHeight(0.f), @@ -222,8 +221,6 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v S32 max_char_height = ll_round(0.5f + (y_max - y_min)); mFontBitmapCachep->init(components, max_char_width, max_char_height); - claimMem(mFontBitmapCachep); - if (!mFTFace->charmap) { @@ -238,7 +235,6 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, F32 point_size, F32 v } mName = filename; - claimMem(mName); mPointSize = point_size; mStyle = LLFontGL::NORMAL; @@ -586,7 +582,6 @@ void LLFontFreetype::insertGlyphInfo(llwchar wch, LLFontGlyphInfo* gi) const } else { - claimMem(gi); mCharGlyphInfoMap[wch] = gi; } } @@ -632,11 +627,9 @@ void LLFontFreetype::resetBitmapCache() 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(). diff --git a/indra/llrender/llfontfreetype.h b/indra/llrender/llfontfreetype.h index 1afe84e770..f61f169987 100644 --- a/indra/llrender/llfontfreetype.h +++ b/indra/llrender/llfontfreetype.h @@ -76,7 +76,7 @@ struct LLFontGlyphInfo extern LLFontManager *gFontManagerp; -class LLFontFreetype : public LLRefCount, public LLTrace::MemTrackable +class LLFontFreetype : public LLRefCount { public: LLFontFreetype(); diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 266399d212..7f734e41f3 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -109,8 +109,6 @@ S32 LLFontGL::getNumFaces(const std::string& filename) return mFontFreetype->getNumFaces(filename); } -static LLTrace::BlockTimerStatHandle FTM_RENDER_FONTS("Fonts"); - S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const { @@ -147,7 +145,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRectf& rec 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 { - LL_RECORD_BLOCK_TIME(FTM_RENDER_FONTS); + LL_PROFILE_ZONE_SCOPED; if(!sDisplayFont) //do not display texts { diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index b66521132c..4f9aa5f979 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -2434,6 +2434,7 @@ void LLGLNamePool::cleanup() GLuint LLGLNamePool::allocate() { + LL_PROFILE_ZONE_SCOPED; #if LL_GL_NAME_POOLING for (name_list_t::iterator iter = mNameList.begin(); iter != mNameList.end(); ++iter) { diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index b5e1910242..09b1c71f02 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -276,11 +276,10 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat) //---------------------------------------------------------------------------- -static LLTrace::BlockTimerStatHandle FTM_IMAGE_UPDATE_STATS("Image Stats"); // static void LLImageGL::updateStats(F32 current_time) { - LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_STATS); + LL_PROFILE_ZONE_SCOPED; sLastFrameTime = current_time; sBoundTextureMemory = sCurBoundTextureMemory; sCurBoundTextureMemory = S32Bytes(0); @@ -313,10 +312,8 @@ 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 ; } } @@ -390,8 +387,7 @@ BOOL LLImageGL::create(LLPointer& dest, const LLImageRaw* imageraw, B //---------------------------------------------------------------------------- LLImageGL::LLImageGL(BOOL usemipmaps) -: LLTrace::MemTrackable("LLImageGL"), - mSaveData(0), mExternalTexture(FALSE) +: mSaveData(0), mExternalTexture(FALSE) { init(usemipmaps); setSize(0, 0, 0); @@ -400,8 +396,7 @@ LLImageGL::LLImageGL(BOOL usemipmaps) } LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) -: LLTrace::MemTrackable("LLImageGL"), - mSaveData(0), mExternalTexture(FALSE) +: mSaveData(0), mExternalTexture(FALSE) { llassert( components <= 4 ); init(usemipmaps); @@ -411,8 +406,7 @@ LLImageGL::LLImageGL(U32 width, U32 height, U8 components, BOOL usemipmaps) } LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps) -: LLTrace::MemTrackable("LLImageGL"), - mSaveData(0), mExternalTexture(FALSE) +: mSaveData(0), mExternalTexture(FALSE) { init(usemipmaps); setSize(0, 0, 0); @@ -430,7 +424,6 @@ LLImageGL::LLImageGL( LLGLenum formatPrimary, LLGLenum formatType, LLTexUnit::eTextureAddressMode addressMode) - : LLTrace::MemTrackable("LLImageGL"), mSaveData(0), mExternalTexture(TRUE) { init(false); mTexName = texName; @@ -682,10 +675,9 @@ void LLImageGL::setImage(const LLImageRaw* imageraw) setImage(rawdata, FALSE); } -static LLTrace::BlockTimerStatHandle FTM_SET_IMAGE("setImage"); BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips, S32 usename) { - LL_RECORD_BLOCK_TIME(FTM_SET_IMAGE); + LL_PROFILE_ZONE_SCOPED; bool is_compressed = false; switch (mFormatPrimary) @@ -746,8 +738,6 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips, S32 usename) } else { -// LL_RECORD_BLOCK_TIME(FTM_TEMP4); - if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); @@ -778,8 +768,6 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips, S32 usename) { stop_glerror(); { -// LL_RECORD_BLOCK_TIME(FTM_TEMP4); - if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); @@ -889,7 +877,6 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips, S32 usename) llassert(w > 0 && h > 0 && cur_mip_data); (void)cur_mip_data; { -// LL_RECORD_BLOCK_TIME(FTM_TEMP4); if(mFormatSwapBytes) { glPixelStorei(GL_UNPACK_SWAP_BYTES, 1); @@ -1203,10 +1190,9 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_ } // static -static LLTrace::BlockTimerStatHandle FTM_GENERATE_TEXTURES("generate textures"); void LLImageGL::generateTextures(S32 numTextures, U32 *textures) { - LL_RECORD_BLOCK_TIME(FTM_GENERATE_TEXTURES); + LL_PROFILE_ZONE_SCOPED; glGenTextures(numTextures, textures); } @@ -1220,10 +1206,9 @@ void LLImageGL::deleteTextures(S32 numTextures, const U32 *textures) } // static -static LLTrace::BlockTimerStatHandle FTM_SET_MANUAL_IMAGE("setManualImage"); void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 width, S32 height, U32 pixformat, U32 pixtype, const void* pixels, bool allow_compression) { - LL_RECORD_BLOCK_TIME(FTM_SET_MANUAL_IMAGE); + LL_PROFILE_ZONE_SCOPED; bool use_scratch = false; U32* scratch = NULL; if (LLRender::sGLCoreProfile) @@ -1338,10 +1323,9 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt //create an empty GL texture: just create a texture name //the texture is assiciate with some image by calling glTexImage outside LLImageGL -static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE1("createGLTexture()"); BOOL LLImageGL::createGLTexture() { - LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE1); + LL_PROFILE_ZONE_SCOPED; if (gGLManager.mIsDisabled) { LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; @@ -1371,10 +1355,9 @@ BOOL LLImageGL::createGLTexture() return TRUE ; } -static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE2("createGLTexture(raw)"); BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename/*=0*/, BOOL to_create, S32 category) { - LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE2); + LL_PROFILE_ZONE_SCOPED; if (gGLManager.mIsDisabled) { LL_WARNS() << "Trying to create a texture while GL is disabled!" << LL_ENDL; @@ -1485,10 +1468,9 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S return createGLTexture(discard_level, rawdata, FALSE, usename); } -static LLTrace::BlockTimerStatHandle FTM_CREATE_GL_TEXTURE3("createGLTexture3(data)"); BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_hasmips, S32 usename) { - LL_RECORD_BLOCK_TIME(FTM_CREATE_GL_TEXTURE3); + LL_PROFILE_ZONE_SCOPED; llassert(data_in); stop_glerror(); @@ -1595,9 +1577,7 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const U8* data_in, BOOL data_ mNewTexName = 0; } - disclaimMem(mTextureMemory); mTextureMemory = (S32Bytes)getMipBytes(mCurrentDiscardLevel); - claimMem(mTextureMemory); sGlobalTextureMemory += mTextureMemory; mTexelsInGLTexture = getWidth() * getHeight(); @@ -1735,7 +1715,6 @@ void LLImageGL::destroyGLTexture() if(mTextureMemory != S32Bytes(0)) { sGlobalTextureMemory -= mTextureMemory; - disclaimMem(mTextureMemory); mTextureMemory = (S32Bytes)0; } @@ -2088,7 +2067,6 @@ U32 LLImageGL::createPickMask(S32 pWidth, S32 pHeight) 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; @@ -2103,7 +2081,6 @@ void LLImageGL::freePickMask() // pickmask validity depends on old image size, delete it if (mPickMask != NULL) { - disclaimMem((mPickMaskWidth * mPickMaskHeight + 7) / 8); delete [] mPickMask; } mPickMask = NULL; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index da626a1093..95b60bd0bd 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -46,7 +46,7 @@ class LLWindow; #define MEGA_BYTES_TO_BYTES(x) ((x) << 20) //============================================================================ -class LLImageGL : public LLRefCount, public LLTrace::MemTrackable +class LLImageGL : public LLRefCount { friend class LLTexUnit; public: diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index dd34f3e383..5a942996be 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -1083,8 +1083,6 @@ void gl_rect_2d_simple( S32 width, S32 height ) gGL.end(); } -static LLTrace::BlockTimerStatHandle FTM_RENDER_SEGMENTED_RECT ("Render segmented rectangle"); - void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, @@ -1094,7 +1092,7 @@ void gl_segmented_rect_2d_tex(const S32 left, const S32 border_size, const U32 edges) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT); + LL_PROFILE_ZONE_SCOPED; S32 width = llabs(right - left); S32 height = llabs(top - bottom); @@ -1253,7 +1251,7 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect, const F32 end_fragment, const U32 edges) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT); + LL_PROFILE_ZONE_SCOPED; const S32 left = rect.mLeft; const S32 right = rect.mRight; const S32 top = rect.mTop; @@ -1440,7 +1438,7 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect, void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv_rect, const LLRectf& center_draw_rect, const LLVector3& width_vec, const LLVector3& height_vec) { - LL_RECORD_BLOCK_TIME(FTM_RENDER_SEGMENTED_RECT); + LL_PROFILE_ZONE_SCOPED; gGL.begin(LLRender::QUADS); { diff --git a/indra/llrender/lltexture.h b/indra/llrender/lltexture.h index 256d85ce5a..e890a5a30b 100644 --- a/indra/llrender/lltexture.h +++ b/indra/llrender/lltexture.h @@ -42,7 +42,7 @@ class LLFontGL ; // //this is an abstract class as the parent for the class LLGLTexture // -class LLTexture : public virtual LLRefCount, public LLTrace::MemTrackable +class LLTexture : public virtual LLRefCount { friend class LLTexUnit ; friend class LLFontGL ; @@ -52,7 +52,6 @@ protected: public: LLTexture() - : LLTrace::MemTrackable("LLTexture") {} // diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 7e726df907..5ea07ddcb1 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -805,13 +805,15 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const placeFence(); } -static LLTrace::BlockTimerStatHandle FTM_GL_DRAW_ARRAYS("GL draw arrays"); + void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const { + LL_PROFILE_ZONE_SCOPED; llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); mMappable = false; gGL.syncMatrices(); +#ifndef LL_RELEASE_FOR_DOWNLOAD llassert(mNumVerts >= 0); if (first >= (U32)mNumVerts || first + count > (U32)mNumVerts) @@ -839,16 +841,11 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const LL_ERRS() << "Invalid draw mode: " << mode << LL_ENDL; return; } +#endif { - LL_RECORD_BLOCK_TIME(FTM_GL_DRAW_ARRAYS); - stop_glerror(); - LLGLSLShader::startProfile(); - stop_glerror(); LL_PROFILER_GPU_ZONEC("gl.DrawArrays", 0xFF4040) glDrawArrays(sGLMode[mode], first, count); - stop_glerror(); - LLGLSLShader::stopProfile(count, mode); } stop_glerror(); @@ -949,8 +946,7 @@ S32 LLVertexBuffer::determineUsage(S32 usage) } LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) -: LLTrace::MemTrackable("LLVertexBuffer"), - LLRefCount(), +: LLRefCount(), mNumVerts(0), mNumIndices(0), @@ -1095,9 +1091,7 @@ void LLVertexBuffer::waitFence() const void LLVertexBuffer::genBuffer(U32 size) { - disclaimMem(mSize); mSize = vbo_block_size(size); - claimMem(mSize); if (mUsage == GL_STREAM_DRAW_ARB) { @@ -1193,9 +1187,7 @@ bool LLVertexBuffer::createGLBuffer(U32 size) static int gl_buffer_idx = 0; mGLBuffer = ++gl_buffer_idx; mMappedData = (U8*)ll_aligned_malloc_16(size); - disclaimMem(mSize); mSize = size; - claimMem(mSize); } if (!mMappedData) @@ -1365,8 +1357,6 @@ bool LLVertexBuffer::allocateBuffer(S32 nverts, S32 nindices, bool create) return success; } -static LLTrace::BlockTimerStatHandle FTM_SETUP_VERTEX_ARRAY("Setup VAO"); - void LLVertexBuffer::setupVertexArray() { if (!mGLArray) @@ -1374,7 +1364,7 @@ void LLVertexBuffer::setupVertexArray() return; } - LL_RECORD_BLOCK_TIME(FTM_SETUP_VERTEX_ARRAY); + LL_PROFILE_ZONE_SCOPED; #if GL_ARB_vertex_array_object glBindVertexArray(mGLArray); #endif @@ -1547,12 +1537,11 @@ bool expand_region(LLVertexBuffer::MappedRegion& region, S32 index, S32 count) return true; } -static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_BUFFER_RANGE("VBO Map Range"); -static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_BUFFER("VBO Map"); // Map for data access volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range) { + LL_PROFILE_ZONE_SCOPED; bindGLBuffer(true); if (mFinal) { @@ -1619,7 +1608,6 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo if (map_range) { #ifdef GL_ARB_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, @@ -1643,7 +1631,6 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo } } - 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); @@ -1729,11 +1716,9 @@ volatile U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, boo } -static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_INDEX_RANGE("IBO Map Range"); -static LLTrace::BlockTimerStatHandle FTM_VBO_MAP_INDEX("IBO Map"); - volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) { + LL_PROFILE_ZONE_SCOPED; bindGLIndices(true); if (mFinal) { @@ -1808,7 +1793,6 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range if (map_range) { #ifdef GL_ARB_map_buffer_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, @@ -1820,7 +1804,6 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range else { #ifdef GL_ARB_map_buffer_range - 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); @@ -1844,7 +1827,6 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range } else { - LL_RECORD_BLOCK_TIME(FTM_VBO_MAP_INDEX); map_range = false; src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } @@ -1895,13 +1877,6 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range } } -static LLTrace::BlockTimerStatHandle FTM_VBO_UNMAP("VBO Unmap"); -static LLTrace::BlockTimerStatHandle FTM_VBO_FLUSH_RANGE("Flush VBO Range"); - - -static LLTrace::BlockTimerStatHandle FTM_IBO_UNMAP("IBO Unmap"); -static LLTrace::BlockTimerStatHandle FTM_IBO_FLUSH_RANGE("Flush IBO Range"); - void LLVertexBuffer::unmapBuffer() { if (!useVBOs()) @@ -1910,10 +1885,10 @@ void LLVertexBuffer::unmapBuffer() } bool updated_all = false; - + LL_PROFILE_ZONE_SCOPED; if (mMappedData && mVertexLocked) { - LL_RECORD_BLOCK_TIME(FTM_VBO_UNMAP); + LL_PROFILE_ZONE_NAMED("unmapBuffer - vertex"); bindGLBuffer(true); updated_all = mIndexLocked; //both vertex and index buffers done updating @@ -1960,7 +1935,7 @@ void LLVertexBuffer::unmapBuffer() { if (!mMappedVertexRegions.empty()) { - stop_glerror(); + LL_PROFILE_ZONE_NAMED("unmapBuffer - flush vertex"); for (U32 i = 0; i < mMappedVertexRegions.size(); ++i) { const MappedRegion& region = mMappedVertexRegions[i]; @@ -1968,18 +1943,16 @@ void LLVertexBuffer::unmapBuffer() S32 length = sTypeSize[region.mType]*region.mCount; if (gGLManager.mHasMapBufferRange) { - LL_RECORD_BLOCK_TIME(FTM_VBO_FLUSH_RANGE); #ifdef GL_ARB_map_buffer_range glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length); #endif } else if (gGLManager.mHasFlushBufferRange) - { + { #ifndef LL_MESA_HEADLESS glFlushMappedBufferRangeAPPLE(GL_ARRAY_BUFFER_ARB, offset, length); #endif } - stop_glerror(); } mMappedVertexRegions.clear(); @@ -1998,7 +1971,7 @@ void LLVertexBuffer::unmapBuffer() if (mMappedIndexData && mIndexLocked) { - LL_RECORD_BLOCK_TIME(FTM_IBO_UNMAP); + LL_PROFILE_ZONE_NAMED("unmapBuffer - index"); bindGLIndices(); if(!mMappable) { @@ -2044,12 +2017,12 @@ void LLVertexBuffer::unmapBuffer() { for (U32 i = 0; i < mMappedIndexRegions.size(); ++i) { + LL_PROFILE_ZONE_NAMED("unmapBuffer - flush index"); const MappedRegion& region = mMappedIndexRegions[i]; S32 offset = region.mIndex >= 0 ? sizeof(U16)*region.mIndex : 0; S32 length = sizeof(U16)*region.mCount; if (gGLManager.mHasMapBufferRange) { - LL_RECORD_BLOCK_TIME(FTM_IBO_FLUSH_RANGE); #ifdef GL_ARB_map_buffer_range glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length); #endif @@ -2068,9 +2041,8 @@ void LLVertexBuffer::unmapBuffer() mMappedIndexRegions.clear(); } } - stop_glerror(); - glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); - stop_glerror(); + + glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); mMappedIndexData = NULL; } @@ -2193,13 +2165,12 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider& strider, S32 in //---------------------------------------------------------------------------- -static LLTrace::BlockTimerStatHandle FTM_BIND_GL_ARRAY("Bind Array"); bool LLVertexBuffer::bindGLArray() { if (mGLArray && sGLRenderArray != mGLArray) { { - LL_RECORD_BLOCK_TIME(FTM_BIND_GL_ARRAY); + LL_PROFILE_ZONE_SCOPED; #if GL_ARB_vertex_array_object glBindVertexArray(mGLArray); #endif @@ -2216,8 +2187,6 @@ bool LLVertexBuffer::bindGLArray() return false; } -static LLTrace::BlockTimerStatHandle FTM_BIND_GL_BUFFER("Bind Buffer"); - bool LLVertexBuffer::bindGLBuffer(bool force_bind) { bindGLArray(); @@ -2226,8 +2195,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind) if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive)))) { - //LL_RECORD_BLOCK_TIME(FTM_BIND_GL_BUFFER); - + LL_PROFILE_ZONE_SCOPED; glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer); sGLRenderBuffer = mGLBuffer; sBindCount++; @@ -2256,16 +2224,14 @@ bool LLVertexBuffer::bindGLBufferFast() return false; } -static LLTrace::BlockTimerStatHandle FTM_BIND_GL_INDICES("Bind Indices"); - bool LLVertexBuffer::bindGLIndices(bool force_bind) { + LL_PROFILE_ZONE_SCOPED; bindGLArray(); bool ret = false; if (useVBOs() && (force_bind || (mGLIndices && (mGLIndices != sGLRenderIndices || !sIBOActive)))) { - LL_RECORD_BLOCK_TIME(FTM_BIND_GL_INDICES); /*if (sMapped) { LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL; diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h index fad474a143..1b400b3aad 100644 --- a/indra/llrender/llvertexbuffer.h +++ b/indra/llrender/llvertexbuffer.h @@ -98,7 +98,7 @@ public: //============================================================================ // base class class LLPrivateMemoryPool; -class LLVertexBuffer : public LLRefCount, public LLTrace::MemTrackable +class LLVertexBuffer : public LLRefCount { public: class MappedRegion @@ -113,8 +113,7 @@ public: }; LLVertexBuffer(const LLVertexBuffer& rhs) - : LLTrace::MemTrackable("LLVertexBuffer"), - mUsage(rhs.mUsage) + : mUsage(rhs.mUsage) { *this = rhs; } -- cgit v1.2.3