Merge pull request #1861 from ludovic111/feat/native-shaders-post

🤖 Agent: native shader packs' post stage in the game with hot reload; pr_ready, 66 affected harnesses and a paired A/B (no cost without a pack) passed.
This commit is contained in:
Ludovic Marie
2026-10-26 06:45:33 +01:00
committed by GitHub
13 changed files with 723 additions and 21 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ One pixel of the picture, for `fn post(input: PostInput) -> vec4<f32>`.
| Field | Type | Meaning |
| --- | --- | --- |
| `uv` | `vec2<f32>` | Where the pixel is, 0..1 from the top left. |
| `pixel` | `vec2<f32>` | The pixel's centre, in pixels from the top left. |
| `pixel` | `vec2<f32>` | The pixel's centre, in pixels from the top left of what the pass draws (the world's size; the window's for the last pass). |
| `color` | `vec4<f32>` | The previous pass's colour here (the world's picture for the first pass). |
| `depth` | `f32` | The world's depth here, reversed: 0 is the sky. |
+1
View File
@@ -96,6 +96,7 @@ stages with options and hot reload, then the overlay, lighting, sky and shadow s
## Changelog
- 2026-10-26: the post stage in the game (`HORIZON_SHADER_PACK`, hot reload with the last good pack kept).
- 2026-10-25: `horizon-shader` (`new`, `check`, `pack`), three templates, the example pack and the guide.
- 2026-10-25: the check (naga validation, signatures, options, budgets, SPIR-V/Metal/HLSL translation).
- 2026-10-25: the stages of API 0.1 (sky, material, post), their inputs and the generated reference.
+13 -3
View File
@@ -13,7 +13,8 @@ Horizon's own format.
| Authoring tool | `horizon-shader` (same crate) | `new`, `check`, `pack` |
| Templates | `crates/horizon-shader-api/templates/` | post, sky, material |
| Example pack | `crates/horizon-shader-api/packs/golden_hour` | a warm sky and two post passes |
| In the game, the launcher, the registry | | not yet: the renderer hooks come next |
| In the game: the post stage | `HORIZON_SHADER_PACK=<name>` (for development, until the Shader Packs page) | post passes, hot reload |
| In the game: sky and material; the launcher and the registry | | not yet |
## Quick start
@@ -29,9 +30,9 @@ horizon-shader pack my_pack # check, then write my_pack-
```
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 Glow 192 expressions, 3 texture reads
post Colour grade 201 expressions, 2 texture reads
sha256 fd92a294...
sha256 b5e0d98c...
```
or every problem, at its file, line and column:
@@ -43,6 +44,15 @@ my_pack 0.1.0 (shader API 0.1): FAILED
`--json` prints the same for tools (`ok`, `id`, `version`, `api`, `sha256`, `stages`, `problems`).
## Trying a pack in the game
Until the Shader Packs page lists them, put the pack folder (or its `.hshader`) in `shaderpacks/` beside `options.txt`
and start the game with `HORIZON_SHADER_PACK=<its folder or file name>`. The game checks the pack first, and refuses
one that fails, with its problems in the chat. While it runs, the game looks at the pack twice a second: save a file
and the pack is checked and rebuilt in place ("Shader pack ... reloaded"); if the new version fails, the chat says
where and the last good version keeps drawing. The post passes run today; the sky and material stages are checked
but not drawn yet.
## A pack
A folder (or the same files zipped as a `.hshader`) with `horizon-shaders.toml` and WGSL files: