Add renderer texture copy command
This commit is contained in:
@@ -2403,6 +2403,26 @@ int record_render(int argc, char** argv)
|
||||
return 2;
|
||||
}
|
||||
|
||||
const auto copy_status = context.copy_texture(
|
||||
*texture.value(),
|
||||
pp::renderer::ReadbackRegion {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = args.width,
|
||||
.height = args.height,
|
||||
},
|
||||
*texture.value(),
|
||||
pp::renderer::ReadbackRegion {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = args.width,
|
||||
.height = args.height,
|
||||
});
|
||||
if (!copy_status.ok()) {
|
||||
print_error("record-render", copy_status.message);
|
||||
return 2;
|
||||
}
|
||||
|
||||
const auto capture_status = context.capture_frame(*target.value(), *readback_buffer.value());
|
||||
if (!capture_status.ok()) {
|
||||
print_error("record-render", capture_status.message);
|
||||
@@ -2438,6 +2458,7 @@ int record_render(int argc, char** argv)
|
||||
std::size_t bind_texture_commands = 0;
|
||||
std::size_t bind_sampler_commands = 0;
|
||||
std::size_t upload_commands = 0;
|
||||
std::size_t copy_commands = 0;
|
||||
std::size_t readback_commands = 0;
|
||||
std::size_t capture_commands = 0;
|
||||
std::size_t blit_commands = 0;
|
||||
@@ -2449,6 +2470,8 @@ int record_render(int argc, char** argv)
|
||||
std::uint64_t draw_indices = 0;
|
||||
std::uint64_t uniform_bytes = 0;
|
||||
std::uint64_t upload_bytes = 0;
|
||||
std::uint64_t copy_source_bytes = 0;
|
||||
std::uint64_t copy_destination_bytes = 0;
|
||||
std::uint64_t bound_texture_bytes = 0;
|
||||
std::uint64_t readback_bytes = 0;
|
||||
std::uint64_t capture_bytes = 0;
|
||||
@@ -2488,6 +2511,10 @@ int record_render(int argc, char** argv)
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::upload_texture) {
|
||||
++upload_commands;
|
||||
upload_bytes += command.upload_bytes;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::copy_texture) {
|
||||
++copy_commands;
|
||||
copy_source_bytes += command.copy_source_bytes;
|
||||
copy_destination_bytes += command.copy_destination_bytes;
|
||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::read_texture) {
|
||||
++readback_commands;
|
||||
readback_bytes += command.readback_bytes;
|
||||
@@ -2526,6 +2553,9 @@ int record_render(int argc, char** argv)
|
||||
<< ",\"boundTextureBytes\":" << bound_texture_bytes
|
||||
<< ",\"uploadCommands\":" << upload_commands
|
||||
<< ",\"uploadBytes\":" << upload_bytes
|
||||
<< ",\"copyCommands\":" << copy_commands
|
||||
<< ",\"copySourceBytes\":" << copy_source_bytes
|
||||
<< ",\"copyDestinationBytes\":" << copy_destination_bytes
|
||||
<< ",\"readbackCommands\":" << readback_commands
|
||||
<< ",\"readbackBytes\":" << readback_bytes
|
||||
<< ",\"captureCommands\":" << capture_commands
|
||||
|
||||
Reference in New Issue
Block a user