Add renderer trace scope contract

This commit is contained in:
2026-06-02 16:55:23 +02:00
parent 07293c0590
commit bbe3db1747
9 changed files with 305 additions and 101 deletions

View File

@@ -2279,7 +2279,23 @@ int record_render(int argc, char** argv)
}
constexpr std::size_t created_resources = 6;
device.trace()->marker("renderer", "pano_cli_record_render");
auto* trace = device.trace();
const auto trace_begin_status = trace->begin_scope("renderer", "pano_cli_record_render");
if (!trace_begin_status.ok()) {
print_error("record-render", trace_begin_status.message);
return 2;
}
const auto trace_marker_status = trace->marker("renderer", "frame");
if (!trace_marker_status.ok()) {
print_error("record-render", trace_marker_status.message);
return 2;
}
const auto trace_end_status = trace->end_scope();
if (!trace_end_status.ok()) {
print_error("record-render", trace_end_status.message);
return 2;
}
auto& context = device.immediate_context();
const auto upload_status = context.upload_texture(
*texture.value(),
@@ -2463,6 +2479,8 @@ int record_render(int argc, char** argv)
std::size_t capture_commands = 0;
std::size_t blit_commands = 0;
std::size_t trace_markers = 0;
std::size_t trace_begin_scopes = 0;
std::size_t trace_end_scopes = 0;
std::size_t render_passes = 0;
std::size_t depth_clears = 0;
std::size_t stencil_clears = 0;
@@ -2527,6 +2545,10 @@ int record_render(int argc, char** argv)
blit_destination_bytes += command.blit_destination_bytes;
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::trace_marker) {
++trace_markers;
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::trace_begin_scope) {
++trace_begin_scopes;
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::trace_end_scope) {
++trace_end_scopes;
}
}
@@ -2564,6 +2586,8 @@ int record_render(int argc, char** argv)
<< ",\"blitSourceBytes\":" << blit_source_bytes
<< ",\"blitDestinationBytes\":" << blit_destination_bytes
<< ",\"traceMarkers\":" << trace_markers
<< ",\"traceBeginScopes\":" << trace_begin_scopes
<< ",\"traceEndScopes\":" << trace_end_scopes
<< ",\"first\":\""
<< pp::renderer::recorded_render_command_kind_name(commands.front().kind)
<< "\",\"last\":\""