Move Win32 VR state behind platform services

This commit is contained in:
2026-06-17 11:30:27 +02:00
parent 68b8d8c45f
commit ba94785eda
6 changed files with 13 additions and 14 deletions

View File

@@ -70,6 +70,10 @@ What is already real:
- `pp_app_core` - `pp_app_core`
Latest slice: Latest slice:
- `src/platform_windows/windows_platform_services.cpp` now owns the retained
Win32 VR shell state directly behind `platform_vr_state()`.
- `src/platform_windows/windows_window_shell.cpp` no longer exposes or owns a
separate `retained_vr_shell_state()` pocket.
- `src/platform_windows/windows_lifecycle_state.*` now owns the retained - `src/platform_windows/windows_lifecycle_state.*` now owns the retained
Win32 lifecycle running flag and FPS-title scratch buffer instead of leaving Win32 lifecycle running flag and FPS-title scratch buffer instead of leaving
them inside `windows_lifecycle_shell.cpp`. them inside `windows_lifecycle_shell.cpp`.

View File

@@ -78,6 +78,10 @@ Completed, blocked, and superseded task history moved to
the queue is now ordered by code movement instead. the queue is now ordered by code movement instead.
Current slice: Current slice:
- `src/platform_windows/windows_platform_services.cpp` now owns the retained
Win32 VR shell state directly behind `platform_vr_state()`.
- `src/platform_windows/windows_window_shell.cpp` no longer keeps a separate
retained VR shell-state accessor.
- `src/platform_windows/windows_lifecycle_state.*` now owns the retained - `src/platform_windows/windows_lifecycle_state.*` now owns the retained
Win32 lifecycle running flag and FPS-title scratch buffer. Win32 lifecycle running flag and FPS-title scratch buffer.
- `src/platform_windows/windows_lifecycle_shell.cpp` no longer carries that - `src/platform_windows/windows_lifecycle_shell.cpp` no longer carries that

View File

@@ -20,10 +20,6 @@
#include <deque> #include <deque>
#include <map> #include <map>
namespace pp::platform::windows {
[[nodiscard]] VrShellState& platform_vr_state() noexcept;
}
void destroy_window(); void destroy_window();
void async_lock(); void async_lock();
void async_unlock(); void async_unlock();
@@ -134,7 +130,8 @@ void initialize_retained_input_state()
VrShellState& platform_vr_state() noexcept VrShellState& platform_vr_state() noexcept
{ {
return retained_vr_shell_state(); static VrShellState state;
return state;
} }
} }

View File

@@ -5,10 +5,12 @@
#include <future> #include <future>
struct VrSessionSnapshot; struct VrSessionSnapshot;
struct VrShellState;
namespace pp::platform::windows { namespace pp::platform::windows {
[[nodiscard]] PlatformServices& platform_services(); [[nodiscard]] PlatformServices& platform_services();
[[nodiscard]] VrShellState& platform_vr_state() noexcept;
[[nodiscard]] VrSessionSnapshot read_platform_vr_session_snapshot() noexcept; [[nodiscard]] VrSessionSnapshot read_platform_vr_session_snapshot() noexcept;
void enqueue_main_thread_task(std::packaged_task<void()> task); void enqueue_main_thread_task(std::packaged_task<void()> task);
void drain_main_thread_tasks(); void drain_main_thread_tasks();

View File

@@ -60,12 +60,6 @@ void synchronize_app_key_state_from_keyboard(App& app)
} }
pp::platform::windows::VrShellState& pp::platform::windows::retained_vr_shell_state() noexcept
{
static pp::platform::windows::VrShellState state;
return state;
}
LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
{ {
auto* app = bound_app(); auto* app = bound_app();
@@ -75,7 +69,7 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
switch (msg) switch (msg)
{ {
case kUserCloseMessage: case kUserCloseMessage:
handle_window_close_message(retained_vr_shell_state()); handle_window_close_message(pp::platform::windows::platform_vr_state());
return 0; return 0;
case WM_PAINT: case WM_PAINT:
app->redraw = true; app->redraw = true;

View File

@@ -3,12 +3,10 @@
#include <Windows.h> #include <Windows.h>
#include "event.h" #include "event.h"
#include "platform_windows/windows_vr_shell.h"
namespace pp::platform::windows { namespace pp::platform::windows {
void initialize_retained_input_state(); void initialize_retained_input_state();
pp::platform::windows::VrShellState& retained_vr_shell_state() noexcept;
LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp); LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
} }