mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-09 04:30:49 -04:00
Add pipeline progress overlay
This commit is contained in:
@@ -174,7 +174,7 @@ namespace dusk {
|
||||
|
||||
ImGuiConsole::ImGuiConsole() {}
|
||||
|
||||
void ImGuiConsole::draw() {
|
||||
void ImGuiConsole::PreDraw() {
|
||||
if (!m_isLaunchInitialized) {
|
||||
m_toasts.emplace_back("Press F1 to toggle menu"s, 5.f);
|
||||
m_isLaunchInitialized = true;
|
||||
@@ -182,7 +182,6 @@ namespace dusk {
|
||||
|
||||
if (CheckMenuViewToggle(ImGuiKey_F1, m_isHidden)) {
|
||||
ShowToasts();
|
||||
m_menuTools.afterDraw();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -200,8 +199,13 @@ namespace dusk {
|
||||
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
ShowToasts();
|
||||
}
|
||||
|
||||
void ImGuiConsole::PostDraw() {
|
||||
m_menuTools.afterDraw();
|
||||
ShowPipelineProgress();
|
||||
}
|
||||
|
||||
bool ImGuiConsole::CheckMenuViewToggle(ImGuiKey key, bool& active) {
|
||||
@@ -274,4 +278,32 @@ namespace dusk {
|
||||
m_toasts.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiConsole::ShowPipelineProgress() {
|
||||
const auto* stats = aurora_get_stats();
|
||||
const u32 queuedPipelines = stats->queuedPipelines;
|
||||
if (queuedPipelines == 0) {
|
||||
return;
|
||||
}
|
||||
const u32 createdPipelines = stats->createdPipelines;
|
||||
const u32 totalPipelines = queuedPipelines + createdPipelines;
|
||||
|
||||
const auto* viewport = ImGui::GetMainViewport();
|
||||
const auto padding = viewport->WorkPos.y + 10.f;
|
||||
const auto halfWidth = viewport->GetWorkCenter().x;
|
||||
ImGui::SetNextWindowPos(ImVec2{halfWidth, padding}, ImGuiCond_Always, ImVec2{0.5f, 0.f});
|
||||
ImGui::SetNextWindowSize(ImVec2{halfWidth, 0.f}, ImGuiCond_Always);
|
||||
ImGui::SetNextWindowBgAlpha(0.65f);
|
||||
ImGui::Begin("Pipelines", nullptr,
|
||||
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove |
|
||||
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing);
|
||||
const auto percent = static_cast<float>(createdPipelines) / static_cast<float>(totalPipelines);
|
||||
const auto progressStr = fmt::format("Processing pipelines: {} / {}", createdPipelines, totalPipelines);
|
||||
const auto textSize = ImGui::CalcTextSize(progressStr.data(), progressStr.data() + progressStr.size());
|
||||
ImGui::NewLine();
|
||||
ImGui::SameLine(ImGui::GetWindowWidth() / 2.f - textSize.x + textSize.x / 2.f);
|
||||
ImGuiStringViewText(progressStr);
|
||||
ImGui::ProgressBar(percent);
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ namespace dusk {
|
||||
class ImGuiConsole {
|
||||
public:
|
||||
ImGuiConsole();
|
||||
void draw();
|
||||
void PreDraw();
|
||||
void PostDraw();
|
||||
|
||||
ImGuiMenuTools::CollisionViewSettings& getCollisionViewSettings() {
|
||||
return m_menuTools.getCollisionViewSettings();
|
||||
@@ -39,6 +40,7 @@ private:
|
||||
ImGuiMenuEnhancements m_menuEnhancements;
|
||||
|
||||
void ShowToasts();
|
||||
void ShowPipelineProgress();
|
||||
};
|
||||
|
||||
extern ImGuiConsole g_imguiConsole;
|
||||
|
||||
@@ -1634,6 +1634,10 @@ int mDoGph_Painter() {
|
||||
if (wn != 0) sDiagLoggedWindow = true;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
dusk::g_imguiConsole.PreDraw();
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
drawHeapMap();
|
||||
#endif
|
||||
@@ -2244,7 +2248,7 @@ int mDoGph_Painter() {
|
||||
#endif
|
||||
|
||||
#if TARGET_PC
|
||||
dusk::g_imguiConsole.draw();
|
||||
dusk::g_imguiConsole.PostDraw();
|
||||
#endif
|
||||
|
||||
mDoGph_gInf_c::endRender();
|
||||
|
||||
Reference in New Issue
Block a user