80 lines
3.1 KiB
Markdown
80 lines
3.1 KiB
Markdown
---
|
|
id: PLN-0111
|
|
ticket: real-render-worker-establishment
|
|
title: Define Read-Only Render Resource Access
|
|
status: done
|
|
created: 2026-06-15
|
|
completed:
|
|
ref_decisions: [DEC-0033]
|
|
tags: [runtime, renderer, worker, hal, resources]
|
|
---
|
|
|
|
## Briefing
|
|
|
|
`DEC-0033` requires the worker backend to resolve render resources by stable ids through compact read-only access, without copying banks, snapshotting banks, requiring `Arc` in the public contract, or accessing mutable `Hardware`/`Gfx`/`FrameComposer`.
|
|
|
|
## Decisions de Origem
|
|
|
|
- `DEC-0033`: Real Render Worker Contract.
|
|
|
|
## Alvo
|
|
|
|
Define shared read-only render resource traits in HAL and implement them over existing local bank storage without changing bank ownership semantics.
|
|
|
|
## Escopo
|
|
|
|
- Define compact HAL traits for read-only glyph and scene bank access by id.
|
|
- Keep the public contract id-based and read-only.
|
|
- Implement the traits in the local driver/resource owner currently used by rendering.
|
|
- Add tests proving banks are read through the new interface.
|
|
|
|
## Fora de Escopo
|
|
|
|
- No worker thread.
|
|
- No bank copying or snapshotting.
|
|
- No public `Arc` requirement.
|
|
- No asset residency policy changes.
|
|
|
|
## Plano de Execucao
|
|
|
|
### Step 1 - Define HAL read-only traits
|
|
|
|
**What:** Add worker-facing resource access contracts.
|
|
**How:** Define traits for resolving glyph and scene banks by stable ids. Return borrowed read-only references or compact read-only views, not mutable handles.
|
|
**File(s):** `crates/console/prometeu-hal/src/*`, likely a new render resource module.
|
|
|
|
### Step 2 - Implement local resource access
|
|
|
|
**What:** Expose current local bank storage through the new traits.
|
|
**How:** Implement the read-only traits for the existing memory bank/resource owner used by `prometeu-drivers`.
|
|
**File(s):** `crates/console/prometeu-drivers/src/memory_banks.rs`, `frame_composer.rs`, or adjacent resource modules.
|
|
|
|
### Step 3 - Thread access through backend-facing APIs
|
|
|
|
**What:** Make future backends able to receive resource access without `Hardware`.
|
|
**How:** Add narrow parameters/types where needed so a backend can be given read-only resources independently from the full platform.
|
|
**File(s):** HAL contracts and driver modules touched above.
|
|
|
|
### Step 4 - Add resource access tests
|
|
|
|
**What:** Prove id lookup and read-only behavior.
|
|
**How:** Add tests for resident/missing glyph and scene banks through the new traits and verify no mutable API is exposed.
|
|
**File(s):** HAL/driver tests.
|
|
|
|
## Criterios de Aceite
|
|
|
|
- [ ] Worker-facing render resource access is defined in `prometeu-hal`.
|
|
- [ ] Resource access is by stable id and read-only.
|
|
- [ ] The public contract does not require `Arc`, bank copies, bank snapshots, `Hardware`, `Gfx`, or `FrameComposer`.
|
|
- [ ] Local driver storage implements the traits.
|
|
|
|
## Tests / Validacao
|
|
|
|
- `cargo test -p prometeu-hal -p prometeu-drivers`
|
|
- `rg "Arc<.*RenderResource|snapshot.*bank|&mut Hardware|&mut Gfx|FrameComposer" crates/console/prometeu-hal crates/console/prometeu-drivers -n`
|
|
|
|
## Riscos
|
|
|
|
- Returning concrete bank internals may overexpose driver implementation.
|
|
- Accidentally requiring `Arc` in the trait would make a storage strategy part of the public contract.
|