Repository navigation
feat(aggregation-layers): accept custom aggregator instances and GPUVectors - #11044
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[High impact] The PR appears safe to merge; no new actionable issues were found. SummaryAdds custom aggregator instances and borrowed
All four supplied prior findings are addressed in the current code. Their threads have no supplied comment numbers, so
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a9bdaed. Configure here.
chrisgervang
left a comment
There was a problem hiding this comment.
Reviewed d4f5714 after merge; follow-ups below.
No P1s. The new layer props have no entries on the layer pages, and GPUVector data.attributes inputs are documented only on the internal Attribute page.
Labels: P1 settle before this is merged, P2 can follow, Non-blocking optional.
| `ScreenGridLayer`, `GridLayer`, `HexagonLayer`, and `ContourLayer` accept an optional | ||
| `aggregator` instance. When omitted, the layer creates its default aggregator using the | ||
| existing layer settings. |
There was a problem hiding this comment.
P2: aggregator, positions, weights and dataBounds have no prop entries on the Grid, Hexagon, Contour or ScreenGrid pages. The Grid page's compute example on master uses positions, weights and dataBounds, but readers can't look them up there. Could each page get entries like ### GPU column inputs on heatmap-layer.md, linking here for details?
Details
Proposed entries for grid-layer.md:
### Custom aggregation
#### `aggregator` (Aggregator, optional) {#aggregator}
* Default: `null`
A custom [Aggregator](./aggregator.md) that replaces the built-in CPU or GPU aggregation. The layer destroys it when the prop changes or the layer is removed. See [Supplying an aggregator to a layer](./aggregator.md#supplying-an-aggregator-to-a-layer).
#### `positions` (GPUVector, optional) {#positions}
* Default: `null`
Positions already on the GPU, used instead of `getPosition`. Requires `weights` and `dataBounds`. See [GPU column inputs](./aggregator.md#gpu-column-inputs).
#### `weights` (GPUVector[], optional) {#weights}
* Default: `null`
Two weight columns, color then elevation, used instead of `getColorWeight` and `getElevationWeight`. Each has the same length as `positions`.
#### `dataBounds` ([number[], number[]], optional) {#databounds}
* Default: `null`
`[min, max]` of `positions`, in input coordinates. Required with `positions`, because the layer cannot read GPU positions to compute bounds.ScreenGridLayer and ContourLayer take one weight column, and ScreenGridLayer does not need dataBounds. The positions TSDoc (aggregation-layer.ts:30) still says it requires a custom aggregator, but the Grid, Hexagon and ScreenGrid compute paths on master accept it without one.
| ### GPUVector inputs | ||
|
|
||
| Accessor entries in `data.attributes` can contain borrowed luma `GPUVector` objects. | ||
| The attribute preserves the vector's identity, buffer offset, and stride, so supplying the | ||
| same vector again does not rebind unchanged storage. Supply a new vector when its layout changes. | ||
| Vectors must provide a format and one fixed-width chunk backed by a concrete buffer, with | ||
| at least as many rows as the draw count. Float16 and variable-length formats are unsupported. | ||
| The caller owns the vector and its buffer. Attributes requiring CPU transforms need CPU data. |
There was a problem hiding this comment.
P2: Any layer's data.attributes can now take a GPUVector, but only this page, titled Internal, says so. The format list at layer.md#dataattributes doesn't mention it. Could it get a bullet there, with this section linking to it? For example:
- A luma.gl
GPUVectorwith one fixed-width chunk and at least as many rows as the layer draws. The layer borrows it without copying. Pass a new vector when its layout changes. Float16 formats are not supported, and attributes the layer transforms on the CPU still need CPU data.
|
|
||
| [modules/aggregation-layers/src/common/aggregator/aggregator.ts](https://github.com/visgl/deck.gl/tree/master/modules/aggregation-layers/src/common/aggregator/aggregator.ts) | ||
|
|
||
| ## Supplying an aggregator to a layer |
There was a problem hiding this comment.
Non-blocking: These sections start after ## Source, so the page looks finished before they appear. Could they move above ## Source?
| `getBins()` and `getResult(channel)` may return either the existing `BinaryAttribute` or a | ||
| borrowed `GPUVector`. Cell rendering uses the same AttributeManager/`GPUVectorModel` path as | ||
| accessor-backed layers, including ArcLayer. The vector adapter preserves offsets and strides | ||
| without uploading, copying, or reading the buffer. Results require one concrete | ||
| buffer chunk: `float32x2` bin IDs and `float32` channel values. Result vectors and | ||
| buffers remain owned by the aggregator, and must stay valid through sublayer drawing. |
There was a problem hiding this comment.
Non-blocking: AttributeManager, GPUVectorModel, ArcLayer and the vector adapter are internals. Could this keep only the requirements? The getBins and getResult entries above also still list only a binary attribute as the return value.
| `getBins()` and `getResult(channel)` may return either the existing `BinaryAttribute` or a | |
| borrowed `GPUVector`. Cell rendering uses the same AttributeManager/`GPUVectorModel` path as | |
| accessor-backed layers, including ArcLayer. The vector adapter preserves offsets and strides | |
| without uploading, copying, or reading the buffer. Results require one concrete | |
| buffer chunk: `float32x2` bin IDs and `float32` channel values. Result vectors and | |
| buffers remain owned by the aggregator, and must stay valid through sublayer drawing. | |
| `getBins()` and `getResult(channel)` may return a `BinaryAttribute` or a borrowed `GPUVector`. | |
| Layers draw a `GPUVector` without copying or reading it. It must have one buffer chunk, with | |
| `float32x2` bin IDs and `float32` channel values. The aggregator owns the vectors and their | |
| buffers, and must keep them valid until the sublayers have drawn. |
|
|
||
| ## Unreleased | ||
|
|
||
| ### Custom aggregators and GPUVector inputs |
There was a problem hiding this comment.
Non-blocking: Unreleased now has six aggregation entries in a row (Hexagon, ScreenGrid and Grid features, Heatmap columns, Grid, ScreenGrid, custom aggregators). Could they become one section with a linked bullet per feature? For example:
Aggregation layers
- ScreenGridLayer, GridLayer and HexagonLayer aggregate in WebGPU compute shaders with
gpuAggregation: true. See Compute aggregation.aggregatoron GridLayer, HexagonLayer, ScreenGridLayer and ContourLayer takes a custom aggregator instance.positionsandweightspass GPU columns to these layers and to HeatmapLayer without copying them to the CPU.

Expose an aggregator interface on GridLayer, HexagonLayer, ScreenGridLayer, and ContourLayer. Applications can supply
aggregator: new CustomAggregator(); omitting the prop creates the existing default.Changes:
initialize(device)and layer-owned replacement/finalization. Extension changes retain the custom instance.Validation:
yarn lint, scoped source TypeScript check, andgit diff --checkpassed.Note
Medium Risk
Modifies core attribute ingestion and aggregation layer lifecycle to handle GPU-backed vector data, but retains fallback defaults and backwards compatibility for existing aggregation pipelines.
Overview
Adds support for custom
Aggregatorinstances acrossGridLayer,HexagonLayer,ScreenGridLayer, andContourLayer, allowing callers to supply specialized aggregation pipelines or reuse existing layer setups. Custom aggregators follow layer-owned lifecycles with an optionalinitialize(device)hook and are preserved across layer extension updates.Layers and
Attribute.setBinaryValuenow accept borrowed lumaGPUVectorinputs forpositionsandweightsalong with an explicitdataBoundsprop, bypassing accessor generation and CPU preprojection. In addition,getBins()andgetResult()can returnGPUVectorobjects directly, which cell sublayers consume without CPU copy or buffer readbacks while preserving vector identity, offsets, and strides.Reviewed by Cursor Bugbot for commit d4f5714. Bugbot is set up for automated code reviews on this repo. Configure here.