[PR #1599] [MERGED] Shader packs, clean room 4: function-like macros and the standard macros #3620

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

📋 Pull Request Information

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

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


📝 Commits (4)

  • 07e46da Shader packs, clean room 1: read packs and their lang files
  • eb0a6f7 Shader packs, clean room 2: macros and #if conditions
  • 397d529 Shader packs, clean room 3: .properties files with conditional directives
  • 4c65ed2 Shader packs, clean room 4: function-like macros and the standard macros

📊 Changes

12 files changed (+1439 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 (+369 -0)
➕ crates/horizon-shaders/src/discover.rs (+82 -0)
➕ crates/horizon-shaders/src/lang.rs (+74 -0)
➕ crates/horizon-shaders/src/lib.rs (+23 -0)
➕ crates/horizon-shaders/src/macros.rs (+317 -0)
➕ crates/horizon-shaders/src/pack.rs (+262 -0)
➕ crates/horizon-shaders/src/properties.rs (+229 -0)
➕ crates/horizon-shaders/tests/real_packs.rs (+59 -0)

📄 Description

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

Shader packs, clean room 4 (slice 2a): function-like macros and the standard macros. Stacked on #1586.

What

  • The macro engine the GLSL preprocessor needs, shared with the .properties reader: function-like macros take their arguments when a ( follows the name (arguments expanded first, raw beside ##, which pastes); a macro is never expanded inside its own expansion. Text is cut into preprocessing tokens, so 1e5 or 0x1F are never mistaken for names.
  • The #if/#elif/#else/#endif state moves out of the .properties reader so the preprocessor (next PR) uses the same code.
  • Standard macros: MC_GL_VERSION and MC_GLSL_VERSION 460, the 24 MC_RENDER_STAGE_* as ascending integers in draw order, MC_RENDER_QUALITY / MC_SHADOW_QUALITY 1.0, MC_HAND_DEPTH 0.125, MAX_COLOR_BUFFERS 16.

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, §1.5.1, §5.4 and OQ-7; no other loader's code read. Values chosen for the open questions (render stage numbers, GL version, hand depth) are in the clean room's impl-plan.md.

How tested

Unit tests: function-like macros with arguments, nesting, ## pasting and self-reference; the standard macros (existing tests updated). The black box on the public test packs runs in the next PRs, which use this engine on every stage file.

Self-check (whole stack, on its top branch feat/shader-packs-translate)

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

Check Result
Scope ⚠️ 16 files, +3028 −1; 2864 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 ✅ (35 s)
clippy ✅ (3 min 10 s)
tests: workspace ✅ 1955 passed (27 min 39 s)
doc tests ✅ 1 passed (rerun alone: the first run compiled the next slice's uncommitted files in the same worktree)
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 skip-release: players see nothing yet

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 first visible slice is 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/1599 **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-macros` --- ### 📝 Commits (4) - [`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 - [`397d529`](https://github.com/horizon-rust/horizon/commit/397d529db72a17a1def83e1d7c50e9f866beb69e) Shader packs, clean room 3: .properties files with conditional directives - [`4c65ed2`](https://github.com/horizon-rust/horizon/commit/4c65ed2f5c6c4e089cf4f0bec4b32ab97004e4bc) Shader packs, clean room 4: function-like macros and the standard macros ### 📊 Changes **12 files changed** (+1439 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` (+369 -0) ➕ `crates/horizon-shaders/src/discover.rs` (+82 -0) ➕ `crates/horizon-shaders/src/lang.rs` (+74 -0) ➕ `crates/horizon-shaders/src/lib.rs` (+23 -0) ➕ `crates/horizon-shaders/src/macros.rs` (+317 -0) ➕ `crates/horizon-shaders/src/pack.rs` (+262 -0) ➕ `crates/horizon-shaders/src/properties.rs` (+229 -0) ➕ `crates/horizon-shaders/tests/real_packs.rs` (+59 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room 4 (slice 2a):** function-like macros and the standard macros. Stacked on #1586. ## What - The macro engine the GLSL preprocessor needs, shared with the `.properties` reader: function-like macros take their arguments when a `(` follows the name (arguments expanded first, raw beside `##`, which pastes); a macro is never expanded inside its own expansion. Text is cut into preprocessing tokens, so `1e5` or `0x1F` are never mistaken for names. - The `#if`/`#elif`/`#else`/`#endif` state moves out of the `.properties` reader so the preprocessor (next PR) uses the same code. - Standard macros: `MC_GL_VERSION` and `MC_GLSL_VERSION` 460, the 24 `MC_RENDER_STAGE_*` as ascending integers in draw order, `MC_RENDER_QUALITY` / `MC_SHADOW_QUALITY` 1.0, `MC_HAND_DEPTH` 0.125, `MAX_COLOR_BUFFERS` 16. 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, §1.5.1, §5.4 and OQ-7; no other loader's code read. Values chosen for the open questions (render stage numbers, GL version, hand depth) are in the clean room's `impl-plan.md`. ## How tested Unit tests: function-like macros with arguments, nesting, `##` pasting and self-reference; the standard macros (existing tests updated). The black box on the public test packs runs in the next PRs, which use this engine on every stage file. ## Self-check (whole stack, on its top branch `feat/shader-packs-translate`) **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 16d49fe66, 32 min 35 s) | Check | Result | | --- | --- | | Scope | ⚠️ 16 files, +3028 −1; 2864 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 | ✅ (35 s) | | clippy | ✅ (3 min 10 s) | | tests: workspace | ✅ 1955 passed (27 min 39 s) | | doc tests | ✅ 1 passed (rerun alone: the first run compiled the next slice's uncommitted files in the same worktree) | | 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 | `skip-release`: players see nothing yet | 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 first visible slice is 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:51 +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#3620
No description provided.