Display a progress bar while the command processor is playing a trace
- Masks a race condition in the texture cache b/t the UI thread and the GL4 command processor
This commit is contained in:
parent
7640448509
commit
7a1d7bd652
|
@ -820,6 +820,34 @@ static const char* kEndiannessNames[] = {
|
||||||
"unspecified endianness", "8-in-16", "8-in-32", "16-in-32",
|
"unspecified endianness", "8-in-16", "8-in-32", "16-in-32",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ProgressBar(float frac, float width, float height = 0,
|
||||||
|
const ImVec4& color = ImVec4(0, 1, 0, 1),
|
||||||
|
const ImVec4& border_color = ImVec4(0, 1, 0, 1)) {
|
||||||
|
if (height == 0) {
|
||||||
|
height = ImGui::GetTextLineHeightWithSpacing();
|
||||||
|
}
|
||||||
|
frac = xe::saturate(frac);
|
||||||
|
|
||||||
|
const auto fontAtlas = ImGui::GetIO().Fonts;
|
||||||
|
|
||||||
|
auto pos = ImGui::GetCursorScreenPos();
|
||||||
|
auto col = ImGui::ColorConvertFloat4ToU32(color);
|
||||||
|
auto border_col = ImGui::ColorConvertFloat4ToU32(border_color);
|
||||||
|
|
||||||
|
if (frac > 0) {
|
||||||
|
// Progress bar
|
||||||
|
ImGui::GetWindowDrawList()->AddRectFilled(
|
||||||
|
pos, ImVec2(pos.x + width * frac, pos.y + height), col);
|
||||||
|
}
|
||||||
|
if (border_color.w > 0.f) {
|
||||||
|
// Border
|
||||||
|
ImGui::GetWindowDrawList()->AddRect(
|
||||||
|
pos, ImVec2(pos.x + width, pos.y + height), border_col);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Dummy(ImVec2(width, height));
|
||||||
|
}
|
||||||
|
|
||||||
void TraceViewer::DrawStateUI() {
|
void TraceViewer::DrawStateUI() {
|
||||||
auto command_processor = graphics_system_->command_processor();
|
auto command_processor = graphics_system_->command_processor();
|
||||||
auto& regs = *graphics_system_->register_file();
|
auto& regs = *graphics_system_->register_file();
|
||||||
|
@ -893,8 +921,25 @@ void TraceViewer::DrawStateUI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player_->playing_trace()) {
|
||||||
|
ImGui::Text("Playing trace...");
|
||||||
|
uint64_t start = uint64_t(player_->player_start_ptr());
|
||||||
|
uint64_t end = uint64_t(player_->player_target_ptr());
|
||||||
|
uint64_t cur = uint64_t(player_->player_current_ptr());
|
||||||
|
|
||||||
|
uint64_t rel_cur = cur - start;
|
||||||
|
uint64_t rel_end = end - start;
|
||||||
|
|
||||||
|
float width = ImGui::GetWindowWidth() - 20.f;
|
||||||
|
|
||||||
|
ProgressBar((float)rel_cur / (float)rel_end, width);
|
||||||
|
ImGui::End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto enable_mode =
|
auto enable_mode =
|
||||||
static_cast<ModeControl>(regs[XE_GPU_REG_RB_MODECONTROL].u32 & 0x7);
|
static_cast<ModeControl>(regs[XE_GPU_REG_RB_MODECONTROL].u32 & 0x7);
|
||||||
|
|
||||||
const char* mode_name = "Unknown";
|
const char* mode_name = "Unknown";
|
||||||
switch (enable_mode) {
|
switch (enable_mode) {
|
||||||
case ModeControl::kIgnore:
|
case ModeControl::kIgnore:
|
||||||
|
@ -915,10 +960,13 @@ void TraceViewer::DrawStateUI() {
|
||||||
kPrimNames[int(draw_info.prim_type)], draw_info.index_count);
|
kPrimNames[int(draw_info.prim_type)], draw_info.index_count);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ModeControl::kCopy:
|
case ModeControl::kCopy: {
|
||||||
ImGui::Text("Copy Command %d", player_->current_command_index());
|
uint32_t copy_dest_base = regs[XE_GPU_REG_RB_COPY_DEST_BASE].u32;
|
||||||
|
ImGui::Text("Copy Command %d (to %.8X)", player_->current_command_index(),
|
||||||
|
copy_dest_base);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Columns(2);
|
ImGui::Columns(2);
|
||||||
ImGui::BulletText("Viewport State:");
|
ImGui::BulletText("Viewport State:");
|
||||||
|
|
Loading…
Reference in New Issue