Skip to content

Port remaining path and polygon layers to WebGPU - #703

Merged
ibgreen merged 2 commits into
masterfrom
codex/port-remaining-layers-webgpu
Jul 30, 2026
Merged

Port remaining path and polygon layers to WebGPU#703
ibgreen merged 2 commits into
masterfrom
codex/port-remaining-layers-webgpu

Conversation

@ibgreen

@ibgreen ibgreen commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Ports the community layers that were blocked on upstream path and polygon support to WebGPU now that deck.gl 9.4 alpha.2 provides dual-backend PathLayer and PolygonLayer implementations.

  • routes outlined, dashed, marked, and dependency paths through the upstream dual-backend path renderer
  • adds a small WGSL dash compatibility plugin until PathStyleExtension supplies its own WGSL implementation
  • replaces graph-only fragment and mesh rendering with CPU-tessellated PolygonLayer geometry
  • adds WGSL picking-width support for editable paths
  • validates Timeline geometry and GeoArrow binary path/polygon rendering on real WebGL2 and WebGPU devices
  • uses integer data textures plus WGSL bitcast for baseline WebGPU adapters that do not expose float32-filterable
  • gives every gallery example and live layer example standalone WebGL2/WebGPU device tabs
  • gives every generated docs page a linked WebGPU support badge derived from the central support matrix
  • updates the WebGPU compatibility matrix, affected module documentation, and docs/whats-new.md

Why

The previous community implementations depended on WebGL-only shaders, mesh paths, or upstream path/polygon layers that did not yet have WebGPU implementations. deck.gl 9.4 alpha.2 removes the central path/polygon blocker, allowing these layers to share the upstream renderers across both backends. The integer texture paths also avoid requiring the optional WebGPU float32-filterable feature.

Making backend selection and support status universal in examples and docs makes the remaining compatibility gaps visible and testable instead of depending on per-page opt-in wiring.

WebGPU porting status

A checkmark means the blocked work is implemented by this PR; the final column records any remaining follow-up beyond this PR's path/polygon scope.

Area Fixed by this PR Remaining WebGPU work
PathOutlineLayer, PathMarkerLayer, and path-mode DependencyArrowLayer Replace the local dash bridge when upstream PathStyleExtension gains WGSL.
TimelineLayer geometry and HorizonGraphLayer data textures Validate TextLayer labels plus pointer and drag interactions.
Static graph rounded nodes, path edges, and arrowheads Validate complete GraphLayer styling, images, labels, layouts, and picking.
GeoArrowPathLayer and GeoArrowSolidPolygonLayer Port or validate the remaining GeoArrow renderers, including GeoArrowTripsLayer.
Editable GeoJSON paths, polygons, edit handles, and picking width Add browser interaction coverage for dragging, snapping, selection, and editing.
Wind particle data textures on baseline WebGPU adapters Complete image terrain and map-boundary integration coverage.
Device selection controls on gallery and live layer examples Continue using the universal tabs to validate and port unsupported examples.
WebGPU support badges on generated docs pages Keep the central support map current as compatibility changes.
FlowPathLayer and animated graph flows Replace the incomplete transform-feedback implementation with a backend-neutral animation or compute design.
Tile, global-grid, and basemap layers Validate upstream sublayers, tile formats, texture formats, labels, and picking.
Host-owned Three.js, Leaflet, and Bing Maps integrations Requires renderer/canvas ownership changes; these hosts cannot switch an existing WebGL context to WebGPU.

User impact

Applications can select WebGPU for the newly ported path, polygon, graph, timeline-geometry, GeoArrow, editable-geometry, and wind-particle paths without WebGL-only shader failures. WebGL2 behavior remains supported. Every gallery and live layer example now exposes backend selection, while every docs page displays its current WebGPU support status and links to the compatibility guide.

Validation

  • yarn lint
  • yarn build
  • yarn --cwd website build
  • yarn test-node — 168 files passed; 1,420 tests passed and 9 skipped
  • yarn vitest run --project examples examples/geo-layers/wind/wind-device-tabs.spec.ts — 2 passed
  • source audit: 29/29 gallery wrappers use the device-managed example wrapper
  • rendered site audit: 205/205 generated docs pages contain a WebGPU status badge
  • runtime smoke tests:
    • standalone widgets example exposes WebGL2 and WebGPU tabs without requiring a Deck instance
    • live GlobalGrid docs example preserves its tabs and badge when switching to WebGL2
  • native browser coverage on WebGL2 and WebGPU:
    • community layer scene: 2 passed
    • GeoArrow path/polygon scene: 2 passed
    • wind layer scene: 3 passed
  • captured native WebGPU validation errors: none

@github-actions

Copy link
Copy Markdown

Coverage

Stmts: 51.01% ▼-0.02% | Branch: 42.11% | Funcs: 49.15% ▼-0.06% | Lines: 51.12% ▼-0.02%

Test Files 168 passed (168)

@ibgreen
ibgreen marked this pull request as ready for review July 30, 2026 17:21
@ibgreen
ibgreen merged commit 6bd7a45 into master Jul 30, 2026
4 checks passed
@ibgreen
ibgreen deleted the codex/port-remaining-layers-webgpu branch July 30, 2026 17:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c25c1bc718

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +61 to +62
shaders.source = insertBefore(
shaders.source.replace('let widthPixels =', 'var widthPixels ='),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard the absent WGSL source before rewriting it

With the pinned deck.gl 9.4.0-alpha.2, PathLayer.getShaders() returns vs, fs, and modules but no source, so every EditablePathLayer initialization—WebGL2 as well as WebGPU—evaluates undefined.replace(...) here and throws before rendering. The WGSL rewrite needs to be conditional or supplied through a shader path that actually defines source.

Useful? React with 👍 / 👎.

Comment on lines +14 to 16
export class RoundedRectangleLayer extends PathBasedRoundedRectangleLayer {
static layerName = 'RoundedRectangleLayer';

draw(props) {
const {cornerRadius} = this.props as any;
const roundedRectangleProps: RoundedRectangleProps = {cornerRadius};
const model = this.state.model as Model;
model.shaderInputs.setProps({roundedRectangle: roundedRectangleProps});
super.draw(props);
}

getShaders() {
// use object.assign to make sure we don't overwrite existing fields like `vs`, `modules`...
const shaders = super.getShaders(undefined!);
return {
...shaders,
fs,
modules: [...shaders.modules, roundedRectangleUniforms]
};
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the rounded-rectangle default radius

When an existing rounded-rectangle style omits the optional cornerRadius, this subclass no longer supplies the previous 0.1 default and the inherited tessellator passes undefined into generateRoundedCorners; its calculations become NaN and return an empty polygon, so the node disappears. An explicit cornerRadius: 0, previously documented as a sharp rectangle, also produces empty geometry, so this implementation needs to preserve the old default and handle zero-radius rectangles.

Useful? React with 👍 / 👎.

Comment on lines 61 to 63
export default function makeImperativeExample(
{title, code, renderInfo = () => null, mount, parameters, mapStyle, data, deviceTabs},
{title, code, renderInfo = () => null, mount, parameters, mapStyle, data, deviceTabs = true},
options

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Disable backend tabs for host-owned renderers

Defaulting every imperative example to device management also adds a functional WebGPU tab to the Leaflet and Bing Maps galleries, although their mount functions ignore the supplied device and create host-owned WebGL overlays (examples/leaflet/get-started/app.ts and examples/bing-maps/get-started/app.ts). Selecting WebGPU therefore only changes the wrapper's unused managed device while the displayed example remains WebGL, making the backend control misleading; these integrations need to opt out or expose an unsupported state.

Useful? React with 👍 / 👎.

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