summaryrefslogtreecommitdiff
path: root/externals/microprofile/microprofileui.h
diff options
context:
space:
mode:
Diffstat (limited to 'externals/microprofile/microprofileui.h')
-rw-r--r--externals/microprofile/microprofileui.h212
1 files changed, 106 insertions, 106 deletions
diff --git a/externals/microprofile/microprofileui.h b/externals/microprofile/microprofileui.h
index fe2410cf4..85fbf2cb9 100644
--- a/externals/microprofile/microprofileui.h
+++ b/externals/microprofile/microprofileui.h
@@ -169,14 +169,13 @@ MICROPROFILEUI_API void MicroProfileCustomGroup(const char* pCustomName, uint32_
169MICROPROFILEUI_API void MicroProfileCustomGroupAddTimer(const char* pCustomName, const char* pGroup, const char* pTimer); 169MICROPROFILEUI_API void MicroProfileCustomGroupAddTimer(const char* pCustomName, const char* pGroup, const char* pTimer);
170 170
171#ifdef MICROPROFILEUI_IMPL 171#ifdef MICROPROFILEUI_IMPL
172#ifdef _WIN32 172#include <inttypes.h>
173#define snprintf _snprintf
174#endif
175#include <stdio.h> 173#include <stdio.h>
176#include <stdlib.h> 174#include <stdlib.h>
177#include <stdarg.h> 175#include <stdarg.h>
178#include <math.h> 176#include <math.h>
179#include <algorithm> 177#include <algorithm>
178#include <array>
180 179
181MICROPROFILE_DEFINE(g_MicroProfileDetailed, "MicroProfile", "Detailed View", 0x8888000); 180MICROPROFILE_DEFINE(g_MicroProfileDetailed, "MicroProfile", "Detailed View", 0x8888000);
182MICROPROFILE_DEFINE(g_MicroProfileDrawGraph, "MicroProfile", "Draw Graph", 0xff44ee00); 181MICROPROFILE_DEFINE(g_MicroProfileDrawGraph, "MicroProfile", "Draw Graph", 0xff44ee00);
@@ -227,10 +226,10 @@ struct SOptionDesc
227 uint8_t nIndex; 226 uint8_t nIndex;
228 bool bSelected; 227 bool bSelected;
229}; 228};
230static uint32_t g_MicroProfileAggregatePresets[] = {0, 10, 20, 30, 60, 120}; 229static const std::array<uint32_t, 6> g_MicroProfileAggregatePresets{0, 10, 20, 30, 60, 120};
231static float g_MicroProfileReferenceTimePresets[] = {5.f, 10.f, 15.f,20.f, 33.33f, 66.66f, 100.f, 250.f, 500.f, 1000.f}; 230static const std::array<float, 10> g_MicroProfileReferenceTimePresets{5.f, 10.f, 15.f,20.f, 33.33f, 66.66f, 100.f, 250.f, 500.f, 1000.f};
232static uint32_t g_MicroProfileOpacityPresets[] = {0x40, 0x80, 0xc0, 0xff}; 231static const std::array<uint32_t, 4> g_MicroProfileOpacityPresets{0x40, 0x80, 0xc0, 0xff};
233static const char* g_MicroProfilePresetNames[] = 232static const std::array<const char*, 7> g_MicroProfilePresetNames
234{ 233{
235 MICROPROFILE_DEFAULT_PRESET, 234 MICROPROFILE_DEFAULT_PRESET,
236 "Render", 235 "Render",
@@ -243,8 +242,8 @@ static const char* g_MicroProfilePresetNames[] =
243 242
244enum 243enum
245{ 244{
246 MICROPROFILE_NUM_REFERENCE_PRESETS = sizeof(g_MicroProfileReferenceTimePresets)/sizeof(g_MicroProfileReferenceTimePresets[0]), 245 MICROPROFILE_NUM_REFERENCE_PRESETS = g_MicroProfileReferenceTimePresets.size(),
247 MICROPROFILE_NUM_OPACITY_PRESETS = sizeof(g_MicroProfileOpacityPresets)/sizeof(g_MicroProfileOpacityPresets[0]), 246 MICROPROFILE_NUM_OPACITY_PRESETS = g_MicroProfileOpacityPresets.size(),
248#if MICROPROFILE_CONTEXT_SWITCH_TRACE 247#if MICROPROFILE_CONTEXT_SWITCH_TRACE
249 MICROPROFILE_OPTION_SIZE = MICROPROFILE_NUM_REFERENCE_PRESETS + MICROPROFILE_NUM_OPACITY_PRESETS * 2 + 2 + 7, 248 MICROPROFILE_OPTION_SIZE = MICROPROFILE_NUM_REFERENCE_PRESETS + MICROPROFILE_NUM_OPACITY_PRESETS * 2 + 2 + 7,
250#else 249#else
@@ -326,9 +325,9 @@ struct MicroProfileUI
326 325
327MicroProfileUI g_MicroProfileUI; 326MicroProfileUI g_MicroProfileUI;
328#define UI g_MicroProfileUI 327#define UI g_MicroProfileUI
329static uint32_t g_nMicroProfileBackColors[2] = { 0x474747, 0x313131 }; 328static const std::array<uint32_t, 2> g_nMicroProfileBackColors{ 0x474747, 0x313131 };
330#define MICROPROFILE_NUM_CONTEXT_SWITCH_COLORS 16 329#define MICROPROFILE_NUM_CONTEXT_SWITCH_COLORS 16
331static uint32_t g_nMicroProfileContextSwitchThreadColors[MICROPROFILE_NUM_CONTEXT_SWITCH_COLORS] = //palette generated by http://tools.medialab.sciences-po.fr/iwanthue/index.php 330static const std::array<uint32_t, MICROPROFILE_NUM_CONTEXT_SWITCH_COLORS> g_nMicroProfileContextSwitchThreadColors //palette generated by http://tools.medialab.sciences-po.fr/iwanthue/index.php
332{ 331{
333 0x63607B, 332 0x63607B,
334 0x755E2B, 333 0x755E2B,
@@ -356,7 +355,7 @@ void MicroProfileInitUI()
356 { 355 {
357 bInitialized = true; 356 bInitialized = true;
358 memset(&g_MicroProfileUI, 0, sizeof(g_MicroProfileUI)); 357 memset(&g_MicroProfileUI, 0, sizeof(g_MicroProfileUI));
359 UI.nActiveMenu = (uint32_t)-1; 358 UI.nActiveMenu = UINT32_MAX;
360 UI.fDetailedOffsetTarget = UI.fDetailedOffset = 0.f; 359 UI.fDetailedOffsetTarget = UI.fDetailedOffset = 0.f;
361 UI.fDetailedRangeTarget = UI.fDetailedRange = 50.f; 360 UI.fDetailedRangeTarget = UI.fDetailedRange = 50.f;
362 361
@@ -368,7 +367,7 @@ void MicroProfileInitUI()
368 UI.nWidth = 100; 367 UI.nWidth = 100;
369 UI.nHeight = 100; 368 UI.nHeight = 100;
370 369
371 UI.nCustomActive = (uint32_t)-1; 370 UI.nCustomActive = UINT32_MAX;
372 UI.nCustomTimerCount = 0; 371 UI.nCustomTimerCount = 0;
373 UI.nCustomCount = 0; 372 UI.nCustomCount = 0;
374 373
@@ -498,8 +497,8 @@ inline void MicroProfileDrawFloatWindow(uint32_t nX, uint32_t nY, const char** p
498 { 497 {
499 MicroProfileDrawBox(nX-MICROPROFILE_TEXT_WIDTH, nY, nX, nY + MICROPROFILE_TEXT_WIDTH, pColors[i]|0xff000000); 498 MicroProfileDrawBox(nX-MICROPROFILE_TEXT_WIDTH, nY, nX, nY + MICROPROFILE_TEXT_WIDTH, pColors[i]|0xff000000);
500 } 499 }
501 MicroProfileDrawText(nX + 1, nY + 1, (uint32_t)-1, ppStrings[i0], (uint32_t)strlen(ppStrings[i0])); 500 MicroProfileDrawText(nX + 1, nY + 1, UINT32_MAX, ppStrings[i0], (uint32_t)strlen(ppStrings[i0]));
502 MicroProfileDrawText(nX + nWidth - nStringLengths[i0+1] * (MICROPROFILE_TEXT_WIDTH+1), nY + 1, (uint32_t)-1, ppStrings[i0+1], (uint32_t)strlen(ppStrings[i0+1])); 501 MicroProfileDrawText(nX + nWidth - nStringLengths[i0+1] * (MICROPROFILE_TEXT_WIDTH+1), nY + 1, UINT32_MAX, ppStrings[i0+1], (uint32_t)strlen(ppStrings[i0+1]));
503 nY += (MICROPROFILE_TEXT_HEIGHT+1); 502 nY += (MICROPROFILE_TEXT_HEIGHT+1);
504 } 503 }
505} 504}
@@ -522,7 +521,7 @@ inline void MicroProfileDrawTextBox(uint32_t nX, uint32_t nY, const char** ppStr
522 MicroProfileDrawBox(nX, nY, nX + nWidth, nY + nHeight, 0xff000000); 521 MicroProfileDrawBox(nX, nY, nX + nWidth, nY + nHeight, 0xff000000);
523 for(uint32_t i = 0; i < nNumStrings; ++i) 522 for(uint32_t i = 0; i < nNumStrings; ++i)
524 { 523 {
525 MicroProfileDrawText(nX + 1, nY + 1, (uint32_t)-1, ppStrings[i], (uint32_t)strlen(ppStrings[i])); 524 MicroProfileDrawText(nX + 1, nY + 1, UINT32_MAX, ppStrings[i], (uint32_t)strlen(ppStrings[i]));
526 nY += (MICROPROFILE_TEXT_HEIGHT+1); 525 nY += (MICROPROFILE_TEXT_HEIGHT+1);
527 } 526 }
528} 527}
@@ -781,7 +780,7 @@ inline void MicroProfileDrawDetailedContextSwitchBars(uint32_t nY, uint32_t nThr
781{ 780{
782 MicroProfile& S = *MicroProfileGet(); 781 MicroProfile& S = *MicroProfileGet();
783 int64_t nTickIn = -1; 782 int64_t nTickIn = -1;
784 uint32_t nThreadBefore = -1; 783 uint32_t nThreadBefore = UINT32_MAX;
785 float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); 784 float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu());
786 float fMsToScreen = UI.nWidth / UI.fDetailedRange; 785 float fMsToScreen = UI.nWidth / UI.fDetailedRange;
787 float fMouseX = (float)UI.nMouseX; 786 float fMouseX = (float)UI.nMouseX;
@@ -949,10 +948,10 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
949 948
950 uint32_t nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadAfter; 949 uint32_t nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadAfter;
951 uint32_t nContextSwitchHoverThreadBefore = S.nContextSwitchHoverThreadBefore; 950 uint32_t nContextSwitchHoverThreadBefore = S.nContextSwitchHoverThreadBefore;
952 S.nContextSwitchHoverThread = S.nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadBefore = -1; 951 S.nContextSwitchHoverThread = S.nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadBefore = UINT32_MAX;
953 952
954 uint32_t nContextSwitchStart = -1; 953 uint32_t nContextSwitchStart = UINT32_MAX;
955 uint32_t nContextSwitchEnd = -1; 954 uint32_t nContextSwitchEnd = UINT32_MAX;
956 S.nContextSwitchHoverCpuNext = 0xff; 955 S.nContextSwitchHoverCpuNext = 0xff;
957 S.nContextSwitchHoverTickIn = -1; 956 S.nContextSwitchHoverTickIn = -1;
958 S.nContextSwitchHoverTickOut = -1; 957 S.nContextSwitchHoverTickOut = -1;
@@ -1005,9 +1004,10 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1005 }while(pFrameLogFirst != pFrameFirst); 1004 }while(pFrameLogFirst != pFrameFirst);
1006 1005
1007 1006
1008 if(nGet == (uint32_t)-1) 1007 if (nGet == UINT32_MAX) {
1009 continue; 1008 continue;
1010 MP_ASSERT(nGet != (uint32_t)-1); 1009 }
1010 MP_ASSERT(nGet != UINT32_MAX);
1011 1011
1012 nPut = pFrameLogLast->nLogStart[i]; 1012 nPut = pFrameLogLast->nLogStart[i];
1013 1013
@@ -1023,9 +1023,9 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1023 int64_t nBaseTicks = bGpu ? nBaseTicksGpu : nBaseTicksCpu; 1023 int64_t nBaseTicks = bGpu ? nBaseTicksGpu : nBaseTicksCpu;
1024 char ThreadName[MicroProfileThreadLog::THREAD_MAX_LEN + 16]; 1024 char ThreadName[MicroProfileThreadLog::THREAD_MAX_LEN + 16];
1025 uint64_t nThreadId = pLog->nThreadId; 1025 uint64_t nThreadId = pLog->nThreadId;
1026 snprintf(ThreadName, sizeof(ThreadName)-1, "%04llx: %s", nThreadId, &pLog->ThreadName[0] ); 1026 snprintf(ThreadName, sizeof(ThreadName)-1, "%04" PRIx64 ": %s", nThreadId, &pLog->ThreadName[0] );
1027 nY += 3; 1027 nY += 3;
1028 uint32_t nThreadColor = -1; 1028 uint32_t nThreadColor = UINT32_MAX;
1029 if(pLog->nThreadId == nContextSwitchHoverThreadAfter || pLog->nThreadId == nContextSwitchHoverThreadBefore) 1029 if(pLog->nThreadId == nContextSwitchHoverThreadAfter || pLog->nThreadId == nContextSwitchHoverThreadBefore)
1030 nThreadColor = UI.nHoverColorShared|0x906060; 1030 nThreadColor = UI.nHoverColorShared|0x906060;
1031 MicroProfileDrawText(0, nY, nThreadColor, &ThreadName[0], (uint32_t)strlen(&ThreadName[0])); 1031 MicroProfileDrawText(0, nY, nThreadColor, &ThreadName[0], (uint32_t)strlen(&ThreadName[0]));
@@ -1048,7 +1048,7 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1048 uint32_t nEnd = nRange[j][1]; 1048 uint32_t nEnd = nRange[j][1];
1049 for(uint32_t k = nStart; k < nEnd; ++k) 1049 for(uint32_t k = nStart; k < nEnd; ++k)
1050 { 1050 {
1051 MicroProfileLogEntry* pEntry = pLog->Log + k; 1051 MicroProfileLogEntry* pEntry = &pLog->Log[k];
1052 int nType = MicroProfileLogType(*pEntry); 1052 int nType = MicroProfileLogType(*pEntry);
1053 if(MP_LOG_ENTER == nType) 1053 if(MP_LOG_ENTER == nType)
1054 { 1054 {
@@ -1066,7 +1066,7 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1066 continue; 1066 continue;
1067 } 1067 }
1068 1068
1069 MicroProfileLogEntry* pEntryEnter = pLog->Log + nStack[nStackPos-1]; 1069 MicroProfileLogEntry* pEntryEnter = &pLog->Log[nStack[nStackPos-1]];
1070 if(MicroProfileLogTimerIndex(*pEntryEnter) != MicroProfileLogTimerIndex(*pEntry)) 1070 if(MicroProfileLogTimerIndex(*pEntryEnter) != MicroProfileLogTimerIndex(*pEntry))
1071 { 1071 {
1072 //uprintf("mismatch %llx %llx\n", pEntryEnter->nToken, pEntry->nToken); 1072 //uprintf("mismatch %llx %llx\n", pEntryEnter->nToken, pEntry->nToken);
@@ -1126,7 +1126,7 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1126 uint32_t nIntegerWidth = (uint32_t)(fXEnd - fXStart); 1126 uint32_t nIntegerWidth = (uint32_t)(fXEnd - fXStart);
1127 if(nIntegerWidth) 1127 if(nIntegerWidth)
1128 { 1128 {
1129 if(bHover && UI.nActiveMenu == -1) 1129 if(bHover && UI.nActiveMenu == UINT32_MAX)
1130 { 1130 {
1131 nHoverToken = MicroProfileLogTimerIndex(*pEntry); 1131 nHoverToken = MicroProfileLogTimerIndex(*pEntry);
1132 #if MICROPROFILE_DEBUG 1132 #if MICROPROFILE_DEBUG
@@ -1146,7 +1146,7 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1146 int nCharacters = (nTextWidth - 2*MICROPROFILE_TEXT_WIDTH) / MICROPROFILE_TEXT_WIDTH; 1146 int nCharacters = (nTextWidth - 2*MICROPROFILE_TEXT_WIDTH) / MICROPROFILE_TEXT_WIDTH;
1147 if(nCharacters>0) 1147 if(nCharacters>0)
1148 { 1148 {
1149 MicroProfileDrawText(fXStartText+1, fYStart+1, -1, S.TimerInfo[nTimerIndex].pName, MicroProfileMin<uint32_t>(S.TimerInfo[nTimerIndex].nNameLen, nCharacters)); 1149 MicroProfileDrawText(fXStartText + 1, fYStart + 1, UINT32_MAX, S.TimerInfo[nTimerIndex].pName, MicroProfileMin<uint32_t>(S.TimerInfo[nTimerIndex].nNameLen, nCharacters));
1150 } 1150 }
1151 } 1151 }
1152#endif 1152#endif
@@ -1158,7 +1158,7 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1158 int nLineX = (int)floor(fXAvg+0.5f); 1158 int nLineX = (int)floor(fXAvg+0.5f);
1159 if(nLineX != (int)nLinesDrawn[nStackPos]) 1159 if(nLineX != (int)nLinesDrawn[nStackPos])
1160 { 1160 {
1161 if(bHover && UI.nActiveMenu == -1) 1161 if(bHover && UI.nActiveMenu == UINT32_MAX)
1162 { 1162 {
1163 nHoverToken = (uint32_t)MicroProfileLogTimerIndex(*pEntry); 1163 nHoverToken = (uint32_t)MicroProfileLogTimerIndex(*pEntry);
1164 nHoverTime = MicroProfileLogTickDifference(nTickStart, nTickEnd); 1164 nHoverTime = MicroProfileLogTickDifference(nTickStart, nTickEnd);
@@ -1235,9 +1235,9 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1235 // nThreadId is 32-bit on Windows 1235 // nThreadId is 32-bit on Windows
1236 int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04x: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); 1236 int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04x: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) );
1237#else 1237#else
1238 int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04llx: %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) ); 1238 int nStrLen = snprintf(ThreadName, sizeof(ThreadName)-1, "%04" PRIx64 ": %s%s", nThreadId, cLocal, i < nNumThreadsBase ? &S.Pool[i]->ThreadName[0] : MICROPROFILE_THREAD_NAME_FROM_ID(nThreadId) );
1239#endif 1239#endif
1240 uint32_t nThreadColor = -1; 1240 uint32_t nThreadColor = UINT32_MAX;
1241 if(nThreadId == nContextSwitchHoverThreadAfter || nThreadId == nContextSwitchHoverThreadBefore) 1241 if(nThreadId == nContextSwitchHoverThreadAfter || nThreadId == nContextSwitchHoverThreadBefore)
1242 nThreadColor = UI.nHoverColorShared|0x906060; 1242 nThreadColor = UI.nHoverColorShared|0x906060;
1243 MicroProfileDrawDetailedContextSwitchBars(nY+2, nThreadId, nContextSwitchStart, nContextSwitchEnd, nBaseTicksCpu, nBaseY); 1243 MicroProfileDrawDetailedContextSwitchBars(nY+2, nThreadId, nContextSwitchStart, nContextSwitchEnd, nBaseTicksCpu, nBaseY);
@@ -1249,9 +1249,6 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1249 1249
1250 S.nContextSwitchHoverCpu = S.nContextSwitchHoverCpuNext; 1250 S.nContextSwitchHoverCpu = S.nContextSwitchHoverCpuNext;
1251 1251
1252
1253
1254
1255 UI.pDisplayMouseOver = pMouseOverNext; 1252 UI.pDisplayMouseOver = pMouseOverNext;
1256 1253
1257 if(!S.nRunning) 1254 if(!S.nRunning)
@@ -1286,10 +1283,10 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1286 float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart); 1283 float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart);
1287 float fStartTextX = fXStart - fStartTextWidth - 2; 1284 float fStartTextX = fXStart - fStartTextWidth - 2;
1288 MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); 1285 MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat);
1289 MicroProfileDrawText(fStartTextX+1, nBaseY, (uint32_t)-1, sBuffer, nLenStart); 1286 MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart);
1290 uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd); 1287 uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd);
1291 MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); 1288 MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat);
1292 MicroProfileDrawText(fXEnd+2, nBaseY+1, (uint32_t)-1, sBuffer, nLenEnd); 1289 MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd);
1293 1290
1294 if(UI.nMouseRight) 1291 if(UI.nMouseRight)
1295 { 1292 {
@@ -1316,10 +1313,10 @@ inline void MicroProfileDrawDetailedBars(uint32_t nWidth, uint32_t nHeight, int
1316 float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart); 1313 float fStartTextWidth = (float)((1+MICROPROFILE_TEXT_WIDTH) * nLenStart);
1317 float fStartTextX = fXStart - fStartTextWidth - 2; 1314 float fStartTextX = fXStart - fStartTextWidth - 2;
1318 MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); 1315 MicroProfileDrawBox(fStartTextX, nBaseY, fStartTextX + fStartTextWidth + 2, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat);
1319 MicroProfileDrawText(fStartTextX+1, nBaseY, (uint32_t)-1, sBuffer, nLenStart); 1316 MicroProfileDrawText(fStartTextX+1, nBaseY, UINT32_MAX, sBuffer, nLenStart);
1320 uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd); 1317 uint32_t nLenEnd = snprintf(sBuffer, sizeof(sBuffer)-1, "%.2fms", fMsEnd);
1321 MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat); 1318 MicroProfileDrawBox(fXEnd+1, nBaseY, fXEnd+1+(1+MICROPROFILE_TEXT_WIDTH) * nLenEnd + 3, MICROPROFILE_TEXT_HEIGHT + 2 + nBaseY, 0x33000000, MicroProfileBoxTypeFlat);
1322 MicroProfileDrawText(fXEnd+2, nBaseY+1, (uint32_t)-1, sBuffer, nLenEnd); 1319 MicroProfileDrawText(fXEnd+2, nBaseY+1, UINT32_MAX, sBuffer, nLenEnd);
1323 } 1320 }
1324 } 1321 }
1325} 1322}
@@ -1365,7 +1362,7 @@ inline void MicroProfileDrawDetailedFrameHistory(uint32_t nWidth, uint32_t nHeig
1365 fBaseX = fXStart; 1362 fBaseX = fXStart;
1366 uint32_t nColor = MICROPROFILE_FRAME_HISTORY_COLOR_CPU; 1363 uint32_t nColor = MICROPROFILE_FRAME_HISTORY_COLOR_CPU;
1367 if(nIndex == nSelectedFrame) 1364 if(nIndex == nSelectedFrame)
1368 nColor = (uint32_t)-1; 1365 nColor = UINT32_MAX;
1369 MicroProfileDrawBox(fXStart, nBaseY + fScale * nBarHeight, fXEnd, nBaseY+MICROPROFILE_FRAME_HISTORY_HEIGHT, nColor, MicroProfileBoxTypeBar); 1366 MicroProfileDrawBox(fXStart, nBaseY + fScale * nBarHeight, fXEnd, nBaseY+MICROPROFILE_FRAME_HISTORY_HEIGHT, nColor, MicroProfileBoxTypeBar);
1370 if(pNext->nFrameStartCpu > nCpuStart) 1367 if(pNext->nFrameStartCpu > nCpuStart)
1371 { 1368 {
@@ -1387,7 +1384,7 @@ inline void MicroProfileDrawDetailedView(uint32_t nWidth, uint32_t nHeight)
1387 uint32_t nBaseY = MICROPROFILE_TEXT_HEIGHT + 1; 1384 uint32_t nBaseY = MICROPROFILE_TEXT_HEIGHT + 1;
1388 1385
1389 int nSelectedFrame = -1; 1386 int nSelectedFrame = -1;
1390 if(UI.nMouseY > nBaseY && UI.nMouseY <= nBaseY + MICROPROFILE_FRAME_HISTORY_HEIGHT && UI.nActiveMenu == -1) 1387 if(UI.nMouseY > nBaseY && UI.nMouseY <= nBaseY + MICROPROFILE_FRAME_HISTORY_HEIGHT && UI.nActiveMenu == UINT32_MAX)
1391 { 1388 {
1392 1389
1393 nSelectedFrame = ((MICROPROFILE_NUM_FRAMES) * (UI.nWidth-UI.nMouseX) / UI.nWidth); 1390 nSelectedFrame = ((MICROPROFILE_NUM_FRAMES) * (UI.nWidth-UI.nMouseX) / UI.nWidth);
@@ -1425,7 +1422,7 @@ inline void MicroProfileDrawHeader(int32_t nX, uint32_t nWidth, const char* pNam
1425 if(pName) 1422 if(pName)
1426 { 1423 {
1427 MicroProfileDrawBox(nX-8, MICROPROFILE_TEXT_HEIGHT + 2, nX + nWidth+5, MICROPROFILE_TEXT_HEIGHT + 2 + (MICROPROFILE_TEXT_HEIGHT+1), 0xff000000|g_nMicroProfileBackColors[1]); 1424 MicroProfileDrawBox(nX-8, MICROPROFILE_TEXT_HEIGHT + 2, nX + nWidth+5, MICROPROFILE_TEXT_HEIGHT + 2 + (MICROPROFILE_TEXT_HEIGHT+1), 0xff000000|g_nMicroProfileBackColors[1]);
1428 MicroProfileDrawText(nX, MICROPROFILE_TEXT_HEIGHT + 2, (uint32_t)-1, pName, (uint32_t)strlen(pName)); 1425 MicroProfileDrawText(nX, MICROPROFILE_TEXT_HEIGHT + 2, UINT32_MAX, pName, (uint32_t)strlen(pName));
1429 } 1426 }
1430} 1427}
1431 1428
@@ -1440,7 +1437,7 @@ inline void MicroProfileLoopActiveGroupsDraw(int32_t nX, int32_t nY, const char*
1440 uint32_t nCount = 0; 1437 uint32_t nCount = 0;
1441 for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) 1438 for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j)
1442 { 1439 {
1443 uint64_t nMask = 1ll << j; 1440 uint64_t nMask = 1ULL << j;
1444 if(nMask & nGroup) 1441 if(nMask & nGroup)
1445 { 1442 {
1446 nY += MICROPROFILE_TEXT_HEIGHT + 1; 1443 nY += MICROPROFILE_TEXT_HEIGHT + 1;
@@ -1521,7 +1518,7 @@ inline void MicroProfileCalcTimers(float* pTimers, float* pAverage, float* pMax,
1521 } 1518 }
1522 } 1519 }
1523 } 1520 }
1524 nMask <<= 1ll; 1521 nMask <<= 1;
1525 } 1522 }
1526} 1523}
1527 1524
@@ -1543,7 +1540,7 @@ inline void MicroProfileDrawBarArrayCallback(uint32_t nTimer, uint32_t nIdx, uin
1543 snprintf(sBuffer, SBUF_MAX-1, "%5.2f", pTimers[nIdx]); 1540 snprintf(sBuffer, SBUF_MAX-1, "%5.2f", pTimers[nIdx]);
1544 if (!pTimers2) 1541 if (!pTimers2)
1545 MicroProfileDrawBox(nX + nTextWidth, nY, nX + nTextWidth + fWidth * pTimers[nIdx+1], nY + nHeight, UI.nOpacityForeground|S.TimerInfo[nTimer].nColor, MicroProfileBoxTypeBar); 1542 MicroProfileDrawBox(nX + nTextWidth, nY, nX + nTextWidth + fWidth * pTimers[nIdx+1], nY + nHeight, UI.nOpacityForeground|S.TimerInfo[nTimer].nColor, MicroProfileBoxTypeBar);
1546 MicroProfileDrawText(nX, nY, (uint32_t)-1, sBuffer, (uint32_t)strlen(sBuffer)); 1543 MicroProfileDrawText(nX, nY, UINT32_MAX, sBuffer, (uint32_t)strlen(sBuffer));
1547} 1544}
1548 1545
1549 1546
@@ -1564,7 +1561,7 @@ inline void MicroProfileDrawBarCallCountCallback(uint32_t nTimer, uint32_t nIdx,
1564 MicroProfile& S = *MicroProfileGet(); 1561 MicroProfile& S = *MicroProfileGet();
1565 char sBuffer[SBUF_MAX]; 1562 char sBuffer[SBUF_MAX];
1566 int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5d", S.Frame[nTimer].nCount);//fix 1563 int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5d", S.Frame[nTimer].nCount);//fix
1567 MicroProfileDrawText(nX, nY, (uint32_t)-1, sBuffer, nLen); 1564 MicroProfileDrawText(nX, nY, UINT32_MAX, sBuffer, nLen);
1568} 1565}
1569 1566
1570inline uint32_t MicroProfileDrawBarCallCount(int32_t nX, int32_t nY, const char* pName) 1567inline uint32_t MicroProfileDrawBarCallCount(int32_t nX, int32_t nY, const char* pName)
@@ -1588,7 +1585,7 @@ inline void MicroProfileDrawBarMetaAverageCallback(uint32_t nTimer, uint32_t nId
1588 float fRcpFrames = pArgs->fRcpFrames; 1585 float fRcpFrames = pArgs->fRcpFrames;
1589 char sBuffer[SBUF_MAX]; 1586 char sBuffer[SBUF_MAX];
1590 int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5.2f", pCounters[nTimer] * fRcpFrames); 1587 int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5.2f", pCounters[nTimer] * fRcpFrames);
1591 MicroProfileDrawText(nX - nLen * (MICROPROFILE_TEXT_WIDTH+1), nY, (uint32_t)-1, sBuffer, nLen); 1588 MicroProfileDrawText(nX - nLen * (MICROPROFILE_TEXT_WIDTH+1), nY, UINT32_MAX, sBuffer, nLen);
1592} 1589}
1593 1590
1594inline uint32_t MicroProfileDrawBarMetaAverage(int32_t nX, int32_t nY, uint64_t* pCounters, const char* pName, uint32_t nTotalHeight) 1591inline uint32_t MicroProfileDrawBarMetaAverage(int32_t nX, int32_t nY, uint64_t* pCounters, const char* pName, uint32_t nTotalHeight)
@@ -1609,8 +1606,8 @@ inline void MicroProfileDrawBarMetaCountCallback(uint32_t nTimer, uint32_t nIdx,
1609{ 1606{
1610 uint64_t* pCounters = (uint64_t*)pExtra; 1607 uint64_t* pCounters = (uint64_t*)pExtra;
1611 char sBuffer[SBUF_MAX]; 1608 char sBuffer[SBUF_MAX];
1612 int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5llu", pCounters[nTimer]); 1609 int nLen = snprintf(sBuffer, SBUF_MAX-1, "%5" PRIu64, pCounters[nTimer]);
1613 MicroProfileDrawText(nX - nLen * (MICROPROFILE_TEXT_WIDTH+1), nY, (uint32_t)-1, sBuffer, nLen); 1610 MicroProfileDrawText(nX - nLen * (MICROPROFILE_TEXT_WIDTH+1), nY, UINT32_MAX, sBuffer, nLen);
1614} 1611}
1615 1612
1616inline uint32_t MicroProfileDrawBarMetaCount(int32_t nX, int32_t nY, uint64_t* pCounters, const char* pName, uint32_t nTotalHeight) 1613inline uint32_t MicroProfileDrawBarMetaCount(int32_t nX, int32_t nY, uint64_t* pCounters, const char* pName, uint32_t nTotalHeight)
@@ -1667,7 +1664,7 @@ bool MicroProfileDrawGraph(uint32_t nScreenWidth, uint32_t nScreenHeight)
1667 if(bMouseOver) 1664 if(bMouseOver)
1668 { 1665 {
1669 float fXAvg = fMouseXPrc * MICROPROFILE_GRAPH_WIDTH + nX; 1666 float fXAvg = fMouseXPrc * MICROPROFILE_GRAPH_WIDTH + nX;
1670 MicroProfileDrawLineVertical(fXAvg, nY, nY + MICROPROFILE_GRAPH_HEIGHT, (uint32_t)-1); 1667 MicroProfileDrawLineVertical(fXAvg, nY, nY + MICROPROFILE_GRAPH_HEIGHT, UINT32_MAX);
1671 } 1668 }
1672 1669
1673 1670
@@ -1706,7 +1703,7 @@ bool MicroProfileDrawGraph(uint32_t nScreenWidth, uint32_t nScreenHeight)
1706 1703
1707 char buf[32]; 1704 char buf[32];
1708 int nLen = snprintf(buf, sizeof(buf)-1, "%5.2fms", S.fReferenceTime); 1705 int nLen = snprintf(buf, sizeof(buf)-1, "%5.2fms", S.fReferenceTime);
1709 MicroProfileDrawText(nX+1, fY1 - (2+MICROPROFILE_TEXT_HEIGHT), (uint32_t)-1, buf, nLen); 1706 MicroProfileDrawText(nX+1, fY1 - (2+MICROPROFILE_TEXT_HEIGHT), UINT32_MAX, buf, nLen);
1710 } 1707 }
1711 1708
1712 1709
@@ -1782,7 +1779,7 @@ void MicroProfileDumpTimers()
1782 1779
1783 for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) 1780 for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j)
1784 { 1781 {
1785 uint64_t nMask = 1ll << j; 1782 uint64_t nMask = 1ULL << j;
1786 if(nMask & nActiveGroup) 1783 if(nMask & nActiveGroup)
1787 { 1784 {
1788 MICROPROFILE_PRINTF("%s\n", S.GroupInfo[j].pName); 1785 MICROPROFILE_PRINTF("%s\n", S.GroupInfo[j].pName);
@@ -1823,7 +1820,7 @@ inline void MicroProfileDrawBarView(uint32_t nScreenWidth, uint32_t nScreenHeigh
1823 uint32_t nNumGroups = 0; 1820 uint32_t nNumGroups = 0;
1824 for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) 1821 for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j)
1825 { 1822 {
1826 if(nActiveGroup & (1ll << j)) 1823 if(nActiveGroup & (1ULL << j))
1827 { 1824 {
1828 nNumTimers += S.GroupInfo[j].nNumTimers; 1825 nNumTimers += S.GroupInfo[j].nNumTimers;
1829 nNumGroups += 1; 1826 nNumGroups += 1;
@@ -1878,7 +1875,7 @@ inline void MicroProfileDrawBarView(uint32_t nScreenWidth, uint32_t nScreenHeigh
1878 for(uint32_t i = 0; i < nNumTimers+nNumGroups+1; ++i) 1875 for(uint32_t i = 0; i < nNumTimers+nNumGroups+1; ++i)
1879 { 1876 {
1880 uint32_t nY0 = nY + i * (nHeight + 1); 1877 uint32_t nY0 = nY + i * (nHeight + 1);
1881 bool bInside = (UI.nActiveMenu == -1) && ((UI.nMouseY >= nY0) && (UI.nMouseY < (nY0 + nHeight + 1))); 1878 bool bInside = (UI.nActiveMenu == UINT32_MAX) && ((UI.nMouseY >= nY0) && (UI.nMouseY < (nY0 + nHeight + 1)));
1882 MicroProfileDrawBox(nX, nY0, nWidth+nX, nY0 + (nHeight+1)+1, UI.nOpacityBackground | (g_nMicroProfileBackColors[nColorIndex++ & 1] + ((bInside) ? 0x002c2c2c : 0))); 1879 MicroProfileDrawBox(nX, nY0, nWidth+nX, nY0 + (nHeight+1)+1, UI.nOpacityBackground | (g_nMicroProfileBackColors[nColorIndex++ & 1] + ((bInside) ? 0x002c2c2c : 0)));
1883 } 1880 }
1884 nX += 10; 1881 nX += 10;
@@ -1927,22 +1924,22 @@ inline void MicroProfileDrawBarView(uint32_t nScreenWidth, uint32_t nScreenHeigh
1927 nY = nHeight + 3 - UI.nOffsetY; 1924 nY = nHeight + 3 - UI.nOffsetY;
1928 for(uint32_t i = 0; i < nNumTimers+nNumGroups+1; ++i) 1925 for(uint32_t i = 0; i < nNumTimers+nNumGroups+1; ++i)
1929 { 1926 {
1930 uint32_t nY0 = nY + i * (nHeight + 1); 1927 const uint32_t nY0 = nY + i * (nHeight + 1);
1931 bool bInside = (UI.nActiveMenu == -1) && ((UI.nMouseY >= nY0) && (UI.nMouseY < (nY0 + nHeight + 1))); 1928 const bool bInside = (UI.nActiveMenu == UINT32_MAX) && ((UI.nMouseY >= nY0) && (UI.nMouseY < (nY0 + nHeight + 1)));
1932 MicroProfileDrawBox(nX, nY0, nTimerWidth, nY0 + (nHeight+1)+1, 0xff0000000 | (g_nMicroProfileBackColors[nColorIndex++ & 1] + ((bInside) ? 0x002c2c2c : 0))); 1929 MicroProfileDrawBox(nX, nY0, nTimerWidth, nY0 + (nHeight+1)+1, 0xff0000000 | (g_nMicroProfileBackColors[nColorIndex++ & 1] + ((bInside) ? 0x002c2c2c : 0)));
1933 } 1930 }
1934 nX += MicroProfileDrawBarLegend(nX, nY, nTotalHeight, nTimerWidth-5) + 1; 1931 nX += MicroProfileDrawBarLegend(nX, nY, nTotalHeight, nTimerWidth-5) + 1;
1935 1932
1936 for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j) 1933 for(uint32_t j = 0; j < MICROPROFILE_MAX_GROUPS; ++j)
1937 { 1934 {
1938 if(nActiveGroup & (1ll << j)) 1935 if(nActiveGroup & (1ULL << j))
1939 { 1936 {
1940 MicroProfileDrawText(nX, nY + (1+nHeight) * nLegendOffset, (uint32_t)-1, S.GroupInfo[j].pName, S.GroupInfo[j].nNameLen); 1937 MicroProfileDrawText(nX, nY + (1+nHeight) * nLegendOffset, UINT32_MAX, S.GroupInfo[j].pName, S.GroupInfo[j].nNameLen);
1941 nLegendOffset += S.GroupInfo[j].nNumTimers+1; 1938 nLegendOffset += S.GroupInfo[j].nNumTimers+1;
1942 } 1939 }
1943 } 1940 }
1944 MicroProfileDrawHeader(nX, nTimerWidth-5, "Group"); 1941 MicroProfileDrawHeader(nX, nTimerWidth-5, "Group");
1945 MicroProfileDrawTextRight(nTimerWidth-3, MICROPROFILE_TEXT_HEIGHT + 2, (uint32_t)-1, "Timer", 5); 1942 MicroProfileDrawTextRight(nTimerWidth-3, MICROPROFILE_TEXT_HEIGHT + 2, UINT32_MAX, "Timer", 5);
1946 MicroProfileDrawLineVertical(nTimerWidth, 0, nTotalHeight+nY, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]); 1943 MicroProfileDrawLineVertical(nTimerWidth, 0, nTotalHeight+nY, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]);
1947 MicroProfileDrawLineHorizontal(0, nWidth, 2*MICROPROFILE_TEXT_HEIGHT + 3, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]); 1944 MicroProfileDrawLineHorizontal(0, nWidth, 2*MICROPROFILE_TEXT_HEIGHT + 3, UI.nOpacityBackground|g_nMicroProfileBackColors[0]|g_nMicroProfileBackColors[1]);
1948} 1945}
@@ -2003,7 +2000,7 @@ inline const char* MicroProfileUIMenuGroups(int nIndex, bool* bSelected)
2003 } 2000 }
2004 else 2001 else
2005 { 2002 {
2006 *bSelected = 0 != (S.nActiveGroupWanted & (1ll << Item.nIndex)); 2003 *bSelected = 0 != (S.nActiveGroupWanted & (1ULL << Item.nIndex));
2007 snprintf(buffer, sizeof(buffer)-1, " %s", Item.pName); 2004 snprintf(buffer, sizeof(buffer)-1, " %s", Item.pName);
2008 } 2005 }
2009 return buffer; 2006 return buffer;
@@ -2015,16 +2012,18 @@ inline const char* MicroProfileUIMenuGroups(int nIndex, bool* bSelected)
2015inline const char* MicroProfileUIMenuAggregate(int nIndex, bool* bSelected) 2012inline const char* MicroProfileUIMenuAggregate(int nIndex, bool* bSelected)
2016{ 2013{
2017 MicroProfile& S = *MicroProfileGet(); 2014 MicroProfile& S = *MicroProfileGet();
2018 if(nIndex < sizeof(g_MicroProfileAggregatePresets)/sizeof(g_MicroProfileAggregatePresets[0])) 2015 if(static_cast<uint32_t>(nIndex) < g_MicroProfileAggregatePresets.size())
2019 { 2016 {
2020 int val = g_MicroProfileAggregatePresets[nIndex]; 2017 uint32_t val = g_MicroProfileAggregatePresets[nIndex];
2021 *bSelected = (int)S.nAggregateFlip == val; 2018 *bSelected = S.nAggregateFlip == val;
2022 if(0 == val) 2019 if (0 == val)
2020 {
2023 return "Infinite"; 2021 return "Infinite";
2022 }
2024 else 2023 else
2025 { 2024 {
2026 static char buf[128]; 2025 static char buf[128];
2027 snprintf(buf, sizeof(buf)-1, "%7d", val); 2026 snprintf(buf, sizeof(buf)-1, "%7u", val);
2028 return buf; 2027 return buf;
2029 } 2028 }
2030 } 2029 }
@@ -2098,11 +2097,13 @@ inline const char* MicroProfileUIMenuPreset(int nIndex, bool* bSelected)
2098{ 2097{
2099 static char buf[128]; 2098 static char buf[128];
2100 *bSelected = false; 2099 *bSelected = false;
2101 int nNumPresets = sizeof(g_MicroProfilePresetNames) / sizeof(g_MicroProfilePresetNames[0]); 2100 int nNumPresets = static_cast<int>(g_MicroProfilePresetNames.size());
2102 int nIndexSave = nIndex - nNumPresets - 1; 2101 int nIndexSave = nIndex - nNumPresets - 1;
2103 if(nIndex == nNumPresets) 2102 if (nIndex == nNumPresets)
2103 {
2104 return "--"; 2104 return "--";
2105 else if(nIndexSave >=0 && nIndexSave <nNumPresets) 2105 }
2106 else if(nIndexSave >=0 && nIndexSave < nNumPresets)
2106 { 2107 {
2107 snprintf(buf, sizeof(buf)-1, "Save '%s'", g_MicroProfilePresetNames[nIndexSave]); 2108 snprintf(buf, sizeof(buf)-1, "Save '%s'", g_MicroProfilePresetNames[nIndexSave]);
2108 return buf; 2109 return buf;
@@ -2120,13 +2121,13 @@ inline const char* MicroProfileUIMenuPreset(int nIndex, bool* bSelected)
2120 2121
2121inline const char* MicroProfileUIMenuCustom(int nIndex, bool* bSelected) 2122inline const char* MicroProfileUIMenuCustom(int nIndex, bool* bSelected)
2122{ 2123{
2123 if((uint32_t)-1 == UI.nCustomActive) 2124 if(UINT32_MAX == UI.nCustomActive)
2124 { 2125 {
2125 *bSelected = nIndex == 0; 2126 *bSelected = nIndex == 0;
2126 } 2127 }
2127 else 2128 else
2128 { 2129 {
2129 *bSelected = nIndex-2 == UI.nCustomActive; 2130 *bSelected = nIndex-2 == static_cast<int>(UI.nCustomActive);
2130 } 2131 }
2131 switch(nIndex) 2132 switch(nIndex)
2132 { 2133 {
@@ -2202,7 +2203,7 @@ inline void MicroProfileUIClickGroups(int nIndex)
2202 else 2203 else
2203 { 2204 {
2204 MP_ASSERT(Item.nIndex < S.nGroupCount); 2205 MP_ASSERT(Item.nIndex < S.nGroupCount);
2205 S.nActiveGroupWanted ^= (1ll << Item.nIndex); 2206 S.nActiveGroupWanted ^= (1ULL << Item.nIndex);
2206 } 2207 }
2207 } 2208 }
2208 } 2209 }
@@ -2273,7 +2274,7 @@ inline void MicroProfileUIClickOptions(int nIndex)
2273 2274
2274inline void MicroProfileUIClickPreset(int nIndex) 2275inline void MicroProfileUIClickPreset(int nIndex)
2275{ 2276{
2276 int nNumPresets = sizeof(g_MicroProfilePresetNames) / sizeof(g_MicroProfilePresetNames[0]); 2277 int nNumPresets = static_cast<int>(g_MicroProfilePresetNames.size());
2277 int nIndexSave = nIndex - nNumPresets - 1; 2278 int nIndexSave = nIndex - nNumPresets - 1;
2278 if(nIndexSave >= 0 && nIndexSave < nNumPresets) 2279 if(nIndexSave >= 0 && nIndexSave < nNumPresets)
2279 { 2280 {
@@ -2310,7 +2311,7 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
2310 2311
2311 uint32_t nX = 0; 2312 uint32_t nX = 0;
2312 uint32_t nY = 0; 2313 uint32_t nY = 0;
2313 bool bMouseOver = UI.nMouseY < MICROPROFILE_TEXT_HEIGHT + 1; 2314
2314#define SBUF_SIZE 256 2315#define SBUF_SIZE 256
2315 char buffer[256]; 2316 char buffer[256];
2316 MicroProfileDrawBox(nX, nY, nX + nWidth, nY + (MICROPROFILE_TEXT_HEIGHT+1)+1, 0xff000000|g_nMicroProfileBackColors[1]); 2317 MicroProfileDrawBox(nX, nY, nX + nWidth, nY + (MICROPROFILE_TEXT_HEIGHT+1)+1, 0xff000000|g_nMicroProfileBackColors[1]);
@@ -2321,7 +2322,7 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
2321 uint32_t nNumMenuItems = 0; 2322 uint32_t nNumMenuItems = 0;
2322 2323
2323 int nLen = snprintf(buffer, 127, "MicroProfile"); 2324 int nLen = snprintf(buffer, 127, "MicroProfile");
2324 MicroProfileDrawText(nX, nY, (uint32_t)-1, buffer, nLen); 2325 MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nLen);
2325 nX += (sizeof("MicroProfile")+2) * (MICROPROFILE_TEXT_WIDTH+1); 2326 nX += (sizeof("MicroProfile")+2) * (MICROPROFILE_TEXT_WIDTH+1);
2326 pMenuText[nNumMenuItems++] = "Mode"; 2327 pMenuText[nNumMenuItems++] = "Mode";
2327 pMenuText[nNumMenuItems++] = "Groups"; 2328 pMenuText[nNumMenuItems++] = "Groups";
@@ -2409,7 +2410,7 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
2409 }; 2410 };
2410 2411
2411 2412
2412 uint32_t nSelectMenu = (uint32_t)-1; 2413 uint32_t nSelectMenu = UINT32_MAX;
2413 for(uint32_t i = 0; i < nNumMenuItems; ++i) 2414 for(uint32_t i = 0; i < nNumMenuItems; ++i)
2414 { 2415 {
2415 nMenuX[i] = nX; 2416 nMenuX[i] = nX;
@@ -2419,17 +2420,17 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
2419 { 2420 {
2420 MicroProfileDrawBox(nX-1, nY, nX + nLen * (MICROPROFILE_TEXT_WIDTH+1), nY +(MICROPROFILE_TEXT_HEIGHT+1)+1, 0xff888888); 2421 MicroProfileDrawBox(nX-1, nY, nX + nLen * (MICROPROFILE_TEXT_WIDTH+1), nY +(MICROPROFILE_TEXT_HEIGHT+1)+1, 0xff888888);
2421 nSelectMenu = i; 2422 nSelectMenu = i;
2422 if((UI.nMouseLeft || UI.nMouseRight) && i == (int)nPauseIndex) 2423 if((UI.nMouseLeft || UI.nMouseRight) && i == (uint32_t)nPauseIndex)
2423 { 2424 {
2424 S.nToggleRunning = 1; 2425 S.nToggleRunning = 1;
2425 } 2426 }
2426 } 2427 }
2427 MicroProfileDrawText(nX, nY, (uint32_t)-1, pMenuText[i], (uint32_t)strlen(pMenuText[i])); 2428 MicroProfileDrawText(nX, nY, UINT32_MAX, pMenuText[i], (uint32_t)strlen(pMenuText[i]));
2428 nX += (nLen+1) * (MICROPROFILE_TEXT_WIDTH+1); 2429 nX += (nLen+1) * (MICROPROFILE_TEXT_WIDTH+1);
2429 } 2430 }
2430 uint32_t nMenu = nSelectMenu != (uint32_t)-1 ? nSelectMenu : UI.nActiveMenu; 2431 uint32_t nMenu = nSelectMenu != UINT32_MAX ? nSelectMenu : UI.nActiveMenu;
2431 UI.nActiveMenu = nMenu; 2432 UI.nActiveMenu = nMenu;
2432 if((uint32_t)-1 != nMenu) 2433 if(UINT32_MAX != nMenu)
2433 { 2434 {
2434 nX = nMenuX[nMenu]; 2435 nX = nMenuX[nMenu];
2435 nY += MICROPROFILE_TEXT_HEIGHT+1; 2436 nY += MICROPROFILE_TEXT_HEIGHT+1;
@@ -2450,9 +2451,9 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
2450 { 2451 {
2451 UI.nActiveMenu = nMenu; 2452 UI.nActiveMenu = nMenu;
2452 } 2453 }
2453 else if(nSelectMenu == (uint32_t)-1) 2454 else if(nSelectMenu == UINT32_MAX)
2454 { 2455 {
2455 UI.nActiveMenu = (uint32_t)-1; 2456 UI.nActiveMenu = UINT32_MAX;
2456 } 2457 }
2457 MicroProfileDrawBox(nX, nY, nX + nWidth, nY + nHeight, 0xff000000|g_nMicroProfileBackColors[1]); 2458 MicroProfileDrawBox(nX, nY, nX + nWidth, nY + nHeight, 0xff000000|g_nMicroProfileBackColors[1]);
2458 for(int i = 0; i < nNumLines; ++i) 2459 for(int i = 0; i < nNumLines; ++i)
@@ -2461,7 +2462,6 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
2461 const char* pString = CB(i, &bSelected); 2462 const char* pString = CB(i, &bSelected);
2462 if(UI.nMouseY >= nY && UI.nMouseY < nY + MICROPROFILE_TEXT_HEIGHT + 1) 2463 if(UI.nMouseY >= nY && UI.nMouseY < nY + MICROPROFILE_TEXT_HEIGHT + 1)
2463 { 2464 {
2464 bMouseOver = true;
2465 if(UI.nMouseLeft || UI.nMouseRight) 2465 if(UI.nMouseLeft || UI.nMouseRight)
2466 { 2466 {
2467 CBClick[nMenu](i); 2467 CBClick[nMenu](i);
@@ -2469,7 +2469,7 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
2469 MicroProfileDrawBox(nX, nY, nX + nWidth, nY + MICROPROFILE_TEXT_HEIGHT + 1, 0xff888888); 2469 MicroProfileDrawBox(nX, nY, nX + nWidth, nY + MICROPROFILE_TEXT_HEIGHT + 1, 0xff888888);
2470 } 2470 }
2471 int nLen = snprintf(buffer, SBUF_SIZE-1, "%c %s", bSelected ? '*' : ' ' ,pString); 2471 int nLen = snprintf(buffer, SBUF_SIZE-1, "%c %s", bSelected ? '*' : ' ' ,pString);
2472 MicroProfileDrawText(nX, nY, (uint32_t)-1, buffer, nLen); 2472 MicroProfileDrawText(nX, nY, UINT32_MAX, buffer, nLen);
2473 nY += MICROPROFILE_TEXT_HEIGHT+1; 2473 nY += MICROPROFILE_TEXT_HEIGHT+1;
2474 } 2474 }
2475 } 2475 }
@@ -2484,7 +2484,7 @@ inline void MicroProfileDrawMenu(uint32_t nWidth, uint32_t nHeight)
2484 float fMaxMs = fToMs * S.nFlipMaxDisplay; 2484 float fMaxMs = fToMs * S.nFlipMaxDisplay;
2485 int nLen = snprintf(FrameTimeMessage, sizeof(FrameTimeMessage)-1, "Time[%6.2f] Avg[%6.2f] Max[%6.2f]", fMs, fAverageMs, fMaxMs); 2485 int nLen = snprintf(FrameTimeMessage, sizeof(FrameTimeMessage)-1, "Time[%6.2f] Avg[%6.2f] Max[%6.2f]", fMs, fAverageMs, fMaxMs);
2486 pMenuText[nNumMenuItems++] = &FrameTimeMessage[0]; 2486 pMenuText[nNumMenuItems++] = &FrameTimeMessage[0];
2487 MicroProfileDrawText(nWidth - nLen * (MICROPROFILE_TEXT_WIDTH+1), 0, -1, FrameTimeMessage, nLen); 2487 MicroProfileDrawText(nWidth - nLen * (MICROPROFILE_TEXT_WIDTH+1), 0, UINT32_MAX, FrameTimeMessage, nLen);
2488 } 2488 }
2489} 2489}
2490 2490
@@ -2538,7 +2538,7 @@ inline void MicroProfileMoveGraph()
2538 2538
2539inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight) 2539inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight)
2540{ 2540{
2541 if((uint32_t)-1 != UI.nCustomActive) 2541 if(UINT32_MAX != UI.nCustomActive)
2542 { 2542 {
2543 MicroProfile& S = *MicroProfileGet(); 2543 MicroProfile& S = *MicroProfileGet();
2544 MP_ASSERT(UI.nCustomActive < MICROPROFILE_CUSTOM_MAX); 2544 MP_ASSERT(UI.nCustomActive < MICROPROFILE_CUSTOM_MAX);
@@ -2571,8 +2571,8 @@ inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight)
2571 pColors[i] = S.TimerInfo[nTimerIndex].nColor; 2571 pColors[i] = S.TimerInfo[nTimerIndex].nColor;
2572 } 2572 }
2573 2573
2574 MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING + 3*MICROPROFILE_TEXT_WIDTH, nOffsetY, (uint32_t)-1, "Avg", sizeof("Avg")-1); 2574 MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING + 3*MICROPROFILE_TEXT_WIDTH, nOffsetY, UINT32_MAX, "Avg", sizeof("Avg")-1);
2575 MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING + 13*MICROPROFILE_TEXT_WIDTH, nOffsetY, (uint32_t)-1, "Max", sizeof("Max")-1); 2575 MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING + 13*MICROPROFILE_TEXT_WIDTH, nOffsetY, UINT32_MAX, "Max", sizeof("Max")-1);
2576 for(uint32_t i = 0; i < nCount; ++i) 2576 for(uint32_t i = 0; i < nCount; ++i)
2577 { 2577 {
2578 nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); 2578 nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT);
@@ -2582,10 +2582,10 @@ inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight)
2582 int nSize; 2582 int nSize;
2583 uint32_t nOffsetX = MICROPROFILE_CUSTOM_PADDING; 2583 uint32_t nOffsetX = MICROPROFILE_CUSTOM_PADDING;
2584 nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2f", pTimeAvg[i]); 2584 nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2f", pTimeAvg[i]);
2585 MicroProfileDrawText(nOffsetX, nOffsetY, (uint32_t)-1, Buffer, nSize); 2585 MicroProfileDrawText(nOffsetX, nOffsetY, UINT32_MAX, Buffer, nSize);
2586 nOffsetX += (nSize+2) * (MICROPROFILE_TEXT_WIDTH+1); 2586 nOffsetX += (nSize+2) * (MICROPROFILE_TEXT_WIDTH+1);
2587 nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2f", pTimeMax[i]); 2587 nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2f", pTimeMax[i]);
2588 MicroProfileDrawText(nOffsetX, nOffsetY, (uint32_t)-1, Buffer, nSize); 2588 MicroProfileDrawText(nOffsetX, nOffsetY, UINT32_MAX, Buffer, nSize);
2589 nOffsetX += (nSize+2) * (MICROPROFILE_TEXT_WIDTH+1); 2589 nOffsetX += (nSize+2) * (MICROPROFILE_TEXT_WIDTH+1);
2590 nSize = snprintf(Buffer, sizeof(Buffer)-1, "%s:%s", S.GroupInfo[nGroupIndex].pName, pTimerInfo->pName); 2590 nSize = snprintf(Buffer, sizeof(Buffer)-1, "%s:%s", S.GroupInfo[nGroupIndex].pName, pTimerInfo->pName);
2591 MicroProfileDrawText(nOffsetX, nOffsetY, pTimerInfo->nColor, Buffer, nSize); 2591 MicroProfileDrawText(nOffsetX, nOffsetY, pTimerInfo->nColor, Buffer, nSize);
@@ -2599,9 +2599,9 @@ inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight)
2599 nOffsetY = nOffsetYBase; 2599 nOffsetY = nOffsetYBase;
2600 float* pMs = pCustom->nFlags & MICROPROFILE_CUSTOM_BAR_SOURCE_MAX ? pTimeMax : pTimeAvg; 2600 float* pMs = pCustom->nFlags & MICROPROFILE_CUSTOM_BAR_SOURCE_MAX ? pTimeMax : pTimeAvg;
2601 const char* pString = pCustom->nFlags & MICROPROFILE_CUSTOM_BAR_SOURCE_MAX ? "Max" : "Avg"; 2601 const char* pString = pCustom->nFlags & MICROPROFILE_CUSTOM_BAR_SOURCE_MAX ? "Max" : "Avg";
2602 MicroProfileDrawText(nMaxOffsetX, nOffsetY, (uint32_t)-1, pString, static_cast<uint32_t>(strlen(pString))); 2602 MicroProfileDrawText(nMaxOffsetX, nOffsetY, UINT32_MAX, pString, static_cast<uint32_t>(strlen(pString)));
2603 int nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2fms", fReference); 2603 int nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2fms", fReference);
2604 MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, (uint32_t)-1, Buffer, nSize); 2604 MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, UINT32_MAX, Buffer, nSize);
2605 for(uint32_t i = 0; i < nCount; ++i) 2605 for(uint32_t i = 0; i < nCount; ++i)
2606 { 2606 {
2607 nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); 2607 nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT);
@@ -2613,9 +2613,9 @@ inline void MicroProfileDrawCustom(uint32_t nWidth, uint32_t nHeight)
2613 { 2613 {
2614 nOffsetY += 2*(1+MICROPROFILE_TEXT_HEIGHT); 2614 nOffsetY += 2*(1+MICROPROFILE_TEXT_HEIGHT);
2615 const char* pString = pCustom->nFlags & MICROPROFILE_CUSTOM_STACK_SOURCE_MAX ? "Max" : "Avg"; 2615 const char* pString = pCustom->nFlags & MICROPROFILE_CUSTOM_STACK_SOURCE_MAX ? "Max" : "Avg";
2616 MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING, nOffsetY, (uint32_t)-1, pString, static_cast<uint32_t>(strlen(pString))); 2616 MicroProfileDrawText(MICROPROFILE_CUSTOM_PADDING, nOffsetY, UINT32_MAX, pString, static_cast<uint32_t>(strlen(pString)));
2617 int nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2fms", fReference); 2617 int nSize = snprintf(Buffer, sizeof(Buffer)-1, "%6.2fms", fReference);
2618 MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, (uint32_t)-1, Buffer, nSize); 2618 MicroProfileDrawText(nReducedWidth - (1+nSize) * (MICROPROFILE_TEXT_WIDTH+1), nOffsetY, UINT32_MAX, Buffer, nSize);
2619 nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT); 2619 nOffsetY += (1+MICROPROFILE_TEXT_HEIGHT);
2620 float fPosX = MICROPROFILE_CUSTOM_PADDING; 2620 float fPosX = MICROPROFILE_CUSTOM_PADDING;
2621 float* pMs = pCustom->nFlags & MICROPROFILE_CUSTOM_STACK_SOURCE_MAX ? pTimeMax : pTimeAvg; 2621 float* pMs = pCustom->nFlags & MICROPROFILE_CUSTOM_STACK_SOURCE_MAX ? pTimeMax : pTimeAvg;
@@ -2668,7 +2668,7 @@ inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight)
2668 UI.nHoverTime = 0; 2668 UI.nHoverTime = 0;
2669 UI.nHoverFrame = -1; 2669 UI.nHoverFrame = -1;
2670 if(S.nDisplay != MP_DRAW_DETAILED) 2670 if(S.nDisplay != MP_DRAW_DETAILED)
2671 S.nContextSwitchHoverThread = S.nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadBefore = -1; 2671 S.nContextSwitchHoverThread = S.nContextSwitchHoverThreadAfter = S.nContextSwitchHoverThreadBefore = UINT32_MAX;
2672 MicroProfileMoveGraph(); 2672 MicroProfileMoveGraph();
2673 2673
2674 2674
@@ -2798,13 +2798,13 @@ inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight)
2798 2798
2799 2799
2800 2800
2801 if(UI.nActiveMenu == -1 && !bMouseOverGraph) 2801 if(UI.nActiveMenu == UINT32_MAX && !bMouseOverGraph)
2802 { 2802 {
2803 if(UI.nHoverToken != MICROPROFILE_INVALID_TOKEN) 2803 if(UI.nHoverToken != MICROPROFILE_INVALID_TOKEN)
2804 { 2804 {
2805 MicroProfileDrawFloatTooltip(UI.nMouseX, UI.nMouseY, UI.nHoverToken, UI.nHoverTime); 2805 MicroProfileDrawFloatTooltip(UI.nMouseX, UI.nMouseY, UI.nHoverToken, UI.nHoverTime);
2806 } 2806 }
2807 else if(S.nContextSwitchHoverThreadAfter != -1 && S.nContextSwitchHoverThreadBefore != -1) 2807 else if(S.nContextSwitchHoverThreadAfter != UINT32_MAX && S.nContextSwitchHoverThreadBefore != UINT32_MAX)
2808 { 2808 {
2809 float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu()); 2809 float fToMs = MicroProfileTickToMsMultiplier(MicroProfileTicksPerSecondCpu());
2810 MicroProfileStringArray ToolTip; 2810 MicroProfileStringArray ToolTip;
@@ -2820,7 +2820,7 @@ inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight)
2820 MicroProfileStringArrayFormat(&ToolTip, "%6.2fms", fToMs * nDifference ); 2820 MicroProfileStringArrayFormat(&ToolTip, "%6.2fms", fToMs * nDifference );
2821 MicroProfileStringArrayAddLiteral(&ToolTip, "CPU"); 2821 MicroProfileStringArrayAddLiteral(&ToolTip, "CPU");
2822 MicroProfileStringArrayFormat(&ToolTip, "%d", S.nContextSwitchHoverCpu); 2822 MicroProfileStringArrayFormat(&ToolTip, "%d", S.nContextSwitchHoverCpu);
2823 MicroProfileDrawFloatWindow(UI.nMouseX, UI.nMouseY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, -1); 2823 MicroProfileDrawFloatWindow(UI.nMouseX, UI.nMouseY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, UINT32_MAX);
2824 2824
2825 2825
2826 } 2826 }
@@ -2858,7 +2858,7 @@ inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight)
2858 } 2858 }
2859 } 2859 }
2860 #endif 2860 #endif
2861 MicroProfileDrawFloatWindow(UI.nMouseX, UI.nMouseY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, -1); 2861 MicroProfileDrawFloatWindow(UI.nMouseX, UI.nMouseY+20, &ToolTip.ppStrings[0], ToolTip.nNumStrings, UINT32_MAX);
2862 } 2862 }
2863 if(UI.nMouseLeft) 2863 if(UI.nMouseLeft)
2864 { 2864 {
@@ -2883,7 +2883,7 @@ inline void MicroProfileDraw(uint32_t nWidth, uint32_t nHeight)
2883#endif 2883#endif
2884 m.unlock(); 2884 m.unlock();
2885 } 2885 }
2886 else if(UI.nCustomActive != (uint32_t)-1) 2886 else if(UI.nCustomActive != UINT32_MAX)
2887 { 2887 {
2888 std::recursive_mutex& m = MicroProfileGetMutex(); 2888 std::recursive_mutex& m = MicroProfileGetMutex();
2889 m.lock(); 2889 m.lock();
@@ -3179,7 +3179,7 @@ void MicroProfileLoadPreset(const char* pSuffix)
3179 { 3179 {
3180 if(0 == MP_STRCASECMP(pGroupName, S.GroupInfo[j].pName)) 3180 if(0 == MP_STRCASECMP(pGroupName, S.GroupInfo[j].pName))
3181 { 3181 {
3182 S.nActiveGroupWanted |= (1ll << j); 3182 S.nActiveGroupWanted |= (1ULL << j);
3183 } 3183 }
3184 } 3184 }
3185 } 3185 }
@@ -3212,7 +3212,7 @@ void MicroProfileLoadPreset(const char* pSuffix)
3212 uint64_t nGroupIndex = S.TimerInfo[j].nGroupIndex; 3212 uint64_t nGroupIndex = S.TimerInfo[j].nGroupIndex;
3213 if(0 == MP_STRCASECMP(pGraphName, S.TimerInfo[j].pName) && 0 == MP_STRCASECMP(pGraphGroupName, S.GroupInfo[nGroupIndex].pName)) 3213 if(0 == MP_STRCASECMP(pGraphName, S.TimerInfo[j].pName) && 0 == MP_STRCASECMP(pGraphGroupName, S.GroupInfo[nGroupIndex].pName))
3214 { 3214 {
3215 MicroProfileToken nToken = MicroProfileMakeToken(1ll << nGroupIndex, (uint16_t)j); 3215 MicroProfileToken nToken = MicroProfileMakeToken(1ULL << nGroupIndex, (uint16_t)j);
3216 S.Graph[i].nToken = nToken; // note: group index is stored here but is checked without in MicroProfileToggleGraph()! 3216 S.Graph[i].nToken = nToken; // note: group index is stored here but is checked without in MicroProfileToggleGraph()!
3217 S.TimerInfo[j].bGraph = true; 3217 S.TimerInfo[j].bGraph = true;
3218 if(nToken != nPrevToken) 3218 if(nToken != nPrevToken)
@@ -3235,7 +3235,7 @@ inline uint32_t MicroProfileCustomGroupFind(const char* pCustomName)
3235 return i; 3235 return i;
3236 } 3236 }
3237 } 3237 }
3238 return (uint32_t)-1; 3238 return UINT32_MAX;
3239} 3239}
3240 3240
3241inline uint32_t MicroProfileCustomGroup(const char* pCustomName) 3241inline uint32_t MicroProfileCustomGroup(const char* pCustomName)
@@ -3251,7 +3251,7 @@ inline uint32_t MicroProfileCustomGroup(const char* pCustomName)
3251 uint32_t nIndex = UI.nCustomCount; 3251 uint32_t nIndex = UI.nCustomCount;
3252 UI.nCustomCount++; 3252 UI.nCustomCount++;
3253 memset(&UI.Custom[nIndex], 0, sizeof(UI.Custom[nIndex])); 3253 memset(&UI.Custom[nIndex], 0, sizeof(UI.Custom[nIndex]));
3254 uint32_t nLen = (uint32_t)strlen(pCustomName); 3254 size_t nLen = strlen(pCustomName);
3255 if(nLen > MICROPROFILE_NAME_MAX_LEN-1) 3255 if(nLen > MICROPROFILE_NAME_MAX_LEN-1)
3256 nLen = MICROPROFILE_NAME_MAX_LEN-1; 3256 nLen = MICROPROFILE_NAME_MAX_LEN-1;
3257 memcpy(&UI.Custom[nIndex].pName[0], pCustomName, nLen); 3257 memcpy(&UI.Custom[nIndex].pName[0], pCustomName, nLen);
@@ -3309,7 +3309,7 @@ inline void MicroProfileCustomGroupEnable(uint32_t nIndex)
3309void MicroProfileCustomGroupToggle(const char* pCustomName) 3309void MicroProfileCustomGroupToggle(const char* pCustomName)
3310{ 3310{
3311 uint32_t nIndex = MicroProfileCustomGroupFind(pCustomName); 3311 uint32_t nIndex = MicroProfileCustomGroupFind(pCustomName);
3312 if(nIndex == (uint32_t)-1 || nIndex == UI.nCustomActive) 3312 if(nIndex == UINT32_MAX || nIndex == UI.nCustomActive)
3313 { 3313 {
3314 MicroProfileCustomGroupDisable(); 3314 MicroProfileCustomGroupDisable();
3315 } 3315 }
@@ -3328,13 +3328,13 @@ void MicroProfileCustomGroupDisable()
3328{ 3328{
3329 MicroProfile& S = *MicroProfileGet(); 3329 MicroProfile& S = *MicroProfileGet();
3330 S.nForceGroupUI = 0; 3330 S.nForceGroupUI = 0;
3331 UI.nCustomActive = (uint32_t)-1; 3331 UI.nCustomActive = UINT32_MAX;
3332} 3332}
3333 3333
3334void MicroProfileCustomGroupAddTimer(const char* pCustomName, const char* pGroup, const char* pTimer) 3334void MicroProfileCustomGroupAddTimer(const char* pCustomName, const char* pGroup, const char* pTimer)
3335{ 3335{
3336 uint32_t nIndex = MicroProfileCustomGroupFind(pCustomName); 3336 uint32_t nIndex = MicroProfileCustomGroupFind(pCustomName);
3337 if((uint32_t)-1 == nIndex) 3337 if(UINT32_MAX == nIndex)
3338 { 3338 {
3339 return; 3339 return;
3340 } 3340 }
@@ -3344,7 +3344,7 @@ void MicroProfileCustomGroupAddTimer(const char* pCustomName, const char* pGroup
3344 MP_ASSERT(nToken != MICROPROFILE_INVALID_TOKEN); //Timer must be registered first. 3344 MP_ASSERT(nToken != MICROPROFILE_INVALID_TOKEN); //Timer must be registered first.
3345 UI.Custom[nIndex].pTimers[nTimerIndex] = nToken; 3345 UI.Custom[nIndex].pTimers[nTimerIndex] = nToken;
3346 uint16_t nGroup = MicroProfileGetGroupIndex(nToken); 3346 uint16_t nGroup = MicroProfileGetGroupIndex(nToken);
3347 UI.Custom[nIndex].nGroupMask |= (1ll << nGroup); 3347 UI.Custom[nIndex].nGroupMask |= (1ULL << nGroup);
3348 UI.Custom[nIndex].nNumTimers++; 3348 UI.Custom[nIndex].nNumTimers++;
3349} 3349}
3350 3350