Skip to content

fix(client): render avatar preview in a single WebGL context#6

Merged
danjdewhurst merged 1 commit into
mainfrom
fix-avatar-preview
Jun 13, 2026
Merged

fix(client): render avatar preview in a single WebGL context#6
danjdewhurst merged 1 commit into
mainfrom
fix-avatar-preview

Conversation

@danjdewhurst

Copy link
Copy Markdown
Contributor

Summary

The avatar preview (preview-entry.ts) created one Pixi Application — and one WebGL context — per grid cell (28 cells). Browsers cap live WebGL contexts at ~16, so the excess were context-lost: their shaders failed to compile (empty info log), and Pixi's error logger then threw on the null program log, blanking the page behind a runtime-error overlay.

Fix: a single shared offscreen renderer snapshots each variant into its own static 2D canvas via renderer.extract.canvas. One context total — the harness now scales to any number of cells.

Not a product bug

This only affected the preview tool. The real app uses a single Pixi context per room and renders full-body avatars correctly (confirmed live).

Test plan

  • bun run lint ✅ · bun run typecheck ✅ · bun test ✅ 250 pass
  • Verified in Chromium (Playwright): all 28 variants (14 body + 14 bubble) render with zero shader errors and no error overlay — vs. the previous ~16-cell ceiling.

🤖 Generated with Claude Code

The avatar preview created one Pixi Application — and therefore one WebGL
context — per grid cell (28 cells: 14 body + 14 bubble). Browsers cap live
WebGL contexts at ~16, so the excess were context-lost: their shaders failed to
compile (with an empty info log) and Pixi's error logger then threw on the null
program log, blanking the page behind a runtime-error overlay.

Use a single shared offscreen renderer and snapshot each variant into its own
static 2D canvas via renderer.extract.canvas. One context total, so the harness
now scales to any number of cells.

Not a product bug: the real app uses a single Pixi context per room and renders
full-body avatars correctly. This only affected the preview tool.

Verified in Chromium (Playwright): all 28 avatar variants render with zero
shader errors and no error overlay.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@danjdewhurst danjdewhurst merged commit a334530 into main Jun 13, 2026
2 checks passed
@danjdewhurst danjdewhurst deleted the fix-avatar-preview branch June 13, 2026 22:03
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