perf: add Android GPU pass timings and fix light/volumetric bottlenecks #1093

Merged
SakulFlee merged 10 commits from feat/perf-timings into main 2026-11-10 18:36:35 +00:00
Owner

Summary

This branch adds pass-level Android GPU timing and fixes the two bottlenecks that the instrumentation exposed:

  • GPU timestamp readback is reliable and split into scene, volumetric inject, volumetric accumulate, volumetric composite, tonemap, and AA stages.
  • Point/spot light range is no longer derived from intensity. The old intensity / 0.01 packing made 30–60 intensity lights span 55–77 world units, so every point/spot light was effectively global and tiled culling was all-inclusive.
  • Light ranges are explicit on LightDescriptor, imported from KHR_lights_punctual, and use a smooth range window in forward, deferred, and volumetric lighting.
  • Added VolumetricQuality::Mobile: reduced resolution-scaled froxel X/Y, 48 depth slices, 8 composite steps, no adaptive depth expansion.
  • Reduced light-culling tiles from 16 px to 8 px; this was positive on Mali and Adreno.
  • Performance metadata/timeline and capture tooling were extended for the new stages.

Measured results

Phone (Mali-G720, 1220×2582):

  • 9.50 → 35.76 FPS across the range/Mobile/composite changes
  • Deferred 73.83 → 7.40 ms
  • Volumetrics 12.67 → 5.42 ms

Tablet (Adreno 810, 2560×1600):

  • 4.47 → 14.56 FPS across the Mobile/composite/8-step changes
  • Deferred 76.43 → 16.2 ms
  • Volumetrics 164 → 14.93 ms
  • Light culling 12.84 → 7.12 ms

The tablet is now limited by native resolution and post-processing; a separate render-scale change is planned in #1083.

Testing

  • cargo fmt --all -- --check
  • cargo clippy for the affected crates with -D warnings
  • cargo test for the affected crates
  • cargo test -p orbital_resources --test wgsl_shaders
  • Android captures on Mali-G720 and Adreno 810, with exact subpass sums and no validation/device-loss errors

No automatic resolution scaling or refresh-rate changes are included.

## Summary This branch adds pass-level Android GPU timing and fixes the two bottlenecks that the instrumentation exposed: - GPU timestamp readback is reliable and split into scene, volumetric inject, volumetric accumulate, volumetric composite, tonemap, and AA stages. - Point/spot light range is no longer derived from intensity. The old `intensity / 0.01` packing made 30–60 intensity lights span 55–77 world units, so every point/spot light was effectively global and tiled culling was all-inclusive. - Light ranges are explicit on `LightDescriptor`, imported from `KHR_lights_punctual`, and use a smooth range window in forward, deferred, and volumetric lighting. - Added `VolumetricQuality::Mobile`: reduced resolution-scaled froxel X/Y, 48 depth slices, 8 composite steps, no adaptive depth expansion. - Reduced light-culling tiles from 16 px to 8 px; this was positive on Mali and Adreno. - Performance metadata/timeline and capture tooling were extended for the new stages. ## Measured results Phone (Mali-G720, 1220×2582): - 9.50 → 35.76 FPS across the range/Mobile/composite changes - Deferred 73.83 → 7.40 ms - Volumetrics 12.67 → 5.42 ms Tablet (Adreno 810, 2560×1600): - 4.47 → 14.56 FPS across the Mobile/composite/8-step changes - Deferred 76.43 → 16.2 ms - Volumetrics 164 → 14.93 ms - Light culling 12.84 → 7.12 ms The tablet is now limited by native resolution and post-processing; a separate render-scale change is planned in #1083. ## Testing - `cargo fmt --all -- --check` - `cargo clippy` for the affected crates with `-D warnings` - `cargo test` for the affected crates - `cargo test -p orbital_resources --test wgsl_shaders` - Android captures on Mali-G720 and Adreno 810, with exact subpass sums and no validation/device-loss errors No automatic resolution scaling or refresh-rate changes are included.
Add a startup metadata sidecar and PERF metadata log line, split update/realize timings, record frame-gap, frame-limiter, GPU-completion and surface-status data, and expose visible overlay state in the CSV. Add opt-in per-system and per-overlay detail behind ORBITAL_PERF_DETAIL.
Use a four-slot asynchronous readback ring, never unmap or overwrite a buffer whose map is still pending, apply the queue timestamp period, and ignore stale/zero generations. This fixes the frozen GPU pass timings that were hiding the Android workload breakdown.
Add timestamp samples for G-buffer, light culling, deferred lighting, forward models and transparent models, keeping gpu_models as the forward model section and gpu_scene_total as the aggregate. This makes the deferred/hybrid GPU cost attributable instead of one ~90 ms bucket.
Stop deriving range from intensity. The old intensity/0.01 packing made 30-60 intensity lights span 55-77 world units, so every light was effectively global; tiled culling could not reduce per-pixel light or shadow work. Add a LightDescriptor range with a 10-unit default, expose with_range, use KHR_lights_punctual range on import, and add a smooth range window to forward, deferred, and volumetric lighting so the cutoff is not a hard edge.
Add separate GPU timestamp samples for volumetric inject, temporal accumulate, and composite. gpu_volumetrics remains the aggregate; this makes the Adreno volumetric cost attributable instead of one ~160 ms bucket.
Add VolumetricQuality::Mobile with a 1/20 X/Y grid, fixed 64 depth slices, and 32 composite steps; the all-in-one example uses it on Android. This targets the Adreno froxel inject/accumulate cost measured at ~160 ms for the previous 213x133x192 Low grid. Also switch light culling from 16px to 8px tiles, which reduced Adreno culling from ~13.1 ms to ~7.1 ms and was neutral-to-positive on Mali.
The tablet Mobile-tier split showed composite at 21.1 ms (61% of volumetrics) with 32 steps. Reduce the Mobile composite to 16 steps while keeping the 128x80x64 froxel grid and 64 depth slices; this targets the remaining fullscreen integration cost directly.
docs(volumetric): match the mobile tier description to its settings
All checks were successful
Lint / lint (pull_request) Successful in 8m39s
Templates / templates (pull_request) Successful in 6m37s
PR / test (pull_request) Successful in 30m29s
e356d4a4e1
The Mobile tier now uses 48 depth slices and 8 composite steps.

Smart test results

Result: PASS

Scope: full workspace

Reason: workspace-level change: Cargo.lock

Elapsed: 26m 24s

Workflow run

Overall: 518 tests, 509 passed, 0 failed, 9 skipped

Nextest: 508 tests, 508 passed, 0 failed, 0 skipped
Doctests: 10 tests, 1 passed, 0 failed, 9 skipped

Outcome charts are split between nextest and doctests. The timing chart covers nextest only.

Crate Nextest Passed Failed Skipped Doctests Time
orbital 1 1 0 0 - 15.03s
orbital-cli 3 3 0 0 - 0.34s
orbital_2d 29 29 0 0 0/1 0.18s
orbital_app 19 19 0 0 0/1 0.11s
orbital_billboard 9 9 0 0 - 0.22s
orbital_camera 8 8 0 0 - 0.04s
orbital_core 2 2 0 0 - 0.01s
orbital_debug_render 2 2 0 0 0/1 0.01s
orbital_debug_ui 51 51 0 0 0/1 0.26s
orbital_ecs 114 114 0 0 0/2 0.59s
orbital_ecs_bridge 45 45 0 0 - 0.28s
orbital_file_manager 5 5 0 0 - 0.23s
orbital_iced 26 26 0 0 - 0.13s
orbital_importer_gltf 16 16 0 0 - 0.15s
orbital_input 11 11 0 0 - 0.05s
orbital_light 8 8 0 0 - 0.04s
orbital_material_shader 2 2 0 0 - 0.01s
orbital_math 4 4 0 0 - 0.02s
orbital_mesh 2 2 0 0 - 0.01s
orbital_procgeo 3 3 0 0 - 0.01s
orbital_render_graph 6 6 0 0 - 0.03s
orbital_renderer 21 21 0 0 - 0.17s
orbital_resources 29 29 0 0 - 1.30s
orbital_shader_core 0 0 0 0 1/1 0.00s
orbital_shader_pbr 4 4 0 0 - 0.02s
orbital_shader_preprocessor 12 12 0 0 - 0.05s
orbital_shadow 3 3 0 0 - 0.01s
orbital_text 14 14 0 0 0/1 0.30s
orbital_texture 11 11 0 0 - 0.06s
orbital_touch_ui 1 1 0 0 0/1 0.01s
orbital_ui 32 32 0 0 0/1 0.16s
orbital_world_environment 13 13 0 0 - 0.06s
template_all_in_one 2 2 0 0 - 0.01s
pie showData
    title Nextest outcomes
    "Passed" : 508
pie showData
    title Doctest outcomes
    "Passed" : 1
    "Skipped" : 9
xychart-beta
    title "Slowest crates (nextest seconds)"
    x-axis ["orbital", "orbital_resources", "orbital_ecs", "orbital-cli", "orbital_text", "orbital_ecs_bridge", "orbital_debug_ui", "orbital_file_manager"]
    y-axis "Seconds" 0 --> 15.1
    bar [15.03, 1.30, 0.59, 0.34, 0.30, 0.28, 0.26, 0.23]
<!-- orbital-ci-test-results --> ## Smart test results **Result:** PASS **Scope:** full workspace **Reason:** workspace-level change: Cargo.lock **Elapsed:** 26m 24s [Workflow run](https://forgejo.sakul-flee.de/SakulFlee/Orbital/actions/runs/1204) **Overall:** 518 tests, 509 passed, 0 failed, 9 skipped **Nextest:** 508 tests, 508 passed, 0 failed, 0 skipped **Doctests:** 10 tests, 1 passed, 0 failed, 9 skipped _Outcome charts are split between nextest and doctests. The timing chart covers nextest only._ | Crate | Nextest | Passed | Failed | Skipped | Doctests | Time | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | orbital | 1 | 1 | 0 | 0 | - | 15.03s | | orbital-cli | 3 | 3 | 0 | 0 | - | 0.34s | | orbital_2d | 29 | 29 | 0 | 0 | 0/1 | 0.18s | | orbital_app | 19 | 19 | 0 | 0 | 0/1 | 0.11s | | orbital_billboard | 9 | 9 | 0 | 0 | - | 0.22s | | orbital_camera | 8 | 8 | 0 | 0 | - | 0.04s | | orbital_core | 2 | 2 | 0 | 0 | - | 0.01s | | orbital_debug_render | 2 | 2 | 0 | 0 | 0/1 | 0.01s | | orbital_debug_ui | 51 | 51 | 0 | 0 | 0/1 | 0.26s | | orbital_ecs | 114 | 114 | 0 | 0 | 0/2 | 0.59s | | orbital_ecs_bridge | 45 | 45 | 0 | 0 | - | 0.28s | | orbital_file_manager | 5 | 5 | 0 | 0 | - | 0.23s | | orbital_iced | 26 | 26 | 0 | 0 | - | 0.13s | | orbital_importer_gltf | 16 | 16 | 0 | 0 | - | 0.15s | | orbital_input | 11 | 11 | 0 | 0 | - | 0.05s | | orbital_light | 8 | 8 | 0 | 0 | - | 0.04s | | orbital_material_shader | 2 | 2 | 0 | 0 | - | 0.01s | | orbital_math | 4 | 4 | 0 | 0 | - | 0.02s | | orbital_mesh | 2 | 2 | 0 | 0 | - | 0.01s | | orbital_procgeo | 3 | 3 | 0 | 0 | - | 0.01s | | orbital_render_graph | 6 | 6 | 0 | 0 | - | 0.03s | | orbital_renderer | 21 | 21 | 0 | 0 | - | 0.17s | | orbital_resources | 29 | 29 | 0 | 0 | - | 1.30s | | orbital_shader_core | 0 | 0 | 0 | 0 | 1/1 | 0.00s | | orbital_shader_pbr | 4 | 4 | 0 | 0 | - | 0.02s | | orbital_shader_preprocessor | 12 | 12 | 0 | 0 | - | 0.05s | | orbital_shadow | 3 | 3 | 0 | 0 | - | 0.01s | | orbital_text | 14 | 14 | 0 | 0 | 0/1 | 0.30s | | orbital_texture | 11 | 11 | 0 | 0 | - | 0.06s | | orbital_touch_ui | 1 | 1 | 0 | 0 | 0/1 | 0.01s | | orbital_ui | 32 | 32 | 0 | 0 | 0/1 | 0.16s | | orbital_world_environment | 13 | 13 | 0 | 0 | - | 0.06s | | template_all_in_one | 2 | 2 | 0 | 0 | - | 0.01s | ```mermaid pie showData title Nextest outcomes "Passed" : 508 ``` ```mermaid pie showData title Doctest outcomes "Passed" : 1 "Skipped" : 9 ``` ```mermaid xychart-beta title "Slowest crates (nextest seconds)" x-axis ["orbital", "orbital_resources", "orbital_ecs", "orbital-cli", "orbital_text", "orbital_ecs_bridge", "orbital_debug_ui", "orbital_file_manager"] y-axis "Seconds" 0 --> 15.1 bar [15.03, 1.30, 0.59, 0.34, 0.30, 0.28, 0.26, 0.23] ```
Sign in to join this conversation.
No description provided.