Own log worker and trim Apple platform hooks
This commit is contained in:
@@ -18,6 +18,22 @@ agent or engineer to remove them without reconstructing context from chat.
|
|||||||
|
|
||||||
## Reductions
|
## Reductions
|
||||||
|
|
||||||
|
- 2026-06-16: `DEBT-0036` was narrowed again. `NodeCanvas` cache-to-screen
|
||||||
|
checkerboard-plane callback setup now routes through
|
||||||
|
`make_legacy_canvas_draw_merge_cache_to_screen_checkerboard_plane(...)` in
|
||||||
|
`src/legacy_canvas_draw_merge_services.h` instead of building the full MVP
|
||||||
|
callback body inline in `NodeCanvas::draw()`; broader canvas draw
|
||||||
|
orchestration remains.
|
||||||
|
- 2026-06-16: `DEBT-0003` was narrowed again. `LogRemote` now owns its network
|
||||||
|
logging worker as `std::jthread` with explicit stop requests in `src/log.*`
|
||||||
|
instead of raw `std::thread` ownership; retained global logger singleton,
|
||||||
|
network logging policy, and queue execution remain.
|
||||||
|
- 2026-06-16: `DEBT-0017` was narrowed again. Apple crash-test, app-close, and
|
||||||
|
iOS SonarPen hooks now route through explicit bridge callbacks in
|
||||||
|
`src/platform_apple/apple_platform_services.*` consumed by
|
||||||
|
`src/platform_legacy/legacy_platform_services.cpp` instead of direct `App::I`
|
||||||
|
calls in those legacy platform methods; the retained Apple fallback adapter
|
||||||
|
and broader platform singleton reach remain.
|
||||||
- 2026-06-16: `DEBT-0036` was narrowed again. `NodeCanvas` merged-path and
|
- 2026-06-16: `DEBT-0036` was narrowed again. `NodeCanvas` merged-path and
|
||||||
non-blend checkerboard background setup now route through
|
non-blend checkerboard background setup now route through
|
||||||
`execute_legacy_canvas_draw_merge_background_setup(...)` in
|
`execute_legacy_canvas_draw_merge_background_setup(...)` in
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ Current architecture mismatches that must be treated as real blockers:
|
|||||||
remain, even though iOS keyboard visibility and prepared-file save handoff
|
remain, even though iOS keyboard visibility and prepared-file save handoff
|
||||||
now also route through explicit Apple bridge callbacks and Apple render-
|
now also route through explicit Apple bridge callbacks and Apple render-
|
||||||
context hooks plus iOS main-render-target binding now route through the same
|
context hooks plus iOS main-render-target binding now route through the same
|
||||||
bridge style.
|
bridge style, as do Apple crash-test, app-close, and iOS SonarPen hooks.
|
||||||
- `src/platform_legacy/legacy_platform_services.*` is still part of the live
|
- `src/platform_legacy/legacy_platform_services.*` is still part of the live
|
||||||
app shell.
|
app shell.
|
||||||
- `pp_panopainter_ui` still depends on `pp_legacy_app`.
|
- `pp_panopainter_ui` still depends on `pp_legacy_app`.
|
||||||
@@ -108,7 +108,8 @@ Current architecture mismatches that must be treated as real blockers:
|
|||||||
OpenGL execution around the renderer boundary, even though `NodeCanvas`
|
OpenGL execution around the renderer boundary, even though `NodeCanvas`
|
||||||
display resolve, cache-to-screen composite, post-draw mask/grid/current-mode
|
display resolve, cache-to-screen composite, post-draw mask/grid/current-mode
|
||||||
sequencing, per-layer/per-plane retained draw execution, and shared
|
sequencing, per-layer/per-plane retained draw execution, and shared
|
||||||
checkerboard background setup now route through retained draw-merge helpers.
|
checkerboard background setup now route through retained draw-merge helpers,
|
||||||
|
with the cache-to-screen checkerboard-plane callback setup also reduced.
|
||||||
- `app_layout.cpp` and `app_dialogs.cpp` are still mixed shell/controller files
|
- `app_layout.cpp` and `app_dialogs.cpp` are still mixed shell/controller files
|
||||||
rather than thin composition/binding surfaces.
|
rather than thin composition/binding surfaces.
|
||||||
- `App`, `Canvas`, `Node`, retained workers, and platform entrypoints still use
|
- `App`, `Canvas`, `Node`, retained workers, and platform entrypoints still use
|
||||||
@@ -118,7 +119,8 @@ Current architecture mismatches that must be treated as real blockers:
|
|||||||
launches now use owned `std::jthread` or service-owned worker queues and
|
launches now use owned `std::jthread` or service-owned worker queues and
|
||||||
`AppRuntime` now owns render/UI workers with explicit `std::jthread`
|
`AppRuntime` now owns render/UI workers with explicit `std::jthread`
|
||||||
shutdown semantics while the Windows splash-dialog and HMD renderer workers
|
shutdown semantics while the Windows splash-dialog and HMD renderer workers
|
||||||
also use owned `std::jthread` lifecycle.
|
also use owned `std::jthread` lifecycle and `LogRemote` now uses the same
|
||||||
|
ownership model.
|
||||||
- Modern C++23 usage exists in extracted components, especially `std::span`,
|
- Modern C++23 usage exists in extracted components, especially `std::span`,
|
||||||
explicit result/status objects, and a few concepts, but the live app still
|
explicit result/status objects, and a few concepts, but the live app still
|
||||||
does not consistently express ownership, thread affinity, or renderer
|
does not consistently express ownership, thread affinity, or renderer
|
||||||
|
|||||||
@@ -133,6 +133,8 @@ Current slice:
|
|||||||
node still owns most live-pass and retained GL resource execution.
|
node still owns most live-pass and retained GL resource execution.
|
||||||
- `NodeCanvas` merged-path and non-blend checkerboard background setup now also
|
- `NodeCanvas` merged-path and non-blend checkerboard background setup now also
|
||||||
route through `execute_legacy_canvas_draw_merge_background_setup(...)`.
|
route through `execute_legacy_canvas_draw_merge_background_setup(...)`.
|
||||||
|
- `NodeCanvas` cache-to-screen checkerboard-plane callback setup now also routes
|
||||||
|
through a retained helper in `legacy_canvas_draw_merge_services.h`.
|
||||||
- `NodeCanvas` display resolve plus cache-to-screen checkerboard/cache-texture
|
- `NodeCanvas` display resolve plus cache-to-screen checkerboard/cache-texture
|
||||||
composite now route through `legacy_canvas_draw_merge_services.h`.
|
composite now route through `legacy_canvas_draw_merge_services.h`.
|
||||||
- `NodeCanvas` smoothing-mask overlay, smoothing-mask face pass, grid keepalive
|
- `NodeCanvas` smoothing-mask overlay, smoothing-mask face pass, grid keepalive
|
||||||
@@ -375,6 +377,8 @@ Current slice:
|
|||||||
- Windows splash-dialog and HMD renderer worker ownership in `main.cpp` now
|
- Windows splash-dialog and HMD renderer worker ownership in `main.cpp` now
|
||||||
also use `std::jthread` with explicit stop requests instead of raw
|
also use `std::jthread` with explicit stop requests instead of raw
|
||||||
`std::thread`
|
`std::thread`
|
||||||
|
- `LogRemote` worker ownership in `src/log.*` now also uses `std::jthread`
|
||||||
|
with explicit stop requests instead of raw `std::thread`
|
||||||
- brush package import/export now use service-owned `std::jthread` workers and
|
- brush package import/export now use service-owned `std::jthread` workers and
|
||||||
UI-thread completion handoff
|
UI-thread completion handoff
|
||||||
- prepared-file save work and grid lightmap launch now also use service-owned
|
- prepared-file save work and grid lightmap launch now also use service-owned
|
||||||
@@ -593,6 +597,9 @@ Current slice:
|
|||||||
- Apple render-context acquire/release/present hooks and iOS
|
- Apple render-context acquire/release/present hooks and iOS
|
||||||
`bind_main_render_target()` now also route through explicit Apple bridge
|
`bind_main_render_target()` now also route through explicit Apple bridge
|
||||||
callbacks instead of direct `App::I` calls in `LegacyPlatformServices`
|
callbacks instead of direct `App::I` calls in `LegacyPlatformServices`
|
||||||
|
- Apple crash-test, app-close, and iOS SonarPen hooks now also route through
|
||||||
|
explicit Apple bridge callbacks instead of direct `App::I` calls in
|
||||||
|
`LegacyPlatformServices`
|
||||||
- retained Apple callback injection and broader `platform_legacy` singleton
|
- retained Apple callback injection and broader `platform_legacy` singleton
|
||||||
reach are still open
|
reach are still open
|
||||||
|
|
||||||
|
|||||||
@@ -568,6 +568,28 @@ inline void execute_legacy_canvas_draw_merge_cache_to_screen_composite(
|
|||||||
execution.unbind_cache_texture();
|
execution.unbind_cache_texture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename PlaneTransform, typename DrawPlane>
|
||||||
|
[[nodiscard]] inline auto make_legacy_canvas_draw_merge_cache_to_screen_checkerboard_plane(
|
||||||
|
glm::mat4 proj,
|
||||||
|
glm::mat4 camera,
|
||||||
|
float layer_scale,
|
||||||
|
PlaneTransform plane_transform,
|
||||||
|
DrawPlane draw_plane)
|
||||||
|
{
|
||||||
|
return [proj, camera, layer_scale, plane_transform, draw_plane](
|
||||||
|
const LegacyCanvasDrawMergeCheckerboardUniforms& uniforms,
|
||||||
|
int plane_index) {
|
||||||
|
auto checkerboard_uniforms = uniforms;
|
||||||
|
checkerboard_uniforms.mvp = proj * camera *
|
||||||
|
glm::scale(glm::vec3(layer_scale)) *
|
||||||
|
plane_transform[plane_index] *
|
||||||
|
glm::translate(glm::vec3(0, 0, -1.f));
|
||||||
|
|
||||||
|
setup_legacy_canvas_draw_merge_checkerboard_shader(checkerboard_uniforms);
|
||||||
|
draw_plane();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
inline void execute_legacy_canvas_draw_merge_display_resolve(
|
inline void execute_legacy_canvas_draw_merge_display_resolve(
|
||||||
const LegacyCanvasDrawMergeDisplayResolveUniforms& uniforms,
|
const LegacyCanvasDrawMergeDisplayResolveUniforms& uniforms,
|
||||||
const LegacyCanvasDrawMergeDisplayResolveExecution& execution)
|
const LegacyCanvasDrawMergeDisplayResolveExecution& execution)
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ void LogRemote::start()
|
|||||||
return; // already running
|
return; // already running
|
||||||
|
|
||||||
m_running = true;
|
m_running = true;
|
||||||
m_thread = std::thread([&] {
|
m_thread = std::jthread([this](std::stop_token stop_token) {
|
||||||
BT_SetTerminate();
|
BT_SetTerminate();
|
||||||
net_init();
|
net_init();
|
||||||
auto session_string = net_request("/start");
|
auto session_string = net_request("/start");
|
||||||
m_session = atoi(session_string.c_str());
|
m_session = atoi(session_string.c_str());
|
||||||
while (m_running && !m_error)
|
while (m_running && !m_error && !stop_token.stop_requested())
|
||||||
{
|
{
|
||||||
auto m = m_mq.Get();
|
auto m = m_mq.Get();
|
||||||
auto escaped = curl_easy_escape(curl, m.c_str(), (int)m.size());
|
auto escaped = curl_easy_escape(curl, m.c_str(), (int)m.size());
|
||||||
@@ -35,6 +35,7 @@ void LogRemote::start()
|
|||||||
void LogRemote::stop()
|
void LogRemote::stop()
|
||||||
{
|
{
|
||||||
m_running = false;
|
m_running = false;
|
||||||
|
m_thread.request_stop();
|
||||||
m_mq.UnlockGetters();
|
m_mq.UnlockGetters();
|
||||||
if (m_thread.joinable())
|
if (m_thread.joinable())
|
||||||
m_thread.join();
|
m_thread.join();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
static LogRemote I;
|
static LogRemote I;
|
||||||
bool m_running = false;
|
bool m_running = false;
|
||||||
bool m_error = false;
|
bool m_error = false;
|
||||||
std::thread m_thread;
|
std::jthread m_thread;
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
BlockingQueue<std::string> m_mq;
|
BlockingQueue<std::string> m_mq;
|
||||||
// Store messages until the file is open
|
// Store messages until the file is open
|
||||||
|
|||||||
@@ -690,16 +690,14 @@ void NodeCanvas::draw()
|
|||||||
.enable_blend = [&] {
|
.enable_blend = [&] {
|
||||||
apply_node_canvas_capability(pp::renderer::gl::blend_state(), true);
|
apply_node_canvas_capability(pp::renderer::gl::blend_state(), true);
|
||||||
},
|
},
|
||||||
.draw_checkerboard_plane = [&](const pp::panopainter::LegacyCanvasDrawMergeCheckerboardUniforms& uniforms, int plane_index) {
|
.draw_checkerboard_plane = pp::panopainter::make_legacy_canvas_draw_merge_cache_to_screen_checkerboard_plane(
|
||||||
auto checkerboard_uniforms = uniforms;
|
proj,
|
||||||
checkerboard_uniforms.mvp = proj * camera *
|
camera,
|
||||||
glm::scale(glm::vec3(m_canvas->m_layers.size() + 500.f)) *
|
m_canvas->m_layers.size() + 500.f,
|
||||||
m_canvas->m_plane_transform[plane_index] *
|
m_canvas->m_plane_transform,
|
||||||
glm::translate(glm::vec3(0, 0, -1.f));
|
[&] {
|
||||||
|
m_face_plane.draw_fill();
|
||||||
pp::panopainter::setup_legacy_canvas_draw_merge_checkerboard_shader(checkerboard_uniforms);
|
}),
|
||||||
m_face_plane.draw_fill();
|
|
||||||
},
|
|
||||||
.bind_sampler = [&] {
|
.bind_sampler = [&] {
|
||||||
m_sampler.bind(0);
|
m_sampler.bind(0);
|
||||||
set_active_texture_unit(0);
|
set_active_texture_unit(0);
|
||||||
|
|||||||
@@ -183,6 +183,24 @@ void AppleDocumentPlatformServices::set_cursor_visible(bool visible) const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppleDocumentPlatformServices::trigger_crash_test() const
|
||||||
|
{
|
||||||
|
if (bridge_.trigger_crash_test)
|
||||||
|
bridge_.trigger_crash_test();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppleDocumentPlatformServices::request_app_close() const
|
||||||
|
{
|
||||||
|
if (bridge_.request_app_close)
|
||||||
|
bridge_.request_app_close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppleDocumentPlatformServices::start_sonarpen() const
|
||||||
|
{
|
||||||
|
if (bridge_.start_sonarpen)
|
||||||
|
bridge_.start_sonarpen();
|
||||||
|
}
|
||||||
|
|
||||||
void AppleDocumentPlatformServices::acquire_render_context() const
|
void AppleDocumentPlatformServices::acquire_render_context() const
|
||||||
{
|
{
|
||||||
if (bridge_.acquire_render_context)
|
if (bridge_.acquire_render_context)
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ struct AppleDocumentPickerBridge {
|
|||||||
std::function<void(std::string path)> display_file;
|
std::function<void(std::string path)> display_file;
|
||||||
std::function<void(std::string path)> share_file;
|
std::function<void(std::string path)> share_file;
|
||||||
std::function<void(bool visible)> set_cursor_visible;
|
std::function<void(bool visible)> set_cursor_visible;
|
||||||
|
std::function<void()> trigger_crash_test;
|
||||||
|
std::function<void()> request_app_close;
|
||||||
|
std::function<void()> start_sonarpen;
|
||||||
std::function<void()> acquire_render_context;
|
std::function<void()> acquire_render_context;
|
||||||
std::function<void()> release_render_context;
|
std::function<void()> release_render_context;
|
||||||
std::function<void()> present_render_context;
|
std::function<void()> present_render_context;
|
||||||
@@ -53,6 +56,9 @@ public:
|
|||||||
void display_file(std::string_view path) const;
|
void display_file(std::string_view path) const;
|
||||||
void share_file(std::string_view path) const;
|
void share_file(std::string_view path) const;
|
||||||
void set_cursor_visible(bool visible) const;
|
void set_cursor_visible(bool visible) const;
|
||||||
|
void trigger_crash_test() const;
|
||||||
|
void request_app_close() const;
|
||||||
|
void start_sonarpen() const;
|
||||||
void acquire_render_context() const;
|
void acquire_render_context() const;
|
||||||
void release_render_context() const;
|
void release_render_context() const;
|
||||||
void present_render_context() const;
|
void present_render_context() const;
|
||||||
|
|||||||
@@ -143,6 +143,12 @@ public:
|
|||||||
[ios_view hide_keyboard];
|
[ios_view hide_keyboard];
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
bridge.trigger_crash_test = [ios_view] {
|
||||||
|
[ios_view crash];
|
||||||
|
};
|
||||||
|
bridge.start_sonarpen = [ios_view] {
|
||||||
|
[App::I->ios_app sonarpen_start];
|
||||||
|
};
|
||||||
bridge.acquire_render_context = [ios_view] {
|
bridge.acquire_render_context = [ios_view] {
|
||||||
[ios_view async_lock];
|
[ios_view async_lock];
|
||||||
};
|
};
|
||||||
@@ -209,6 +215,14 @@ public:
|
|||||||
[osx_view share_file:[NSString stringWithUTF8String:path.c_str()]];
|
[osx_view share_file:[NSString stringWithUTF8String:path.c_str()]];
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
bridge.trigger_crash_test = [osx_view] {
|
||||||
|
[osx_view hockeyapp_crash];
|
||||||
|
};
|
||||||
|
bridge.request_app_close = [osx_view] {
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[osx_view close];
|
||||||
|
});
|
||||||
|
};
|
||||||
bridge.acquire_render_context = [osx_view] {
|
bridge.acquire_render_context = [osx_view] {
|
||||||
[osx_view async_lock];
|
[osx_view async_lock];
|
||||||
};
|
};
|
||||||
@@ -318,9 +332,9 @@ public:
|
|||||||
void trigger_crash_test() override
|
void trigger_crash_test() override
|
||||||
{
|
{
|
||||||
#ifdef __IOS__
|
#ifdef __IOS__
|
||||||
[App::I->ios_view crash];
|
active_apple_document_platform_services().trigger_crash_test();
|
||||||
#elif __OSX__
|
#elif __OSX__
|
||||||
[App::I->osx_view hockeyapp_crash];
|
active_apple_document_platform_services().trigger_crash_test();
|
||||||
#elif defined(__ANDROID__)
|
#elif defined(__ANDROID__)
|
||||||
int *x = nullptr; *x = 42;
|
int *x = nullptr; *x = 42;
|
||||||
LOG("%d", *x);
|
LOG("%d", *x);
|
||||||
@@ -663,7 +677,7 @@ public:
|
|||||||
void start_sonarpen() override
|
void start_sonarpen() override
|
||||||
{
|
{
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
[App::I->ios_app sonarpen_start];
|
active_apple_document_platform_services().start_sonarpen();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,9 +741,7 @@ public:
|
|||||||
void request_app_close() override
|
void request_app_close() override
|
||||||
{
|
{
|
||||||
#ifdef __OSX__
|
#ifdef __OSX__
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
active_apple_document_platform_services().request_app_close();
|
||||||
[App::I->osx_view close];
|
|
||||||
});
|
|
||||||
#elif __LINUX__
|
#elif __LINUX__
|
||||||
glfwSetWindowShouldClose(App::I->glfw_window, GLFW_TRUE);
|
glfwSetWindowShouldClose(App::I->glfw_window, GLFW_TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user