perf(renderer): per-light shadow path costs ~40 ms; PCF taps are secondary #1086

Closed
opened 2026-11-10 00:51:44 +00:00 by SakulFlee · 0 comments
Owner

Update: the cost is not PCF taps or shadow-map resolution

Phone A/B results:

  • 3x3 PCF (9 taps): gpu_deferred 73.83 ms
  • 1 tap: 69.61 ms — only 4.2 ms saved
  • 4 taps: 73.14 ms — only 0.7 ms saved
  • 512 shadow maps: 73.97 ms
  • 2048 shadow maps: 74.05 ms

So the ~40 ms shadow cost is not the number of texture taps and not shadow-map bandwidth.

The cost is the per-light shadow path and the number of shadowed lights evaluated. Disabling spot shadows removes ~24.7 ms; disabling point shadows removes ~13.7 ms. Removing the eight unshadowed R5 point lights also removes ~31.9 ms, which points at the per-light shadow-slot scan and repeated light setup, not just shadow sampling.

Root cause candidate: #1088. Point/spot “range” is packed as intensity / 0.01, so lights with intensity 30–60 get a radius of ~55–77 world units. Every light covers the whole scene, so tiled culling is all-inclusive and every pixel pays for most light/shadow evaluations.

The first fix is the explicit range in #1088. If further optimization is needed after that, add a per-light shadow-slot index / has_shadow flag so unshadowed lights do not scan the shadow slot array, and avoid reloading the light in compute_shadow_for_light.

## Update: the cost is not PCF taps or shadow-map resolution Phone A/B results: - 3x3 PCF (9 taps): `gpu_deferred` 73.83 ms - 1 tap: 69.61 ms — only 4.2 ms saved - 4 taps: 73.14 ms — only 0.7 ms saved - 512 shadow maps: 73.97 ms - 2048 shadow maps: 74.05 ms So the ~40 ms shadow cost is not the number of texture taps and not shadow-map bandwidth. The cost is the per-light shadow path and the number of shadowed lights evaluated. Disabling spot shadows removes ~24.7 ms; disabling point shadows removes ~13.7 ms. Removing the eight unshadowed R5 point lights also removes ~31.9 ms, which points at the per-light shadow-slot scan and repeated light setup, not just shadow sampling. Root cause candidate: #1088. Point/spot “range” is packed as `intensity / 0.01`, so lights with intensity 30–60 get a radius of ~55–77 world units. Every light covers the whole scene, so tiled culling is all-inclusive and every pixel pays for most light/shadow evaluations. The first fix is the explicit range in #1088. If further optimization is needed after that, add a per-light shadow-slot index / `has_shadow` flag so unshadowed lights do not scan the shadow slot array, and avoid reloading the light in `compute_shadow_for_light`.
SakulFlee changed title from perf(android): shadow sampling costs ~40 ms/frame on Mali-G720 to perf(renderer): per-light shadow path costs ~40 ms; PCF taps are secondary 2026-11-10 01:30:13 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
SakulFlee/Orbital#1086
No description provided.