Repository navigation
feat(layers): add ArcLayer analytic antialiasing - #10559
chrisgervang merged 9 commits into
Conversation
4a16644 to
f296a64
Compare
f296a64 to
ef31270
Compare
ef31270 to
452322b
Compare
452322b to
f0e4bbe
Compare
ibgreen
left a comment
There was a problem hiding this comment.
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.
f0e4bbe to
7fb5e72
Compare
|
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. |
eb85670 to
c1655b3
Compare
c1655b3 to
511f87c
Compare
511f87c to
2537fa9
Compare
Greptile SummaryThis PR adds opt-in analytic edge antialiasing to ArcLayer while preserving the existing default rendering path.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| 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]
Reviews (17): Last reviewed commit: "refactor(arc-layer): use named WGSL expo..." | Re-trigger Greptile
2537fa9 to
56791e3
Compare
b1f781b to
ca443bc
Compare
6663437 to
fae9133
Compare
fae9133 to
a879b55
Compare
a879b55 to
2846d96
Compare
2846d96 to
5fc87ce
Compare
965c66c to
fd8d064
Compare
fd8d064 to
25fb8f0
Compare
25fb8f0 to
c2828c0
Compare
Goal
Extend the same opt-in analytic coverage model to ArcLayer.
Change List
ArcLayer.antialiasing, defaulting tofalse.uv.ysilhouette coordinate.Validation
yarn lintandyarn buildPerformance benchmark
Extends
yarn bench-antialiasingwith 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.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
ArcLayerviaantialiasing(defaultfalse), matching Line/Path layers. When enabled, GLSL and WGSL feather the outer width of the segmented strip usinguv.yand extend the rasterized envelope by half a device pixel; ends stay hard so segments join cleanly.The default path is unchanged (
ANTIALIASINGis 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.