mirror of https://github.com/AxioDL/metaforce.git
aurora: Add pipeline progress window
This commit is contained in:
parent
64baad395a
commit
ad90e4b511
|
@ -1291,6 +1291,7 @@ void ImGuiConsole::PreUpdate() {
|
||||||
ShowDebugOverlay();
|
ShowDebugOverlay();
|
||||||
ShowInputViewer();
|
ShowInputViewer();
|
||||||
ShowPlayerTransformEditor();
|
ShowPlayerTransformEditor();
|
||||||
|
ShowPipelineProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGuiConsole::PostUpdate() {
|
void ImGuiConsole::PostUpdate() {
|
||||||
|
@ -1707,4 +1708,29 @@ void ImGuiConsole::ShowPlayerTransformEditor() {
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImGuiConsole::ShowPipelineProgress() {
|
||||||
|
if (aurora::gfx::queuedPipelines == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
const u32 totalPipelines = aurora::gfx::queuedPipelines + aurora::gfx::createdPipelines;
|
||||||
|
const auto percent = static_cast<float>(aurora::gfx::createdPipelines) / static_cast<float>(totalPipelines);
|
||||||
|
const auto progressStr =
|
||||||
|
fmt::format(FMT_STRING("Processing pipelines: {} / {}"), aurora::gfx::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();
|
||||||
|
}
|
||||||
} // namespace metaforce
|
} // namespace metaforce
|
||||||
|
|
|
@ -115,5 +115,6 @@ private:
|
||||||
void SetOverlayWindowLocation(int corner) const;
|
void SetOverlayWindowLocation(int corner) const;
|
||||||
void ShowCornerContextMenu(int& corner, int avoidCorner) const;
|
void ShowCornerContextMenu(int& corner, int avoidCorner) const;
|
||||||
void ShowPlayerTransformEditor();
|
void ShowPlayerTransformEditor();
|
||||||
|
void ShowPipelineProgress();
|
||||||
};
|
};
|
||||||
} // namespace metaforce
|
} // namespace metaforce
|
||||||
|
|
|
@ -125,7 +125,7 @@ static PipelineRef g_currentPipeline;
|
||||||
|
|
||||||
static std::vector<Command> g_commands;
|
static std::vector<Command> g_commands;
|
||||||
|
|
||||||
static ByteBuffer g_serializedPipelines;
|
static ByteBuffer g_serializedPipelines{};
|
||||||
static u32 g_serializedPipelineCount = 0;
|
static u32 g_serializedPipelineCount = 0;
|
||||||
|
|
||||||
template <typename PipelineConfig>
|
template <typename PipelineConfig>
|
||||||
|
@ -320,7 +320,6 @@ void initialize() {
|
||||||
g_state.stream = stream::construct_state();
|
g_state.stream = stream::construct_state();
|
||||||
g_state.model = model::construct_state();
|
g_state.model = model::construct_state();
|
||||||
|
|
||||||
g_serializedPipelines = {};
|
|
||||||
{
|
{
|
||||||
// Load serialized pipeline cache
|
// Load serialized pipeline cache
|
||||||
std::ifstream file("pipeline_cache.bin", std::ios::in | std::ios::binary | std::ios::ate);
|
std::ifstream file("pipeline_cache.bin", std::ios::in | std::ios::binary | std::ios::ate);
|
||||||
|
@ -342,20 +341,33 @@ void initialize() {
|
||||||
offset += sizeof(u32);
|
offset += sizeof(u32);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ShaderType::MoviePlayer: {
|
case ShaderType::MoviePlayer: {
|
||||||
const movie_player::PipelineConfig config =
|
if (size != sizeof(movie_player::PipelineConfig)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const auto config =
|
||||||
*reinterpret_cast<const movie_player::PipelineConfig*>(g_serializedPipelines.data() + offset);
|
*reinterpret_cast<const movie_player::PipelineConfig*>(g_serializedPipelines.data() + offset);
|
||||||
find_pipeline(
|
find_pipeline(
|
||||||
type, config, [=]() { return movie_player::create_pipeline(g_state.moviePlayer, config); }, false);
|
type, config, [=]() { return movie_player::create_pipeline(g_state.moviePlayer, config); }, false);
|
||||||
} break;
|
} break;
|
||||||
case ShaderType::Stream: {
|
case ShaderType::Stream: {
|
||||||
const stream::PipelineConfig config =
|
if (size != sizeof(stream::PipelineConfig)) {
|
||||||
*reinterpret_cast<const stream::PipelineConfig*>(g_serializedPipelines.data() + offset);
|
break;
|
||||||
|
}
|
||||||
|
const auto config = *reinterpret_cast<const stream::PipelineConfig*>(g_serializedPipelines.data() + offset);
|
||||||
|
if (config.version != gx::GXPipelineConfigVersion) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
find_pipeline(
|
find_pipeline(
|
||||||
type, config, [=]() { return stream::create_pipeline(g_state.stream, config); }, false);
|
type, config, [=]() { return stream::create_pipeline(g_state.stream, config); }, false);
|
||||||
} break;
|
} break;
|
||||||
case ShaderType::Model: {
|
case ShaderType::Model: {
|
||||||
const model::PipelineConfig config =
|
if (size != sizeof(model::PipelineConfig)) {
|
||||||
*reinterpret_cast<const model::PipelineConfig*>(g_serializedPipelines.data() + offset);
|
break;
|
||||||
|
}
|
||||||
|
const auto config = *reinterpret_cast<const model::PipelineConfig*>(g_serializedPipelines.data() + offset);
|
||||||
|
if (config.version != gx::GXPipelineConfigVersion) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
find_pipeline(
|
find_pipeline(
|
||||||
type, config, [=]() { return model::create_pipeline(g_state.model, config); }, false);
|
type, config, [=]() { return model::create_pipeline(g_state.model, config); }, false);
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -119,8 +119,8 @@ void ImGuiEngine_Initialize(float scale) {
|
||||||
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
|
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.11f, 0.15f, 0.17f, 1.00f);
|
||||||
colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
|
colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
|
||||||
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
|
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
|
||||||
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
colors[ImGuiCol_PlotHistogram] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);
|
||||||
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
|
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.28f, 0.56f, 1.00f, 1.00f);
|
||||||
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
|
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
|
||||||
colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
|
colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
|
||||||
colors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
colors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
|
Loading…
Reference in New Issue