天量级等待操作

This commit is contained in:
2026-08-28 23:42:18 +08:00
parent 647ad6a66c
commit 314a14176c
60 changed files with 4224 additions and 3400 deletions
+24 -28
View File
@@ -308,7 +308,10 @@ nlohmann::json datoviz_observation_json(
{"emit", milliseconds(value.emit_ns)},
{"execute", milliseconds(value.execute_ns)},
{"submit", milliseconds(value.submit_ns)},
{"gpu_fence_wait", milliseconds(value.gpu_fence_wait_ns)},
{"gpu_completion_observation",
milliseconds(value.gpu_completion_observation_ns)},
{"completion_task_queue",
milliseconds(value.completion_task_queue_ns)},
{"readback", milliseconds(value.readback_ns)}}},
{"traffic", {
{"uploaded_bytes", value.uploaded_bytes},
@@ -1156,7 +1159,26 @@ void Plot::Private::render_frame(Plot_Render_Tick tick) {
record_plot_measurements(output);
auto& scene_3d = std::get<std::unique_ptr<Scene_3D>>(scene);
scene_3d->set<&Render_Scene_3D::Prop::viewport>(Extent{tick.width, tick.height});
const auto result = scene_3d->render(&output);
const auto weak = lifetime;
const auto result = scene_3d->render(
&output,
Render_Scene_3D::Frame_Callbacks{
.submitted = [weak](not_null<Frame_3D*>, bool) {
if (auto owner = weak.lock()) {
try { owner->d->release_render_admission(weak); }
catch (...) { owner->d->fail(std::current_exception()); }
}
},
.completed = [weak](not_null<Frame_3D*> frame) {
if (auto owner = weak.lock()) {
try {
owner->d->publish_completed_frame(frame);
owner->d->consume_completed_frame(frame);
owner->d->retire_completed_frame(frame);
}
catch (...) { owner->d->fail(std::current_exception()); }
}
}});
if (result == Render_Scene_3D::Render_Result::submitted) {
taskflow_trace_claimed = false;
managed->submitted_at = std::chrono::steady_clock::now();
@@ -1526,32 +1548,6 @@ void Plot::ensure_started() {
.source = Frame_Request_Source::periodic});
}
});
/* 3D Scene 的提交/完成回调只表示借用阶段变化;Frame 的发布、
* 统计和复用始终由本帧策略决定。2D 回调与每次 render 直接绑定。 */
if (std::holds_alternative<std::unique_ptr<Scene_3D>>(d->scene)) {
auto& scene_3d = std::get<std::unique_ptr<Scene_3D>>(d->scene);
scene_3d->set_submitted_frame_callback(
[weak](not_null<Frame_3D*>, bool) {
if (auto owner = weak.lock()) {
try {
owner->d->release_render_admission(weak);
}
catch (...) { owner->d->fail(std::current_exception()); }
}
});
scene_3d->set_frame_callback(
[weak](not_null<Frame_3D*> frame) {
if (auto owner = weak.lock()) {
try {
owner->d->publish_completed_frame(frame);
owner->d->consume_completed_frame(frame);
owner->d->retire_completed_frame(frame);
}
catch (...) { owner->d->fail(std::current_exception()); }
}
});
}
/* 3D callback 必须先于周期时钟安装,避免首帧在初始化窗口进入 Scene。 */
d->refresh_schedule();
});
}