Repository navigation
feat(layers): add LineLayer analytic antialiasing - #10558
chrisgervang merged 11 commits into
Conversation
6ddf070 to
a9db815
Compare
a9db815 to
b7cca97
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 b7cca97. Configure here.
b7cca97 to
79c401b
Compare
79c401b to
07cc35f
Compare
ibgreen
left a comment
There was a problem hiding this comment.
There is a concrete default-off WebGPU regression here: edgeCoord and edgePixels (including fwidth, max, and division) are computed before checking line.antialiasing. This work therefore remains in every fragment, including the picking path, when the prop is left at its default false. The vertex shader likewise computes length(filteredOffset.xy) before the guard on both backends.
I think this should be addressed before merge. Moving the derivative into the uniform branch would remove the most obvious unconditional work, but to guarantee the non-opt-in fast path across drivers I recommend compiling separate AA-on/off shader variants: a GLSL define plus generated WGSL, with model recreation or lazy selection when the prop toggles. The disabled variant should contain neither the derivative calculation nor the vertex coverage-envelope logic.
07cc35f to
cd98950
Compare
|
Addressed in cd98950. LineLayer now uses compile-time GLSL/WGSL variants and recreates the model when the antialiasing prop changes. The default WGSL source no longer contains the unconditional fwidth, edge division, vertex length, coverage envelope, AA branch, or AA uniform. Source-level and lifecycle tests guard the fast path and variant transition. |
cd98950 to
3b3933f
Compare
3b3933f to
ee9d725
Compare
b46440b to
9ba2158
Compare
Greptile SummaryAdds opt-in analytic antialiasing to LineLayer across WebGL and WebGPU while retaining the existing default rendering path.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| modules/layers/src/line-layer/line-layer.ts | Adds the public antialiasing property, shader define selection, and model recreation when the variant changes. |
| modules/layers/src/line-layer/line-layer-fragment.glsl.ts | Adds optional analytic coverage and out-of-ramp fragment discard for WebGL. |
| modules/layers/src/line-layer/line-layer-vertex.glsl.ts | Expands the antialiased line envelope by half a device pixel for WebGL. |
| modules/layers/src/line-layer/line-layer.wgsl.ts | Implements equivalent vertex expansion and fragment coverage behavior for WebGPU. |
| test/render/test-cases/line-layer.spec.ts | Adds isolated no-MSAA and WebGPU rendering checks for analytic line coverage. |
| test/modules/layers/line-antialiasing.spec.ts | Verifies shader variants, default fast-path preprocessing, and model recreation. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[LineLayer antialiasing prop] --> B{Enabled?}
B -->|No| C[Existing shader path]
B -->|Yes| D[Compile ANTIALIASING variant]
D --> E[Expand rasterized width]
E --> F[Calculate edge coverage with fwidth]
F --> G[Discard fragments outside ramp]
G --> H[Apply alpha coverage]
Reviews (17): Last reviewed commit: "refactor(line-layer): preserve named WGS..." | Re-trigger Greptile
9ba2158 to
fd97a08
Compare
fd97a08 to
bea30c3
Compare
e72a419 to
947b8f7
Compare
|
|
||
| const webgpuAntialiasingTestCase: TestCase = { | ||
| ...antialiasingTestCase, | ||
| skip: false |
There was a problem hiding this comment.
Why the override? Why not just remove webgpu from skip?
There was a problem hiding this comment.
Good point — simplified in 2314c0a. The case now uses only skip: ["msaa"], so the ordinary shared WebGPU suite runs it and selects the WebGPU golden override, while shared MSAA WebGL skips it and the isolated no-MSAA WebGL suite still runs it. This removes the cloned test case and the extra WebGPU suite. I applied the same registration pattern to PathLayer, ArcLayer, and PointCloudLayer as well. Focused AA results remain 8/8 on WebGPU and 9/9 on WebGL.
There was a problem hiding this comment.
Yeah.. that last turn over complicated the ask. Thanks for pointing it out
947b8f7 to
2314c0a
Compare
2314c0a to
ba82176
Compare
5eae6ef to
a573f3f
Compare
cc34673 to
b8bce35
Compare
b8bce35 to
a11d17d
Compare
a11d17d to
cc7c245
Compare

Goal
Add opt-in analytic edge antialiasing to LineLayer independently of PathLayer.
Change List
LineLayer.antialiasing, defaulting tofalse.fwidth(uv.y).wrapLongitudedraw.Validation
yarn lintandyarn buildPerformance benchmark
Extends
yarn bench-antialiasingwith 100K sparse 1px LineLayer segments. 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.441→0.442 ms (+0%) on WebGL2 and 0.420→0.424 ms (+1%) on WebGPU.Visual comparison
The render-test device has framebuffer MSAA disabled. Left:
antialiasing: false. Right:antialiasing: true.Note
Medium Risk
Touches LineLayer vertex/fragment shaders (including discard and picking coverage) on both WebGL and WebGPU. Default remains off, so existing visuals stay unchanged unless the new prop is enabled.
Overview
Adds an opt-in
antialiasingprop onLineLayer(defaultfalse) so long edges can be feathered in the shader instead of relying on framebuffer MSAA.When enabled, GLSL and WGSL expand the rasterized width by half a device pixel and apply
fwidth-based coverage alonguv.y. Segment ends stay hard so neighboring segments do not seam. The model is rebuilt when the prop changes;wrapLongitude’s second draw keeps the same shader variant. Overlapping lines can still show coverage artifacts.Docs, unit tests, no-MSAA render tests, and a LineLayer bench workload cover the new path.
Reviewed by Cursor Bugbot for commit cc7c245. Bugbot is set up for automated code reviews on this repo. Configure here.