Skip to content

feat(text): move shaping and render planning into Rust - #47

Open
thejustinwalsh wants to merge 128 commits into
feat/three-apifrom
feat/rust-wasm-render-plan
Open

feat(text): move shaping and render planning into Rust#47
thejustinwalsh wants to merge 128 commits into
feat/three-apifrom
feat/rust-wasm-render-plan

Conversation

@thejustinwalsh

Copy link
Copy Markdown
Collaborator

What changed

  • moves retained paragraph shaping, layout, instance packing, and dirty render-plan generation behind the Rust/Wasm frame transaction
  • adds a declarative renderer policy and compact Rust-emitted command buffer consumed by the Three adapter
  • supports mixed Bitmap, MTSDF, and Slug fallback, stable and ordered allocation policies, material-directed draws, and coalesced partial uploads
  • removes the duplicate TypeScript shaping/layout path and adds a minimal React Three Fiber example
  • records exact migration benchmarks, package-size evidence, browser/GPU parity, and follow-on paragraph-query and publishing-feature milestones

Why

The shaping and layout state machine must be reusable outside JavaScript, execute through one authoritative boundary, and publish incremental renderer work without reconstructing layout state in adapters.

Evidence

  • root mise exec -- pnpm check passes on the final implementation commit
  • 158 Rust tests, 165 Node integration tests, three fixed-seed mutation suites, and 112 benchmark tests pass
  • all 16 isolated Chromium conformance targets and all 48 Bitmap/MTSDF/Slug × WebGPU/WebGL2 Presentation cells pass with visible output
  • the live R3F GPU interaction passes
  • the 22,000-glyph exact-base comparison improves every comparable median; Bitmap cold/font-size/width/suffix-edit medians are 15.90/6.04/2.78/13.48 ms versus 58.32/12.09/9.15/39.61 ms on feat/three-api
  • optimized shaper Wasm is 1,159,317 raw / 442,284 gzip / 347,850 Brotli bytes; core JS + Wasm is 1,247,715 raw / 460,130 gzip / 363,319 Brotli bytes

Follow-ons

Paragraph-scoped synchronous query/candidate adoption and the broader realtime publishing typography set remain separate roadmap items 11.17 and 11.18 so this foundation can merge cleanly first.

@github-actions

Copy link
Copy Markdown

size-limit report 📦

Path Size
browser-core (brotli) 15.11 KB (-75.5% 🔽)
text-shaper-wasm (raw) 1.11 MB (+70.42% 🔺)
text-shaper-wasm (gzip) 432.41 KB (+74.29% 🔺)
text-shaper-wasm (brotli) 340.14 KB (+74.56% 🔺)
renderer-neutral-core-total (gzip) 449.83 KB (+37.1% 🔺)
renderer-neutral-core-total (brotli) 355.25 KB (+38.5% 🔺)
three-runtime-js (brotli) 46.3 KB (+100% 🔺)
three-renderer-total (gzip) 487.4 KB (+100% 🔺)
three-renderer-total (brotli) 386.45 KB (+100% 🔺)
font-inter-bitmap-16-32 (raw) 3 MB (+100% 🔺)
font-inter-bitmap-16-32 (gzip) 545.22 KB (+100% 🔺)
font-inter-bitmap-16-32 (brotli) 410.73 KB (+100% 🔺)
font-inter-mtsdf (raw) 37.52 MB (+100% 🔺)
font-inter-mtsdf (gzip) 6.48 MB (+100% 🔺)
font-inter-mtsdf (brotli) 3.09 MB (+100% 🔺)
font-inter-slug (raw) 3.29 MB (+100% 🔺)
font-inter-slug (gzip) 603.99 KB (+100% 🔺)
font-inter-slug (brotli) 400.42 KB (+100% 🔺)
font-icons-bitmap-16-32 (raw) 2.27 MB (+100% 🔺)
font-icons-bitmap-16-32 (gzip) 439.5 KB (+100% 🔺)
font-icons-bitmap-16-32 (brotli) 347.22 KB (+100% 🔺)
font-icons-mtsdf (raw) 31.07 MB (+100% 🔺)
font-icons-mtsdf (gzip) 6.89 MB (+100% 🔺)
font-icons-mtsdf (brotli) 3.17 MB (+100% 🔺)
font-icons-slug (raw) 2.81 MB (+100% 🔺)
font-icons-slug (gzip) 642.59 KB (+100% 🔺)
font-icons-slug (brotli) 473.63 KB (+100% 🔺)
delivery-three-inter-bitmap (gzip) 1.01 MB (+100% 🔺)
delivery-three-inter-bitmap (brotli) 797.18 KB (+100% 🔺)
delivery-three-inter-mtsdf (gzip) 6.96 MB (+100% 🔺)
delivery-three-inter-mtsdf (brotli) 3.47 MB (+100% 🔺)
delivery-three-inter-slug (gzip) 1.07 MB (+100% 🔺)
delivery-three-inter-slug (brotli) 786.87 KB (+100% 🔺)
delivery-three-icons-bitmap (gzip) 926.9 KB (+100% 🔺)
delivery-three-icons-bitmap (brotli) 733.66 KB (+100% 🔺)
delivery-three-icons-mtsdf (gzip) 7.37 MB (+100% 🔺)
delivery-three-icons-mtsdf (brotli) 3.55 MB (+100% 🔺)
delivery-three-icons-slug (gzip) 1.1 MB (+100% 🔺)
delivery-three-icons-slug (brotli) 860.08 KB (+100% 🔺)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant