[PR #5157] [MERGED] gfx: upload atlas patches on skipped frames and refresh skins after pack reload #6106

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5157
Author: @mulareal
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix-skin-pack-reload-5097


📝 Commits (1)

  • 190e969 gfx: upload atlas patches on skipped frames and refresh skins after pack reload

📊 Changes

6 files changed (+75 additions, -33 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+20 -2)
📝 crates/horizon-client-render/src/hud.rs (+33 -20)
📝 crates/horizon-client/src/game.rs (+4 -0)
📝 crates/horizon-client/src/game/packs.rs (+1 -0)
📝 crates/horizon-client/src/game/remote.rs (+5 -4)
📝 crates/horizon-client/src/game/scoreboard.rs (+12 -7)

📄 Description

???? Opened by mulareal's AI agent (Antigravity, Gemini), not by mulareal personally.

What

Player skins stay visible after unloading or reloading a resource pack instead of turning transparent. Fixes #5097.

Why

  • Game::render drained self.map_patches (which carries skin slot uploads from Game::store_skin) and font.take_patches() into frame.hud.patches before calling Renderer::render. When Renderer::draw_frame returned Ok(false) before HudRenderer::prepare ??? such as when the swapchain returned Outdated, Validation, or Timeout right after apply_staged_pack reconfigured the surface on the existing device ??? Renderer::render submitted take_section_copies() but dropped frame.hud.patches. Because store_skin had already registered the skin in self.skin_slots and self.gui.atlas.sprites, again_skin treated it as uploaded on every later frame while the horizon/skin{slot} region in the GPU texture stayed transparent ([0, 0, 0, 0]).
  • Game::apply_staged_pack forgot skin_slots and maps.slots when swapping self.gui, but left stale patches in self.map_patches with coordinates from the previous HudAtlas.
  • Game::hud_layers returned early on Screen::Options before draw_tab_list, so skin slots were not advanced or re-uploaded while the Options menu stayed open over the world after closing the Resource Packs screen, and horizon/offline_skin was not marked drawn through drawn_skin.

Fix

  • Extract HudRenderer::upload_patches (clamped to the atlas dimensions) and submit frame.hud.patches in Renderer::render even when draw_frame does not draw the frame (crates/horizon-client-render/src/hud.rs, crates/horizon-client-render/src/gfx.rs).
  • Clear self.map_patches in Game::apply_staged_pack (crates/horizon-client/src/game/packs.rs).
  • Extract Game::flush_skin_slots in crates/horizon-client/src/game/scoreboard.rs and run it with Game::update_remote_skins when Screen::Options is open over a world (crates/horizon-client/src/game.rs).
  • Check self.gui.atlas.sprites alongside self.skin_slots for offline skins and capes in Game::update_remote_skins, and pass horizon/offline_skin through Game::again_skin in Game::drawn_skin (crates/horizon-client/src/game/remote.rs).

Checked

  • Verified in-game with a custom skin across F3 + T and toggling resource packs in the Resource Packs screen: before the fix the skin disappeared after reloading, after the fix it stays visible.
  • Ran cargo test -p horizon-client-render --lib (hud::tests, skins::tests) and cargo test -p horizon-client --lib --bins --tests (game::packs::tests).
Check Result
Scope ??? 6 files, +75 ???33
Cargo.lock ??? unchanged
Public tree ???
Python tests ??? 484 passed
rustfmt ???
clippy (horizon-client, horizon-client-render) ???
tests: horizon-client-render ??? 704 passed
tests: horizon-client ??? 1345 passed
doc tests ??? 0 passed
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

???? Generated with Antigravity


🔄 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/5157 **Author:** [@mulareal](https://github.com/mulareal) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix-skin-pack-reload-5097` --- ### 📝 Commits (1) - [`190e969`](https://github.com/horizon-rust/horizon/commit/190e96938bd8babe63b0a57e7c50d254fbf96568) gfx: upload atlas patches on skipped frames and refresh skins after pack reload ### 📊 Changes **6 files changed** (+75 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+20 -2) 📝 `crates/horizon-client-render/src/hud.rs` (+33 -20) 📝 `crates/horizon-client/src/game.rs` (+4 -0) 📝 `crates/horizon-client/src/game/packs.rs` (+1 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+5 -4) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+12 -7) </details> ### 📄 Description > ???? Opened by mulareal's AI agent (Antigravity, Gemini), not by mulareal personally. ## What Player skins stay visible after unloading or reloading a resource pack instead of turning transparent. Fixes #5097. ## Why - `Game::render` drained `self.map_patches` (which carries skin slot uploads from `Game::store_skin`) and `font.take_patches()` into `frame.hud.patches` before calling `Renderer::render`. When `Renderer::draw_frame` returned `Ok(false)` before `HudRenderer::prepare` ??? such as when the swapchain returned `Outdated`, `Validation`, or `Timeout` right after `apply_staged_pack` reconfigured the surface on the existing device ??? `Renderer::render` submitted `take_section_copies()` but dropped `frame.hud.patches`. Because `store_skin` had already registered the skin in `self.skin_slots` and `self.gui.atlas.sprites`, `again_skin` treated it as uploaded on every later frame while the `horizon/skin{slot}` region in the GPU texture stayed transparent (`[0, 0, 0, 0]`). - `Game::apply_staged_pack` forgot `skin_slots` and `maps.slots` when swapping `self.gui`, but left stale patches in `self.map_patches` with coordinates from the previous `HudAtlas`. - `Game::hud_layers` returned early on `Screen::Options` before `draw_tab_list`, so skin slots were not advanced or re-uploaded while the Options menu stayed open over the world after closing the Resource Packs screen, and `horizon/offline_skin` was not marked drawn through `drawn_skin`. ## Fix - Extract `HudRenderer::upload_patches` (clamped to the atlas dimensions) and submit `frame.hud.patches` in `Renderer::render` even when `draw_frame` does not draw the frame (`crates/horizon-client-render/src/hud.rs`, `crates/horizon-client-render/src/gfx.rs`). - Clear `self.map_patches` in `Game::apply_staged_pack` (`crates/horizon-client/src/game/packs.rs`). - Extract `Game::flush_skin_slots` in `crates/horizon-client/src/game/scoreboard.rs` and run it with `Game::update_remote_skins` when `Screen::Options` is open over a world (`crates/horizon-client/src/game.rs`). - Check `self.gui.atlas.sprites` alongside `self.skin_slots` for offline skins and capes in `Game::update_remote_skins`, and pass `horizon/offline_skin` through `Game::again_skin` in `Game::drawn_skin` (`crates/horizon-client/src/game/remote.rs`). ## Checked - Verified in-game with a custom skin across `F3 + T` and toggling resource packs in the Resource Packs screen: before the fix the skin disappeared after reloading, after the fix it stays visible. - Ran `cargo test -p horizon-client-render --lib` (`hud::tests`, `skins::tests`) and `cargo test -p horizon-client --lib --bins --tests` (`game::packs::tests`). | Check | Result | |---|---| | Scope | ??? 6 files, +75 ???33 | | Cargo.lock | ??? unchanged | | Public tree | ??? | | Python tests | ??? 484 passed | | rustfmt | ??? | | clippy (`horizon-client`, `horizon-client-render`) | ??? | | tests: horizon-client-render | ??? 704 passed | | tests: horizon-client | ??? 1345 passed | | doc tests | ??? 0 passed | | 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 | ???? Generated with [Antigravity](https://antigravity.google) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:11:42 +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#6106
No description provided.