[PR #1585] [MERGED] Shader packs, clean room 2: macros and #if conditions #3611

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

📋 Pull Request Information

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

Base: main ← Head: feat/shader-packs-conditions


📝 Commits (2)

  • 07e46da Shader packs, clean room 1: read packs and their lang files
  • eb0a6f7 Shader packs, clean room 2: macros and #if conditions

📊 Changes

11 files changed (+901 additions, -1 deletions)

View changed files

📝 AGENTS.md (+1 -0)
📝 Cargo.lock (+8 -0)
📝 Cargo.toml (+1 -1)
➕ crates/horizon-shaders/Cargo.toml (+14 -0)
➕ crates/horizon-shaders/src/condition.rs (+265 -0)
➕ crates/horizon-shaders/src/discover.rs (+82 -0)
➕ crates/horizon-shaders/src/lang.rs (+74 -0)
➕ crates/horizon-shaders/src/lib.rs (+20 -0)
➕ crates/horizon-shaders/src/macros.rs (+131 -0)
➕ crates/horizon-shaders/src/pack.rs (+262 -0)
➕ crates/horizon-shaders/tests/real_packs.rs (+43 -0)

📄 Description

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

Shader packs, clean room 2 of 3 (slice 1b): macros and the #if arithmetic that a pack's .properties files and, later, its GLSL preprocessor share. Stacked on #1584.

What

  • eval_condition(expr, macros): defined X and defined(X), decimal, 0x hexadecimal and leading-zero octal literals with an optional u, the C operators with C precedence (GLSL 4.60 §3.3), macros expanded to their values. An identifier that is not a macro reads as 0, as in C: GLSL would reject the line, and a pack would lose a whole section of its settings over one unknown name. A bad condition (1 / 0, X == 0.5, an unclosed bracket) returns why.
  • Macros: object-like macros with expansion that stops when a macro reappears inside its own expansion. Macros::standard() gives MC_VERSION from horizon_core::version::VERSION_ID by the documented rule major*10000 + minor*100 + patch (26.3 is 260300; tested against the documented examples 1.21.0 → 12100 and 1.7.10 → 10710) and the system's MC_OS_*. The graphics macros arrive with the renderer. No other loader's identity macros are defined (orchestrator decision).

Nothing uses it yet: players see no change (skip-release).

Clean room

Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, §1.5 (#if arithmetic) and §1.5.1 (MC_VERSION, MC_OS_*), plus the GLSL 4.60 specification §3.3; no other loader's code read. Decision OQ-1 (MC_VERSION = 260300) is in the clean room's impl-plan.md.

How tested

Unit tests: C precedence and operators, literals, macros and defined, unknown names, every error case, version numbers.

Self-check (whole stack, on its top branch)

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 16d49fe66, 18 min 0 s)

Check Result
Scope ⚠️ 12 files, +1199 −1; 1140 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (4 s)
clippy ✅ (1 min 12 s)
tests: workspace ✅ 1947 passed (15 min 38 s)
doc tests ✅ 1 passed (1 min 5 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Parity: the root Cargo.toml change selects 326 harnesses, but nothing in the game depends on the new crate, so they can't change. CI runs them.

Needs Ludovic

Nothing for this PR. Label skip-release because players see nothing yet. The clean room brief says feature, but no player-facing change ships until the Shader Packs page (slice 9).

🤖 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/1585 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/shader-packs-conditions` --- ### 📝 Commits (2) - [`07e46da`](https://github.com/horizon-rust/horizon/commit/07e46daa59e2c6238a443c7992beb10af1307266) Shader packs, clean room 1: read packs and their lang files - [`eb0a6f7`](https://github.com/horizon-rust/horizon/commit/eb0a6f74e6d5911cc63e637b6dcd14076c28ac0e) Shader packs, clean room 2: macros and #if conditions ### 📊 Changes **11 files changed** (+901 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+1 -0) 📝 `Cargo.lock` (+8 -0) 📝 `Cargo.toml` (+1 -1) ➕ `crates/horizon-shaders/Cargo.toml` (+14 -0) ➕ `crates/horizon-shaders/src/condition.rs` (+265 -0) ➕ `crates/horizon-shaders/src/discover.rs` (+82 -0) ➕ `crates/horizon-shaders/src/lang.rs` (+74 -0) ➕ `crates/horizon-shaders/src/lib.rs` (+20 -0) ➕ `crates/horizon-shaders/src/macros.rs` (+131 -0) ➕ `crates/horizon-shaders/src/pack.rs` (+262 -0) ➕ `crates/horizon-shaders/tests/real_packs.rs` (+43 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room 2 of 3 (slice 1b):** macros and the `#if` arithmetic that a pack's `.properties` files and, later, its GLSL preprocessor share. Stacked on #1584. ## What - `eval_condition(expr, macros)`: `defined X` and `defined(X)`, decimal, `0x` hexadecimal and leading-zero octal literals with an optional `u`, the C operators with C precedence (GLSL 4.60 §3.3), macros expanded to their values. An identifier that is not a macro reads as 0, as in C: GLSL would reject the line, and a pack would lose a whole section of its settings over one unknown name. A bad condition (`1 / 0`, `X == 0.5`, an unclosed bracket) returns why. - `Macros`: object-like macros with expansion that stops when a macro reappears inside its own expansion. `Macros::standard()` gives `MC_VERSION` from `horizon_core::version::VERSION_ID` by the documented rule `major*10000 + minor*100 + patch` (26.3 is `260300`; tested against the documented examples 1.21.0 → 12100 and 1.7.10 → 10710) and the system's `MC_OS_*`. The graphics macros arrive with the renderer. No other loader's identity macros are defined (orchestrator decision). Nothing uses it yet: players see no change (`skip-release`). ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §1.5 (`#if` arithmetic) and §1.5.1 (`MC_VERSION`, `MC_OS_*`), plus the GLSL 4.60 specification §3.3; no other loader's code read. Decision OQ-1 (`MC_VERSION` = 260300) is in the clean room's `impl-plan.md`. ## How tested Unit tests: C precedence and operators, literals, macros and `defined`, unknown names, every error case, version numbers. ## Self-check (whole stack, on its top branch) **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 16d49fe66, 18 min 0 s) | Check | Result | | --- | --- | | Scope | ⚠️ 12 files, +1199 −1; 1140 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (4 s) | | clippy | ✅ (1 min 12 s) | | tests: workspace | ✅ 1947 passed (15 min 38 s) | | doc tests | ✅ 1 passed (1 min 5 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Parity: the root `Cargo.toml` change selects 326 harnesses, but nothing in the game depends on the new crate, so they can't change. CI runs them. ## Needs Ludovic Nothing for this PR. Label `skip-release` because players see nothing yet. The clean room brief says `feature`, but no player-facing change ships until the Shader Packs page (slice 9). 🤖 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:10:47 +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#3611
No description provided.