Skip to content

feat(aggregation-layers): port GridLayer to WebGPU - #10482

Merged
ibgreen merged 3 commits into
masterfrom
codex/webgpu-grid-layer
Aug 1, 2026
Merged

ibgreen merged 3 commits into
masterfrom
codex/webgpu-grid-layer

Conversation

@ibgreen-openai

Copy link
Copy Markdown
Collaborator

Goal

Port GridLayer to WebGPU as a small, standalone follow-up to the landed ColumnLayer, HexagonLayer, and shared shader/device preparation work.

WebGL GPU aggregation and the existing WebGL rendering path are unchanged. On WebGPU, GridLayer uses its already-existing automatic CPU-aggregation fallback and renders the result through a dedicated WGSL grid-cell shader.

Changes

  • Add a WGSL GridCellLayer shader following the already-landed HexagonLayer implementation.
  • Support flat and extruded grid cells, interpolated elevation, color-range texture sampling, lighting, layer opacity, picking, and highlighting.
  • Add automatically relocated WGSL bindings for the existing grid uniforms, color-range texture, and sampler.
  • Supply source unconditionally alongside the unchanged GLSL shader; there is no new isWebGPU shader-selection branch.
  • Preserve existing WebGL vertex shaders, WebGL GPU aggregation, model setup, and attribute layouts.
  • Document that WebGPU automatically falls back to CPU aggregation.
  • Add a dedicated /examples/grid-layer road-safety example using the landed shared website device store and persisted WebGL2/WebGPU tabs.
  • Add regression tests for WGSL uniform layout, field order, and color-range bindings.

Website example

Layer Example WebGL2 WebGPU Notes
GridLayer United Kingdom Road Safety ✅ ✅ 140.1K accident points; existing GPU aggregation on WebGL, automatic CPU aggregation and WGSL grid-cell rendering on WebGPU.

Why this is low risk for WebGL

  • GridLayer.getAggregatorType() and WebGLAggregator are not changed.
  • The existing GLSL grid-cell vertex shader is not changed.
  • WGSL source is ignored by the WebGL device.
  • No shared renderer, AttributeManager, blending, extension, or application plumbing is modified.
  • All seven existing GridLayer WebGL golden-image cases, including GPU aggregation and extruded side views, remain unchanged.

Validation

  • yarn build
  • yarn lint — passes with existing repository warnings only.
  • yarn test-headless test/modules/aggregation-layers — 15 suites; 41 passed, 2 existing skipped.
  • yarn test-render test/render/test-cases/grid-layer.spec.ts test/render/test-cases/hexagon-layer.spec.ts test/render/test-cases/screen-grid-layer.spec.ts test/render/test-cases/contour-layer.spec.ts — 18 passed.
  • yarn test-website — production build passes with existing dependency source-map warnings only.
  • Live headless Chromium WebGPU smoke test: confirmed a real WebGPU adapter, selected and persisted the WebGPU tab, loaded 140.1K road-accident records, and observed no WGSL, binding, or render-pipeline errors.
  • yarn prettier --config .prettierrc --check website/src/examples/grid-layer.js website/src/examples/grid-layer.mdx website/src/examples-sidebar.js

@coveralls

coveralls commented Jul 25, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 83.128% (+0.001%) from 83.127% — codex/webgpu-grid-layer into master

@ibgreen-openai
ibgreen-openai force-pushed the codex/webgpu-grid-layer branch from c31631f to 8b40ae8 Compare July 27, 2026 20:22
@ibgreen-openai ibgreen-openai mentioned this pull request Jul 27, 2026
42 of 61 tasks
@ibgreen-openai
ibgreen-openai marked this pull request as ready for review July 31, 2026 19:29

@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: 8b40ae86a2

ℹ️ 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".


return (
<DeckGL
device={device}

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 Remount DeckGL when switching devices

When a user switches the example's WebGL2/WebGPU tab after mount, this updates the existing DeckGL instance instead of remounting it. The device-change path in modules/core/src/lib/deck.ts stops the old animation loop but replaces the layer, effect, renderer, and picker managers without finalizing the old ones, leaking their GPU resources on every toggle. Existing device-switching examples avoid this by keying the rendered app with device?.type; add the same key here so the previous Deck instance is finalized.

Useful? React with 👍 / 👎.

@ibgreen
ibgreen merged commit bcbe017 into master Aug 1, 2026
5 checks passed
@ibgreen
ibgreen deleted the codex/webgpu-grid-layer branch August 1, 2026 17:36
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.

4 participants