[PR #4451] [MERGED] Shader packs 10/12: draw geometry stages (Rethinking Voxels renders) #5631

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

📋 Pull Request Information

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

Base: main ← Head: shader-packs/10


📝 Commits (10+)

  • fcd2161 Shader packs: atomic functions on a component of a shared integer vector
  • 6e385e7 Shader packs: Iris's camera uniforms
  • 92b62f0 Shader packs: translate geometry stages of terrain's shadow program
  • 60d3a67 Shader packs: draw geometry stages, and what Rethinking Voxels needed
  • 62a673e Shader packs: eye uniforms are the player's in third person, compound assignments on atomic vectors
  • ba64c55 Shader packs: geometry stages are tested, take unsized inputs, images keep a layout on the line before
  • 8429a92 Shader packs: a terrain or shadow program that writes only images is drawn
  • 888fc0f Shader packs: relativeEyePosition points from the eye to the camera, uint indices on split vectors
  • ed70681 Shader packs: gl_InstanceID is 0 in a folded vertex stage, shadow_water has no cutout test
  • 0d6a564 Shader packs: up to 64 images, a pass's copy of an image it samples and stores is taken just before it

📊 Changes

15 files changed (+1576 additions, -70 deletions)

View changed files

📝 crates/horizon-client-render/src/camera.rs (+8 -0)
📝 crates/horizon-client-render/src/gfx.rs (+42 -3)
📝 crates/horizon-client-render/src/gfx/flat.rs (+17 -0)
📝 crates/horizon-client-render/src/gfx/pack_atlas.rs (+10 -0)
📝 crates/horizon-client-render/src/gfx/pack_images.rs (+157 -21)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+124 -11)
📝 crates/horizon-client-render/src/gfx/pack_uniforms.rs (+41 -4)
📝 crates/horizon-client/src/game.rs (+10 -0)
📝 crates/horizon-shaders/src/lib.rs (+3 -3)
📝 crates/horizon-shaders/src/post.rs (+204 -24)
➕ crates/horizon-shaders/src/translate/atomic_vectors.rs (+349 -0)
➕ crates/horizon-shaders/src/translate/geometry.rs (+572 -0)
📝 crates/horizon-shaders/src/translate/mod.rs (+20 -0)
📝 crates/horizon-shaders/src/translate/rewrite.rs (+4 -2)
📝 crates/horizon-shaders/tests/real_packs.rs (+15 -2)

📄 Description

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

  • 60d3a679b Shader packs: draw geometry stages, and what Rethinking Voxels needed
  • 8429a924e Shader packs: a terrain or shadow program that writes only images is drawn
  • 0d6a56428 Shader packs: up to 64 images, a pass's copy of an image it samples and stores is taken just before it

What and why

draw geometry stages, and what Rethinking Voxels needed (60d3a679b)

  • Flat terrain draws a program with a geometry stage without its index buffer: the vertex stage reads it (set 5) and the draw has an instance for each triangle the geometry stage may emit.
  • Programs that write only images draw into a sink that keeps nothing.
  • The pack's images are cleared before the shadow pass, not after it, and a pass that samples an image it stores samples last frame's copy. Images an atomic function uses are made for atomics (Metal dropped them otherwise), and images bind in vertex stages where the device lets them.
  • HORIZON_SHADER_PACK_DUMP= logs how many of a pack image's texels are set, for debugging.

Rethinking Voxels r0.1-beta9 voxelizes the world in its shadow pass and lights it with its colored voxel lights.

a terrain or shadow program that writes only images is drawn (8429a924e)

It was skipped as writing no buffer; the sink was only given to fullscreen programs. A program
drawing geometry has the depth buffer, so it now draws with no colour target, its images
written as GL's would be.

up to 64 images, a pass's copy of an image it samples and stores is taken just before it (0d6a56428)

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 31 s)

Check Result
Scope ⚠️ 187 files, +125432 −299; 125575 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 (24 s)
rustfmt ✅ (5 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 ✅ (30 s)
tests: workspace ❌ 2562 passed, 7 failed (1 min 5 s)
doc tests ✅ 0 passed (4 s)
content root tests ✅ 7 passed (18 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/4451 **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/10` --- ### 📝 Commits (10+) - [`fcd2161`](https://github.com/horizon-rust/horizon/commit/fcd21612876425d80f0b2a4753a971e5653f503e) Shader packs: atomic functions on a component of a shared integer vector - [`6e385e7`](https://github.com/horizon-rust/horizon/commit/6e385e741f4e389f611cc9c20c4e435e29e54c50) Shader packs: Iris's camera uniforms - [`92b62f0`](https://github.com/horizon-rust/horizon/commit/92b62f0f0ee9af9902f770b0e6df642ce668675c) Shader packs: translate geometry stages of terrain's shadow program - [`60d3a67`](https://github.com/horizon-rust/horizon/commit/60d3a679bc1d5d0d5905680736de76b7c02185c0) Shader packs: draw geometry stages, and what Rethinking Voxels needed - [`62a673e`](https://github.com/horizon-rust/horizon/commit/62a673ec2ccc8e32919eeb35e1196bc468d7b613) Shader packs: eye uniforms are the player's in third person, compound assignments on atomic vectors - [`ba64c55`](https://github.com/horizon-rust/horizon/commit/ba64c557465f8b6178c2be93cafdca0b0f643c82) Shader packs: geometry stages are tested, take unsized inputs, images keep a layout on the line before - [`8429a92`](https://github.com/horizon-rust/horizon/commit/8429a924edc6f2582b2dea721250ec2de7fd2f69) Shader packs: a terrain or shadow program that writes only images is drawn - [`888fc0f`](https://github.com/horizon-rust/horizon/commit/888fc0fafd8f34f10433f1e161d95a3a9e118780) Shader packs: relativeEyePosition points from the eye to the camera, uint indices on split vectors - [`ed70681`](https://github.com/horizon-rust/horizon/commit/ed70681a0f595b770d3512e6c6ee11cce9202e1b) Shader packs: gl_InstanceID is 0 in a folded vertex stage, shadow_water has no cutout test - [`0d6a564`](https://github.com/horizon-rust/horizon/commit/0d6a5642876bd36059e66b7e4680834a6a8eda49) Shader packs: up to 64 images, a pass's copy of an image it samples and stores is taken just before it ### 📊 Changes **15 files changed** (+1576 additions, -70 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/camera.rs` (+8 -0) 📝 `crates/horizon-client-render/src/gfx.rs` (+42 -3) 📝 `crates/horizon-client-render/src/gfx/flat.rs` (+17 -0) 📝 `crates/horizon-client-render/src/gfx/pack_atlas.rs` (+10 -0) 📝 `crates/horizon-client-render/src/gfx/pack_images.rs` (+157 -21) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+124 -11) 📝 `crates/horizon-client-render/src/gfx/pack_uniforms.rs` (+41 -4) 📝 `crates/horizon-client/src/game.rs` (+10 -0) 📝 `crates/horizon-shaders/src/lib.rs` (+3 -3) 📝 `crates/horizon-shaders/src/post.rs` (+204 -24) ➕ `crates/horizon-shaders/src/translate/atomic_vectors.rs` (+349 -0) ➕ `crates/horizon-shaders/src/translate/geometry.rs` (+572 -0) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+20 -0) 📝 `crates/horizon-shaders/src/translate/rewrite.rs` (+4 -2) 📝 `crates/horizon-shaders/tests/real_packs.rs` (+15 -2) </details> ### 📄 Description Part 10 of 12 of the shader pack work from #3737. It builds on part 9 (#4450): this branch is that one plus the commits below, so review only these: - `60d3a679b` Shader packs: draw geometry stages, and what Rethinking Voxels needed - `8429a924e` Shader packs: a terrain or shadow program that writes only images is drawn - `0d6a56428` Shader packs: up to 64 images, a pass's copy of an image it samples and stores is taken just before it ## What and why **draw geometry stages, and what Rethinking Voxels needed** (`60d3a679b`) - Flat terrain draws a program with a geometry stage without its index buffer: the vertex stage reads it (set 5) and the draw has an instance for each triangle the geometry stage may emit. - Programs that write only images draw into a sink that keeps nothing. - The pack's images are cleared before the shadow pass, not after it, and a pass that samples an image it stores samples last frame's copy. Images an atomic function uses are made for atomics (Metal dropped them otherwise), and images bind in vertex stages where the device lets them. - HORIZON_SHADER_PACK_DUMP=<image> logs how many of a pack image's texels are set, for debugging. Rethinking Voxels r0.1-beta9 voxelizes the world in its shadow pass and lights it with its colored voxel lights. **a terrain or shadow program that writes only images is drawn** (`8429a924e`) It was skipped as writing no buffer; the sink was only given to fullscreen programs. A program drawing geometry has the depth buffer, so it now draws with no colour target, its images written as GL's would be. **up to 64 images, a pass's copy of an image it samples and stores is taken just before it** (`0d6a56428`) ## 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 31 s) | Check | Result | | --- | --- | | Scope | ⚠️ 187 files, +125432 −299; 125575 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 (24 s) | | rustfmt | ✅ (5 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 | ✅ (30 s) | | tests: workspace | ❌ 2562 passed, 7 failed (1 min 5 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ✅ 7 passed (18 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:56 +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#5631
No description provided.