[PR #418] [MERGED] horizon-shaderpack: plan a Java pack's full-screen passes like Iris #2550

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

📋 Pull Request Information

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

Base: main ← Head: feat/shaderpack-passes


📝 Commits (4)

  • 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

📊 Changes

31 files changed (+5564 additions, -7 deletions)

View changed files

📝 Cargo.lock (+395 -6)
📝 Cargo.toml (+1 -1)
➕ 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 (+640 -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 (+1297 -0)
➕ crates/horizon-shaderpack/tests/fixtures/mini/shaders/composite.fsh (+10 -0)
➕ crates/horizon-shaderpack/tests/fixtures/mini/shaders/composite.vsh (+3 -0)
➕ crates/horizon-shaderpack/tests/fixtures/mini/shaders/lib/common.glsl (+7 -0)
➕ crates/horizon-shaderpack/tests/fixtures/mini/shaders/lib/settings.glsl (+7 -0)
➕ crates/horizon-shaderpack/tests/fixtures/mini/shaders/notes.txt (+1 -0)
➕ crates/horizon-shaderpack/tests/fixtures/mini/shaders/world-1/composite.fsh (+4 -0)
➕ crates/horizon-shaderpack/tests/fixtures/passes/shaders/composite.fsh (+17 -0)
➕ crates/horizon-shaderpack/tests/fixtures/passes/shaders/composite.vsh (+3 -0)
➕ crates/horizon-shaderpack/tests/fixtures/passes/shaders/composite1.fsh (+7 -0)

...and 11 more files

📄 Description

Stacked on #415 (shaders.properties) → #413 → #405. This is the first half of step 3 (deferred and final stages) in docs/shader-packs.md. It plans the passes; drawing them in the client is next.

What it does

JavaPack::passes(folder, values, env, properties) returns the full-screen passes of one program folder (world0, or the root), in Iris's order: begin*, prepare*, deferred*, composite*, final. This follows ProgramDirectives, PackRenderTargetDirectives, CompositeRenderer and BufferFlipper:

  • What each pass writes: the later of /* DRAWBUFFERS:… */ and /* RENDERTARGETS:… */, or None when there is neither (Iris then takes the gl_FragData indices). Ports of CommentDirectiveParser and ConstDirectiveParser, tested on Iris's own cases.
  • The ping-pong state: which side of each colour target a pass reads. The gbuffers and the world get the state after prepare and after deferred, and the targets to copy back after final are listed. flip.<pass>.<buffer> and flip.<group>_pre are applied.
  • Per target: colortexNFormat (and gaux1Format etc.), Clear, and ClearColor. These are read from every program's fragment in Iris's order, final included, because BSL declares its formats only there. size.buffer.* comes from the properties.
  • Per pass: colortexNMipmapEnabled and scale.<pass>.
  • The preprocessor now keeps the directive comments of active code (Preprocessed::comments and with_comments()), as Iris's JCPP does with KEEPCOMMENTS. A DRAWBUFFERS in an #if'd out branch no longer counts. Packs rely on this: Complementary's deferred1 has five of them behind #ifs.

How it was verified

  • cargo fmt, cargo clippy -p horizon-shaderpack --all-targets -D warnings, and cargo test -p horizon-shaderpack all pass. The tests cover Iris's comment-directive cases and the const parsing. A new fixture pack (tests/fixtures/passes) checks a disabled pass, a directive in #if 0, an explicit flip, scale.*, size.buffer.*, mipmaps, and the flip state before and after each group.
  • Real packs (dev only, not committed): the overworld plans read like their sources.
    • Complementary r5.9.3: 9 passes, deferred1 writes 0,5,4 (the active one of its five directives), 13 targets with formats such as R11F_G11F_B10F and RGB8_SNORM.
    • BSL v10.1.8: 9 passes, formats from final.
    • Sildur's Vibrant 2.02: 6 passes.
  • All three packs still translate after the preprocessor change: Complementary 180/180, Sildur's 114/114, BSL 154/154.

What is left

  • The client side: drawing these passes over Horizon's world. That means colour targets in these formats, the uniforms Iris provides, depthtex*/noisetex, and the final copy. It's the next PR.
  • Iris's override of the draw buffers for passes without a directive (from the outputs written) belongs to the client, which has the translated outputs.

Needs Ludovic

Nothing.

🤖 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/418 **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-passes` --- ### 📝 Commits (4) - [`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 ### 📊 Changes **31 files changed** (+5564 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+395 -6) 📝 `Cargo.toml` (+1 -1) ➕ `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` (+640 -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` (+1297 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/mini/shaders/composite.fsh` (+10 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/mini/shaders/composite.vsh` (+3 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/mini/shaders/lib/common.glsl` (+7 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/mini/shaders/lib/settings.glsl` (+7 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/mini/shaders/notes.txt` (+1 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/mini/shaders/world-1/composite.fsh` (+4 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/passes/shaders/composite.fsh` (+17 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/passes/shaders/composite.vsh` (+3 -0) ➕ `crates/horizon-shaderpack/tests/fixtures/passes/shaders/composite1.fsh` (+7 -0) _...and 11 more files_ </details> ### 📄 Description Stacked on #415 (shaders.properties) → #413 → #405. This is the first half of step 3 (deferred and final stages) in `docs/shader-packs.md`. It plans the passes; drawing them in the client is next. ## What it does `JavaPack::passes(folder, values, env, properties)` returns the full-screen passes of one program folder (`world0`, or the root), in Iris's order: `begin*`, `prepare*`, `deferred*`, `composite*`, `final`. This follows `ProgramDirectives`, `PackRenderTargetDirectives`, `CompositeRenderer` and `BufferFlipper`: - **What each pass writes**: the later of `/* DRAWBUFFERS:… */` and `/* RENDERTARGETS:… */`, or `None` when there is neither (Iris then takes the `gl_FragData` indices). Ports of `CommentDirectiveParser` and `ConstDirectiveParser`, tested on Iris's own cases. - **The ping-pong state**: which side of each colour target a pass reads. The gbuffers and the world get the state after `prepare` and after `deferred`, and the targets to copy back after `final` are listed. `flip.<pass>.<buffer>` and `flip.<group>_pre` are applied. - **Per target**: `colortexNFormat` (and `gaux1Format` etc.), `Clear`, and `ClearColor`. These are read from every program's fragment in Iris's order, `final` included, because BSL declares its formats only there. `size.buffer.*` comes from the properties. - **Per pass**: `colortexNMipmapEnabled` and `scale.<pass>`. - **The preprocessor now keeps the directive comments of active code** (`Preprocessed::comments` and `with_comments()`), as Iris's JCPP does with `KEEPCOMMENTS`. A `DRAWBUFFERS` in an `#if`'d out branch no longer counts. Packs rely on this: Complementary's `deferred1` has five of them behind `#if`s. ## How it was verified - `cargo fmt`, `cargo clippy -p horizon-shaderpack --all-targets -D warnings`, and `cargo test -p horizon-shaderpack` all pass. The tests cover Iris's comment-directive cases and the const parsing. A new fixture pack (`tests/fixtures/passes`) checks a disabled pass, a directive in `#if 0`, an explicit flip, `scale.*`, `size.buffer.*`, mipmaps, and the flip state before and after each group. - Real packs (dev only, not committed): the overworld plans read like their sources. - Complementary r5.9.3: 9 passes, `deferred1` writes `0,5,4` (the active one of its five directives), 13 targets with formats such as `R11F_G11F_B10F` and `RGB8_SNORM`. - BSL v10.1.8: 9 passes, formats from `final`. - Sildur's Vibrant 2.02: 6 passes. - All three packs still translate after the preprocessor change: Complementary 180/180, Sildur's 114/114, BSL 154/154. ## What is left - The client side: drawing these passes over Horizon's world. That means colour targets in these formats, the uniforms Iris provides, `depthtex*`/`noisetex`, and the final copy. It's the next PR. - Iris's override of the draw buffers for passes without a directive (from the outputs written) belongs to the client, which has the translated outputs. ## Needs Ludovic Nothing. 🤖 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:06 +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#2550
No description provided.