Skip to content

Make the PixiJS renderer preference configurable - #35

Open
soulrap wants to merge 1 commit into
engineio:mainfrom
soulrap:webgpu-renderer-preference
Open

Make the PixiJS renderer preference configurable#35
soulrap wants to merge 1 commit into
engineio:mainfrom
soulrap:webgpu-renderer-preference

Conversation

@soulrap

@soulrap soulrap commented Aug 27, 2026

Copy link
Copy Markdown

Problem

InitialiseApplication.svelte hardcodes the PixiJS renderer preference:

preference: 'webgpu',

On a machine where WebGPU is available but produces no output, every sample
game is a black screen. There is no error, in the console or anywhere else —
the app authenticates, assets load, the scene graph builds and the ticker runs.
Only nothing is drawn.

Observed on Windows 11 / Chrome, with the scatter sample connected to a live
RGS session:

preference: 'webgpu' preference: 'webgl'
canvas context webgpu webgl2
renderer.type 2 1
stage.children 4 9
ticker.started true true
what you see black screen the game

The state that makes this hard to diagnose is the middle rows: the renderer
reports the right size, the stage has children, and the ticker is running, so
every health check short of looking at the pixels passes.

PixiJS already falls back to WebGL when WebGPU is unavailable. It cannot
fall back here, because WebGPU reports itself as working — so the choice has to
be made from outside.

Change

Expose an optional rendererPreference prop, threaded from App through to
InitialiseApplication:

preference: props.rendererPreference ?? 'webgpu',

Nothing changes by default. A game that hits this can now opt out with

<App rendererPreference="webgl">

instead of patching pixi-svelte in node_modules or forking the package,
which is what is required today.

Notes

The default stays 'webgpu' deliberately — this is not an argument that WebGPU
is the wrong default, only that there needs to be a way out of it that does not
involve editing the package. If you would rather this were driven by an env var
(PUBLIC_RENDERER_PREFERENCE) or auto-detected with a render probe, I am happy
to redo it that way.

Two files, +2 −2.

`preference` was hardcoded to 'webgpu'. On machines where WebGPU is
available but renders nothing, the game is a black screen with no error -
the scene graph builds and the ticker runs, only no pixels come out.
PixiJS falls back to WebGL when WebGPU is *unavailable*, so it cannot
detect this case on its own.

Expose an optional `rendererPreference` prop on App/InitialiseApplication,
defaulting to 'webgpu' so current behaviour is unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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