[PR #436] [MERGED] horizon-client: run a Java pack's full-screen passes over the world #2564

Closed
opened 2026-11-02 15:57:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/436
Author: @ludovic111
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @ludovic111

Base: main ← Head: feat/shaderpack-client


📝 Commits (5)

  • b22583d horizon-shaderpack: open Java shader packs and preprocess them like Iris
  • 98ebdca horizon-shaderpack: translate Java shader pack programs to WGSL
  • 38a9f65 horizon-shaderpack: read shaders.properties like Iris
  • e1d9ae1 horizon-shaderpack: plan a Java pack's full-screen passes like Iris
  • 2862f17 horizon-client: run a Java pack's full-screen passes over the world

📊 Changes

38 files changed (+7676 additions, -31 deletions)

View changed files

📝 Cargo.lock (+396 -6)
📝 Cargo.toml (+1 -1)
📝 crates/horizon-client/Cargo.toml (+2 -0)
📝 crates/horizon-client/src/game/shader_packs.rs (+10 -1)
📝 crates/horizon-client/src/gfx.rs (+46 -17)
➕ crates/horizon-client/src/gfx/java_stages.rs (+1584 -0)
➕ crates/horizon-client/src/java_pack.rs (+165 -0)
📝 crates/horizon-client/src/lib.rs (+1 -0)
📝 crates/horizon-client/src/shader_pack.rs (+58 -5)
➕ crates/horizon-shaderpack/Cargo.toml (+20 -0)
➕ crates/horizon-shaderpack/src/include.rs (+198 -0)
➕ crates/horizon-shaderpack/src/lib.rs (+162 -0)
➕ crates/horizon-shaderpack/src/options.rs (+659 -0)
➕ crates/horizon-shaderpack/src/pipeline.rs (+728 -0)
➕ crates/horizon-shaderpack/src/preprocess.rs (+424 -0)
➕ crates/horizon-shaderpack/src/properties.rs (+783 -0)
➕ crates/horizon-shaderpack/src/source.rs (+141 -0)
➕ crates/horizon-shaderpack/src/translate.rs (+1339 -0)
➕ crates/horizon-shaderpack/tests/fixtures/mini/shaders/composite.fsh (+10 -0)
➕ crates/horizon-shaderpack/tests/fixtures/mini/shaders/composite.vsh (+3 -0)

...and 18 more files

📄 Description

Stacked on #418 (feat/shaderpack-passes), which is stacked on #415 → #413 → #405. Step 3 of docs/shader-packs.md's order, first slice: the deferred and final stages.

What it does

A Java (OptiFine/Iris) pack in shaderpacks/, either a folder holding shaders/ or a .zip, now shows in the Shader Packs screen and runs:

  • java_pack.rs opens the pack, applies shaders.properties, plans each dimension folder (world0, world-1, world1, root) with #418's pass plan, and translates every begin*, prepare*, deferred*, composite* and final pass. ShaderPack::load_any picks Horizon or Java.
  • gfx/java_stages.rs allocates the colortexN targets (both sides, Iris formats mapped to renderable wgpu ones) and depth. Each frame it clears what the pack clears, runs the early passes, puts the world into colortex0/depthtex*, runs deferred/composite with Iris's flips, and sends final where Horizon packs' composite output goes (the hand, menus and HUD draw over it). It also feeds the Iris uniforms: matrices, camera, view, time, sun and moon, weather, fog and sky, eye state, plus a noisetex.
  • Translator changes in horizon-shaderpack:
    • vertex shaders end by flipping gl_Position.y and remapping depth, so targets keep OpenGL's layout;
    • textures share four samplers by kind (iris_linear/nearest/repeat/compare), because Metal allows 16 per stage and Complementary binds 23;
    • isnan/isinf test bits, because Metal's fast math folds x != x. Without this, a NaN sticks in Complementary's TAA history and the picture goes black.
  • docs/shader-packs.md: state rows plus a "Running a Java pack's full-screen passes" section.

How it was verified

  • cargo clippy -p horizon-client -p horizon-shaderpack --all-targets -D warnings is clean, and cargo fmt was run.
  • cargo test -p horizon-client --lib: 704 passed. New tests:
    • Iris format mapping;
    • which texture each sampler name reads;
    • OpenGL projection rebuilt from Horizon's reversed depth;
    • loading the fixture pack's passes.
  • cargo test -p horizon-shaderpack passes, including against local copies of the three test packs (HORIZON_TEST_SHADERPACKS). Every planned pass of every folder compiles. A new test covers shared samplers.
  • In-game, offscreen on the Mac mini (M4 Pro), with the packs' default options. The packs are dev-only copies outside the repo; none is committed.
    • BSL v10.1.8: its composite and final grade Horizon's world.
    • Complementary Reimagined r5.9.3: renders correctly once the isnan fix is in (black before it).
    • Sildur's Vibrant v2.02: only the sky. Its deferred reads the albedo that gbuffers_* write to colortex4, so this is expected until gbuffers exist.
    • A hand-written check pack confirmed the orientation, the depth and gbufferProjectionInverse: one half shows the world, the other half shows distance bands.

What is left

  • gbuffers_* and shadow. The packs' water, sky, shadows and lighting come from these.
  • Images and compute (.csh). A pack that needs them reports an error and doesn't load.
  • Mipmapped targets (read but ignored), custom textures, custom uniforms, the option screen. Shadow matrices are identity, and eyeBrightness is approximated.

🤖 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/436 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/shaderpack-client` --- ### 📝 Commits (5) - [`b22583d`](https://github.com/horizon-rust/horizon/commit/b22583d0577f83652e275b4560de483ab42594d8) horizon-shaderpack: open Java shader packs and preprocess them like Iris - [`98ebdca`](https://github.com/horizon-rust/horizon/commit/98ebdcad7b27100b569ca55b717507e2dd896bbc) horizon-shaderpack: translate Java shader pack programs to WGSL - [`38a9f65`](https://github.com/horizon-rust/horizon/commit/38a9f6543f8e8ed8c00a844fc64751f507ab6b0e) horizon-shaderpack: read shaders.properties like Iris - [`e1d9ae1`](https://github.com/horizon-rust/horizon/commit/e1d9ae1dd7d8d579e4b5923f85c81c2e30535c00) horizon-shaderpack: plan a Java pack's full-screen passes like Iris - [`2862f17`](https://github.com/horizon-rust/horizon/commit/2862f17e86b28dac9bbb68b9917a1a3772ecb5bf) horizon-client: run a Java pack's full-screen passes over the world ### 📊 Changes **38 files changed** (+7676 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+396 -6) 📝 `Cargo.toml` (+1 -1) 📝 `crates/horizon-client/Cargo.toml` (+2 -0) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+10 -1) 📝 `crates/horizon-client/src/gfx.rs` (+46 -17) ➕ `crates/horizon-client/src/gfx/java_stages.rs` (+1584 -0) ➕ `crates/horizon-client/src/java_pack.rs` (+165 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) 📝 `crates/horizon-client/src/shader_pack.rs` (+58 -5) ➕ `crates/horizon-shaderpack/Cargo.toml` (+20 -0) ➕ `crates/horizon-shaderpack/src/include.rs` (+198 -0) ➕ `crates/horizon-shaderpack/src/lib.rs` (+162 -0) ➕ `crates/horizon-shaderpack/src/options.rs` (+659 -0) ➕ `crates/horizon-shaderpack/src/pipeline.rs` (+728 -0) ➕ `crates/horizon-shaderpack/src/preprocess.rs` (+424 -0) ➕ `crates/horizon-shaderpack/src/properties.rs` (+783 -0) ➕ `crates/horizon-shaderpack/src/source.rs` (+141 -0) ➕ `crates/horizon-shaderpack/src/translate.rs` (+1339 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/mini/shaders/composite.fsh` (+10 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/mini/shaders/composite.vsh` (+3 -0) _...and 18 more files_ </details> ### 📄 Description Stacked on #418 (`feat/shaderpack-passes`), which is stacked on #415 → #413 → #405. Step 3 of docs/shader-packs.md's order, first slice: the deferred and final stages. ## What it does A Java (OptiFine/Iris) pack in `shaderpacks/`, either a folder holding `shaders/` or a `.zip`, now shows in the Shader Packs screen and runs: - `java_pack.rs` opens the pack, applies `shaders.properties`, plans each dimension folder (`world0`, `world-1`, `world1`, root) with #418's pass plan, and translates every `begin*`, `prepare*`, `deferred*`, `composite*` and `final` pass. `ShaderPack::load_any` picks Horizon or Java. - `gfx/java_stages.rs` allocates the `colortexN` targets (both sides, Iris formats mapped to renderable wgpu ones) and depth. Each frame it clears what the pack clears, runs the early passes, puts the world into `colortex0`/`depthtex*`, runs `deferred`/`composite` with Iris's flips, and sends `final` where Horizon packs' `composite` output goes (the hand, menus and HUD draw over it). It also feeds the Iris uniforms: matrices, camera, view, time, sun and moon, weather, fog and sky, eye state, plus a `noisetex`. - Translator changes in `horizon-shaderpack`: - vertex shaders end by flipping `gl_Position.y` and remapping depth, so targets keep OpenGL's layout; - textures share four samplers by kind (`iris_linear`/`nearest`/`repeat`/`compare`), because Metal allows 16 per stage and Complementary binds 23; - `isnan`/`isinf` test bits, because Metal's fast math folds `x != x`. Without this, a NaN sticks in Complementary's TAA history and the picture goes black. - docs/shader-packs.md: state rows plus a "Running a Java pack's full-screen passes" section. ## How it was verified - `cargo clippy -p horizon-client -p horizon-shaderpack --all-targets -D warnings` is clean, and `cargo fmt` was run. - `cargo test -p horizon-client --lib`: 704 passed. New tests: - Iris format mapping; - which texture each sampler name reads; - OpenGL projection rebuilt from Horizon's reversed depth; - loading the fixture pack's passes. - `cargo test -p horizon-shaderpack` passes, including against local copies of the three test packs (`HORIZON_TEST_SHADERPACKS`). Every planned pass of every folder compiles. A new test covers shared samplers. - In-game, offscreen on the Mac mini (M4 Pro), with the packs' default options. The packs are dev-only copies outside the repo; none is committed. - **BSL v10.1.8**: its composite and final grade Horizon's world. - **Complementary Reimagined r5.9.3**: renders correctly once the `isnan` fix is in (black before it). - **Sildur's Vibrant v2.02**: only the sky. Its `deferred` reads the albedo that `gbuffers_*` write to `colortex4`, so this is expected until gbuffers exist. - A hand-written check pack confirmed the orientation, the depth and `gbufferProjectionInverse`: one half shows the world, the other half shows distance bands. ## What is left - `gbuffers_*` and `shadow`. The packs' water, sky, shadows and lighting come from these. - Images and compute (`.csh`). A pack that needs them reports an error and doesn't load. - Mipmapped targets (read but ignored), custom textures, custom uniforms, the option screen. Shadow matrices are identity, and `eyeBrightness` is approximated. 🤖 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-02 15:57:13 +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#2564
No description provided.