[PR #6905] [MERGED] Pose armor stands on the GPU path, and cut per-item lookups #7184

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

📋 Pull Request Information

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

Base: main ← Head: perf/armor-stands-gpu


📝 Commits (1)

  • c8d486c Pose armor stands on the GPU path, and cut per-item lookups

📊 Changes

7 files changed (+222 additions, -53 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/armor_stands.rs (+49 -17)
📝 crates/horizon-client/src/game/creatures.rs (+50 -25)
📝 crates/horizon-client/src/game/entity_model_loading_tests.rs (+8 -2)
📝 crates/horizon-client/src/item_render.rs (+16 -7)
📝 crates/horizon-client/src/mobs/render.rs (+3 -2)
📝 crates/horizon-client/src/mobs/skin.rs (+95 -0)

📄 Description

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

What

Armor stands were the weakest stress scene against vanilla (×2.2, 8.4 ms of frame CPU time for 500 stands, #6808). Every frame, each stand posed and pushed on the CPU:

  • its body and the body's emissive overlay;
  • four armour layers;
  • their trims.

Armor stands on the GPU path. These draws now go through mobs::render::put, so the GPU posing of #6757 takes them whenever it runs. Held items and wings stay on the CPU path. To share the path with mobs:

  • the stand models become Arc<Part>, so the renderer's model store keeps one copy of each;
  • the frame's skin setup moves to the start of entity_geometry (begin_skinning), so every entity kind shares it;
  • the culling of a GPU-posed entity becomes one helper, cull_skinned, used by mobs and stands.

Two lookups no longer repeat.

  • item_render::submit_quads looked up each quad's sprite rect by name (SipHash on a String), though an item's quads share a sprite (a generated item such as the stands' swords has dozens). The rect is now cached like the translucency already was. Dropped items and every held item benefit.
  • Each armour layer built a new pose map. One map now serves the four layers (Poses::reset keeps its capacity).

Tests. armor_stand_models_pose_on_the_gpu_as_on_the_cpu poses the stand models both ways and compares the vertices to the bit. It covers the normal and small stands, each with its main model and four armour layers, a turned head and arm, hidden parts (scale 0, as without arms or base plate), and the glint. Frozen screenshots of the scene show no difference beyond the noise between two runs of the same binary.

A/B: stress scenes, full game

Mac mini M4 Pro, RD 16, 1280×720 offscreen, perf_bench --scenes stress, main (b2258cbf68) against this branch on the same machine. The run stopped after 1.5 alternating pairs, when the Mac's disk fell under 25 GB (other jobs). The table shows main's two runs and the branch's one; the remaining pairs follow when the disk allows.

Scene Metric main This PR Change
stress_armor_stands (500 stands, full armour, sword) avg fps 148 / 131 216 +46…65%
1% low fps 130 / 114 189
frame CPU p50 6.70 / 7.55 ms 4.58 ms −32…39%
RSS 1471 / 1510 MB 1389 MB −80 MB
stress_items (2000 dropped items) avg fps 168 / 177 198 +12…18%
frame CPU p50 5.79 / 5.47 ms 4.90 ms −10…15%

Vanilla 26.3 on the same scenes (#6808): 51 fps for the armor stands and 47 for the items.

Checks

head c8d486ca9e
CI verify (fmt, clippy --workspace --all-targets -D warnings, cargo test --workspace)   pass

With the prepared resources, on the Mac:

  • cargo clippy --profile fast -p horizon-client -p horizon-client-lib --lib --bins --tests -D warnings: ok;
  • mobs::skin: 2 passed;
  • armor_stand: 10 passed;
  • entity_model_loading: 3 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/6905 **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/armor-stands-gpu` --- ### 📝 Commits (1) - [`c8d486c`](https://github.com/horizon-rust/horizon/commit/c8d486ca9ec1b188bbd2e9f820f4310d37b4f564) Pose armor stands on the GPU path, and cut per-item lookups ### 📊 Changes **7 files changed** (+222 additions, -53 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+49 -17) 📝 `crates/horizon-client/src/game/creatures.rs` (+50 -25) 📝 `crates/horizon-client/src/game/entity_model_loading_tests.rs` (+8 -2) 📝 `crates/horizon-client/src/item_render.rs` (+16 -7) 📝 `crates/horizon-client/src/mobs/render.rs` (+3 -2) 📝 `crates/horizon-client/src/mobs/skin.rs` (+95 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Armor stands were the weakest stress scene against vanilla (×2.2, 8.4 ms of frame CPU time for 500 stands, #6808). Every frame, each stand posed and pushed on the CPU: - its body and the body's emissive overlay; - four armour layers; - their trims. **Armor stands on the GPU path.** These draws now go through `mobs::render::put`, so the GPU posing of #6757 takes them whenever it runs. Held items and wings stay on the CPU path. To share the path with mobs: - the stand models become `Arc<Part>`, so the renderer's model store keeps one copy of each; - the frame's skin setup moves to the start of `entity_geometry` (`begin_skinning`), so every entity kind shares it; - the culling of a GPU-posed entity becomes one helper, `cull_skinned`, used by mobs and stands. **Two lookups no longer repeat.** - `item_render::submit_quads` looked up each quad's sprite rect by name (SipHash on a `String`), though an item's quads share a sprite (a generated item such as the stands' swords has dozens). The rect is now cached like the translucency already was. Dropped items and every held item benefit. - Each armour layer built a new pose map. One map now serves the four layers (`Poses::reset` keeps its capacity). **Tests.** `armor_stand_models_pose_on_the_gpu_as_on_the_cpu` poses the stand models both ways and compares the vertices to the bit. It covers the normal and small stands, each with its main model and four armour layers, a turned head and arm, hidden parts (scale 0, as without arms or base plate), and the glint. Frozen screenshots of the scene show no difference beyond the noise between two runs of the same binary. ## A/B: stress scenes, full game Mac mini M4 Pro, RD 16, 1280×720 offscreen, `perf_bench --scenes stress`, main (b2258cbf68) against this branch on the same machine. The run stopped after 1.5 alternating pairs, when the Mac's disk fell under 25 GB (other jobs). The table shows main's two runs and the branch's one; the remaining pairs follow when the disk allows. | Scene | Metric | main | This PR | Change | |---|---|---|---|---| | stress_armor_stands (500 stands, full armour, sword) | avg fps | 148 / 131 | 216 | +46…65% | | | 1% low fps | 130 / 114 | 189 | | | | frame CPU p50 | 6.70 / 7.55 ms | 4.58 ms | −32…39% | | | RSS | 1471 / 1510 MB | 1389 MB | −80 MB | | stress_items (2000 dropped items) | avg fps | 168 / 177 | 198 | +12…18% | | | frame CPU p50 | 5.79 / 5.47 ms | 4.90 ms | −10…15% | Vanilla 26.3 on the same scenes (#6808): 51 fps for the armor stands and 47 for the items. ## Checks ``` head c8d486ca9e CI verify (fmt, clippy --workspace --all-targets -D warnings, cargo test --workspace) pass ``` With the prepared resources, on the Mac: - `cargo clippy --profile fast -p horizon-client -p horizon-client-lib --lib --bins --tests -D warnings`: ok; - `mobs::skin`: 2 passed; - `armor_stand`: 10 passed; - `entity_model_loading`: 3 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 06:35:22 +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#7184
No description provided.