perf(renderer): cache the world bind group #936

Merged
SakulFlee merged 2 commits from perf/renderer-bind-group-cache into main 2026-10-26 01:37:53 +00:00
Collaborator

Summary

Stacked on #933 (phase 1a). Caches the world bind group instead of recreating it every frame.

  • Key by camera identity, light-buffer identity, environment identity, sky-parameter buffer and shadow resource generation.
  • Keep the keyed Arcs alive in the cache, so allocator address reuse cannot produce a false hit.
  • Build the bind group after the shadow pass, so a shadow texture reallocation is reflected in the same frame.
  • ShadowRenderer now exposes a generation counter that is bumped when its texture arrays grow.

Buffer and texture contents can still change every frame; only replacing a resource invalidates the binding.

Verification

  • cargo fmt --all -- --check
  • cargo clippy -p orbital_renderer -p orbital_shadow -p orbital_app -- -D warnings
  • cargo test -p orbital_renderer -p orbital_shadow -p orbital_app --no-fail-fast
  • GUI examples were not launched in this environment (no display/GPU).

Refs #781.

## Summary Stacked on #933 (phase 1a). Caches the world bind group instead of recreating it every frame. - Key by camera identity, light-buffer identity, environment identity, sky-parameter buffer and shadow resource generation. - Keep the keyed `Arc`s alive in the cache, so allocator address reuse cannot produce a false hit. - Build the bind group after the shadow pass, so a shadow texture reallocation is reflected in the same frame. - `ShadowRenderer` now exposes a generation counter that is bumped when its texture arrays grow. Buffer and texture contents can still change every frame; only replacing a resource invalidates the binding. ## Verification - `cargo fmt --all -- --check` - `cargo clippy -p orbital_renderer -p orbital_shadow -p orbital_app -- -D warnings` - `cargo test -p orbital_renderer -p orbital_shadow -p orbital_app --no-fail-fast` - GUI examples were not launched in this environment (no display/GPU). Refs #781.
perf(renderer): cache the world bind group
All checks were successful
PR / test (pull_request) Successful in 3m37s
Lint / lint (pull_request) Successful in 2m21s
a5a90dd0c7
World bind groups are now keyed by camera identity, light buffer, environment, sky parameter buffer and shadow resource generation. Moving the build after the shadow pass ensures a shadow texture reallocation is visible in the same frame.

The cache keeps the keyed Arcs alive so allocator address reuse cannot produce a false hit.

Smart test results

Result: PASS

Scope: orbital_renderer, orbital_shadow

Reason: directly changed crates

Elapsed: 37.3s

Workflow run

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

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

Crate Nextest Passed Failed Skipped Doctests Time
orbital_renderer 2 2 0 0 - 0.01s
orbital_shadow 3 3 0 0 - 0.01s
pie showData
    title Nextest outcomes
    "Passed" : 5
xychart-beta
    title "Slowest crates (nextest seconds)"
    x-axis ["orbital_shadow", "orbital_renderer"]
    y-axis "Seconds" 0 --> 1
    bar [0.01, 0.01]
<!-- orbital-ci-test-results --> ## Smart test results **Result:** PASS **Scope:** orbital_renderer, orbital_shadow **Reason:** directly changed crates **Elapsed:** 37.3s [Workflow run](https://forgejo.sakul-flee.de/SakulFlee/Orbital/actions/runs/631) **Overall:** 5 tests, 5 passed, 0 failed, 0 skipped **Nextest:** 5 tests, 5 passed, 0 failed, 0 skipped **Doctests:** no tests reported | Crate | Nextest | Passed | Failed | Skipped | Doctests | Time | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | orbital_renderer | 2 | 2 | 0 | 0 | - | 0.01s | | orbital_shadow | 3 | 3 | 0 | 0 | - | 0.01s | ```mermaid pie showData title Nextest outcomes "Passed" : 5 ``` ```mermaid xychart-beta title "Slowest crates (nextest seconds)" x-axis ["orbital_shadow", "orbital_renderer"] y-axis "Seconds" 0 --> 1 bar [0.01, 0.01] ```
SakulFlee changed target branch from refactor/renderer-phase-1 to main 2026-10-26 01:22:09 +00:00
Merge branch 'main' into perf/renderer-bind-group-cache
All checks were successful
PR / test (pull_request) Successful in 1m11s
Lint / lint (pull_request) Successful in 1m11s
a877b65b45
SakulFlee deleted branch perf/renderer-bind-group-cache 2026-10-26 01:37:53 +00:00
Sign in to join this conversation.
No description provided.