[PR #6756] [MERGED] Renderer: a compute pass that poses entity models #7075

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

📋 Pull Request Information

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

Base: main ← Head: perf/entity-skin-pass


📝 Commits (3)

  • 3e642d0 Renderer: a compute pass that poses entity models
  • dbb78b8 Merge remote-tracking branch 'origin/main' into perf/entity-skin-pass
  • 27877c6 Renderer: the pack uniforms test frame sends no posed entities

📊 Changes

5 files changed (+675 additions, -6 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+51 -6)
➕ crates/horizon-client-render/src/gfx/entity_skin.rs (+511 -0)
➕ crates/horizon-client-render/src/gfx/entity_skin.wgsl (+110 -0)
📝 crates/horizon-client-render/src/gfx/pack_uniforms.rs (+1 -0)
📝 crates/horizon-client/src/game.rs (+2 -0)

📄 Description

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

What

This is the first of three stacked PRs that pose mob models on the GPU (workstream #8 of the client-perf effort). In an RD 32 flight (perf-20x-baseline.md), entity geometry rebuilt on the CPU every frame takes 17% of render-thread time. This PR adds only the renderer side. Nothing sends it work yet: Frame::skin stays None until the next PR.

  • Model store. gfx/entity_skin.rs keeps a store of model-space vertices on the GPU: position / 16, model UV, the face's axis normal and its part index. It grows as the game hands over new models.
  • Per frame. A compute pass (entity_skin.wgsl) reads one matrix pair per drawn part and one job per run of model vertices (texture rect, scroll, colour, light, overlay, glint). It writes mesher::Vertex words into the entity buffer, ahead of the CPU-built entities. Every pass that reads that buffer (opaque, cutout, OIT, shadows, HDR marks, outlines) sees the same vertices it saw before.

Why compute expansion and not vertex-shader skinning. The entity buffer is read by many pipelines. Writing the posed vertices into it keeps every one of them unchanged. Skinning in each vertex shader would have meant changing each pipeline and its pack variants.

Bit for bit. expand is the CPU reference: glam's transform_point3 order, axis normals taken as exact normal-matrix columns, and as i8 normal packing. the_shader_writes_what_the_cpu_reference_computes runs the shader on a real device and compares its output with expand, to the byte. It uses turned and non-uniformly scaled parts, a scrolled texture and the glint, and checks that the 5 vertices before the posed ones stay untouched.

When it is on. The pass needs compute and four storage buffers. It stays off with a shader pack, a native pack, frame generation, or HORIZON_NO_ENTITY_SKIN=1.

Next in the stack: #6757, the game-side walk, with the A/B table.

Checks

These ran on playhorizon instead of pr_ready.py (the slot-limited box):

head 27877c639e (3e642d0acd + main merged + `skin: None` in pack_uniforms' new test frame); CI verify passed on it
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 --profile fast -p horizon-client-render --lib entity_skin   1 passed (on a real wgpu adapter, not skipped)

🤖 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/6756 **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/entity-skin-pass` --- ### 📝 Commits (3) - [`3e642d0`](https://github.com/horizon-rust/horizon/commit/3e642d0acdf4eecf413e971bbfafe72b128d6e26) Renderer: a compute pass that poses entity models - [`dbb78b8`](https://github.com/horizon-rust/horizon/commit/dbb78b8a4c89a5e887ebb45bdf7fd8a8061a3880) Merge remote-tracking branch 'origin/main' into perf/entity-skin-pass - [`27877c6`](https://github.com/horizon-rust/horizon/commit/27877c639e83876dfec83f8d6d6a4339afe5f247) Renderer: the pack uniforms test frame sends no posed entities ### 📊 Changes **5 files changed** (+675 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+51 -6) ➕ `crates/horizon-client-render/src/gfx/entity_skin.rs` (+511 -0) ➕ `crates/horizon-client-render/src/gfx/entity_skin.wgsl` (+110 -0) 📝 `crates/horizon-client-render/src/gfx/pack_uniforms.rs` (+1 -0) 📝 `crates/horizon-client/src/game.rs` (+2 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What This is the first of three stacked PRs that pose mob models on the GPU (workstream #8 of the client-perf effort). In an RD 32 flight (`perf-20x-baseline.md`), entity geometry rebuilt on the CPU every frame takes 17% of render-thread time. This PR adds only the renderer side. Nothing sends it work yet: `Frame::skin` stays `None` until the next PR. - **Model store.** `gfx/entity_skin.rs` keeps a store of model-space vertices on the GPU: position / 16, model UV, the face's axis normal and its part index. It grows as the game hands over new models. - **Per frame.** A compute pass (`entity_skin.wgsl`) reads one matrix pair per drawn part and one job per run of model vertices (texture rect, scroll, colour, light, overlay, glint). It writes `mesher::Vertex` words into the entity buffer, **ahead of** the CPU-built entities. Every pass that reads that buffer (opaque, cutout, OIT, shadows, HDR marks, outlines) sees the same vertices it saw before. **Why compute expansion and not vertex-shader skinning.** The entity buffer is read by many pipelines. Writing the posed vertices into it keeps every one of them unchanged. Skinning in each vertex shader would have meant changing each pipeline and its pack variants. **Bit for bit.** `expand` is the CPU reference: glam's `transform_point3` order, axis normals taken as exact normal-matrix columns, and `as i8` normal packing. `the_shader_writes_what_the_cpu_reference_computes` runs the shader on a real device and compares its output with `expand`, to the byte. It uses turned and non-uniformly scaled parts, a scrolled texture and the glint, and checks that the 5 vertices before the posed ones stay untouched. **When it is on.** The pass needs compute and four storage buffers. It stays off with a shader pack, a native pack, frame generation, or `HORIZON_NO_ENTITY_SKIN=1`. Next in the stack: #6757, the game-side walk, with the A/B table. ## Checks These ran on playhorizon instead of `pr_ready.py` (the slot-limited box): ``` head 27877c639e (3e642d0acd + main merged + `skin: None` in pack_uniforms' new test frame); CI verify passed on it 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 --profile fast -p horizon-client-render --lib entity_skin 1 passed (on a real wgpu adapter, not skipped) ``` 🤖 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:33: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#7075
No description provided.