[PR #2026] [MERGED] F3 shows the shader pack's GPU time per pass, for either kind of pack #3949

Closed
opened 2026-11-03 04:13:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2026
Author: @ludovic111
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: feat/shader-pass-times


📝 Commits (1)

  • c3763ff F3 shows the shader pack's GPU time per pass, for either kind of pack

📊 Changes

9 files changed (+334 additions, -79 deletions)

View changed files

📝 crates/horizon-client/src/debug_overlay.rs (+38 -0)
📝 crates/horizon-client/src/game.rs (+4 -1)
📝 crates/horizon-client/src/game/debug_keys.rs (+7 -0)
📝 crates/horizon-client/src/gfx.rs (+42 -0)
📝 crates/horizon-client/src/gfx/native_post.rs (+11 -0)
📝 crates/horizon-client/src/gfx/pack_post.rs (+3 -3)
📝 crates/horizon-client/src/gfx/pack_timing.rs (+222 -68)
📝 crates/horizon-client/src/gfx/timing.rs (+2 -2)
📝 docs/shaders.md (+5 -5)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

#1861 (the post stage) is merged; this builds on it.

What

While the F3 overlay is open, the running shader pack's passes are timed on the GPU. This works for a shaders/ pack and for one of Horizon's own packs. The right column then shows the pack's total and its costliest passes, by name: the median of the last 15 timed frames, up to 8 passes, then "N more". Pack authors can check a pass against their [budget] gpu_ms.

  • No stall. pack_timing.rs (shared by both kinds) used to wait for the GPU on the frame after a timed one. Now one frame is timed at a time, and its stamps are resolved once on_submitted_work_done says the GPU has finished. They are read back once mapped, then the next frame is timed. Nothing waits.
  • Accurate first pass. On tiled GPUs a pass's begin stamp can come before the work it waits for. A native pack's first pass now counts from a mark: a one-pixel pass on the world target that ends once the world's draws have. Golden Hour's glow read 0.73 ms without the mark and 0.43 ms with it.
  • No cost without F3. Timing runs only while F3 is open, or always with HORIZON_SHADER_PACK_TIMING=1, which still logs. With F3 closed or no pack, the frame does one Option match.
  • An empty F3 group would shift vanilla's column split, so the group is only added when it has lines.

Screenshots

These are in ~/code/horizon-parity/screenshots/shaders-api-2/:

  • f3-golden.png: Golden Hour, "Shader pack GPU: 0.46 ms in 2 passes / Glow: 0.43 ms / Colour grade: 0.03 ms".
  • f3-java.png: Sildur's Vibrant (shaders/ format), 14 passes: deferred 1.53 ms, shadow 1.40 ms, ...

Self-check

pr_ready (tools/pr_ready.py --quick --base feat/native-shaders-post-2 on ludovics-mac-mini, against feat/native-shaders-post-2 at 1aa6f2162, 3 min 26 s)

Check Result
Scope ✅ 9 files, +334 −79
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (8 s)
clippy ✅ (58 s)
tests: horizon-client ✅ 1295 passed (1 min 51 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 30 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, hardcore_respawn, locator_bar, mace, marker_particles, online_mode and 18 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Harnesses (tools/parity.py --changed origin/main at c3763ff1b): 32 passed, 0 failed (block_removal, command_exec, dedicated_server, secure_chat, server_* ..., world_spawn#1-4).

A/B, no pack, F3 closed (paired, alternating, 4 rounds of horizon-ctl bench 15, offscreen, render distance 12, same seed and view; main = merge base 5bcc87983):

CPU ms/frame (rounds) mean GPU ms mean p99 frame ms
main 0.730 0.747 0.771 0.811 0.765 1.780 11.01
this PR 0.734 0.743 0.756 0.703 0.734 1.788 11.06

No cost without a pack: the differences are within run-to-run noise.

🤖 Generated with Claude Code


🔄 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/2026 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/shader-pass-times` --- ### 📝 Commits (1) - [`c3763ff`](https://github.com/horizon-rust/horizon/commit/c3763ff1b3c138c2f944aae844bfdbdc74e60aa2) F3 shows the shader pack's GPU time per pass, for either kind of pack ### 📊 Changes **9 files changed** (+334 additions, -79 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/debug_overlay.rs` (+38 -0) 📝 `crates/horizon-client/src/game.rs` (+4 -1) 📝 `crates/horizon-client/src/game/debug_keys.rs` (+7 -0) 📝 `crates/horizon-client/src/gfx.rs` (+42 -0) 📝 `crates/horizon-client/src/gfx/native_post.rs` (+11 -0) 📝 `crates/horizon-client/src/gfx/pack_post.rs` (+3 -3) 📝 `crates/horizon-client/src/gfx/pack_timing.rs` (+222 -68) 📝 `crates/horizon-client/src/gfx/timing.rs` (+2 -2) 📝 `docs/shaders.md` (+5 -5) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. #1861 (the post stage) is merged; this builds on it. ## What While the F3 overlay is open, the running shader pack's passes are timed on the GPU. This works for a `shaders/` pack and for one of Horizon's own packs. The right column then shows the pack's total and its costliest passes, by name: the median of the last 15 timed frames, up to 8 passes, then "N more". Pack authors can check a pass against their `[budget] gpu_ms`. - **No stall.** `pack_timing.rs` (shared by both kinds) used to wait for the GPU on the frame after a timed one. Now one frame is timed at a time, and its stamps are resolved once `on_submitted_work_done` says the GPU has finished. They are read back once mapped, then the next frame is timed. Nothing waits. - **Accurate first pass.** On tiled GPUs a pass's begin stamp can come before the work it waits for. A native pack's first pass now counts from a mark: a one-pixel pass on the world target that ends once the world's draws have. Golden Hour's glow read 0.73 ms without the mark and 0.43 ms with it. - **No cost without F3.** Timing runs only while F3 is open, or always with `HORIZON_SHADER_PACK_TIMING=1`, which still logs. With F3 closed or no pack, the frame does one `Option` match. - An empty F3 group would shift vanilla's column split, so the group is only added when it has lines. ## Screenshots These are in `~/code/horizon-parity/screenshots/shaders-api-2/`: - `f3-golden.png`: Golden Hour, "Shader pack GPU: 0.46 ms in 2 passes / Glow: 0.43 ms / Colour grade: 0.03 ms". - `f3-java.png`: Sildur's Vibrant (shaders/ format), 14 passes: deferred 1.53 ms, shadow 1.40 ms, ... ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base feat/native-shaders-post-2` on ludovics-mac-mini, against feat/native-shaders-post-2 at 1aa6f2162, 3 min 26 s) | Check | Result | | --- | --- | | Scope | ✅ 9 files, +334 −79 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (8 s) | | clippy | ✅ (58 s) | | tests: horizon-client | ✅ 1295 passed (1 min 51 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 30 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, hardcore_respawn, locator_bar, mace, marker_particles, online_mode and 18 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Harnesses (`tools/parity.py --changed origin/main` at c3763ff1b): **32 passed, 0 failed** (block_removal, command_exec, dedicated_server, secure_chat, server_* ..., world_spawn#1-4). A/B, no pack, F3 closed (paired, alternating, 4 rounds of `horizon-ctl bench 15`, offscreen, render distance 12, same seed and view; main = merge base 5bcc87983): | | CPU ms/frame (rounds) | mean | GPU ms mean | p99 frame ms | |---|---|---|---|---| | main | 0.730 0.747 0.771 0.811 | 0.765 | 1.780 | 11.01 | | this PR | 0.734 0.743 0.756 0.703 | 0.734 | 1.788 | 11.06 | No cost without a pack: the differences are within run-to-run noise. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:30 +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#3949
No description provided.