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.
| Metric | Trustworthy in this container | Gate on it in CI |
|---|---|---|
draws, tris_*, tiles_occluded | Yes — a property of what the client selected. Culling, LOD and visibility run the same code on lavapipe as on an Adreno | Yes, as an absolute ceiling |
| mesh/image/material asset counts | Yes | Leak-shaped rather than cost-shaped |
Allocation counts (crates/geo/src/perf_budgets.rs) | Yes — bit-identical over three runs | Already gated |
worker_outstanding | Timing-dependent | No — report only |
frame_ms, frame_ms_max | Weak relative signal within one run on one machine | No |
elapsed_gpu from RenderDiagnosticsPlugin | No — CPU rasteriser time wearing a GPU label | No. 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.
| Viewpoint | draws | tiles_occluded | frame_ms |
|---|---|---|---|
| 2000 km orbit, straight down | 94 | 0 | 352 |
| 3 km, −30° | 367 (was 401) | 34 | 1082 |
| 150 m, −20° | 653 | 70 | 971 |
3 km, −30°, CARTO_QUALITY=phone | 209 | — | 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, steady | frame | submit_pending_command_buffers |
|---|---|---|
| defaults (desktop tier) | 29.9 ms | 12.6 ms |
| sky lighting off | 12.4 ms | 2.4 ms |
| shadows off (light shafts go with them) | 25.3 ms | 6.7 ms |
| light shafts off | 26.1 ms | 9.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.
| steady | frame | of which GPU wait | draws | entities |
|---|---|---|---|---|
| orbit | 17.9 ms | 7.0 | 297 | 2.3 k |
| low-orbit | 18.5 | 7.6 | 315 | 2.3 k |
| city (3 km) | 19.7 | 7.9 | 354 | 3.6 k |
| earth | 24.7 | — | 2434 | 7.3 k |
| street (120 m) | 46.4 | 25.6 | 4321 | 8.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, steady | frame | GPU wait | what it says |
|---|---|---|---|
| defaults (4 cascades to 1.5 km) | 46.4 ms | 25.6 | |
CARTO_NO_SHADOWS (shafts go too) | 21.3 | 9.4 | shadows are 25 of 46 ms |
| 3 cascades | 39.0 | 17.2 | (against a 43.5 baseline that evening) |
| 2 cascades | 32.1 | 10.7 | the two outer cascades are ~14 ms |
| 2 cascades, shafts off | 32.0 | 10.1 | the shafts cost nothing once the cascades are two |
CARTO_NO_LIGHT_SHAFTS alone | 40.9 | 18.7 | ~3 ms; the march's cost is its shadow-map reads |
CARTO_SHADOW_DISTANCE=600 | 40.8 | 20.6 | against 41.4: the reach moves nothing though casters fell 4304 → 2947 |
| 3 cascades to 1 000 m (the balanced rung's shadow geometry) | 35.9 | 12.8 | against 41.4: the cascade count again, not the reach |
CARTO_SHADOW_MAP=1024 | 47.8 | 24.6 | against 45.2: a quarter of the texels, no time back |
CARTO_SHADOW_MAP=4096 | 45.3 | 22.1 | against 45.2: four times the texels, free — a quality lever on this GPU, at 256 MB of maps for four cascades |
CARTO_NO_STREET_LABELS | 39.3 | 16.6 | against 43.5: the 160 name quads were 4–6 ms |
CARTO_DBG_HIDE=kerb,furniture | 41.5 | 22.9 | against 46.5: the furniture ~5 ms, the kerbs none of it |
CARTO_DBG_HIDE=kerb | 47.0 | 26.8 | against 46.5 |
CARTO_DBG_HIDE=canopy,trunk | 45.8 | 25.5 | 2 500 fewer draws, no time back |
CARTO_DBG_HIDE=paving,built | 45.4 | 26.3 | ~11 M ground triangles, no time back |
CARTO_MSAA=1 | 43.7 | 24.8 | within drift |
CARTO_MSAA=4 | 43.9 | 26.8 | within drift: 4× is free here (city: 16.2 against 19.7) |
CARTO_RENDER_SCALE=0.5 | 49.0 | 23.7 | not fill (or the scale does not reach an offscreen target — still open) |
CARTO_DEPTH_PREPASS=1 | 55.5 | 23.3 | a second geometry pass, as predicted for a desktop GPU |
CARTO_OCCLUSION_CULLING=1 (bevy's two-phase, needs the prepass) | 59.4 | 27.8 | worse again; a city seen from 120 m hides little behind itself |
CARTO_QUALITY=balanced CARTO_HANDSET=1 (the phone's own rung) | 40.4 | 18.3 | and 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.
- The cost is per cascade, not per caster and not per triangle. Halving the
reach dropped a third of the casters and no time; hiding the ground's millions
of triangles or the trees' 2 500 entities moved nothing; each cascade removed
gave 5–7 ms back. Whatever a cascade costs on this GPU, it is mostly the pass
itself, and not the map: 1024² and 4096² cost the same as 2048². That leaves
the casters' vertex work per pass — the LoD2.2 cell and the model trees, which
no switch hides — or the paravirtual device's per-pass overhead; a real
M-series Mac may differ, and the Deck (
CARTO_NO_SHADOWSmovedcitynot at all there) does. - Draw count is not the lever on this GPU either: GPU preprocessing and
indirect draws make 2 500 tree entities free. The CPU-side batch-set cost is
the Metal staging-buffer round trips (
write_binned_instance_buffers, Shadow 5.7 ms + Opaque 3.8 ms at street), which scale with materials, not meshes. - The 160 street-name signs were shadow casters. Each is its own
StandardMaterial(its own texture),AlphaMode::Blend, noNotShadowCaster, so every sign went into every cascade as an alpha-tested caster of its own — and a 0.55 m-high plate does throw a strip onto the tarmac.NotShadowCasteron the sign tookstreetfrom 46.5 to 41.4 ms (three flights each, 40.3..45.4 against 45.8..47.2), the same as taking the names away. The rule already in this file applied: a flat annotation on the ground owes aNotShadowCasterin the same breath as its depth bias.
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:
| street | city | |
|---|---|---|
| 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 set | 34.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):
| group | vertices | triangles | casts |
|---|---|---|---|
| Furniture (parked cars are most of it) | 9.4 M | 4.8 M | yes |
| Paving | 8.9 M | 5.3 M | no |
| Built | 5.8 M | 2.8 M | no |
| Canopy + Trunk | 1.4 M | 1.6 M | yes |
Geometry was 1.75–1.96 GB of the street view's ~2 GB residency. Two causes, both fixed without changing a pixel:
- The flat fills arrived with every triangle owning its corners (3.0 vertices
a triangle), and the refinement then minted a midpoint per index pair, two
per shared edge.
terrain_refine::weldmerges bit-identical vertices before the refinement. - Furniture and trees were cut into upload-sized pieces in source order, so
every piece's box spanned the cell and went into all four cascades and the main
pass. They (and
split_by_upload_bytes) now fill pieces along a Hilbert curve (cartopolis_geo::patches): same pieces, small boxes.
Measured with the web-release profile (the dev profile's debug assertions
distort every CPU number here), main → this change, two flights each:
| street | main | after |
|---|---|---|
| steady frame | 54.7 ms | 50.8 ms |
main_opaque_pass_3d | 21.5 ms | 19.3 ms |
| GPU residency | 2.16 GB | 1.81 GB |
| settled in | 57.0 / 54.6 s | 53.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 in | main | after |
|---|---|---|
| street | 57.0 / 54.6 s | 29.4 / 29.4 s |
| city | 78.8 / 33.2 s | 27.5 / 15.0 s |
| Earth | 61.6 / 42.5 s | 28.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 frame | city (3 km) | street (120 m) |
|---|---|---|
| defaults | 27.8 ms | 65.3 ms |
| light shafts off | 10.6 ms | 47.7 ms |
| shadows and shafts off | 13.7 ms | 28.3 ms |
| shafts off, 2 cascades | 11.6 ms | 41.4 ms |
| shafts off, fast shadow filter | 10.9 ms | 47.3 ms |
| sky lighting off | 26.6 ms | 61.8 ms |
- The shafts cost ~17 ms at 1 MP, where the M5 Pro measured ~4 ms per
megapixel (
light_shafts::AUTO_MAX_PIXELS). The phone runs them too, at 3.5 MP, unmeasured. - Sky lighting is no longer the frame: 1–7 ms across runs since
sky_bakestopped the every-frame re-bake (CARTO_SKY_BAKE_EVERY_FRAME=1puts 640×360 city back at 27.4 ms against 10.7). Thebalancedrung still has it off for the old reason; there it adds ~6 ms at city, ~2 ms at street. - Shadows cost ~19 ms at street level and little at city; four cascades against two is 6 ms of it, the filter nothing.
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 frame | city (3 km) | street (120 m) | orbit |
|---|---|---|---|
| before | 32.8 ms | 65.8 ms | 17.3 ms |
| after | 13.2 ms | 53.6 ms | 17.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.
| scenario | frame | fps | draws | entities | measured GPU passes | unaccounted |
|---|---|---|---|---|---|---|
| orbit (180 km) | 8.95 ms | 112 | 149 | 1109 | 4.11 ms | 4.84 ms (54 %) |
| low-orbit | 7.82 ms | 128 | 106 | 985 | 4.03 ms | 3.79 ms (49 %) |
| city (3 km) | 14.41 ms | 69 | 522 | 2295 | 4.00 ms | 9.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
- Fill. A resolution sweep of
cityat 640×360 / 1280×720 / 1920×1080 — 1×, 4×, 9× the pixels, andfragment_invocationsduly 0.57 M / 2.2 M / 4.9 M — moved the frame 13.79 → 15.32 → 23.58 ms. The unaccounted remainder was 9.82 / 9.13 / 15.19 ms: a floor of about 10 ms that nine times the pixels barely touches. - The shadow filter.
CARTO_SHADOW_FILTER=fastagainstsoftcut the opaque pass from 2.385 to 1.759 ms — a real, repeatable 0.63 ms, 26 % of that pass — and the frame went 13.77 → 13.87 ms, i.e. nowhere. 0.6 ms of GPU pass time was removed and no frame time came back. - Shadows entirely.
CARTO_NO_SHADOWS=1oncity: 13.73 → 13.94 ms, withdrawsunchanged at 522. The sun is the only casting light (the moon hasshadow_maps_enabled: falseunconditionally), so this is the whole shadow cost, caster passes included, and it is not on the critical path at all.
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
| scenario | unaccounted | entities | µs per entity |
|---|---|---|---|
| orbit | 4.84 ms | 1109 | 4.36 |
| low-orbit | 3.79 ms | 985 | 3.85 |
| city | 9.73 ms | 2295 | 4.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:
| system | streaming (frames 200–299) | settled (frames 1600–1699) |
|---|---|---|
bevy_render::run_render_schedule | 46.8 ms/frame | 14.6 ms/frame |
bevy_render::renderer::render_system | 13.3 | 6.8 |
bevy_app::main_schedule::Main::run_main | 192.0 | 5.9 |
bevy_core_pipeline::schedule::camera_driver | 5.8 | 4.0 |
write_binned_instance_buffers<Opaque3d, MeshPipeline> | 4.5 | 2.4 |
submit_pending_command_buffers | 6.4 | 2.3 |
prepare_preprocess_bind_groups | 3.1 | 1.6 |
main_opaque_pass_3d | — | 0.9 |
map_geometry::update_map_surfaces | 170.4 | absent 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:
-
camera_driverat 3.6 ms/frame settled, second only torender_system. -
Instance-buffer and batching preparation at ~4.2 ms/frame together —
write_binned_instance_buffers2.36,prepare_preprocess_bind_groups1.52,batch_and_prepare_binned_render_phase0.34. All three scale with the number of batched draws, of which this viewpoint has 522, so draw count is the lever on the render thread's CPU even though it is not the lever on the GPU passes.An earlier draft of this section called that 2.4 ms row "pipeline specialization" and it is not. The chrome trace truncated the type name at 58 characters and
Opaque3d, MeshPipelinewas read as a specialization key; the in-harness counter prints the whole path and it isbevy_render::batching::gpu_preprocessing::write_binned_instance_buffers. Nothing here measures specialization, and this note's pipeline-cache entry is neither supported nor contradicted by it.
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:
| scenario | draws | frame |
|---|---|---|
| orbit (180 km) | 149 → 149 | 8.95 → 9.5 ms |
| low-orbit | 106 → 106 | 7.82 → 8.7 ms |
| city (3 km) | 522 → 331 | 14.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/frame | before | after |
|---|---|---|
run_render_schedule | 13.5 | 9.94 |
render_system | 6.36 | 4.85 |
camera_driver | 3.59 | 2.72 |
write_binned_instance_buffers | 2.36 | 1.11 |
prepare_preprocess_bind_groups | 1.52 | 0.80 |
Main::run_main | 5.03 | 5.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, steady | before | bindless globe | + 8 sky samples |
|---|---|---|---|
| orbit | 13.2 ms | 14.7 ms | 11.0 ms |
| low-orbit | 13.4 ms | 14.7 ms | 10.4 ms |
| city | 13.3 ms | 10.2 ms | 6.7 ms |
| street | 10.3 ms | 8.1 ms | 8.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.
-
Writing a shared value into every material.
Assets::get_mutmarks 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_framecounts 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 withget, compare, and takeget_mutonly 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. -
A lock held across the work. On a warm-cache globe tile,
decode_globe_tileran as an argument toresults.lock()…push(…), so the worker held the sink for the whole decode. The main thread'stake_resultsslept on that mutex for 6.5–7.4 ms a frame of a fly-mode turn. -
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::StreamCentremakes Earth mode stream round the focus instead: a ring streamer centres onAnchoredCamera::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. -
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 theearthwindow unmeasurable until it was fixed.
| window | before | after |
|---|---|---|
| city turn, mean / worst frame | 34.5 / 110.6 ms | 27.4 / 29.3 ms |
| city turn, materials re-prepared per frame | 212 | 1.6 |
| Earth turn, mean / worst frame | 48.0 / 70.0 ms | 33.0 / 47.8 ms |
| Earth turn, materials re-prepared per frame | 321 | 8.8 |
| Earth scenario settled | 0 of 2 | 2 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:
- city: 11.9 ms still, 11.3 ms turning;
- Earth before the stream centre: 14.9 ms still, 24.6 ms turning;
- Earth after it: 15.7 ms still, 16.1 ms turning, worst frame 122.6 → 26.7 ms, uploads over the turn 245 → 73 MB;
- street: 77 → 7.6 materials re-prepared per frame while turning.
Two traps in the measurement, both standing.
- A scripted run used to inherit the measuring person's Settings. Settings ▸
Graphics is per-person, and
run_clienthanded it to--shot,--shotsand--perfalike. On the machine above it held an explicitlight_shafts: true. That overrides the 4 MP rule that leaves the shafts off on Automatic, so every run marched them per pixel. Turning shadows off (which starves the march of its shadow map) took city from 27.5 to 12.0 ms. The shadow filter, the cascade count (4 → 1) and the reach (1500 → 600 m) each moved it by under a millisecond. Scripted captures start fromAppPrefs::default()now, as the layer and sky restores already did. Steer them with flags andCARTO_*. - The Mac mini's GPU is shared. The midas VMs run under
Virtualization.frameworkwith paravirtualised graphics. With the client not running,ioreg -r -c IOAcceleratorread 22–61 % "Device Utilization". A GPU-bound number taken while they run describes the box, not the client. Check that reading before believing one.
Negative, at Retina on the M5 Pro:
- MSAA makes no difference:
CARTO_MSAA=1|2|4measured 27.5, 27.5 and 27.8 ms. The switch is new; nothing reached the sample count without moving the whole tier. CARTO_RENDER_SCALE=0.5makes no difference in a headless run either (27.3 against 27.5 ms), while 1280×720 at full scale is 9.3 ms. Open: whether the scale reaches an offscreen target at all.
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, cull | run 1 | run 2 | run 3 |
|---|---|---|---|
| before | 44.66 ms | 40.84 ms | 38.53 ms |
| after | 36.96 ms | 42.56 ms | 40.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
-
osm_buildingsblocks io-pool threads withstd::thread::sleepon two paths insideasync fns — the retry backoff andpace_fallback, both insideoverpass_query, both spanning attempts and endpoints within a single call so a dispatcher cannot express them.async-iois in the graph only transitively; making it a direct dependency, with the reactor thread that implies on Android, is a decision to take on its own.It was three paths per module until 2026-09-14, and those were a different thing:
osm_buildings,street_detailandtall_structureseach paced their own per-cell Overpass queries by sleeping 800 ms on the pool thread after their own request. The spacing is the dispatcher's job —data_layershad already moved it there — so each stream'sPolicynow carriesoverpass_pace().1and the sleeps are gone. Two things came with it. The spacing had to becfg-ed away on wasm, which cannot block, so the web build had no pacing against a public instance at all; it has it now, from the same declaration. And the parking was never only its own stream's problem — aIoTaskPoolthread held for 800 ms a cell is one every other fetch in the app queues behind. -
egui was a second full-resolution pass over the swapchain with
LoadOp::Load— a full tile-memory load and store of the 1080×2340 output, every frame, purely to composite the UI; merging it intoupscalingwas the proposed win. egui left on 2026-11-26. Its successor is no cheaper in kind: the library'sLibCamera(Camera2d, order 100) clears a texture of its own and lays it over the target each frame. Unmeasured. Shrinking the UI's scale is still not the cheap version: it is the layout unit and the rasterisation density at once, so it pays for fill with touch-target size. -
Nothing prewarms the pipeline cache, and
StandardMaterial::depth_biasis part of the specialization key, so each of the ~25 depth-bias rungs is a distinct shader compile. Adreno compiles run 50–300 ms apiece and geometry whose pipeline is not resident is silently skipped. Costs time-to-a-complete-picture after launch and after every teleport, not steady-state frames — and--shotwaits for settle, so the harness hides exactly this.
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:
| size | config | fps | GPU total | transparent pass | fragment invocations |
|---|---|---|---|---|---|
| 640×360 | base | 106.9 | 5.19 ms | 3.21 ms | 231 039 |
| 640×360 | no clouds | 115.4 | 2.08 ms | 0.03 ms | 0 |
| 1280×720 | base | 52.2 | 13.22 ms | 9.39 ms | 922 840 |
| 1280×720 | no clouds | 84.5 | 3.85 ms | 0.03 ms | 0 |
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:
| before | after | |
|---|---|---|
| cloud pass | 9.38 ms | 4.81 ms (−48.7 %) |
| GPU frame | 13.22 ms | 8.14 ms (−38.4 %) |
| frame rate | 54.6 fps | 69.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 octaves | cloud pass | difference from 3 |
|---|---|---|
| 3 | 5.90 ms | reference |
| 2 | 5.05 ms | mean 1.10/255 — clean |
| 1 | 4.02 ms | mean 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:
drawsis still worth measuring, but it is no longer the number. On a part that batches, what matters is how many distinct batch sets the draws fall into —pipeline + material bind group + mesh asset— which is why the material-sharing work (one handle per building lane, one per surface group) buys more than the draw count alone suggests.- Whether it collapses further depends on bindless, which
StandardMaterialdeclares (#[bindless(index_table(range(0..31)))]) and which engages only if the driver reportsTEXTURE_BINDING_ARRAY | BUFFER_BINDING_ARRAYand enough binding-array sampler slots. If it is live, the 224 per-tile materials and the 160 per-label materials stop mattering on their own. That is a log line (RUST_LOG=bevy_render=debug, "Configured wgpu adapter Features"), not a guess, and it should be read before anyone builds a tile atlas or a texture array to solve a problem the driver may already have solved.
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:
- The tile budget that ruled out
Hdr. At the panel's 2772×1272, RGBA8 + D32 is 2 bins andRgba16Float+ D32 is 3, against 39 and 58 on the 619. HDR is affordable, and it also moves tonemapping out of every mesh fragment back into one pass. - The fill scarcity that halved the render scale. Still a real cost — tile memory does not make fragments free — but against ~5× the bandwidth and a far faster GPU, and a point-sampled 2× upscale was the most visible quality cost in the app.
- The 2-big-6-little thermal envelope behind
worker_cap: Some(3). There are no little cores.
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:
| entity | why it was unculled | what it cast |
|---|---|---|
StreamTile (the clipmap) | flat quads + big_space rebasing | a ground plane, onto itself |
| the route ribbon | same | a line lying in the road surface |
| the driver arrow | same | a navigation mark |
| particle emitters | the quads are placed in the vertex shader, so the AABB is the wrong volume | nothing 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.
| before | after | |
|---|---|---|
draws | 488 | 488 |
tris_total | 1688 | 1688 |
tris_shadow | 1368 | 0 |
shadow_casters | 158 | 44 |
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.