From b4c211799278c0f66672eece867833f592e5e9eb Mon Sep 17 00:00:00 2001 From: omigamedev Date: Tue, 2 Jun 2026 20:52:53 +0200 Subject: [PATCH] Expose OpenGL command plans in pano_cli --- docs/modernization/build-inventory.md | 6 +++++- docs/modernization/roadmap.md | 6 +++++- scripts/automation/platform-build.sh | 2 +- tests/CMakeLists.txt | 2 +- tools/pano_cli/CMakeLists.txt | 7 +++++++ tools/pano_cli/main.cpp | 19 +++++++++++++++++++ 6 files changed, 38 insertions(+), 4 deletions(-) diff --git a/docs/modernization/build-inventory.md b/docs/modernization/build-inventory.md index b7d60dc..4f5a8fb 100644 --- a/docs/modernization/build-inventory.md +++ b/docs/modernization/build-inventory.md @@ -340,7 +340,11 @@ Known local toolchain state: 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, 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 JSON, and is covered by `pano_cli_record_render_smoke`, `pano_cli_record_render_exercises_clear_reset`, plus diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index c6e1f07..b202b54 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -890,7 +890,11 @@ Results: render-pass/depth-clear counts, and draw descriptor vertex/index totals, scissor/depth/blend-state plus 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, 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 diff --git a/scripts/automation/platform-build.sh b/scripts/automation/platform-build.sh index 7e353fd..cb0920b 100644 --- a/scripts/automation/platform-build.sh +++ b/scripts/automation/platform-build.sh @@ -3,7 +3,7 @@ set -u preset="${1:-android-arm64}" 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)" cmake --preset "$preset" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 053a26f..5964ac8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -384,7 +384,7 @@ if(TARGET pano_cli) COMMAND pano_cli record-render --width 32 --height 16) set_tests_properties(pano_cli_record_render_smoke PROPERTIES 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 COMMAND pano_cli record-render --width 32 --height 16 --exercise-clear) diff --git a/tools/pano_cli/CMakeLists.txt b/tools/pano_cli/CMakeLists.txt index c9d56c8..542a677 100644 --- a/tools/pano_cli/CMakeLists.txt +++ b/tools/pano_cli/CMakeLists.txt @@ -8,3 +8,10 @@ target_link_libraries(pano_cli PRIVATE pp_document pp_renderer_api 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() diff --git a/tools/pano_cli/main.cpp b/tools/pano_cli/main.cpp index c3f0f6f..8b57a42 100644 --- a/tools/pano_cli/main.cpp +++ b/tools/pano_cli/main.cpp @@ -11,6 +11,9 @@ #include "paint/stroke.h" #include "paint/stroke_script.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 @@ -2672,6 +2675,9 @@ int record_render(int argc, char** argv) }; const auto commands = device.commands(); 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) { if (command.kind == pp::renderer::RecordedRenderCommandKind::begin_render_pass) { ++render_passes; @@ -2773,6 +2779,19 @@ int record_render(int argc, char** argv) << ",\"clearReusedRenderPass\":" << json_bool(clear_reused_render_pass) << ",\"labeledCommandDescriptors\":" << labeled_command_descriptors << ",\"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 << ",\"depthClears\":" << depth_clears << ",\"stencilClears\":" << stencil_clears