Skip to content

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

Open
chrisgervang wants to merge 8 commits into
masterfrom
chr/terrain-cover-auxiliary-pass
Open

chrisgervang wants to merge 8 commits into
masterfrom
chr/terrain-cover-auxiliary-pass

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

For #10850. Supersedes #10669.

Background

Terrain covers render into a WebMercatorViewport of their own making. LayersPass activated it on draped layers, re-running updateState, and the screen pass undid it. Under GlobeView the subdivision step flips every frame, so draped PathLayer and (since #10874) SolidPolygonLayer re-tessellate and re-render every cover forever.

Once layers stop adopting the cover viewport, anything that projects on the CPU during draw has to use the viewport being drawn. ClipExtension geometry mode was projecting its bounds with the screen viewport.

terrain-extension-drape-globe, webgl/SwiftShader:

before after
fills only still dirty at frame 25 settles at frame 10
fills + strokes 34.1 s, still dirty at frame 21 13.3 s, settles at frame 12

Change List

  • LayersPassRenderOptions: add isAuxiliaryPass
  • LayersPass: auxiliary passes skip layer.activateViewport
  • PickLayersPass: forward isAuxiliaryPass to picking buffer renders
  • TerrainPass/TerrainPickingPass: mark cover and height-map passes auxiliary
  • ClipExtension: project geometry-mode bounds with the viewport being drawn
  • Render test: new terrain-extension-drape-globe case strokes and waits until deck stops requesting redraws, so a cover pass that re-tessellates times out (WebGL only); the fill-only globe case stays for WebGPU
  • Unit tests
  • Render tests

TODO


Note

Medium Risk
Modifies viewport activation conditions in core layer rendering passes and updates viewport resolution for clip extension bounds calculations.

Overview
Adds an isAuxiliaryPass flag to LayersPass and PickLayersPass to prevent auxiliary rendering passes—such as terrain covers and height maps—from triggering layer.activateViewport on draped layers. This resolves an issue where draped layers under GlobeView continuously re-tessellated and redrew every frame due to alternating viewport state between the primary screen view and auxiliary passes.

Auxiliary passes now check getPreprojectionSignature and only activate the viewport if the layer requires different attribute preprojection for that pass.

Updates ClipExtension and projection utilities to compute clipping bounds against the viewport being actively drawn (shaderModuleProps.project.viewport) rather than the layer context's primary viewport, ensuring correct clip uniforms in auxiliary passes.

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


Generated by Claude Code

@coveralls

coveralls commented Oct 11, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.839% (-0.006%) from 82.845% — 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.

@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with no outstanding findings.

Summary

The PR keeps terrain passes from repeatedly updating draped geometry, while preserving needed coordinate conversions and matching clip bounds to the viewport being drawn.

  • Terrain passes keep compatible layer geometry on its primary viewport.
  • Clip bounds follow the viewport used for each draw.

Reviews (7) · Last reviewed commit: "test: describe globe terrain render gold..." · Reviewed by Greptile

@chrisgervang chrisgervang mentioned this pull request Oct 22, 2026
53 of 66 tasks
@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Oct 22, 2026

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I reviewed this against the stated goal of preventing terrain cover passes from re-updating and re-tessellating draped layers. I agree with the open review findings: please forward isAuxiliaryPass through the picking-buffer options as well, otherwise hover/picking still activates the transient viewport and reproduces the churn; and finalize the layer manager in the new regression test so shared GPU resources are released even on assertion failures. Until the picking path is covered, I would not recommend approval because the main behavior is still incomplete.

Comment thread modules/core/src/passes/layers-pass.ts Resolved
@chrisgervang
chrisgervang requested a review from ibgreen October 24, 2026 00:29
Comment thread modules/core/src/passes/layers-pass.ts Resolved
chrisgervang and others added 6 commits November 4, 2026 13:12
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.
PickLayersPass._drawPickingBuffer rebuilt the render options and dropped
the flag, so TerrainPickingPass set it to no effect. Also finalize the
layer manager in the regression test, and key it off subdivisionStep now
that GlobeViewport subdivides only when given a resolution.
Under a custom projection a web mercator terrain cover needs positions
packed as WGS84, not in the custom CRS. Compare preprojection signatures
and only skip activation when packing is unchanged.
… drawn

Auxiliary passes such as terrain covers no longer adopt their viewport, so
projectPosition's default (the layer's retained viewport) gave globe-space
clip bounds while the cover draws in web mercator.
Rename terrain-extension-drape-fill-globe to terrain-extension-drape-globe,
add strokes back, and wait for a frame that requests no further redraw. A
draped PathLayer that re-tessellates on every frame now times out instead
of being captured mid-loop.
@ibgreen
ibgreen force-pushed the chr/terrain-cover-auxiliary-pass branch from 65e4207 to db9a8cd Compare November 4, 2026 18:17

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The auxiliary pass regression tests check both relevant paths: retaining the screen viewport for draped layers and adopting the auxiliary viewport for layers that require it. They also verify that clipping still uses the viewport being drawn. I found no blocker in this pass.

@ibgreen ibgreen added the bug label Nov 21, 2026
@chrisgervang
chrisgervang requested a review from ibgreen November 21, 2026 16:24

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

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

The change looks correct to me. All earlier bot and review points are fixed at the head.

Rebase on master. There is a conflict in modules/extensions/src/utils/projection-utils.ts, next to the new viewport field.

@chrisgervang chrisgervang mentioned this pull request Nov 24, 2026
29 tasks

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants