Trim Win32 lifecycle retained state

This commit is contained in:
2026-06-17 12:11:13 +02:00
parent 4a5b55f58a
commit e1767bdb00
5 changed files with 11 additions and 8 deletions

View File

@@ -92,6 +92,11 @@ Latest slice:
entrypoint header that picks up the retained binding surface from entrypoint header that picks up the retained binding surface from
`windows_runtime_state.h` instead of declaring a second shell-owned binding `windows_runtime_state.h` instead of declaring a second shell-owned binding
API. API.
- `src/platform_windows/windows_lifecycle_shell.cpp` now formats the FPS title
with a stack buffer at the callsite instead of routing through a retained
lifecycle-global scratch array.
- `src/platform_windows/windows_lifecycle_state.*` is down to the retained
Win32 running flag only; the redundant global FPS-title buffer is gone.
- `src/platform_windows/windows_runtime_session.*` now owns the bound-session - `src/platform_windows/windows_runtime_session.*` now owns the bound-session
Win32 runtime loop/startup/shutdown body that had still been sitting inside Win32 runtime loop/startup/shutdown body that had still been sitting inside
`windows_runtime_flow.cpp`. `windows_runtime_flow.cpp`.

View File

@@ -98,6 +98,11 @@ Current slice:
- `src/platform_windows/windows_runtime_shell.h` is thinner again and now - `src/platform_windows/windows_runtime_shell.h` is thinner again and now
imports that binding surface from `windows_runtime_state.h` instead of imports that binding surface from `windows_runtime_state.h` instead of
declaring shell-owned bind/release accessors itself. declaring shell-owned bind/release accessors itself.
- `src/platform_windows/windows_lifecycle_shell.cpp` now formats the FPS title
with a stack buffer at the callsite instead of keeping a retained
lifecycle-global scratch array.
- `src/platform_windows/windows_lifecycle_state.*` is now down to the Win32
running flag only; the redundant global FPS-title buffer is gone.
- `src/platform_windows/windows_runtime_session.*` now owns the bound-session - `src/platform_windows/windows_runtime_session.*` now owns the bound-session
Win32 runtime loop/startup/shutdown body. Win32 runtime loop/startup/shutdown body.
- `src/platform_windows/windows_runtime_flow.cpp` is now only a thin handoff - `src/platform_windows/windows_runtime_flow.cpp` is now only a thin handoff

View File

@@ -40,7 +40,7 @@ void update_stylus_frame(float dt)
void update_window_fps(HWND hWnd, const wchar_t* window_title, VrShellState& vr, int frames) void update_window_fps(HWND hWnd, const wchar_t* window_title, VrShellState& vr, int frames)
{ {
auto* title_fps = retained_window_fps_title_buffer(); wchar_t title_fps[512]{};
const int vr_fps = current_vr_fps(vr); const int vr_fps = current_vr_fps(vr);
if (read_vr_session_snapshot(vr).vr_active) if (read_vr_session_snapshot(vr).vr_active)
swprintf_s(title_fps, 512, L"%s - %d fps - %d vr fps", window_title, frames, vr_fps); swprintf_s(title_fps, 512, L"%s - %d fps - %d vr fps", window_title, frames, vr_fps);

View File

@@ -7,7 +7,6 @@ namespace {
struct RetainedWindowLifecycleState final { struct RetainedWindowLifecycleState final {
std::atomic<int> running{-1}; std::atomic<int> running{-1};
wchar_t title_fps[512]{};
}; };
[[nodiscard]] RetainedWindowLifecycleState& retained_window_lifecycle_state() noexcept [[nodiscard]] RetainedWindowLifecycleState& retained_window_lifecycle_state() noexcept
@@ -38,9 +37,4 @@ std::atomic<int>& retained_lifecycle_running_state() noexcept
return retained_window_lifecycle_state().running; return retained_window_lifecycle_state().running;
} }
wchar_t* retained_window_fps_title_buffer() noexcept
{
return retained_window_lifecycle_state().title_fps;
}
} }

View File

@@ -10,6 +10,5 @@ void mark_lifecycle_running() noexcept;
void mark_lifecycle_stopped() noexcept; void mark_lifecycle_stopped() noexcept;
[[nodiscard]] bool lifecycle_is_running() noexcept; [[nodiscard]] bool lifecycle_is_running() noexcept;
[[nodiscard]] std::atomic<int>& retained_lifecycle_running_state() noexcept; [[nodiscard]] std::atomic<int>& retained_lifecycle_running_state() noexcept;
[[nodiscard]] wchar_t* retained_window_fps_title_buffer() noexcept;
} }