Repository navigation
TrailView: the crop rows list their cells in view first - #3794
Merged
Merged
Conversation
The rows ran one workgroup of 256 lanes per base cell of their 2 km window, and 255 lanes waited while one tested the cell: about 1 ms per run on the M1 Pro, also where no cell is in view. find_rows now tests each cell on one thread and lists the cells in view; plantings runs one workgroup per listed cell, as the forest does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 8 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
timohueser
marked this pull request as ready for review
November 21, 2026 21:48
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Mode: change #3787
Requirements: none
Public docs: no
Closes #3787
What changed
The crop rows (
vegetation/rows.wgsl) ran one workgroup of 256 lanes per base cell of their 2 km window, about 6,400 workgroups. In each, 255 lanes waited while one lane tested the cell. That cost about 1 ms per run on the M1 Pro, also where no cell was in view.find_rows(new) tests each base cell on one thread, with the same tests as before (reach, ground height, frustum, depth of the last frame). It lists the cells in view with their ground height, asfind_cellsof the forest does.plantingsruns one workgroup per listed cell, through an indirect dispatch. From the crop sample on, it does not change.rows.tsholds one list per view (eye and sun), sized for the window at the highest latitude of the bounds: 0.2 MiB in all at 47° N.updateresets each list once per frame.engine.tspasses the config toRowsfor the bounds.The proof that nothing moved
A one-off script copied the staged instances out of the GPU after the view was idle and 20 more frames: the eye's view, then the near and the far shadow map, each redrawn on its own. Views: the starts of the walk, the valley drive, the zoom-out and the bridge and tunnel, at their heading and at +180°. Builds of develop 4a54190 and of this branch against
obc data serve(Central Switzerland). The comparison is of the instances as multisets: the order in a list depends on the GPU's atomics.tier=phone), develop against branch* Central Switzerland has no crop rows in the data: with develop, the rows alone stage no instance in any view. For this check the served rules give grassland, pasture and rough grass the vineyard's rows with a reach of 500 m, in both builds.
The far map differs between two runs of develop too. Its differences are in tree draws, and with the rows alone it is equal. Screenshots of the same views differ between develop and the branch by no more than between two runs of develop (at most 0.09 % of the pixels by more than 8 levels, at the same views).
Measurement
M1 Pro, headless Chromium on Metal, the turn (360° in 8 s) and the flight of the walk and the valley drive, develop and the branch in turn, two rounds. Medians over the frames that ran the pass, ms. The load average was 6 to 45: another job ran on the machine.
vegetationdevelop → branchcasterstier=phoneThe far map draws 1 to 14 times per run, so its totals are noisy under the load (2.6 to 13 ms in both builds). In the runs with one pass per dispatch, its rows took 1.72 to 1.80 ms on develop (once 3.28) and 0.78 to 1.33 ms on the branch (the cell search 0.02 to 0.1 ms, once 0.62).
iPhone 13
The owner ran the TrailView Proto app (the prototype branch with this change merged and a throwaway switch
rows=gridfor develop's grid; not pushed), preset P (tier=phone), 12 runs in one session: grid, then cell list, in the full turn, the look about and the walk, then the cell list first and the grid last. Medians over the timed frames of each run, ms:vegetationcastersfar-castersterrainvegetationpass falls from 4.7 to 7.1 ms to 2.0 to 2.5 ms, about 2.7 to 4.6 ms less (55 to 65 %). The near shadow map's run falls from 3.9 to 9.0 ms to 1.4 to 2.5 ms; the far map's from 9.2 to 17.7 ms to 5.6 to 11.7 ms.Review
One review round (verdict: mergeable), two small findings, both fixed in the last commit:
Math.min(this.most, …)), so the list holds every cell and no near rows drop at random. Inside the bounds this changes nothing.Checks
npx vitest run src/lib/trailview: 489 passed.npm run check: 0 errors, 0 warnings.npm run check:wgsl: rows.wgsl validates.obc test affected; CI runs them.🤖 Generated with Claude Code