Skip to content

Fix empty HTML/SOG export by forcing splat-transform's worker pool inline#930

Merged
slimbuck merged 1 commit into
playcanvas:mainfrom
slimbuck:sog-fix
Jun 30, 2026
Merged

Fix empty HTML/SOG export by forcing splat-transform's worker pool inline#930
slimbuck merged 1 commit into
playcanvas:mainfrom
slimbuck:sog-fix

Conversation

@slimbuck

Copy link
Copy Markdown
Member

Problem

After updating to @playcanvas/splat-transform@2.7.1 and playcanvas@2.20.2 (#929), HTML and ZIP viewer export stopped working: the output file and its .crswap temp were created on disk but 0 bytes were written, with no error dialog. Plain SOG export was affected too, since all three share the same write path.

Root cause

splat-transform 2.6.0 ("Parallelize SOG writing with a cross-platform worker pool") rewired writeSog to offload runQuantize1d / runEncodeWebp onto a WorkerQueue. Our 2.5.1 → 2.7.1 bump crossed that change (writeHtml itself is unchanged between the two versions).

In the published build the pool is not inline by default (WorkerQueue.isInline is false). We never configure it for our browser bundle — main.ts only sets WebPCodec.wasmUrl — so the pool tries to spawn new URL('./worker.mjs', import.meta.url), which resolves next to our bundle and 404s (we don't ship that worker). A single failed-worker task falls back to inline correctly, but under the parallel task load that real SOG writing generates, the pool hangs instead of falling back — so writeSog never completes and nothing is written.

Fix

Force SOG writing to run inline (the pre-2.6.0 behavior), alongside the existing WebPCodec config in main.ts:

import { WebPCodec, WorkerQueue } from '@playcanvas/splat-transform';
...
WorkerQueue.maxWorkers = 0;

With the pool disabled, no worker spawn is attempted and writes run on the calling thread, exactly as in 2.5.1.

Verification

  • tsc --noEmit passes.
  • Reproduced the hang directly against the installed 2.7.1: 16 parallel quantize tasks with an unreachable worker hang before the change, and complete inline (16/16) with maxWorkers = 0.

Notes / follow-ups

  • Trade-off: SOG writing in the editor is serial again (no worker parallelism). To restore it later, ship splat-transform's worker.mjs as a static asset and set WorkerQueue.workerUrl to it.
  • Latent splat-transform bug (out of scope here): WorkerQueue hangs under parallel load when workers can't spawn, rather than degrading to inline. Forcing inline sidesteps it, but it would bite any browser consumer that enables the pool without shipping the worker.

@slimbuck slimbuck requested a review from Copilot June 30, 2026 11:19
@slimbuck slimbuck self-assigned this Jun 30, 2026
@slimbuck slimbuck added the bug Something isn't working label Jun 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores broken HTML/ZIP viewer exports (and plain SOG export) after the @playcanvas/splat-transform@2.7.1 update by disabling splat-transform’s worker pool in the browser bundle so SOG writing completes reliably.

Changes:

  • Import WorkerQueue from @playcanvas/splat-transform.
  • Configure WorkerQueue.maxWorkers = 0 during app startup to force inline (non-worker) SOG writing and avoid hangs caused by missing worker.mjs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@slimbuck slimbuck marked this pull request as ready for review June 30, 2026 11:23
@slimbuck slimbuck requested a review from a team June 30, 2026 11:23
@slimbuck slimbuck merged commit 20d49a3 into playcanvas:main Jun 30, 2026
2 checks passed
@slimbuck slimbuck deleted the sog-fix branch June 30, 2026 11:24
dimitribarbot added a commit to dimitribarbot/supersplat that referenced this pull request Jul 2, 2026
Resolve conflicts by adopting upstream's reactive i18n localization (PR playcanvas#927,
which removed the free localize()/formatTooltipWithShortcut() helpers) across all
fork subsystems: converted ~80 localize() call sites to i18n.t(), using thunk form
() => i18n.t() at reactive menu/tooltip sites. Locale files merged (all fork keys
kept; upstream's renamed 'panel.view-options' -> Settings + language-selector keys
adopted). Kept fork's richer LCC import guard alongside upstream's i18n change.

Requires @playcanvas/splat-transform 2.7.1 (upstream dep bump, PR playcanvas#929) which now
exports WorkerQueue, used by upstream's inline worker-pool fix (PR playcanvas#930).

Verified: npm run lint (clean), npm run build (ok), npm run test (189/189 pass).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants