Visitar URL original
feat(extensions): add dashMode and whole-path justification by chrisgervang · Pull Request #10582 · visgl/deck.gl · GitHub
Skip to content

feat(extensions): add dashMode and whole-path justification - #10582

Merged
chrisgervang merged 137 commits into
masterfrom
claude/deck-gl-path-dashing-2jnq8i-4
Sep 2, 2026
Merged

chrisgervang merged 137 commits into
masterfrom
claude/deck-gl-path-dashing-2jnq8i-4

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Aug 21, 2026 •

Copy link
Copy Markdown
Collaborator

Stack position: Part 4 of 6; base #10581.

Goal

Make dash phase a semantic choice: restart at rendered-segment boundaries or continue across the complete normalized path independently of tessellation.

Changes

  • Add optional constructor option dashMode: 'segment' | 'path'; segment behavior remains the default.
  • Build on the existing-options typing cleanup merged in fix(extensions): make PathStyle options optional #10616; this layer only adds dashMode to that public options surface.
  • Keep highPrecisionDash as a deprecated alias, with an explicit dashMode taking precedence.
  • Preserve the scalar public getDashOffsets while storing private vec2 [phase, totalLength] metrics for path mode.
  • Compose dashJustified with both phase domains and bound the solid interval when a complete path is shorter than the requested pattern.
  • Synchronize PathStyle-owned attributes and model layouts for same-ID segment → path → segment changes.
  • Update the dash-styles test app to exercise both semantic modes without forcing layer recreation.
  • Add render and unit coverage for constructor resolution, live mode changes, and all four mode/justification combinations.
  • Own the consolidated Stable dash patterns for PathStyleExtension RFC. It specifies both dashMode and the following dashUnits layer once; feat(extensions): add dashUnits #10583 inherits it byte-for-byte and has no effective RFC delta.

Benchmark results

Apple M1 Max/ANGLE Metal/WebGL2, 3840×2160, 20 samples at production head fc836ab9e5. Subsequent inherited fixes correct rounded-cap AA composition, limit the remapped rounded-corner/body intersection to PATH_STYLE_OFFSET shader variants, and preserve both phase and visible cap/joint bounds for camera-clipped billboards. This benchmark uses flat Orthographic paths with square caps and antialiasing: false, so the AA and billboard-clipping branches do not execute. The inherited bounds fix adds one dash-only varying, so the table remains the closest measured reference rather than a post-fix A/B.

Workload Plain Segment mode Path mode Offset only
100K sparse 1 px strokes 2.390 2.767 2.750 2.444
256 overlapping 64 px strokes 0.459 0.663 0.682 0.480

Path mode is within measurement noise of segment mode in the sparse pass and adds 0.019 ms (about 2.9%) beyond segment mode in the overdraw-heavy pass. The production normalized CPU updater is approximately 3.8 ms for a 100,000-segment path on this hardware; it runs only when path-continuous phase is requested.

The render matrix measures the intended semantic change: segment-mode density periods are 43.4/43.4/43.4/55.4 px before becoming visually solid, while path mode stays 43.4 px across the tested densities; whole-path justification produces a consistent 42.4 px fitted period.

Validation


Note

Medium Risk
Touches PathLayer dash GLSL, CPU tessellation metrics, and attribute topology on extension updates—visible rendering changes are possible, but defaults preserve segment mode and legacy highPrecisionDash behavior.

Overview
Introduces dashMode: 'segment' | 'path' on PathStyleExtension so dash phase can restart at each rendered segment (default, backward compatible) or stay continuous across tessellation, Globe cuts, and dense polylines. highPrecisionDash is deprecated in favor of explicit dashMode: 'path', with explicit mode winning when both are set.

Path-continuous mode stores instanceDashOffsets as a vec2 [distance along path, total length], drives HIGH_PRECISION_DASH from dashMode, and dashJustified now fits one period over the whole path in path mode (with solid length clamped on short runs). Shaders reduce phase modulo the active period in the vertex stage for long paths and reconcile offset widening with justified path phase.

synchronizeAttributes adds/removes extension attributes and refreshes model buffer layouts when the extension changes on a same-ID layer, enabling live segment ↔ path toggles without recreating layers. Exports DashMode; the dash-styles app and render/unit tests cover constructor resolution, mode × justification, and live topology changes. Adds the v9.4 path-dash RFC (also describes upcoming dashUnits; not implemented in this diff).

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

@coveralls

coveralls commented Aug 21, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.391% (+0.05%) from 82.346% — claude/deck-gl-path-dashing-2jnq8i-4 into master

@chrisgervang
chrisgervang marked this pull request as ready for review August 21, 2026 23:15
@greptile-apps

greptile-apps Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR adds segment- and whole-path dash phase modes while preserving compatibility with highPrecisionDash.

  • Exports the new DashMode option and resolves constructor aliases and defaults.
  • Synchronizes extension-owned attributes and model layouts during live mode changes.
  • Adds whole-path justification and path-length-aware shader phase calculations.
  • Expands unit, render, demo, golden-image, and RFC coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
modules/extensions/src/path-style/path-style-extension.ts Adds dash-mode option resolution, path metrics, and attribute/model synchronization for live mode transitions.
modules/extensions/src/path-style/shaders.glsl.ts Implements path-length-aware phase reduction and whole-path dash justification.
modules/extensions/src/index.ts Exports the new public DashMode type.
test/modules/extensions/path.spec.ts Covers option compatibility, normalized metrics, justification, and live attribute topology changes; the prior naming concern is resolved.
test/render/test-cases/path-dash.spec.ts Expands visual coverage across dash modes and justification combinations.
dev-docs/RFCs/v9.4/path-dash-rfc.md Documents the phase-domain API, compatibility behavior, implementation model, and limitations.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[PathStyleExtension options] --> B{dashMode}
  B -->|segment| C[Segment-local phase]
  B -->|path| D[CPU path metrics]
  D --> E[Phase and total length attribute]
  C --> F{dashJustified}
  E --> F
  F -->|off| G[Requested dash period]
  F -->|on| H[Fit period to active run]
  G --> I[Dash shader output]
  H --> I
Loading

Reviews (39): Last reviewed commit: "Merge #10581 from master" | Re-trigger Greptile

Comment thread test/modules/extensions/path.spec.ts Resolved
@chrisgervang
chrisgervang force-pushed the claude/deck-gl-path-dashing-2jnq8i-4 branch from 7ee028e to 62d32c2 Compare August 22, 2026 00:59
@chrisgervang
chrisgervang force-pushed the claude/deck-gl-path-dashing-2jnq8i-4 branch from 62d32c2 to 1967991 Compare August 22, 2026 01:05
@chrisgervang
chrisgervang force-pushed the claude/deck-gl-path-dashing-2jnq8i-4 branch from 1967991 to 72e53a0 Compare August 22, 2026 01:09
@chrisgervang
chrisgervang force-pushed the claude/deck-gl-path-dashing-2jnq8i-4 branch 2 times, most recently from 2556db1 to e0a52ed Compare August 22, 2026 22:00

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 e0a52ed. Configure here.

@chrisgervang
chrisgervang force-pushed the claude/deck-gl-path-dashing-2jnq8i-4 branch from e0a52ed to c82aab9 Compare August 22, 2026 22:15
claude and others added 4 commits August 22, 2026 15:28
…ension

Adds a render-test matrix and an interactive app for PathStyleExtension dashing,
covering segment density, dash arrays, corners, zoom levels, device pixel ratio,
3D elevation and billboard/flat parity.

The golden images record current behavior, defects included, so that subsequent
work shows up as a direct image diff. Measured from these goldens with
getDashArray [4, 5]:

- Six strips drawing the identical straight line diverge purely by vertex count.
  1, 2 and 4 segments dash correctly at a 43.4px period, 12 segments drifts to
  55.4px, and 40 and 120 segments render fully solid. Dash phase restarts at
  every vertex, so once a segment is shorter than one dash period nothing is
  discarded.
- dashJustified collapses the same way; justification is also per segment.
- highPrecisionDash renders all six strips identically and correctly, confirming
  the continuous-arclength mechanism works and is merely opt-in.
- billboard: true combined with highPrecisionDash is broken: the same geometry
  renders solid when dense and at a 52.0px period, 1.5x too long, when sparse,
  against 34.8px for the flat copy.
- Dash length grows along paths that climb in Z, because the CPU accumulates 3D
  distance while the shader coordinate measures 2D.

No source changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014GipN1niYRgRuLVat2wujw
@chrisgervang
chrisgervang force-pushed the claude/deck-gl-path-dashing-2jnq8i-4 branch from c82aab9 to 4464687 Compare August 22, 2026 22:34
@chrisgervang
chrisgervang force-pushed the claude/deck-gl-path-dashing-2jnq8i-4 branch from 4464687 to 2de6726 Compare August 23, 2026 19:44
@chrisgervang
chrisgervang force-pushed the claude/deck-gl-path-dashing-2jnq8i-4 branch from 2de6726 to d5d0ac6 Compare August 24, 2026 00:05
chrisgervang and others added 25 commits August 30, 2026 19:14
# Conflicts:
#	modules/extensions/src/path-style/path-style-extension.ts
#	modules/extensions/src/path-style/shaders.glsl.ts
# Conflicts:
#	modules/extensions/src/path-style/shaders.glsl.ts
#	test/modules/extensions/path.spec.ts
# Conflicts:
#	test/render/golden-images/path-dash-clipped-composition.png
# Conflicts:
#	test/render/test-cases/path-dash.spec.ts
Base automatically changed from claude/deck-gl-path-dashing-2jnq8i-3 to master September 1, 2026 02:10
# Conflicts:
#	modules/extensions/src/path-style/path-style-extension.ts
#	modules/extensions/src/path-style/shaders.glsl.ts
#	test/modules/extensions/path.spec.ts
#	test/render/test-cases/path-dash.spec.ts
@chrisgervang
chrisgervang merged commit 047126b into master Sep 2, 2026
8 checks passed
@chrisgervang
chrisgervang deleted the claude/deck-gl-path-dashing-2jnq8i-4 branch September 2, 2026 04:04
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