[PR #6181] [MERGED] Translucent batching (2/4): bind the large pages up to their last range in use #6702

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

📋 Pull Request Information

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

Base: main ← Head: perf/translucent-bind-used


📝 Commits (1)

  • 18ac513 Renderer: bind the large translucent pages up to their last range in use

📊 Changes

2 files changed (+49 additions, -7 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+11 -7)
📝 crates/horizon-client-render/src/gfx/arena.rs (+38 -0)

📄 Description

🤖 Opened by NerfPhaselock's AI agent (Claude Code, Claude Opus 5.5), not by NerfPhaselock personally.

What and why

Part of #5983 (2 of 4; #5984 was the first).

wgpu clears, on the GPU, whatever part of a vertex or index binding nothing has written yet, before the pass runs:
wgpu-core records the whole bound range as needing initialized memory (create_action(.., NeedsInitializedMemory)
in command/render.rs, for set_vertex_buffer and set_index_buffer) and command/memory_init.rs clears what
isn't (clear_buffer). Draws bound Translucent Batching's large pages whole. When one grows, its new buffer holds the
old ranges and an unwritten tail, so the next frame cleared that tail: up to 256 MiB in one frame, and, once the next
PR moves ranges into a fresh right-sized page, most of that page.

Arena::binding gives a page's buffer up to the end of its last range in use (a grain at least: wgpu refuses an
empty slice), and draw_sections binds the translucent arena's and the sorted indices' pages through it. With
batching off (the default) nothing changes: those draws still bind the section arena's pages whole.

Tests. arena.rs large_pages_are_bound_up_to_their_last_range_in_use: after growth the binding ends at the last
range in use, a free range before it stays bound and none after it, and an empty page binds a grain. GPU test, run on
Vulkan (RTX 4090); it skips without an adapter, and CI has none.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Horizon-only: vanilla has no arena.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on DESKTOP-4R7C0FC, against upstream/main at 3adcfcbb3, 4 min 2 s)

Check Result
Scope ✅ 2 files, +49 −7
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 585 passed (1 min 28 s)
rustfmt ✅ (8 s)
clippy ✅ (53 s)
tests: horizon-client-render ✅ 914 passed (1 min 27 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/6181 **Author:** [@NerfPhaselock](https://github.com/NerfPhaselock) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/translucent-bind-used` --- ### 📝 Commits (1) - [`18ac513`](https://github.com/horizon-rust/horizon/commit/18ac513e8c85e88ac194d7a8d12a88826e98f460) Renderer: bind the large translucent pages up to their last range in use ### 📊 Changes **2 files changed** (+49 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+11 -7) 📝 `crates/horizon-client-render/src/gfx/arena.rs` (+38 -0) </details> ### 📄 Description > 🤖 Opened by NerfPhaselock's AI agent (Claude Code, Claude Opus 5.5), not by NerfPhaselock personally. ## What and why Part of #5983 (2 of 4; #5984 was the first). wgpu clears, on the GPU, whatever part of a vertex or index binding nothing has written yet, before the pass runs: wgpu-core records the whole bound range as needing initialized memory (`create_action(.., NeedsInitializedMemory)` in `command/render.rs`, for `set_vertex_buffer` and `set_index_buffer`) and `command/memory_init.rs` clears what isn't (`clear_buffer`). Draws bound Translucent Batching's large pages whole. When one grows, its new buffer holds the old ranges and an unwritten tail, so the next frame cleared that tail: up to 256 MiB in one frame, and, once the next PR moves ranges into a fresh right-sized page, most of that page. `Arena::binding` gives a page's buffer up to the end of its last range in use (a grain at least: wgpu refuses an empty slice), and `draw_sections` binds the translucent arena's and the sorted indices' pages through it. With batching off (the default) nothing changes: those draws still bind the section arena's pages whole. **Tests.** `arena.rs` `large_pages_are_bound_up_to_their_last_range_in_use`: after growth the binding ends at the last range in use, a free range before it stays bound and none after it, and an empty page binds a grain. GPU test, run on Vulkan (RTX 4090); it skips without an adapter, and CI has none. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [x] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Horizon-only: vanilla has no arena. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on DESKTOP-4R7C0FC, against upstream/main at 3adcfcbb3, 4 min 2 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +49 −7 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 585 passed (1 min 28 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (53 s) | | tests: horizon-client-render | ✅ 914 passed (1 min 27 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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:25:08 +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#6702
No description provided.