[PR #1817] [MERGED] Horizon shader packs: horizon-shaders.toml (schema 1) and the .hshader package #3788

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

📋 Pull Request Information

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

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


📝 Commits (1)

  • 98c8db5 Horizon shader packs: horizon-shaders.toml (schema 1) and the .hshader package

📊 Changes

16 files changed (+944 additions, -2 deletions)

View changed files

📝 AGENTS.md (+1 -0)
📝 Cargo.lock (+9 -0)
📝 Cargo.toml (+1 -1)
➕ crates/horizon-shader-api/Cargo.toml (+15 -0)
➕ crates/horizon-shader-api/src/lib.rs (+10 -0)
➕ crates/horizon-shader-api/src/manifest.rs (+365 -0)
➕ crates/horizon-shader-api/src/package.rs (+175 -0)
➕ crates/horizon-shader-api/tests/samples/schema-1/README.md (+1 -0)
➕ crates/horizon-shader-api/tests/samples/schema-1/common.wgsl (+3 -0)
➕ crates/horizon-shader-api/tests/samples/schema-1/horizon-shaders.toml (+59 -0)
➕ crates/horizon-shader-api/tests/samples/schema-1/material.wgsl (+3 -0)
➕ crates/horizon-shader-api/tests/samples/schema-1/post/grade.wgsl (+8 -0)
➕ crates/horizon-shader-api/tests/samples/schema-1/post/vignette.wgsl (+8 -0)
➕ crates/horizon-shader-api/tests/samples/schema-1/sky.wgsl (+3 -0)
➕ crates/horizon-shader-api/tests/schema.rs (+238 -0)
📝 docs/api/shaders.md (+45 -1)

📄 Description

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

What

The first part of Horizon's own shader API (docs/api/shaders.md): the pack format. A new crate, horizon-shader-api, reads and checks a pack so the game, the launcher and the registry judge it the same way.

  • horizon-shaders.toml, schema 1: id, name, version, the api line (0.1), description/authors/license, shared WGSL files, the stages ([sky], [material], [[post]], up to 8 post passes), [[options]] (bool, float, int, choice, each the WGSL override of the same name, with its type: bool/f32/i32/u32), and [budget] gpu_ms. Unknown keys, newer schemas and other API lines are refused with a clear message.
  • The package: a folder or a .hshader zip. Only the manifest, the WGSL it names (each used, UTF-8, 256 KiB at most), README/LICENSE/icon, plain paths, 8 MiB in all. Pack::package() builds the .hshader reproducibly (path order, fixed dates), so a pack's SHA-256 depends only on its files.
  • A sample with every key of schema 1 (crates/horizon-shader-api/tests/samples/schema-1/), read by the tests, as docs/api/stability.md asks of data formats.

Why

Ludovic (2026-10-25): "We need an API and an SDK for Horizon shaders, and they must be validated to appear in the Horizon browser." This is step 1 of that brief. Next PRs, stacked on this one: the stages (prelude generated from the Rust uniform structs, reference + drift test), then horizon-shader check (naga validation, signatures, options, budgets, hashes), then the game and the registry. Clean room: written from Horizon's renderer and WGSL only.

How tested

python3 tools/pr_ready.py --quick (Mac mini)
  Public tree: pass
  rustfmt: pass
  clippy (workspace, -D warnings): pass (3 min 20 s)
  tests: the workspace run was cut off by a 10 min limit on the busy machine; the only touched crate's tests:
cargo test -p horizon-shader-api: 5 passed (schema.rs: every key, smallest manifest, 15 refusals, folder = package round trip and reproducible bytes, file refusals)

Cargo.lock only gains the new package (no version changes). No harness covers this crate; nothing in the game uses it yet.

Needs Ludovic

Nothing. skip-release: players see no change yet.

🤖 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/1817 **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-format` --- ### 📝 Commits (1) - [`98c8db5`](https://github.com/horizon-rust/horizon/commit/98c8db50a35a0eb7e0409a5865e35e40edfce906) Horizon shader packs: horizon-shaders.toml (schema 1) and the .hshader package ### 📊 Changes **16 files changed** (+944 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+1 -0) 📝 `Cargo.lock` (+9 -0) 📝 `Cargo.toml` (+1 -1) ➕ `crates/horizon-shader-api/Cargo.toml` (+15 -0) ➕ `crates/horizon-shader-api/src/lib.rs` (+10 -0) ➕ `crates/horizon-shader-api/src/manifest.rs` (+365 -0) ➕ `crates/horizon-shader-api/src/package.rs` (+175 -0) ➕ `crates/horizon-shader-api/tests/samples/schema-1/README.md` (+1 -0) ➕ `crates/horizon-shader-api/tests/samples/schema-1/common.wgsl` (+3 -0) ➕ `crates/horizon-shader-api/tests/samples/schema-1/horizon-shaders.toml` (+59 -0) ➕ `crates/horizon-shader-api/tests/samples/schema-1/material.wgsl` (+3 -0) ➕ `crates/horizon-shader-api/tests/samples/schema-1/post/grade.wgsl` (+8 -0) ➕ `crates/horizon-shader-api/tests/samples/schema-1/post/vignette.wgsl` (+8 -0) ➕ `crates/horizon-shader-api/tests/samples/schema-1/sky.wgsl` (+3 -0) ➕ `crates/horizon-shader-api/tests/schema.rs` (+238 -0) 📝 `docs/api/shaders.md` (+45 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What The first part of Horizon's own shader API (docs/api/shaders.md): the pack format. A new crate, `horizon-shader-api`, reads and checks a pack so the game, the launcher and the registry judge it the same way. - `horizon-shaders.toml`, schema 1: `id`, `name`, `version`, the `api` line (`0.1`), `description`/`authors`/`license`, `shared` WGSL files, the stages (`[sky]`, `[material]`, `[[post]]`, up to 8 post passes), `[[options]]` (`bool`, `float`, `int`, `choice`, each the WGSL `override` of the same name, with its type: `bool`/`f32`/`i32`/`u32`), and `[budget] gpu_ms`. Unknown keys, newer schemas and other API lines are refused with a clear message. - The package: a folder or a `.hshader` zip. Only the manifest, the WGSL it names (each used, UTF-8, 256 KiB at most), README/LICENSE/icon, plain paths, 8 MiB in all. `Pack::package()` builds the `.hshader` reproducibly (path order, fixed dates), so a pack's SHA-256 depends only on its files. - A sample with every key of schema 1 (`crates/horizon-shader-api/tests/samples/schema-1/`), read by the tests, as docs/api/stability.md asks of data formats. ## Why Ludovic (2026-10-25): "We need an API and an SDK for Horizon shaders, and they must be validated to appear in the Horizon browser." This is step 1 of that brief. Next PRs, stacked on this one: the stages (prelude generated from the Rust uniform structs, reference + drift test), then `horizon-shader check` (naga validation, signatures, options, budgets, hashes), then the game and the registry. Clean room: written from Horizon's renderer and WGSL only. ## How tested ``` python3 tools/pr_ready.py --quick (Mac mini) Public tree: pass rustfmt: pass clippy (workspace, -D warnings): pass (3 min 20 s) tests: the workspace run was cut off by a 10 min limit on the busy machine; the only touched crate's tests: cargo test -p horizon-shader-api: 5 passed (schema.rs: every key, smallest manifest, 15 refusals, folder = package round trip and reproducible bytes, file refusals) ``` Cargo.lock only gains the new package (no version changes). No harness covers this crate; nothing in the game uses it yet. ## Needs Ludovic Nothing. `skip-release`: players see no change yet. 🤖 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:19 +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#3788
No description provided.