This commit is contained in:
2026-08-12 11:03:16 +08:00
parent 0910b73ea4
commit 898a58b554
18 changed files with 521 additions and 277 deletions
+35 -9
View File
@@ -98,9 +98,23 @@ void Waterfall_Control::publish() {
void Waterfall_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
auto& output = impl_->render_frame;
const auto view = render_state_view();
const auto& state = render_properties(view);
const auto& rows = view.get(impl_->rows);
std::size_t work_size{};
if (!rows.empty()) {
const auto shortest = std::min_element(
rows.begin(), rows.end(),
[](const auto& left, const auto& right) {
return left.values.size() < right.values.size();
});
work_size = static_cast<std::size_t>(std::max(
0, std::min(state.frequency_bin_count.get(),
static_cast<int>(shortest->values.size())))) * rows.size();
}
const int partition_count = output.partitioner.graph_partition_count(
render_properties(render_state_view()).partition_count.get(),
static_cast<int>(Scene_Base::task_executor_worker_count()));
state.partition_mode, state.partition_count.get(),
static_cast<int>(Scene_Base::task_executor_worker_count()), work_size, 4096);
const auto prepare = graph.emplace([this, partition_count](const Scene_Render_Context&) {
prepare_render_frame(render_state_view(), partition_count);
}, "prepare waterfall");
@@ -115,11 +129,15 @@ void Waterfall_Control::build_paint_task_graph(Renderable_Task_Graph& graph) {
graph.precede(prepare, partition);
partitions.push_back(partition);
}
const auto compose = add_paint_task(
graph, "compose waterfall",
[this](Painter& painter, const Render_State_View& view) { paint(painter, view); });
const auto paint_image = add_paint_task(
graph, "paint waterfall shared image",
[this](Painter& painter, const Render_State_View& frame_view,
const Scene_Render_Context& context) {
paint_render_frame(painter, frame_view,
context.frame_control_state.next_refresh_interval_ns);
});
for (const auto partition : partitions)
graph.precede(partition, compose);
graph.precede(partition, paint_image);
}
void Waterfall_Control::prepare_render_frame(const Render_State_View& view,
@@ -179,7 +197,9 @@ void Waterfall_Control::render_partition(const Render_State_View& view, int part
}
}
void Waterfall_Control::paint(Painter& painter, const Render_State_View& view) {
void Waterfall_Control::paint_render_frame(Painter& painter,
const Render_State_View& view,
std::uint64_t frame_interval_ns) {
const auto& state = render_properties(view);
const auto& interaction = view.get(impl_->interaction);
auto& output = impl_->render_frame;
@@ -188,9 +208,9 @@ void Waterfall_Control::paint(Painter& painter, const Render_State_View& view) {
painter.heatmap(output.layout.target, output.layout.width, output.layout.height,
output.pixels, state.interpolation_mode);
if (output.partitioner.finish(
state.partition_count.get(), output.active_partitions,
state.partition_mode, output.active_partitions, frame_interval_ns,
static_cast<int>(Scene_Base::task_executor_worker_count()),
output.work_size))
output.work_size, 4096))
task_graph_changed();
if(state.tooltip_enabled && interaction.tooltip.active && output.layout.target.contains(interaction.tooltip.position)) {
const Axis_Transform frequency_axis = impl_->frequency_axis->transform(view);
@@ -202,5 +222,11 @@ void Waterfall_Control::paint(Painter& painter, const Render_State_View& view) {
painter.text({box.x + 4.0, box.y + 3.0}, text.str(), state.tooltip_font, state.tooltip_text_pen);
}
}
void Waterfall_Control::paint(Painter& painter, const Render_State_View& view) {
prepare_render_frame(view, 1);
render_partition(view, 0);
paint_render_frame(painter, view, 0);
}
}
}