Skip to content

fix(core): terrain cover passes no longer re-update draped layers - #10851

Open
chrisgervang wants to merge 1 commit into
masterfrom
chr/terrain-cover-auxiliary-pass
Open

chrisgervang wants to merge 1 commit into
masterfrom
chr/terrain-cover-auxiliary-pass

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

For #10850

Background

Terrain covers render into a WebMercatorViewport of their own making, one per terrain tile. LayersPass activated that viewport on every layer it drew, which immediately re-ran Layer.updateState, and the screen pass undid it. A draped PathLayer re-tessellated twice a frame and kept needsRedraw set, so every cover re-rendered forever. Projection uniforms already come from the pass viewport, so layers never needed to adopt it.

terrain-extension-drape-fill-globe with stroked: true, webgl/SwiftShader:

frames to capture needsRedraw duration
before 26, still climbing set from frame 3 on, never clears 43.0 s
after 12 false every frame 12.0 s

A GlobeView + TerrainExtension app containing any PathLayer now reaches idle instead of re-tessellating and re-draping its whole dataset every frame.

Change List

  • LayersPassRenderOptions: add isAuxiliaryPass
  • LayersPass: auxiliary passes skip layer.activateViewport
  • TerrainPass/TerrainPickingPass: mark cover and height-map passes auxiliary
  • Drop a stale comment in the globe drape render case
  • Unit tests

TODO


Note

Medium Risk
Changes when layers see viewport changes during multi-pass rendering; limited to auxiliary passes and terrain paths, but could affect layer update timing if mis-flagged.

Overview
Adds an isAuxiliaryPass render option so offscreen passes (terrain height maps and per-tile covers, including picking) no longer call layer.activateViewport for their transient viewports. Layers keep update/tessellation state tied to the primary screen viewport while projection uniforms still come from the pass viewport, which stops draped layers (e.g. PathLayer on GlobeView) from re-tessellating every frame and leaving needsRedraw stuck on.

Terrain TerrainPass / TerrainPickingPass set the flag on those auxiliary renders. A new LayersPass#isAuxiliaryPass unit test locks in the behavior; the globe terrain drape render test comment is updated to reflect performance-only stroke omission.

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

Terrain covers render into a WebMercatorViewport of their own making, one
per terrain tile. LayersPass activated that viewport on every layer it
drew, which immediately re-ran Layer.updateState, and the screen pass then
undid it. A draped PathLayer re-tessellated twice a frame and kept
needsRedraw set, so every cover re-rendered forever.

Mark the terrain height map, cover and cover-picking passes as auxiliary
so layers keep the update state they have for the primary viewport.
Projection uniforms already come from the pass viewport, so drawing is
unchanged.
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 83.521% (-0.02%) from 83.541% — chr/terrain-cover-auxiliary-pass 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 using default effort 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 b34751e. Configure here.

pass: `terrain-cover-picking-${terrainCover.id}`,
layers,
viewports: [viewport],
isAuxiliaryPass: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Picking covers still activate viewports

Medium Severity

Setting isAuxiliaryPass in renderTerrainCover has no effect because PickLayersPass._drawPickingBuffer rebuilds the options object and omits the flag. Cover picking still calls activateViewport, so a draped PathLayer on GlobeView re-tessellates on hover and can leave needsRedraw set.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b34751e. Configure here.

@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium impact] Adjusts layer update behavior for auxiliary rendering passes.

The PR appears safe to merge, with a non-blocking cleanup issue in the new test.

Findings

  1. P2 Test leaves GPU resources allocated ▶

Summary

Adds isAuxiliaryPass so terrain covers and height maps draw without changing each layer's saved viewport.

  • Terrain passes stop resetting layers to their temporary viewports.

Acknowledged scope:

  • chrisgervang explicitly keeps globe strokes disabled for render-test speed.
  • chrisgervang explicitly leaves per-feature TerrainCover culling untouched and defers applying the flag to MaskPass.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Prepare layers for primary viewport] --> B[Render terrain cover or height map]
  B --> C[isAuxiliaryPass is true]
  C --> D[Skip layer.activateViewport]
  D --> E[Keep primary layer geometry]
  E --> F[Draw using pass projection uniforms]
  F --> G[Render primary view]
Loading

Reviews (1) · Last reviewed commit: "fix(core): terrain cover passes no longe..." · Reviewed by Greptile

Comment on lines +686 to +690
renderOnce(auxiliaryViewport, false);
expect(
layer.state.tessellationResolution,
'a primary pass still re-tessellates on viewport change'
).toBeUndefined();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Test leaves GPU resources allocated

The new test initializes a PathLayer but never calls layerManager.finalize(). Its model and attribute buffers stay allocated on the shared test device. Wrap the test body in try/finally and finalize the manager so resources are released even when an assertion fails.

This branch has not been deployed

No deployments
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.

2 participants