Expose OpenGL command plans in pano_cli

This commit is contained in:
2026-06-02 20:52:53 +02:00
parent 9a4c595f64
commit b4c2117992
6 changed files with 38 additions and 4 deletions

View File

@@ -340,7 +340,11 @@ Known local toolchain state:
shader-uniform/texture-bind/sampler-bind/upload/mipmap-generation/texture-transition/texture-copy/readback/ shader-uniform/texture-bind/sampler-bind/upload/mipmap-generation/texture-transition/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. Its `--exercise-clear` mode verifies descriptor vertex/index totals. When `pp_renderer_gl` is available, it also
emits an `openGlPlan` JSON object with the planned command count, support
status, render-pass/draw/passthrough/trace counts, unsupported command count,
render-pass order error count, and unclosed-pass state. Its
`--exercise-clear` mode verifies
interrupted-frame recorder clear/reuse behavior and reports the result in interrupted-frame recorder clear/reuse behavior and reports the result in
JSON, and is covered by `pano_cli_record_render_smoke`, JSON, and is covered by `pano_cli_record_render_smoke`,
`pano_cli_record_render_exercises_clear_reset`, plus `pano_cli_record_render_exercises_clear_reset`, plus

View File

@@ -890,7 +890,11 @@ Results:
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/mipmap-generation/texture-transition/texture-copy/readback/ shader-uniform/texture/sampler-bind/upload/mipmap-generation/texture-transition/texture-copy/readback/
frame-capture/blit command/byte totals for agent automation. The frame-capture/blit command/byte totals for agent automation. When
`pp_renderer_gl` is available, it also emits an `openGlPlan` JSON object with
planned command count, support status, render-pass/draw/passthrough/trace
counts, unsupported command count, render-pass order error count, and
unclosed-pass state. The
`--exercise-clear` mode deliberately clears an interrupted trace/render pass, `--exercise-clear` mode deliberately clears an interrupted trace/render pass,
verifies stale trace-scope state is rejected, verifies the render context can verifies stale trace-scope state is rejected, verifies the render context can
be reused, and then emits that reset status in JSON. It also has an be reused, and then emits that reset status in JSON. It also has an

View File

@@ -3,7 +3,7 @@ set -u
preset="${1:-android-arm64}" preset="${1:-android-arm64}"
shift || true shift || true
targets="${*:-pp_foundation pp_assets pp_paint pp_document pp_renderer_api pp_renderer_gl pp_paint_renderer pp_ui_core pano_cli pp_foundation_binary_stream_tests pp_foundation_event_tests pp_foundation_log_tests pp_foundation_parse_tests pp_foundation_task_queue_tests pp_foundation_trace_tests pp_assets_image_format_tests pp_assets_image_metadata_tests pp_assets_image_pixels_tests pp_assets_ppi_header_tests pp_assets_settings_document_tests pp_paint_brush_tests pp_paint_blend_tests pp_paint_stroke_tests pp_paint_stroke_script_tests pp_document_tests pp_document_ppi_import_tests pp_document_ppi_export_tests pp_renderer_api_tests pp_renderer_gl_capabilities_tests pp_paint_renderer_compositor_tests pp_ui_core_color_tests pp_ui_core_layout_value_tests pp_ui_core_layout_xml_tests}" targets="${*:-pp_foundation pp_assets pp_paint pp_document pp_renderer_api pp_renderer_gl pp_paint_renderer pp_ui_core pano_cli pp_foundation_binary_stream_tests pp_foundation_event_tests pp_foundation_log_tests pp_foundation_parse_tests pp_foundation_task_queue_tests pp_foundation_trace_tests pp_assets_image_format_tests pp_assets_image_metadata_tests pp_assets_image_pixels_tests pp_assets_ppi_header_tests pp_assets_settings_document_tests pp_paint_brush_tests pp_paint_blend_tests pp_paint_stroke_tests pp_paint_stroke_script_tests pp_document_tests pp_document_ppi_import_tests pp_document_ppi_export_tests pp_renderer_api_tests pp_renderer_gl_capabilities_tests pp_renderer_gl_command_plan_tests pp_paint_renderer_compositor_tests pp_ui_core_color_tests pp_ui_core_layout_value_tests pp_ui_core_layout_xml_tests}"
start="$(date +%s)" start="$(date +%s)"
cmake --preset "$preset" cmake --preset "$preset"

View File

@@ -384,7 +384,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\".*\"framebufferFetch\":false.*\"explicitTextureTransitions\":true.*\"textureCopy\":true.*\"renderTargetBlit\":true.*\"frameCapture\":true.*\"float16RenderTargets\":false.*\"float32RenderTargets\":false.*\"width\":32.*\"height\":16.*\"createdResources\":7.*\"exercisedClearReset\":false.*\"clearRejectedOrphanedTraceEnd\":false.*\"clearReusedRenderPass\":false.*\"labeledCommandDescriptors\":16.*\"commands\":25.*\"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.*\"transitionCommands\":4.*\"transitionToUpload\":1.*\"transitionToShaderRead\":2.*\"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\".*\"framebufferFetch\":false.*\"explicitTextureTransitions\":true.*\"textureCopy\":true.*\"renderTargetBlit\":true.*\"frameCapture\":true.*\"float16RenderTargets\":false.*\"float32RenderTargets\":false.*\"width\":32.*\"height\":16.*\"createdResources\":7.*\"exercisedClearReset\":false.*\"clearRejectedOrphanedTraceEnd\":false.*\"clearReusedRenderPass\":false.*\"labeledCommandDescriptors\":16.*\"commands\":25.*\"openGlPlan\":.*\"available\":true.*\"supported\":true.*\"commands\":25.*\"renderPasses\":1.*\"drawCommands\":1.*\"passthroughCommands\":11.*\"traceCommands\":3.*\"unsupportedCommands\":0.*\"renderPassOrderErrors\":0.*\"endedInRenderPass\":false.*\"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.*\"transitionCommands\":4.*\"transitionToUpload\":1.*\"transitionToShaderRead\":2.*\"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_exercises_clear_reset add_test(NAME pano_cli_record_render_exercises_clear_reset
COMMAND pano_cli record-render --width 32 --height 16 --exercise-clear) COMMAND pano_cli record-render --width 32 --height 16 --exercise-clear)

View File

@@ -8,3 +8,10 @@ target_link_libraries(pano_cli PRIVATE
pp_document pp_document
pp_renderer_api pp_renderer_api
pp_ui_core) pp_ui_core)
if(TARGET pp_renderer_gl)
target_link_libraries(pano_cli PRIVATE
pp_renderer_gl)
target_compile_definitions(pano_cli PRIVATE
PP_PANO_CLI_ENABLE_OPENGL_PLAN=1)
endif()

View File

@@ -11,6 +11,9 @@
#include "paint/stroke.h" #include "paint/stroke.h"
#include "paint/stroke_script.h" #include "paint/stroke_script.h"
#include "renderer_api/recording_renderer.h" #include "renderer_api/recording_renderer.h"
#ifdef PP_PANO_CLI_ENABLE_OPENGL_PLAN
#include "renderer_gl/command_plan.h"
#endif
#include "ui_core/layout_xml.h" #include "ui_core/layout_xml.h"
#include <algorithm> #include <algorithm>
@@ -2672,6 +2675,9 @@ int record_render(int argc, char** argv)
}; };
const auto commands = device.commands(); const auto commands = device.commands();
const auto features = device.features(); const auto features = device.features();
#ifdef PP_PANO_CLI_ENABLE_OPENGL_PLAN
const auto open_gl_plan = pp::renderer::gl::plan_recorded_render_commands(commands);
#endif
for (const auto& command : commands) { for (const auto& command : commands) {
if (command.kind == pp::renderer::RecordedRenderCommandKind::begin_render_pass) { if (command.kind == pp::renderer::RecordedRenderCommandKind::begin_render_pass) {
++render_passes; ++render_passes;
@@ -2773,6 +2779,19 @@ int record_render(int argc, char** argv)
<< ",\"clearReusedRenderPass\":" << json_bool(clear_reused_render_pass) << ",\"clearReusedRenderPass\":" << json_bool(clear_reused_render_pass)
<< ",\"labeledCommandDescriptors\":" << labeled_command_descriptors << ",\"labeledCommandDescriptors\":" << labeled_command_descriptors
<< ",\"commands\":" << commands.size() << ",\"commands\":" << commands.size()
#ifdef PP_PANO_CLI_ENABLE_OPENGL_PLAN
<< ",\"openGlPlan\":{\"available\":true"
<< ",\"supported\":" << json_bool(open_gl_plan.supported)
<< ",\"commands\":" << open_gl_plan.commands.size()
<< ",\"renderPasses\":" << open_gl_plan.render_pass_count
<< ",\"drawCommands\":" << open_gl_plan.draw_command_count
<< ",\"passthroughCommands\":" << open_gl_plan.passthrough_command_count
<< ",\"traceCommands\":" << open_gl_plan.trace_command_count
<< ",\"unsupportedCommands\":" << open_gl_plan.unsupported_command_count
<< ",\"renderPassOrderErrors\":" << open_gl_plan.render_pass_order_error_count
<< ",\"endedInRenderPass\":" << json_bool(open_gl_plan.ended_in_render_pass)
<< "}"
#endif
<< ",\"renderPasses\":" << render_passes << ",\"renderPasses\":" << render_passes
<< ",\"depthClears\":" << depth_clears << ",\"depthClears\":" << depth_clears
<< ",\"stencilClears\":" << stencil_clears << ",\"stencilClears\":" << stencil_clears