Java shader packs: Photon, Chocapic13' and MakeUp Ultra Fast load

The translator now legalises what these packs write and naga refuses:
lookups without a level outside fragment shaders become textureLod at
level 0; struct varyings travel as one varying per field; textureGather
is emulated with texelFetch; a bool given to a numeric constructor
becomes cond ? 1 : 0; `const in` parameters lose the const; array fields
of private structs get their natural stride (naga lays every struct out
as std140); modf into a vector component assigns it instead of passing a
pointer. shaders.properties keeps the empty lines the preprocessor
leaves, so Photon's `) \` before `#else` ends its value.

real_packs_load now also parses every translated program again as WGSL,
which is what wgpu is given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-22 20:24:55 +02:00
parent 95d0a06ba5
commit 60fc787288
5 changed files with 468 additions and 6 deletions
+13 -2
View File
@@ -397,10 +397,12 @@ and screenshotted. Only full-screen passes run (above), so no pack has its own t
| 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 |
| Chocapic13' | V9 High | drawn: 16 passes, its grade and fog over Horizon's world | |
| MakeUp Ultra Fast | 9.6 | drawn: 6 passes; its fog covers everything without its `gbuffers_*` | |
| Photon | v1.4 | loads: 27 passes; draws black: it lights the scene from the G-buffer its `gbuffers_*` write | |
| Bliss | 2.1.2 | fails | `world0/composite1.fsh`: a vector component passed to an `inout` parameter (WGSL can't point at one) |
| 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:
@@ -418,6 +420,15 @@ What the translator does for these packs, as Iris (JCPP and its GLSL transformer
(`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.
- **What GL takes and naga doesn't** (Photon, Chocapic13', MakeUp Ultra Fast, Bliss): `texture2D` and its kin without a
level outside fragment shaders sample level 0 (`textureLod`); a struct passed between stages travels as one varying
per field (matrices by column, arrays by element); `textureGather` reads the four texels with `texelFetch`; a
`bool` given to `vec3(..)` and other numeric constructors becomes `cond ? 1.0 : 0.0`; `const in` parameters lose
the `const`; an array field of a struct that never reaches a buffer gets its natural stride (naga lays every struct
out as std140, so `Spline(.., float[6](..))` didn't match); `modf` into a vector component assigns it instead of
passing a pointer.
- **Every translated program parses again as WGSL** in `real_packs_load`: wgpu is given the text, and naga's WGSL
writer can emit what its WGSL parser refuses (`&v.y`).
### Order to implement