Memory tracking system updated.

This commit is contained in:
Shyotl
2012-01-29 01:33:14 -06:00
parent 32c6365bf9
commit 9453c2c2e9
25 changed files with 1248 additions and 486 deletions

View File

@@ -8043,6 +8043,17 @@
<key>Value</key>
<integer>512</integer>
</map>
<key>MemProfiling</key>
<map>
<key>Comment</key>
<string>You want to use tcmalloc's memory profiling options.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>MenuAccessKeyTime</key>
<map>
<key>Comment</key>

View File

@@ -630,6 +630,8 @@ bool LLAppViewer::init()
initMaxHeapSize() ;
LLPrivateMemoryPoolManager::initClass((BOOL)gSavedSettings.getBOOL("MemoryPrivatePoolEnabled"), (U32)gSavedSettings.getU32("MemoryPrivatePoolSize")) ;
mAlloc.setProfilingEnabled(gSavedSettings.getBOOL("MemProfiling"));
// *NOTE:Mani - LLCurl::initClass is not thread safe.
// Called before threads are created.
LLCurl::initClass(gSavedSettings.getBOOL("CurlUseMultipleThreads"));
@@ -1023,8 +1025,10 @@ static LLFastTimer::DeclareTimer FTM_PUMP_SERVICE("Service");
static LLFastTimer::DeclareTimer FTM_SERVICE_CALLBACK("Callback");
static LLFastTimer::DeclareTimer FTM_AGENT_AUTOPILOT("Autopilot");
static LLFastTimer::DeclareTimer FTM_AGENT_UPDATE("Update");
bool LLAppViewer::mainLoop()
{
LLMemType mt1(LLMemType::MTYPE_MAIN);
mMainloopTimeout = new LLWatchdogTimeout();
// *FIX:Mani - Make this a setting, once new settings exist in this branch.
@@ -1042,7 +1046,6 @@ bool LLAppViewer::mainLoop()
LLVoiceChannel::initClass();
LLVoiceClient::init(gServicePump);
LLMemType mt1(LLMemType::MTYPE_MAIN);
LLTimer frameTimer,idleTimer;
LLTimer debugTime;
LLFrameTimer memCheckTimer;
@@ -1115,6 +1118,7 @@ bool LLAppViewer::mainLoop()
&& !gViewerWindow->getShowProgress()
&& !gFocusMgr.focusLocked())
{
LLMemType mjk(LLMemType::MTYPE_JOY_KEY);
joystick->scanJoystick();
gKeyboard->scanKeyboard();
if(isCrouch)
@@ -1134,6 +1138,7 @@ bool LLAppViewer::mainLoop()
if (gAres != NULL && gAres->isInitialized())
{
LLMemType mt_ip(LLMemType::MTYPE_IDLE_PUMP);
pingMainloopTimeout("Main:ServicePump");
LLFastTimer t4(FTM_PUMP);
{
@@ -1188,6 +1193,7 @@ bool LLAppViewer::mainLoop()
// Sleep and run background threads
{
LLMemType mt_sleep(LLMemType::MTYPE_SLEEP);
LLFastTimer t2(FTM_SLEEP);
static const LLCachedControl<bool> run_multiple_threads("RunMultipleThreads",false);
@@ -3707,6 +3713,7 @@ static LLFastTimer::DeclareTimer FTM_VLMANAGER("VL Manager");
///////////////////////////////////////////////////////
void LLAppViewer::idle()
{
LLMemType mt_idle(LLMemType::MTYPE_IDLE);
pingMainloopTimeout("Main:Idle");
// Update frame timers
@@ -4287,6 +4294,7 @@ static LLFastTimer::DeclareTimer FTM_DYNAMIC_THROTTLE("Dynamic Throttle");
static LLFastTimer::DeclareTimer FTM_CHECK_REGION_CIRCUIT("Check Region Circuit");
void LLAppViewer::idleNetwork()
{
LLMemType mt_in(LLMemType::MTYPE_IDLE_NETWORK);
pingMainloopTimeout("idleNetwork");
gObjectList.mNumNewObjects = 0;

View File

@@ -33,7 +33,8 @@
#ifndef LL_LLAPPVIEWER_H
#define LL_LLAPPVIEWER_H
#include "llsys.h" // LLOSInfo
#include "llallocator.h"
#include "llsys.h" // for LLOSInfo
#include "llviewercontrol.h" // settings_map_type
class LLTextureCache;
@@ -158,6 +159,7 @@ public:
// *NOTE:Mani Fix this for login abstraction!!
void handleLoginComplete();
LLAllocator & getAllocator() { return mAlloc; }
void addOnIdleCallback(const boost::function<void()>& cb); // add a callback to fire (once) when idle
void purgeCache(); // Clear the local cache.
@@ -245,6 +247,7 @@ private:
bool mAgentRegionLastAlive;
LLUUID mAgentRegionLastID;
LLAllocator mAlloc;
LLFrameTimer mMemCheckTimer;

View File

@@ -32,37 +32,28 @@
#include "llviewerprecompiledheaders.h"
#include "indra_constants.h"
#include "llmemoryview.h"
#include "llrect.h"
#include "llerror.h"
#include "llgl.h"
#include "llmath.h"
#include "llfontgl.h"
#include "llmemtype.h"
#include "llcharacter.h"
#include "llui.h"
#include "llappviewer.h"
#include "llallocator_heap_profile.h"
#include "llgl.h" // LLGLSUIDefault
#include "llviewerwindow.h"
#include "llviewercontrol.h"
#include "llstat.h"
#include "llfasttimer.h"
#include <sstream>
#include <boost/algorithm/string/split.hpp>
#include "llmemory.h"
LLMemoryView::LLMemoryView(const std::string& name, const LLRect& rect)
: LLView(name, rect, TRUE),
mDelay(120)
mPaused(FALSE),
//mDelay(120),
mAlloc(NULL)
{
setVisible(FALSE);
mDumpTimer.reset();
#ifdef MEM_DUMP_DATA
// clear out file.
LLFILE *dump = LLFile::fopen("memusagedump.txt", "w");
fclose(dump);
#endif
}
LLMemoryView::~LLMemoryView()
@@ -79,6 +70,7 @@ BOOL LLMemoryView::handleMouseDown(S32 x, S32 y, MASK mask)
}
else
{
mPaused = !mPaused;
}
return TRUE;
}
@@ -94,62 +86,143 @@ BOOL LLMemoryView::handleHover(S32 x, S32 y, MASK mask)
return FALSE;
}
//////////////////////////////////////////////////////////////////////////////
struct mtv_display_info {
S32 memtype;
const char *desc;
const LLColor4 *color;
};
static const LLColor4 red0(0.5f, 0.0f, 0.0f, 1.0f);
static const struct mtv_display_info mtv_display_table[] =
void LLMemoryView::refreshProfile()
{
{ LLMemType::MTYPE_INIT, "Init", &LLColor4::white },
{ LLMemType::MTYPE_STARTUP, "Startup", &LLColor4::cyan1 },
{ LLMemType::MTYPE_MAIN, "Main", &LLColor4::cyan2 },
{ LLMemType::MTYPE_IMAGEBASE, "ImageBase", &LLColor4::yellow1 },
{ LLMemType::MTYPE_IMAGERAW, "ImageRaw", &LLColor4::yellow2 },
{ LLMemType::MTYPE_IMAGEFORMATTED, "ImageFmtd", &LLColor4::yellow3 },
{ LLMemType::MTYPE_APPFMTIMAGE, "ViewerImageFmt", &LLColor4::orange1 },
{ LLMemType::MTYPE_APPRAWIMAGE, "ViewerImageRaw", &LLColor4::orange2 },
{ LLMemType::MTYPE_APPAUXRAWIMAGE, "ViewerImageAux", &LLColor4::orange3 },
{ LLMemType::MTYPE_DRAWABLE, "Drawable", &LLColor4::green1 },
{ LLMemType::MTYPE_OBJECT, "ViewerObject", &LLColor4::green2 },
{ LLMemType::MTYPE_PIPELINE, "Pipeline", &LLColor4::green3 },
{ LLMemType::MTYPE_PARTICLES, "Particles", &LLColor4::green4 },
{ LLMemType::MTYPE_SPACE_PARTITION, "Space Partition", &LLColor4::blue2 },
{ LLMemType::MTYPE_VERTEX_DATA, "Vertex Buffer", &LLColor4::blue3 },
{ LLMemType::MTYPE_AVATAR, "Avatar", &LLColor4::purple1 },
{ LLMemType::MTYPE_AVATAR_MESH, "Avatar Mesh", &LLColor4::purple2 },
{ LLMemType::MTYPE_ANIMATION, "Animation", &LLColor4::purple3 },
{ LLMemType::MTYPE_REGIONS, "Regions", &LLColor4::blue1 },
{ LLMemType::MTYPE_VOLUME, "Volume", &LLColor4::pink1 },
{ LLMemType::MTYPE_PRIMITIVE, "Profile", &LLColor4::pink2 },
{ LLMemType::MTYPE_TEMP1, "Temp1", &LLColor4::red1 },
{ LLMemType::MTYPE_TEMP2, "Temp2", &LLColor4::magenta1 },
{ LLMemType::MTYPE_TEMP3, "Temp3", &LLColor4::red2 },
{ LLMemType::MTYPE_TEMP4, "Temp4", &LLColor4::magenta2 },
{ LLMemType::MTYPE_TEMP5, "Temp5", &LLColor4::red3 },
{ LLMemType::MTYPE_TEMP6, "Temp6", &LLColor4::magenta3 },
{ LLMemType::MTYPE_TEMP7, "Temp7", &LLColor4::red4 },
{ LLMemType::MTYPE_TEMP8, "Temp8", &LLColor4::magenta4 },
/*
LLAllocator & alloc = LLAppViewer::instance()->getAllocator();
if(alloc.isProfiling()) {
std::string profile_text = alloc.getRawProfile();
{ LLMemType::MTYPE_OTHER, "Other", &red0 },
};
static const int MTV_DISPLAY_NUM = LL_ARRAY_SIZE(mtv_display_table);
boost::algorithm::split(mLines, profile_text, boost::bind(std::equal_to<llwchar>(), '\n', _1));
} else {
mLines.clear();
}
*/
if (mAlloc == NULL) {
mAlloc = &LLAppViewer::instance()->getAllocator();
}
mLines.clear();
if(mAlloc->isProfiling())
{
const LLAllocatorHeapProfile &prof = mAlloc->getProfile();
for(size_t i = 0; i < prof.mLines.size(); ++i)
{
std::stringstream ss;
ss << "Unfreed Mem: " << (prof.mLines[i].mLiveSize >> 20) << " M Trace: ";
for(size_t k = 0; k < prof.mLines[i].mTrace.size(); ++k)
{
ss << LLMemType::getNameFromID(prof.mLines[i].mTrace[k]) << " ";
}
mLines.push_back(utf8string_to_wstring(ss.str()));
}
}
}
void LLMemoryView::draw()
{
std::string tdesc;
S32 width = getRect().getWidth();
S32 height = getRect().getHeight();
const S32 UPDATE_INTERVAL = 60;
const S32 MARGIN_AMT = 10;
static S32 curUpdate = UPDATE_INTERVAL;
static LLColor4 s_console_color = gColors.getColor("ConsoleBackground");
// setup update interval
if (curUpdate >= UPDATE_INTERVAL)
{
refreshProfile();
curUpdate = 0;
}
curUpdate++;
// setup window properly
S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f);
S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.9f);
setRect(LLRect().setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height));
// setup window color
F32 console_opacity = llclamp(gSavedSettings.getF32("ConsoleBackgroundOpacity"), 0.f, 1.f);
LLColor4 color = s_console_color;
color.mV[VALPHA] *= console_opacity;
LLGLSUIDefault gls_ui;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gl_rect_2d(0, height, width, 0, LLColor4(0.f, 0.f, 0.f, 0.25f));
gl_rect_2d(0, height, width, 0, color);
LLFontGL * font = LLFontGL::getFontSansSerifSmall();
// draw remaining lines
F32 y_pos = 0.f;
F32 y_off = 0.f;
F32 line_height = font->getLineHeight();
S32 target_width = width - 2 * MARGIN_AMT;
// cut off lines on bottom
U32 max_lines = U32((height - 2 * line_height) / line_height);
y_pos = height - MARGIN_AMT - line_height;
y_off = 0.f;
#if !MEM_TRACK_MEM
std::vector<LLWString>::const_iterator end = mLines.end();
if(mLines.size() > max_lines) {
end = mLines.begin() + max_lines;
}
for (std::vector<LLWString>::const_iterator i = mLines.begin(); i != end; ++i)
{
font->render(*i, 0, MARGIN_AMT, y_pos - y_off,
LLColor4::white,
LLFontGL::LEFT,
LLFontGL::BASELINE,
LLFontGL::NORMAL,
LLFontGL::DROP_SHADOW,
S32_MAX,
target_width
);
y_off += line_height;
}
#else
LLMemTracker::getInstance()->preDraw(mPaused) ;
{
F32 x_pos = MARGIN_AMT ;
U32 lines = 0 ;
const char* str = LLMemTracker::getInstance()->getNextLine() ;
while(str != NULL)
{
lines++ ;
font->renderUTF8(str, 0, x_pos, y_pos - y_off,
LLColor4::white,
LLFontGL::LEFT,
LLFontGL::BASELINE,
LLFontGL::NORMAL,
LLFontGL::DROP_SHADOW,
S32_MAX,
target_width,
NULL, FALSE);
str = LLMemTracker::getInstance()->getNextLine() ;
y_off += line_height;
if(lines >= max_lines)
{
lines = 0 ;
x_pos += 512.f ;
if(x_pos + 512.f > target_width)
{
break ;
}
y_pos = height - MARGIN_AMT - line_height;
y_off = 0.f;
}
}
}
LLMemTracker::getInstance()->postDraw() ;
#endif
#if MEM_TRACK_TYPE
S32 left, top, right, bottom;
@@ -267,40 +340,3 @@ void LLMemoryView::draw()
LLView::draw();
}
void LLMemoryView::setDataDumpInterval(float delay)
{
mDelay = delay;
}
void LLMemoryView::dumpData()
{
#if MEM_TRACK_TYPE && MEM_DUMP_DATA
if (mDelay && (mDumpTimer.getElapsedTimeF32() > mDelay ))
{
// reset timer
mDumpTimer.reset();
// append dump info to text file
LLFILE *dump = LLFile::fopen("memusagedump.txt", "a");
if (dump)
{
// write out total memory usage
fprintf (dump, "Total memory in use = %09d (%03d MB)\n", LLMemType::sTotalMem, LLMemType::sTotalMem>>20);
fprintf (dump, "High Water Mark = %09d (%03d MB)\n\n", LLMemType::sMaxTotalMem, LLMemType::sMaxTotalMem>>20);
// dump out usage of 'new' for each memory type
for (S32 i=0; i<LLMemType::MTYPE_NUM_TYPES; i++)
{
if (LLMemType::sMemCount[i])
{
std::string outData = llformat("MEM: % 20s %09d %03d MB (%09d %03d MB) in %06d News", LLMemType::sTypeDesc[i], LLMemType::sMemCount[i], LLMemType::sMemCount[i]>>20, LLMemType::sMaxMemCount[i], LLMemType::sMaxMemCount[i]>>20, LLMemType::sNewCount[i]);
fprintf (dump, "%s\n", outData.c_str());
}
}
fprintf (dump, "\n\n");
fclose(dump);
}
}
#endif
}

View File

@@ -35,6 +35,8 @@
#include "llview.h"
class LLAllocator;
class LLMemoryView : public LLView
{
public:
@@ -46,14 +48,13 @@ public:
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual void draw();
private:
void setDataDumpInterval(float delay);
void dumpData();
float mDelay;
LLFrameTimer mDumpTimer;
void refreshProfile();
private:
std::vector<LLWString> mLines;
LLAllocator* mAlloc;
BOOL mPaused ;
};
#endif

View File

@@ -946,14 +946,14 @@ void init_client_menu(LLMenuGL* menu)
&get_visibility,
(void*)gDebugView->mFastTimerView,
'9', MASK_CONTROL|MASK_SHIFT ) );
#if MEM_TRACK_MEM
//#if MEM_TRACK_MEM
sub->append(new LLMenuItemCheckGL("Memory",
&toggle_visibility,
NULL,
&get_visibility,
(void*)gDebugView->mMemoryView,
'0', MASK_CONTROL|MASK_SHIFT ) );
#endif
//#endif
sub->appendSeparator();

View File

@@ -388,7 +388,7 @@ LLPipeline::LLPipeline() :
void LLPipeline::init()
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_INIT);
refreshCachedSettings();
@@ -868,6 +868,7 @@ void LLPipeline::releaseScreenBuffers()
void LLPipeline::createGLBuffers()
{
stop_glerror();
LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_CREATE_BUFFERS);
assertInitialized();
updateRenderDeferred();
@@ -982,6 +983,7 @@ void LLPipeline::createGLBuffers()
void LLPipeline::restoreGL()
{
LLMemType mt_cb(LLMemType::MTYPE_PIPELINE_RESTORE_GL);
assertInitialized();
if (mVertexShadersEnabled)
@@ -1043,6 +1045,7 @@ BOOL LLPipeline::canUseAntiAliasing() const
void LLPipeline::unloadShaders()
{
LLMemType mt_us(LLMemType::MTYPE_PIPELINE_UNLOAD_SHADERS);
LLViewerShaderMgr::instance()->unloadShaders();
mVertexShadersLoaded = 0;
@@ -1074,6 +1077,7 @@ S32 LLPipeline::getMaxLightingDetail() const
S32 LLPipeline::setLightingDetail(S32 level)
{
LLMemType mt_ld(LLMemType::MTYPE_PIPELINE_LIGHTING_DETAIL);
refreshCachedSettings();
if (level < 0)
@@ -1264,7 +1268,7 @@ LLDrawPool* LLPipeline::getPoolFromTE(const LLTextureEntry* te, LLViewerTexture*
//static
U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* imagep)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt_gpt(LLMemType::MTYPE_PIPELINE_GET_POOL_TYPE);
if (!te || !imagep)
{
@@ -1294,7 +1298,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
void LLPipeline::addPool(LLDrawPool *new_poolp)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt_a(LLMemType::MTYPE_PIPELINE_ADD_POOL);
assertInitialized();
mPools.insert(new_poolp);
addToQuickLookup( new_poolp );
@@ -1306,7 +1310,7 @@ void LLPipeline::allocDrawable(LLViewerObject *vobj)
{
llerrs << "Null object passed to allocDrawable!" << llendl;
}
LLMemType mt(LLMemType::MTYPE_DRAWABLE);
LLMemType mt_ad(LLMemType::MTYPE_PIPELINE_ALLOCATE_DRAWABLE);
LLDrawable *drawable = new LLDrawable();
vobj->mDrawable = drawable;
@@ -1399,7 +1403,7 @@ U32 LLPipeline::addObject(LLViewerObject *vobj)
{
return 0;
}
LLMemType mt_ao(LLMemType::MTYPE_PIPELINE_ADD_OBJECT);
static const LLCachedControl<bool> render_delay_creation("RenderDelayCreation",false);
if (!vobj->isAvatar() && render_delay_creation)
{
@@ -1416,7 +1420,7 @@ U32 LLPipeline::addObject(LLViewerObject *vobj)
void LLPipeline::createObjects(F32 max_dtime)
{
LLFastTimer ftm(FTM_GEO_UPDATE);
LLMemType mt(LLMemType::MTYPE_DRAWABLE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_CREATE_OBJECTS);
LLTimer update_timer;
@@ -1591,7 +1595,7 @@ static LLFastTimer::DeclareTimer FTM_UPDATE_MOVE("Update Move");
void LLPipeline::updateMove()
{
LLFastTimer t(FTM_UPDATE_MOVE);
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt_um(LLMemType::MTYPE_PIPELINE_UPDATE_MOVE);
static const LLCachedControl<bool> freeze_time("FreezeTime",false);
if (freeze_time)
@@ -1945,7 +1949,7 @@ static LLFastTimer::DeclareTimer FTM_CULL("Object Culling");
void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip, LLPlane* planep)
{
LLFastTimer t(FTM_CULL);
LLMemType mt_uc(LLMemType::MTYPE_PIPELINE);
LLMemType mt_uc(LLMemType::MTYPE_PIPELINE_UPDATE_CULL);
grabReferences(result);
@@ -2314,7 +2318,7 @@ void LLPipeline::rebuildGroups()
void LLPipeline::updateGeom(F32 max_dtime)
{
LLTimer update_timer;
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_UPDATE_GEOM);
LLPointer<LLDrawable> drawablep;
LLFastTimer t(FTM_GEO_UPDATE);
@@ -2417,7 +2421,7 @@ void LLPipeline::updateGeom(F32 max_dtime)
void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_MARK_VISIBLE);
if(drawablep && !drawablep->isDead())
{
@@ -2462,7 +2466,7 @@ void LLPipeline::markVisible(LLDrawable *drawablep, LLCamera& camera)
void LLPipeline::markMoved(LLDrawable *drawablep, BOOL damped_motion)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt_mm(LLMemType::MTYPE_PIPELINE_MARK_MOVED);
if (!drawablep)
{
@@ -2508,7 +2512,7 @@ void LLPipeline::markMoved(LLDrawable *drawablep, BOOL damped_motion)
void LLPipeline::markShift(LLDrawable *drawablep)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_MARK_SHIFT);
if (!drawablep || drawablep->isDead())
{
@@ -2531,7 +2535,7 @@ void LLPipeline::markShift(LLDrawable *drawablep)
void LLPipeline::shiftObjects(const LLVector3 &offset)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_SHIFT_OBJECTS);
assertInitialized();
@@ -2575,7 +2579,7 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)
void LLPipeline::markTextured(LLDrawable *drawablep)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_MARK_TEXTURED);
if (drawablep && !drawablep->isDead() && assertInitialized())
{
@@ -2666,7 +2670,7 @@ void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority)
void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags flag, BOOL priority)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_MARK_REBUILD);
if (drawablep && !drawablep->isDead() && assertInitialized())
{
@@ -2714,7 +2718,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
}
LLFastTimer ftm(FTM_STATESORT);
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT);
//LLVertexBuffer::unbind();
@@ -2815,7 +2819,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT);
if (!sSkipUpdate && group->changeLOD())
{
for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
@@ -2834,7 +2838,7 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)
void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT);
if (/*!sShadowRender && */!sSkipUpdate && bridge->getSpatialGroup()->changeLOD())
{
bool force_update = false;
@@ -2844,7 +2848,7 @@ void LLPipeline::stateSort(LLSpatialBridge* bridge, LLCamera& camera)
void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT);
if (!drawablep
|| drawablep->isDead()
@@ -3093,7 +3097,7 @@ void renderSoundHighlights(LLDrawable* drawablep)
void LLPipeline::postSort(LLCamera& camera)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_POST_SORT);
LLFastTimer ftm(FTM_STATESORT_POSTSORT);
assertInitialized();
@@ -3333,6 +3337,7 @@ void LLPipeline::postSort(LLCamera& camera)
void render_hud_elements()
{
LLMemType mt_rhe(LLMemType::MTYPE_PIPELINE_RENDER_HUD_ELS);
LLFastTimer t(FTM_RENDER_UI);
gPipeline.disableLights();
@@ -3352,25 +3357,22 @@ void render_hud_elements()
}
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
{
if(!LLPipeline::sReflectionRender)
{
static const LLCachedControl<U32> RenderFSAASamples("RenderFSAASamples",0);
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d()
static const LLCachedControl<U32> RenderFSAASamples("RenderFSAASamples",0);
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d()
// Draw the tracking overlays
LLTracker::render3D();
// Draw the tracking overlays
LLTracker::render3D();
// Show the property lines
LLWorld::getInstance()->renderPropertyLines();
LLViewerParcelMgr::getInstance()->render();
LLViewerParcelMgr::getInstance()->renderParcelCollision();
// Show the property lines
LLWorld::getInstance()->renderPropertyLines();
LLViewerParcelMgr::getInstance()->render();
LLViewerParcelMgr::getInstance()->renderParcelCollision();
// Render name tags.
LLHUDObject::renderAll();
}
// Render name tags.
LLHUDObject::renderAll();
}
else if (gForceRenderLandFence)
{
@@ -3391,7 +3393,7 @@ void render_hud_elements()
void LLPipeline::renderHighlights()
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_RENDER_HL);
assertInitialized();
@@ -3456,9 +3458,10 @@ void LLPipeline::renderHighlights()
//debug use
U32 LLPipeline::sCurRenderPoolType = 0 ;
void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_RENDER_GEOM);
LLFastTimer t(FTM_RENDER_GEOMETRY);
assertInitialized();
@@ -3723,6 +3726,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)
void LLPipeline::renderGeomDeferred(LLCamera& camera)
{
LLAppViewer::instance()->pingMainloopTimeout("Pipeline:RenderGeomDeferred");
LLMemType mt_rgd(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_DEFFERRED);
LLFastTimer t(FTM_RENDER_GEOMETRY);
LLFastTimer t2(FTM_POOLS);
@@ -3822,6 +3826,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
{
LLMemType mt_rgpd(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_POST_DEF);
LLFastTimer t(FTM_POOLS);
U32 cur_type = 0;
@@ -3918,6 +3923,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
void LLPipeline::renderGeomShadow(LLCamera& camera)
{
LLMemType mt_rgs(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_SHADOW);
U32 cur_type = 0;
LLGLEnable cull(GL_CULL_FACE);
@@ -4351,7 +4357,7 @@ void LLPipeline::renderDebug()
void LLPipeline::rebuildPools()
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_REBUILD_POOLS);
assertInitialized();
@@ -4391,7 +4397,7 @@ void LLPipeline::rebuildPools()
void LLPipeline::addToQuickLookup( LLDrawPool* new_poolp )
{
LLMemType mt(LLMemType::MTYPE_PIPELINE);
LLMemType mt(LLMemType::MTYPE_PIPELINE_QUICK_LOOKUP);
assertInitialized();
@@ -6000,6 +6006,7 @@ void LLPipeline::doResetVertexBuffers()
void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture, BOOL batch_texture)
{
LLMemType mt_ro(LLMemType::MTYPE_PIPELINE_RENDER_OBJECTS);
assertInitialized();
gGL.loadMatrix(gGLModelView);
gGLLastMatrix = NULL;
@@ -6075,6 +6082,7 @@ void LLPipeline::bindScreenToTexture()
static LLFastTimer::DeclareTimer FTM_RENDER_BLOOM("Bloom");
void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield, bool tiling)
{
LLMemType mt_ru(LLMemType::MTYPE_PIPELINE_RENDER_BLOOM);
if (!(gPipeline.canUseVertexShaders() &&
sRenderGlow))
{
@@ -9201,6 +9209,7 @@ void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL textu
void LLPipeline::generateImpostor(LLVOAvatar* avatar)
{
LLMemType mt_gi(LLMemType::MTYPE_PIPELINE_GENERATE_IMPOSTOR);
LLGLState::checkStates();
LLGLState::checkTextureChannels();
LLGLState::checkClientArrays();