Skip to content

feat: Made linux compatible:#19

Open
rajzzz wants to merge 1 commit into
mohebifar:mainfrom
rajzzz:main
Open

feat: Made linux compatible:#19
rajzzz wants to merge 1 commit into
mohebifar:mainfrom
rajzzz:main

Conversation

@rajzzz
Copy link
Copy Markdown

@rajzzz rajzzz commented Apr 26, 2026

fix: cross-origin isolation + WebGPU + playback backpressure (Linux)

What

Three changes to fix laggy/frozen preview on Linux:

  1. COOP/COEP/CORP headers on the dev server so crossOriginIsolated === true
  2. crossOrigin: "anonymous" on the Umami analytics script (required under COEP)
  3. Compositor backpressure in the preview playback loop

Why

Headers (vite.config.ts): The render engine needs SharedArrayBuffer, which requires crossOriginIsolated. TanStack Start uses Nitro as the HTTP handler — Vite's server.headers is bypassed for document responses, so the headers must go in nitro.routeRules. Using credentialless instead of require-corp since third-party scripts (Umami, unpkg) don't serve Cross-Origin-Resource-Policy headers.

Playback freeze (preview-panel.tsx): The previous fire-and-forget void compositor.renderFrame() let Comlink messages queue up faster than the worker could drain them on Linux/Vulkan (~20ms GPU turnaround vs ~16ms tick rate). After a few seconds the compositor was rendering frames from the past while the timeline ran live. Fix: compositorBusyRef skips the entire render cycle (capture + upload + render) when the worker hasn't finished the previous frame, so the queue never grows.

Verified

  • crossOriginIsolated === true, typeof SharedArrayBuffer === "function"
  • WebGPU adapter: vendor: "nvidia", isFallbackAdapter: false
  • Playback no longer freezes

Linux dev note: also requires Chromium flags --disable-gpu-sandbox --enable-features=Vulkan,UseSkiaRenderer,VulkanFromANGLE --use-vulkan=native --use-angle=vulkan to get a real GPU adapter instead of SwiftShader.

configure cross-origin policies, update fumadocs generation, and implement frame rendering backpressure in preview panel
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 26, 2026

@rajzzz is attempting to deploy a commit to the Mohamad Mohebifar's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 26, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@rajzzz
Copy link
Copy Markdown
Author

rajzzz commented May 28, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 28, 2026
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