From 449c6a07b4879aa863646bfb63470a155c0f71fc Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Wed, 3 Sep 2014 21:13:07 -0400 Subject: [PATCH] fix weird profiler bug, hovering it would change the values. No idea why these changes work --- src/utils/profiler.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/utils/profiler.cpp b/src/utils/profiler.cpp index a1af59aa1..2e8c56202 100644 --- a/src/utils/profiler.cpp +++ b/src/utils/profiler.cpp @@ -353,26 +353,27 @@ void Profiler::draw() } } + // GPU profiler QueryPerf hovered_gpu_marker = Q_LAST; long hovered_gpu_marker_elapsed = 0; + int gpu_y = int(y_offset + nb_thread_infos*line_height + line_height/2); + float total = 0; + for (unsigned i = 0; i < Q_LAST; i++) + { + total += irr_driver->getGPUTimer(i).elapsedTimeus(); + } + + static video::SColor colors[] = { + video::SColor(255, 255, 0, 0), + video::SColor(255, 0, 255, 0), + video::SColor(255, 0, 0, 255), + video::SColor(255, 255, 255, 0), + video::SColor(255, 255, 0, 255), + video::SColor(255, 0, 255, 255) + }; + if (hovered_markers.size() == 0) { - int gpu_y = int(y_offset + nb_thread_infos*line_height + line_height/2); - float total = 0; - for (unsigned i = 0; i < Q_LAST; i++) - { - total += irr_driver->getGPUTimer(i).elapsedTimeus(); - } - - static video::SColor colors[] = { - video::SColor(255, 255, 0, 0), - video::SColor(255, 0, 255, 0), - video::SColor(255, 0, 0, 255), - video::SColor(255, 255, 255, 0), - video::SColor(255, 255, 0, 255), - video::SColor(255, 0, 255, 255) - }; - float curr_val = 0; for (unsigned i = 0; i < Q_LAST; i++) { @@ -422,7 +423,7 @@ void Profiler::draw() // Draw the hovered markers' names gui::ScalableFont* font = GUIEngine::getFont(); - if(font) + if (font) { core::stringw text; while(!hovered_markers.empty())