diff --git a/docs/shader-packs.md b/docs/shader-packs.md index 3cd068f2d..ecb71b5f6 100644 --- a/docs/shader-packs.md +++ b/docs/shader-packs.md @@ -16,7 +16,7 @@ Both are off by default. With no pack selected the renderer draws exactly what i | Horizon shader packs: `composite` stage, uniforms, hot reload, Shader Packs screen | first slice planned | | Horizon shader packs: `deferred`, `gbuffer`, `shadow` stages, custom textures | planned | | Java shader packs: preprocessing + GLSL parse coverage | spike done: 450 of 470 programs reach valid WGSL (below) | -| Java shader packs: preprocessor (`crates/horizon-shaderpack`: includes, options, Iris's macros) | done: every program of the three test packs preprocesses | +| Java shader packs: preprocessor (`crates/horizon-shaderpack`: includes, options, Iris's macros, JCPP's `#if` and `#define` rules) | done: every program of the three test packs preprocesses; ten packs tested (Compatibility, below) | | Java shader packs: GLSL → WGSL (`horizon_shaderpack::translate`: syntax-tree legaliser, naga) | done: the 464 programs the three test packs enable by default translate (below) | | Java shader packs: `shaders.properties` (`horizon_shaderpack::properties`: screens, sliders, profiles, `program.*.enabled`, image formats, blend modes) | done, no screen yet: read like Iris for the three test packs | | Java shader packs: full-screen pass plan (`horizon_shaderpack::pipeline`: `DRAWBUFFERS`/`RENDERTARGETS`, `colortexN` formats and clearing, buffer flips) | done: planned for the three test packs | @@ -378,6 +378,43 @@ shadows, water or sky look yet; Distant Horizons' and Voxy's depth read as far. compute (`.csh`; a pack that needs them doesn't load), mipmapped targets (`colortexNMipmapEnabled` is read but ignored), custom textures, the option screen; shadow matrices are identity. +### Compatibility + +Tested on 2026-10-22 on the Mac mini (M4 Pro, Metal) with each pack's default options, the 26.3 builds from Modrinth or +the authors' pages (dev-only test inputs, kept outside the repository). "Loads" means every pass the pack enables for +the overworld, Nether and End is preprocessed, translated and validated, as the game does when the pack is picked +(`java_pack::tests::real_packs_load` with `HORIZON_TEST_SHADERPACKS`); "drawn" means it was also picked in the game +and screenshotted. Only full-screen passes run (above), so no pack has its own terrain, water, shadows or sky yet. + +| Pack | Version | Result | First thing that stops it | +| --- | --- | --- | --- | +| BSL | v10.1.8 | drawn: 26 passes | | +| Complementary Reimagined | r5.9.3 | drawn: 27 passes | | +| Complementary Unbound | r5.8 | loads: 27 passes | | +| Sildur's Vibrant Extreme | 2.02 | drawn: 18 passes, only its sky (above) | | +| Steadfast | 0.8.0 | drawn: 3 passes | | +| Bliss | 2.1.2 | fails | `world0/deferred.vsh`: an operation naga forbids in a vertex shader | +| Bloop | 1.8.0-Alpha-3 | fails | `world0/prepare1.fsh`: `mat2(vec4)` and other constructors naga's GLSL front end refuses | +| Noble | v1.9.9 | fails (Apple and NVIDIA) | `world0/deferred4.vsh`: a `vec3[9][9]` varying (nested arrays between stages) | +| Photon | v1.4 | fails | `world0/prepare.vsh`: a struct varying (`CloudsParameters`) | +| Rethinking Voxels | r0.1-beta9 | fails | `world0/prepare.fsh`: `1 << 31` overflows naga's constant folding; it also needs images | + +What the translator does for these packs, as Iris (JCPP and its GLSL transformer) does: + +- **`#if` reads floats as JCPP does**: a float in a condition, written there or through a macro, counts as its + integer part, and an empty operand as 0. The same holds in `shaders.properties`, where Steadfast's + `#elif ATMOSPHERE_FOG_STRENGTH_NOON == 0.5` stopped the pack (`UnexpectedToken(Float(0.5))`). +- **A later `#define` replaces an earlier one** instead of failing (Bloop's `DefineRedefined`), and an unterminated + `#if` runs to the end of the file. +- **`shaders.properties`** keeps its empty lines and backslashes through the preprocessor, as Iris's does, so a + continued line doesn't swallow the next one. +- **16-bit and 8-bit types** (`float16_t`, `u16vec2`, `packFloat2x16`...), which Noble uses when the GPU reports + NVIDIA (`NV_gpu_shader5`), become their 32-bit types: WGSL has none. +- **What naga refuses**: `%` with a scalar and a vector operand goes through overloads, a `const` naga can't fold + (`mix`, `?:`, `smoothstep`) becomes a global set at the start of `main`, `sqrt` of a negative constant is + evaluated at run time, and a fragment output narrower than four channels (`out vec3`, Steadfast's `final`) is + written through a `vec4` with alpha 1 as OpenGL fills it. + ### Order to implement 1. **Translator crate** (`horizon-shaderpack`): the preprocessor (includes, option `#define`s with the player's