Add renderer blit command contract
This commit is contained in:
@@ -2221,6 +2221,11 @@ int record_render(int argc, char** argv)
|
||||
.format = pp::renderer::TextureFormat::rgba8,
|
||||
.render_target = true,
|
||||
});
|
||||
pp::renderer::RecordingRenderTarget blit_target(pp::renderer::TextureDesc {
|
||||
.extent = pp::renderer::Extent2D { .width = args.width, .height = args.height },
|
||||
.format = pp::renderer::TextureFormat::rgba8,
|
||||
.render_target = true,
|
||||
});
|
||||
pp::renderer::RecordingReadbackBuffer readback_buffer(
|
||||
static_cast<std::uint64_t>(args.width) * args.height * 4U);
|
||||
const std::array<std::byte, 4> upload_pixel {
|
||||
@@ -2305,14 +2310,38 @@ int record_render(int argc, char** argv)
|
||||
return 2;
|
||||
}
|
||||
|
||||
const auto blit_status = context.blit_render_target(
|
||||
target,
|
||||
pp::renderer::ReadbackRegion {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = args.width,
|
||||
.height = args.height,
|
||||
},
|
||||
blit_target,
|
||||
pp::renderer::ReadbackRegion {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = args.width,
|
||||
.height = args.height,
|
||||
},
|
||||
pp::renderer::BlitFilter::nearest);
|
||||
if (!blit_status.ok()) {
|
||||
print_error("record-render", blit_status.message);
|
||||
return 2;
|
||||
}
|
||||
|
||||
std::size_t draw_commands = 0;
|
||||
std::size_t upload_commands = 0;
|
||||
std::size_t readback_commands = 0;
|
||||
std::size_t capture_commands = 0;
|
||||
std::size_t blit_commands = 0;
|
||||
std::size_t trace_markers = 0;
|
||||
std::uint64_t upload_bytes = 0;
|
||||
std::uint64_t readback_bytes = 0;
|
||||
std::uint64_t capture_bytes = 0;
|
||||
std::uint64_t blit_source_bytes = 0;
|
||||
std::uint64_t blit_destination_bytes = 0;
|
||||
const auto commands = device.commands();
|
||||
for (const auto& command : commands) {
|
||||
if (command.kind == pp::renderer::RecordedRenderCommandKind::draw) {
|
||||
@@ -2326,6 +2355,10 @@ int record_render(int argc, char** argv)
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::capture_frame) {
|
||||
++capture_commands;
|
||||
capture_bytes += command.capture_bytes;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::blit_render_target) {
|
||||
++blit_commands;
|
||||
blit_source_bytes += command.blit_source_bytes;
|
||||
blit_destination_bytes += command.blit_destination_bytes;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::trace_marker) {
|
||||
++trace_markers;
|
||||
}
|
||||
@@ -2344,6 +2377,9 @@ int record_render(int argc, char** argv)
|
||||
<< ",\"readbackBytes\":" << readback_bytes
|
||||
<< ",\"captureCommands\":" << capture_commands
|
||||
<< ",\"captureBytes\":" << capture_bytes
|
||||
<< ",\"blitCommands\":" << blit_commands
|
||||
<< ",\"blitSourceBytes\":" << blit_source_bytes
|
||||
<< ",\"blitDestinationBytes\":" << blit_destination_bytes
|
||||
<< ",\"traceMarkers\":" << trace_markers
|
||||
<< ",\"first\":\""
|
||||
<< pp::renderer::recorded_render_command_kind_name(commands.front().kind)
|
||||
|
||||
Reference in New Issue
Block a user