Skip to content

Add WebGPU support#448

Open
jtbandes wants to merge 9 commits intomainfrom
jacob/webgpu
Open

Add WebGPU support#448
jtbandes wants to merge 9 commits intomainfrom
jacob/webgpu

Conversation

@jtbandes
Copy link
Member

@jtbandes jtbandes commented Feb 11, 2026

Changelog

Breaking changes:

  • Label is now an abstract base class to support both WebGL and WebGPU. Continue using import { LabelPool } from "@foxglove/three-text" for WebGLRenderer, or use import { LabelPool } from "@foxglove/three-text/webgpu" to use with WebGPURenderer (including the WebGL fallback).

Docs

Updated readme

Description

High-level changes in this PR:

  • Make Label an abstract class using new ILabelMaterial interface, add LabelWebGL & LabelWebGPU concrete subclasses
    • LabelWebGL uses the old LabelMaterial
    • LabelWebGPU uses a new LabelNodeMaterial
  • Add stories using WebGPURenderer, and WebGPURenderer + forceWebGL

See also https://discourse.threejs.org/t/how-to-publish-a-library-that-supports-both-webglrenderer-and-webgpurenderer/89668 for some architecture discussion.

@jtbandes jtbandes mentioned this pull request Feb 12, 2026
jtbandes added a commit that referenced this pull request Feb 12, 2026
### Changelog
Breaking changes:
* Package is ESM-only

### Docs

None

### Description

Split from #448 

- Upgrade `@foxglove/tsconfig`, replace some TS-specific syntax
features, add file extensions on all imports
- Add `"type": "module"`, remove `tsconfig.cjs.json`
jtbandes added a commit that referenced this pull request Feb 12, 2026
### Changelog
None

### Docs

None

### Description

Just moving code into separate files. I am trying to make #448 a smaller
diff.
@niels-foxglove
Copy link

I just started looking this over. Does this mean that our strategy for converting to webGPU is to refactor each component to be compatible with both webGL and webGPU and then when we've applied it to every component make the global switch to webGPU?

Copy link

@niels-foxglove niels-foxglove left a comment

Choose a reason for hiding this comment

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

Aside from a couple of minor things i mentioned this looks good. I was able to run it in the app by linking the library and creating a 3d scene with a bunch of labels. Everything still looks the same in the 3d panel

Digging around and doing some testing with claude i did find one issue where certain labels (scale_invariant: true) couldn't be selected. This issue already exists in main and wasn't introduced by this PR. I'll create a new PR that contains a fix

@niels-foxglove
Copy link

Follow-up on the picking bug I mentioned: filed as FG-13915 with fix in #455 (draft, waiting for this PR to merge first).

Test data MCAP to reproduce: open in a 3D panel, enable select mode, yellow (scale_invariant=true) labels are not pickable while green ones are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants