diff --git a/docs/modernization/build-inventory.md b/docs/modernization/build-inventory.md index 2d47850..53e75f3 100644 --- a/docs/modernization/build-inventory.md +++ b/docs/modernization/build-inventory.md @@ -448,8 +448,9 @@ Known local toolchain state: startup storage path preparation, clipboard text, cursor visibility, virtual-keyboard visibility, external file display, file sharing, native app/window close, UI-thread lifecycle hooks, render-context lifecycle hooks, - render-capture frame hooks, per-frame platform hooks, picker callbacks, and - recording cleanup, live asset/layout reload policy, diagnostic + render-target binding hooks, render-capture frame hooks, per-frame platform + hooks, picker callbacks, and recording cleanup, live asset/layout reload + policy, diagnostic stacktrace/crash hooks, prepared-file save/download handoff; Windows live app execution now uses injected diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index 13e4408..bae6092 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -35,7 +35,7 @@ agent or engineer to remove them without reconstructing context from chat. | DEBT-0014 | Open | Modernization | `windows-clangcl-asan` now configures as a headless Ninja/clang-cl preset and uses the release MSVC runtime required by ASan, but local builds still fail because installed clang-cl 18.1.8 is paired with VS 2026-preview STL headers that require Clang 20 or newer | Sanitizer validation should be local and repeatable, but this machine's compiler/header pairing is incompatible | `cmake --fresh --preset windows-clangcl-asan`; `cmake --build --preset windows-clangcl-asan --target pp_foundation` | Install/use Clang 20+ with the VS 2026 STL, or point the preset at a compatible VS 2022 toolchain, then make `platform-build.ps1 -Presets windows-clangcl-asan` pass for the headless matrix | | DEBT-0015 | Open | Modernization | Cursor visibility requests now consume pure `pp_app_core` planning through `pano_cli plan-cursor-visibility`, `App::show_cursor`/`App::hide_cursor` dispatch through `PlatformServices` without platform guards, and Windows live execution uses injected `WindowsPlatformServices`, but macOS cursor execution still reaches the retained fallback adapter | Keep canvas cursor behavior stable while platform shells are extracted incrementally | `pp_app_core_document_platform_io_tests`; `pano_cli plan-cursor-visibility --visible`; `ctest --preset desktop-fast --build-config Debug` | Cursor visibility execution is owned by injected `pp_platform_*` services for every supported platform | | DEBT-0016 | Open | Modernization | Clipboard get/set requests now consume pure `pp_app_core` planning through `pano_cli plan-clipboard-read` and `pano_cli plan-clipboard-write`, and Windows live execution uses injected `WindowsPlatformServices`, but Apple/Android clipboard execution still reaches retained fallback adapter branches from `App::clipboard_get_text` and `App::clipboard_set_text` | Keep picker/color text clipboard behavior stable while platform shells are extracted incrementally | `pp_app_core_document_platform_io_tests`; `pano_cli plan-clipboard-write --text #ff00aa`; `ctest --preset desktop-fast --build-config Debug` | Clipboard execution is owned by injected `pp_platform_*` services for every supported platform | -| DEBT-0017 | Open | Modernization | Startup storage path preparation, `App::clipboard_get_text`, `App::clipboard_set_text`, `App::show_cursor`, `App::hide_cursor`, `App::showKeyboard`, `App::hideKeyboard`, `App::display_file`, `App::share_file`, native app/window close, UI-thread lifecycle hooks, render-context acquire/release/present hooks, render-capture frame hooks, recording cleanup, live asset/layout reload policy, diagnostic stacktrace/crash hooks, per-frame platform hooks, `App::pick_image`, `App::pick_file`, the non-writer `App::pick_file_save`, `App::pick_dir`, and prepared-file save/download handoff now call the SDK-free `pp::platform::PlatformServices` interface, and Windows injects `WindowsPlatformServices` from `src/platform_windows/windows_platform_services.*`; non-Windows live implementations still use `src/platform_legacy/legacy_platform_services.*`, a named fallback adapter that forwards to retained Apple/Android/Linux/Web bridge functions and retained no-op branches | Preserve behavior while moving platform execution behind a testable service boundary before platform shell implementations are injected | `pp_platform_api_tests`; `pp_app_core_document_platform_io_tests`; `ctest --preset desktop-fast --build-config Debug`; `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug` | Replace `src/platform_legacy/legacy_platform_services.*` with injected `pp_platform_*` service implementations owned by each non-Windows platform shell | +| DEBT-0017 | Open | Modernization | Startup storage path preparation, `App::clipboard_get_text`, `App::clipboard_set_text`, `App::show_cursor`, `App::hide_cursor`, `App::showKeyboard`, `App::hideKeyboard`, `App::display_file`, `App::share_file`, native app/window close, UI-thread lifecycle hooks, render-context acquire/release/present hooks, render-target binding hooks, render-capture frame hooks, recording cleanup, live asset/layout reload policy, diagnostic stacktrace/crash hooks, per-frame platform hooks, `App::pick_image`, `App::pick_file`, the non-writer `App::pick_file_save`, `App::pick_dir`, and prepared-file save/download handoff now call the SDK-free `pp::platform::PlatformServices` interface, and Windows injects `WindowsPlatformServices` from `src/platform_windows/windows_platform_services.*`; non-Windows live implementations still use `src/platform_legacy/legacy_platform_services.*`, a named fallback adapter that forwards to retained Apple/Android/Linux/Web bridge functions and retained no-op branches | Preserve behavior while moving platform execution behind a testable service boundary before platform shell implementations are injected | `pp_platform_api_tests`; `pp_app_core_document_platform_io_tests`; `ctest --preset desktop-fast --build-config Debug`; `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug` | Replace `src/platform_legacy/legacy_platform_services.*` with injected `pp_platform_*` service implementations owned by each non-Windows platform shell | ## Closed Debt diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 757a406..d4171d4 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -471,10 +471,10 @@ before retained platform clipboard bridges continue. `pp_platform_api` now owns a headless `PlatformServices` interface for startup storage path preparation, clipboard text, cursor visibility, virtual-keyboard visibility, UI-thread lifecycle hooks, render-context -acquire/release/present hooks, render-capture frame hooks, external file -display, file sharing, recording file cleanup, live asset/layout reload policy, -diagnostic stacktrace/crash hooks, image/file/save-file pickers, and directory -pickers. +acquire/release/present hooks, render-target binding hooks, render-capture +frame hooks, external file display, file sharing, recording file cleanup, live +asset/layout reload policy, diagnostic stacktrace/crash hooks, +image/file/save-file pickers, and directory pickers. Windows installs an injected `WindowsPlatformServices` implementation from `src/platform_windows/windows_platform_services.*` in `pp_platform_windows`; other platforms still route through the debt-tracked legacy fallback adapter @@ -503,6 +503,9 @@ The app's render context acquire/release/present path now dispatches through rebinding, and swap in `WindowsPlatformServices`; Apple, Android, Linux, and WebGL behavior is preserved behind the legacy adapter until their platform shells are injected. +Render-task default-target binding and visible main-target binding now dispatch +through `PlatformServices`, preserving the existing iOS drawable bind in the +legacy adapter while removing the iOS drawable branch from `App::draw`. Windows RenderDoc frame capture hooks now also dispatch through `PlatformServices`, keeping capture integration in the platform service while leaving non-Windows adapters as no-ops. @@ -1035,10 +1038,11 @@ Results: clipboard writes, cursor visibility dispatch, virtual-keyboard visibility dispatch, external file display dispatch, file sharing dispatch, native app/window close dispatch, UI-thread lifecycle dispatch, render-context - lifecycle dispatch, render-capture frame hook dispatch, recording cleanup - dispatch, live asset/layout reload policy dispatch, diagnostic hook dispatch, - per-frame platform hook dispatch, picker callback dispatch, and prepared-file - save/download callback dispatch. The live Windows app now + lifecycle dispatch, render-target binding dispatch, render-capture frame hook + dispatch, recording cleanup dispatch, live asset/layout reload policy + dispatch, diagnostic hook dispatch, per-frame platform hook dispatch, picker + callback dispatch, and prepared-file save/download callback dispatch. The + live Windows app now consumes this interface through an injected `WindowsPlatformServices` instance isolated in `src/platform_windows/windows_platform_services.*`; other platforms still diff --git a/src/app.cpp b/src/app.cpp index fed8f94..84ff19a 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -620,11 +620,7 @@ void App::draw(float dt) if (!vr_only) { -#if __IOS__ - [ios_view->glview bindDrawable]; -#else - glBindFramebuffer(framebuffer_target(), default_framebuffer_id()); -#endif + bind_main_render_target(); glViewport(off_x, off_y, (GLsizei)width, (GLsizei)height); glEnable(scissor_test_state()); for (int i = 0; i < layout[main_id]->m_children.size(); i++) @@ -947,7 +943,7 @@ void App::ui_thread_tick() update(0); render_task([this] { - glBindFramebuffer(framebuffer_target(), default_framebuffer_id()); + bind_default_render_target(); clear(); draw(0); async_swap(); @@ -1039,7 +1035,7 @@ void App::ui_thread_main() update(t_frame); render_task([this, t_frame] { - glBindFramebuffer(framebuffer_target(), default_framebuffer_id()); + bind_default_render_target(); clear(); draw(t_frame); async_swap(); diff --git a/src/app.h b/src/app.h index 753a823..451bdd8 100644 --- a/src/app.h +++ b/src/app.h @@ -196,6 +196,8 @@ public: void acquire_render_context(); void release_render_context(); void present_render_context(); + void bind_default_render_target(); + void bind_main_render_target(); void begin_render_capture_frame(); void end_render_capture_frame(); [[nodiscard]] bool platform_deletes_recorded_files_on_clear(); diff --git a/src/app_events.cpp b/src/app_events.cpp index 791ea9a..03d5c0b 100644 --- a/src/app_events.cpp +++ b/src/app_events.cpp @@ -237,6 +237,16 @@ void App::present_render_context() active_platform_services().present_render_context(); } +void App::bind_default_render_target() +{ + active_platform_services().bind_default_render_target(); +} + +void App::bind_main_render_target() +{ + active_platform_services().bind_main_render_target(); +} + void App::begin_render_capture_frame() { active_platform_services().begin_render_capture_frame(); diff --git a/src/platform_api/platform_services.h b/src/platform_api/platform_services.h index 6ebffcd..bba253a 100644 --- a/src/platform_api/platform_services.h +++ b/src/platform_api/platform_services.h @@ -33,6 +33,8 @@ public: virtual void acquire_render_context() = 0; virtual void release_render_context() = 0; virtual void present_render_context() = 0; + virtual void bind_default_render_target() = 0; + virtual void bind_main_render_target() = 0; virtual void begin_render_capture_frame() = 0; virtual void end_render_capture_frame() = 0; [[nodiscard]] virtual bool deletes_recorded_files_on_clear() = 0; diff --git a/src/platform_legacy/legacy_platform_services.cpp b/src/platform_legacy/legacy_platform_services.cpp index 2b98853..73ac0f1 100644 --- a/src/platform_legacy/legacy_platform_services.cpp +++ b/src/platform_legacy/legacy_platform_services.cpp @@ -3,6 +3,7 @@ #include "app.h" #include "app_core/document_platform_io.h" +#include "renderer_gl/opengl_capabilities.h" #ifdef __ANDROID__ void displayKeyboard(bool pShow); @@ -224,6 +225,22 @@ public: #endif } + void bind_default_render_target() override + { + glBindFramebuffer( + static_cast(pp::renderer::gl::framebuffer_target()), + pp::renderer::gl::default_framebuffer_id()); + } + + void bind_main_render_target() override + { +#if __IOS__ + [App::I->ios_view->glview bindDrawable]; +#else + bind_default_render_target(); +#endif + } + void begin_render_capture_frame() override { } diff --git a/src/platform_windows/windows_platform_services.cpp b/src/platform_windows/windows_platform_services.cpp index b05ccbd..a7e362d 100644 --- a/src/platform_windows/windows_platform_services.cpp +++ b/src/platform_windows/windows_platform_services.cpp @@ -250,6 +250,18 @@ public: win32_async_swap(); } + void bind_default_render_target() override + { + glBindFramebuffer( + static_cast(pp::renderer::gl::framebuffer_target()), + pp::renderer::gl::default_framebuffer_id()); + } + + void bind_main_render_target() override + { + bind_default_render_target(); + } + void begin_render_capture_frame() override { win32_renderdoc_frame_start(); diff --git a/tests/platform_api/platform_services_tests.cpp b/tests/platform_api/platform_services_tests.cpp index f88e03b..fb6c084 100644 --- a/tests/platform_api/platform_services_tests.cpp +++ b/tests/platform_api/platform_services_tests.cpp @@ -81,6 +81,16 @@ public: ++render_context_presents; } + void bind_default_render_target() override + { + ++default_render_target_binds; + } + + void bind_main_render_target() override + { + ++main_render_target_binds; + } + void begin_render_capture_frame() override { ++render_capture_begins; @@ -184,6 +194,8 @@ public: int render_context_acquires = 0; int render_context_releases = 0; int render_context_presents = 0; + int default_render_target_binds = 0; + int main_render_target_binds = 0; int render_capture_begins = 0; int render_capture_ends = 0; int storage_prepares = 0; @@ -313,10 +325,14 @@ void platform_services_dispatch_render_context_lifecycle(pp::tests::Harness& har services.acquire_render_context(); services.present_render_context(); + services.bind_default_render_target(); + services.bind_main_render_target(); services.release_render_context(); PP_EXPECT(harness, fake.render_context_acquires == 1); PP_EXPECT(harness, fake.render_context_presents == 1); + PP_EXPECT(harness, fake.default_render_target_binds == 1); + PP_EXPECT(harness, fake.main_render_target_binds == 1); PP_EXPECT(harness, fake.render_context_releases == 1); }