Expose renderer mipmap command in CLI
This commit is contained in:
@@ -298,7 +298,7 @@ Known local toolchain state:
|
|||||||
records trace markers and scopes without a window or GL context.
|
records trace markers and scopes without a window or GL context.
|
||||||
- `pano_cli record-render` exposes the recording renderer through JSON
|
- `pano_cli record-render` exposes the recording renderer through JSON
|
||||||
automation, including render-pass/depth-clear counts, scissor/depth/blend/
|
automation, including render-pass/depth-clear counts, scissor/depth/blend/
|
||||||
shader-uniform/texture-bind/sampler-bind/upload/texture-copy/readback/
|
shader-uniform/texture-bind/sampler-bind/upload/mipmap-generation/texture-copy/readback/
|
||||||
frame-capture/blit command and byte totals, trace marker/scope counts,
|
frame-capture/blit command and byte totals, trace marker/scope counts,
|
||||||
labeled descriptor counts, backend resource creation counts, plus draw
|
labeled descriptor counts, backend resource creation counts, plus draw
|
||||||
descriptor vertex/index totals, and is covered by
|
descriptor vertex/index totals, and is covered by
|
||||||
|
|||||||
@@ -847,7 +847,7 @@ Results:
|
|||||||
name, trace marker/scope and draw summary, labeled descriptor counts,
|
name, trace marker/scope and draw summary, labeled descriptor counts,
|
||||||
render-pass/depth-clear counts, and draw
|
render-pass/depth-clear counts, and draw
|
||||||
descriptor vertex/index totals, scissor/depth/blend-state plus
|
descriptor vertex/index totals, scissor/depth/blend-state plus
|
||||||
shader-uniform/texture/sampler-bind/upload/texture-copy/readback/
|
shader-uniform/texture/sampler-bind/upload/mipmap-generation/texture-copy/readback/
|
||||||
frame-capture/blit command/byte totals for agent automation, with an
|
frame-capture/blit command/byte totals for agent automation, with an
|
||||||
expected-failure smoke for oversized render/readback targets.
|
expected-failure smoke for oversized render/readback targets.
|
||||||
- `pano_cli simulate-document-history` exercises pure document history
|
- `pano_cli simulate-document-history` exercises pure document history
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ if(TARGET pano_cli)
|
|||||||
COMMAND pano_cli record-render --width 32 --height 16)
|
COMMAND pano_cli record-render --width 32 --height 16)
|
||||||
set_tests_properties(pano_cli_record_render_smoke PROPERTIES
|
set_tests_properties(pano_cli_record_render_smoke PROPERTIES
|
||||||
LABELS "renderer;integration;desktop-fast"
|
LABELS "renderer;integration;desktop-fast"
|
||||||
PASS_REGULAR_EXPRESSION "\"backend\":\"recording\".*\"width\":32.*\"height\":16.*\"createdResources\":6.*\"labeledCommandDescriptors\":10.*\"commands\":20.*\"renderPasses\":1.*\"depthClears\":1.*\"stencilClears\":0.*\"drawCommands\":1.*\"drawVertices\":3.*\"drawIndices\":3.*\"scissorCommands\":1.*\"blendCommands\":1.*\"depthCommands\":1.*\"uniformCommands\":1.*\"uniformBytes\":64.*\"bindTextureCommands\":1.*\"bindSamplerCommands\":1.*\"boundTextureBytes\":2048.*\"uploadCommands\":1.*\"uploadBytes\":4.*\"copyCommands\":1.*\"copySourceBytes\":2048.*\"copyDestinationBytes\":2048.*\"readbackCommands\":1.*\"readbackBytes\":2048.*\"captureCommands\":1.*\"captureBytes\":2048.*\"blitCommands\":1.*\"blitSourceBytes\":2048.*\"blitDestinationBytes\":2048.*\"traceMarkers\":1.*\"traceBeginScopes\":1.*\"traceEndScopes\":1")
|
PASS_REGULAR_EXPRESSION "\"backend\":\"recording\".*\"width\":32.*\"height\":16.*\"createdResources\":7.*\"labeledCommandDescriptors\":12.*\"commands\":21.*\"renderPasses\":1.*\"depthClears\":1.*\"stencilClears\":0.*\"drawCommands\":1.*\"drawVertices\":3.*\"drawIndices\":3.*\"scissorCommands\":1.*\"blendCommands\":1.*\"depthCommands\":1.*\"uniformCommands\":1.*\"uniformBytes\":64.*\"bindTextureCommands\":1.*\"bindSamplerCommands\":1.*\"boundTextureBytes\":2048.*\"uploadCommands\":1.*\"uploadBytes\":4.*\"mipmapCommands\":1.*\"mipmapLevels\":3.*\"mipmapBytes\":84.*\"copyCommands\":1.*\"copySourceBytes\":2048.*\"copyDestinationBytes\":2048.*\"readbackCommands\":1.*\"readbackBytes\":2048.*\"captureCommands\":1.*\"captureBytes\":2048.*\"blitCommands\":1.*\"blitSourceBytes\":2048.*\"blitDestinationBytes\":2048.*\"traceMarkers\":1.*\"traceBeginScopes\":1.*\"traceEndScopes\":1")
|
||||||
|
|
||||||
add_test(NAME pano_cli_record_render_rejects_oversized_target
|
add_test(NAME pano_cli_record_render_rejects_oversized_target
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
|||||||
@@ -2216,18 +2216,26 @@ int record_render(int argc, char** argv)
|
|||||||
.extent = pp::renderer::Extent2D { .width = args.width, .height = args.height },
|
.extent = pp::renderer::Extent2D { .width = args.width, .height = args.height },
|
||||||
.format = pp::renderer::TextureFormat::rgba8,
|
.format = pp::renderer::TextureFormat::rgba8,
|
||||||
.usage = pp::renderer::TextureUsage::render_target | pp::renderer::TextureUsage::sampled | pp::renderer::TextureUsage::upload_destination | pp::renderer::TextureUsage::readback_source | pp::renderer::TextureUsage::copy_source | pp::renderer::TextureUsage::copy_destination,
|
.usage = pp::renderer::TextureUsage::render_target | pp::renderer::TextureUsage::sampled | pp::renderer::TextureUsage::upload_destination | pp::renderer::TextureUsage::readback_source | pp::renderer::TextureUsage::copy_source | pp::renderer::TextureUsage::copy_destination,
|
||||||
.debug_name = "record-render-target",
|
.debug_name = "record-render-texture",
|
||||||
});
|
});
|
||||||
const auto target = device.create_render_target(pp::renderer::TextureDesc {
|
const auto target = device.create_render_target(pp::renderer::TextureDesc {
|
||||||
.extent = pp::renderer::Extent2D { .width = args.width, .height = args.height },
|
.extent = pp::renderer::Extent2D { .width = args.width, .height = args.height },
|
||||||
.format = pp::renderer::TextureFormat::rgba8,
|
.format = pp::renderer::TextureFormat::rgba8,
|
||||||
.usage = pp::renderer::TextureUsage::render_target | pp::renderer::TextureUsage::sampled | pp::renderer::TextureUsage::upload_destination | pp::renderer::TextureUsage::readback_source | pp::renderer::TextureUsage::copy_source | pp::renderer::TextureUsage::copy_destination,
|
.usage = pp::renderer::TextureUsage::render_target | pp::renderer::TextureUsage::sampled | pp::renderer::TextureUsage::upload_destination | pp::renderer::TextureUsage::readback_source | pp::renderer::TextureUsage::copy_source | pp::renderer::TextureUsage::copy_destination,
|
||||||
.debug_name = "record-render-blit-target",
|
.debug_name = "record-render-target",
|
||||||
});
|
});
|
||||||
const auto blit_target = device.create_render_target(pp::renderer::TextureDesc {
|
const auto blit_target = device.create_render_target(pp::renderer::TextureDesc {
|
||||||
.extent = pp::renderer::Extent2D { .width = args.width, .height = args.height },
|
.extent = pp::renderer::Extent2D { .width = args.width, .height = args.height },
|
||||||
.format = pp::renderer::TextureFormat::rgba8,
|
.format = pp::renderer::TextureFormat::rgba8,
|
||||||
.usage = pp::renderer::TextureUsage::render_target | pp::renderer::TextureUsage::sampled | pp::renderer::TextureUsage::upload_destination | pp::renderer::TextureUsage::readback_source | pp::renderer::TextureUsage::copy_source | pp::renderer::TextureUsage::copy_destination,
|
.usage = pp::renderer::TextureUsage::render_target | pp::renderer::TextureUsage::sampled | pp::renderer::TextureUsage::upload_destination | pp::renderer::TextureUsage::readback_source | pp::renderer::TextureUsage::copy_source | pp::renderer::TextureUsage::copy_destination,
|
||||||
|
.debug_name = "record-render-blit-target",
|
||||||
|
});
|
||||||
|
const auto mip_texture = device.create_texture(pp::renderer::TextureDesc {
|
||||||
|
.extent = pp::renderer::Extent2D { .width = 4, .height = 4 },
|
||||||
|
.format = pp::renderer::TextureFormat::rgba8,
|
||||||
|
.mip_levels = 3,
|
||||||
|
.usage = pp::renderer::TextureUsage::sampled | pp::renderer::TextureUsage::copy_source | pp::renderer::TextureUsage::copy_destination,
|
||||||
|
.debug_name = "record-render-mip-texture",
|
||||||
});
|
});
|
||||||
const auto readback_buffer = device.create_readback_buffer(
|
const auto readback_buffer = device.create_readback_buffer(
|
||||||
static_cast<std::uint64_t>(args.width) * args.height * 4U);
|
static_cast<std::uint64_t>(args.width) * args.height * 4U);
|
||||||
@@ -2269,6 +2277,10 @@ int record_render(int argc, char** argv)
|
|||||||
print_error("record-render", blit_target.status().message);
|
print_error("record-render", blit_target.status().message);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
if (!mip_texture.ok()) {
|
||||||
|
print_error("record-render", mip_texture.status().message);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
if (!readback_buffer.ok()) {
|
if (!readback_buffer.ok()) {
|
||||||
print_error("record-render", readback_buffer.status().message);
|
print_error("record-render", readback_buffer.status().message);
|
||||||
return 2;
|
return 2;
|
||||||
@@ -2281,7 +2293,7 @@ int record_render(int argc, char** argv)
|
|||||||
print_error("record-render", mesh.status().message);
|
print_error("record-render", mesh.status().message);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
constexpr std::size_t created_resources = 6;
|
constexpr std::size_t created_resources = 7;
|
||||||
|
|
||||||
auto* trace = device.trace();
|
auto* trace = device.trace();
|
||||||
const auto trace_begin_status = trace->begin_scope("renderer", "pano_cli_record_render");
|
const auto trace_begin_status = trace->begin_scope("renderer", "pano_cli_record_render");
|
||||||
@@ -2315,6 +2327,12 @@ int record_render(int argc, char** argv)
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto mipmap_status = context.generate_mipmaps(*mip_texture.value());
|
||||||
|
if (!mipmap_status.ok()) {
|
||||||
|
print_error("record-render", mipmap_status.message);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
const auto begin_status = context.begin_render_pass(
|
const auto begin_status = context.begin_render_pass(
|
||||||
*target.value(),
|
*target.value(),
|
||||||
pp::renderer::RenderPassDesc {
|
pp::renderer::RenderPassDesc {
|
||||||
@@ -2478,6 +2496,7 @@ int record_render(int argc, char** argv)
|
|||||||
std::size_t bind_texture_commands = 0;
|
std::size_t bind_texture_commands = 0;
|
||||||
std::size_t bind_sampler_commands = 0;
|
std::size_t bind_sampler_commands = 0;
|
||||||
std::size_t upload_commands = 0;
|
std::size_t upload_commands = 0;
|
||||||
|
std::size_t mipmap_commands = 0;
|
||||||
std::size_t copy_commands = 0;
|
std::size_t copy_commands = 0;
|
||||||
std::size_t readback_commands = 0;
|
std::size_t readback_commands = 0;
|
||||||
std::size_t capture_commands = 0;
|
std::size_t capture_commands = 0;
|
||||||
@@ -2492,6 +2511,8 @@ int record_render(int argc, char** argv)
|
|||||||
std::uint64_t draw_indices = 0;
|
std::uint64_t draw_indices = 0;
|
||||||
std::uint64_t uniform_bytes = 0;
|
std::uint64_t uniform_bytes = 0;
|
||||||
std::uint64_t upload_bytes = 0;
|
std::uint64_t upload_bytes = 0;
|
||||||
|
std::uint64_t mipmap_levels = 0;
|
||||||
|
std::uint64_t mipmap_bytes = 0;
|
||||||
std::uint64_t copy_source_bytes = 0;
|
std::uint64_t copy_source_bytes = 0;
|
||||||
std::uint64_t copy_destination_bytes = 0;
|
std::uint64_t copy_destination_bytes = 0;
|
||||||
std::uint64_t bound_texture_bytes = 0;
|
std::uint64_t bound_texture_bytes = 0;
|
||||||
@@ -2542,7 +2563,10 @@ int record_render(int argc, char** argv)
|
|||||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::bind_mesh) {
|
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::bind_mesh) {
|
||||||
count_label(command.mesh_desc.debug_name);
|
count_label(command.mesh_desc.debug_name);
|
||||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::generate_mipmaps) {
|
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::generate_mipmaps) {
|
||||||
|
++mipmap_commands;
|
||||||
count_label(command.texture_desc.debug_name);
|
count_label(command.texture_desc.debug_name);
|
||||||
|
mipmap_levels += command.generated_mip_levels;
|
||||||
|
mipmap_bytes += command.generated_mip_bytes;
|
||||||
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::upload_texture) {
|
} else if (command.kind == pp::renderer::RecordedRenderCommandKind::upload_texture) {
|
||||||
++upload_commands;
|
++upload_commands;
|
||||||
count_label(command.texture_desc.debug_name);
|
count_label(command.texture_desc.debug_name);
|
||||||
@@ -2600,6 +2624,9 @@ int record_render(int argc, char** argv)
|
|||||||
<< ",\"boundTextureBytes\":" << bound_texture_bytes
|
<< ",\"boundTextureBytes\":" << bound_texture_bytes
|
||||||
<< ",\"uploadCommands\":" << upload_commands
|
<< ",\"uploadCommands\":" << upload_commands
|
||||||
<< ",\"uploadBytes\":" << upload_bytes
|
<< ",\"uploadBytes\":" << upload_bytes
|
||||||
|
<< ",\"mipmapCommands\":" << mipmap_commands
|
||||||
|
<< ",\"mipmapLevels\":" << mipmap_levels
|
||||||
|
<< ",\"mipmapBytes\":" << mipmap_bytes
|
||||||
<< ",\"copyCommands\":" << copy_commands
|
<< ",\"copyCommands\":" << copy_commands
|
||||||
<< ",\"copySourceBytes\":" << copy_source_bytes
|
<< ",\"copySourceBytes\":" << copy_source_bytes
|
||||||
<< ",\"copyDestinationBytes\":" << copy_destination_bytes
|
<< ",\"copyDestinationBytes\":" << copy_destination_bytes
|
||||||
|
|||||||
Reference in New Issue
Block a user