| 1451 | #endif |
| 1452 | |
| 1453 | void CEntitySystem::DebugDrawLayerInfo() |
| 1454 | { |
| 1455 | |
| 1456 | #ifdef ENABLE_PROFILING_CODE |
| 1457 | |
| 1458 | bool bRenderAllLayerStats = CVar::es_LayerDebugInfo >= 2; |
| 1459 | bool bRenderMemoryStats = CVar::es_LayerDebugInfo == 3; |
| 1460 | bool bRenderAllLayerPakStats = CVar::es_LayerDebugInfo == 4; |
| 1461 | bool bShowLayerActivation = CVar::es_LayerDebugInfo == 5; |
| 1462 | |
| 1463 | float tx = 0; |
| 1464 | float ty = 30; |
| 1465 | float ystep = 12.0f; |
| 1466 | ColorF clText(0, 1, 1, 1); |
| 1467 | |
| 1468 | if (bShowLayerActivation) // Show which layer was switched on or off |
| 1469 | { |
| 1470 | const float fShowTime = 10.0f; // 10 seconds |
| 1471 | float fCurTime = gEnv->pTimer->GetCurrTime(); |
| 1472 | float fPrevTime = 0; |
| 1473 | std::vector<SLayerProfile>::iterator ppClearProfile = m_layerProfiles.end(); |
| 1474 | for (std::vector<SLayerProfile>::iterator ppProfiles = m_layerProfiles.begin(); ppProfiles != m_layerProfiles.end(); ++ppProfiles) |
| 1475 | { |
| 1476 | SLayerProfile& profile = (*ppProfiles); |
| 1477 | CEntityLayer* pLayer = profile.pLayer; |
| 1478 | |
| 1479 | ColorF clTextProfiledTime(0, 1, 1, 1); |
| 1480 | if (profile.fTimeMS > 50) // Red color for more then 50 ms |
| 1481 | clTextProfiledTime = ColorF(1, 0.3f, 0.3f, 1); |
| 1482 | else if (profile.fTimeMS > 10) // Yellow color for more then 10 ms |
| 1483 | clTextProfiledTime = ColorF(1, 1, 0.3f, 1); |
| 1484 | |
| 1485 | if (!profile.isEnable) |
| 1486 | clTextProfiledTime -= ColorF(0.3f, 0.3f, 0.3f, 0); |
| 1487 | |
| 1488 | float xstep = 0.0f; |
| 1489 | if (strlen(pLayer->GetParentName()) > 0) |
| 1490 | { |
| 1491 | xstep += 20; |
| 1492 | const IEntityLayer* const pParentLayer = FindLayer(pLayer->GetParentName()); |
| 1493 | if (pParentLayer && strlen(pParentLayer->GetParentName()) > 0) |
| 1494 | xstep += 20; |
| 1495 | } |
| 1496 | if (profile.fTimeOn != fPrevTime) |
| 1497 | { |
| 1498 | ty += 10.0f; |
| 1499 | fPrevTime = profile.fTimeOn; |
| 1500 | } |
| 1501 | |
| 1502 | DrawText(tx + xstep, ty += ystep, clTextProfiledTime, "%.1f ms: %s (%s)", profile.fTimeMS, pLayer->GetName(), profile.isEnable ? "On" : "Off"); |
| 1503 | if (ppClearProfile == m_layerProfiles.end() && fCurTime - profile.fTimeOn > fShowTime) |
| 1504 | ppClearProfile = ppProfiles; |
| 1505 | } |
| 1506 | if (ppClearProfile != m_layerProfiles.end()) |
| 1507 | m_layerProfiles.erase(ppClearProfile, m_layerProfiles.end()); |
| 1508 | return; |
| 1509 | } |
| 1510 |
nothing calls this directly
no test coverage detected