refactor(renderer): extract render scene and own frame resources #933

Merged
SakulFlee merged 1 commit from refactor/renderer-phase-1 into main 2026-10-26 01:22:08 +00:00
Collaborator

Summary

Phase 1 of the renderer overhaul (#781): move the ECS-to-GPU extraction boundary into orbital_renderer and make the renderer own its frame resources.

  • Add orbital_renderer::RenderScene / RenderCamera as an owned snapshot of the active camera, realized models, light buffer, environment, shadow lights and light count.
  • Move camera/light/environment/model/shadow extraction out of ModuleRuntime, removing the raw model-pointer collection and the static OnceLock fallbacks.
  • Move fallback camera/IBL/sky/light-count/shadow resources and world bind-group construction into Renderer.
  • Change ShadowRenderer::render to accept Arc<Model> so no temporary Vec<&Model> is needed.
  • Expose Renderer::camera_buffer(&RenderScene) for overlays.
  • Select winit's Linux backends for standalone orbital_ecs_bridge builds, matching orbital_iced's Linux target section.
  • Add scene extraction tests for light count, shadow slots, disabled casters and missing positions.

RenderScene is deliberately the animation extension point: bone matrices and previous-frame transforms can be added there without touching the render passes. This change is behavior-preserving; single-submit recording and persistent buffer reuse follow in the next phase-1 changes.

Verification

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

Refs #781.

## Summary Phase 1 of the renderer overhaul (#781): move the ECS-to-GPU extraction boundary into `orbital_renderer` and make the renderer own its frame resources. - Add `orbital_renderer::RenderScene` / `RenderCamera` as an owned snapshot of the active camera, realized models, light buffer, environment, shadow lights and light count. - Move camera/light/environment/model/shadow extraction out of `ModuleRuntime`, removing the raw model-pointer collection and the static `OnceLock` fallbacks. - Move fallback camera/IBL/sky/light-count/shadow resources and world bind-group construction into `Renderer`. - Change `ShadowRenderer::render` to accept `Arc<Model>` so no temporary `Vec<&Model>` is needed. - Expose `Renderer::camera_buffer(&RenderScene)` for overlays. - Select winit's Linux backends for standalone `orbital_ecs_bridge` builds, matching `orbital_iced`'s Linux target section. - Add scene extraction tests for light count, shadow slots, disabled casters and missing positions. `RenderScene` is deliberately the animation extension point: bone matrices and previous-frame transforms can be added there without touching the render passes. This change is behavior-preserving; single-submit recording and persistent buffer reuse follow in the next phase-1 changes. ## Verification - `cargo fmt --all -- --check` - `cargo clippy -p orbital_renderer -p orbital_shadow -p orbital_app -p orbital_iced -- -D warnings` - `cargo test -p orbital_renderer -p orbital_shadow -p orbital_app -p orbital_iced --no-fail-fast` - `cargo test -p orbital_renderer --no-fail-fast` - `cargo check -p template_minimal -p template_all_in_one -p template_2d` - GUI examples were not launched in this environment (no display/GPU). Refs #781.
refactor(renderer): extract render scene and own frame resources
Some checks failed
Lint / lint (pull_request) Failing after 1m5s
Templates / templates (pull_request) Failing after 4s
PR / test (pull_request) Has been cancelled
e7a14bd937
Move camera, model, light, environment and shadow-light extraction out of ModuleRuntime into orbital_renderer::RenderScene. The renderer now owns fallback camera, IBL, sky, light-count and shadow resources plus the world bind group, so ModuleRuntime no longer uses raw model pointers or static OnceLock fallbacks.

RenderScene is the ECS-to-renderer boundary; animation support can extend it with bone matrices and previous-frame transforms without changing the render passes.

Smart test results

Result: PASS

Scope: full workspace

Reason: workspace-level change: Cargo.lock

Elapsed: 10m 27s

Workflow run

Overall: 417 tests, 407 passed, 0 failed, 10 skipped

Nextest: 406 tests, 406 passed, 0 failed, 0 skipped
Doctests: 11 tests, 1 passed, 0 failed, 10 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 - 1.01s
orbital_2d 29 29 0 0 0/1 0.27s
orbital_app 10 10 0 0 0/1 0.08s
orbital_camera 4 4 0 0 - 0.04s
orbital_core 2 2 0 0 - 0.02s
orbital_debug_render 0 0 0 0 0/1 0.00s
orbital_debug_ui 38 38 0 0 0/1 0.34s
orbital_ecs 114 114 0 0 0/2 1.03s
orbital_ecs_bridge 39 39 0 0 - 0.46s
orbital_file_manager 5 5 0 0 - 0.08s
orbital_iced 24 24 0 0 - 0.30s
orbital_importer_gltf 13 13 0 0 - 0.27s
orbital_input 11 11 0 0 - 0.12s
orbital_light 6 6 0 0 - 0.11s
orbital_macros 0 0 0 0 0/1 0.00s
orbital_math 4 4 0 0 - 0.07s
orbital_procgeo 2 2 0 0 - 0.04s
orbital_renderer 2 2 0 0 - 0.03s
orbital_resources 18 18 0 0 - 0.50s
orbital_shader_core 0 0 0 0 1/1 0.00s
orbital_shader_preprocessor 12 12 0 0 - 0.36s
orbital_shadow 3 3 0 0 - 0.06s
orbital_text 14 14 0 0 0/1 1.43s
orbital_texture 9 9 0 0 - 0.19s
orbital_touch_ui 1 1 0 0 0/1 0.01s
orbital_ui 32 32 0 0 0/1 0.52s
orbital_world_environment 13 13 0 0 - 0.20s
pie showData
    title Nextest outcomes
    "Passed" : 406
pie showData
    title Doctest outcomes
    "Passed" : 1
    "Skipped" : 10
xychart-beta
    title "Slowest crates (nextest seconds)"
    x-axis ["orbital_text", "orbital_ecs", "orbital", "orbital_ui", "orbital_resources", "orbital_ecs_bridge", "orbital_shader_preprocessor", "orbital_debug_ui"]
    y-axis "Seconds" 0 --> 1.5
    bar [1.43, 1.03, 1.01, 0.52, 0.50, 0.46, 0.36, 0.34]
<!-- orbital-ci-test-results --> ## Smart test results **Result:** PASS **Scope:** full workspace **Reason:** workspace-level change: Cargo.lock **Elapsed:** 10m 27s [Workflow run](https://forgejo.sakul-flee.de/SakulFlee/Orbital/actions/runs/605) **Overall:** 417 tests, 407 passed, 0 failed, 10 skipped **Nextest:** 406 tests, 406 passed, 0 failed, 0 skipped **Doctests:** 11 tests, 1 passed, 0 failed, 10 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 | - | 1.01s | | orbital_2d | 29 | 29 | 0 | 0 | 0/1 | 0.27s | | orbital_app | 10 | 10 | 0 | 0 | 0/1 | 0.08s | | orbital_camera | 4 | 4 | 0 | 0 | - | 0.04s | | orbital_core | 2 | 2 | 0 | 0 | - | 0.02s | | orbital_debug_render | 0 | 0 | 0 | 0 | 0/1 | 0.00s | | orbital_debug_ui | 38 | 38 | 0 | 0 | 0/1 | 0.34s | | orbital_ecs | 114 | 114 | 0 | 0 | 0/2 | 1.03s | | orbital_ecs_bridge | 39 | 39 | 0 | 0 | - | 0.46s | | orbital_file_manager | 5 | 5 | 0 | 0 | - | 0.08s | | orbital_iced | 24 | 24 | 0 | 0 | - | 0.30s | | orbital_importer_gltf | 13 | 13 | 0 | 0 | - | 0.27s | | orbital_input | 11 | 11 | 0 | 0 | - | 0.12s | | orbital_light | 6 | 6 | 0 | 0 | - | 0.11s | | orbital_macros | 0 | 0 | 0 | 0 | 0/1 | 0.00s | | orbital_math | 4 | 4 | 0 | 0 | - | 0.07s | | orbital_procgeo | 2 | 2 | 0 | 0 | - | 0.04s | | orbital_renderer | 2 | 2 | 0 | 0 | - | 0.03s | | orbital_resources | 18 | 18 | 0 | 0 | - | 0.50s | | orbital_shader_core | 0 | 0 | 0 | 0 | 1/1 | 0.00s | | orbital_shader_preprocessor | 12 | 12 | 0 | 0 | - | 0.36s | | orbital_shadow | 3 | 3 | 0 | 0 | - | 0.06s | | orbital_text | 14 | 14 | 0 | 0 | 0/1 | 1.43s | | orbital_texture | 9 | 9 | 0 | 0 | - | 0.19s | | orbital_touch_ui | 1 | 1 | 0 | 0 | 0/1 | 0.01s | | orbital_ui | 32 | 32 | 0 | 0 | 0/1 | 0.52s | | orbital_world_environment | 13 | 13 | 0 | 0 | - | 0.20s | ```mermaid pie showData title Nextest outcomes "Passed" : 406 ``` ```mermaid pie showData title Doctest outcomes "Passed" : 1 "Skipped" : 10 ``` ```mermaid xychart-beta title "Slowest crates (nextest seconds)" x-axis ["orbital_text", "orbital_ecs", "orbital", "orbital_ui", "orbital_resources", "orbital_ecs_bridge", "orbital_shader_preprocessor", "orbital_debug_ui"] y-axis "Seconds" 0 --> 1.5 bar [1.43, 1.03, 1.01, 0.52, 0.50, 0.46, 0.36, 0.34] ```
OpenCode force-pushed refactor/renderer-phase-1 from e7a14bd937
Some checks failed
Lint / lint (pull_request) Failing after 1m5s
Templates / templates (pull_request) Failing after 4s
PR / test (pull_request) Has been cancelled
to 0e713ed05f
All checks were successful
Lint / lint (pull_request) Successful in 2m57s
Templates / templates (pull_request) Successful in 4m7s
PR / test (pull_request) Successful in 11m1s
2026-10-25 18:14:49 +00:00
Compare
SakulFlee deleted branch refactor/renderer-phase-1 2026-10-26 01:22:09 +00:00
Sign in to join this conversation.
No description provided.