feat(offload): stream images and retained geometry on 3DS and PSP - #377
Draft
doodlewind wants to merge 20 commits into
Draft
feat(offload): stream images and retained geometry on 3DS and PSP#377doodlewind wants to merge 20 commits into
doodlewind wants to merge 20 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Behavior
Tiled PocketJS apps can hand image decoding and vector preparation to a desktop while retaining local camera movement and GPU rendering. Binary pixels and geometry stay outside guest JavaScript. The same resource collections support 3DS over paired LAN and PSP over PSPLINK USB; Pocket Map demonstrates both with OSM vectors and a local Hyrule raster atlas.
Resource and rendering contracts
createOffloadImageCollection/createOffloadMeshCollectionown upload, cost admission, raw-response release and resident disposal.ResourceImage/ResourceMeshborrow native handles and expose component fallbacks. Merged view demand, retry, invalidation and eviction apply to both.Ui.take_texture()invalidates a texture handle while transferring storage to a backend for the same delayed-release rule.PSP USB execution
connectOffloadUsbProvider()mounts an app-specific directory below the root served byusbhostfs_pc. It runs the same isolated capability worker module as the LAN provider.A lower-priority native thread performs all host0 file operations. The UI only exchanges preallocated slots: at most one submit, completion and binary upload per frame. The worker allocates no QuickJS, UI or Rust heap objects. Each slot has a 4 KiB request, 64-byte header and 128 KiB response buffer, with release/acquire ownership transitions. Mac epoch, PSP boot nonce, sequence and checksum fence incomplete or obsolete replies. Physical USB access replaces LAN pairing for this adapter.
Eight capability calls bound Mac work. A 12-second execution timeout terminates the subprocess and only releases credit after exit. The UI expires stale contact after three seconds even while the worker is blocked in a USB call, retaining materialized content for cached navigation. Pocket YouTube provided the host0 reference; maps need independent tile identities and completion ownership instead of replacing whole video frames.
PSP offload builds also calibrate a stable analog center in a bounded startup window and support SELECT recentering. This fixes the test PSP's untouched raw
(162,133)nub without changing ordinary PSP demo input. The old synchronous DevTools file probe is disabled for these builds.Continuous input and app boundaries
inputDeltaSeconds()exposes bounded host sampling time as recorded frame data. Both 3DS and PSP supply the seventh frame argument; tape v4 preserves it, and older tapes retain nominal timing. A 66.666 ms cap bounds resume movement without changing virtual timers, core ticks or resource budgets.Tile world bounds and source/display LOD stay explicit.
createTileIntentpreserves direction across gesture lifts andplanTileWindowsupports a bounded forward corridor. The application decides loading importance, prediction and provider policy. PBF parsing, styling, simplification, tessellation and label selection remain in Pocket Map's Mac worker; no map parser or app state enters the framework.Validation
usbhostfs_pcblocked transport for over five seconds while the UI thread continued running; cached rendering and communication recovered. These are scripted hardware receipts, not physical-button acceptance.Limits and related app
The PSP adapter targets an app-specific embedded executable under PSPLINK; it does not bootstrap the USB driver from XMB, route multiple apps or add video playback. Offloading prevents host0 waits from blocking UI; it does not eliminate JavaScript, mounting, GC or GPU cost. There is no continuous 60 fps claim during loading, no device MVT parser, Media Engine work, or SDF text shader.
PSP ownership and transport documentation. Application implementation, hardware screenshots and installation evidence: pocket-map#1.
Keep this PR Draft and unmerged, as requested.