[PR #5887] [MERGED] Time Horizon's own render passes on the GPU #6540

Closed
opened 2026-11-03 06:22:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5887
Author: @kacpherek
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: perf/gpu-pass-timings


📝 Commits (7)

  • 3e9805e Time Horizon's own render passes on the GPU
  • 9025a1a Show Horizon's own GPU pass times in F3 and the control socket
  • c627a02 Pass the timing option on without re-borrowing it
  • ad4877f List gpu-passes in the horizon-ctl reference
  • 7ec69de Merge remote-tracking branch 'origin/main' into pk1/5887
  • 5c785a2 Format the pass timing calls
  • 130acf3 Native shadow map: the depth pass takes the pass timing (main split begin into depth_pass)

📊 Changes

19 files changed (+267 additions, -52 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+104 -21)
📝 crates/horizon-client-render/src/gfx/animate.rs (+3 -2)
📝 crates/horizon-client-render/src/gfx/cull.rs (+6 -1)
📝 crates/horizon-client-render/src/gfx/entity_outline.rs (+11 -2)
📝 crates/horizon-client-render/src/gfx/flat.rs (+8 -3)
📝 crates/horizon-client-render/src/gfx/hdr.rs (+17 -4)
📝 crates/horizon-client-render/src/gfx/native_shadow.rs (+9 -4)
📝 crates/horizon-client-render/src/gfx/oit.rs (+15 -3)
📝 crates/horizon-client-render/src/gfx/pack_timing.rs (+18 -2)
📝 crates/horizon-client-render/src/gfx/world_post.rs (+7 -3)
📝 crates/horizon-client-render/src/hud.rs (+4 -0)
📝 crates/horizon-client-render/src/menu_blur.rs (+2 -0)
📝 crates/horizon-client-render/src/post_chain.rs (+15 -0)
📝 crates/horizon-client/src/bin/horizon-ctl/commands.rs (+1 -0)
📝 crates/horizon-client/src/debug_overlay.rs (+6 -4)
📝 crates/horizon-client/src/game.rs (+4 -1)
📝 crates/horizon-client/src/game/control.rs (+29 -2)
📝 crates/horizon-client/src/game/debug_lines.rs (+7 -0)
📝 docs/horizon-ctl-commands.md (+1 -0)

📄 Description

The renderer only reported one GPU time for the whole frame, so a frame that got slower on the GPU gave no hint where. Shader packs already had per-pass GPU timing (PassTiming). This PR uses the same timer for Horizon's own passes.

What it does

  • Every per-frame pass of Horizon's renderer is timed with its own name: World, World after culling, Occlusion test, Flatten, Water mirror, Hand, Post, TAA, HDR, OIT stages, Entity outline, Post effect, Menu blur, HUD and others. PassTiming gains compute_writes for compute passes.
  • F3 shows the times under "Horizon passes" while it is open, next to the shader pack's.
  • horizon-ctl gpu-passes on turns timing on from the control socket. bench and stats then reply with gpu_passes, each pass's median GPU milliseconds.
  • Timing costs nothing while it is off. It is on only while F3 is open, with gpu-passes on, or with HORIZON_SHADER_PACK_TIMING=1.

Limits

  • On Metal the GPU can only time pass boundaries. Sky, terrain, entities, clouds and particles are drawn inside one World pass, so they show as one number there.
  • Shader-pack passes keep their own timer. Screenshots, readbacks and one-off work (atlas building, warm-up) are not timed.
  • At most 64 passes per frame are timed. Passes with the same name (for example the OIT feature passes) are pooled.

Example

M1 Pro, 1280x720, render distance 24, far distance 256, standing still:

World                 9.86 ms
World after culling   0.99 ms
Flatten               0.35 ms
Post                  0.19 ms
Screen effects        0.16 ms
Occlusion test        0.11 ms

With it I found that RGSS texture filtering (#4843) costs about 2.2 ms of GPU a frame on this machine: 10.2 ms with RGSS against 8.0 ms with None or Anisotropic.

Testing

  • cargo clippy -p horizon-client-render -p horizon-client --all-targets -- -D warnings: clean.
  • cargo test -p horizon-client-render -p horizon-client: passing. docs/horizon-ctl-commands.md regenerated.
  • Ran a release build and read the pass times through horizon-ctl bench with gpu-passes on.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5887 **Author:** [@kacpherek](https://github.com/kacpherek) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/gpu-pass-timings` --- ### 📝 Commits (7) - [`3e9805e`](https://github.com/horizon-rust/horizon/commit/3e9805e29563f369f5f35774332d0939c2e5fd5b) Time Horizon's own render passes on the GPU - [`9025a1a`](https://github.com/horizon-rust/horizon/commit/9025a1ac46486373d2a193b3ba944447ecd9a324) Show Horizon's own GPU pass times in F3 and the control socket - [`c627a02`](https://github.com/horizon-rust/horizon/commit/c627a02c56f7866e856a2843c68182ccd1a7ae89) Pass the timing option on without re-borrowing it - [`ad4877f`](https://github.com/horizon-rust/horizon/commit/ad4877f432a4b12b3d292db6da039d3f1cc3f424) List gpu-passes in the horizon-ctl reference - [`7ec69de`](https://github.com/horizon-rust/horizon/commit/7ec69de302302b86d7bbbb9c55a4ef39cc7fdd60) Merge remote-tracking branch 'origin/main' into pk1/5887 - [`5c785a2`](https://github.com/horizon-rust/horizon/commit/5c785a252cd5306158e9bbd8dc9d3113a0fc13dd) Format the pass timing calls - [`130acf3`](https://github.com/horizon-rust/horizon/commit/130acf3d3d54bd07b12bd6ef0e7395dea02c72e0) Native shadow map: the depth pass takes the pass timing (main split begin into depth_pass) ### 📊 Changes **19 files changed** (+267 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+104 -21) 📝 `crates/horizon-client-render/src/gfx/animate.rs` (+3 -2) 📝 `crates/horizon-client-render/src/gfx/cull.rs` (+6 -1) 📝 `crates/horizon-client-render/src/gfx/entity_outline.rs` (+11 -2) 📝 `crates/horizon-client-render/src/gfx/flat.rs` (+8 -3) 📝 `crates/horizon-client-render/src/gfx/hdr.rs` (+17 -4) 📝 `crates/horizon-client-render/src/gfx/native_shadow.rs` (+9 -4) 📝 `crates/horizon-client-render/src/gfx/oit.rs` (+15 -3) 📝 `crates/horizon-client-render/src/gfx/pack_timing.rs` (+18 -2) 📝 `crates/horizon-client-render/src/gfx/world_post.rs` (+7 -3) 📝 `crates/horizon-client-render/src/hud.rs` (+4 -0) 📝 `crates/horizon-client-render/src/menu_blur.rs` (+2 -0) 📝 `crates/horizon-client-render/src/post_chain.rs` (+15 -0) 📝 `crates/horizon-client/src/bin/horizon-ctl/commands.rs` (+1 -0) 📝 `crates/horizon-client/src/debug_overlay.rs` (+6 -4) 📝 `crates/horizon-client/src/game.rs` (+4 -1) 📝 `crates/horizon-client/src/game/control.rs` (+29 -2) 📝 `crates/horizon-client/src/game/debug_lines.rs` (+7 -0) 📝 `docs/horizon-ctl-commands.md` (+1 -0) </details> ### 📄 Description The renderer only reported one GPU time for the whole frame, so a frame that got slower on the GPU gave no hint where. Shader packs already had per-pass GPU timing (`PassTiming`). This PR uses the same timer for Horizon's own passes. ## What it does - Every per-frame pass of Horizon's renderer is timed with its own name: World, World after culling, Occlusion test, Flatten, Water mirror, Hand, Post, TAA, HDR, OIT stages, Entity outline, Post effect, Menu blur, HUD and others. `PassTiming` gains `compute_writes` for compute passes. - F3 shows the times under "Horizon passes" while it is open, next to the shader pack's. - `horizon-ctl gpu-passes on` turns timing on from the control socket. `bench` and `stats` then reply with `gpu_passes`, each pass's median GPU milliseconds. - Timing costs nothing while it is off. It is on only while F3 is open, with `gpu-passes on`, or with `HORIZON_SHADER_PACK_TIMING=1`. ## Limits - On Metal the GPU can only time pass boundaries. Sky, terrain, entities, clouds and particles are drawn inside one World pass, so they show as one number there. - Shader-pack passes keep their own timer. Screenshots, readbacks and one-off work (atlas building, warm-up) are not timed. - At most 64 passes per frame are timed. Passes with the same name (for example the OIT feature passes) are pooled. ## Example M1 Pro, 1280x720, render distance 24, far distance 256, standing still: ``` World 9.86 ms World after culling 0.99 ms Flatten 0.35 ms Post 0.19 ms Screen effects 0.16 ms Occlusion test 0.11 ms ``` With it I found that RGSS texture filtering (#4843) costs about 2.2 ms of GPU a frame on this machine: 10.2 ms with RGSS against 8.0 ms with None or Anisotropic. ## Testing - `cargo clippy -p horizon-client-render -p horizon-client --all-targets -- -D warnings`: clean. - `cargo test -p horizon-client-render -p horizon-client`: passing. `docs/horizon-ctl-commands.md` regenerated. - Ran a release build and read the pass times through `horizon-ctl bench` with `gpu-passes on`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:22:38 +07:00
Sign in to join this conversation.
No milestone
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
horizon-rust/horizon#6540
No description provided.