prometeu-runtime/discussion/workflow/plans/PLN-0088-define-read-only-render-resource-boundary.md
2026-06-05 09:34:51 +01:00

64 lines
2.3 KiB
Markdown

---
id: PLN-0088
ticket: vm-render-parallel-execution-boundary
title: Define Read-Only Render Resource Boundary
status: done
created: 2026-06-05
ref_decisions: [DEC-0031]
tags: [runtime, renderer, resources, cache, banks]
---
## Briefing
`DEC-0031` requires render packets to carry small owned data and stable resource IDs, while heavy banks/caches remain resident and read-only to render consumers.
## Objective
Define and enforce the read-only resource boundary needed before any worker can safely read scene/glyph/cache data.
## Dependencies
- Source decision: `DEC-0031`.
- `PLN-0087` should clarify the packet consumer path before this plan finalizes worker-facing APIs.
## Scope
- Identify every resource read during Game2D rendering.
- Classify data as packet-owned, resident read-only, or logical-core mutable preparation state.
- Add trait/API boundaries for render read access where missing.
- Document which types must be `Send + Sync` for a real threaded worker.
## Non-Goals
- Do not make resource swaps transactional.
- Do not capture `Arc<GlyphBank>` or `Arc<SceneBank>` inside every submission.
- Do not implement background asset loading policy.
## Execution Method
1. Trace Game2D render reads from packet to glyph bank, scene bank, viewport cache, and framebuffer helpers.
2. Create a short internal module-level contract for render resource access.
3. Add or refine read-only access traits for banks/cache without exposing mutable runtime state.
4. Add compile-time assertions or targeted tests for `Send + Sync` where a threaded worker will require them.
5. Keep resource identity in submissions as IDs/handles, not heavy ownership captures.
## Acceptance Criteria
- Render consumer APIs can be described as packet-owned plus read-only resource access.
- No worker-facing API requires `&mut Hardware`, `&mut Gfx`, live `FrameComposer`, or mutable VM state.
- Shared read APIs that cross thread boundaries have explicit `Send + Sync` expectations.
- Existing synchronous renderer behavior remains unchanged.
## Tests
- Compile-time trait assertions for read-only resource APIs where practical.
- Unit tests for read-only bank/cache access.
- Existing asset/scene rendering tests continue to pass.
## Affected Artifacts
- `crates/console/prometeu-hal`
- `crates/console/prometeu-system`
- `crates/console/prometeu-drivers`
- Relevant renderer/resource tests.