The Shore yard times the island's rebuild, and the rebuild builds each layer's buffers directly #131
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/3610-every-drawn-land-layer-lies-on-the-land"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tracker: #3610
Step 4a of plan #3558. It gives the coast work of #3620 and #3621 its instrument and room inside its cost budget. Nothing a player sees changes, so there is no changelog entry.
presentSurfacemakes that the coast work changes:landLoops,buildSurfacewith the Toybox look's ground materials, and the shore field's update and upload, then one render. It runs 3 warm-up rebuilds, times 15 as one span, and reports the mean and each part's mean indata-rebuildand in its text. Its shore field timings stay as they are.buildSurfacebuilds each layer's buffers directly (src/client/render/island.ts). The flat caps (land and woods) are triangulated with Earcut on flat arrays, and the bank strips and highway ribbons are written straight into one buffer per material, with no per-run geometries and nomergeGeometries. It draws the same triangles.WOODS_SHADEmoves from view.ts to ground.ts, so that the yard draws the woods with the view's shade.Evidence
Same geometry. In Node at 256², Lakes 0.25, seeds 11 and 42, the head's
buildSurfacegives the same three meshes as main's, with the same positions, colours and index buffers bit for bit. Seed 11 has 32,994 grass, 4,766 woods and 49,532 road triangles, 87,292 in all. Cap normals differ by 6e-17, because main's rotated ShapeGeometry left that much in z. Bank normals differ by up to 2.7e-4, because main accumulated them in float32 and the head accumulates them in float64.The rebuild's cost in the Shore yard, Playwright WebKit (iPhone 15 landscape), on s32. Each arm ran 5 sessions of 7 runs, interleaved with the other. Each figure is the median of the runs' means in ms:
672fc28The phone estimate is 7.5 × −9.86 = −74 ms per rebuild. Every session's median lies within 0.2 ms of the overall figure. The shore field's own timings are unchanged on both arms (first build 26 ms, reveal 0.7 ms). Main's arm is the head's src/mock/shore.ts over main's modules, built from a
git archiveof672fc28. Its only change is that the yard definesconst WOODS_SHADE = 0.9itself, because main's ground.ts does not export it.Map Yard renders, main against the head, in every finish at 1× and 0.5× under reduced motion. Triangle counts are equal. Two loads of main differ from each other in 39–52k pixels, so the comparison counts only pixels two loads of main agree on. A third load of main changes 5,955–9,162 of them, and the head changes 5,676–9,188. That is load-to-load noise, so the renders do not change.
The seed search ends. In a scratch vitest run with
generateIslandmocked to always throw a collapse, the test fails in 0.4 s with "64² landform 0 lakes 0: 0 of 8 maps in seeds 1–16". The search before the bound was still running at 2 minutes with nothing printed past RUN. With a TypeError at seed 3 alone, the test now fails with that TypeError, where before it passed. Unmocked, both versions pass.