feat(graphics): migrate native target to 640x360
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good

Centralize the fixed 640x360 RGBA8888/60 Hz contract in the existing HAL.
Preserve 8/16/32 tiles and composition, cover partial edges and mixed-size
camera movement, and adapt firmware, fixtures, hosts and native tests.

Share nearest-neighbor presentation geometry with pointer input. Measure
actual framebuffer publications and successful host presentations separately
from VM ticks, with bounded opt-in diagnostics and release harnesses.

Validated with the complete tooling verify gate, native rendering tests,
GPU readback, headless/process integration, formatting and strict clippy.
The existing synchronous session path is documented; no worker/session
architecture replacement or format compatibility layer is introduced.

Work: WRK-0016 / DEC-0001 / PLN-0001
Commit and push explicitly authorized by the user after completion.
This commit is contained in:
2026-11-20 10:34:45 +00:00
parent f1adf86dd5
commit a32f834b2b
36 changed files with 1345 additions and 165 deletions
+28 -5
View File
@@ -51,10 +51,26 @@ The current 2D graphics model is based on:
### Base resolution
- **480 × 270 pixels**
- aspect ratio close to 16:9
- **640 × 360 pixels**
- aspect ratio exactly 16:9
- scalable by the host (nearest-neighbor)
This is the machine's only native target, at **60 Hz**. The authoritative Rust
definitions live in `prometeu_hal::graphics_contract` in the existing HAL crate.
Hosts MUST NOT choose a VM resolution from their physical display dimensions.
No 480×270 compatibility mode, runtime resolution switch or legacy-content
adapter is provided.
A packed native surface contains **230,400 pixels**, **921,600 bytes** and a
stride of **640 pixels / 2,560 bytes**. Stride units remain explicit in each
interface: `OwnedRgba8888Frame::stride_pixels` is measured in pixels.
At 1280×720 the host presents at integer 2×. Otherwise it uses the largest
integer scale that fits, centered with bars, or proportional reduction if the
surface cannot fit 1×. Reduction also uses nearest-neighbor. The aspect ratio
MUST remain 16:9. Physical surface coordinates, including HiDPI and resize,
determine the presentation rectangle and its inverse input transform.
### Pixel format
- **RGBA8888**
@@ -368,9 +384,16 @@ The cache is a window of tiles around the camera.
Example:
- Screen: 480×270
- 16×16 tiles → approximately 30×17 visible
- Current runtime cache sizing with 16×16 layers: 35×21 tiles
- Screen: 640×360
- 16×16 tiles → approximately 40×23 visible (the last tile row has 8 visible pixels)
- Current runtime cache sizing with 16×16 layers: 45×27 tiles
The final 16×16 tile row has eight visible pixels. With 32×32 tiles the aligned
viewport is 20 columns and 11 complete rows plus eight pixels. With 8×8 tiles it
is 80×45. Camera offsets may expose partial tiles at any edge. Mixed-size layers
remain supported; the resolver's movement threshold must not oscillate between
adjacent anchors when a layer tile is larger than the scene's minimum tile.
Native height is always 360, never rounded to 352 or 368.
It stores tiles already resolved from the tilemap.