| 2484 | } |
| 2485 | |
| 2486 | auto TaskGraphDebugUi::update(TaskGraph & task_graph) -> bool |
| 2487 | { |
| 2488 | auto & ui_context = *r_cast<ImplTaskGraphDebugUi *>(this->object); |
| 2489 | auto * impl_tg = r_cast<ImplTaskGraph *>(task_graph.get()); |
| 2490 | |
| 2491 | ui_context.recreated = ui_context.last_exec_tg_unique_index != impl_tg->unique_index; |
| 2492 | ui_context.last_exec_tg_unique_index = impl_tg->unique_index; |
| 2493 | |
| 2494 | /// ============================================== |
| 2495 | /// ======= PRE UPDATE RESOURCE VIEW STATE ======= |
| 2496 | /// ============================================== |
| 2497 | |
| 2498 | for (auto av_iter = ui_context.resource_viewer_states.begin(); av_iter != ui_context.resource_viewer_states.end();) |
| 2499 | { |
| 2500 | ResourceViewerState & state = av_iter->second; |
| 2501 | state.image.imgui_image_id = {}; |
| 2502 | state.free_window = av_iter->second.free_window_next_frame; |
| 2503 | |
| 2504 | state.open_frame_count += 1; |
| 2505 | u32 const readback_index = (state.open_frame_count) % READBACK_CIRCULAR_BUFFER_SIZE; |
| 2506 | |
| 2507 | if (!state.image.readback_buffer.is_empty()) |
| 2508 | { |
| 2509 | auto * readback_struct = ui_context.device.buffer_host_address_as<TaskGraphDebugUiImageReadbackStruct>(state.image.readback_buffer).value(); |
| 2510 | state.image.latest_readback = readback_struct[readback_index]; |
| 2511 | readback_struct[readback_index] = { |
| 2512 | .pos_min_value = ~0u, |
| 2513 | .neg_min_value = ~0u, |
| 2514 | }; |
| 2515 | } |
| 2516 | |
| 2517 | if (!state.image.destroy_display_image.is_empty()) |
| 2518 | { |
| 2519 | ui_context.device.destroy_image(state.image.destroy_display_image); |
| 2520 | state.image.destroy_display_image = {}; |
| 2521 | } |
| 2522 | if (!state.image.destroy_clone_image.is_empty()) |
| 2523 | { |
| 2524 | ui_context.device.destroy_image(state.image.destroy_clone_image); |
| 2525 | state.image.destroy_clone_image = {}; |
| 2526 | } |
| 2527 | ++av_iter; |
| 2528 | } |
| 2529 | |
| 2530 | /// ======================================= |
| 2531 | /// ======= TASK GRAPH MAIN UI TABS ======= |
| 2532 | /// ======================================= |
| 2533 | |
| 2534 | bool open = true; |
| 2535 | if (ImGui::Begin("Task Graph Debug UI", &open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollWithMouse)) |
| 2536 | { |
| 2537 | ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_None; |
| 2538 | if (ImGui::BeginTabBar("TgDebugUiTabBar", tab_bar_flags)) |
| 2539 | { |
| 2540 | if (ImGui::BeginTabItem("Timeline")) |
| 2541 | { |
| 2542 | task_timeline_ui(ui_context, impl_tg); |
| 2543 | ImGui::EndTabItem(); |
nothing calls this directly
no test coverage detected