From cd17687f01420952712a500107e0f93e7ab8d5f8 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:34 -0500 Subject: Second Life viewer sources 1.19.1.0 --- linden/indra/newview/llfasttimerview.cpp | 200 ++++++++++++++++++------------- 1 file changed, 117 insertions(+), 83 deletions(-) (limited to 'linden/indra/newview/llfasttimerview.cpp') diff --git a/linden/indra/newview/llfasttimerview.cpp b/linden/indra/newview/llfasttimerview.cpp index 6364fd2..0fdbb98 100644 --- a/linden/indra/newview/llfasttimerview.cpp +++ b/linden/indra/newview/llfasttimerview.cpp @@ -37,6 +37,7 @@ #include "llrect.h" #include "llerror.h" #include "llgl.h" +#include "llglimmediate.h" #include "llmath.h" #include "llfontgl.h" @@ -56,20 +57,20 @@ static const S32 LINE_GRAPH_HEIGHT = 240; struct ft_display_info { int timer; const char *desc; - LLColor4 *color; + const LLColor4 *color; S32 disabled; // initialized to 0 int level; // calculated based on desc int parent; // calculated }; -static LLColor4 red0(0.5f, 0.0f, 0.0f, 1.0f); -static LLColor4 green0(0.0f, 0.5f, 0.0f, 1.0f); -static LLColor4 blue0(0.0f, 0.0f, 0.5f, 1.0f); -static LLColor4 blue7(0.0f, 0.0f, 0.5f, 1.0f); +static const LLColor4 red0(0.5f, 0.0f, 0.0f, 1.0f); +static const LLColor4 green0(0.0f, 0.5f, 0.0f, 1.0f); +static const LLColor4 blue0(0.0f, 0.0f, 0.5f, 1.0f); +static const LLColor4 blue7(0.0f, 0.0f, 0.5f, 1.0f); -static LLColor4 green7(0.6f, 1.0f, 0.4f, 1.0f); -static LLColor4 green8(0.4f, 1.0f, 0.6f, 1.0f); -static LLColor4 green9(0.6f, 1.0f, 0.6f, 1.0f); +static const LLColor4 green7(0.6f, 1.0f, 0.4f, 1.0f); +static const LLColor4 green8(0.4f, 1.0f, 0.6f, 1.0f); +static const LLColor4 green9(0.6f, 1.0f, 0.6f, 1.0f); // green(6), blue, yellow, orange, pink(2), cyan // red (5) magenta (4) @@ -93,40 +94,14 @@ static struct ft_display_info ft_display_table[] = { LLFastTimer::FTM_WORLD_UPDATE, " World Update", &LLColor4::blue1, 1 }, { LLFastTimer::FTM_UPDATE_MOVE, " Move Objects", &LLColor4::pink2, 0 }, { LLFastTimer::FTM_OCTREE_BALANCE, " Octree Balance", &LLColor4::red3, 0 }, -// { LLFastTimer::FTM_TEMP1, " Blur", &LLColor4::red1, 0 }, - { LLFastTimer::FTM_CULL, " Object Cull", &LLColor4::blue2, 1 }, - { LLFastTimer::FTM_CULL_REBOUND, " Rebound", &LLColor4::blue3, 0 }, - { LLFastTimer::FTM_FRUSTUM_CULL, " Frustum Cull", &LLColor4::blue4, 0 }, - { LLFastTimer::FTM_OCCLUSION, " Object Occlude", &LLColor4::pink1, 0 }, - { LLFastTimer::FTM_OCCLUSION_READBACK, " Occlusion Read", &LLColor4::red2, 0 }, - { LLFastTimer::FTM_HUD_EFFECTS, " HUD Effects", &LLColor4::orange1, 0 }, - { LLFastTimer::FTM_HUD_UPDATE, " HUD Update", &LLColor4::orange2, 0 }, - { LLFastTimer::FTM_GEO_UPDATE, " Geo Update", &LLColor4::blue3, 0 }, - { LLFastTimer::FTM_UPDATE_PRIMITIVES, " Volumes", &LLColor4::blue4, 0 }, - { LLFastTimer::FTM_GEN_VOLUME, " Gen Volume", &LLColor4::yellow3, 0 }, - { LLFastTimer::FTM_GEN_FLEX, " Flexible", &LLColor4::yellow4, 0 }, - { LLFastTimer::FTM_GEN_TRIANGLES, " Triangles", &LLColor4::yellow5, 0 }, - { LLFastTimer::FTM_UPDATE_AVATAR, " Avatar", &LLColor4::yellow1, 0 }, - { LLFastTimer::FTM_UPDATE_TREE, " Tree", &LLColor4::yellow2, 0 }, - { LLFastTimer::FTM_UPDATE_TERRAIN, " Terrain", &LLColor4::yellow6, 0 }, - { LLFastTimer::FTM_UPDATE_CLOUDS, " Clouds", &LLColor4::yellow7, 0 }, - { LLFastTimer::FTM_UPDATE_GRASS, " Grass", &LLColor4::yellow8, 0 }, - { LLFastTimer::FTM_UPDATE_WATER, " Water", &LLColor4::yellow9, 0 }, - { LLFastTimer::FTM_GEO_LIGHT, " Lighting", &LLColor4::yellow1, 0 }, - { LLFastTimer::FTM_GEO_SHADOW, " Shadow", &LLColor4::black, 0 }, - { LLFastTimer::FTM_UPDATE_PARTICLES, " Particles", &LLColor4::blue5, 0 }, - { LLFastTimer::FTM_SIMULATE_PARTICLES, " Particle Sim", &LLColor4::blue4, 0 }, - { LLFastTimer::FTM_GEO_RESERVE, " Reserve", &LLColor4::blue6, 0 }, - { LLFastTimer::FTM_UPDATE_LIGHTS, " Lights", &LLColor4::yellow2, 0 }, - { LLFastTimer::FTM_UPDATE_SKY, " Sky Update", &LLColor4::cyan1, 0 }, - { LLFastTimer::FTM_OBJECTLIST_UPDATE, " Object Update", &LLColor4::purple1, 0 }, + { LLFastTimer::FTM_SIMULATE_PARTICLES, " Particle Sim", &LLColor4::blue4, 0 }, + { LLFastTimer::FTM_OBJECTLIST_UPDATE, " Object Update", &LLColor4::purple1, 1 }, { LLFastTimer::FTM_AVATAR_UPDATE, " Avatars", &LLColor4::purple2, 0 }, { LLFastTimer::FTM_JOINT_UPDATE, " Joints", &LLColor4::purple3, 0 }, { LLFastTimer::FTM_ATTACHMENT_UPDATE, " Attachments", &LLColor4::purple4, 0 }, - { LLFastTimer::FTM_UPDATE_ANIMATION, " Animation", &LLColor4::purple5, 0 }, + { LLFastTimer::FTM_UPDATE_ANIMATION, " Animation", &LLColor4::purple5, 0 }, { LLFastTimer::FTM_FLEXIBLE_UPDATE, " Flex Update", &LLColor4::pink2, 0 }, { LLFastTimer::FTM_LOD_UPDATE, " LOD Update", &LLColor4::magenta1, 0 }, -// { LLFastTimer::FTM_TEMP5, " Check", &LLColor4::red1, 1}, { LLFastTimer::FTM_REGION_UPDATE, " Region Update", &LLColor4::cyan2, 0 }, { LLFastTimer::FTM_NETWORK, " Network", &LLColor4::orange1, 1 }, { LLFastTimer::FTM_IDLE_NETWORK, " Decode Msgs", &LLColor4::orange2, 0 }, @@ -145,23 +120,48 @@ static struct ft_display_info ft_display_table[] = { LLFastTimer::FTM_VFILE_WAIT, " VFile Wait", &LLColor4::cyan6, 0 }, // { LLFastTimer::FTM_IDLE_CB, " Callbacks", &LLColor4::pink1, 0 }, { LLFastTimer::FTM_RENDER, " Render", &green0, 1 }, - { LLFastTimer::FTM_REBUILD, " Rebuild", &LLColor4::green1, 1 }, - { LLFastTimer::FTM_STATESORT, " State Sort", &LLColor4::orange1, 1 }, - { LLFastTimer::FTM_STATESORT_DRAWABLE, " Drawable", &LLColor4::orange2, 0 }, - { LLFastTimer::FTM_STATESORT_POSTSORT, " Post Sort", &LLColor4::orange3, 0 }, - { LLFastTimer::FTM_REBUILD_OCCLUSION_VB," Occlusion", &LLColor4::cyan5, 0 }, - { LLFastTimer::FTM_REBUILD_VBO, " VBO Rebuild", &LLColor4::red4, 0 }, - { LLFastTimer::FTM_REBUILD_VOLUME_VB, " Volume", &LLColor4::blue1, 0 }, - { LLFastTimer::FTM_REBUILD_NONE_VB, " Unknown", &LLColor4::cyan5, 0 }, - { LLFastTimer::FTM_REBUILD_BRIDGE_VB, " Bridge", &LLColor4::blue2, 0 }, - { LLFastTimer::FTM_REBUILD_HUD_VB, " HUD", &LLColor4::blue3, 0 }, - { LLFastTimer::FTM_REBUILD_TERRAIN_VB, " Terrain", &LLColor4::blue4, 0 }, - { LLFastTimer::FTM_REBUILD_WATER_VB, " Water", &LLColor4::blue5, 0 }, - { LLFastTimer::FTM_REBUILD_TREE_VB, " Tree", &LLColor4::cyan1, 0 }, - { LLFastTimer::FTM_REBUILD_PARTICLE_VB, " Particle", &LLColor4::cyan2, 0 }, - { LLFastTimer::FTM_REBUILD_CLOUD_VB, " Cloud", &LLColor4::cyan3, 0 }, - { LLFastTimer::FTM_REBUILD_GRASS_VB, " Grass", &LLColor4::cyan4, 0 }, - { LLFastTimer::FTM_RENDER_GEOMETRY, " Geometry", &LLColor4::green2, 1 }, + { LLFastTimer::FTM_HUD_EFFECTS, " HUD Effects", &LLColor4::orange1, 0 }, + { LLFastTimer::FTM_HUD_UPDATE, " HUD Update", &LLColor4::orange2, 0 }, + { LLFastTimer::FTM_UPDATE_SKY, " Sky Update", &LLColor4::cyan1, 0 }, + { LLFastTimer::FTM_UPDATE_TEXTURES, " Textures", &LLColor4::pink2, 0 }, + { LLFastTimer::FTM_GEO_UPDATE, " Geo Update", &LLColor4::blue3, 1 }, + { LLFastTimer::FTM_UPDATE_PRIMITIVES, " Volumes", &LLColor4::blue4, 0 }, + { LLFastTimer::FTM_GEN_VOLUME, " Gen Volume", &LLColor4::yellow3, 0 }, + { LLFastTimer::FTM_GEN_FLEX, " Flexible", &LLColor4::yellow4, 0 }, + { LLFastTimer::FTM_GEN_TRIANGLES, " Triangles", &LLColor4::yellow5, 0 }, + { LLFastTimer::FTM_UPDATE_AVATAR, " Avatar", &LLColor4::yellow1, 0 }, + { LLFastTimer::FTM_UPDATE_TREE, " Tree", &LLColor4::yellow2, 0 }, + { LLFastTimer::FTM_UPDATE_TERRAIN, " Terrain", &LLColor4::yellow6, 0 }, + { LLFastTimer::FTM_UPDATE_CLOUDS, " Clouds", &LLColor4::yellow7, 0 }, + { LLFastTimer::FTM_UPDATE_GRASS, " Grass", &LLColor4::yellow8, 0 }, + { LLFastTimer::FTM_UPDATE_WATER, " Water", &LLColor4::yellow9, 0 }, + { LLFastTimer::FTM_GEO_LIGHT, " Lighting", &LLColor4::yellow1, 0 }, + { LLFastTimer::FTM_GEO_SHADOW, " Shadow", &LLColor4::black, 0 }, + { LLFastTimer::FTM_UPDATE_PARTICLES, " Particles", &LLColor4::blue5, 0 }, + { LLFastTimer::FTM_GEO_RESERVE, " Reserve", &LLColor4::blue6, 0 }, + { LLFastTimer::FTM_UPDATE_LIGHTS, " Lights", &LLColor4::yellow2, 0 }, + { LLFastTimer::FTM_GEO_SKY, " Sky", &LLColor4::yellow3, 0 }, + { LLFastTimer::FTM_UPDATE_WLPARAM, " Windlight Param",&LLColor4::magenta2, 0 }, + { LLFastTimer::FTM_CULL, " Object Cull", &LLColor4::blue2, 1 }, + { LLFastTimer::FTM_CULL_REBOUND, " Rebound", &LLColor4::blue3, 0 }, + { LLFastTimer::FTM_FRUSTUM_CULL, " Frustum Cull", &LLColor4::blue4, 0 }, + { LLFastTimer::FTM_OCCLUSION_READBACK, " Occlusion Read", &LLColor4::red2, 0 }, + { LLFastTimer::FTM_STATESORT, " State Sort", &LLColor4::orange1, 1 }, + { LLFastTimer::FTM_STATESORT_DRAWABLE, " Drawable", &LLColor4::orange2, 0 }, + { LLFastTimer::FTM_STATESORT_POSTSORT, " Post Sort", &LLColor4::orange3, 0 }, + { LLFastTimer::FTM_REBUILD_OCCLUSION_VB," Occlusion", &LLColor4::cyan5, 0 }, + { LLFastTimer::FTM_REBUILD_VBO, " VBO Rebuild", &LLColor4::red4, 0 }, + { LLFastTimer::FTM_REBUILD_VOLUME_VB, " Volume", &LLColor4::blue1, 0 }, +// { LLFastTimer::FTM_REBUILD_NONE_VB, " Unknown", &LLColor4::cyan5, 0 }, +// { LLFastTimer::FTM_REBUILD_BRIDGE_VB, " Bridge", &LLColor4::blue2, 0 }, +// { LLFastTimer::FTM_REBUILD_HUD_VB, " HUD", &LLColor4::blue3, 0 }, + { LLFastTimer::FTM_REBUILD_TERRAIN_VB, " Terrain", &LLColor4::blue4, 0 }, +// { LLFastTimer::FTM_REBUILD_WATER_VB, " Water", &LLColor4::blue5, 0 }, +// { LLFastTimer::FTM_REBUILD_TREE_VB, " Tree", &LLColor4::cyan1, 0 }, + { LLFastTimer::FTM_REBUILD_PARTICLE_VB, " Particle", &LLColor4::cyan2, 0 }, +// { LLFastTimer::FTM_REBUILD_CLOUD_VB, " Cloud", &LLColor4::cyan3, 0 }, +// { LLFastTimer::FTM_REBUILD_GRASS_VB, " Grass", &LLColor4::cyan4, 0 }, + { LLFastTimer::FTM_RENDER_GEOMETRY, " Geometry", &LLColor4::green2, 1 }, { LLFastTimer::FTM_POOLS, " Pools", &LLColor4::green3, 1 }, { LLFastTimer::FTM_POOLRENDER, " RenderPool", &LLColor4::green4, 1 }, { LLFastTimer::FTM_RENDER_TERRAIN, " Terrain", &LLColor4::green6, 0 }, @@ -179,13 +179,17 @@ static struct ft_display_info ft_display_table[] = { LLFastTimer::FTM_RENDER_ALPHA, " Alpha", &LLColor4::yellow6, 0 }, { LLFastTimer::FTM_RENDER_HUD, " HUD", &LLColor4::yellow7, 0 }, { LLFastTimer::FTM_RENDER_WATER, " Water", &LLColor4::yellow9, 0 }, + { LLFastTimer::FTM_RENDER_WL_SKY, " WL Sky", &LLColor4::blue3, 0 }, + { LLFastTimer::FTM_RENDER_FAKE_VBO_UPDATE," Fake VBO update", &LLColor4::red2, 0 }, + { LLFastTimer::FTM_RENDER_BLOOM, " Bloom", &LLColor4::blue4, 0 }, + { LLFastTimer::FTM_RENDER_BLOOM_FBO, " First FBO", &LLColor4::blue, 0 }, { LLFastTimer::FTM_RENDER_UI, " UI", &LLColor4::cyan4, 1 }, { LLFastTimer::FTM_RENDER_TIMER, " Timers", &LLColor4::cyan5, 1, 0 }, // { LLFastTimer::FTM_RENDER_FONTS, " Fonts", &LLColor4::pink1, 0 }, -// { LLFastTimer::FTM_UPDATE_TEXTURES, " Textures", &LLColor4::pink2, 0 }, { LLFastTimer::FTM_SWAP, " Swap", &LLColor4::pink1, 0 }, { LLFastTimer::FTM_CLIENT_COPY, " Client Copy", &LLColor4::red1, 1}, - + +#if 0 || !LL_RELEASE_FOR_DOWNLOAD { LLFastTimer::FTM_TEMP1, " Temp1", &LLColor4::red1, 0 }, { LLFastTimer::FTM_TEMP2, " Temp2", &LLColor4::magenta1, 0 }, { LLFastTimer::FTM_TEMP3, " Temp3", &LLColor4::red2, 0 }, @@ -194,7 +198,8 @@ static struct ft_display_info ft_display_table[] = { LLFastTimer::FTM_TEMP6, " Temp6", &LLColor4::magenta3, 0 }, { LLFastTimer::FTM_TEMP7, " Temp7", &LLColor4::red4, 0 }, { LLFastTimer::FTM_TEMP8, " Temp8", &LLColor4::magenta4, 0 }, - +#endif + { LLFastTimer::FTM_OTHER, " Other", &red0 } }; static int ft_display_didcalc = 0; @@ -211,6 +216,7 @@ LLFastTimerView::LLFastTimerView(const std::string& name, const LLRect& rect) mMaxCountTotal = 0; mDisplayCenter = 1; mDisplayCalls = 0; + mDisplayHz = 0; mScrollIndex = 0; mHoverIndex = -1; mHoverBarIndex = -1; @@ -288,7 +294,7 @@ BOOL LLFastTimerView::handleRightMouseDown(S32 x, S32 y, MASK mask) S32 LLFastTimerView::getLegendIndex(S32 y) { - S32 idx = (mRect.getHeight() - y) / ((S32) LLFontGL::sMonospace->getLineHeight()+2) - 5; + S32 idx = (getRect().getHeight() - y) / ((S32) LLFontGL::sMonospace->getLineHeight()+2) - 5; if (idx >= 0 && idx < FTV_DISPLAY_NUM) { return ft_display_idx[idx]; @@ -322,9 +328,17 @@ BOOL LLFastTimerView::handleMouseDown(S32 x, S32 y, MASK mask) else if (mask & MASK_ALT) { if (mask & MASK_SHIFT) + { mSubtractHidden = !mSubtractHidden; + } + else if (mask & MASK_CONTROL) + { + mDisplayHz = !mDisplayHz; + } else + { mDisplayCalls = !mDisplayCalls; + } } else if (mask & MASK_SHIFT) { @@ -417,7 +431,8 @@ void LLFastTimerView::draw() S32 height = (S32) (gViewerWindow->getVirtualWindowRect().getHeight()*0.75f); S32 width = (S32) (gViewerWindow->getVirtualWindowRect().getWidth() * 0.75f); - mRect.setLeftTopAndSize(mRect.mLeft, mRect.mTop, width, height); + // HACK: casting away const. Should use setRect or some helper function instead. + const_cast(getRect()).setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height); S32 left, top, right, bottom; S32 x, y, barw, barh, dx, dy; @@ -463,7 +478,7 @@ void LLFastTimerView::draw() // Draw the window background { LLGLSNoTexture gls_ui_no_texture; - gl_rect_2d(0, mRect.getHeight(), mRect.getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f)); } S32 xleft = margin; @@ -644,7 +659,7 @@ void LLFastTimerView::draw() // update rectangle that includes timer bars mBarRect.mLeft = xleft; - mBarRect.mRight = mRect.mRight - xleft; + mBarRect.mRight = getRect().mRight - xleft; mBarRect.mTop = ytop - ((S32)LLFontGL::sMonospace->getLineHeight() + 4); mBarRect.mBottom = margin + LINE_GRAPH_HEIGHT; @@ -755,36 +770,36 @@ void LLFastTimerView::draw() // Draw borders { LLGLSNoTexture gls_ui_no_texture; - glColor4f(0.5f,0.5f,0.5f,0.5f); + gGL.color4f(0.5f,0.5f,0.5f,0.5f); S32 by = y + 2; y -= ((S32)LLFontGL::sMonospace->getLineHeight() + 4); //heading - gl_rect_2d(xleft-5, by, mRect.getWidth()-5, y+5, FALSE); + gl_rect_2d(xleft-5, by, getRect().getWidth()-5, y+5, FALSE); //tree view gl_rect_2d(5, by, xleft-10, 5, FALSE); by = y + 5; //average bar - gl_rect_2d(xleft-5, by, mRect.getWidth()-5, by-barh-dy-5, FALSE); + gl_rect_2d(xleft-5, by, getRect().getWidth()-5, by-barh-dy-5, FALSE); by -= barh*2+dy; //current frame bar - gl_rect_2d(xleft-5, by, mRect.getWidth()-5, by-barh-dy-2, FALSE); + gl_rect_2d(xleft-5, by, getRect().getWidth()-5, by-barh-dy-2, FALSE); by -= barh+dy+1; //history bars - gl_rect_2d(xleft-5, by, mRect.getWidth()-5, LINE_GRAPH_HEIGHT-barh-dy-2, FALSE); + gl_rect_2d(xleft-5, by, getRect().getWidth()-5, LINE_GRAPH_HEIGHT-barh-dy-2, FALSE); by = LINE_GRAPH_HEIGHT-barh-dy-7; //line graph - graph_rect = LLRect(xleft-5, by, mRect.getWidth()-5, 5); + graph_rect = LLRect(xleft-5, by, getRect().getWidth()-5, 5); gl_rect_2d(graph_rect, FALSE); } @@ -920,7 +935,7 @@ void LLFastTimerView::draw() color = lerp(color, LLColor4::grey, 0.8f); } - glColor4fv(color.mV); + gGL.color4fv(color.mV); F32 start_fragment = llclamp((F32)(left - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f); F32 end_fragment = llclamp((F32)(right - sublevel_left[level]) / (F32)sublevel_dx[level], 0.f, 1.f); gl_segmented_rect_2d_fragment_tex(sublevel_left[level], top - level + scale_offset, sublevel_right[level], bottom + level - scale_offset, box_imagep->getWidth(), box_imagep->getHeight(), 16, start_fragment, end_fragment); @@ -947,6 +962,8 @@ void LLFastTimerView::draw() //display y-axis range LLString tdesc = mDisplayCalls ? llformat("%d calls", max_ticks) : + mDisplayHz ? + llformat("%d Hz", max_ticks) : llformat("%4.2f ms", ms); x = graph_rect.mRight - LLFontGL::sMonospace->getWidth(tdesc)-5; @@ -954,7 +971,7 @@ void LLFastTimerView::draw() LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); - + //highlight visible range { S32 first_frame = LLFastTimer::FTM_HISTORY_NUM - mScrollIndex; @@ -965,7 +982,7 @@ void LLFastTimerView::draw() F32 right = (F32) graph_rect.mLeft + frame_delta*first_frame; F32 left = (F32) graph_rect.mLeft + frame_delta*last_frame; - glColor4f(0.5f,0.5f,0.5f,0.3f); + gGL.color4f(0.5f,0.5f,0.5f,0.3f); gl_rect_2d((S32) left, graph_rect.mTop, (S32) right, graph_rect.mBottom); if (mHoverBarIndex >= 0) @@ -973,12 +990,12 @@ void LLFastTimerView::draw() S32 bar_frame = first_frame - mHoverBarIndex; F32 bar = (F32) graph_rect.mLeft + frame_delta*bar_frame; - glColor4f(0.5f,0.5f,0.5f,1); + gGL.color4f(0.5f,0.5f,0.5f,1); - glBegin(GL_LINES); - glVertex2i((S32)bar, graph_rect.mBottom); - glVertex2i((S32)bar, graph_rect.mTop); - glEnd(); + gGL.begin(GL_LINES); + gGL.vertex2i((S32)bar, graph_rect.mBottom); + gGL.vertex2i((S32)bar, graph_rect.mTop); + gGL.end(); } } @@ -993,10 +1010,11 @@ void LLFastTimerView::draw() //fatten highlighted timer if (mHoverIndex == idx) { + gGL.flush(); glLineWidth(3); } - F32* col = ft_display_table[idx].color->mV; + const F32 * col = ft_display_table[idx].color->mV; F32 alpha = 1.f; @@ -1009,30 +1027,38 @@ void LLFastTimerView::draw() } } - glColor4f(col[0], col[1], col[2], alpha); - glBegin(GL_LINE_STRIP); + gGL.color4f(col[0], col[1], col[2], alpha); + gGL.begin(GL_LINE_STRIP); for (U32 j = 0; j < LLFastTimer::FTM_HISTORY_NUM; j++) { U64 ticks = ticks_sum[j+1][idx]; - if (mDisplayCalls) + + if (mDisplayHz) + { + F64 tc = (F64) (ticks+1) * iclock_freq; + tc = 1000.f/tc; + ticks = llmin((U64) tc, (U64) 1024); + } + else if (mDisplayCalls) { S32 tidx = ft_display_table[idx].timer; S32 hidx = (LLFastTimer::sLastFrameIndex + j) % LLFastTimer::FTM_HISTORY_NUM; ticks = (S32)LLFastTimer::sCallHistory[hidx][tidx]; } - + if (alpha == 1.f) { //normalize to highlighted timer cur_max = llmax(cur_max, ticks); } F32 x = graph_rect.mLeft + ((F32) (graph_rect.getWidth()))/(LLFastTimer::FTM_HISTORY_NUM-1)*j; F32 y = graph_rect.mBottom + (F32) graph_rect.getHeight()/max_ticks*ticks; - glVertex2f(x,y); + gGL.vertex2f(x,y); } - glEnd(); + gGL.end(); if (mHoverIndex == idx) { + gGL.flush(); glLineWidth(1); } } @@ -1045,7 +1071,15 @@ void LLFastTimerView::draw() llmin((F32) cur_max/ (F32) last_max - 1.f,1.f); alpha_interp = alpha_interp + (alpha_target-alpha_interp) * dt; - + + if (mHoverIndex >= 0) + { + x = (graph_rect.mRight + graph_rect.mLeft)/2; + y = graph_rect.mBottom + 8; + + LLFontGL::sMonospace->renderUTF8(ft_display_table[mHoverIndex].desc, 0, x, y, LLColor4::white, + LLFontGL::LEFT, LLFontGL::BOTTOM); + } } } -- cgit v1.1