Files
rplace/package.json
T
tiennm99 ce05024858 perf(canvas): port renderer to PixiJS (GPU pan/zoom) + cap DPR at 2
Replace Canvas2D render path with pixi.js v8. Canvas stays authored
as CPU RGBA on an OffscreenCanvas; pixi uses that as a texture source
and uploads on demand. Pan/zoom become pure GPU transforms on a
Container — no CPU work per frame. Overlay is a second sprite in the
same container so it tracks pan/zoom for free.

Key points:
- app.ticker.stop() + manual app.renderer.render() on rAF: idle frames
  cost 0, active frames cost one GPU draw.
- mainTexture.source.update() called only when imageDataDirty (same
  gating as before). Writes stay cheap.
- resolution: Math.min(devicePixelRatio, 2). iPhone 3x → 2x = 44%
  fewer fragments; pixel art gains nothing from 3x.
- Public API preserved: applyUpdates, undo/redo, setOverlay, panBy,
  gotoPoint, getCommittedColor, getPendingPixels, commitPending,
  refetchCanvas, cancelStrokeIfAny all unchanged.
- Overlay sprite rebuilt on setOverlay() with destroy({texture,
  textureSource}) to avoid GPU leaks.

Bundle: +200KB main, +~100KB pixi chunks, ~70KB gz total. Tradeoff
accepted for mobile perf parity with wplace.
2026-04-18 17:51:53 +07:00

31 lines
883 B
JSON

{
"name": "rplace",
"private": true,
"type": "module",
"scripts": {
"dev": "wrangler dev",
"dev:client": "vite dev",
"build": "vite build",
"deploy": "vite build && wrangler deploy",
"preview": "vite build && wrangler dev",
"test": "vitest run --config vitest.config.js",
"test:integration": "vitest run --config vitest.integration.config.js",
"test:all": "vitest run --config vitest.config.js && vitest run --config vitest.integration.config.js",
"test:watch": "vitest --config vitest.config.js"
},
"dependencies": {
"@upstash/redis": "^1.34.3",
"hono": "^4.7.6",
"pixi.js": "^8.18.1"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"ioredis": "^5.10.1",
"svelte": "^5.28.2",
"testcontainers": "^11.14.0",
"vite": "^6.3.2",
"vitest": "^4.1.4",
"wrangler": "^4.14.1"
}
}