[PR #1669] [MERGED] Shader packs, clean room 11: translating gbuffers programs #3675

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

📋 Pull Request Information

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

Base: main ← Head: feat/shader-packs-gbuffers-translate


📝 Commits (1)

  • a2a91f9 Shader packs, clean room 11: translating gbuffers programs

📊 Changes

4 files changed (+168 additions, -12 deletions)

View changed files

📝 crates/horizon-shaders/src/lib.rs (+5 -2)
📝 crates/horizon-shaders/src/translate/mod.rs (+144 -5)
📝 crates/horizon-shaders/src/translate/rewrite.rs (+13 -3)
📝 crates/horizon-shaders/src/translate/scan.rs (+6 -2)

📄 Description

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

Shader packs, clean room 11 (slice 6a): translating gbuffers programs. Stacked on #1668.

What

translate_gbuffers in horizon-shaders, the translator's half of drawing the world with a pack's own programs:

  • The game supplies a GbuffersInputs: GLSL declarations of its vertex inputs (and bindings of set 1) plus statements that set the compatibility inputs (gl_Vertex, gl_Color, gl_MultiTexCoord0/1, gl_Normal). The translator only places them, so the crate stays free of the renderer's vertex formats.
  • Attributes a pack declares (mc_Entity, mc_midTexCoord, at_tangent, vaPosition...) get the game's value when it gives one and zero otherwise (§5.1: declaring them is how a pack asks for them).
  • The compatibility matrices come from the frame: gl_ModelViewMatrix = gbufferModelView, gl_ProjectionMatrix = gbufferProjection (+ inverses, gl_ModelViewProjectionMatrix, gl_NormalMatrix = its upper 3×3), gl_TextureMatrix[1] and [2] = the lightmap matrix of §1.6 (scale 1/256, translate 1/32), the others identity. The four gbuffer* matrices join the uniform block even when the pack does not declare them.

Nothing calls it yet; the client's terrain pass is the next PR. About 170 lines.

Clean room

Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, §1.6, §2.2, §5.1; no other loader's code read.

How tested

Unit test gbuffers_programs_read_the_games_vertices: a GLSL 120 gbuffers_terrain written for the test (ftransform, both texture matrices, gl_NormalMatrix, mc_Entity, mc_midTexCoord, DRAWBUFFERS:02) translates with game-like inputs; the game's vertex inputs reach the entry point, the gbuffer* matrices are in the block, both outputs exist, and naga validates both stages. The existing translator tests still pass.

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

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

Check Result
Scope ⚠️ 37 files, +5804 −13; 5544 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 ✅ (22 s)
tests: workspace ✅ 1967 passed (10 min 9 s)
doc tests ✅ 1 passed (34 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: 326 harnesses selected (the root Cargo.toml and gfx.rs earlier in the stack); CI runs them. Nothing here acts without HORIZON_SHADER_PACK. The Label row is the tool's generic hint: these PRs are skip-release. After this run, the slice 11 commit was amended to drop an unused Target variant (cargo test/clippy -D warnings of horizon-shaders rerun: pass).

Needs Ludovic

Nothing. Label skip-release: it runs only behind HORIZON_SHADER_PACK.

🤖 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/1669 **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-gbuffers-translate` --- ### 📝 Commits (1) - [`a2a91f9`](https://github.com/horizon-rust/horizon/commit/a2a91f98f96c3270dfaf600d9d3ddf06830dbd5c) Shader packs, clean room 11: translating gbuffers programs ### 📊 Changes **4 files changed** (+168 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-shaders/src/lib.rs` (+5 -2) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+144 -5) 📝 `crates/horizon-shaders/src/translate/rewrite.rs` (+13 -3) 📝 `crates/horizon-shaders/src/translate/scan.rs` (+6 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room 11 (slice 6a):** translating gbuffers programs. Stacked on #1668. ## What `translate_gbuffers` in `horizon-shaders`, the translator's half of drawing the world with a pack's own programs: - The game supplies a `GbuffersInputs`: GLSL declarations of its vertex inputs (and bindings of set 1) plus statements that set the compatibility inputs (`gl_Vertex`, `gl_Color`, `gl_MultiTexCoord0/1`, `gl_Normal`). The translator only places them, so the crate stays free of the renderer's vertex formats. - Attributes a pack declares (`mc_Entity`, `mc_midTexCoord`, `at_tangent`, `vaPosition`...) get the game's value when it gives one and zero otherwise (§5.1: declaring them is how a pack asks for them). - The compatibility matrices come from the frame: `gl_ModelViewMatrix` = `gbufferModelView`, `gl_ProjectionMatrix` = `gbufferProjection` (+ inverses, `gl_ModelViewProjectionMatrix`, `gl_NormalMatrix` = its upper 3×3), `gl_TextureMatrix[1]` and `[2]` = the lightmap matrix of §1.6 (scale 1/256, translate 1/32), the others identity. The four `gbuffer*` matrices join the uniform block even when the pack does not declare them. Nothing calls it yet; the client's terrain pass is the next PR. About 170 lines. ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §1.6, §2.2, §5.1; no other loader's code read. ## How tested Unit test `gbuffers_programs_read_the_games_vertices`: a GLSL 120 `gbuffers_terrain` written for the test (`ftransform`, both texture matrices, `gl_NormalMatrix`, `mc_Entity`, `mc_midTexCoord`, `DRAWBUFFERS:02`) translates with game-like inputs; the game's vertex inputs reach the entry point, the `gbuffer*` matrices are in the block, both outputs exist, and naga validates both stages. The existing translator tests still pass. ## Self-check (whole stack, on its top branch `feat/shader-packs-atlas`) **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 16d49fe66, 11 min 9 s) | Check | Result | | --- | --- | | Scope | ⚠️ 37 files, +5804 −13; 5544 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 | ✅ (22 s) | | tests: workspace | ✅ 1967 passed (10 min 9 s) | | doc tests | ✅ 1 passed (34 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: 326 harnesses selected (the root `Cargo.toml` and `gfx.rs` earlier in the stack); CI runs them. Nothing here acts without `HORIZON_SHADER_PACK`. The Label row is the tool's generic hint: these PRs are `skip-release`. After this run, the slice 11 commit was amended to drop an unused `Target` variant (`cargo test`/`clippy -D warnings` of `horizon-shaders` rerun: pass). ## Needs Ludovic Nothing. Label `skip-release`: it runs only behind `HORIZON_SHADER_PACK`. 🤖 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:11:21 +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#3675
No description provided.