[PR #6497] [MERGED] Renderer: keep pipelines for the next renderer on the same device #6913

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

📋 Pull Request Information

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

Base: main ← Head: perf/renderer-reuse-pipelines


📝 Commits (1)

  • f57550e Renderer: keep shader modules, layouts and pipelines for the next renderer on the device

📊 Changes

2 files changed (+220 additions, -22 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+39 -22)
➕ crates/horizon-client-render/src/gfx/reuse.rs (+181 -0)

📄 Description

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

Stacked on #6496 (startup trace); retargets to main when it merges.

The start builds three renderers on one device: the boot screen's, the title artwork's (set_ui) and the world's (finish). A resource reload or a graphics option builds another. Each one created every shader module, layout and pipeline again, though the boot and title renderers' come out identical and the world's entity pipelines too. On a driver that compiles slowly (cold shader cache, software rendering, a weak CPU) that was seconds of the main thread before the title showed.

gfx/reuse.rs keeps the shader modules, bind group layouts, pipeline layouts and render pipelines of Renderer::new under their descriptor's Debug text (labels, sources, constants, formats, states; the handles a descriptor names print as their ids, and kept handles stay alive, so a key can only match the same handle). A renderer built with previous takes the previous one's Reuse; what the latest build did not ask for is let go when it finishes. Pipelines are immutable, so sharing them changes nothing drawn. The calls go through kept.create_* (same names as wgpu::Device), so the diff in Renderer::new is one word per call.

Numbers

playhorizon (EPYC, 4 shared cores, load 41-50, llvmpipe Vulkan with Mesa's shader cache warm), fast build, start to title, 3 alternated runs each, from tools/startup_trace.py:

step (ms) #6496 this PR
renderer.title_artwork 4807 / 9061 / 4753 (median 4807) 754 / 1529 / 2550 (median 1529)
renderer.world 1979 / 1824 / 2308 (median 1979) 1592 / 2262 / 1420 (median 1592)

The rest of the title artwork step is texture uploads and the sub-renderers' own pipelines (HUD, panorama, weather, post), not routed through Reuse yet. On the Mac mini (Metal) the pipelines cost little already (Metal's shader cache): no measurable change expected there; the Mac's disk was under the floor for a build, so not measured.

pr_ready: queued on playhorizon (all build slots busy), block follows as a comment. A unit test covers the keep/let-go rule.

🤖 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/6497 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/renderer-reuse-pipelines` --- ### 📝 Commits (1) - [`f57550e`](https://github.com/horizon-rust/horizon/commit/f57550ec8c360beeb8ae169ffdd1834bb0ea662d) Renderer: keep shader modules, layouts and pipelines for the next renderer on the device ### 📊 Changes **2 files changed** (+220 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+39 -22) ➕ `crates/horizon-client-render/src/gfx/reuse.rs` (+181 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #6496 (startup trace); retargets to main when it merges. The start builds three renderers on one device: the boot screen's, the title artwork's (`set_ui`) and the world's (`finish`). A resource reload or a graphics option builds another. Each one created every shader module, layout and pipeline again, though the boot and title renderers' come out identical and the world's entity pipelines too. On a driver that compiles slowly (cold shader cache, software rendering, a weak CPU) that was seconds of the main thread before the title showed. `gfx/reuse.rs` keeps the shader modules, bind group layouts, pipeline layouts and render pipelines of `Renderer::new` under their descriptor's `Debug` text (labels, sources, constants, formats, states; the handles a descriptor names print as their ids, and kept handles stay alive, so a key can only match the same handle). A renderer built with `previous` takes the previous one's `Reuse`; what the latest build did not ask for is let go when it finishes. Pipelines are immutable, so sharing them changes nothing drawn. The calls go through `kept.create_*` (same names as `wgpu::Device`), so the diff in `Renderer::new` is one word per call. ## Numbers playhorizon (EPYC, 4 shared cores, load 41-50, llvmpipe Vulkan with Mesa's shader cache warm), fast build, start to title, 3 alternated runs each, from `tools/startup_trace.py`: | step (ms) | #6496 | this PR | |---|---|---| | `renderer.title_artwork` | 4807 / 9061 / 4753 (median 4807) | 754 / 1529 / 2550 (median 1529) | | `renderer.world` | 1979 / 1824 / 2308 (median 1979) | 1592 / 2262 / 1420 (median 1592) | The rest of the title artwork step is texture uploads and the sub-renderers' own pipelines (HUD, panorama, weather, post), not routed through `Reuse` yet. On the Mac mini (Metal) the pipelines cost little already (Metal's shader cache): no measurable change expected there; the Mac's disk was under the floor for a build, so not measured. pr_ready: queued on playhorizon (all build slots busy), block follows as a comment. A unit test covers the keep/let-go rule. 🤖 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:29:09 +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#6913
No description provided.