Conversation
…eadback error handling - Add terrainReadbackEnabled (default true) and terrainReadbackIntervalMs (default 0) params; terrainReadbackTask no-ops when disabled and throttles by wall-clock interval using task-local state (no module scope). - triggerSnapshotReadback / CpuTerrainCache.triggerReadback return whether a readback was scheduled so the throttle timestamp only advances on real work. - Catch readback failures on both the pooled and getArrayBufferAsync paths: reset readbackPending, never swap buffers, retry on next run, and log each distinct error once per snapshot state. - React: terrainReadback / terrainReadbackIntervalMs options on useTerrain and <Terrain>, wired through useTerrainParams. - Tests for the gating helper, the snapshot failure path, and the React option mapping. - Docs: Controlling readback section, params/useTerrain tables, topology link, changelog entry. - Bean hello-terrain-essk marked completed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The GPU→CPU elevation readback ran unconditionally and any readback failure went unhandled (
readbackPendingcould stick, buffers could half-swap).terrainReadbackEnabled(defaulttrue) andterrainReadbackIntervalMs(default0), exposed as ReactTerrainprops /TerrainOptions.terrainReadbackTaskkeeps per-instance throttle state in its own returned value (no module-scope state); gating logic is a pureshouldScheduleReadback()inquery/readback-schedule.tswith unit tests.triggerSnapshotReadbacknow returns whether a readback was scheduled,.catches both the device andgetArrayBufferAsyncpaths, never swaps buffers on failure, resetsreadbackPending, resets the stamp so the next run retries, and logs each distinct error once.{ valid: false }/null, raycast falls back to bounds-only picking, LOD uses the datum surface (documented).Verification
memocache the task body would not re-run when upstream deps were stable, so a throttled/pending-skipped readback could stall until the next dependency change. Fixed by marking the task.cache("none")(its body is a few comparisons when nothing needs scheduling;prevstill flows viatask.value).Notes
hello-terrain-essk.Made with Cursor