Implement M9.2 native client lifecycle and immutable render boundary

This commit is contained in:
dingo
2026-10-01 16:58:46 -04:00
parent d487d86ea3
commit 04c7715646
24 changed files with 827 additions and 34 deletions
+47
View File
@@ -0,0 +1,47 @@
# Native client boundary (M9.2)
Implemented scope: desktop lifecycle and primitive presentation, not gameplay.
ADR-0077 selects SDL; ADR-0078 defines its ownership and view boundary.
```mermaid
flowchart LR
App[evo-client main thread] --> Platform[Application / private SDL adapter]
App --> Frame[Owned immutable render Frame]
Platform --> Render[Private SDL renderer]
Frame --> Render
Future[Later M9.4 view projection] -. copied presentation values .-> Frame
```
`include/evo/client/application.hpp` and `include/evo/render/frame.hpp` contain
no SDL, world-store, network or database types. The application owns one SDL
runtime, window and renderer on the process main thread; concurrent application
instances are rejected. Destruction releases renderer, window, then SDL. Partial
initialization releases everything acquired. No application object may outlive
main or be used/destroyed on another thread.
`Frame::create` validates and copies at most 4096 rectangles. Its const span is
valid until frame destruction/assignment. `Application::step(const Frame&)`
borrows it for the call only; there is no queue, stored pointer or simulation
mutation. Coordinates are logical window units, top-left origin, +Y down. They
are presentation units, never world millimetres. M9.3 owns world-screen mapping;
M9.4 projects environment samples. In particular, do not retain M6 validation
tokens/store pointers in a renderer or serialize them as a client protocol.
Window state records logical size, drawable pixel size and display content scale
separately. Resizes/display changes query SDL rather than trust event payloads.
Drawing scales independently by pixel/logical width and height; content scale is
for future UI sizing, not a second pixel multiplier. Hidden/minimized/zero-area
windows skip rendering. Focus loss disables the future input admission flag;
there are no held gameplay inputs in M9.2. Close is terminal.
Each step consumes at most 256 events, filters window-specific events and renders
one frame. Target reset needs only redraw (no cached textures). Device reset
recreates the renderer from CPU frame data. Device loss, recreation/query/draw
failure latch an error until destruction; no silent backend substitution or busy
recovery loop. Typed errors reach the process boundary. The host paces frames
outside the renderer and catches allocation/standard-library exceptions.
Failure tests inject actual SDL events, including foreign window IDs, with no
test-only production hooks. Real device failures and physical DPI/input require
manual hardware qualification at M9.8. The native client is opt-in and never
enters a server container. Headless configuration does not prepare/load SDL.
+4
View File
@@ -43,6 +43,10 @@ headers expose values and bounded commands, not third-party ECS/storage types.
No Steam ID, socket, Kubernetes API, logger clock or storage handle belongs in
the simulation state. Durable account references live in orchestration mapping.
M9.2 implements the opt-in [native client boundary](CLIENT_ARCHITECTURE.md):
copied immutable presentation frames and one main-thread platform owner. It does
not yet project biological views or connect to a region server.
| Boundary | Owns | Must not own |
|---|---|---|
| core | Value types, deterministic algorithms, explicit version constants | Global state, threads, I/O |