[PR #1670] [MERGED] Shader packs, clean room 12: the block atlas packs sample #3676

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/1670
Author: @ludovic111
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

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


📝 Commits (1)

  • f31c18a Shader packs, clean room 12: the block atlas packs sample

📊 Changes

3 files changed (+239 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/gfx.rs (+32 -0)
📝 crates/horizon-client/src/gfx/animate.rs (+10 -0)
➕ crates/horizon-client/src/gfx/pack_atlas.rs (+197 -0)

📄 Description

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

Shader packs, clean room 12 (slice 6b): the block atlas packs sample. Stacked on #1669.

What

Packs sample blocks from one 2D atlas with atlas coordinates (texture/gtexture, atlasSize, mc_midTexCoord); Horizon keeps block sprites in texture arrays. New gfx/pack_atlas.rs:

  • While a pack is loaded, every sprite layer and each of its mip levels is copied into a square-ish grid (row by row from the top left), with GPU copies only.
  • The sprite animator now reports the layers it rewrote this tick, and only those are copied again (SpriteAnimator::changed).
  • The sprite arrays gain COPY_SRC. Without a pack nothing else changes: no atlas exists and no copies run.

The gbuffers terrain pass binds it in the next PR. About 240 lines.

Clean room

Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, §5.1 (mc_midTexCoord), §5.2 (atlasSize); no other loader's code read.

How tested

GPU unit test layers_land_in_their_cells: five sprites over two arrays (a split of 3) land in a 3×2 grid, each in its cell, read back from the GPU. The animator's own 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/1670 **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-atlas` --- ### 📝 Commits (1) - [`f31c18a`](https://github.com/horizon-rust/horizon/commit/f31c18aa6c06b206440d1dd1fe5784c437f304be) Shader packs, clean room 12: the block atlas packs sample ### 📊 Changes **3 files changed** (+239 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/gfx.rs` (+32 -0) 📝 `crates/horizon-client/src/gfx/animate.rs` (+10 -0) ➕ `crates/horizon-client/src/gfx/pack_atlas.rs` (+197 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room 12 (slice 6b):** the block atlas packs sample. Stacked on #1669. ## What Packs sample blocks from one 2D atlas with atlas coordinates (`texture`/`gtexture`, `atlasSize`, `mc_midTexCoord`); Horizon keeps block sprites in texture arrays. New `gfx/pack_atlas.rs`: - While a pack is loaded, every sprite layer and each of its mip levels is copied into a square-ish grid (row by row from the top left), with GPU copies only. - The sprite animator now reports the layers it rewrote this tick, and only those are copied again (`SpriteAnimator::changed`). - The sprite arrays gain `COPY_SRC`. Without a pack nothing else changes: no atlas exists and no copies run. The gbuffers terrain pass binds it in the next PR. About 240 lines. ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §5.1 (`mc_midTexCoord`), §5.2 (`atlasSize`); no other loader's code read. ## How tested GPU unit test `layers_land_in_their_cells`: five sprites over two arrays (a split of 3) land in a 3×2 grid, each in its cell, read back from the GPU. The animator's own 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#3676
No description provided.