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.
+12 -3
View File
@@ -20,17 +20,26 @@ Core contract:
## 2 Coordinate Space
- TOUCH coordinates use **the same space as the framebuffer**
- Resolution: **480×270**
- Resolution: **640×360**
- Origin: top-left corner `(0,0)`
- Ranges:
- `x ∈ [0, 479]`
- `y ∈ [0, 269]`
- `x ∈ [0, 639]`
- `y ∈ [0, 359]`
TOUCH is **absolute**:
- `(x, y)` represents the current contact position after normalization;
- the runtime does not apply dynamic transformation to that coordinate pair.
The host MUST apply the inverse of the actual presentation rectangle and scale,
including bars, proportional reduction, resize and HiDPI. A press outside that
rectangle MUST NOT capture a pointer. An active pointer leaving the image MUST
release, with `released` exposed for one logical frame under the existing button
contract. Returning while the physical button remains held MUST NOT recapture;
a new press inside is required. Releasing or losing focus must neutralize the
active pointer. Coordinates while `down == false` retain their existing invalid
status; no new guest-visible sentinel is introduced.
## 3 TOUCH Peripheral API
### 3.1 Exposed Structure