Skip to content

Commit

Permalink
Fix empty window when developer mode is disabled, add CVars for rende…
Browse files Browse the repository at this point in the history
…ring information
  • Loading branch information
Antidote committed Oct 23, 2023
1 parent 70443dd commit e4e6c0c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
12 changes: 11 additions & 1 deletion Runtime/ConsoleVariables/CVarCommons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) {
m_debugOverlayShowRandomStats =
m_mgr.findOrMakeCVar("debugOverlay.showRandomStats", "Displays the current number of random calls per frame"sv,
false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
m_debugOverlayPipelineInfo =
m_mgr.findOrMakeCVar("debugOverlay.pipelineInfo"sv, "Displays the current pipeline memory usage per frame"sv,
false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
m_debugOverlayDrawCallInfo =
m_mgr.findOrMakeCVar("debugOverlay.drawCallInfo"sv, "Displays the current number of draw calls per frame"sv,
false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
m_debugOverlayBufferInfo =
m_mgr.findOrMakeCVar("debugOverlay.bufferInfo"sv, "Displays the current buffer memory usage per frame"sv,
false, CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
m_debugOverlayShowInput = m_mgr.findOrMakeCVar("debugOverlay.showInput"sv, "Displays controller input"sv, false,
CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
m_debugOverlayCorner =
Expand All @@ -60,7 +69,8 @@ CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) {
m_mgr.findOrMakeCVar("debugOverlay.inputOverlayCorner"sv, "ImGui input overlay corner"sv, 3 /* bottom-right */,
CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::Hidden);
m_debugInputOverlayPos =
m_mgr.findOrMakeCVar("debugOverlay.inputOverlayPosition"sv, "ImGui custom input overlay position"sv, zeus::CVector2f{0.f, 0.f} /* uninitialized */,
m_mgr.findOrMakeCVar("debugOverlay.inputOverlayPosition"sv, "ImGui custom input overlay position"sv,
zeus::CVector2f{0.f, 0.f} /* uninitialized */,
CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::Hidden);

m_debugToolDrawAiPath =
Expand Down
3 changes: 3 additions & 0 deletions Runtime/ConsoleVariables/CVarCommons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ struct CVarCommons {
CVar* m_debugOverlayShowResourceStats = nullptr;
CVar* m_debugOverlayShowRandomStats = nullptr;
CVar* m_debugOverlayShowRoomTimer = nullptr;
CVar* m_debugOverlayPipelineInfo = nullptr;
CVar* m_debugOverlayDrawCallInfo = nullptr;
CVar* m_debugOverlayBufferInfo = nullptr;
CVar* m_debugOverlayShowInput = nullptr;
CVar* m_debugOverlayCorner = nullptr;
CVar* m_debugInputOverlayCorner = nullptr;
Expand Down
6 changes: 6 additions & 0 deletions Runtime/ImGuiConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,9 @@ static std::string BytesToString(size_t bytes) {
}

void ImGuiConsole::ShowDebugOverlay() {
if (!m_developer) {
return;
}
if (!m_frameCounter && !m_frameRate && !m_inGameTime && !m_roomTimer && !m_playerInfo && !m_areaInfo &&
!m_worldInfo && !m_randomStats && !m_resourceStats && !m_pipelineInfo && !m_drawCallInfo && !m_bufferInfo) {
return;
Expand Down Expand Up @@ -1283,6 +1286,9 @@ void ImGuiConsole::ShowAppMainMenuBar(bool canInspect, bool preLaunch) {
ImGuiCVarMenuItem("Area Info", m_cvarCommons.m_debugOverlayAreaInfo, m_areaInfo);
ImGuiCVarMenuItem("Layer Info", m_cvarCommons.m_debugOverlayLayerInfo, m_layerInfo);
ImGuiCVarMenuItem("Random Stats", m_cvarCommons.m_debugOverlayShowRandomStats, m_randomStats);
ImGuiCVarMenuItem("Draw Call Info", m_cvarCommons.m_debugOverlayDrawCallInfo, m_drawCallInfo);
ImGuiCVarMenuItem("Pipeline Info", m_cvarCommons.m_debugOverlayPipelineInfo, m_pipelineInfo);
ImGuiCVarMenuItem("Buffer Info", m_cvarCommons.m_debugOverlayBufferInfo, m_bufferInfo);
ImGuiCVarMenuItem("Resource Stats", m_cvarCommons.m_debugOverlayShowResourceStats, m_resourceStats);
ImGuiCVarMenuItem("Show Input", m_cvarCommons.m_debugOverlayShowInput, m_showInput);
#if 0 // Currently unimplemented
Expand Down
6 changes: 3 additions & 3 deletions Runtime/ImGuiConsole.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ class ImGuiConsole {
bool m_drawCallInfo = false;
bool m_bufferInfo = false;
#else
bool m_pipelineInfo = true; // TODO cvar
bool m_drawCallInfo = true; // TODO cvar
bool m_bufferInfo = true; // TODO cvar
bool m_pipelineInfo = m_cvarCommons.m_debugOverlayPipelineInfo->toBoolean(); // TODO cvar
bool m_drawCallInfo = m_cvarCommons.m_debugOverlayDrawCallInfo->toBoolean(); // TODO cvar
bool m_bufferInfo = m_cvarCommons.m_debugOverlayBufferInfo->toBoolean(); // TODO cvar
#endif
bool m_developer = m_cvarMgr.findCVar("developer")->toBoolean();
bool m_cheats = m_cvarMgr.findCVar("cheats")->toBoolean();
Expand Down

0 comments on commit e4e6c0c

Please sign in to comment.