Fix empty window when developer mode is disabled, add CVars for rendering information

This commit is contained in:
Phillip Stephens 2023-10-22 18:38:58 -07:00
parent 70443ddff5
commit e4e6c0c00a
4 changed files with 23 additions and 4 deletions

View File

@ -51,6 +51,15 @@ CVarCommons::CVarCommons(CVarManager& manager) : m_mgr(manager) {
m_debugOverlayShowRandomStats = m_debugOverlayShowRandomStats =
m_mgr.findOrMakeCVar("debugOverlay.showRandomStats", "Displays the current number of random calls per frame"sv, 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); 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, m_debugOverlayShowInput = m_mgr.findOrMakeCVar("debugOverlay.showInput"sv, "Displays controller input"sv, false,
CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly); CVar::EFlags::Game | CVar::EFlags::Archive | CVar::EFlags::ReadOnly);
m_debugOverlayCorner = m_debugOverlayCorner =
@ -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 */, m_mgr.findOrMakeCVar("debugOverlay.inputOverlayCorner"sv, "ImGui input overlay corner"sv, 3 /* bottom-right */,
CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::Hidden); CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::Hidden);
m_debugInputOverlayPos = 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); CVar::EFlags::System | CVar::EFlags::Archive | CVar::EFlags::Hidden);
m_debugToolDrawAiPath = m_debugToolDrawAiPath =

View File

@ -38,6 +38,9 @@ struct CVarCommons {
CVar* m_debugOverlayShowResourceStats = nullptr; CVar* m_debugOverlayShowResourceStats = nullptr;
CVar* m_debugOverlayShowRandomStats = nullptr; CVar* m_debugOverlayShowRandomStats = nullptr;
CVar* m_debugOverlayShowRoomTimer = nullptr; CVar* m_debugOverlayShowRoomTimer = nullptr;
CVar* m_debugOverlayPipelineInfo = nullptr;
CVar* m_debugOverlayDrawCallInfo = nullptr;
CVar* m_debugOverlayBufferInfo = nullptr;
CVar* m_debugOverlayShowInput = nullptr; CVar* m_debugOverlayShowInput = nullptr;
CVar* m_debugOverlayCorner = nullptr; CVar* m_debugOverlayCorner = nullptr;
CVar* m_debugInputOverlayCorner = nullptr; CVar* m_debugInputOverlayCorner = nullptr;

View File

@ -813,6 +813,9 @@ static std::string BytesToString(size_t bytes) {
} }
void ImGuiConsole::ShowDebugOverlay() { void ImGuiConsole::ShowDebugOverlay() {
if (!m_developer) {
return;
}
if (!m_frameCounter && !m_frameRate && !m_inGameTime && !m_roomTimer && !m_playerInfo && !m_areaInfo && 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) { !m_worldInfo && !m_randomStats && !m_resourceStats && !m_pipelineInfo && !m_drawCallInfo && !m_bufferInfo) {
return; return;
@ -1283,6 +1286,9 @@ void ImGuiConsole::ShowAppMainMenuBar(bool canInspect, bool preLaunch) {
ImGuiCVarMenuItem("Area Info", m_cvarCommons.m_debugOverlayAreaInfo, m_areaInfo); ImGuiCVarMenuItem("Area Info", m_cvarCommons.m_debugOverlayAreaInfo, m_areaInfo);
ImGuiCVarMenuItem("Layer Info", m_cvarCommons.m_debugOverlayLayerInfo, m_layerInfo); ImGuiCVarMenuItem("Layer Info", m_cvarCommons.m_debugOverlayLayerInfo, m_layerInfo);
ImGuiCVarMenuItem("Random Stats", m_cvarCommons.m_debugOverlayShowRandomStats, m_randomStats); 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("Resource Stats", m_cvarCommons.m_debugOverlayShowResourceStats, m_resourceStats);
ImGuiCVarMenuItem("Show Input", m_cvarCommons.m_debugOverlayShowInput, m_showInput); ImGuiCVarMenuItem("Show Input", m_cvarCommons.m_debugOverlayShowInput, m_showInput);
#if 0 // Currently unimplemented #if 0 // Currently unimplemented

View File

@ -121,9 +121,9 @@ private:
bool m_drawCallInfo = false; bool m_drawCallInfo = false;
bool m_bufferInfo = false; bool m_bufferInfo = false;
#else #else
bool m_pipelineInfo = true; // TODO cvar bool m_pipelineInfo = m_cvarCommons.m_debugOverlayPipelineInfo->toBoolean(); // TODO cvar
bool m_drawCallInfo = true; // TODO cvar bool m_drawCallInfo = m_cvarCommons.m_debugOverlayDrawCallInfo->toBoolean(); // TODO cvar
bool m_bufferInfo = true; // TODO cvar bool m_bufferInfo = m_cvarCommons.m_debugOverlayBufferInfo->toBoolean(); // TODO cvar
#endif #endif
bool m_developer = m_cvarMgr.findCVar("developer")->toBoolean(); bool m_developer = m_cvarMgr.findCVar("developer")->toBoolean();
bool m_cheats = m_cvarMgr.findCVar("cheats")->toBoolean(); bool m_cheats = m_cvarMgr.findCVar("cheats")->toBoolean();