Repository navigation
fix(core): terrain cover passes no longer re-update draped layers - #10851
chrisgervang wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort 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 b34751e. Configure here.
[Medium impact] The PR appears safe to merge, with no outstanding findings. SummaryThe PR keeps terrain passes from repeatedly updating draped geometry, while preserving needed coordinate conversions and matching clip bounds to the viewport being drawn.
Reviews (7) · Last reviewed commit: "test: describe globe terrain render gold..." · Reviewed by Greptile |
ibgreen
left a comment
There was a problem hiding this comment.
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.
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.
65e4207 to
db9a8cd
Compare
ibgreen
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
athomct
left a comment
There was a problem hiding this comment.
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.

For #10850. Supersedes #10669.
Background
Terrain covers render into a
WebMercatorViewportof their own making.LayersPassactivated it on draped layers, re-runningupdateState, and the screen pass undid it. UnderGlobeViewthe subdivision step flips every frame, so drapedPathLayerand (since #10874)SolidPolygonLayerre-tessellate and re-render every cover forever.Once layers stop adopting the cover viewport, anything that projects on the CPU during
drawhas to use the viewport being drawn.ClipExtensiongeometry mode was projecting its bounds with the screen viewport.terrain-extension-drape-globe, webgl/SwiftShader:Change List
LayersPassRenderOptions: addisAuxiliaryPassLayersPass: auxiliary passes skiplayer.activateViewportPickLayersPass: forwardisAuxiliaryPassto picking buffer rendersTerrainPass/TerrainPickingPass: mark cover and height-map passes auxiliaryClipExtension: project geometry-mode bounds with the viewport being drawnterrain-extension-drape-globecase 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 WebGPUTODO
TerrainCoverculling (second bug in [Bug] TerrainExtension drape: draped layers never settle, and every cover draws every feature #10850).MaskPassbuilds its own viewport too and may want the flag.Note
Medium Risk
Modifies viewport activation conditions in core layer rendering passes and updates viewport resolution for clip extension bounds calculations.
Overview
Adds an
isAuxiliaryPassflag toLayersPassandPickLayersPassto prevent auxiliary rendering passes—such as terrain covers and height maps—from triggeringlayer.activateViewporton draped layers. This resolves an issue where draped layers underGlobeViewcontinuously re-tessellated and redrew every frame due to alternating viewport state between the primary screen view and auxiliary passes.Auxiliary passes now check
getPreprojectionSignatureand only activate the viewport if the layer requires different attribute preprojection for that pass.Updates
ClipExtensionand 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