Add renderer blit command contract
This commit is contained in:
@@ -256,6 +256,52 @@ pp::foundation::Status RecordingCommandContext::capture_frame(
|
||||
return pp::foundation::Status::success();
|
||||
}
|
||||
|
||||
pp::foundation::Status RecordingCommandContext::blit_render_target(
|
||||
IRenderTarget& source,
|
||||
ReadbackRegion source_region,
|
||||
IRenderTarget& destination,
|
||||
ReadbackRegion destination_region,
|
||||
BlitFilter filter) noexcept
|
||||
{
|
||||
if (in_render_pass_) {
|
||||
return pp::foundation::Status::invalid_argument("render target blit must be outside a render pass");
|
||||
}
|
||||
|
||||
const auto source_desc = source.color_desc();
|
||||
const auto destination_desc = destination.color_desc();
|
||||
const auto desc_status = validate_blit_descs(source_desc, destination_desc);
|
||||
if (!desc_status.ok()) {
|
||||
return desc_status;
|
||||
}
|
||||
|
||||
const auto filter_status = validate_blit_filter(filter);
|
||||
if (!filter_status.ok()) {
|
||||
return filter_status;
|
||||
}
|
||||
|
||||
const auto source_bytes = readback_byte_size(source_desc, source_region);
|
||||
if (!source_bytes) {
|
||||
return source_bytes.status();
|
||||
}
|
||||
|
||||
const auto destination_bytes = readback_byte_size(destination_desc, destination_region);
|
||||
if (!destination_bytes) {
|
||||
return destination_bytes.status();
|
||||
}
|
||||
|
||||
push_command(commands_, RecordedRenderCommand {
|
||||
.kind = RecordedRenderCommandKind::blit_render_target,
|
||||
.source_desc = source_desc,
|
||||
.destination_desc = destination_desc,
|
||||
.source_region = source_region,
|
||||
.destination_region = destination_region,
|
||||
.blit_filter = filter,
|
||||
.blit_source_bytes = source_bytes.value(),
|
||||
.blit_destination_bytes = destination_bytes.value(),
|
||||
});
|
||||
return pp::foundation::Status::success();
|
||||
}
|
||||
|
||||
void RecordingCommandContext::end_render_pass() noexcept
|
||||
{
|
||||
if (!in_render_pass_) {
|
||||
@@ -339,6 +385,8 @@ const char* recorded_render_command_kind_name(RecordedRenderCommandKind kind) no
|
||||
return "read_texture";
|
||||
case RecordedRenderCommandKind::capture_frame:
|
||||
return "capture_frame";
|
||||
case RecordedRenderCommandKind::blit_render_target:
|
||||
return "blit_render_target";
|
||||
case RecordedRenderCommandKind::end_render_pass:
|
||||
return "end_render_pass";
|
||||
case RecordedRenderCommandKind::trace_marker:
|
||||
|
||||
Reference in New Issue
Block a user