Skip to content

feat(layers): add ArcLayer analytic antialiasing - #10559

Merged
chrisgervang merged 9 commits into
chrisgervang/line-layer-antialiasingfrom
chrisgervang/arc-layer-antialiasing
Aug 21, 2026
Merged

chrisgervang merged 9 commits into
chrisgervang/line-layer-antialiasingfrom
chrisgervang/arc-layer-antialiasing

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Goal

Extend the same opt-in analytic coverage model to ArcLayer.

Change List

  • Add ArcLayer.antialiasing, defaulting to false.
  • Feather the outer sides of the segmented arc strip in GLSL and WGSL using its existing uv.y silhouette coordinate.
  • Compute derivatives before validity discards to keep derivative evaluation well-defined.
  • Include ArcLayer API documentation, uniform coverage, isolated no-MSAA WebGL coverage, and WebGPU premultiplication coverage.

Validation

  • Focused ArcLayer headless test
  • Focused WebGL and WebGPU render tests
  • Included in stack-wide yarn lint and yarn build

Performance benchmark

Extends yarn bench-antialiasing with 10K sparse 1px ArcLayer arcs at 50 segments each. On an Apple M1 Max running macOS 26.3 in headless Chrome 151.0.7922.138, the median of 100 alternating GPU timestamp samples was 0.656→0.795 ms (+21%) on WebGL2 and 0.683→0.708 ms (+4%) on WebGPU.

Visual comparison

The render-test device has framebuffer MSAA disabled. Left: antialiasing: false. Right: antialiasing: true.

ArcLayer analytic antialiasing comparison


Note

Medium Risk
Touches ArcLayer vertex/fragment shaders (WebGL and WebGPU), including discard and alpha coverage that can affect picking, depth, and overlapping arcs. Default remains off, so existing visuals are unchanged unless the new prop is enabled.

Overview
Adds opt-in shader-based edge coverage to ArcLayer via antialiasing (default false), matching Line/Path layers. When enabled, GLSL and WGSL feather the outer width of the segmented strip using uv.y and extend the rasterized envelope by half a device pixel; ends stay hard so segments join cleanly.

The default path is unchanged (ANTIALIASING is a shader define, not a uniform). Toggling the prop rebuilds the model. Docs note overlap artifacts vs MSAA. Tests cover shader variants, no-MSAA WebGL coverage, WebGPU premultiplication, a golden image, and a 10K-arc bench workload.

Reviewed by Cursor Bugbot for commit c2828c0. Bugbot is set up for automated code reviews on this repo. Configure here.

@coveralls

coveralls commented Aug 14, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 82.2% — chrisgervang/arc-layer-antialiasing into chrisgervang/line-layer-antialiasing. No base build found for chrisgervang/line-layer-antialiasing.

@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from 4a16644 to f296a64 Compare August 14, 2026 00:52
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from f296a64 to ef31270 Compare August 14, 2026 17:39
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from ef31270 to 452322b Compare August 14, 2026 18:39
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from 452322b to f0e4bbe Compare August 14, 2026 19:44

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Performance concern for users who do not opt in: both shaders now compute halfWidthPixels = length(offset) before testing arc.antialiasing, and the compiled fragment shader still carries the AA branches and derivative path because the toggle is a runtime uniform. Defaulting the prop to false preserves output, but it does not preserve the previous shader execution/pipeline.

Could this use the same compile-time specialization proposed for PathLayer/LineLayer? An AA-off GLSL/WGSL variant should omit the coverage envelope, derivative code, branches, and AA uniform entirely; changing the prop can recreate or lazily select the model. This keeps the cost with applications that explicitly enable the visual feature.

@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from f0e4bbe to 7fb5e72 Compare August 15, 2026 00:43
@chrisgervang

Copy link
Copy Markdown
Collaborator Author

Addressed in 7fb5e72. ArcLayer now uses compile-time GLSL/WGSL AA variants, removes the runtime AA uniform, and recreates its model when the prop changes. The disabled source omits the vertex coverage-envelope work and fragment derivative path; focused source and lifecycle tests cover the guarantee.

@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch 2 times, most recently from eb85670 to c1655b3 Compare August 15, 2026 23:39
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from c1655b3 to 511f87c Compare August 16, 2026 03:25
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from 511f87c to 2537fa9 Compare August 17, 2026 21:45
@greptile-apps

greptile-apps Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR adds opt-in analytic edge antialiasing to ArcLayer while preserving the existing default rendering path.

  • Adds matching GLSL and WGSL coverage calculations and shader variants.
  • Recreates the ArcLayer model when antialiasing changes.
  • Adds API documentation, benchmarks, shader tests, and WebGL/WebGPU render coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
modules/layers/src/arc-layer/arc-layer.ts Adds the antialiasing prop, selects the corresponding shader variant, and rebuilds the model when the option changes.
modules/layers/src/arc-layer/arc-layer-vertex.glsl.ts Expands the arc strip to rasterize the outer half of the analytic coverage ramp.
modules/layers/src/arc-layer/arc-layer-fragment.glsl.ts Computes width-edge coverage before validity discards and applies it to fragment alpha.
modules/layers/src/arc-layer/arc-layer.wgsl.ts Implements the WebGPU equivalent of the ArcLayer analytic coverage path.
test/render/test-cases/arc-layer.spec.ts Adds isolated no-MSAA WebGL coverage and WebGPU premultiplication validation.
test/modules/layers/arc-antialiasing.spec.ts Verifies shader variants, model recreation, and preservation of the default fast path.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  P[ArcLayer antialiasing prop] --> D{Enabled?}
  D -- No --> F[Default shader path]
  D -- Yes --> V[Expand strip by half a device pixel]
  V --> C[Compute width-edge coverage]
  C --> X[Discard fragments outside ramp]
  X --> A[Apply coverage to alpha]
  A --> O[Run deck.gl color filters]
  D -->|Prop toggled| R[Recreate model with shader define]
Loading

Reviews (17): Last reviewed commit: "refactor(arc-layer): use named WGSL expo..." | Re-trigger Greptile

Comment thread test/bench/antialiasing.js Resolved
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from 2537fa9 to 56791e3 Compare August 18, 2026 18:09
@chrisgervang chrisgervang added this to the v9.4 milestone Aug 19, 2026
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch 2 times, most recently from b1f781b to ca443bc Compare August 19, 2026 00:24
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch 2 times, most recently from 6663437 to fae9133 Compare August 20, 2026 05:36
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from fae9133 to a879b55 Compare August 20, 2026 05:47
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from a879b55 to 2846d96 Compare August 20, 2026 17:44
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from 2846d96 to 5fc87ce Compare August 20, 2026 18:39
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch 2 times, most recently from 965c66c to fd8d064 Compare August 20, 2026 23:01
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from fd8d064 to 25fb8f0 Compare August 20, 2026 23:25
@chrisgervang
chrisgervang force-pushed the chrisgervang/arc-layer-antialiasing branch from 25fb8f0 to c2828c0 Compare August 20, 2026 23:33
@chrisgervang
chrisgervang merged commit 981b334 into master Aug 21, 2026
12 checks passed
@chrisgervang
chrisgervang deleted the chrisgervang/arc-layer-antialiasing branch August 21, 2026 02:46
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