Conversation
Add ADR 0003 and the ABI v1 §File input contract. File input moves from the App v2 capabilities.fileInput manifest block to a runtime host_file_register call on the mediated-input lifecycle, with inline (8 MiB) and relaunch (128 MiB) delivery and host_file_info for the selected file's name, MIME type and size. The manifest keeps only an advisory top-level fileTypes hint. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Implement ABI v1 §File input on the mediated-input lifecycle. host_file_register validates the JSON descriptor (4 KiB, strict fields, integer maxBytes, id/label/extension/MIME/mount-path rules), shares the handle space and the eight-registration quota with host_input_register, and reports -2/-4 from the deliveries the Host declares. host_file_info describes a ready file. Hosts see registrations with file_registrations, receive guest-triggered picker requests as MediatedInputCommand::FileRequest, and deliver a selection with send_file_input, which rejects empty or over-bound files with status 6. A relaunch delivery stops the execution and returns a FileRelaunch that set_file_relaunch mounts over the asset of a fresh execution, where the re-registered handler reports status 3. host_input_cancel discards a ready result and every successful cancel leaves the registration idle. AppDescriptor parses the advisory fileTypes hint, and the wasm bridge exposes the same calls to the browser core. The file-input fixture is assembled from source in tests/file_input.rs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The translated backend parses descriptors with the native strictness and both backends exchange the same Host messages: file-registrations, file-input-request, file-input, and file-input-delivery, with the fileInput and fileRelaunch start options. A Host still receives the registrations of an execution that fails before it becomes ready. Shared descriptor vectors and the file-input fixture run against both backends. Browser assets are regenerated from the build. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The PolkaVM 0.37 interpreter (c160c13) grew its stack buffer to a power-of-two capacity and treated the whole capacity as resident guest stack. For a non-power-of-two declared stack (e.g. 384 KiB grown to 512 KiB) this exposed the lower guard page and corrupted Host reads of stack-backed guest memory. Vendor the pinned engine crate under rust/vendor/polkavm with residency bounded to the declared stack size, record upstream provenance and licenses, and ship the PolkaVM license texts with the browser package.
File input: a selected file can be delivered as a stream that guests read in bounded ranges (host_file_read) and cache privately (host_file_cache_*), in both the native and browser backends, so large inputs need not be copied into guest memory or packaged as assets. GPU wire, additive within application runtime ABI 1 and gated by RasterFeatures bit 1 (GPU_RASTER_FEATURE_STENCIL_DEPTH_BIAS): texture format Depth24PlusStencil8, render-pass stencil load/store/clear, a pipeline trailer with stencil state and depth bias, and opcode 30 SetStencilReference. Unknown pass and pipeline flag bits are now rejected because payload length depends on them. Implemented in the native renderer and the browser GPU worker, with wire, native and browser tests and the ABI document updated.
Rebuild the browser runtime (npm run build) with the vendored PolkaVM, file streaming, and stencil/depth-bias support, and record the new asset digests.
… input Resolve the merge of main's pause/background/random runtime work (#57) with runtime file handlers, streamed file input, stencil/depth-bias GPU wire and the vendored PolkaVM interpreter stack-residency fix. - Cargo.toml: keep the vendored PolkaVM path dependency; take main's 0.3.1 sibling crate versions. - lib.rs: keep both test sets (resident stack growth and native pause). - runtime-core.js: keep both state sets (file streams/caches and pause/background/held inputs); main's inactive frame/audio guards precede the file-input-request tracking in postRuntimeOutput; start sets both fileCacheEnabled and starting; start and pause/background failures use the asynchronous terminate() so cache cleanup completes before "terminated", while a disposed endpoint stays silent; the disposed-start teardown tracks translated cleanup. - wasm-translated.js: initialize() marks initialization and takes main's u64 gas budget. - Docs: file pickers count as mediated-input prompts that inactive Hosts cancel; file status changes while paused or backgrounded wait for the next executed update. - Tests: the malformed-background test awaits the asynchronous termination; add a regression that a file delivered while paused waits for resume in both backends. - Regenerate browser assets (npm run build), SHA256SUMS and embedded digests.
Blend factors 12 (constant) and 13 (one minus constant) were accepted but had no way to set the constant. SetBlendConstant carries four finite f32 values (RGBA, 16 bytes), is valid only inside a render pass, and applies to later draws in that pass. Every pass starts with constant 0,0,0,0. - gpu-wire: opcode 31 with an exact 16-byte payload and GPU_RASTER_FEATURE_BLEND_CONSTANT = 4. - native: records the constant in pass order and calls set_blend_constant. Every pass now starts with an explicit zero constant, because wgpu otherwise rejects constant-factor draws with a validation panic. - browser: parses, validates (in pass, finite), and calls setBlendConstant. - Both hosts advertise RasterFeatures 7. - ABI doc, wire and browser tests, and regenerated browser assets.
BeginRenderPass flag 128 declares a pass's query count and a guest token (at most 4,096 per batch). BeginOcclusionQuery (32) and EndOcclusionQuery (33) follow WebGPU's nesting rules on both Hosts. After the batch completes, each declaring pass is resolved and read back asynchronously and delivered as GPU event 9 (token, count, u64 sample counts) in submission order. Native Hosts receive outstanding results from NativeGpuRenderer::poll_events. Implemented in the wire crate, the native renderer and the browser GPU worker, with tests, the ABI document and rebuilt browser assets.
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.
Draft: runtime support needed to run the Halo CE engine (polkavm-app-kit
apps/halo) on any Host. Everything is additive within application runtime ABI 1.Changes
Runtime file handlers and streamed file input (ADR 0003;
docs/runtime/polkavm-app-abi-v1.md)host_file_read) and keep a private per-selection cache (host_file_cache_*).Stencil and depth bias, gated by
RasterFeaturesbit 1 (GPU_RASTER_FEATURE_STENCIL_DEPTH_BIAS)Depth24PlusStencil8).SetStencilReference.Blend constant, gated by
RasterFeaturesbit 2 (value 4)SetBlendConstant: 16 bytes, RGBAf32little-endian, every value finite. Valid only inside a render pass; it applies to the draws recorded after it.Occlusion queries, gated by
RasterFeaturesbit 3 (value 8)BeginRenderPassflag 128 declares a pass's query count and a guest token. Passes in one batch declare at most 4,096 queries in total.BeginOcclusionQuery(32) andEndOcclusionQuery(33) follow WebGPU's nesting rules on both Hosts.u64sample counts), in submission order.NativeGpuRenderer::poll_events.RasterFeatures15.Interpreter stack-residency fix
c160c13) treated a grown stack buffer's whole power-of-two capacity as resident guest stack. For a non-power-of-two declared stack, that exposed the lower guard page and corrupted Host reads of stack-backed memory.rust/vendor/polkavmwith residency bounded to the declared size, and with its provenance and licences recorded. Upstream PolkaVM is unchanged.Merge of
main(#57, mediated input runtime API)Verification
cargo +nightly fmt --check, clippy with-D warnings, andcargo test --workspace --all-features: 193 passed.npm test: 216 passed. Browser assets were regenerated, andverify-browser-assetspasses.Notes for reviewers