diff --git a/docs/modernization/build-inventory.md b/docs/modernization/build-inventory.md index 5597e3e..e6fc430 100644 --- a/docs/modernization/build-inventory.md +++ b/docs/modernization/build-inventory.md @@ -295,7 +295,10 @@ powershell -ExecutionPolicy Bypass -File scripts\automation\apple-remote-build.p write pure document/paint-renderer equirectangular PNG sequences through the app-core collection write/publish executor before retained fallback; JPEG/XMP equirectangular export, Web handoff, incomplete-readback collection cases, - depth, and video export remain on retained writer paths. + and video export remain on retained writer paths. Depth export now plans the + retained image/depth output paths in `pp_app_core` and logs a tested + `pp_paint_renderer` depth render plan plus the shared document-frame + renderer-readiness report before retained `Canvas::export_depth` execution. - `pano_cli save-document-project` writes that pure document export to a PPI file and is covered by `pano_cli_save_document_project_roundtrip_smoke`, which inspects and loads the generated file. @@ -1141,9 +1144,10 @@ powershell -ExecutionPolicy Bypass -File scripts\automation\apple-remote-build.p equirectangular export writes the pure document/paint-renderer equirectangular PNG before retained fallback, payload-complete layer and animation-frame collections write pure document/paint-renderer PNG sequences - through the app-core collection write/publish executor, and JPEG/XMP, - Web/incomplete-readback collection cases, and depth exports remain on older - retained paths. It + through the app-core collection write/publish executor, depth export plans + image/depth targets and logs the paint-renderer render plan plus shared + renderer readiness before retained execution, and JPEG/XMP plus + Web/incomplete-readback collection cases remain on older retained paths. It also bridges timelapse and animation MP4 export picker-selected paths while preserving desktop worker-thread timelapse behavior, mobile/Web save callbacks, `App::rec_export`, animation `Canvas::export_anim_mp4`, and diff --git a/docs/modernization/capability-map.md b/docs/modernization/capability-map.md index 6a3d298..33a9f1b 100644 --- a/docs/modernization/capability-map.md +++ b/docs/modernization/capability-map.md @@ -27,7 +27,7 @@ and validation command. | PNG/JPEG export | `Canvas`, `Image`, export dialogs | `pp_assets`, `pp_paint_renderer`, `pp_app_core` | Golden output tolerance, export start/target planning tests, live export-adapter document snapshot readiness through the shared paint-renderer export report, pure cube-face PNG writer, pure equirectangular PNG writer, pure layer/frame collection PNG writers, app-core collection write executor, JPEG/XMP parity still retained | | Equirectangular import/export | `Canvas`, shaders, RTT, export dialogs | `pp_paint_renderer`, `pp_app_core` | Tiny cube/equirect golden, app-core file target tests, live export-adapter renderer-upload/face-PNG readiness report, pure document-frame equirectangular PNG export and live PNG writer fallback, pure layer/frame equirectangular PNG collection export, JPEG/XMP retained until metadata parity is owned | | Cube face export | `Canvas` fallback | `pp_paint_renderer`, `pp_app_core` | Pure six-face document frame composite, renderer texture-upload bridge, shared export-readiness report, app-core face filename planning and write/publish service execution, payload-complete canvas-snapshot renderer-upload and face-PNG automation, live document/renderer face-PNG writer with retained Canvas fallback, OpenGL command-plan coverage, six-face golden set | -| Depth export | `Canvas`, grid tools | `pp_paint_renderer` | Float/readback validation | +| Depth export | `Canvas`, grid tools | `pp_paint_renderer`, `pp_app_core` | Depth target/write planning, document-snapshot renderer-readiness logging, depth render-plan draw/readback counts, retained render/readback parity, and format/golden validation | ## Brush And Painting diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index 5b309e7..aa0e549 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -543,6 +543,14 @@ agent or engineer to remove them without reconstructing context from chat. fallback; Web handoff, incomplete renderer-readback snapshots, progress and threading parity, exact GPU filtering/goldens, depth, video, and JPEG/XMP remain open. +- 2026-06-05: DEBT-0010/DEBT-0036/DEBT-0043 were narrowed again. Depth export + now plans the retained image/depth output target paths in tested + `pp_app_core`, has a tested `pp_app_core` two-payload write/publish executor + ready for later pure payload adoption, and logs a tested + `pp_paint_renderer::plan_document_depth_export_render` result from the live + document snapshot before retained `Canvas::export_depth` runs. The actual + 1024x1024 perspective/depth rendering, readback, worker-thread behavior, and + the legacy `.png` path names carrying JPEG-encoded bytes remain open. ## Open Debt @@ -556,7 +564,7 @@ agent or engineer to remove them without reconstructing context from chat. | DEBT-0007 | Open | Modernization | `vcpkg.json` and `windows-msvc-vcpkg-headless` are validated for the headless Windows component matrix, and root CMake now exposes a focused `panopainter_platform_build_vcpkg_ui_core` target for the vcpkg-backed `pp_ui_core`/tinyxml2 boundary, but app targets still use vendored libraries and Android/Apple triplets are not proven | Dependency migration must stay incremental while SDK/patched/vendor dependencies remain in use | `cmake --preset windows-msvc-vcpkg-headless`; `ctest --preset desktop-fast-vcpkg --build-config Debug`; `cmake --build --preset windows-msvc-default --config Debug --target panopainter_platform_build_vcpkg_ui_core` | Component targets consume vcpkg packages where reliable and desktop app, Android, and Apple triplets are validated or explicitly documented as permanent vendor exceptions | | DEBT-0008 | Open | Modernization | `windows-msvc-default` and `windows-msvc-vcpkg-headless` explicitly select Visual Studio 18 2026 for local validation, but non-VS2026 CMake executables on PATH may not know that generator | The local machine has VS 2026, but using an older CMake can still default to Ninja or reject the VS 2026 generator | `cmake --preset windows-msvc-default`; `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter`; `ctest --preset desktop-fast --build-config Debug` | The repo automation invokes or locates a CMake executable that supports `Visual Studio 18 2026`, and VS 2026 generator validation is the normal Windows path without manual tool selection | | DEBT-0009 | Open | Modernization | Android root CMake validation currently builds headless targets only, while retained standard/Quest/Focus package CMake paths now have a refreshed CMake 3.10/C++23 baseline outside root CMake; automation queries `sdkmanager`, installs newer or missing SDK Manager NDK/CMake packages, selects the resulting pair before configure, and reports update decisions; root CMake exposes non-default platform-build and retained native package validation targets | Platform app entrypoints still live in legacy Gradle/CMake projects and need Phase 6 alignment | `powershell -ExecutionPolicy Bypass -File scripts\automation\platform-build.ps1 -Presets android-arm64`; `cmake --build --preset android-x64`; `cmake --build --preset android-quest-arm64`; `cmake --build --preset android-focus-arm64`; `cmake --build --preset windows-msvc-default --config Debug --target panopainter_platform_build_android_assets`; `powershell -ExecutionPolicy Bypass -File scripts\automation\android-legacy-package-build.ps1 -Packages standard`; `powershell -ExecutionPolicy Bypass -File scripts\automation\android-legacy-package-build.ps1 -Packages quest,focus -ConfigureOnly`; `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -ReadinessOnly -AndroidNativeChecks -PackageKinds android-standard-apk,android-quest-apk,android-focus-apk`; `cmake --build --preset windows-msvc-default --config Debug --target panopainter_android_native_package_smoke` | Android standard, Quest, and Focus/Wave package targets consume shared component targets and have package smoke commands | -| DEBT-0010 | Open | Modernization | `pp_document` is a pure layer/frame/document/undo-history model with alpha-lock metadata, snapshot construction, per-layer frame metadata, renderer-free RGBA8 face payload storage, snapshot-embedded face-payload validation, renderer-free alpha8 selection-mask storage, PPI import/export helpers, stroke-script-to-face-payload CLI automation, `pp_paint_renderer` document face/frame compositors, renderer-neutral six-face texture upload, pure six-face PNG export, pure equirectangular PNG export, pure layer/animation-frame PNG collection export, shared document-frame export readiness reporting, OpenGL command-planner validation through CLI render automation, live Canvas snapshot projection through `pp_app_core`/`legacy_document_canvas_services`, captured RGBA8 payload attachment to `pp_document`, live Save/Save As/Save Version/save-before-workflow snapshot-readiness reporting before retained save execution, pure app-core PPI export for payload-complete canvas snapshots, payload-complete canvas-snapshot renderer-upload plus face-PNG export automation, live cube-face face-PNG writer execution using app-core face target planning and write/publish service dispatch with retained fallback, live PNG equirectangular writer execution using the paint-renderer equirectangular PNG export with retained fallback, live payload-complete layer/animation-frame collection writer execution using paint-renderer PNG sequences and app-core collection write/publish dispatch with retained fallback, and live equirectangular/layer/animation-frame/cube-face export snapshot/render/export-readiness reporting through the shared readiness helper, but action-command adoption, live save-writer replacement, JPEG/XMP metadata parity, Web and incomplete-readback collection handoff, progress/threading parity, broader renderer-owned export execution, and renderer-owned cube-face readback ownership are not yet wired | Keep extraction incremental while preserving app behavior | `ctest --preset desktop-fast --build-config Debug`; `pano_cli create-document --width 64 --height 32 --layers 2`; `pano_cli load-project --path tests\data\projects\minimal-project.ppi`; `pano_cli simulate-document-render --width 64 --height 32`; `pano_cli plan-canvas-document-snapshot --width 64 --height 32`; `pano_cli plan-canvas-document-snapshot --captured-face-payloads-per-layer 1`; `pp_document_tests`; `pp_document_ppi_import_tests`; `pp_document_ppi_export_tests`; `pp_paint_renderer_compositor_tests`; `pp_app_core_document_canvas_tests`; `pano_cli_simulate_document_edits_smoke`; `pano_cli_simulate_document_export_smoke`; `pano_cli_simulate_document_render_smoke`; `pano_cli_plan_canvas_document_snapshot_smoke`; `pano_cli_plan_canvas_document_snapshot_payload_smoke`; `pano_cli_save_document_project_roundtrip_smoke`; `pano_cli_apply_stroke_script_roundtrip_smoke`; `pano_cli_apply_stroke_script_rejects_tiny_canvas` | Legacy document behavior is represented by `pp_document`/`pp_paint_renderer` tests and the app consumes it through a boundary/facade | +| DEBT-0010 | Open | Modernization | `pp_document` is a pure layer/frame/document/undo-history model with alpha-lock metadata, snapshot construction, per-layer frame metadata, renderer-free RGBA8 face payload storage, snapshot-embedded face-payload validation, renderer-free alpha8 selection-mask storage, PPI import/export helpers, stroke-script-to-face-payload CLI automation, `pp_paint_renderer` document face/frame compositors, renderer-neutral six-face texture upload, pure six-face PNG export, pure equirectangular PNG export, pure layer/animation-frame PNG collection export, shared document-frame export readiness reporting, depth export render-plan reporting, OpenGL command-planner validation through CLI render automation, live Canvas snapshot projection through `pp_app_core`/`legacy_document_canvas_services`, captured RGBA8 payload attachment to `pp_document`, live Save/Save As/Save Version/save-before-workflow snapshot-readiness reporting before retained save execution, pure app-core PPI export for payload-complete canvas snapshots, payload-complete canvas-snapshot renderer-upload plus face-PNG export automation, live cube-face face-PNG writer execution using app-core face target planning and write/publish service dispatch with retained fallback, live PNG equirectangular writer execution using the paint-renderer equirectangular PNG export with retained fallback, live payload-complete layer/animation-frame collection writer execution using paint-renderer PNG sequences and app-core collection write/publish dispatch with retained fallback, and live equirectangular/layer/animation-frame/depth/cube-face export snapshot/render/export-readiness reporting through the shared readiness helper plus the depth render plan, but action-command adoption, live save-writer replacement, JPEG/XMP metadata parity, Web and incomplete-readback collection handoff, progress/threading parity, broader renderer-owned export execution, depth render/readback replacement, and renderer-owned cube-face readback ownership are not yet wired | Keep extraction incremental while preserving app behavior | `ctest --preset desktop-fast --build-config Debug`; `pano_cli create-document --width 64 --height 32 --layers 2`; `pano_cli load-project --path tests\data\projects\minimal-project.ppi`; `pano_cli simulate-document-render --width 64 --height 32`; `pano_cli plan-canvas-document-snapshot --width 64 --height 32`; `pano_cli plan-canvas-document-snapshot --captured-face-payloads-per-layer 1`; `pp_document_tests`; `pp_document_ppi_import_tests`; `pp_document_ppi_export_tests`; `pp_paint_renderer_compositor_tests`; `pp_app_core_document_canvas_tests`; `pano_cli_simulate_document_edits_smoke`; `pano_cli_simulate_document_export_smoke`; `pano_cli_simulate_document_render_smoke`; `pano_cli_plan_canvas_document_snapshot_smoke`; `pano_cli_plan_canvas_document_snapshot_payload_smoke`; `pano_cli_save_document_project_roundtrip_smoke`; `pano_cli_apply_stroke_script_roundtrip_smoke`; `pano_cli_apply_stroke_script_rejects_tiny_canvas` | Legacy document behavior is represented by `pp_document`/`pp_paint_renderer` tests and the app consumes it through a boundary/facade | | DEBT-0011 | Open | Modernization | `package-smoke` validates the Windows CMake app artifact and launch-folder DLL payload, and reports a structured package readiness matrix for Windows AppX, Android standard/Quest/Focus APKs, Apple bundles, Linux app output, and WebGL output; the Windows app smoke passes the configure-time CMake executable so VS 2026 generator validation does not depend on `cmake` from PATH, retained Android package native CMake paths, and retained Linux/WebGL CMake baseline metadata are reachable from package validation and root CMake package-readiness targets, but Windows AppX/APK/Linux/Apple/WebGL package outputs are still `blocked` because root CMake package targets do not exist yet | Platform package targets are not migrated to root CMake yet | `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug`; `cmake --build --preset windows-msvc-default --config Debug --target panopainter_windows_app_package_smoke`; `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -ReadinessOnly -AndroidNativeChecks -PackageKinds android-standard-apk,android-quest-apk,android-focus-apk`; `cmake --build --preset windows-msvc-default --config Debug --target panopainter_android_native_package_smoke`; `cmake --build --preset windows-msvc-default --config Debug --target panopainter_linux_webgl_package_readiness`; `python scripts/dev/check_package_smoke_readiness.py`; `bash -n scripts/automation/package-smoke.sh` | Package-smoke builds and validates Windows AppX, Android APK variants, Linux app, Apple bundles, and WebGL output where local toolchains are present | | DEBT-0012 | Open | Modernization | `pp_ui_core` uses vcpkg tinyxml2 on `windows-msvc-vcpkg-headless`, but retains `pp_vendor_tinyxml2` for default and unproven platform presets | Mobile/AppX/Apple triplets and app packaging still need validation before removing the vendored fallback | `ctest --preset desktop-fast-vcpkg --build-config Debug`; `ctest --preset desktop-fast --build-config Debug`; `powershell -ExecutionPolicy Bypass -File scripts\automation\platform-build.ps1 -Presets android-arm64` | All supported presets consume vcpkg tinyxml2 or document a permanent vendored exception | | DEBT-0013 | Open | Modernization | `pp_assets`, `pp_document`, `pano_cli inspect-project`, `pano_cli load-project`, and `pano_cli save-project` validate the fixed PPI header, thumbnail/body byte layout, generated multi-layer/multi-frame PPI writing with explicit layer opacity/blend/alpha-lock/visibility metadata, per-layer frame durations, metadata-only and targeted dirty-face-payload save/load round-trips, layer/frame index, dirty-face descriptors, dirty-face PNG payload metadata, asset-level RGBA PNG payload decoding, pure document-to-PPI export, CLI document export automation, file-writing document export automation, stroke-script-generated document payload export, decoded pixel attachment to `pp_document`, live save-path snapshot-readiness reporting, and app-core canvas-snapshot-to-PPI export automation, but full legacy PPI round-trip parity and pure live save writer replacement are not yet extracted | Full PPI save parity requires staged extraction of legacy `Canvas` serialization and image/layer payload handling | `ctest --preset desktop-fast --build-config Debug`; `pp_assets_image_pixels_tests`; `pp_assets_ppi_header_tests`; `pp_document_ppi_import_tests`; `pp_document_ppi_export_tests`; `pano_cli_inspect_project_layout_smoke`; `pano_cli_load_project_metadata_smoke`; `pano_cli_save_project_roundtrip_smoke`; `pano_cli_save_project_payload_roundtrip_smoke`; `pano_cli_simulate_document_export_smoke`; `pano_cli_save_document_project_roundtrip_smoke`; `pano_cli_apply_stroke_script_roundtrip_smoke`; `pano_cli_apply_stroke_script_rejects_tiny_canvas` | Full PPI load/save fixtures cover thumbnails, decoded layer face payloads attached to documents, frames, corrupt payloads, dirty-face payload saving, arbitrary legacy canvas payload/layout combinations, and legacy app round-trip compatibility | @@ -588,7 +596,7 @@ agent or engineer to remove them without reconstructing context from chat. | DEBT-0040 | Open | Modernization | Close request, document save, save-before-workflow planning/execution dispatch, and close/save-before/save-error prompt metadata now consume pure `pp_app_core` through `App::request_close`, `App::save_document`, `App::continue_document_workflow_after_optional_save`, `pano_cli simulate-app-session`, `pano_cli plan-document-session-prompt`, `DocumentSaveServices`, `CloseRequestServices`, `DocumentWorkflowServices`, and `src/legacy_document_session_services.*`; close/save-before prompt creation now uses `src/legacy_app_dialog_services.*`, Save dialog working-directory picker visibility/path formatting now dispatches through `PlatformServices`, and existing-project save/save-before-workflow execution prepares a payload-bearing canvas snapshot report before retained saving, but the bridge still opens retained save dialogs, wires prompt callbacks directly, delegates actual writing to `Canvas::project_save`, mutates the unsaved flag on close confirmation, invokes native app close, and routes save-version through the retained legacy dialog | Preserve current close/save/dirty-workflow behavior while document session execution moves toward app/document/UI/platform services | `pp_app_core_document_session_tests`; `pp_platform_api_tests`; `pano_cli plan-document-session-prompt --kind close-unsaved`; `pano_cli plan-document-session-prompt --kind save-before-workflow`; `pano_cli simulate-app-session --unsaved --save-intent save-dirty-version`; `pano_cli simulate-app-session --no-canvas`; `pano_cli plan-document-file --work-dir D:/Paint --name demo --target-exists`; `pano_cli plan-document-version --directory D:/Paint --doc-name demo.01 --existing-path D:/Paint/demo.02.ppi`; `ctest --preset desktop-fast --build-config Debug` | Close prompt execution, native close requests, dirty-workflow save prompts, existing-project saves, save dialogs, save-version execution, and unsaved-flag mutation are owned by injected app/document/UI/platform services with `App` methods acting only as adapters | | DEBT-0041 | Open | Modernization | Accepted new-document planning/execution dispatch and new-document overwrite prompt metadata now consume pure `pp_app_core` through `App::dialog_newdoc`, `pano_cli plan-new-document`, `pano_cli plan-document-session-prompt`, `NewDocumentServices`, and `src/legacy_document_session_services.*`; new-document overwrite prompt creation now uses `src/legacy_app_dialog_services.*`, and New Document dialog working-directory picker visibility/path formatting now dispatches through `PlatformServices`, but the bridge still mutates legacy app document fields, clears legacy layer UI, resizes legacy `Canvas`, clears legacy history, creates the default layer through legacy UI, mutates unsaved/new-document flags, updates the title, wires overwrite callbacks directly, and handles keyboard/dialog cleanup directly | Preserve current New Document dialog behavior while document creation moves toward app/document/UI services | `pp_app_core_document_session_tests`; `pp_platform_api_tests`; `pano_cli plan-new-document --work-dir D:/Paint --name demo --resolution-index 3`; `pano_cli plan-new-document --work-dir D:/Paint --name demo --resolution-index 3 --target-exists`; `pano_cli plan-document-session-prompt --kind new-document-overwrite`; `pano_cli simulate-app-session --save-intent save`; `ctest --preset desktop-fast --build-config Debug` | New document creation, overwrite confirmation, canvas/document allocation, default layer creation, history clearing, title updates, dirty/new-document state, and keyboard/dialog cleanup are owned by injected app/document/UI services with `App::dialog_newdoc` acting only as a UI adapter | | DEBT-0042 | Open | Modernization | Accepted Save As and Save Version planning/execution dispatch plus Save As overwrite prompt metadata now consumes pure `pp_app_core` through `App::dialog_save`, `App::dialog_save_ver`, `pano_cli plan-document-file`, `pano_cli plan-document-version`, `pano_cli plan-document-session-prompt`, `DocumentFileSaveServices`, `DocumentVersionSaveServices`, and `src/legacy_document_session_services.*`; Save As overwrite prompt creation now uses `src/legacy_app_dialog_services.*`, and accepted Save As/Save Version execution prepares a payload-bearing canvas snapshot report before retained saving, but the bridge still wires overwrite callbacks directly, delegates actual writing to legacy `Canvas::project_save`, mutates app document name/path/directory fields, marks version saves dirty before saving, updates the title, and handles keyboard/dialog cleanup directly | Preserve current Save As and Save Version behavior while document persistence moves toward app/document/storage/UI services | `pp_app_core_document_session_tests`; `pano_cli plan-document-file --work-dir D:/Paint --name demo --target-exists`; `pano_cli plan-document-session-prompt --kind file-overwrite --name demo`; `pano_cli plan-document-version --directory D:/Paint --doc-name demo.01 --existing-path D:/Paint/demo.02.ppi`; `pano_cli simulate-app-session --save-intent save-as`; `pano_cli simulate-app-session --save-intent save-version`; `ctest --preset desktop-fast --build-config Debug` | Save As overwrite prompting, project-save execution, app document metadata updates, title updates, version-save dirty-state handling, and keyboard/dialog cleanup are owned by injected app/document/storage/UI services with `App::dialog_save` and `App::dialog_save_ver` acting only as UI adapters | -| DEBT-0043 | Open | Modernization | Equirectangular, layer, animation-frame, depth, and cube-face export planning/execution dispatch now consumes pure `pp_app_core` through `App::dialog_export`, `App::dialog_export_layers`, `App::dialog_export_anim_frames`, `App::dialog_export_depth`, `App::dialog_export_cube_faces`, `pano_cli plan-export-*`, `DocumentExportServices`, and `src/legacy_document_export_services.*`; layer/frame dialogs also consume `plan_document_export_collection_target` plus `PlatformServices::uses_work_directory_document_export_collections()` instead of spelling local iOS branches, export success/failure/license dialog metadata plus execution log labels now come from `pp_app_core`, equirectangular/layer/animation-frame/cube-face execution prepares a payload-bearing document snapshot plus the shared `pp_paint_renderer::prepare_document_frame_export_readiness` report, cube-face export writes the pure face PNG bytes to `pp_app_core` planned work-directory face paths through `execute_document_cube_face_export_write` before falling back to retained Canvas execution on failure, PNG equirectangular export writes the pure `pp_paint_renderer` equirectangular PNG before retained fallback, and payload-complete layer/animation-frame collections write pure `pp_paint_renderer` PNG sequences through `execute_document_export_collection_write` before retained fallback, but the bridge still adapts retained filesystem writes/exported-image publishing locally, still calls legacy `Canvas` export methods for JPEG/XMP equirectangular export, Web/incomplete-readback collection exports, and depth, creates export directories, handles picker-selected stems, performs Web prepared-file handoff directly, and leaves depth export on the retained path | Preserve current image/collection/depth/cube export behavior while export execution moves toward document/renderer/platform/storage services | `pp_app_core_document_export_tests`; `pp_platform_api_tests`; `pano_cli plan-export-start --requires-license --demo`; `pano_cli plan-export-menu --kind layers`; `pano_cli plan-export-target --kind collection --work-dir D:/Paint --doc-name demo --suffix _layers`; `pano_cli plan-export-target --kind cube-faces --work-dir D:/Paint --doc-name demo`; `pano_cli plan-export-message --kind equirectangular --destination work --detail D:/Paint`; `pano_cli plan-export-report --kind license-disabled`; `pano_cli simulate-document-export`; `ctest --preset desktop-fast --build-config Debug` | File, collection, stem, depth, and remaining retained export execution, export-directory creation, Web file handoff, picker-selected stem handling, and legacy canvas export calls are owned by injected document/renderer/platform/storage services with export dialogs acting only as UI adapters | +| DEBT-0043 | Open | Modernization | Equirectangular, layer, animation-frame, depth, and cube-face export planning/execution dispatch now consumes pure `pp_app_core` through `App::dialog_export`, `App::dialog_export_layers`, `App::dialog_export_anim_frames`, `App::dialog_export_depth`, `App::dialog_export_cube_faces`, `pano_cli plan-export-*`, `DocumentExportServices`, and `src/legacy_document_export_services.*`; layer/frame dialogs also consume `plan_document_export_collection_target` plus `PlatformServices::uses_work_directory_document_export_collections()` instead of spelling local iOS branches, export success/failure/license dialog metadata plus execution log labels now come from `pp_app_core`, equirectangular/layer/animation-frame/depth/cube-face execution prepares a payload-bearing document snapshot plus the shared `pp_paint_renderer::prepare_document_frame_export_readiness` report, depth export target naming and two-payload write order are covered by tested `pp_app_core` helpers, cube-face export writes the pure face PNG bytes to `pp_app_core` planned work-directory face paths through `execute_document_cube_face_export_write` before falling back to retained Canvas execution on failure, PNG equirectangular export writes the pure `pp_paint_renderer` equirectangular PNG before retained fallback, and payload-complete layer/animation-frame collections write pure `pp_paint_renderer` PNG sequences through `execute_document_export_collection_write` before retained fallback, but the bridge still adapts retained filesystem writes/exported-image publishing locally, still calls legacy `Canvas` export methods for JPEG/XMP equirectangular export, Web/incomplete-readback collection exports, and depth rendering, creates export directories, handles picker-selected stems, performs Web prepared-file handoff directly, and leaves depth render/readback plus the legacy `.png`/JPEG payload mismatch on the retained path | Preserve current image/collection/depth/cube export behavior while export execution moves toward document/renderer/platform/storage services | `pp_app_core_document_export_tests`; `pp_platform_api_tests`; `pano_cli plan-export-start --requires-license --demo`; `pano_cli plan-export-menu --kind layers`; `pano_cli plan-export-target --kind collection --work-dir D:/Paint --doc-name demo --suffix _layers`; `pano_cli plan-export-target --kind cube-faces --work-dir D:/Paint --doc-name demo`; `pano_cli plan-export-message --kind equirectangular --destination work --detail D:/Paint`; `pano_cli plan-export-report --kind license-disabled`; `pano_cli simulate-document-export`; `ctest --preset desktop-fast --build-config Debug` | File, collection, stem, depth, and remaining retained export execution, export-directory creation, Web file handoff, picker-selected stem handling, and legacy canvas export calls are owned by injected document/renderer/platform/storage services with export dialogs acting only as UI adapters | | DEBT-0044 | Open | Modernization | Timelapse and animation MP4 export execution dispatch now consumes pure `pp_app_core` through `App::dialog_timelapse_export`, `App::dialog_export_mp4`, `pano_cli plan-export-menu`, `pano_cli plan-export-target --kind name`, `pano_cli plan-export-message`, `pano_cli plan-export-report`, `DocumentVideoExportServices`, and `src/legacy_document_export_services.*`, and success/failure/license dialog metadata plus execution log labels now come from `pp_app_core`, but the bridge still launches legacy desktop timelapse worker threads, calls `App::rec_export`, calls `Canvas::export_anim_mp4`, and owns mobile/Web save callbacks | Preserve current MP4/timelapse export behavior while video export moves toward app/document/renderer/video/platform/storage services | `pp_app_core_document_export_tests`; `pano_cli plan-export-menu --kind animation-mp4`; `pano_cli plan-export-menu --kind timelapse`; `pano_cli plan-export-target --kind name --doc-name demo --suffix -animation`; `pano_cli plan-export-target --kind name --doc-name demo --suffix -timelapse`; `pano_cli plan-export-message --kind timelapse --destination success`; `pano_cli plan-export-report --kind animation-mp4 --message "video export path must not be empty"`; `ctest --preset desktop-fast --build-config Debug` | Timelapse and animation MP4 execution, desktop worker threading, frame readback/video encoding handoff, and mobile/Web save callbacks are owned by injected app/document/renderer/video/platform/storage services with export dialogs acting only as UI adapters | | DEBT-0045 | Open | Modernization | Options-menu preference execution now consumes pure `pp_app_core` through UI scale, viewport scale, RTL direction, VR mode, VR-controller, auto-timelapse, and canvas cursor-mode callbacks plus `AppPreferenceServices` and `src/legacy_app_preference_services.*`; viewport-density and cursor-mode execution now delegate to `src/legacy_canvas_view_services.*`, but the bridges still call legacy `App::set_ui_scale`, `App::set_ui_rtl`, `App::rec_start`, `App::rec_stop`, retained canvas view mutation, and `Settings::save` directly; VR mode callbacks now call `App` VR wrappers that dispatch to `PlatformServices`, whose desktop runtime policy prefers OpenXR while the actual Windows OpenVR SDK bridge still lives in `WindowsPlatformServices` under DEBT-0061 | Preserve current options-menu behavior while preferences move toward app/UI/platform/storage services | `pp_app_core_app_preferences_tests`; `pp_app_core_canvas_view_tests`; `pano_cli plan-app-preferences --ui-scale 1.5 --display-density 2 --current-scale 1.6 --scale-option 1 --scale-option 1.5 --rtl`; `pano_cli plan-canvas-view-density --density 1.5`; `pano_cli plan-canvas-view-cursor-mode --mode 3`; `ctest --preset desktop-fast --build-config Debug`; `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter` | Preference persistence, UI/layout direction, viewport density, cursor mode, VR mode start/stop/failure handling, VR-controller state, and auto-timelapse recording side effects are owned by injected app/UI/platform/storage services with options-menu callbacks acting only as UI adapters | | DEBT-0046 | Open | Modernization | Startup preference/runtime execution and startup resource sequencing now consume pure `pp_app_core` through `App::init`, `pano_cli plan-app-startup`, `pano_cli plan-app-startup-resources`, `AppStartupServices`, `AppStartupResourceServices`, and `src/legacy_app_startup_services.*`, but the bridge still calls legacy `Settings::set`, `Settings::save`, `App::rec_start`, app VR-controller state mutation, message-box license warning execution, shader loading, asset initialization, layout creation, title updates, and UI render-target creation directly | Preserve current startup behavior while app startup moves toward app/preferences/storage/recording/UI/renderer services | `pp_app_core_app_startup_tests`; `pano_cli plan-app-startup --run-counter 7 --vr-controllers-disabled --license-invalid`; `pano_cli plan-app-startup --run-counter -1`; `pano_cli plan-app-startup-resources --width 1280 --height 720`; `pano_cli plan-app-startup-resources --bad-size`; `ctest --preset desktop-fast --build-config Debug`; `cmake --build --preset windows-msvc-default --config Debug --target PanoPainter` | Startup preference persistence, auto-timelapse startup, stored VR-controller state, license validation/warning, startup resource initialization, title updates, and UI render-target allocation are owned by injected app/preferences/storage/recording/UI/renderer services with `App::init` acting only as orchestration | diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index a65497e..3cff742 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -695,9 +695,13 @@ generate an equirectangular PNG through `pp_paint_renderer` before the retained fallback. Payload-complete layer and animation-frame PNG collections now use pure `pp_paint_renderer` equirectangular PNG generation plus app-core collection write/publish execution before retained fallback. JPEG/XMP -equirectangular export, Web handoff, depth, video, and incomplete-readback -collection cases still delegate to retained `Canvas` writers after readiness -reporting. +equirectangular export, Web handoff, video, and incomplete-readback collection +cases still delegate to retained `Canvas` writers after readiness reporting. +Depth export now also plans the retained image/depth file targets in +`pp_app_core` and logs a `pp_paint_renderer` document depth render plan for the +legacy 1024x1024 perspective render plus per-layer depth pass before falling +back to retained `Canvas::export_depth`; actual depth rendering, readback, and +format parity remain retained. `pano_cli plan-image-import` exposes app-core planning for File > Import image route decisions, including wide equirectangular images, legacy vertical cube strips, regular transform-placement images, and invalid image dimensions; live @@ -2542,10 +2546,12 @@ Results: frame before falling back to retained `Canvas` execution; payload-complete layer and animation-frame PNG collections now write pure `pp_paint_renderer` equirectangular PNG sequences through a tested app-core - collection write/publish executor before retained fallback. JPEG/XMP, - Web prepared-file handoff, depth, video, and incomplete-readback collection - cases remain on their prior retained writer paths. Actual broader writer - replacement remains tracked under export debt. + collection write/publish executor before retained fallback. Depth export now + prepares the same document/canvas snapshot, logs the shared renderer-upload + readiness report, and records a tested paint-renderer depth render plan before + retained `Canvas` execution. JPEG/XMP, Web prepared-file handoff, video, and + incomplete-readback collection cases remain on their prior retained writer + paths. Actual broader writer replacement remains tracked under export debt. - Snapshot creation now rejects invalid embedded RGBA8 face payloads before document export or history can persist malformed state. - Package-smoke wrappers validate the Windows CMake app executable/runtime diff --git a/src/app_core/document_export.h b/src/app_core/document_export.h index be86a5a..1d631b9 100644 --- a/src/app_core/document_export.h +++ b/src/app_core/document_export.h @@ -37,10 +37,20 @@ struct DocumentCubeFaceExportTarget { std::size_t face_count = 0; }; +struct DocumentDepthExportTarget { + std::string image_path; + std::string depth_path; +}; + struct DocumentCubeFaceExportPayload { std::span bytes; }; +struct DocumentDepthExportPayload { + std::span image_bytes; + std::span depth_bytes; +}; + struct DocumentExportCollectionPngPayload { std::string path_suffix; std::span bytes; @@ -195,6 +205,16 @@ public: virtual void publish_exported_image(std::string_view path) = 0; }; +class DocumentDepthExportWriteServices { +public: + virtual ~DocumentDepthExportWriteServices() = default; + + virtual pp::foundation::Status write_binary_file( + std::string_view path, + std::span bytes) = 0; + virtual void publish_exported_image(std::string_view path) = 0; +}; + class DocumentExportCollectionWriteServices { public: virtual ~DocumentExportCollectionWriteServices() = default; @@ -623,6 +643,34 @@ document_cube_face_export_names() noexcept return pp::foundation::Result::success(std::move(target)); } +[[nodiscard]] inline pp::foundation::Result make_document_depth_export_target( + std::string_view work_directory, + std::string_view document_name) +{ + if (work_directory.empty()) { + return pp::foundation::Result::failure( + pp::foundation::Status::invalid_argument("work directory must not be empty")); + } + + if (document_name.empty()) { + return pp::foundation::Result::failure( + pp::foundation::Status::invalid_argument("document name must not be empty")); + } + + DocumentDepthExportTarget target; + target.image_path.reserve(work_directory.size() + document_name.size() + 5U); + target.image_path += work_directory; + target.image_path += "/"; + target.image_path += document_name; + target.image_path += ".png"; + target.depth_path.reserve(work_directory.size() + document_name.size() + 11U); + target.depth_path += work_directory; + target.depth_path += "/"; + target.depth_path += document_name; + target.depth_path += "_depth.png"; + return pp::foundation::Result::success(std::move(target)); +} + [[nodiscard]] inline std::string document_export_two_digit_index(std::size_t index) { auto value = std::to_string(index); @@ -706,6 +754,33 @@ document_cube_face_export_names() noexcept return pp::foundation::Status::success(); } +[[nodiscard]] inline pp::foundation::Status execute_document_depth_export_write( + const DocumentDepthExportTarget& target, + DocumentDepthExportPayload payload, + DocumentDepthExportWriteServices& services) +{ + if (target.image_path.empty() || target.depth_path.empty()) { + return pp::foundation::Status::invalid_argument("depth export target requires image and depth paths"); + } + if (payload.image_bytes.empty() || payload.depth_bytes.empty()) { + return pp::foundation::Status::invalid_argument("depth export payload requires image and depth bytes"); + } + + const auto image_status = services.write_binary_file(target.image_path, payload.image_bytes); + if (!image_status.ok()) { + return image_status; + } + services.publish_exported_image(target.image_path); + + const auto depth_status = services.write_binary_file(target.depth_path, payload.depth_bytes); + if (!depth_status.ok()) { + return depth_status; + } + services.publish_exported_image(target.depth_path); + + return pp::foundation::Status::success(); +} + [[nodiscard]] inline pp::foundation::Status execute_document_export_collection_write( const DocumentExportCollectionTarget& target, std::span payloads, diff --git a/src/legacy_document_export_services.cpp b/src/legacy_document_export_services.cpp index 2513241..f79bb18 100644 --- a/src/legacy_document_export_services.cpp +++ b/src/legacy_document_export_services.cpp @@ -67,6 +67,7 @@ pp::foundation::Status write_export_binary_file(std::string_view path, std::span class LegacyExportWriteServices final : public pp::app::DocumentCubeFaceExportWriteServices + , public pp::app::DocumentDepthExportWriteServices , public pp::app::DocumentExportCollectionWriteServices { public: explicit LegacyExportWriteServices(App& app) noexcept @@ -519,6 +520,48 @@ public: void export_depth(std::string_view document_name) override { auto* app = &app_; +#if !__WEB__ + const auto target = pp::app::make_document_depth_export_target(app_.work_path, document_name); + if (target) { + LOG( + "export-depth document export target: image=%s depth=%s", + target.value().image_path.c_str(), + target.value().depth_path.c_str()); + } else { + LOG("export-depth document export target planning failed: %s", target.status().message); + } + + const auto prepared = prepare_legacy_document_export_snapshot(app_, "export-depth"); + if (prepared) { + const auto plan = pp::paint_renderer::plan_document_depth_export_render( + pp::paint_renderer::DocumentDepthExportRenderPlanRequest { + .document = &prepared.value().snapshot.document, + .frame_index = prepared.value().snapshot.document.active_frame_index(), + }); + if (plan) { + LOG( + "export-depth document export render plan: output=%ux%u mergedFaceDraws=%zu layerDepthDraws=%zu visitedLayers=%zu visibleLayers=%zu facePayloads=%zu requiresRendererReadback=%s", + plan.value().output_extent.width, + plan.value().output_extent.height, + plan.value().merged_face_draw_count, + plan.value().layer_depth_draw_count, + plan.value().visited_layer_count, + plan.value().visible_layer_count, + plan.value().face_payload_count, + plan.value().requires_renderer_readback ? "true" : "false"); + } else { + LOG( + "export-depth document export render plan retained legacy export after failure: %s", + plan.status().message); + } + } else { + LOG( + "export-depth document export snapshot bridge retained legacy export after failure: %s", + prepared.status().message); + } +#else + prepare_legacy_document_export_snapshot_or_continue(app_, "export-depth"); +#endif app_.canvas->m_canvas->export_depth(std::string(document_name), [app] { show_export_success_dialog( *app, diff --git a/src/paint_renderer/compositor.cpp b/src/paint_renderer/compositor.cpp index eded8c7..d1e07ac 100644 --- a/src/paint_renderer/compositor.cpp +++ b/src/paint_renderer/compositor.cpp @@ -683,6 +683,57 @@ export_document_frame_equirectangular_png(DocumentFrameCompositeRequest request) return export_document_frame_equirectangular_png(composite.value()); } +pp::foundation::Result plan_document_depth_export_render( + DocumentDepthExportRenderPlanRequest request) noexcept +{ + if (request.document == nullptr) { + return pp::foundation::Result::failure( + pp::foundation::Status::invalid_argument("document depth export request requires a document")); + } + + if (request.frame_index >= request.document->frames().size()) { + return pp::foundation::Result::failure( + pp::foundation::Status::out_of_range("document depth export frame index is outside the document")); + } + + const auto output_pixels = expected_pixel_count(request.output_extent); + if (!output_pixels) { + return pp::foundation::Result::failure(output_pixels.status()); + } + + DocumentDepthExportRenderPlan plan; + plan.output_extent = request.output_extent; + plan.merged_face_draw_count = pp::document::cube_face_count; + plan.visited_layer_count = request.document->layers().size(); + + for (const auto& layer : request.document->layers()) { + if (!layer.visible || layer.opacity == 0.0F || request.frame_index >= layer.frames.size()) { + continue; + } + + ++plan.visible_layer_count; + std::array layer_faces {}; + const auto& frame = layer.frames[request.frame_index]; + for (const auto& payload : frame.face_pixels) { + if (payload.face_index >= pp::document::cube_face_count) { + return pp::foundation::Result::failure( + pp::foundation::Status::out_of_range("document depth export face index is outside the cube")); + } + + layer_faces[payload.face_index] = true; + ++plan.face_payload_count; + } + + for (const auto has_payload : layer_faces) { + if (has_payload) { + ++plan.layer_depth_draw_count; + } + } + } + + return pp::foundation::Result::success(plan); +} + pp::foundation::Result export_document_layers_equirectangular_pngs(DocumentLayerEquirectangularPngExportRequest request) { diff --git a/src/paint_renderer/compositor.h b/src/paint_renderer/compositor.h index c40f9ac..9fb9f88 100644 --- a/src/paint_renderer/compositor.h +++ b/src/paint_renderer/compositor.h @@ -156,6 +156,29 @@ struct DocumentFrameEquirectangularPngExportResult { std::size_t composited_layer_face_count = 0; }; +struct DocumentDepthExportRenderPlanRequest { + const pp::document::CanvasDocument* document = nullptr; + std::size_t frame_index = 0; + pp::renderer::Extent2D output_extent { + .width = 1024, + .height = 1024, + }; +}; + +struct DocumentDepthExportRenderPlan { + pp::renderer::Extent2D output_extent { + .width = 1024, + .height = 1024, + }; + std::size_t merged_face_draw_count = 0; + std::size_t layer_depth_draw_count = 0; + std::size_t visited_layer_count = 0; + std::size_t visible_layer_count = 0; + std::size_t face_payload_count = 0; + bool uses_perspective_camera = true; + bool requires_renderer_readback = true; +}; + struct DocumentLayerEquirectangularPngExportRequest { const pp::document::CanvasDocument* document = nullptr; std::size_t frame_index = 0; @@ -232,6 +255,9 @@ export_document_frame_equirectangular_png(const DocumentFrameCompositeResult& co [[nodiscard]] pp::foundation::Result export_document_frame_equirectangular_png(DocumentFrameCompositeRequest request); +[[nodiscard]] pp::foundation::Result plan_document_depth_export_render( + DocumentDepthExportRenderPlanRequest request) noexcept; + [[nodiscard]] pp::foundation::Result export_document_layers_equirectangular_pngs(DocumentLayerEquirectangularPngExportRequest request); diff --git a/tests/app_core/document_export_tests.cpp b/tests/app_core/document_export_tests.cpp index 0f20379..e0c7063 100644 --- a/tests/app_core/document_export_tests.cpp +++ b/tests/app_core/document_export_tests.cpp @@ -154,6 +154,7 @@ public: class FakeDocumentCubeFaceExportWriteServices final : public pp::app::DocumentCubeFaceExportWriteServices + , public pp::app::DocumentDepthExportWriteServices , public pp::app::DocumentExportCollectionWriteServices { public: pp::foundation::Status write_binary_file( @@ -266,6 +267,26 @@ void cube_face_export_rejects_invalid_target_inputs(pp::tests::Harness& harness) PP_EXPECT(harness, missing_name.status().code == pp::foundation::StatusCode::invalid_argument); } +void depth_export_builds_legacy_work_paths(pp::tests::Harness& harness) +{ + const auto target = pp::app::make_document_depth_export_target("D:/Paint", "demo"); + + PP_EXPECT(harness, target); + PP_EXPECT(harness, target.value().image_path == "D:/Paint/demo.png"); + PP_EXPECT(harness, target.value().depth_path == "D:/Paint/demo_depth.png"); +} + +void depth_export_rejects_invalid_target_inputs(pp::tests::Harness& harness) +{ + const auto missing_work_directory = pp::app::make_document_depth_export_target("", "demo"); + const auto missing_name = pp::app::make_document_depth_export_target("D:/Paint", ""); + + PP_EXPECT(harness, !missing_work_directory); + PP_EXPECT(harness, missing_work_directory.status().code == pp::foundation::StatusCode::invalid_argument); + PP_EXPECT(harness, !missing_name); + PP_EXPECT(harness, missing_name.status().code == pp::foundation::StatusCode::invalid_argument); +} + void cube_face_export_writer_writes_and_publishes_faces_in_order(pp::tests::Harness& harness) { const auto target = pp::app::make_document_cube_face_export_target("D:/Paint", "demo"); @@ -349,6 +370,97 @@ void cube_face_export_writer_rejects_malformed_inputs(pp::tests::Harness& harnes PP_EXPECT(harness, services.publish_calls == 0); } +void depth_export_writer_writes_and_publishes_image_then_depth(pp::tests::Harness& harness) +{ + const auto target = pp::app::make_document_depth_export_target("D:/Paint", "demo"); + const std::array image_bytes {}; + const std::array depth_bytes {}; + FakeDocumentCubeFaceExportWriteServices services; + + PP_EXPECT(harness, target); + PP_EXPECT( + harness, + pp::app::execute_document_depth_export_write( + target.value(), + pp::app::DocumentDepthExportPayload { + .image_bytes = std::span(image_bytes), + .depth_bytes = std::span(depth_bytes), + }, + services) + .ok()); + PP_EXPECT(harness, services.write_calls == 2); + PP_EXPECT(harness, services.publish_calls == 2); + PP_EXPECT(harness, services.total_bytes == 5U); + PP_EXPECT(harness, services.last_path == "D:/Paint/demo_depth.png"); + PP_EXPECT( + harness, + services.call_order + == "write:D:/Paint/demo.png;publish:D:/Paint/demo.png;" + "write:D:/Paint/demo_depth.png;publish:D:/Paint/demo_depth.png;"); +} + +void depth_export_writer_stops_before_depth_publish_on_write_failure(pp::tests::Harness& harness) +{ + const auto target = pp::app::make_document_depth_export_target("D:/Paint", "demo"); + const std::array image_bytes {}; + const std::array depth_bytes {}; + FakeDocumentCubeFaceExportWriteServices services; + services.fail_on_write_call = 2; + + PP_EXPECT(harness, target); + const auto status = pp::app::execute_document_depth_export_write( + target.value(), + pp::app::DocumentDepthExportPayload { + .image_bytes = std::span(image_bytes), + .depth_bytes = std::span(depth_bytes), + }, + services); + PP_EXPECT(harness, !status.ok()); + PP_EXPECT(harness, services.write_calls == 2); + PP_EXPECT(harness, services.publish_calls == 1); + PP_EXPECT( + harness, + services.call_order + == "write:D:/Paint/demo.png;publish:D:/Paint/demo.png;" + "write:D:/Paint/demo_depth.png;"); +} + +void depth_export_writer_rejects_malformed_inputs(pp::tests::Harness& harness) +{ + const auto target = pp::app::make_document_depth_export_target("D:/Paint", "demo"); + const std::array image_bytes {}; + const std::array depth_bytes {}; + FakeDocumentCubeFaceExportWriteServices services; + + PP_EXPECT(harness, target); + auto empty_image_path = target.value(); + empty_image_path.image_path.clear(); + PP_EXPECT( + harness, + !pp::app::execute_document_depth_export_write( + empty_image_path, + pp::app::DocumentDepthExportPayload { + .image_bytes = std::span(image_bytes), + .depth_bytes = std::span(depth_bytes), + }, + services) + .ok()); + + PP_EXPECT( + harness, + !pp::app::execute_document_depth_export_write( + target.value(), + pp::app::DocumentDepthExportPayload { + .image_bytes = {}, + .depth_bytes = std::span(depth_bytes), + }, + services) + .ok()); + + PP_EXPECT(harness, services.write_calls == 0); + PP_EXPECT(harness, services.publish_calls == 0); +} + void collection_export_builds_legacy_path_suffixes(pp::tests::Harness& harness) { PP_EXPECT( @@ -976,6 +1088,8 @@ int main() harness.run("picked directory export builds stem", picked_directory_export_builds_stem); harness.run("cube face export builds legacy work paths", cube_face_export_builds_legacy_work_paths); harness.run("cube face export rejects invalid target inputs", cube_face_export_rejects_invalid_target_inputs); + harness.run("depth export builds legacy work paths", depth_export_builds_legacy_work_paths); + harness.run("depth export rejects invalid target inputs", depth_export_rejects_invalid_target_inputs); harness.run( "cube face export writer writes and publishes faces in order", cube_face_export_writer_writes_and_publishes_faces_in_order); @@ -983,6 +1097,13 @@ int main() "cube face export writer stops before publish on write failure", cube_face_export_writer_stops_before_publish_on_write_failure); harness.run("cube face export writer rejects malformed inputs", cube_face_export_writer_rejects_malformed_inputs); + harness.run( + "depth export writer writes and publishes image then depth", + depth_export_writer_writes_and_publishes_image_then_depth); + harness.run( + "depth export writer stops before depth publish on write failure", + depth_export_writer_stops_before_depth_publish_on_write_failure); + harness.run("depth export writer rejects malformed inputs", depth_export_writer_rejects_malformed_inputs); harness.run("collection export builds legacy path suffixes", collection_export_builds_legacy_path_suffixes); harness.run( "collection export writer writes and publishes payloads in order", diff --git a/tests/paint_renderer/compositor_tests.cpp b/tests/paint_renderer/compositor_tests.cpp index 9bc2584..04806a6 100644 --- a/tests/paint_renderer/compositor_tests.cpp +++ b/tests/paint_renderer/compositor_tests.cpp @@ -24,6 +24,7 @@ using pp::paint_renderer::composite_document_face; using pp::paint_renderer::composite_document_frame; using pp::paint_renderer::plan_canvas_blend_gate; using pp::paint_renderer::plan_canvas_stroke_feedback; +using pp::paint_renderer::plan_document_depth_export_render; using pp::paint_renderer::plan_stroke_composite; using pp::paint_renderer::stroke_composite_path_name; using pp::paint_renderer::stroke_composite_requires_feedback; @@ -1036,6 +1037,80 @@ void exports_document_animation_frames_as_equirectangular_pngs(pp::tests::Harnes PP_EXPECT(h, decoded.value().pixels[2] == 0U); } +void plans_document_depth_export_renderer_work(pp::tests::Harness& h) +{ + std::vector visible_faces; + visible_faces.push_back(solid_face_payload(0, 1, 1, 255, 0, 0, 255)); + visible_faces.push_back(solid_face_payload(2, 1, 1, 0, 0, 255, 255)); + + const AnimationFrame root_frames[] { + { .duration_ms = 100, .face_pixels = {} }, + }; + const AnimationFrame visible_layer_frames[] { + { .duration_ms = 100, .face_pixels = visible_faces }, + }; + const AnimationFrame hidden_layer_frames[] { + { + .duration_ms = 100, + .face_pixels = solid_cube_faces(1, 1, 255, 255, 0, 255), + }, + }; + const AnimationFrame empty_layer_frames[] { + { .duration_ms = 100, .face_pixels = {} }, + }; + const DocumentLayerConfig layers[] { + { + .name = "Visible", + .frames = std::span(visible_layer_frames, 1), + }, + { + .name = "Hidden", + .visible = false, + .frames = std::span(hidden_layer_frames, 1), + }, + { + .name = "Transparent", + .opacity = 0.0F, + .frames = std::span(hidden_layer_frames, 1), + }, + { + .name = "EmptyVisible", + .frames = std::span(empty_layer_frames, 1), + }, + }; + const auto document = CanvasDocument::create_from_snapshot(DocumentSnapshotConfig { + .width = 1, + .height = 1, + .layers = std::span(layers, 4), + .frames = std::span(root_frames, 1), + .selection_masks = {}, + }); + PP_EXPECT(h, document); + if (!document) { + return; + } + + const auto plan = plan_document_depth_export_render( + pp::paint_renderer::DocumentDepthExportRenderPlanRequest { + .document = &document.value(), + .frame_index = 0, + }); + PP_EXPECT(h, plan); + if (!plan) { + return; + } + + PP_EXPECT(h, plan.value().output_extent.width == 1024U); + PP_EXPECT(h, plan.value().output_extent.height == 1024U); + PP_EXPECT(h, plan.value().merged_face_draw_count == pp::document::cube_face_count); + PP_EXPECT(h, plan.value().visited_layer_count == 4U); + PP_EXPECT(h, plan.value().visible_layer_count == 2U); + PP_EXPECT(h, plan.value().face_payload_count == 2U); + PP_EXPECT(h, plan.value().layer_depth_draw_count == 2U); + PP_EXPECT(h, plan.value().uses_perspective_camera); + PP_EXPECT(h, plan.value().requires_renderer_readback); +} + void document_frame_upload_rejects_invalid_requests(pp::tests::Harness& h) { RecordingRenderDevice device; @@ -1050,6 +1125,8 @@ void document_frame_upload_rejects_invalid_requests(pp::tests::Harness& h) pp::paint_renderer::DocumentLayerEquirectangularPngExportRequest {}); const auto no_document_frames = pp::paint_renderer::export_document_animation_frames_equirectangular_pngs( pp::paint_renderer::DocumentAnimationFrameEquirectangularPngExportRequest {}); + const auto no_document_depth = plan_document_depth_export_render( + pp::paint_renderer::DocumentDepthExportRenderPlanRequest {}); const AnimationFrame root_frames[] { { .duration_ms = 100, .face_pixels = {} }, @@ -1077,6 +1154,17 @@ void document_frame_upload_rejects_invalid_requests(pp::tests::Harness& h) .document = &document.value(), .frame_index = 1, }); + const auto bad_frame_depth = plan_document_depth_export_render( + pp::paint_renderer::DocumentDepthExportRenderPlanRequest { + .document = &document.value(), + .frame_index = 1, + }); + const auto bad_extent_depth = plan_document_depth_export_render( + pp::paint_renderer::DocumentDepthExportRenderPlanRequest { + .document = &document.value(), + .frame_index = 0, + .output_extent = Extent2D {}, + }); PP_EXPECT(h, !no_document.ok()); PP_EXPECT(h, no_document.status().code == StatusCode::invalid_argument); @@ -1088,10 +1176,16 @@ void document_frame_upload_rejects_invalid_requests(pp::tests::Harness& h) PP_EXPECT(h, no_document_layers.status().code == StatusCode::invalid_argument); PP_EXPECT(h, !no_document_frames.ok()); PP_EXPECT(h, no_document_frames.status().code == StatusCode::invalid_argument); + PP_EXPECT(h, !no_document_depth.ok()); + PP_EXPECT(h, no_document_depth.status().code == StatusCode::invalid_argument); PP_EXPECT(h, !bad_frame.ok()); PP_EXPECT(h, bad_frame.status().code == StatusCode::out_of_range); PP_EXPECT(h, !bad_frame_readiness.ok()); PP_EXPECT(h, bad_frame_readiness.status().code == StatusCode::out_of_range); + PP_EXPECT(h, !bad_frame_depth.ok()); + PP_EXPECT(h, bad_frame_depth.status().code == StatusCode::out_of_range); + PP_EXPECT(h, !bad_extent_depth.ok()); + PP_EXPECT(h, bad_extent_depth.status().code == StatusCode::invalid_argument); PP_EXPECT(h, device.commands().empty()); } @@ -1448,6 +1542,7 @@ int main() harness.run( "exports_document_animation_frames_as_equirectangular_pngs", exports_document_animation_frames_as_equirectangular_pngs); + harness.run("plans_document_depth_export_renderer_work", plans_document_depth_export_renderer_work); harness.run("document_frame_upload_rejects_invalid_requests", document_frame_upload_rejects_invalid_requests); harness.run("detects_feedback_requirements", detects_feedback_requirements); harness.run("plans_stroke_composite_paths", plans_stroke_composite_paths);