[PR #1887] [MERGED] Shader packs, clean room 39: shadow buffers, their samplers and shadowcomp #3840

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1887
Author: @ludovic111
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: feat/shader-packs-shadow-buffers


📝 Commits (7)

  • 5dcbe22 Shader packs, clean room 37: shadow settings and the shadow camera
  • 86d8d9e Shader packs, clean room 38: load the shadow programs
  • 6320718 Shader packs, clean room 39: shadow buffers, their samplers and shadowcomp
  • a276f81 Shader packs, clean room 39: the run doc comment back on run
  • 86a2f8e Merge feat/shader-packs-hand into feat/shader-packs-shadow-camera
  • b2a7e77 Merge feat/shader-packs-shadow-camera into feat/shader-packs-shadow-programs
  • 8b7315a Merge feat/shader-packs-shadow-programs into feat/shader-packs-shadow-buffers

📊 Changes

10 files changed (+872 additions, -65 deletions)

View changed files

📝 crates/horizon-client/src/gfx.rs (+1 -0)
📝 crates/horizon-client/src/gfx/pack_post.rs (+251 -31)
➕ crates/horizon-client/src/gfx/pack_shadow.rs (+150 -0)
📝 crates/horizon-client/src/gfx/pack_sky.rs (+6 -4)
📝 crates/horizon-client/src/gfx/pack_uniforms.rs (+104 -17)
📝 crates/horizon-shaders/src/config.rs (+136 -0)
📝 crates/horizon-shaders/src/lib.rs (+3 -3)
📝 crates/horizon-shaders/src/post.rs (+177 -3)
📝 crates/horizon-shaders/src/translate/mod.rs (+39 -6)
📝 crates/horizon-shaders/tests/real_packs.rs (+5 -1)

📄 Description

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

Shader packs, clean room 39: the shadow buffers, their samplers and shadowcomp. Stacked on #1886.

What

  • Buffers (spec 6.3), made when the shadow pass runs. They are square, at shadowMapResolution, within the device's limit:
    • shadowtex0, cleared to 1.0 every frame;
    • shadowtex1, a copy made only when a program reads it;
    • shadowcolor0/1, made only when used, each with two sides, cleared to their Clear colour (white by default).
  • Samplers:
    • shadowtex0/watershadow, shadowtex1, shadow (shadowtex1 when beside watershadow) and the HW forms read the shadow map. A sampler2DShadow reads it through a linear depth comparison.
    • shadowcolor/shadowcolor0/1 read the colour buffers.
    • In the shadow programs, buffer n is shadowcolor n, and colortex reads a stand-in.
  • shadowcomp…shadowcomp99 run after the shadow pass and before prepare (2.1). Each draws into the alt side of the shadowcolor buffers it writes and flips them after, as composite programs do with colortex (6.1.6).
  • Without the shadow pass nothing changes: the names read the stand-ins as before.
  • Nothing draws into the map yet: the shadow pass draws nothing until #1888, so the map stays clear.
  • Renderer outside the pack code: gfx.rs only gains mod pack_shadow;.

Clean room

Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, §2.1, §5.2 (samplers), §6.1.6, §6.3; no other loader's code read.

How tested

  • Unit tests: sampler_names covers the shadow names: comparison or not, the watershadow rule, and the stand-in inside the shadow programs.
  • In game: BSL loads with the shadow pass on: "shadow map 2048x2048 over 256 blocks, sunPathRotation -40, shadowcolor buffers 0b1, shadowtex1". The pictures are the same as before, since the map is still clear.

🤖 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/1887 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/shader-packs-shadow-buffers` --- ### 📝 Commits (7) - [`5dcbe22`](https://github.com/horizon-rust/horizon/commit/5dcbe222c94261c7291659a15a06549f46134014) Shader packs, clean room 37: shadow settings and the shadow camera - [`86d8d9e`](https://github.com/horizon-rust/horizon/commit/86d8d9e3a19a0c6614b6b4fec537007d33759254) Shader packs, clean room 38: load the shadow programs - [`6320718`](https://github.com/horizon-rust/horizon/commit/632071849134f15723faba98d8fb76d155faa1ce) Shader packs, clean room 39: shadow buffers, their samplers and shadowcomp - [`a276f81`](https://github.com/horizon-rust/horizon/commit/a276f81abacc7d7503a3098c986b1c370f294912) Shader packs, clean room 39: the run doc comment back on run - [`86a2f8e`](https://github.com/horizon-rust/horizon/commit/86a2f8e470868e862d3290efe71ba25f8dd880ba) Merge feat/shader-packs-hand into feat/shader-packs-shadow-camera - [`b2a7e77`](https://github.com/horizon-rust/horizon/commit/b2a7e77036c445340f06f55f3f34952e673dba3e) Merge feat/shader-packs-shadow-camera into feat/shader-packs-shadow-programs - [`8b7315a`](https://github.com/horizon-rust/horizon/commit/8b7315a6ff0921d1ce41d99ce9212329a8243076) Merge feat/shader-packs-shadow-programs into feat/shader-packs-shadow-buffers ### 📊 Changes **10 files changed** (+872 additions, -65 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/gfx.rs` (+1 -0) 📝 `crates/horizon-client/src/gfx/pack_post.rs` (+251 -31) ➕ `crates/horizon-client/src/gfx/pack_shadow.rs` (+150 -0) 📝 `crates/horizon-client/src/gfx/pack_sky.rs` (+6 -4) 📝 `crates/horizon-client/src/gfx/pack_uniforms.rs` (+104 -17) 📝 `crates/horizon-shaders/src/config.rs` (+136 -0) 📝 `crates/horizon-shaders/src/lib.rs` (+3 -3) 📝 `crates/horizon-shaders/src/post.rs` (+177 -3) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+39 -6) 📝 `crates/horizon-shaders/tests/real_packs.rs` (+5 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room 39:** the shadow buffers, their samplers and `shadowcomp`. Stacked on #1886. ## What - **Buffers** (spec 6.3), made when the shadow pass runs. They are square, at `shadowMapResolution`, within the device's limit: - `shadowtex0`, cleared to 1.0 every frame; - `shadowtex1`, a copy made only when a program reads it; - `shadowcolor0/1`, made only when used, each with two sides, cleared to their `Clear` colour (white by default). - **Samplers:** - `shadowtex0`/`watershadow`, `shadowtex1`, `shadow` (`shadowtex1` when beside `watershadow`) and the HW forms read the shadow map. A `sampler2DShadow` reads it through a linear depth comparison. - `shadowcolor`/`shadowcolor0/1` read the colour buffers. - In the shadow programs, buffer n is shadowcolor n, and colortex reads a stand-in. - **`shadowcomp`…`shadowcomp99`** run after the shadow pass and before prepare (2.1). Each draws into the alt side of the shadowcolor buffers it writes and flips them after, as composite programs do with colortex (6.1.6). - **Without the shadow pass** nothing changes: the names read the stand-ins as before. - **Nothing draws into the map yet:** the shadow pass draws nothing until #1888, so the map stays clear. - **Renderer outside the pack code:** `gfx.rs` only gains `mod pack_shadow;`. ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §2.1, §5.2 (samplers), §6.1.6, §6.3; no other loader's code read. ## How tested - **Unit tests:** `sampler_names` covers the shadow names: comparison or not, the `watershadow` rule, and the stand-in inside the shadow programs. - **In game:** BSL loads with the shadow pass on: "shadow map 2048x2048 over 256 blocks, sunPathRotation -40, shadowcolor buffers 0b1, shadowtex1". The pictures are the same as before, since the map is still clear. 🤖 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 04:12: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#3840
No description provided.