Skip to content

feat(render): wire term-state snapshots into the grid render pipeline - #25

Merged
Xuepoo merged 2 commits into
mainfrom
ctx-0016/feat-render-grid-pipeline
Aug 26, 2026
Merged

Xuepoo merged 2 commits into
mainfrom
ctx-0016/feat-render-grid-pipeline

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Closes #22

CarryCtx task: CTX-0016 (branch ctx-0016/feat-render-grid-pipeline, worktree .worktrees/ctx-0016-feat-render-grid-pipeline).

What

Wires bitty-term-state snapshots into the bitty-render grid pipeline per ADR-0003 dependency rule 3 (public Snapshot/Damage surface only; no term-state mutation):

  • grid::SnapshotDamage: grid-coordinate damage -> pixel regions for the existing plan_frame (scrollback ranges contribute no pixels on the active-screen surface; over-damage clips safely)
  • GridRenderer::render: Snapshot + Damage -> FramePlan -> owned DrawList (fills + glyph instances), per-cell background repaint so incremental frames union to a full redraw
  • Cell-to-glyph placement honoring width(1|2) and spacer cells; fixed deterministic baseline rule; inverse/faint/invisible/underline/strikethrough handling; built-in xterm-compatible 256-color palette
  • Atlas upload via RasterKey/GlyphCache + shelf-packed GlyphAtlas: CPU coverage texture, drainable upload queue, wholesale eviction on exhaustion, inline fallback for oversized bitmaps
  • sw-fallback exercises the SAME pipeline headlessly end-to-end (snapshot bytes in -> RGBA buffer out)
  • Perf instrumentation (cells examined/drawn, glyphs emitted, cache+atlas hits/misses, evictions, inline fallbacks) documented against performance-budget-rfc PB-4/PB-6/PB-7 without claiming budget compliance

Deliberately deferred and documented: cursor visuals, scrollback viewport rendering, shaping/color fonts (text RFC).

Evidence

  • just check green locally (fmt, clippy -D warnings, workspace tests, actionlint, markdownlint)
  • clippy/test also green under --features sw-fallback
  • 78 unit tests incl. byte-determinism across independent runs; 4 feature-gated e2e tests incl. incremental-damage == full-redraw byte equality

Xuepoo added 2 commits August 26, 2026 19:27
Consume bitty-term-state public Snapshot+Damage (ADR-0003 rule 3) and
produce owned DrawList frame records: SnapshotDamage converts grid damage
to pixel regions for plan_frame; a per-cell walk emits background/decoration
fills and glyph instances honoring width(1|2)/spacer cells; glyphs cache
through GlyphCache/RasterKey and upload into a shelf-packed GlyphAtlas with
deterministic wholesale eviction, drainable upload queue, CPU coverage
texture, and inline fallback for oversized bitmaps.

The sw-fallback feature exercises the SAME pipeline headlessly end to end
(snapshot -> FramePlan -> DrawList -> RGBA surface); integration tests prove
incremental damage accumulation equals a full redraw byte-for-byte and that
output is byte-deterministic across runs. GlyphCache gains hit/miss
counters; RenderCounters/atlas stats instrument cells drawn, glyphs
rasterized, atlas hits/misses against performance-budget-rfc PB-4/PB-6/PB-7
without claiming compliance.

Closes #22

CarryCtx: CTX-0016
extent_for and the cell-placement products multiplied in u64 before the
u32 clamp; hostile dimensions could overflow the intermediate and panic
under overflow checks (caught by CI). Route every product through
saturating_mul so the documented saturating contract holds under any
build profile.
@Xuepoo
Xuepoo merged commit a9a6338 into main Aug 26, 2026
5 checks passed
@Xuepoo Xuepoo added feat Feature area:render Area: rendering area:term Area: terminal state / VT P0 Priority: highest labels Aug 29, 2026
@Xuepoo Xuepoo added this to the v0.0.1 milestone Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:render Area: rendering area:term Area: terminal state / VT feat Feature P0 Priority: highest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(render): wire term-state snapshots into bitty-render grid pipeline

1 participant