Skip to content

fix(core, extensions): stop terrain cover pass from re-tessellating draped layers on GlobeView - #10669

Closed
chrisgervang wants to merge 2 commits into
masterfrom
claude/fix-globe-offscreen-retessellation-GveWO
Closed

chrisgervang wants to merge 2 commits into
masterfrom
claude/fix-globe-offscreen-retessellation-GveWO

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Follow up of #10666

Background

A draped PathLayer on GlobeView never settles: deck reports needsRedraw every frame. The terrain cover pass draws drape layers with a flat WebMercatorViewport and the screen pass draws them again with the GlobeViewport. LayersPass._shouldDrawLayer() calls layer.activateViewport() each time, PathLayer.shouldUpdateState() sees viewport.resolution and projectionMode change, so the path is re-tessellated twice per frame, and each _update() sets needsRedraw, which marks the terrain cover dirty again. The stroked globe drape case hits Playwright's 30 s screenshot timeout before this change and settles in about 12 s after it.

GlobeView
terrain-extension-drape-globe: choropleth fills and strokes draped over TerrainLayer tiles, San Francisco at zoom 11.5, pitch 60

No before image: before this change the case never settles and the harness times out instead of producing a frame.

Change List

  • LayersPassRenderOptions: add activateViewport?: boolean (default true), threaded to _shouldDrawLayer, so an off-screen pass can draw layers without rebinding their viewport. No existing pass sets it
  • TerrainPass and TerrainPickingPass: render the terrain cover with activateViewport: false; layers still receive the cover viewport through shaderModuleProps.project.viewport. Picking passes no longer activate viewports since feat(core): layer coordinateSystem supports arbitrary CRS #10874, so PickLayersPass needs no change
  • Render tests: terrain-extension-drape also renders under GlobeView with strokes, replacing the fills-only terrain-extension-drape-fill-globe case and golden from test(render): GlobeView terrain drape render case + fix TerrainExtension GlobeView docs #10666
  • Unit tests: layers-pass.spec.ts covers default, false and explicit true

Cover-pass layers now keep internalState.viewport bound to the screen viewport. On GlobeView a globe-tessellated path is drawn into the Mercator cover; the extra subdivision only adds collinear vertices in Mercator. renderHeightMap still activates its viewport: it is gated on viewport changes and showed no loop.

Ran the render spec headless on WebGL, the unit specs, tsc and lint.


Note

Medium Risk
Changes core layer draw semantics for off-screen passes; limited to terrain cover paths today but affects when viewport-dependent layer state updates.

Overview
Fixes an infinite redraw on GlobeView when layers are draped over terrain: the terrain cover pass renders in Web Mercator while the screen pass uses the globe viewport, and each draw was calling layer.activateViewport(), so viewport-dependent layers (e.g. PathLayer tessellation) kept invalidating state every frame.

Adds activateViewport?: boolean (default true) on LayersPass render options so off-screen passes can draw without rebinding the layer’s viewport; projection for the pass still comes from shader project uniforms. PickLayersPass forwards the flag; TerrainPass and TerrainPickingPass set activateViewport: false for terrain cover (and picking cover).

Unit tests cover default / opt-out / explicit true; render tests run the draped choropleth case on both Map and Globe with strokes as the regression guard.

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


Generated by Claude Code

@coveralls

coveralls commented Sep 7, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.169% (-0.008%) from 84.177% — claude/fix-globe-offscreen-retessellation-GveWO into master

@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 2ddf01b. Configure here.

@greptile-apps

greptile-apps Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change reaches shared layer drawing and terrain rendering.

The continuous dash regression should be fixed before merging.

Findings

  1. P1 Terrain dashes lose continuity ▶

Summary

Adds activateViewport so terrain covers can draw without repeatedly changing a layer's viewport.

  • Terrain cover passes keep draped layers on their screen viewport.
  • Draped terrain render tests cover stroked layers on maps and globes.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Prepare layers with screen viewport] --> B[Build terrain cover]
  B --> C[Skip layer viewport activation]
  C --> D[Draw using Mercator shader viewport]
  D --> E[Draw terrain and screen layers]
Loading

Reviews (6) · Last reviewed commit: "fix(extensions): stop terrain cover pass..." · Reviewed by Greptile

@chrisgervang
chrisgervang force-pushed the claude/test-terrain-extension-globe-GveWO branch from 26792ec to f0f1666 Compare September 25, 2026 17:37
@chrisgervang
chrisgervang force-pushed the claude/fix-globe-offscreen-retessellation-GveWO branch from d150c56 to 02b1a72 Compare September 25, 2026 17:38
Base automatically changed from claude/test-terrain-extension-globe-GveWO to master September 30, 2026 05:41
@chrisgervang
chrisgervang force-pushed the claude/fix-globe-offscreen-retessellation-GveWO branch 2 times, most recently from 342a938 to c888a35 Compare October 3, 2026 22:10
@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Oct 10, 2026
…ir viewport

`LayersPass._shouldDrawLayer()` calls `layer.activateViewport(viewport)` for every
layer it draws. `Layer.activateViewport()` runs `_update()` whenever the viewport
differs from the last activated one, so a layer that is drawn both by an off-screen
pass with one viewport and by the screen pass with another is updated twice per
frame. For layers whose state depends on the viewport (PathLayer re-tessellates when
`viewport.resolution` / projectionMode change) this also calls `setNeedsRedraw()`,
which can keep deck redrawing forever.

Add an opt-out `activateViewport?: boolean` (default `true`) to
`LayersPassRenderOptions`, threaded through `_getDrawLayerParams` into
`_shouldDrawLayer`. The default path is unchanged; passes that render layers with a
viewport other than the one they are drawn to screen with can pass `false` so the
layer's viewport-dependent state stays bound to the screen viewport.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
…layers on GlobeView

A draped PathLayer (e.g. the stroke of a GeoJsonLayer with TerrainExtension) on
GlobeView never settled: deck reported needsRedraw on every frame. The terrain cover
pass draws drape layers with a flat WebMercatorViewport (resolution undefined,
projectionMode WEB_MERCATOR) and the screen pass then draws the same layers with the
GlobeViewport (resolution 10, projectionMode GLOBE); both passes activated their
viewport on the layer, so `PathLayer.shouldUpdateState()` saw the tessellation
resolution flip twice per frame, re-tessellated and flagged a redraw. The redraw
marked the terrain cover dirty (`TerrainExtension.onNeedsRedraw`), which re-rendered
the cover next frame and repeated the cycle.

Render the terrain cover (color and picking) with `activateViewport: false`. Layers
still receive the cover viewport through the `project` shader module props, but their
viewport-dependent state stays bound to the screen viewport: on GlobeView the
globe-tessellated path is drawn into the Mercator cover (extra subdivision vertices
are collinear in Mercator) and Mercator-only state such as dash offsets is computed
for the screen viewport.

Tests: `terrain-extension-drape` is now expanded with `expandViewMatrix` into the
MapView case (golden unchanged) and a fully stroked GlobeView twin
`terrain-extension-drape-globe`, replacing the fills-only
`terrain-extension-drape-fill-globe` workaround case and golden. Before the fix the
stroked globe case hit the screenshot timeout (88 s); after it settles in ~12 s.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
@chrisgervang
chrisgervang force-pushed the claude/fix-globe-offscreen-retessellation-GveWO branch from c888a35 to fc7d857 Compare October 23, 2026 00:29
@chrisgervang

Copy link
Copy Markdown
Collaborator Author

Superseded by #10851, which fixes the cover pass in LayersPass and carries over this PR's stroked GlobeView render case.

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.

3 participants