[PR #3702] [MERGED] gfx: opt-in shader-pack shadow cache with explicit invalidation #5162

Closed
opened 2026-11-03 05:10:40 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3702
Author: @Ashura006
Created: 10/29/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: shadow-cache


📝 Commits (10+)

  • e91569d gfx: implement temporal shadow cache with reprojection
  • a1bac98 Format code
  • f0b02fd Remove benchmark logs and scripts from PR
  • 803022a Merge origin/main into shadow-cache
  • 81d1052 Restore benchmarks deleted from an outdated branch base.
  • f4bdd6e gfx: make shader-pack shadow cache opt-in with explicit invalidation.
  • cf4fc19 clippy: derive Default for ShadowCache instead of a manual impl.
  • fd0deac clippy: drop needless return in pass-timing control command.
  • 2fe8dd0 ui: shorten Shadow Cache description to fit one Advanced Graphics line.
  • ac8614c Merge origin/main into shadow-cache

📊 Changes

5 files changed (+224 additions, -2 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+5 -0)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+196 -1)
📝 crates/horizon-client-render/src/graphics.rs (+9 -1)
📝 crates/horizon-client-render/src/graphics_ui.rs (+10 -0)
📝 crates/horizon-client/src/game.rs (+4 -0)

📄 Description

Opt-in temporal shadow cache for shader packs: when enabled, reuse the previous frame's shadow map if the cache key still matches.

What changed

  • ShadowCache / ShadowCacheKey in pack_post.rs: on a hit the shadow pass is skipped (only shadow passes write the shadow targets, so they still hold the last map); no extra textures or copies
  • Cache key includes sun/moon angle, snapped shadow camera, shadow settings, shadow_scene_revision (block edits + chunk membership), ticks, day_time, and a hash of shadow-pass uniforms
  • Entity shadows, and packs with custom images (cleared every frame), force a miss
  • Off by default: Advanced Graphics → Shadow Cache, or shadowCache:true in horizon-graphics.txt

Review follow-up

  • Merged current main; the false benchmarks/ deletions are gone — the diff is only the shadow-cache change
  • The earlier +23–45% FPS numbers were measured with frozen time (daylight cycle off / fixed day_time). That is not a normal-play claim. With a live day cycle the exact key almost never hits, which is expected
  • rustfmt / bench JSON / tools/shadow_bench.py cleaned up earlier

Related: crates/horizon-client-render/src/gfx/pack_post.rs, pack_shadow.rs, graphics.rs, graphics_ui.rs


🔄 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/3702 **Author:** [@Ashura006](https://github.com/Ashura006) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shadow-cache` --- ### 📝 Commits (10+) - [`e91569d`](https://github.com/horizon-rust/horizon/commit/e91569dbf18198f99074d83b25f9e49791d7301a) gfx: implement temporal shadow cache with reprojection - [`a1bac98`](https://github.com/horizon-rust/horizon/commit/a1bac98626ec4ce8fb9caa7d6ca86a796b9a9149) Format code - [`f0b02fd`](https://github.com/horizon-rust/horizon/commit/f0b02fd36837d638897bf049c2e9608f65a6fcf4) Remove benchmark logs and scripts from PR - [`803022a`](https://github.com/horizon-rust/horizon/commit/803022a9e2cbb5fc5fb8592c6d42b8c62d9aaa27) Merge origin/main into shadow-cache - [`81d1052`](https://github.com/horizon-rust/horizon/commit/81d1052b4add272835b647d5eea98164d7ffc63a) Restore benchmarks deleted from an outdated branch base. - [`f4bdd6e`](https://github.com/horizon-rust/horizon/commit/f4bdd6e45436466450267129cdc07237eba5fb2d) gfx: make shader-pack shadow cache opt-in with explicit invalidation. - [`cf4fc19`](https://github.com/horizon-rust/horizon/commit/cf4fc19a8a3e091dc1cab5ba7d725948601713c8) clippy: derive Default for ShadowCache instead of a manual impl. - [`fd0deac`](https://github.com/horizon-rust/horizon/commit/fd0deacd54368463a200c23e717f9d083afa52fb) clippy: drop needless return in pass-timing control command. - [`2fe8dd0`](https://github.com/horizon-rust/horizon/commit/2fe8dd0029a7950d74d68832b33b08365308bd85) ui: shorten Shadow Cache description to fit one Advanced Graphics line. - [`ac8614c`](https://github.com/horizon-rust/horizon/commit/ac8614cd4a6a0e61fbb15bb7b4287eee317e1d15) Merge origin/main into shadow-cache ### 📊 Changes **5 files changed** (+224 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+5 -0) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+196 -1) 📝 `crates/horizon-client-render/src/graphics.rs` (+9 -1) 📝 `crates/horizon-client-render/src/graphics_ui.rs` (+10 -0) 📝 `crates/horizon-client/src/game.rs` (+4 -0) </details> ### 📄 Description Opt-in temporal shadow cache for shader packs: when enabled, reuse the previous frame's shadow map if the cache key still matches. ## What changed - `ShadowCache` / `ShadowCacheKey` in `pack_post.rs`: on a hit the shadow pass is skipped (only shadow passes write the shadow targets, so they still hold the last map); no extra textures or copies - Cache key includes sun/moon angle, snapped shadow camera, shadow settings, `shadow_scene_revision` (block edits + chunk membership), `ticks`, `day_time`, and a hash of shadow-pass uniforms - Entity shadows, and packs with custom images (cleared every frame), force a miss - Off by default: Advanced Graphics → Shadow Cache, or `shadowCache:true` in `horizon-graphics.txt` ## Review follow-up - Merged current `main`; the false `benchmarks/` deletions are gone — the diff is only the shadow-cache change - The earlier +23–45% FPS numbers were measured with frozen time (daylight cycle off / fixed `day_time`). That is not a normal-play claim. With a live day cycle the exact key almost never hits, which is expected - rustfmt / bench JSON / `tools/shadow_bench.py` cleaned up earlier Related: `crates/horizon-client-render/src/gfx/pack_post.rs`, `pack_shadow.rs`, `graphics.rs`, `graphics_ui.rs` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:10:40 +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#5162
No description provided.