perf(renderer): 16 point/spot lights cost ~29 ms/frame; verify tiled light culling #1087

Closed
opened 2026-11-10 00:51:44 +00:00 by SakulFlee · 1 comment
Owner

Summary

The 16 point/spot lights cost about 29.1 ms/frame on the Mali-G720 phone. With shadows already disabled, removing all point/spot lights reduced gpu_deferred from 33.15 ms to 4.01 ms and gpu_scene_total from 36.25 ms to 7.00 ms.

The forward path has the same issue and is only ~8.7% faster overall than deferred; it evaluates all lights per fragment without the tile list.

Hypotheses

  • The tiled light list is too conservative. tile_aabb uses the min/max depth of a 16x16 tile and builds the world-space AABB of that depth slice. At far depth this can span most of the scene, so many tiles include lights that do not actually affect the tile.
  • The forward path loops over all 17 lights for every fragment and has no tiled light list.
  • The per-light BRDF/attenuation work is being repeated for lights that are outside the tile or behind geometry.

Next measurements

  1. Read back tile_light_counts and report average/max lights per tile, plus the overflow count.
  2. Compare with a screen-space light-sphere/tile bounds test, or a clustered/froxel light grid.
  3. Test a forward-path variant with a tiled/clustered light list; do not assume deferred is the only path to optimize.
  4. Check whether culling is the issue before reducing light count or resolution.

Do not implement automatic resolution/refresh changes; #1083 remains separate.

Acceptance criteria

  • The actual number of lights evaluated per tile/pixel is measured.
  • The per-fragment light cost is reduced on device with before/after data.
  • Both forward and deferred paths are improved or the limitation is documented.
  • Visual output remains equivalent for the test scene.
## Summary The 16 point/spot lights cost about **29.1 ms/frame** on the Mali-G720 phone. With shadows already disabled, removing all point/spot lights reduced `gpu_deferred` from 33.15 ms to 4.01 ms and `gpu_scene_total` from 36.25 ms to 7.00 ms. The forward path has the same issue and is only ~8.7% faster overall than deferred; it evaluates all lights per fragment without the tile list. ## Hypotheses - The tiled light list is too conservative. `tile_aabb` uses the min/max depth of a 16x16 tile and builds the world-space AABB of that depth slice. At far depth this can span most of the scene, so many tiles include lights that do not actually affect the tile. - The forward path loops over all 17 lights for every fragment and has no tiled light list. - The per-light BRDF/attenuation work is being repeated for lights that are outside the tile or behind geometry. ## Next measurements 1. Read back `tile_light_counts` and report average/max lights per tile, plus the overflow count. 2. Compare with a screen-space light-sphere/tile bounds test, or a clustered/froxel light grid. 3. Test a forward-path variant with a tiled/clustered light list; do not assume deferred is the only path to optimize. 4. Check whether culling is the issue before reducing light count or resolution. Do not implement automatic resolution/refresh changes; #1083 remains separate. ## Acceptance criteria - The actual number of lights evaluated per tile/pixel is measured. - The per-fragment light cost is reduced on device with before/after data. - Both forward and deferred paths are improved or the limitation is documented. - Visual output remains equivalent for the test scene.
Author
Owner

Batch results: forcing the full 17-light loop is 71.27 ms vs 73.83 ms for tiled culling, and tile sizes 8/16/32 are indistinguishable. The tile lists are effectively all-inclusive.

The reason is #1088: point/spot “range” is intensity / 0.01; intensities 30–60 yield radii of ~55–77 world units, covering the whole scene. Fixing the light range should make this culling test meaningful. Re-run E/F after #1088 before redesigning the culling bounds.

Batch results: forcing the full 17-light loop is 71.27 ms vs 73.83 ms for tiled culling, and tile sizes 8/16/32 are indistinguishable. The tile lists are effectively all-inclusive. The reason is #1088: point/spot “range” is `intensity / 0.01`; intensities 30–60 yield radii of ~55–77 world units, covering the whole scene. Fixing the light range should make this culling test meaningful. Re-run E/F after #1088 before redesigning the culling bounds.
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#1087
No description provided.