O4: positron-wgpu — GPU renderer (outlier B, closes the outlier pair)#8
Merged
Conversation
positron-wgpu is a `Renderer` whose `type Output` is a GPU `Frame` — colored quads destined for a vertex buffer, not any CPU text tree. That is the point: `counter-cli`'s `String` and `positron-ratatui`'s `Paragraph` are both CPU text (a weak outlier pair); GPU geometry is maximally different. With `Renderer<S>` fitting a `String`, terminal cells, AND GPU quads without forcing, the contract provably carries no hidden DOM/text assumption — the middle (mobile, DOM) is guaranteed. This is the "web ≠ DOM" claim made real: one Rust wgpu renderer for native (Metal/Vulkan/DX12) + web (WebGPU/WASM). Splits along the same seam as outlier A: - frame.rs — pure data (Frame/Primitive/Rect/Rgba/RgbaFrame), no wgpu. The render(state) -> Frame projection is unit-tested headlessly. RgbaFrame is deliberately continuum's avatar-frame shape for the O5 reconcile. - gpu.rs — the only file touching wgpu. Gpu::rasterize renders a Frame offscreen (wgpu 22, Rgba8Unorm target, padded copy_texture_to_buffer readback). Missing GPU is a loud GpuError::NoAdapter, never a software fallback. - lib.rs — render_to_rgba: project a ViewState through a Renderer and rasterize in one call (GPU twin of positron_ratatui::render_to_buffer). The hardware path can't be a #[test] (CI runners have no adapter); it's proven by examples/counter_gpu.rs, which rasterizes the same Counter the tests project and writes PNGs. Verified on Metal: 3→three green quads, -4→four red. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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.
What
positron-wgpu— the GPU referenceRendererfor positron, outlier B in the contract's outlier-validation.A
Rendererhere hastype Output = Frame: GPU-bound geometry (colored quads for a vertex buffer), not a CPU text tree.counter-cli'sStringandpositron-ratatui'sParagraphare both CPU text (a weak outlier pair). GPU quads are maximally different. WithRenderer<S>fitting aString, terminal cells, and GPU geometry without forcing, the contract provably carries no hidden DOM/text assumption — so the middle (mobile, DOM) is guaranteed. That is "web ≠ DOM" made real: one Rust wgpu renderer runs native (Metal/Vulkan/DX12) + web (WebGPU/WASM) from one source.Shape (same seam as outlier A)
frame.rs— pure data (Frame/Primitive/Rect/Rgba/RgbaFrame), no wgpu. Therender(state) -> Frameprojection is unit-tested headlessly.RgbaFrameis deliberately continuum's avatar-frame shape (width/height/tight RGBA8) for the O5 reconcile.gpu.rs— the only file touching wgpu.Gpu::rasterizerenders aFrameoffscreen (wgpu 22,Rgba8Unorm, paddedcopy_texture_to_bufferreadback). Missing GPU → loudGpuError::NoAdapter, never a software fallback (force_fallback_adapter: false).lib.rs—render_to_rgba: project aViewStatethrough aRendererand rasterize in one call (GPU twin ofpositron_ratatui::render_to_buffer).Why the GPU path is an example, not a
#[test]CI runners have no GPU adapter. The pure projection is the always-on unit-tested contract proof; the hardware path is proven by
examples/counter_gpu.rs, which rasterizes the sameCounterthe tests project and writes PNGs. This honors fail-loud — no silent software fallback.Verification
cargo fmt --checkclean,cargo clippy --workspace --all-targets -- -D warningsclean.cargo run -p positron-wgpu --example counter_gpu→3renders three green quads,-4four red (magnitude→count, sign→color, correct readback).Roadmap: closes O4 → O5 is next (
ContinuumHost: first realViewState, session↔Commands/Events, reconcileRgbaFramewith continuum'sRenderBackend).🤖 Generated with Claude Code