perf: reduce GPU frame cost from billboard churn and 4K light culling #1104

Merged
SakulFlee merged 3 commits from perf/gpu-frame-cost into main 2026-11-11 21:47:08 +00:00
Owner

Reduces the GPU frame cost behind the 4K Linux surface_acquire wait.

  • Billboard transforms were recomputed every frame, but every billboard was marked dirty even when unchanged. That forced model realization and a full shadow-map refresh every frame while the camera was still.
  • Light culling now uses 16 px tiles above four million pixels, keeping the per-tile light loop bounded at 4K while preserving 8 px tiles on phones and laptops.

4K borderless, vsync off, Immediate, RX 9060 XT / RADV: ~258 → ~349 FPS; full GPU pass sum 3.72 → 2.81 ms; gpu_shadow 0.99 → 0.24 ms; gpu_light_culling 0.46 → 0.31 ms.

The remaining surface_acquire wait is GPU backpressure, not a compositor stall. PERFORMANCE_REPORTING.md now documents how to classify it.

Refs #1081
Note: the commits are unsigned because the GPG agent timed out waiting for a passphrase. Sign/amend them before opening the PR if your branch protection requires it.

Reduces the GPU frame cost behind the 4K Linux `surface_acquire` wait. - Billboard transforms were recomputed every frame, but every billboard was marked dirty even when unchanged. That forced model realization and a full shadow-map refresh every frame while the camera was still. - Light culling now uses 16 px tiles above four million pixels, keeping the per-tile light loop bounded at 4K while preserving 8 px tiles on phones and laptops. 4K borderless, vsync off, Immediate, RX 9060 XT / RADV: ~258 → ~349 FPS; full GPU pass sum 3.72 → 2.81 ms; `gpu_shadow` 0.99 → 0.24 ms; `gpu_light_culling` 0.46 → 0.31 ms. The remaining `surface_acquire` wait is GPU backpressure, not a compositor stall. `PERFORMANCE_REPORTING.md` now documents how to classify it. Refs #1081 Note: the commits are unsigned because the GPG agent timed out waiting for a passphrase. Sign/amend them before opening the PR if your branch protection requires it.
Billboard transforms are recomputed every frame, but the system marked
every billboard model dirty even when the pose was unchanged. That forced a
model realization and a full shadow-map update every frame while the camera
was still, because any dirty model sets the global shadow refresh.

Compare the computed transform with the existing instance and only update
the instance and dirty flag when it changes. Keep retrying while a billboard
has not been realized yet.
Light culling evaluates the per-tile light loop for every 8 px tile, so a
4K surface dispatches four times as many tiles as 1080p. Use 16 px tiles
above four million pixels to keep the tile count bounded while preserving
the small tiles that help on phones and laptops.
docs(perf): explain GPU-bound surface waits
All checks were successful
Lint / lint (pull_request) Successful in 5m22s
PR / test (pull_request) Successful in 7m10s
a6ace57bdc
Document how to distinguish GPU backpressure from a compositor or swapchain
stall: sum the individual GPU pass columns instead of reading
gpu_scene_total, and reduce GPU work when the sum matches the frame period.
Author
Owner

Closes #1081

Closes #1081

Smart test results

Result: PASS

Scope: orbital_billboard, orbital_renderer

Reason: directly changed crates

Elapsed: 5m 41s

Workflow run

Overall: 35 tests, 35 passed, 0 failed, 0 skipped

Nextest: 35 tests, 35 passed, 0 failed, 0 skipped
Doctests: no tests reported

Crate Nextest Passed Failed Skipped Doctests Time
orbital_billboard 12 12 0 0 - 3.47s
orbital_renderer 23 23 0 0 - 0.25s
pie showData
    title Nextest outcomes
    "Passed" : 35
xychart-beta
    title "Slowest crates (nextest seconds)"
    x-axis ["orbital_billboard", "orbital_renderer"]
    y-axis "Seconds" 0 --> 3.5
    bar [3.47, 0.25]
<!-- orbital-ci-test-results --> ## Smart test results **Result:** PASS **Scope:** orbital_billboard, orbital_renderer **Reason:** directly changed crates **Elapsed:** 5m 41s [Workflow run](https://forgejo.sakul-flee.de/SakulFlee/Orbital/actions/runs/1266) **Overall:** 35 tests, 35 passed, 0 failed, 0 skipped **Nextest:** 35 tests, 35 passed, 0 failed, 0 skipped **Doctests:** no tests reported | Crate | Nextest | Passed | Failed | Skipped | Doctests | Time | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | orbital_billboard | 12 | 12 | 0 | 0 | - | 3.47s | | orbital_renderer | 23 | 23 | 0 | 0 | - | 0.25s | ```mermaid pie showData title Nextest outcomes "Passed" : 35 ``` ```mermaid xychart-beta title "Slowest crates (nextest seconds)" x-axis ["orbital_billboard", "orbital_renderer"] y-axis "Seconds" 0 --> 3.5 bar [3.47, 0.25] ```
SakulFlee deleted branch perf/gpu-frame-cost 2026-11-11 21:47:08 +00:00
Sign in to join this conversation.
No description provided.