[PR #4443] [MERGED] Shader packs 3/12: draw custom textures (Photon renders) #5625

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4443
Author: @PzmuV1517
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: shader-packs/03


📝 Commits (10+)

  • d085cab Shader packs: outputs narrower than vec4, inverse(), alphaTestRef and the cutout test
  • 6b0f026 Shader packs: read custom textures (texture.*)
  • 1763989 Shader packs: a raw texture's sizes are bounded and checked
  • 6485363 Shader packs: a pack that defines its own inverse() keeps it
  • e654965 Shader packs: draw custom textures, and what Photon needed to render in game
  • ec259a2 Shader packs: a custom texture over the device's limits is skipped with a note
  • b8f4137 Shader packs: 1D stand-ins, samplers check a custom texture's type, pack_textures is tested
  • 0c3831d Merge main into shader-packs/02 (zip 9.1.3 from #3832 beside this part's half and png)
  • de0508a Merge branch 'a3-4442' into a3-4443
  • 6173f17 Merge remote-tracking branch 'origin/main' into a3-4442

📊 Changes

15 files changed (+1159 additions, -76 deletions)

View changed files

📝 Cargo.lock (+3 -0)
📝 crates/horizon-client-render/Cargo.toml (+1 -0)
📝 crates/horizon-client-render/src/gfx.rs (+1 -0)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+210 -63)
➕ crates/horizon-client-render/src/gfx/pack_textures.rs (+339 -0)
📝 crates/horizon-shaders/Cargo.toml (+2 -0)
📝 crates/horizon-shaders/src/lib.rs (+5 -0)
📝 crates/horizon-shaders/src/pack.rs (+2 -2)
📝 crates/horizon-shaders/src/post.rs (+14 -1)
➕ crates/horizon-shaders/src/textures.rs (+427 -0)
📝 crates/horizon-shaders/src/translate/mod.rs (+70 -0)
📝 crates/horizon-shaders/src/translate/rewrite.rs (+21 -0)
📝 crates/horizon-shaders/src/translate/scan.rs (+51 -2)
📝 third_party/naga/src/front/glsl/functions.rs (+4 -5)
📝 third_party/naga/src/front/glsl/variables.rs (+9 -3)

📄 Description

Part 3 of 12 of the shader pack work from #3737. It builds on part 2 (#4442): this branch is that one plus the commits below, so review only these:

  • e65496594 Shader packs: draw custom textures, and what Photon needed to render in game
  • ec259a221 Shader packs: a custom texture over the device's limits is skipped with a note
  • b8f4137e2 Shader packs: 1D stand-ins, samplers check a custom texture's type, pack_textures is tested

What and why

draw custom textures, and what Photon needed to render in game (e65496594)

  • The custom textures texture.* names are uploaded and bound to the samplers they name: one texture per dimension of a unit (Photon's 3D scattering LUT under depthtex0), and the lightmap and block atlas by resource location. A sampler with nothing to read gets a stand-in of its own dimension instead of failing its pipeline.
  • Outputs past the last buffer RENDERTARGETS names go nowhere, as in GL, instead of an attachment the pass lacks (a crash).
  • A shader the driver's compiler refuses (an internal error) skips its program as a validation error does.

Photon v1.4 now loads all 27 overworld programs and draws its lighting, shadows, fog and volumetric clouds.

a custom texture over the device's limits is skipped with a note (ec259a221)

Its size is checked against the device's largest texture of its dimension and its texels
against that size before anything is created, so a pack asking for too much loses that
texture instead of failing validation at upload.

1D stand-ins, samplers check a custom texture's type, pack_textures is tested (b8f4137e2)

Vanilla reference

Horizon-only: vanilla has no shader packs. Nothing changes unless a pack is selected.

Self-check

pr_ready (tools/pr_ready.py --quick on Mac, against origin/main at 27cb8f96b, 2 min 28 s)

Check Result
Scope ⚠️ 175 files, +121467 −88; 121453 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ✅ 495 passed (25 s)
rustfmt ✅ (4 s)
Rust ⚠️ 1.98.1 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ✅ (31 s)
tests: workspace ❌ 2562 passed, 7 failed (1 min 2 s)
doc tests ✅ 0 passed (4 s)
content root tests ✅ 7 passed (17 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅
launcher tests ❌ 315 passed, 1 failed (4 s)
Parity ➖ 359 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 347 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Failures that aren't from this stack:

  • The horizon-port-pack resource pack tests and the launcher's modpacks::tests::resource_only_profile_can_play_without_enabling_or_overwriting_packs fail with "/var: not an ordinary directory" on macOS, where /var is a symlink. The resource pack tests fail the same way on main itself, and this stack changes neither horizon-port-pack nor the launcher.

Screenshots

Photon and Rethinking Voxels rendering, no pack and the packs that worked before unchanged, and the fallbacks: https://github.com/horizon-rust/horizon/pull/3737#issuecomment-6503561132.


🔄 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/4443 **Author:** [@PzmuV1517](https://github.com/PzmuV1517) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shader-packs/03` --- ### 📝 Commits (10+) - [`d085cab`](https://github.com/horizon-rust/horizon/commit/d085cabe41a8bcd8146c93c31eb1ea95e2b6b5e1) Shader packs: outputs narrower than vec4, inverse(), alphaTestRef and the cutout test - [`6b0f026`](https://github.com/horizon-rust/horizon/commit/6b0f0261e9b31a16528275fdcccc8170534b2fb6) Shader packs: read custom textures (texture.*) - [`1763989`](https://github.com/horizon-rust/horizon/commit/17639892ece3aa3aa3313a73e752b96fc50b368a) Shader packs: a raw texture's sizes are bounded and checked - [`6485363`](https://github.com/horizon-rust/horizon/commit/6485363dc2516cf9ea5c6e3ed0296646577aaa74) Shader packs: a pack that defines its own inverse() keeps it - [`e654965`](https://github.com/horizon-rust/horizon/commit/e65496594f9a4c9772aaebc3e9b4c7288a8b3fa7) Shader packs: draw custom textures, and what Photon needed to render in game - [`ec259a2`](https://github.com/horizon-rust/horizon/commit/ec259a221a91ff01abbc84f3ff9bdc93261d6bb7) Shader packs: a custom texture over the device's limits is skipped with a note - [`b8f4137`](https://github.com/horizon-rust/horizon/commit/b8f4137e2c1bb91386188d8124ebeeb47bd792aa) Shader packs: 1D stand-ins, samplers check a custom texture's type, pack_textures is tested - [`0c3831d`](https://github.com/horizon-rust/horizon/commit/0c3831d711c26decc128b794447e335c397c1021) Merge main into shader-packs/02 (zip 9.1.3 from #3832 beside this part's half and png) - [`de0508a`](https://github.com/horizon-rust/horizon/commit/de0508a004ee6e78b82668206c9c7c5677a29636) Merge branch 'a3-4442' into a3-4443 - [`6173f17`](https://github.com/horizon-rust/horizon/commit/6173f174b1d48a73c79f315b19545ca945ab84e5) Merge remote-tracking branch 'origin/main' into a3-4442 ### 📊 Changes **15 files changed** (+1159 additions, -76 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+3 -0) 📝 `crates/horizon-client-render/Cargo.toml` (+1 -0) 📝 `crates/horizon-client-render/src/gfx.rs` (+1 -0) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+210 -63) ➕ `crates/horizon-client-render/src/gfx/pack_textures.rs` (+339 -0) 📝 `crates/horizon-shaders/Cargo.toml` (+2 -0) 📝 `crates/horizon-shaders/src/lib.rs` (+5 -0) 📝 `crates/horizon-shaders/src/pack.rs` (+2 -2) 📝 `crates/horizon-shaders/src/post.rs` (+14 -1) ➕ `crates/horizon-shaders/src/textures.rs` (+427 -0) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+70 -0) 📝 `crates/horizon-shaders/src/translate/rewrite.rs` (+21 -0) 📝 `crates/horizon-shaders/src/translate/scan.rs` (+51 -2) 📝 `third_party/naga/src/front/glsl/functions.rs` (+4 -5) 📝 `third_party/naga/src/front/glsl/variables.rs` (+9 -3) </details> ### 📄 Description Part 3 of 12 of the shader pack work from #3737. It builds on part 2 (#4442): this branch is that one plus the commits below, so review only these: - `e65496594` Shader packs: draw custom textures, and what Photon needed to render in game - `ec259a221` Shader packs: a custom texture over the device's limits is skipped with a note - `b8f4137e2` Shader packs: 1D stand-ins, samplers check a custom texture's type, pack_textures is tested ## What and why **draw custom textures, and what Photon needed to render in game** (`e65496594`) - The custom textures texture.* names are uploaded and bound to the samplers they name: one texture per dimension of a unit (Photon's 3D scattering LUT under depthtex0), and the lightmap and block atlas by resource location. A sampler with nothing to read gets a stand-in of its own dimension instead of failing its pipeline. - Outputs past the last buffer RENDERTARGETS names go nowhere, as in GL, instead of an attachment the pass lacks (a crash). - A shader the driver's compiler refuses (an internal error) skips its program as a validation error does. Photon v1.4 now loads all 27 overworld programs and draws its lighting, shadows, fog and volumetric clouds. **a custom texture over the device's limits is skipped with a note** (`ec259a221`) Its size is checked against the device's largest texture of its dimension and its texels against that size before anything is created, so a pack asking for too much loses that texture instead of failing validation at upload. **1D stand-ins, samplers check a custom texture's type, pack_textures is tested** (`b8f4137e2`) ## Vanilla reference Horizon-only: vanilla has no shader packs. Nothing changes unless a pack is selected. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Mac, against origin/main at 27cb8f96b, 2 min 28 s) | Check | Result | | --- | --- | | Scope | ⚠️ 175 files, +121467 −88; 121453 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ✅ 495 passed (25 s) | | rustfmt | ✅ (4 s) | | Rust | ⚠️ 1.98.1 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ✅ (31 s) | | tests: workspace | ❌ 2562 passed, 7 failed (1 min 2 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ✅ 7 passed (17 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ | | launcher tests | ❌ 315 passed, 1 failed (4 s) | | Parity | ➖ 359 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 347 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Failures that aren't from this stack: - The `horizon-port-pack` resource pack tests and the launcher's `modpacks::tests::resource_only_profile_can_play_without_enabling_or_overwriting_packs` fail with "/var: not an ordinary directory" on macOS, where `/var` is a symlink. The resource pack tests fail the same way on main itself, and this stack changes neither `horizon-port-pack` nor the launcher. ## Screenshots Photon and Rethinking Voxels rendering, no pack and the packs that worked before unchanged, and the fallbacks: https://github.com/horizon-rust/horizon/pull/3737#issuecomment-6503561132. --- <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:53 +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#5625
No description provided.