[PR #1822] [MERGED] Horizon shader packs: horizon-shader new/check/pack, templates, an example pack and the guide #3793

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

📋 Pull Request Information

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

Base: main ← Head: feat/native-shaders-sdk


📝 Commits (1)

  • 49f62d0 Horizon shader packs: horizon-shader new/check/pack, templates, an example pack and the guide

📊 Changes

20 files changed (+761 additions, -3 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-shader-api/Cargo.toml (+2 -1)
➕ crates/horizon-shader-api/packs/golden_hour/README.md (+4 -0)
➕ crates/horizon-shader-api/packs/golden_hour/common.wgsl (+13 -0)
➕ crates/horizon-shader-api/packs/golden_hour/horizon-shaders.toml (+69 -0)
➕ crates/horizon-shader-api/packs/golden_hour/post/glow.wgsl (+22 -0)
➕ crates/horizon-shader-api/packs/golden_hour/post/grade.wgsl (+19 -0)
➕ crates/horizon-shader-api/packs/golden_hour/sky.wgsl (+14 -0)
➕ crates/horizon-shader-api/src/bin/horizon-shader.rs (+307 -0)
📝 crates/horizon-shader-api/src/check.rs (+1 -1)
➕ crates/horizon-shader-api/templates/material/horizon-shaders.toml (+18 -0)
➕ crates/horizon-shader-api/templates/material/material.wgsl (+9 -0)
➕ crates/horizon-shader-api/templates/post/horizon-shaders.toml (+22 -0)
➕ crates/horizon-shader-api/templates/post/post.wgsl (+9 -0)
➕ crates/horizon-shader-api/templates/sky/horizon-shaders.toml (+18 -0)
➕ crates/horizon-shader-api/templates/sky/sky.wgsl (+9 -0)
➕ crates/horizon-shader-api/tests/sdk.rs (+92 -0)
📝 docs/README.md (+1 -0)
📝 docs/api/shaders.md (+4 -1)
➕ docs/shaders.md (+127 -0)

📄 Description

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

Stacked on #1820 (check) ← #1818 (stages) ← #1817 (format); the diff below is only this step.

What

The shader SDK's tool and its first users, so an author can make, check and package a Horizon shader pack today:

  • horizon-shader (a bin of horizon-shader-api):
    • new <dir> [--template post|sky|material] [--name "Name"]: a pack from a template (id from the folder name).
    • check <pack>... [--json]: the check from #1820; prints each stage's cost and the pack's SHA-256, or every problem at file:line:column. --json for tools (ok, id, version, api, sha256, stages, problems); exit status 1 when any pack fails.
    • pack <dir> [--out <file>]: check, then write the reproducible .hshader and print its SHA-256.
  • Templates for the three stages (crates/horizon-shader-api/templates/), each a small working effect with one option.
  • Golden Hour (crates/horizon-shader-api/packs/golden_hour), the example pack: a sky stage that warms the horizon around a low sun and deepens the blue overhead, a glow pass (12 taps scaled with the picture's height) and a colour grade (golden light at sunrise and sunset, a soft shoulder, saturation, vignette), with five options. It will be the renderer tests' pack when the post stage lands in the game; screenshots then.
  • docs/shaders.md, the authors' guide (linked from docs/README.md and docs/api/shaders.md).
$ horizon-shader check crates/horizon-shader-api/packs/golden_hour
golden_hour 1.0.0 (shader API 0.1): ok
  sky       Warm horizon                     99 expressions, 0 texture reads
  post      Glow                            185 expressions, 3 texture reads
  post      Colour grade                    201 expressions, 2 texture reads
  sha256 fd92a29426a882811053a4790b9ff3f58b4fe88e811e4ba1d2b3431507fbf777

How tested

cargo test -p horizon-shader-api: 20 passed
  sdk.rs (3): the example pack passes; `new` with each template then `check` passes (and an unknown template is refused);
    `pack` → `check --json` of the .hshader (ok, id, the same SHA-256 as `pack` printed, stages); a broken file gives
    ok=false with file and line, exit 1, and `pack` refuses it
  check.rs (7), reference.rs (4), schema.rs (5), inputs (1)
cargo clippy -p horizon-shader-api --all-targets -- -D warnings: clean; cargo fmt --check: clean

Needs Ludovic

Nothing. skip-release: nothing in the game or the launcher uses it yet (the renderer hooks are being agreed with cleanroom-impl-1).

🤖 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/1822 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/native-shaders-sdk` --- ### 📝 Commits (1) - [`49f62d0`](https://github.com/horizon-rust/horizon/commit/49f62d02cb01596462023f46c803e4cc1053b2f0) Horizon shader packs: horizon-shader new/check/pack, templates, an example pack and the guide ### 📊 Changes **20 files changed** (+761 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-shader-api/Cargo.toml` (+2 -1) ➕ `crates/horizon-shader-api/packs/golden_hour/README.md` (+4 -0) ➕ `crates/horizon-shader-api/packs/golden_hour/common.wgsl` (+13 -0) ➕ `crates/horizon-shader-api/packs/golden_hour/horizon-shaders.toml` (+69 -0) ➕ `crates/horizon-shader-api/packs/golden_hour/post/glow.wgsl` (+22 -0) ➕ `crates/horizon-shader-api/packs/golden_hour/post/grade.wgsl` (+19 -0) ➕ `crates/horizon-shader-api/packs/golden_hour/sky.wgsl` (+14 -0) ➕ `crates/horizon-shader-api/src/bin/horizon-shader.rs` (+307 -0) 📝 `crates/horizon-shader-api/src/check.rs` (+1 -1) ➕ `crates/horizon-shader-api/templates/material/horizon-shaders.toml` (+18 -0) ➕ `crates/horizon-shader-api/templates/material/material.wgsl` (+9 -0) ➕ `crates/horizon-shader-api/templates/post/horizon-shaders.toml` (+22 -0) ➕ `crates/horizon-shader-api/templates/post/post.wgsl` (+9 -0) ➕ `crates/horizon-shader-api/templates/sky/horizon-shaders.toml` (+18 -0) ➕ `crates/horizon-shader-api/templates/sky/sky.wgsl` (+9 -0) ➕ `crates/horizon-shader-api/tests/sdk.rs` (+92 -0) 📝 `docs/README.md` (+1 -0) 📝 `docs/api/shaders.md` (+4 -1) ➕ `docs/shaders.md` (+127 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #1820 (check) ← #1818 (stages) ← #1817 (format); the diff below is only this step. ## What The shader SDK's tool and its first users, so an author can make, check and package a Horizon shader pack today: - `horizon-shader` (a bin of `horizon-shader-api`): - `new <dir> [--template post|sky|material] [--name "Name"]`: a pack from a template (id from the folder name). - `check <pack>... [--json]`: the check from #1820; prints each stage's cost and the pack's SHA-256, or every problem at `file:line:column`. `--json` for tools (`ok`, `id`, `version`, `api`, `sha256`, `stages`, `problems`); exit status 1 when any pack fails. - `pack <dir> [--out <file>]`: check, then write the reproducible `.hshader` and print its SHA-256. - Templates for the three stages (`crates/horizon-shader-api/templates/`), each a small working effect with one option. - Golden Hour (`crates/horizon-shader-api/packs/golden_hour`), the example pack: a sky stage that warms the horizon around a low sun and deepens the blue overhead, a glow pass (12 taps scaled with the picture's height) and a colour grade (golden light at sunrise and sunset, a soft shoulder, saturation, vignette), with five options. It will be the renderer tests' pack when the post stage lands in the game; screenshots then. - `docs/shaders.md`, the authors' guide (linked from docs/README.md and docs/api/shaders.md). ``` $ horizon-shader check crates/horizon-shader-api/packs/golden_hour golden_hour 1.0.0 (shader API 0.1): ok sky Warm horizon 99 expressions, 0 texture reads post Glow 185 expressions, 3 texture reads post Colour grade 201 expressions, 2 texture reads sha256 fd92a29426a882811053a4790b9ff3f58b4fe88e811e4ba1d2b3431507fbf777 ``` ## How tested ``` cargo test -p horizon-shader-api: 20 passed sdk.rs (3): the example pack passes; `new` with each template then `check` passes (and an unknown template is refused); `pack` → `check --json` of the .hshader (ok, id, the same SHA-256 as `pack` printed, stages); a broken file gives ok=false with file and line, exit 1, and `pack` refuses it check.rs (7), reference.rs (4), schema.rs (5), inputs (1) cargo clippy -p horizon-shader-api --all-targets -- -D warnings: clean; cargo fmt --check: clean ``` ## Needs Ludovic Nothing. `skip-release`: nothing in the game or the launcher uses it yet (the renderer hooks are being agreed with cleanroom-impl-1). 🤖 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:12: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#3793
No description provided.