[PR #4371] [MERGED] resource packs: a pack's core/text shader draws the GUI's text, so server HUDs show #5585

Closed
opened 2026-11-03 05:13:35 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4371
Author: @iLostName
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: core-text-shader


📝 Commits (1)

  • e759c90 resource packs: a pack's core/text shader draws the GUI's text, so server HUDs show

📊 Changes

6 files changed (+1063 additions, -9 deletions)

View changed files

📝 crates/horizon-client-render/src/hud.rs (+71 -5)
➕ crates/horizon-client-render/src/hud/pack_text.rs (+325 -0)
📝 crates/horizon-client/src/game.rs (+7 -0)
➕ crates/horizon-shaders/src/core_shader.rs (+653 -0)
📝 crates/horizon-shaders/src/lib.rs (+3 -0)
📝 docs/resource-packs.md (+4 -4)

📄 Description

What and why

Servers place their HUD with the resource pack's shaders/core/text.vsh: glyphs written far right of a boss bar title are moved to the screen's corners and edges, and text.fsh adds effects (colour sweeps, vignettes). Horizon drew GUI text natively and never ran a pack's GLSL, so those HUDs stayed off screen.

  • horizon-shaders core_shader.rs turns a pack's core shader pair into validated naga modules: includes (#include and the older #moj_import) inlined from the pack, then the game's resources; vanilla's uniform blocks and samplers bound at fixed slots; vertex inputs filled by the caller; varyings matched by name across the stages; gl_VertexID from the caller. Blocks and samplers of other pipelines (OIT's) are fine behind their #ifdef, an error when a stage uses them.
  • hud/pack_text.rs: when a pack replaces core/text, the GUI's text quads (glyphs, shadows, underline and strikethrough; not world text) draw through it with IS_GUI, under vanilla's GUI projection and model view, Globals (ScreenSize, GameTime, GlintAlpha) and the glyph atlas as Sampler0. gl_VertexID % 4 gives vanilla's corner order. A shader that doesn't translate or validate (wgpu error scope) leaves the text native, with a log line.
  • docs/resource-packs.md: core shaders are "partly".

Tested with a network's pack whose HUD is lanes in a boss bar title: its panels and text sit at the corners as in vanilla, and menus' text is unchanged. Over 500 lines: about 400 are tests, and the translator has no other user, so it comes with its pipeline.

Vanilla reference

RenderPipelines.GUI_TEXT (core/text with IS_GUI, POSITION_TEX_COLOR, translucent, no depth); GuiRenderer (setupOrtho(1000, 11000, width / guiScale, height / guiScale, true), model view translated by -11000); GlobalSettingsUniform.update (GameTime = (gameTime % 24000 + partial tick) / 24000); the uniform blocks of shaders/include/*.glsl; GlslCompiler's includes.

Self-check

pr_ready (tools/pr_ready.py --quick on PC-Lost, against origin/main at 0a341cc35, 8 min 16 s)

Check Result
Scope ⚠️ 6 files, +1063 −9; 1064 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 480 passed (2 min 21 s)
rustfmt ✅ (18 s)
clippy ✅ (1 min 43 s)
tests: horizon-client, horizon-client-render, horizon-shaders ❌ 731 passed, 1 failed (3 min 42 s)
doc tests ✅ 0 passed (8 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The one failure under the horizon-client tests is title::tests::each_world_preset_writes_its_own_generator, which makes a folder named minecraft:normal that Windows refuses; this branch doesn't touch it. Parity is left to CI.


🔄 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/4371 **Author:** [@iLostName](https://github.com/iLostName) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `core-text-shader` --- ### 📝 Commits (1) - [`e759c90`](https://github.com/horizon-rust/horizon/commit/e759c905f1863bd04529adef310164215c52ef9c) resource packs: a pack's core/text shader draws the GUI's text, so server HUDs show ### 📊 Changes **6 files changed** (+1063 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/hud.rs` (+71 -5) ➕ `crates/horizon-client-render/src/hud/pack_text.rs` (+325 -0) 📝 `crates/horizon-client/src/game.rs` (+7 -0) ➕ `crates/horizon-shaders/src/core_shader.rs` (+653 -0) 📝 `crates/horizon-shaders/src/lib.rs` (+3 -0) 📝 `docs/resource-packs.md` (+4 -4) </details> ### 📄 Description ## What and why Servers place their HUD with the resource pack's `shaders/core/text.vsh`: glyphs written far right of a boss bar title are moved to the screen's corners and edges, and `text.fsh` adds effects (colour sweeps, vignettes). Horizon drew GUI text natively and never ran a pack's GLSL, so those HUDs stayed off screen. - `horizon-shaders` `core_shader.rs` turns a pack's core shader pair into validated naga modules: includes (`#include` and the older `#moj_import`) inlined from the pack, then the game's resources; vanilla's uniform blocks and samplers bound at fixed slots; vertex inputs filled by the caller; varyings matched by name across the stages; `gl_VertexID` from the caller. Blocks and samplers of other pipelines (OIT's) are fine behind their `#ifdef`, an error when a stage uses them. - `hud/pack_text.rs`: when a pack replaces `core/text`, the GUI's text quads (glyphs, shadows, underline and strikethrough; not world text) draw through it with `IS_GUI`, under vanilla's GUI projection and model view, `Globals` (`ScreenSize`, `GameTime`, `GlintAlpha`) and the glyph atlas as `Sampler0`. `gl_VertexID % 4` gives vanilla's corner order. A shader that doesn't translate or validate (wgpu error scope) leaves the text native, with a log line. - `docs/resource-packs.md`: core shaders are "partly". Tested with a network's pack whose HUD is lanes in a boss bar title: its panels and text sit at the corners as in vanilla, and menus' text is unchanged. Over 500 lines: about 400 are tests, and the translator has no other user, so it comes with its pipeline. ## Vanilla reference `RenderPipelines.GUI_TEXT` (`core/text` with `IS_GUI`, `POSITION_TEX_COLOR`, translucent, no depth); `GuiRenderer` (`setupOrtho(1000, 11000, width / guiScale, height / guiScale, true)`, model view translated by -11000); `GlobalSettingsUniform.update` (`GameTime` = (gameTime % 24000 + partial tick) / 24000); the uniform blocks of `shaders/include/*.glsl`; `GlslCompiler`'s includes. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on PC-Lost, against origin/main at 0a341cc35, 8 min 16 s) | Check | Result | | --- | --- | | Scope | ⚠️ 6 files, +1063 −9; 1064 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 480 passed (2 min 21 s) | | rustfmt | ✅ (18 s) | | clippy | ✅ (1 min 43 s) | | tests: horizon-client, horizon-client-render, horizon-shaders | ❌ 731 passed, 1 failed (3 min 42 s) | | doc tests | ✅ 0 passed (8 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The one failure under the horizon-client tests is `title::tests::each_world_preset_writes_its_own_generator`, which makes a folder named `minecraft:normal` that Windows refuses; this branch doesn't touch it. Parity is left to CI. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:35 +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#5585
No description provided.