[PR #7377] [MERGED] Pose glowing entities' silhouettes on the GPU skin path #7562

Closed
opened 2026-11-03 07:19:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: perf/outline-gpu


📝 Commits (1)

  • fd594cb Pose glowing entities' silhouettes on the GPU skin path

📊 Changes

7 files changed (+180 additions, -33 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+10 -2)
📝 crates/horizon-client-render/src/gfx/entity_outline.rs (+31 -10)
📝 crates/horizon-client-render/src/gfx/entity_skin.rs (+105 -14)
📝 crates/horizon-client/src/game/creatures.rs (+12 -5)
📝 crates/horizon-client/src/game/item_draw.rs (+6 -2)
📝 tests/test_perf_bench.py (+1 -0)
📝 tools/stress_scenes.py (+15 -0)

📄 Description

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

Before this PR, a glowing mob (or dropped item) went to the CPU path whole. The entity outline (OutlineBufferSource) copied the entity's CPU vertices in its team colour, with no normal (glowing.rs mark_outline), so the GPU skin path (#6757, #7056) left glowing entities out.

Now a glowing entity that is not invisible is posed on the GPU like any other, and so is its silhouette:

  • Copy. SkinFrame::outline_since copies the entity's skin jobs as FLAT jobs (#7287: no normal) in the team colour, which is exactly what mark_outline does to vertices.
  • Placement. The same compute dispatch writes them after every entity material in the entity buffer.
  • Drawing. The outline pass draws them from there with a base vertex, after the CPU silhouettes.

Whatever an entity still draws on the CPU (a player's body, a carried block) keeps going through mark_outline. An invisible glowing mob, which shows only its outline, stays on the CPU path. Glowing entities are still not culled, as before.

Exactness

  • Shader test. the_shader_writes_what_the_cpu_reference_computes now also dispatches outline jobs into a second region of the buffer. It checks that:

    • the GPU writes what the CPU reference computes;
    • each silhouette is its draw's vertex with the team colour and a cleared normal, which is mark_outline's result.
  • Screenshots. stress_glowing before and after this PR, 1280×720, against two runs of the same binary:

    • same binary, two runs: 16630 pixels differ (mob animations depend on game time);
    • base vs this PR: 13063 / 16321 pixels.

    So the outlines show no difference beyond that run-to-run noise.

A/B: new stress_glowing scene

1000 glowing mobs: the stress_mobs kinds and grid, with Glowing:1b. Mac mini M4 Pro, RD 16, 1280×720 offscreen, 10 s, 3 alternating pairs. The base is #7287's head (eyes on the GPU path); this PR is rebased onto main after it merged.

Metric base this PR change
avg fps 205.2 / 196.1 / 190.3 373.5 / 384.6 / 375.2 +92 % (197 → 378)
1 % low fps 158.9 / 158.8 / 124.7 215.9 / 257.3 / 218.0 +56 % (147 → 230)
0.1 % low fps 152.1 / 140.2 / 84.9 148.0 / 138.8 / 130.3 level (126 → 139)
frame CPU p50 4.90 ms 2.53 ms −48 %
steady RSS 1282 MB 1015 MB −267 MB

Checks (playhorizon)

Head fd594cb6a:

cargo fmt --all -- --check                                              ok
cargo clippy --profile fast -p horizon-client -p horizon-client-lib -p horizon-client-render --lib --bins --tests -- -D warnings   ok, 0 diagnostics
cargo test -p horizon-client-render --lib entity_skin                   1 passed (lavapipe)
cargo test -p horizon-client-lib --lib mobs::skin                       3 passed
cargo test -p horizon-client --lib creatures                            7 passed
cargo test -p horizon-client --lib item_draw                            2 passed
python3 -m unittest tests.test_perf_bench                               24 passed

🤖 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/7377 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/outline-gpu` --- ### 📝 Commits (1) - [`fd594cb`](https://github.com/horizon-rust/horizon/commit/fd594cb6a015d30ff2fe110c15f4617e58cc7780) Pose glowing entities' silhouettes on the GPU skin path ### 📊 Changes **7 files changed** (+180 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+10 -2) 📝 `crates/horizon-client-render/src/gfx/entity_outline.rs` (+31 -10) 📝 `crates/horizon-client-render/src/gfx/entity_skin.rs` (+105 -14) 📝 `crates/horizon-client/src/game/creatures.rs` (+12 -5) 📝 `crates/horizon-client/src/game/item_draw.rs` (+6 -2) 📝 `tests/test_perf_bench.py` (+1 -0) 📝 `tools/stress_scenes.py` (+15 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Before this PR, a glowing mob (or dropped item) went to the CPU path whole. The entity outline (`OutlineBufferSource`) copied the entity's CPU vertices in its team colour, with no normal (`glowing.rs` `mark_outline`), so the GPU skin path (#6757, #7056) left glowing entities out. Now a glowing entity that is not invisible is posed on the GPU like any other, and so is its silhouette: - **Copy.** `SkinFrame::outline_since` copies the entity's skin jobs as `FLAT` jobs (#7287: no normal) in the team colour, which is exactly what `mark_outline` does to vertices. - **Placement.** The same compute dispatch writes them after every entity material in the entity buffer. - **Drawing.** The outline pass draws them from there with a base vertex, after the CPU silhouettes. Whatever an entity still draws on the CPU (a player's body, a carried block) keeps going through `mark_outline`. An invisible glowing mob, which shows only its outline, stays on the CPU path. Glowing entities are still not culled, as before. ### Exactness - **Shader test.** `the_shader_writes_what_the_cpu_reference_computes` now also dispatches outline jobs into a second region of the buffer. It checks that: - the GPU writes what the CPU reference computes; - each silhouette is its draw's vertex with the team colour and a cleared normal, which is `mark_outline`'s result. - **Screenshots.** `stress_glowing` before and after this PR, 1280×720, against two runs of the same binary: - same binary, two runs: 16630 pixels differ (mob animations depend on game time); - base vs this PR: 13063 / 16321 pixels. So the outlines show no difference beyond that run-to-run noise. ### A/B: new `stress_glowing` scene 1000 glowing mobs: the `stress_mobs` kinds and grid, with `Glowing:1b`. Mac mini M4 Pro, RD 16, 1280×720 offscreen, 10 s, 3 alternating pairs. The base is #7287's head (eyes on the GPU path); this PR is rebased onto main after it merged. | Metric | base | this PR | change | |---|---|---|---| | avg fps | 205.2 / 196.1 / 190.3 | 373.5 / 384.6 / 375.2 | **+92 %** (197 → 378) | | 1 % low fps | 158.9 / 158.8 / 124.7 | 215.9 / 257.3 / 218.0 | **+56 %** (147 → 230) | | 0.1 % low fps | 152.1 / 140.2 / 84.9 | 148.0 / 138.8 / 130.3 | level (126 → 139) | | frame CPU p50 | 4.90 ms | 2.53 ms | **−48 %** | | steady RSS | 1282 MB | 1015 MB | −267 MB | ### Checks (playhorizon) Head fd594cb6a: ``` cargo fmt --all -- --check ok cargo clippy --profile fast -p horizon-client -p horizon-client-lib -p horizon-client-render --lib --bins --tests -- -D warnings ok, 0 diagnostics cargo test -p horizon-client-render --lib entity_skin 1 passed (lavapipe) cargo test -p horizon-client-lib --lib mobs::skin 3 passed cargo test -p horizon-client --lib creatures 7 passed cargo test -p horizon-client --lib item_draw 2 passed python3 -m unittest tests.test_perf_bench 24 passed ``` 🤖 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 07:19:52 +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#7562
No description provided.