garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/notes/render-performance-survey.md

raw


topic: render-performance-survey triggers: [grid.rs, patches.rs, kerb_shadows.rs, KerbPiece, "kerb", split_by_upload_bytes, terrain_refine::weld, "street level is slow", ground_detail.rs, wet_surfaces.rs, street_labels.rs, map_stream.rs, systems/dev/perf.rs, "rotate the camera", "turning", "turn window", material_modified_per_frame, get_mut, StreamCentre, orbit_focus, sample_to_callgrind, kcachegrind, qcachegrind, "sample(1)", CARTO_MSAA, light_shafts, macOS, Metal, Retina, write_buffer, StagingBuffer, "batch set", GLOBE_SKY_SAMPLES, ShotMetrics, render_census, "draw call", "overdraw", "clipmap", "SIMD", big_space, "frame time", "profiling", "perf", "framerate", "fps", occluded_by_finer, "tier", quality.rs, Adreno, "gpu preprocessing", bindless, "task pool", ComputeTaskPool, CARTO_NO_CLOUDS, globe_clouds, "clouds", "slow at altitude", "fps drops when zoomed", fbm3, "shadows", "shadows are slow", ShadowFilteringMethod, NotShadowCaster, NoFrustumCulling, shadow_casters, shadow_distance_m, shadow_cascades, CascadeShadowConfigBuilder, CARTO_NO_SHADOWS, "moon shadow", CARTO_NO_LIGHT_SHAFTS, CARTO_NO_STREET_LABELS, CARTO_OCCLUSION_CULLING, CARTO_DBG_HIDE, StreetLabelSign, street_labels.rs, "mac-2", "M5 Pro", "cascades", "turn is slow", "shadow map size", CARTO_SHADOW_MAP] updated: 2026-11-26

Where the frames go, and where they do not

A ten-lens survey of the client's render cost, 2026-08-16. Most of what follows is negative results — directions that look obviously worth taking and are not. Those are the expensive part to rediscover, so they are the part written down. What was found and fixed is in the commits; this note holds the standing facts around them.

The instrument, and what it may be trusted for

ShotMetrics carries draws, tris_total, tris_shadow, the four per-streamer triangle splits, tiles_occluded, worker_outstanding, frame_ms and frame_ms_max. systems::render_census computes the first group for both the shot harness and log_render_cost's five-second line.

The split that matters is workload versus machine.

MetricTrustworthy in this containerGate on it in CI
draws, tris_*, tiles_occludedYes — a property of what the client selected. Culling, LOD and visibility run the same code on lavapipe as on an AdrenoYes, as an absolute ceiling
mesh/image/material asset countsYesLeak-shaped rather than cost-shaped
Allocation counts (crates/geo/src/perf_budgets.rs)Yes — bit-identical over three runsAlready gated
worker_outstandingTiming-dependentNo — report only
frame_ms, frame_ms_maxWeak relative signal within one run on one machineNo
elapsed_gpu from RenderDiagnosticsPluginNo — CPU rasteriser time wearing a GPU labelNo. This is theatre

Two limits are structural and documented at the fields. Triangle counts read 0 for anything uploaded RENDER_WORLD-only — tiles, globe, transit — because the main world no longer holds the geometry, so on the globe tier draws is the only column carrying meaning. And worker_outstanding is sampled at the settle verdict, not the shutter, because the harness quiesces the pool between them.

frame_ms was clipped at both ends until 2026-08-16: it accumulated Res<Time>, whose delta Bevy clamps at max_delta (0.25 s), so on any renderer slower than four frames a second it read exactly 250.0 for every scene, while frame_limiter floored it at the tier's cap from the other side.

Reference measurements

Lavapipe, 640×360, Groningen, dev profile, 2026-08-16. Frame times are the CPU rasteriser's and are not comparable to a device; the counts are exact.

Viewpointdrawstiles_occludedframe_ms
2000 km orbit, straight down940352
3 km, −30°367 (was 401)341082
150 m, −20°65370971
3 km, −30°, CARTO_QUALITY=phone209—491

Correction: the 2026-09-22 Deck runs had three effects switched off (2026-09-30)

Every deck-1 figure dated 2026-09-22 below was measured with shadows, light shafts and sky lighting all off. Those runs set no CARTO_DATA_DIR, so the client read the Deck bot's own user.json, which has all three switched off. The mechanisms below still hold. The absolute figures describe that configuration, not the default. In particular, "CARTO_NO_SHADOWS moves nothing" was measured with shadows already off.

Re-run 2026-09-30 at 636c6c5 with a fresh data directory (same setup otherwise, every steady window quiet=true, one run per row; repeats agreed within 0.3 %):

city, steadyframesubmit_pending_command_buffers
defaults (desktop tier)29.9 ms12.6 ms
sky lighting off12.4 ms2.4 ms
shadows off (light shafts go with them)25.3 ms6.7 ms
light shafts off26.1 ms9.8 ms
sun rays, bloom, anti-aliasing, or CARTO_NO_CLOUDS~30 ms each—

Orbit: 25.3 ms with defaults, 10.4 ms with sky lighting off. The same comparison at 917a2f6, the 2026-09-22 commit, gives 31.4 ms against 12.1 ms, so no commit made this slower: it was always the default cost.

Sky lighting (AtmosphereEnvironmentMapLight) is about 17.5 ms of a 30 ms frame. Bevy re-renders the sky cubemap and re-filters it into the diffuse and specular maps every frame. It is GPU time that the render thread waits for inside submit_pending_command_buffers. None of it appears in RenderDiagnosticsPlugin's pass list: bevy_pbr opens lightprobe_* spans, and they never reach DiagnosticsStore. The shadow passes are also missing from that list. So the "measured GPU passes" column cannot see the largest cost in the frame. systems::sky_bake re-bakes only when the sun, the moon or the camera's place in the atmosphere has moved.

On an M5 Pro the street frame is the shadow cascades, and the names on the road (2026-11-10)

mac-2 (Apple M5 Pro, a midas VM with a paravirtual GPU, shared with the other VM on the same mini), dev profile, --features perf, 1600×900, desktop rung, CARTO_FPS_CAP=0, a fresh CARTO_DATA_DIR, two flights per row unless stated, every steady window quiet. No per-pass GPU time exists on this backend (above); what the per-system table gives instead is submit_pending_command_buffers, which on Metal is the render thread waiting for the GPU, so it is read here as the GPU's share of the frame. Launch-to-launch drift was ±2–3 ms on the same configuration (street baselines of 46.4, 43.5, 46.5 ms across the evening), so a row is a finding only when its range clears the baseline's.

steadyframeof which GPU waitdrawsentities
orbit17.9 ms7.02972.3 k
low-orbit18.57.63152.3 k
city (3 km)19.77.93543.6 k
earth24.7—24347.3 k
street (120 m)46.425.643218.2 k

Away from the ground the frame is the render thread's CPU (render_system ~9 ms of which the GPU wait is 7, write_binned_instance_buffers 3.1 ms), as the Metal section below found. At street level it is the GPU, and the GPU is drawing shadows. Switches at street, same binary, one launch per row:

street, steadyframeGPU waitwhat it says
defaults (4 cascades to 1.5 km)46.4 ms25.6
CARTO_NO_SHADOWS (shafts go too)21.39.4shadows are 25 of 46 ms
3 cascades39.017.2(against a 43.5 baseline that evening)
2 cascades32.110.7the two outer cascades are ~14 ms
2 cascades, shafts off32.010.1the shafts cost nothing once the cascades are two
CARTO_NO_LIGHT_SHAFTS alone40.918.7~3 ms; the march's cost is its shadow-map reads
CARTO_SHADOW_DISTANCE=60040.820.6against 41.4: the reach moves nothing though casters fell 4304 → 2947
3 cascades to 1 000 m (the balanced rung's shadow geometry)35.912.8against 41.4: the cascade count again, not the reach
CARTO_SHADOW_MAP=102447.824.6against 45.2: a quarter of the texels, no time back
CARTO_SHADOW_MAP=409645.322.1against 45.2: four times the texels, free — a quality lever on this GPU, at 256 MB of maps for four cascades
CARTO_NO_STREET_LABELS39.316.6against 43.5: the 160 name quads were 4–6 ms
CARTO_DBG_HIDE=kerb,furniture41.522.9against 46.5: the furniture ~5 ms, the kerbs none of it
CARTO_DBG_HIDE=kerb47.026.8against 46.5
CARTO_DBG_HIDE=canopy,trunk45.825.52 500 fewer draws, no time back
CARTO_DBG_HIDE=paving,built45.426.3~11 M ground triangles, no time back
CARTO_MSAA=143.724.8within drift
CARTO_MSAA=443.926.8within drift: 4× is free here (city: 16.2 against 19.7)
CARTO_RENDER_SCALE=0.549.023.7not fill (or the scale does not reach an offscreen target — still open)
CARTO_DEPTH_PREPASS=155.523.3a second geometry pass, as predicted for a desktop GPU
CARTO_OCCLUSION_CULLING=1 (bevy's two-phase, needs the prepass)59.427.8worse again; a city seen from 120 m hides little behind itself
CARTO_QUALITY=balanced CARTO_HANDSET=1 (the phone's own rung)40.418.3and 37.1 with CARTO_DEPTH_PREPASS=0: the prepass costs 3 ms here too

Three things follow, and the third is the one to carry.

Taken (2026-11-11): the desktop rung draws three cascades on a 4096² map, and 4× multisampling on Metal. Both sides explicit (CARTO_SHADOW_CASCADES, CARTO_SHADOW_MAP, CARTO_MSAA), one launch per row, street / city steady, with the GPU wait in brackets:

streetcity
4 cascades, 2048², 2× (as it was)42.7 ms (21.6)19.5 (7.7)
3 cascades, 4096², 2×41.6 (19.1)19.2 (7.1)
4 cascades, 2048², 4×44.1 (23.0)21.0 (8.2)
3 cascades, 4096², 4×41.4 (18.4)21.1 (8.2)
the new defaults, nothing set34.5 (13.2)21.0 (7.8)

Read with the evening's other rows: the cascade step gave 4.5, 5.5, 1.1, 1.3 and 8.2 ms across five launches, and a lower GPU wait in every one. The host drifts ±3 ms between launches of one configuration, so the claim is the direction and the GPU wait, not a number. The texels: ~3, 15 and 73 cm against ~6, 17, 50 and 150 cm, for 192 MB of maps against 64. Captures of the two configurations at 120 m, 40 m and eye level differ in the moving traffic and in shadow edges only — and, in two of three pairs, in the colour of the street itself, which the change cannot have touched: the Rodeweeshuisstraat came up as pale asphalt in one settled capture and as red-brown paving in the next, in either order of the two configurations. A street has two steady states between identical launches, which reads as a race between the paving data and the road's tessellation in the cell build (map_geometry, road_texture). Not chased here; a capture-based A/B of anything on the ground has to allow for it.

Turning at street level is still the materials. The turn window was 73 ms a frame against 46 standing, worst 174 ms: prepare_material_bind_groups 29 ms/frame, update_street_labels 8 ms (main world), 6.5 materials modified a frame. With the names off the bind-group work was 12 ms; with the fix above and the names on, 20. What remained was the re-dealing of names to signs as the view turned — each a texture swap on one of 160 materials, each a bind group — and the materials the streaming of new cells brings.

Taken (2026-11-11): the names live in one atlas (systems::label_atlas, cartopolis_materials::label_sign). One material and one two-channel texture for the whole pool, a slot per sign, written slot by slot from the render world with Queue::write_texture; a sign taking a new name is a MeshTag and a region write, and no material or mesh changes. street turn, three flights: prepare_material_bind_groups 22.2 → 12.5 ms a frame (the names-off floor was 12.2), material_modified_per_frame 6.5 → 3.6, the turn's mean frame 53.4 → 48.6 ms. What is left in those 12 ms is the materials new cells bring while the view turns — bevy's per-material preparation on Metal, which has no owner yet — and update_street_labels itself still averages ~8 ms a frame of main world through a turn (the placement, every 20° of yaw), beside the render thread rather than on its path.

Negative, and measured here so nobody re-opens them first: the globe cloud shell at orbit (CARTO_NO_CLOUDS: 18.1 against 17.9 ms — it was 71 % of the Deck's GPU frame, and is nothing here); a VisibilityRange of 300 m on the kerb pieces (43.5 against 42.5 ms off, three flights each — a kerb piece is a Hilbert patch hundreds of metres across, so only ~40 of ~4 300 pieces left the view, and the kerbs cost nothing here anyway); the depth prepass and occlusion culling on anything but a handset.

What this machine cannot say. It is a VM: the GPU is paravirtualised and shared, there are no Metal counters, and the dev profile keeps debug assertions. The ratios between rows of one evening are sound; the milliseconds are the box's. The phone's question — whether the depth prepass pays on an Adreno 840 — is unanswered by any of this and needs debug.carto.depth_prepass on the device.

At street level the ground is tens of millions of vertices (2026-10-20)

deck-1, 1280×800, desktop rung, fresh CARTO_DATA_DIR, cargo perf --only street --repeat 2. The main pass shaded 2.5–3.0 M fragments for 1.0 M pixels and took 22 ms, while the nine map_geometry cells around the camera held (per-group totals from a temporary log in stand_on_terrain):

groupverticestrianglescasts
Furniture (parked cars are most of it)9.4 M4.8 Myes
Paving8.9 M5.3 Mno
Built5.8 M2.8 Mno
Canopy + Trunk1.4 M1.6 Myes

Geometry was 1.75–1.96 GB of the street view's ~2 GB residency. Two causes, both fixed without changing a pixel:

Measured with the web-release profile (the dev profile's debug assertions distort every CPU number here), main → this change, two flights each:

streetmainafter
steady frame54.7 ms50.8 ms
main_opaque_pass_3d21.5 ms19.3 ms
GPU residency2.16 GB1.81 GB
settled in57.0 / 54.6 s53.2 / 49.7 s

Before/after captures differ only in the drifting clouds and the moving traffic.

The street load was the road cut: a sampling profile of the optimised build (pprof, added for one run; perf_event_paranoid is 2 on the Deck and blocks samply) put road_stitch::cut_ribbon_inner at 62 % of worker time against 7 % for the refinement. In the dev build the refinement looked like the wall instead (hashing its edge keys byte by byte was 11 % on its own, fixed with terrain_refine::Words) — profile the optimised build. Fixed by cutting against the sheets as laid (tile-pipeline-stage-costs.md); settle, web-release, two flights each:

settled inmainafter
street57.0 / 54.6 s29.4 / 29.4 s
city78.8 / 33.2 s27.5 / 15.0 s
Earth61.6 / 42.5 s28.1 / 19.8 s

The street frame is geometry, and most of it is shadows (same setup, 2026-10-20). 640×400 against 1280×800 puts ~34 ms of the 53.6 ms frame in work that does not scale with pixels and ~19 ms in work that does; of main_opaque_pass_3d's 22.2 ms, ~10 is fixed. CARTO_NO_SHADOWS=1 takes the frame to 24.3 ms (light shafts go with it), two cascades to 46 ms. By caster class (dev build): street furniture ~13–20 ms, trees ~1 ms. Furniture is mostly kerbs — 40–66 k boxes a cell, against ~1,200 parked cars (~200 k triangles) and ~1,500 lamps (~55 k) — and leaving the kerbs out entirely took the frame from 49.8 to ~33 ms. Emitting them in curve order (as the street objects already were) took 53.3 → 49.8; the rest is the outer cascades, where a 10 cm kerb is a fraction of a texel (~35 cm at cascade 2, ~1 m at 3) and draws nothing anyone can see. So the kerbs are their own group now (SurfaceGroup::Kerb, furniture in every other respect) and only the pieces that can reach the two near cascades cast (systems::kerb_shadows): street steady frame 49.9 → 41.8 ms (dev build, quiet windows only), captures at 20 m and 120 m unchanged but for the walkers. Not taken: a depth prepass would cut the 3.2× overdraw but add a second geometry pass to a frame that is geometry-bound. Taken on a handset (2026-11-08), whose frame is fill: depth-prepass-on-the-handset.md.

At the Deck's own size the light shafts were the frame (2026-10-19)

The table above is at 640×360. Re-run on deck-1 at 1280×800, the Deck's own panel, desktop rung, fresh CARTO_DATA_DIR, --perf --repeat 2, every steady window quiet=true. Light shafts were split from shadows with a throwaway switch (shafts follow shadows, so CARTO_NO_SHADOWS takes both).

steady framecity (3 km)street (120 m)
defaults27.8 ms65.3 ms
light shafts off10.6 ms47.7 ms
shadows and shafts off13.7 ms28.3 ms
shafts off, 2 cascades11.6 ms41.4 ms
shafts off, fast shadow filter10.9 ms47.3 ms
sky lighting off26.6 ms61.8 ms

What was taken: the march itself (assets/shaders/patched/bevy_pbr_volumetric_fog.wesl, 2026-10-20). Bevy spends all 48 steps on every ray, and then marches every ray again for volumetric point lights — this app has none, but that second march is where the returned background transmittance comes from, so it always ran. The patch steps in proportion to the ray's length (no ray coarser than the longest always was), replaces the second march with its closed form when the density is constant, and samples the air's dimming of the sun at the ray's two ends instead of every step. light_shafts::altitude_factor fades the density out between 300 m and 600 m, where the volume's floor rises above anything that casts, and the shader returns before marching at zero density. Same setup:

steady framecity (3 km)street (120 m)orbit
before32.8 ms65.8 ms17.3 ms
after13.2 ms53.6 ms17.1 ms

Before/after captures at 25 m into a low sun, 120 m and 3 km match within the moving traffic and clouds; at 3 km the frame is ~1–2 % lighter, the veil gone. What remains at 120 m (~6 ms) is the shadow-map sample per step. A reduced-resolution march would take most of that, but bevy's node renders at the main pass's size, so it needs the node, not only the shader.

On a real GPU the frame is none of the things this note was optimising (2026-09-22)

Everything above was measured on the container's CPU rasteriser, where the table says not to read a millisecond. deck-1 is an AMD Van Gogh with Vulkan timestamps, so elapsed_gpu there is a real GPU number and the whole suite was re-run on it. Dev profile, default 640×360, tiles from tiles.cartopolis.org, every steady window quiet=true.

scenarioframefpsdrawsentitiesmeasured GPU passesunaccounted
orbit (180 km)8.95 ms11214911094.11 ms4.84 ms (54 %)
low-orbit7.82 ms1281069854.03 ms3.79 ms (49 %)
city (3 km)14.41 ms6952222954.00 ms9.73 ms (72 %)

Measured GPU pass time is the same 4 ms in all three. Three scenes differing by 5× in draw calls cost an identical amount of instrumented GPU work, while the unaccounted remainder tracks the scene. Whatever sets a frame here is not in a pass the instrument can see.

Three candidates were eliminated, each by an A/B on that hardware

That last one is worth stating plainly because this note's "not done, and it is the big one" is shadow-map caching. On this hardware, at these scenarios, caching every cascade perfectly would buy nothing. It may still be the big one on an Adreno, which has a fraction of the fill rate and where the note's phone figures were never taken — but it is not what a Deck frame is made of, and the claim should not be repeated without a device measurement behind it.

What the remainder does correlate with

scenariounaccountedentitiesµs per entity
orbit4.84 ms11094.36
low-orbit3.79 ms9853.85
city9.73 ms22954.24

Not draws, not pixels, not shadows — entity count, at a near-constant ~4.2 µs each. Beside it, process_cpu_percent is flat at 21–23 % across all three while the frame varies by a factor of two: on eight cores that is roughly two busy threads and six idle, which is what a single-threaded bottleneck looks like rather than a machine out of capacity.

Three points is a correlation and not a cause, and it is deliberately not written up here as one. The honest statement is that the cost scales with how many entities the main world holds, and that nothing in the render passes explains a frame.

The per-system profiler cannot be reached, and fails silently

bevy/trace and bevy/debug are both already in the perf feature, so the spans exist and their names resolve. Collecting them is the problem: bevy/trace_chrome lives inside LogPlugin, and lib.rs disables LogPlugin on desktop in favour of this tree's own tracing_subscriber. Building with the feature therefore succeeds, runs, and writes no trace file at all — no warning, no error, one full client rebuild to discover.

Reaching those spans means installing a chrome layer on our subscriber under the perf feature, which needs tracing-chrome as a direct dependency (it is not in Cargo.lock today, not even transitively). That is the next step for anyone continuing this, and it is the step that turns the correlation above into a name.

The missing 10 ms is CPU work on the render thread (answered 2026-09-22)

The per-system profiler below settled it. Per-system spans, split into 100-frame buckets so a streaming cost cannot be read as a frame cost — city on deck-1, Main::run_main counted once per frame:

systemstreaming (frames 200–299)settled (frames 1600–1699)
bevy_render::run_render_schedule46.8 ms/frame14.6 ms/frame
bevy_render::renderer::render_system13.36.8
bevy_app::main_schedule::Main::run_main192.05.9
bevy_core_pipeline::schedule::camera_driver5.84.0
write_binned_instance_buffers<Opaque3d, MeshPipeline>4.52.4
submit_pending_command_buffers6.42.3
prepare_preprocess_bind_groups3.11.6
main_opaque_pass_3d—0.9
map_geometry::update_map_surfaces170.4absent from the top 12

The render schedule is the critical path and the main world is not. Settled, run_render_schedule is 14.6 ms against a 14.4 ms frame, while the whole main-world schedule is 5.9 ms — the two run in parallel under bevy's pipelined rendering, so the frame is the render thread's and the main world has headroom to spare.

And the GPU passes are 4.0 ms of that 14.6. The remaining ~10.6 ms is render-thread CPU work — extraction, specialization, batching, bind-group and buffer preparation — which is the same ~10 ms the table at the top of this section could not account for. Every earlier negative result follows from it at once: resolution did not matter because this work is resolution-independent, shadows did not matter because removing a caster pass does not remove the preparation around it, the cost tracked entity count because extraction and batching are per-entity, and process CPU sat flat near two busy threads because exactly two are on the path.

Two things in that settled column are worth someone's attention, and neither is a pass:

update_map_surfaces is a streaming cost and not a frame cost, which is what the whole-run total of 53.7 s could not distinguish and what this split exists to say. One caveat travels with every row: this workspace's own crates build at opt-level = 1 and dependencies at 3, so our systems and bevy's are not on equal terms in this table.

The first measured win off all this: cull the clipmap (2026-09-22)

The clipmap carried NoFrustumCulling with the reason "flat tiles + big_space rebasing confuse frustum culling", so every tile in the pyramid was submitted to the main pass whether or not it was on screen. big_space was not the cause. The cause is that stream.quads caches one quad mesh per zoom and reuses it, and bevy's calculate_bounds gives an Aabb only to an entity that has none, only while it can see the mesh's positions — for a stashed, reused handle that is the first spawn and no other. An entity with no Aabb is culled exactly as little as one that opted out, so the component was describing the symptom.

Stating the bound at the spawn site, deck-1, all three scenarios:

scenariodrawsframe
orbit (180 km)149 → 1498.95 → 9.5 ms
low-orbit106 → 1067.82 → 8.7 ms
city (3 km)522 → 33114.41 → 11.2 ms

Every figure in this section was measured before the branch was rebased, and main moved underneath it during the day — 634be61 deleted the depth prepass and 4a214b2 changed the basemap cross-fade, both in the render path. The mechanism is unaffected, since a tile with no Aabb cannot be culled whatever else changed, but the exact saving on today's main has not been re-measured. Treat the ratios as sound and the absolute milliseconds as of that branch.

City: 191 fewer draws (−37 %) and 3.2 ms (−22 %), 69 fps to 89. The two orbit scenarios are unchanged, which is the correctness check rather than a disappointment: from 180 km looking straight down the whole pyramid is in frame, so a correct culler removes nothing, and a drop there would have meant ground was being deleted. The settled capture shows continuous ground to the horizon.

The saving lands exactly where the per-system table said it would, which is what makes this a confirmation rather than a coincidence:

settled, ms/framebeforeafter
run_render_schedule13.59.94
render_system6.364.85
camera_driver3.592.72
write_binned_instance_buffers2.361.11
prepare_preprocess_bind_groups1.520.80
Main::run_main5.035.47

The main world got slower and that is the trade: it now runs the frustum test it was skipping. Where the render thread dominates, as at city, buying 3.6 ms there for 0.4 ms here is overwhelmingly worth it. Where it does not, the trade is thinner — both orbit scenarios came back 0.5–0.9 ms slower on identical draw counts, which is at the edge of the ~0.7 ms run-to-run spread this machine shows and is the one number here worth re-running before trusting.

The prepass was missing because it had been deleted

Answered while rebasing, not by measurement: 634be61 refactor(view): remove ambient occlusion, and the prepass it was the only user of landed on main during this work. So "no prepass appears in any scenario's pass list" is simply true — there is no prepass — and the 3.0×-overdraw finding below describes a build that no longer exists.

Worth keeping the sequence straight, because the measurement was taken on a branch that still contained the prepass code and still reported nothing for it. That is not resolved by the deletion and remains the open half: either it was already inert on that branch, or a pass can run here without RenderDiagnosticsPlugin reporting it. The second would matter, since the whole 2026-09-22 investigation began from a 10 ms hole in the pass list.

And the prepass was missing from the diagnostics

This note records, as a standing finding, that at orbit "the depth prepass runs 3.0× overdraw while the opaque pass runs exactly 1.0×". No prepass appears in RenderDiagnosticsPlugin's output at orbit or anywhere else now — the pass list is the same seven entries in every scenario, with no prepass and no shadow pass among them. perf::gpu_passes does not filter; it reports what the store holds. Whether the prepass was turned off since, or is running unrecorded, is not established here — but the 3.0× figure cannot currently be reproduced, and something that renders is going unmeasured either way.

On Metal a batch set costs a kernel round trip, and the sky march costs the rest (2026-10-16)

Measured on an M5 Pro (cargo perf --features perf, --size 3134x1952, a MacBook's Retina panel, CARTO_FPS_CAP=0, two flights each, every steady window quiet), with sample(1) for the call stacks. Three things, none of which the Deck could have shown.

cargo perf measured nothing on a Mac until this date. PerfPlugin adds RenderDiagnosticsPlugin; wgpu's Metal backend cannot allocate its counter sample buffer, reports that as DeviceLost, and handle_render_error halts the renderer before the first frame. The suite then reports ~570 fps for an empty frame. It is skipped on Apple targets now (CARTO_GPU_TIMINGS still forces it).

Every Queue::write_buffer is a Metal buffer created and later freed through the kernel. wgpu-core makes a fresh staging buffer per call (StagingBuffer::new → newBuffer → IOGPUResourceCreate, a mach_msg), and frees it when the submission retires (triage_submissions → AGXBuffer dealloc, another trap). Bevy's write_binned_instance_buffers makes three such calls per multidraw batch set per frame, so the render thread's time is batch sets × 6 kernel round trips. Over Groningen from 3 km the main pass had 373 batch sets, ~330 of them globe tiles, each a non-bindless material of its own; creation showed up in write_binned_instance_buffers (4.5 ms) and the frees in submit_pending_command_buffers (~5 ms) — ~8 ms of a 12.6 ms frame. Making GlobeOcean bindless took it to 107 batch sets and the city frame to 10.2 ms. On this backend a material that is not bindless costs per entity on the CPU, not only per draw. Bevy caps a bindless slab at 64 resources on Apple targets (2048 elsewhere, AUTO_BINDLESS_SLAB_RESOURCE_LIMIT) for Metal's own limits, which is why the globe still splits into a few dozen sets; that cap was left alone.

That change moved orbit the other way, 13.2 → 14.7 ms, because orbit was never CPU-bound: its render thread waits in -[MTLCommandQueue commandBuffer], i.e. on the GPU, and the bindless globe shader costs a little more per pixel.

The GPU half was the raymarched atmosphere. It runs whenever the globe is drawn — from orbit and over any city view high enough to see the globe's horizon — once per main-pass pixel at GLOBE_SKY_SAMPLES steps. CARTO_NO_SPACE_RAYMARCH=1 took orbit to 7.7 ms and city to 5.5 ms, and CARTO_RENDER_SCALE=0.7 landed in the same place, so both are fill. Halving the samples to 8 is invisible in side-by-side captures and is where the constant now sits; its doc comment has the sweep.

scenario, steadybeforebindless globe+ 8 sky samples
orbit13.2 ms14.7 ms11.0 ms
low-orbit13.4 ms14.7 ms10.4 ms
city13.3 ms10.2 ms6.7 ms
street10.3 ms8.1 ms8.5 ms

street is ~0.4 ms of run-to-run spread on either side of its middle column: at 150 m the globe is not drawn, so the sky samples cannot reach it. Two things were tried and moved nothing: dependency debug_assertions off (wgpu's and bevy's checks are not the cost) and CARTO_GPU_PREPROCESS=preprocess (worse: submit doubled). CARTO_GPU_PREPROCESS=off panics in bevy 0.20 ("Dynamic uniform batch sets shouldn't be used here").

Read the table above with two caveats found the same evening (next section): every scripted run then inherited the measuring person's Settings ▸ Graphics, and on that machine those forced the light shafts on; and the Mac it was measured on also hosts the midas VMs, whose paravirtualised graphics share its GPU.

Turning the camera cost what standing still did not (2026-10-16)

Reported as "fine until I rotate the camera, then the frame rate collapses". Every window cargo perf had was a still view, so it could not see it. It has a turn window now: the settled scene yawing 2° a frame for 90 frames. It also has an earth scenario for the pose the app opens on, because there a rotate-drag swings the camera round the focus instead of turning it on the spot. Measured on the M5 Pro at 3134×1952, two flights each, with sample(1) for the call stacks.

Four causes, none of them the GPU.

  1. Writing a shared value into every material. Assets::get_mut marks the asset changed on any write through it, assigned value or not. A changed material is re-prepared on the render thread: a new uniform buffer and bind group, each one a kernel round trip on Metal. Four systems did this to every instance of a material family whenever a key moved:

    • ground_detail::refresh_ground_detail, keyed on the material count;
    • wet_surfaces::apply_wet_surfaces, keyed on the same count;
    • map_stream::refresh_tile_lod_blend, keyed on the screen-driven desired set;
    • street_labels, which dealt its 160 names to the sign pool in a fresh order on every re-placement.

    All four keys move on every frame of a turn. The first three were found the same day from the other end — a web load, where each landing tile re-prepared the whole clipmap — and fixed on main (0cc59b71, wasm-performance.md) while this was being measured; the street labels were this investigation's own. material_modified_per_frame counts it now, and a still window that reads above zero logs a warning. The before/after numbers are in the table below, and cover all four. The rule that follows is general: read with get, compare, and take get_mut only on the instances whose value differs — anything writing one shared value into a whole family pays this the moment its key starts moving every frame.

  2. A lock held across the work. On a warm-cache globe tile, decode_globe_tile ran as an argument to results.lock()…push(…), so the worker held the sink for the whole decode. The main thread's take_results slept on that mutex for 6.5–7.4 ms a frame of a fly-mode turn.

  3. Earth mode streamed round the camera, and a rotate-drag moves the camera. At the opening pose the camera sits ~1 km off the focus. A turn carried it round a ~2 km circle, and every ring streamer centred on the camera retargeted all the way round: whole 3DBAG cells of 5–7 MB, the surface cells, the half-metre terrain tier. One flight had a 906 ms frame in mid-turn. grid::StreamCentre makes Earth mode stream round the focus instead: a ring streamer centres on AnchoredCamera::stream_xz_at, which is the orbit focus in Earth mode and the camera everywhere else. What is about the camera's body rather than the view — the glass over the building it is in, the interiors, the grass — still reads the camera itself.

  4. The globe never settled after a descent. Below 2 km the quadtree selection does not run, and it was the only thing that cleared the not-yet-started fetch queue. So busy() stayed true for good and every Earth-mode capture after a higher one timed out. This cost no frame time; it made the earth window unmeasurable until it was fixed.

windowbeforeafter
city turn, mean / worst frame34.5 / 110.6 ms27.4 / 29.3 ms
city turn, materials re-prepared per frame2121.6
Earth turn, mean / worst frame48.0 / 70.0 ms33.0 / 47.8 ms
Earth turn, materials re-prepared per frame3218.8
Earth scenario settled0 of 22 of 2

These rows are still GPU-bound at ~27 ms, for the two reasons below. The render thread's share is clearer: prepare_erased_assets<GroundMaterial> went from 17–33 ms a frame to nothing. Once the scripted runs stopped inheriting the light shafts, the GPU stopped hiding the rest:

Two traps in the measurement, both standing.

Negative, at Retina on the M5 Pro:

How it was profiled, since there is no Xcode here. xctrace needs the full Xcode, and RenderDiagnosticsPlugin cannot allocate Metal's counter buffer (above). What works is sample(1): attach to the PID once the steady line is logged, demangle with rustfilt, and either read the tree or convert it with tools/sample_to_callgrind.py and open it in KCachegrind (qcachegrind on a Mac). The perf feature's per-system table says which system; the sample says why. For causes 1 and 2 above, that was a re-prepare loop and a mutex wait.

Negative results — do not re-open these first

SIMD is already done, and the remaining candidates are not vectorisable

.cargo/config.toml is a measured baseline document, not boilerplate: target-cpu=x86-64-v3 on every x86 lane and +simd128 on wasm32, with ~30% off the mask raster and ~2× off the shore-field tail recorded against it. Three of the four sites that look most promising were already vectorised and carry their numbers: squared_distance_transform (~3×, bit-identical), mip::halve_triangle (~2×), paint_water_alpha_by_colour (~2.5×).

Availability needs no work either. NEON is baseline on aarch64 — the Android lane correctly sets no RUSTFLAGS — and simd128 is repeated in every wasm lane because RUSTFLAGS replaces rather than merges the config entry. glam 0.32 selects its NEON/SSE2/simd128 arms automatically and neither scalar-math nor core-simd is enabled anywhere.

Two consequences worth knowing. x86-64-v3 is a baseline assumption, not dispatch — shipped desktop binaries already require Haswell — so further x86 widening must be runtime-dispatched or stay at v3. And Vec3A is not the win it looks like: mesh attributes must stay packed [f32; 3] for upload, so converting would add a repack costing more than it saves.

Not vectorisable, with the reason: earcut (pointer-chasing ear clipping), MVT varint decode (serially dependent by construction), clip_ring (data-dependent output length), the routing graph's finish/snap/A* (hash probes and heap operations), lower_envelope's stack machine. tiny-skia's scan conversion — the 121 ms — is inside the dependency and is already SIMD.

Where a loop genuinely was hot, the fix was algorithmic, not SIMD: terrain::bake hoisted anchor-invariant trig and exploited Mercator separability for ~10–30×.

The building colliders do not need a spatial index

collision::blocked is a linear scan over every footprint, though the structure has been called a "footprint index", which it is not. Both look like an obvious ~100×. Do the arithmetic before building one: blocked is called at most ~5 times per frame (slide does up to four, steer_velocity a couple), each footprint costs an AABB test that the first compare usually rejects, and the worst-case patch is 6,776 buildings — so the whole per-frame cost is on the order of 70 µs.

A uniform grid has to be rebuilt whenever a source changes, and 3DBAG cells arrive several times a second while streaming. Rebuilding ~6,800 footprints into their overlapping cells is ~0.5–1 ms, i.e. the index would cost more on the frames it is rebuilt than it saves on the frames it is queried. It becomes worth building only if the query rate rises by an order of magnitude — several colliding agents, or a per-vertex query — and the honest trigger is a measurement, not the shape of the loop.

big_space is not the bottleneck

~800–1000 entities, all flat children of exactly one Grid; no nesting anywhere in the client. High-precision propagation is order tens of microseconds. The vendored fork's divergence from Bevy 0.19's dirty-tree propagation is upstream's deliberate choice, inherited, and costs nothing here: the only deep low-precision subtrees are avatar skeletons, which animate every frame, so nothing would be skipped.

Upstream's post-0.10 perf work does not transfer. Stationary and the GridDirtyTick in 2f6f4fc are per grid, and this app's single grid contains the camera and the avatar, so it is dirty every frame by construction; the 6× figure in 17549ac is from a many-grid scene. Only 961cc0c's two set_if_neq lines are worth cherry-picking. A specialised replacement of the general machinery would save microseconds and cost the upstream relationship — the machinery is cheap here precisely because the hierarchy is flat.

free_camera.rs's comment claiming that any camera Transform change forces an O(scene) GlobalTransform recompute is false. LocalFloatingOrigin::compute_all seeds from the origin's cell, so moving the camera a metre recomputes one transform. The write-back guard is still worth keeping — it stops the camera's own Changed<Transform> firing, which a great many systems key off — but whatever frame-time win was once measured came from somewhere else.

BigSpaceValidationPlugin walks every entity every frame as an exclusive system under debug_assertions, estimated at 1–3 ms. It is cfg-disabled in release, android-release and web-release, so it costs a shipped build nothing, and at ~1000 ms/frame on lavapipe it cannot be measured here. Left alone deliberately; settling it needs a GPU workstation or a trace_chrome capture.

The ECS side is disciplined

No missing is_changed() throttle was found, and no unconditional ResMut deref defeating an existing one. .chain() is used exactly twice and both are correct. theme.rs was not a per-frame cost (its egui style was installed once). There is no FixedUpdate anywhere, so there is no timestep death spiral.

The real ceiling was parallelism: 28 systems took ResMut<EguiManager> and ~33 ResMut<Assets<…>>. Those two disjoint cliques covered ~61 of ~150 Update systems, so everything that does real work was at most 2-way parallel (the egui clique left with egui on 2026-11-26; the library's screens are uncounted). On a 4-core phone that leaves two cores idle for most of Update. Most clique members early-out, so the realised cost concentrates in the streamers — but the ceiling is structural and no amount of .after() tuning moves it.

And until 2026-08-18 the realised figure was 1-way, for an unrelated reason. ComputeTaskPool is Bevy's parallel system executor, and its width is not configured anywhere — create_default_pools sizes io, then async_compute, then compute, each from the last one's remainder, and get_number_of_threads applies min(remaining) before clamp(min_threads, max_threads). On the 8 cores an Android device reports, lib.rs's override resolved to io = 4 (its floor beating its 0.30 share), async_compute = 4 (0.45 × 8 rounded up, taking the rest), and compute = min(8, 0) clamped up to its default floor of 1. Measured by reading /proc/<pid>/task/*/comm on an 8-core host: 1 compute thread before the fix, 3 after.

Two things worth keeping from that. It was invisible for months because the io and async widths were measured on a 22-core box, where the same policies give io=7, async=10, compute=5 and the failure cannot occur — a pool width that is derived rather than declared needs a device with the awkward core count to falsify it. And it is why the diagnostics report now prints all three widths: the next person to move a percentage here has no other way to see what they did on hardware they do not own.

Android frame pacing is fixed (2026-08-16)

fps_cap: None on the phone meant "do not run a thread::sleep limiter on top of AutoVsync", which is right, and was being read as "run as fast as the panel will go", which is not the same instruction. FIFO paces to the display, so a 90/120 Hz handset rendered a 30 fps-budgeted scene at 90/120 and was thermally throttled for it — and the ADPF deadline was hardcoded to 1e9/60 regardless, so on those same devices every frame was reported comfortably on time and the governor never had cause to boost.

Budget::target_fps is the number to tell the compositor, distinct from fps_cap, and platform::android::set_frame_rate delivers it through ANativeWindow_setFrameRate — dlsymed from libandroid.so for the same reason ADPF is, since an API-29 handset is not misconfigured. It is a hint: the platform may pick a multiple, or ignore it on a device with no seamless mode switching, so it logs what it got. Retried until native_window() exists, because that is None for the first few seconds after android_main.

Unverifiable here. The emulator is fixed at 60 Hz, so this needs a real 90/120 Hz device — adb shell dumpsys SurfaceFlinger | grep -i refresh plus battery temperature.

…and it came undone, and is fixed again with an idle throttle (2026-08-21)

Reported from the OnePlus 15: fast enough, extremely hot. It had regressed. report_frame_to_scheduler was passing a hardcoded 0.0 to ANativeWindow_setFrameRate — the API's documented "the app will accept the system's choice of display frame rate" — so Budget::target_fps reached nothing but the ADPF seed and a 120 Hz LTPO panel got exactly what it asked for.

The argument for the 0.0 was not silly and is worth keeping straight, because half of it is still true. It ran: 60 is not a property of any display, it is a property of the desktop the tier table was written on, and this codebase cannot read the panel's rate — winit's Android backend answers None for the refresh rate and fabricates a 60 in video_modes. All correct. What it got wrong is that handing the choice back is not neutral when the choice is "as fast as possible": the compositor optimises for smoothness, and nobody in that conversation represents the battery. target_fps is not a claim about the panel — it is a statement about how much work the tier is willing to do per second, which is something we know. And the panel's rate is measured now anyway (Cadence), so ADPF's deadline never depended on the constant.

The rung test could not have caught it, and that is the reusable part. quality::every_rung_asks_the_compositor_for_a_rate asserts what target_fps() returns; the bug was that nothing passed the return value on. Same shape as the two demotions already recorded in quality.rs — a test that describes a preset rather than a call site. The resolution is a plain function now (frame_pacing::resolve_frame_rate), compiled on every target, with the assertion on it.

On top of that, an idle throttle: frame_pacing::present_rate asks for half the rate (floored at 30) after IDLE_AFTER_S of nothing happening — no input held or just released, camera not moved, driver mode off, no bytes uploaded this frame and no tile job outstanding. The streamers are in that list because the per-frame build budgets are per frame, so a cold map filling in while you sit still would otherwise take twice as long to arrive.

Two things about the mechanism. The compositor is the lever, not a sleep: a thread::sleep on top of FIFO is the second clock frame_limiter exists to refuse, whereas setFrameRate is the same clock — FIFO then blocks on acquire for the longer period and the whole loop throttles with it. And the rate is one resource (PresentationRate) with two consumers, so the desktop limiter gets the idle drop from the same decision rather than a parallel one that can drift.

The deliberate trade: the world keeps animating while idle — sun, waves, a remote avatar walking past — and it animates at the idle rate. Hence a floor of 30 rather than something lower.

Unverified. Same wall as the 2026-08-16 entry: the emulator is fixed at 60 Hz, so neither the mode switch nor the heat can be measured here. On the device, debug.carto.fps_cap A/Bs it without a rebuild (0 = uncapped, which also disables the idle throttle so a headroom measurement is not measuring itself), and the transitions are on debug in logcat. IDLE_AFTER_S = 2.0 is a guess and is the first number to move if the drop is noticeable.

The repeat parses are collapsed (2026-08-16)

tile_loader::parse_shared keys a Weak<TileData> cache on the source tile, which is the ancestor when overzooming — so the finest clipmap ring's 81 z17 tiles share 4 parses rather than doing 81 (pinned by a test). The globe, map_geometry, both tile-sourced data layers and the routing corridor go through the same cache, so ground being streamed by several consumers at once is parsed once between them.

It stays Weak on purpose: a fully-decoded dense z14 tile peaks at ~12.5 MiB and the globe can want hundreds at once, so anything strong would be a memory policy rather than a cache. That number, from allocation-budgets.md, is what tile-raster-cost.md said this was blocked on.

The enabling change was TileData's per-layer memo moving from std::cell::OnceCell to OnceLock, i.e. from Send to Send + Sync. A compile-time assertion in crates/geo holds it there, because cartopolis_geo is single-threaded and would otherwise test green while breaking the cache.

Not visible in settled_s on this container, and that is expected: lavapipe spends ~1 s per frame rasterising, so a cold ground fill is bounded by frames drawn, not by tiles decoded. The saving is in worker time and allocation traffic.

The unused MVT layers are not decoded

docs/notes/vector-tile-unused-layers.md says the geometry cell "decodes all of it". That stopped being true when TileData::features became lazy per layer: place_labels and street_labels_points are never decoded at all, and every "loop over all layers" site filters before touching features(). The note's conclusions hold; its cost model does not.

The real duplicate is PAINT_ORDER listing buildings and streets twice. The decode is memoised; the path building and the bounds scan are not.

…and sharing the rest of that duplicate was measured and rejected (2026-09-14)

The obvious next step is to memoise the other two per-layer things the second pass redoes: geometry_bounds, which walks every coordinate of every feature, and the streets paint order, which is a filter plus a sort whose comparator calls street_style and two flag probes — O(n log n) attribute lookups, rebuilt for the casing pass and again for the fill pass. It was built (a HashMap per concern keyed on Layer::layer_index, the sort decorated so the key is read once), it is exactly value-preserving, and culling_off_screen_features_changes_no_pixels and the allocation budgets both pass with it in.

It buys nothing measurable. Paired bench_overzoom_cull runs, release, this container, per tile:

factor 2, cullrun 1run 2run 3
before44.66 ms40.84 ms38.53 ms
after36.96 ms42.56 ms40.46 ms

The first pair looked like −17 % and was an ordering artefact — that run's before is simply the slowest of the three befores. Runs 2 and 3 put the memoised version marginally behind. The arithmetic agrees and is the part to keep: the duplicated bounds scan is a linear pass over ~50k coordinates, order 50 µs, against a tile that costs 18–45 ms. It is a tenth of a percent of the thing it sits inside.

So the duplicate is real and it is not where the time is — the time is tiny-skia's scan conversion, as tile-raster-cost.md has said throughout. Two hash maps and a memo protocol in the hottest loop in the tree is not worth a saving under the noise floor. Reverted. Re-open only with a profile that puts geometry_bounds somewhere visible.

The path building genuinely cannot be shared either, which is worth stating so it is not tried: the two passes over a layer build different paths from the same features — a fill against an outline, a casing stroke against a fill stroke — and the batching runs are keyed on colour and width, so there is nothing common to keep.

Open, with the reason they are still open

The space-tier cloud shell: measured at last, and it is the frame

Reported 2026-08-23 from the OnePlus 15: frame rate swings hard with altitude — 84 fps with the globe small on screen, 24 fps with it filling the screen — which reads as a streaming or residency fault. It is not one, and the developer panel is what settles it. At 7191 km, space · factor 1.00:

28 fps · 35.6 ms   draws 122 · 1040 entities   triangles 7 978
buildings 0 · 3DBAG 0 · map tiles 0 · globe 0
upload 0 kB now · pipelines 45 ready, 0 building

122 draws and 8k triangles with nothing streaming and nothing compiling, at 35.6 ms. No streaming cap can account for a cost that survives that; it is per-pixel. (The worst figures — 52 and 90 ms in the same session — are a different question and are plausibly the upload path: 12.4 MB peak against a 4 MB/frame ceiling.)

The candidate is shaders/globe_clouds.wesl. Per fragment it runs nine 6-octave fbm3 fields (~54 3D value-noise lookups) plus two domain warps and a Coriolis curl, on a shell at planet radius — so from low orbit it covers every pixel of a 2772×1272 native-scale HDR target.

Two things made it unmeasurable, which is the part worth remembering. Coverage (params.x) is not consulted until line 204, after every fbm3, and the only discard is at 242 — so there is no cheap value to set it to. And the value it is set to is the GLOBE_CLOUD_COVER constant blended with live GFS, deliberately not the weather slider (one met.no point should not overcast the planet), so neither --clouds 0 nor Settings ▸ World moved it. A first A/B duly returned 303.8 ms against 293.2 ms and looked like an exoneration; it was the flag never reaching the shader. Hence CARTO_NO_CLOUDS and the Settings ▸ World checkbox, which hide both shells — the ground deck already dropped itself when it carried no cloud, and the globe copy was missing that guard.

What is still not established is whether the clouds are the cost, and lavapipe cannot establish it. Triplicate at 1000 km, CARTO_QUALITY=android, 480×1040, medians: baseline 261.6 ms, CARTO_NO_CLOUDS 223.0, NO_ATMOSPHERE 252.5 — but repeats of one config spanned 218–319 ms, and an earlier sweep had CARTO_NO_SHADOWS landing 48 ms slower than baseline. The within-group spread exceeds every between-group difference. A CPU rasteriser also flatters this test in the wrong direction specifically: an ALU-heavy noise shader is far more expensive relative to everything else on lavapipe than on an Adreno, so even a clean number here would not transfer. This is the frame_ms row of the table at the top of this note doing exactly what it says it does.

Settled 2026-09-09 on real hardware

A Steam Deck (AMD Van Gogh, RADV, Mesa 26.2.2) was added as a second runner, and it answers what lavapipe could not. cargo perf --only orbit, quiet steady windows, CARTO_NO_CLOUDS against baseline:

sizeconfigfpsGPU totaltransparent passfragment invocations
640×360base106.95.19 ms3.21 ms231 039
640×360no clouds115.42.08 ms0.03 ms0
1280×720base52.213.22 ms9.39 ms922 840
1280×720no clouds84.53.85 ms0.03 ms0

The globe cloud shell is the transparent pass, and at 1280×720 it is 71 % of the GPU frame and the difference between 52 and 85 fps. The atmosphere and the haze are noise beside it: CARTO_NO_ATMOSPHERE measured +0.36 ms and CARTO_NO_HAZE −0.10 ms, both inside the run-to-run spread.

Three things make this trustworthy where the 2026-08-23 attempt was not. The windows report quiet=true — nothing streaming, no worker jobs, no mesh churn. Fragment counts repeat to the unit across configurations. And the machine was idle (load 0.1–2.4) rather than shared.

It is fill-bound, not overdraw. Overdraw on that pass is exactly 1.00× — one fragment per pixel, nothing wasted — and the cost scales with resolution (3.11 → 9.37 ms for 4× the pixels, a 3.0× rise; invocations scale exactly 4×). So the problem is not how much is drawn, it is what each fragment costs: globe_clouds.wesl runs nine 6-octave fbm3 fields, i.e. 54 vnoise3 calls and 432 hash lookups, per pixel.

Do not extrapolate the millisecond figure to an Adreno. This shader is dominated by 3-D value-noise lookups, which is exactly where GPU architectures diverge most. What does transfer is the shape: fill-bound, 1.00× overdraw, and scaling with pixel count — so a handset at ~2772×1272 pays it over ~3.8× the pixels of the 1280×720 row above.

And it was made ~50 % cheaper, with the floor measured

globe_clouds.wesl ran nine 6-octave fbm3 fields per fragment. Six of them are warps — their output is scaled by 2.2 and added to a sample coordinate, so their top octaves displace the sample by a fraction of a noise cell. Those six, and the wisp (whose own comment calls it "gentle, LARGE-scale… low frequency and shallow"), lost octaves; the density and ridge crests that decide what you see kept all six.

54 vnoise3 calls per fragment became 27. Measured end to end at 1280×720, both windows quiet, on an idle machine:

beforeafter
cloud pass9.38 ms4.81 ms (−48.7 %)
GPU frame13.22 ms8.14 ms (−38.4 %)
frame rate54.6 fps69.5 fps (+27.4 %)

Where the floor is, and why. A ladder on the warp octaves, whole-Earth capture with CARTO_CLOUD_DATA_SYNC=1 so the frame carries real GFS cloud:

warp octavescloud passdifference from 3
35.90 msreference
25.05 msmean 1.10/255 — clean
14.02 msmean 2.77/255 — visibly blocky

At one octave the warp is too coarse to decorrelate the noise lattice, and the axis-aligned grid that M3 exists to hide shows through as rectangular, stair-stepped patches — the "hexagonal/blocky blobs" M3's own comment describes. So the last 1.0 ms is refused: two octaves is the floor, not three, and not one.

Two lessons for the next person here. A per-pixel budget is not one number — the nine fields in this shader had wildly different value per octave, and cutting the six that only displace a coordinate cost nothing visible. And a --shot on real hardware is now part of the argument: colour is not evidence on lavapipe, so this trade could not have been judged from this container at all.

The device settles it, with no rebuild once an APK carries the flag:

adb shell setprop debug.carto.no_clouds 1
adb shell am force-stop eu.garage44.cartopolis

One unrelated thing the same readout shows: 6,998 of 7,978 triangles (88%) go into shadow cascades at 7191 km, where no shadow can be resolved. Cheap in absolute terms — 8k triangles — but it is three passes over invisible geometry and nothing gates cascade submission on the tier.

2026-10-17, and some of that spent again, on sight. The shell's clouds were soft blobs drawn from the 1° weather grid itself. The density now runs eight octaves (two more, to ~28 km), the four finest folded into puffs; the cover picks the field's quantile with a crisp edge; and a sun-ward relief sample of six octaves shades cloud tops near the terminator, replacing the three-octave wisp. Net: 27 → 32 vnoise3 per fragment, ~19 % more noise work. Not re-measured on the Deck; the M5 Pro node is no evidence for it.

No frame-rate governor on the clouds (decided 2026-09-28)

From 2026-09-09 systems::adaptive_quality hid both cloud shells when the frame interval stayed over budget for 4 s, and brought them back only after 20 s under 70 % of it. On the OnePlus 15 that meant no clouds, ever: the first seconds of every launch are loading frames (43–48 ms on a Steam Deck at the phone's resolution, where the settled scene then ran at ~15 ms), and the interval of a device paced to 60 fps cannot fall below 16.7 ms, so the 11.7 ms needed to take them back was unreachable. It also ran during scripted captures, so every slow --shot photographed a cloudless sky whatever --clouds said. The user's decision was that clouds are on or off, and not dependent on fps, so the governor was removed rather than repaired — it governed nothing else. What a cloudy frame costs on a handset is now visible as a frame rate, and the levers for it are the cloud shaders themselves (CLOUDS_LOW, the octave floor above), not a switch that takes the clouds away.

A trap in the instrument itself

--frames sweeps only place the first viewpoint. Every capture after the first reports alt_m=0 with space_factor and globe_albedo as NaN (reproduced 2026-08-16 on a 6-frame 60 km → 3000 km climb, and confirmed pre-existing by re-running against a clean tree). The likely cause is that each waypoint is a teleport, a teleport re-anchors, setup_globe rebuilds, and the settle test waits on the tile streams but not on the globe being placed — so the shutter fires while GlobeState is still empty.

This matters more than it looks, because --frames + --csv is precisely the tool the shots skill (.claude/skills/shots/SKILL.md) documents for catching a hard cut in a ramp — the one thing a single still cannot show. Until it is fixed, verify a ramp with separate --shot runs at several altitudes, which does work:

400 km   space_factor 0.039   globe_albedo 0.983
1500 km  space_factor 0.487   globe_albedo 0.781
3000 km  space_factor 1.000   globe_albedo 0.550

What a phone cannot be measured on here

Lavapipe is a CPU rasteriser: geometry, placement, culling and visibility are trustworthy, colour and lighting are not (headless-shots-software-renderer.md). The VPS Android emulator renders on SwiftShader and aborts after ~9 s (egui-wgpu: Tried to update a texture that has not been allocated yet; not retried since egui left on 2026-11-26), so it could not hold a steady frame at all — it settles startup order, asset loading, lifecycle, memory and panics, not performance. simpleperf is worse than useless under ndk-translation, which executes translated x86_64 and profiles the translator.

The minimum real-device loop needs no rebuild. env_flag on Android reads debug.carto.* system properties, the one namespace adb shell setprop may write on a production build without root:

adb shell setprop debug.carto.fps_log 1
adb shell setprop debug.carto.render_cost 1
adb shell am force-stop eu.garage44.cartopolis
adb shell monkey -p eu.garage44.cartopolis -c android.intent.category.LAUNCHER 1
adb logcat -s cartopolis:V | grep -E 'frame stats|render cost'

That gives per-second fps/jitter and the five-second draws/triangle census off a shipped APK. wasm-performance.md's claim that "every env-var escape hatch is unreachable on Android" is true only of switches read through raw std::env::var; anything going through env_flag/env_value is reachable, and CARTO_FPS_CAP was moved onto that path on 2026-08-16.

The engine constraint behind the draw-count work — lapsed 2026-08-18

bevy_render's gpu_preprocessing excludes Adreno ≤ 730 (except 720) and Mali drivers below 48 from GPU preprocessing entirely — GpuPreprocessingMode::None. The Fairphone 4's Adreno 619 was in that bucket, so on the then-target device there was no indirect draw, no GPU culling and no cross-mesh batching: every mesh was a CPU-issued draw with its own bind group. That is why draws became a first-class metric here rather than a proxy for triangles, and why it was a main-thread number as much as a GPU one.

The filter is unchanged; the device is not. bevy_render/src/lib.rs:531-545 strips the literal prefix "Adreno (TM) " and parses the digits, and the test at batching/gpu_preprocessing.rs:1333 is model != 720 && model <= 730. An Adreno 840 fails it and lands in the supported branch — so GPU culling, indirect draw, cross-mesh batching and GPU bin unpacking are all live on the current target, and with them the Bevy 0.19 rendering wins that are downstream of them. Note the filter also fails open: if Qualcomm changes the string, strip_prefix returns None and the device is treated as supported.

Two consequences for anyone reading the draw-count sections above:

The target device, and what it voids

Until 2026-08-18 the Android target was a Fairphone 4 — Adreno 619, 512 KiB of on-chip tile memory, ~17 GB/s, 2 performance + 6 efficiency cores. It is now a OnePlus 15: Snapdragon 8 Elite Gen 5, Adreno 840, 18 MB of tile memory (Qualcomm's own a8xx kernel enablement series states the figure), ~85 GB/s LPDDR5X, and 2 prime + 6 performance Oryon cores with no efficiency cores at all. Older phones are explicitly out of scope.

Three arguments in quality.rs were built on the old numbers and do not survive the change, which is why auto() now puts Android on Budget::balanced:

One field does not come up with the rung, and it is the one this device has actually broken: upload_bytes_per_frame. It is None on every rung above the phone, on the sound reasoning that those rungs describe machines whose uploads cross a much wider bus and none of which has lost a device to streaming — but a handset on the balanced rung is neither case, and this handset lost its Vulkan device to a cold-start burst while on the phone budget. So auto() takes balanced and keeps the 4 MB ceiling explicitly. Note the same change raises the pressure on it: 512 px tile rasters are 4× the texture bytes of 256, and radius_bias: 0 nearly doubles the tile count. With the ceiling kept that is fill latency; without it, it is the burst again.

One prediction made from a desk was wrong, and it is worth recording as wrong: FP32 linear filtering was assumed to be a standing Adreno architectural gap, so the flagship was expected to lack FLOAT32_FILTERABLE and to keep the analytic dome. The device reports the feature. It was the tier, not the adapter, that was vetoing the sky.

The fix for that was itself a vendor-family generalisation — a table of GPU model numbers, gpu_affords_atmosphere — and it survived one day before being deleted along with Budget::sky_dome (2026-08-18). The sky is now decided by asking the adapter, through quality::Capabilities. So the lesson landed twice in two days and is worth stating flatly: a vendor-family generalisation is not a measurement, this file should not have carried one, and neither should the fix for it. Where a capability can be queried, query it; where it cannot, let a person choose a rung.

Two of the chipset's headline features are structurally unreachable rather than merely unused: Bevy 0.19 contains no reference to EXPERIMENTAL_MESH_SHADER (wgpu 29 exposes it; the engine has no draw path), and the explicit 18 MB tile heap is VK_QCOM_tile_memory_heap, which wgpu 29 does not support at all — the memory is reachable only as implicit GMEM.

Measurement is harder on this device, not easier. dumpsys gfxinfo is useless for a Vulkan NativeActivity surface, AGI's whitelist does not include it, and there is no workstation in the loop — so the shareable report (systems::dev::diagnostics) is the primary instrument, and since 2026-08-18 it carries frame time, draws, the triangle split and the three task-pool widths for that reason.

Where the shadows go (2026-09-11)

Reported as "enabling shadows makes the viewer very slow". The caster side had been tuned hard and repeatedly — the terrain relief does not cast, lod22 casts only from the camera's own cell (SHADOW_RADIUS = 0), the moon light is despawned by day, the map is 1024² below the desktop rung — and three things had never been looked at at all.

NoFrustumCulling is also "submit me to every cascade"

This is the one worth carrying forward, because the component's name says nothing about it. bevy_light::check_dir_light_mesh_visibility tests each caster against each cascade frustum — unless the entity carries NoFrustumCulling or has no Aabb, in which case it goes into every cascade of every light with no test. So anything that opts out of frustum culling owes a decision about shadows in the same breath — NotShadowCaster unless it really casts.

Four things in this tree carried that component and no NotShadowCaster, and one of them is the whole ground:

entitywhy it was unculledwhat it cast
StreamTile (the clipmap)flat quads + big_space rebasinga ground plane, onto itself
the route ribbonsamea line lying in the road surface
the driver arrowsamea navigation mark
particle emittersthe quads are placed in the vertex shader, so the AABB is the wrong volumenothing coherent — the shadow pass runs bevy's own vertex shader over a lattice whose vertices are all at the origin

The tiles are the expensive one: the pyramid is a few hundred quads (the 424 figure in upload-bursts.md's handset_guarded table is the count of tile rasters held, which is the same set), each covering its whole cascade, and including the ones behind the camera. They now carry NotShadowCaster from spawn. The comment that used to justify it on the relief path — "the ground does not cast" — was right about relief and had quietly never applied to the flat case, which is every tile most of the time.

Measured

Lavapipe, 480×270, Groningen from 3 km at −30°/35°, CARTO_QUALITY=balanced, noon, clear, dry, both runs settled. The only difference between them is the four NotShadowCaster insertions; everything else is the same binary and the same scene, which the identical draw and triangle totals confirm.

beforeafter
draws488488
tris_total16881688
tris_shadow13680
shadow_casters15844

114 of 158 casters, 72 %, were things that cannot cast a meaningful shadow — and every one of them was going into every cascade of every light with no frustum test. At this viewpoint the route, the driver arrow and the particle emitters are all absent, so the whole difference is the ground.

tris_shadow alone is not enough, though it is not blind here either. The first draft of this section claimed the metric could not see the change at all, on the reasoning that the clipmap is uploaded RENDER_WORLD-only and counts zero triangles from the main world. The measurement says otherwise: it moved 1368 → 0, because the relief and curvature grids map_stream builds are main-world meshes. What the reasoning got right is the direction — 1688 counted triangles for a 488-draw scene means most of the geometry (the 3DBAG shells, the globe) contributes nothing to either column, so a caster can still be invisible to tris_shadow while costing a pass. Read both. RenderCounts::shadow_casters is the entity count, and it reaches the shot state line, --csv, --dump-state, --expect, the dev panel and the shareable report.

The filter was never set, so every tier took bevy's most expensive one

Everything above bounds what the shadow pass draws. Nothing bounded what the main pass reads: ShadowFilteringMethod appeared nowhere in the tree, so every rung took the Gaussian default — Castaño's nine taps approximating a 5×5 kernel, per shadowed fragment, per light. At a handset's 2772×1272 with the sun and the moon both up that is the largest single shadow term in the frame, and no amount of caster work touches it.

Budget::shadow_filter now answers it: Gaussian on the desktop rung, Hardware2x2 (one hardware PCF tap) on balanced and phone. Balanced is the rung Android resolves to, and this is the purest example of that rung's stated brief — a shadow's placement is its shape, and the filter decides only how soft the edge is. Temporal is not reachable from a rung and should not become so: it is the right answer with TAA, and surface-finish-and-occlusion.md records why this codebase cannot run TAA.

The moon was a second shadow-casting light, all night

Same illuminance argument light_shafts already makes about the same light and settles the same way — "a second volumetric light doubles the march's shadow work for something nobody would see" — except that a shaft is an optional effect and a shadow map is not. spawn_moon_light sets shadow_maps_enabled: false unconditionally now. Bevy answers a light with that off by clearing its cascade visible-entity lists outright, so it is a saving in the caster pass and not only in the fragment lookup.

Its CascadeShadowConfig stays, identical to the sun's: the panic in bevy_light is about the two configs matching and does not care which of them is casting.

The cascades reached past anything that casts

shadow_distance_m was 3 km (desktop) and 1.5 km (balanced) while the casters are bounded by lod22's one z14 cell, ~1.5 km across at this latitude, plus whatever a low sun throws off it. The outer cascade covered a band where by construction nothing casts, and was paid for twice — as a pass, and as a share of the texel budget spent on ground nothing can darken. Now 1.5 km and 1 km, at the same cascade counts, so every cascade gets about twice the texel density: cheaper and sharper at once.

This is also the only distance LOD the casters have, deliberately. A per-streamer shadow radius on the trees and the street furniture was drafted and dropped: bevy already culls every caster against every cascade frustum, so a second mechanism would be two answers to one question — and this repo's rule is to remove the overlap rather than arbitrate it.

Not done — and on a Deck it would buy nothing (qualified 2026-09-22)

Nothing caches a shadow map. The city is static and the sun moves 15°/hour, and bevy re-renders every cascade every frame regardless. Re-rendering the outer cascades only every N frames is the real structural win here and bevy 0.19 has no API for it — it is engine work, not a setting.

This was written from the software rasteriser and the hardware A/B contradicts it. CARTO_NO_SHADOWS=1 on deck-1 moves city by 13.73 → 13.94 ms, i.e. not at all — so on that GPU the ceiling for perfectly caching every cascade is zero. See the 2026-09-22 section near the top. The idea may still hold on a handset, where fill is scarce and none of these figures were taken; it is no longer evidence-backed on a desktop-class GPU, and "the big one" should not be repeated until a device says so.

What is still unmeasured

The caster counts above are measured. No millisecond figure is, and none should be taken from this container: frame times here are a CPU rasteriser's and the table at the top of this note says not to gate on them — an earlier sweep had CARTO_NO_SHADOWS landing 48 ms slower than baseline. Nothing above should be read as a frame-rate claim.

The filter, the moon and the cascade reach have no caster-count signature at all, so they are untested by the A/B above; they rest on reading bevy_light and the call sites. Splitting the shadow cost between the caster pass and the per-fragment lookup needs cargo perf --features perf on the deck-gpu runner, which is how the cloud shell was settled — and CARTO_SHADOW_FILTER exists so that run needs no rebuild.

One practical note for whoever does it: five of six capture attempts on this container were killed by the OOM killer with eight other sessions compiling. The 3 km viewpoint at 480×270 is what fits; a 100 m street view did not.