[PR #6423] [MERGED] Menu blur and entity outline targets are freed while no frame uses them #6862

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

📋 Pull Request Information

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

Base: main ← Head: mem-free-blur-outline-targets


📝 Commits (1)

  • 45129f3 Menu blur and entity outline targets are freed while no frame uses them

📊 Changes

3 files changed (+94 additions, -1 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+2 -0)
📝 crates/horizon-client-render/src/gfx/entity_outline.rs (+3 -1)
📝 crates/horizon-client-render/src/menu_blur.rs (+89 -0)

📄 Description

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

Part of #6418.

What

Two pairs of window-sized render targets stayed in video memory for the rest of the game after their first use:

  • the menu blur's copy of the frame and its swap texture (menu_blur.rs), made for the first screen that blurs (the world loading screen already does), then kept through all play;
  • the entity outline target and its swap (gfx/entity_outline.rs), made for the first glowing entity (a spectral arrow hit, the Glowing effect), then kept.

Each pair is 2 × width × height × 4 bytes: 7.5 MiB at 1280x720, 16 MiB at 1920x1080, 63 MiB at 3840x2160. A frame that doesn't blur now releases the blur's targets (MenuBlur::release), and a frame with no outlined entity drops the outline targets; both are made again by the next frame that needs them, as on their first use. Making two textures when a menu opens costs well under a millisecond.

Measured

How it was measured. Arch Linux (zen kernel), Ryzen 5 5600X (12 threads), 32 GB, RTX 4060 8 GB (Vulkan, NVIDIA 615.78), --profile fast, --offscreen 1280x720, fresh scratch homes per start, render distance 12. A start goes to the title screen, creates the perf_bench world (seed 1234, creative), waits for spawn to load, then teleports to and flies tools/perf_bench.py's village and forest paths (12 s each) and samples after each. Video memory: what nvidia-smi attributes to the process, and the game's own allocator totals (status: gpu_allocated_bytes / gpu_reserved_bytes); RSS from /proc/<pid>/status. Three alternated starts per build, medians (range in brackets); main = dea6dea98.

main this PR
GPU memory in use after the flights (allocator, 1280x720) 500 [496-504] MiB 489 [489-495] MiB
"Menu blur target" in a world, no screen open 7.5 MiB 0
pause menu open 7.5 MiB 7.5 MiB
glowing pig in view → killed 7.5 → 7.5 MiB 7.5 → 0 MiB

(From the allocator's per-label report: in a world, pause, resume, a summoned {Glowing:1b} pig, then /kill.) The pause menu blurs and the glowing pig's outline draws as before (checked on screenshots).

Tests

blurs_the_same_after_its_targets_were_released (new, on the GPU when there is one): a striped frame blurred, the targets released, the same frame blurred again gives the same pixels.

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at 80dfb5f35, 2 min 30 s)

Check Result
Scope ✅ 4 files, +94 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 594 passed (33 s)
rustfmt ✅ (8 s)
clippy ✅ (48 s)
tests: horizon-client-render ✅ 929 passed (56 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 ➖ 375 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, armor_stand_frost, arrow, arrow_wind_charge, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes and 363 more
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/6423 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `mem-free-blur-outline-targets` --- ### 📝 Commits (1) - [`45129f3`](https://github.com/horizon-rust/horizon/commit/45129f31164b28911b5229431b2a7ba8c73ea970) Menu blur and entity outline targets are freed while no frame uses them ### 📊 Changes **3 files changed** (+94 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+2 -0) 📝 `crates/horizon-client-render/src/gfx/entity_outline.rs` (+3 -1) 📝 `crates/horizon-client-render/src/menu_blur.rs` (+89 -0) </details> ### 📄 Description > 🤖 Opened by rdbtCVS's AI agent (Claude Code, Claude Opus 5.5), not by rdbtCVS personally. Part of #6418. ## What Two pairs of window-sized render targets stayed in video memory for the rest of the game after their first use: - the menu blur's copy of the frame and its swap texture (`menu_blur.rs`), made for the first screen that blurs (the world loading screen already does), then kept through all play; - the entity outline target and its swap (`gfx/entity_outline.rs`), made for the first glowing entity (a spectral arrow hit, the Glowing effect), then kept. Each pair is 2 × width × height × 4 bytes: 7.5 MiB at 1280x720, 16 MiB at 1920x1080, 63 MiB at 3840x2160. A frame that doesn't blur now releases the blur's targets (`MenuBlur::release`), and a frame with no outlined entity drops the outline targets; both are made again by the next frame that needs them, as on their first use. Making two textures when a menu opens costs well under a millisecond. ## Measured **How it was measured.** Arch Linux (zen kernel), Ryzen 5 5600X (12 threads), 32 GB, RTX 4060 8 GB (Vulkan, NVIDIA 615.78), `--profile fast`, `--offscreen` 1280x720, fresh scratch homes per start, render distance 12. A start goes to the title screen, creates the perf_bench world (seed 1234, creative), waits for spawn to load, then teleports to and flies `tools/perf_bench.py`'s village and forest paths (12 s each) and samples after each. Video memory: what `nvidia-smi` attributes to the process, and the game's own allocator totals (`status`: `gpu_allocated_bytes` / `gpu_reserved_bytes`); RSS from `/proc/<pid>/status`. Three alternated starts per build, medians (range in brackets); `main` = dea6dea98. | | main | this PR | |---|---|---| | GPU memory in use after the flights (allocator, 1280x720) | 500 [496-504] MiB | 489 [489-495] MiB | | "Menu blur target" in a world, no screen open | 7.5 MiB | 0 | | pause menu open | 7.5 MiB | 7.5 MiB | | glowing pig in view → killed | 7.5 → 7.5 MiB | 7.5 → 0 MiB | (From the allocator's per-label report: in a world, pause, resume, a summoned `{Glowing:1b}` pig, then `/kill`.) The pause menu blurs and the glowing pig's outline draws as before (checked on screenshots). ## Tests `blurs_the_same_after_its_targets_were_released` (new, on the GPU when there is one): a striped frame blurred, the targets released, the same frame blurred again gives the same pixels. **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at 80dfb5f35, 2 min 30 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +94 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 594 passed (33 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (48 s) | | tests: horizon-client-render | ✅ 929 passed (56 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 | ➖ 375 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, armor_stand_frost, arrow, arrow_wind_charge, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes and 363 more | | 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:28:19 +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#6862
No description provided.