Merge modeling/affine-as-built: the as-built map of the snoise tie fix and affine forms
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
d4e3b837f3
1 changed files with 123 additions and 0 deletions
|
|
@ -1496,3 +1496,126 @@ Fixture bytes:
|
|||
`snoise-tie` and starts from the merged tree, so its `af_*` families are
|
||||
appended after the tie families, and its device enclosure checks run on the
|
||||
fixed `cultmath_snoise_grad`. Nothing else in it changes.
|
||||
|
||||
## As built: the affine and tie cuts on main (Modeling, 2026-10-04)
|
||||
|
||||
Body map against CultLib `main` at `14568bf9`, after `48aadda0` (snoise tie)
|
||||
and `156782da` (affine forms, merged as `hands/cultmath-affine-forms`). It
|
||||
records what the Body is, not what Passes 5, 5b and 6 intended. Where it
|
||||
disagrees with those passes, this section wins; where it disagrees with the
|
||||
Body, the Body wins. Cut reports live in the eureka-state mind under
|
||||
`cultmath-tapes`: `cut-snoise-tie.h2`, `cut-affine-forms.h1-h3`,
|
||||
`cut-affine-shaders.h1-h3`.
|
||||
|
||||
### Pieces and owners
|
||||
|
||||
Paths are under `packages/cultmath/`.
|
||||
|
||||
| Piece | Path | Owner | Role |
|
||||
| --- | --- | --- | --- |
|
||||
| Snoise kernel | `src/CultMath/math.cs` (`snoise`, `snoise_grad`) | library, C# | Ties in `x0` break in Gustavson order (x over y, y over z, x over z), a total order. Mirrored in `shaders/CultMath.hlsl` and the Unity copy. |
|
||||
| Lipschitz constant | `math.Interval.cs` `SNOISE_LIPSCHITZ = 7.9640074f`; `CultMath.Interval.hlsl`; generated GLSL | library | Derived from the kernel by `NoiseBoundTests.MeasureLipschitz` (seed 0x11B5): refined 7.2400064 x 1.10. A kernel change re-pins it. |
|
||||
| Hessian constant | `math.Affine.cs` `SNOISE_HESSIAN = 56.050385f` | library | Unchanged by the tie cut. Provenance in `design.md` "Affine forms". |
|
||||
| Affine ops | `math.Affine.cs`: `af_point`, `af_symbol`, `af_from_iv`, `af_range`, `af_add`, `af_sub`, `af_neg`, `af_scale`, `af_add_iv`, `af_mul`, `af_snoise`, `af_fbm`, `af_frustum_axis`, `af_frustum_ball`; plus 2D `iv_snoise_ball(float2, float)` in `math.Interval.cs` | library, C# | Plain value functions over `float3` (centre, coefficient of the one shared symbol, radius of the independent remainder). No struct state, no `Expr` coupling. |
|
||||
| Affine HLSL | `shaders/CultMath.Affine.hlsl`, byte-identical `unity/org.gamecult.cultmath/Shaders/CultMath.Affine.hlsl` | library | `cultmath_`-prefixed bit-for-bit mirror of `math.Affine.cs`. |
|
||||
| GLSL | `shaders/CultMath.glsl` (and `CultMath.Phacelle.glsl`) | derived | Generated by `GlslLowering` (test project) from the HLSL files. |
|
||||
| Fixture | `tests/CultMath.Tests/fixtures/glsl-parity.json` | derived | Generated by `GlslMirrorTests.GoldenFixtureMatchesCSharp`. Families: the earlier ones, the tie families (after `phacelle`), `iv_snoise_ball` for vec3 and vec2, every `af_*`, and small-reach `af_snoise` and `af_fbm` families that exercise the centred branch. |
|
||||
| Test harness | `tests/CultMath.Tests/AffineTests.cs`, `NoiseBoundTests.cs`, `GlslMirrorTests.cs`, `HlslMirrorTests.cs`, `NoiseGradTests.cs` | test project | `FogField` (with `DeepWell`, `Wells`, `InsideFog`, `AetheriaWarp`), `NoiseArg`, `AffineSlice`, `BoundMode` and the gates live here, not in the library. They stand in for the site ground and Aetheria. |
|
||||
| Explicit measurements | `NoiseBoundTests` `[Fact(Explicit = true)]` facts: the (c) rows and `DeepWellCullMap` (PNG into the directory named by `CULTMATH_WRITE_CULLMAP`) | test project | Printed measurements, not state. Their numbers are copied into `design.md` by hand. |
|
||||
|
||||
### Inputs and outputs
|
||||
|
||||
- `af_snoise(centre, axis, radius)` takes the noise argument as a centre, the
|
||||
direction of the one shared symbol and a ball radius. It reads `snoise_grad`
|
||||
(`.w` equals `snoise` bitwise), `SNOISE_LIPSCHITZ` and `SNOISE_HESSIAN`, and
|
||||
returns a `float3` form: the Lipschitz form or the centred Taylor form,
|
||||
whichever is narrower (`design.md` "Affine forms"). `af_fbm` composes it per
|
||||
octave. `af_range` turns a form into a `float2` interval and finds a NaN
|
||||
endpoint by bit pattern, because dxc's fast-math compare folds `x != x`.
|
||||
- `af_frustum_axis` and `af_frustum_ball` build the symbol and ball for a tile
|
||||
slice of the view frustum. A consumer rotates and translates the centre into
|
||||
world space and scales by its frequencies.
|
||||
- Interval consumers keep `iv_*`; the two representations meet at `af_from_iv`
|
||||
and `af_range`.
|
||||
|
||||
### Derived state and forbidden writers
|
||||
|
||||
- `CultMath.glsl`, `CultMath.Phacelle.glsl` and `glsl-parity.json` are never
|
||||
hand-edited. The only writer is `CULTMATH_WRITE_GLSL=1 dotnet test --filter
|
||||
GlslMirrorTests` from `packages/cultmath/tests/CultMath.Tests`. The tests
|
||||
compare committed text with the lowering and committed families with C#'s
|
||||
current output, so a hand edit fails them.
|
||||
- `unity/.../Shaders/CultMath*.hlsl` is a copy.
|
||||
`HlslMirrorTests.UnityPackageShaderIsIdenticalToTheCanonicalShader` pins byte
|
||||
identity per file (`Interval` and `Affine` among them). Edit `shaders/` only.
|
||||
- `SNOISE_LIPSCHITZ` is written in three places (C#, Interval HLSL, generated
|
||||
GLSL) and re-pinned only by running `MeasureLipschitz`. `SNOISE_HESSIAN` has
|
||||
one definition in C# and one in `CultMath.Affine.hlsl`.
|
||||
- Forbidden: a consumer linearising noise itself, a second curvature constant,
|
||||
an evaluator over `CultMath.Expr`, a flow or envelope function in CultMath.
|
||||
- Shared paths a cut touches: the include list in `CultMath.hlsl`,
|
||||
`HlslMirrorTests` InlineData, `scripts/build-unity-package.ps1`'s file list,
|
||||
and the fixture's family list. A cut that adds families appends after the
|
||||
previous cut's and regenerates.
|
||||
|
||||
### The mirror chain
|
||||
|
||||
C# (`math.cs`, `math.Interval.cs`, `math.Affine.cs`) -> HLSL (`shaders/`, Unity
|
||||
copy byte-identical) -> GLSL ES 3.00 (generated by `GlslLowering`) -> fixture
|
||||
(generated from C#). A change starts in C#; the HLSL follows bit for bit; the
|
||||
GLSL and fixture are regenerated. `HlslMirrorTests` sweeps C# against the HLSL
|
||||
semantics on the CPU, including `af_snoise`'s centred branch on both sides of
|
||||
the choice. The tie fix landed in C#, `CultMath.hlsl`, the Unity copy and the
|
||||
regenerated GLSL in one merge.
|
||||
|
||||
### Verification layer
|
||||
|
||||
- Yggdrasil (CPU, through the stopgap): `dotnet test` of `CultMath.Tests`
|
||||
(mirror, GLSL golden-fixture comparison, `AffineTests`, the `NoiseBoundTests`
|
||||
gates, `NoiseGradTests.SnoiseIsContinuousOnTheSimplexDiagonal`), Stryker
|
||||
scoped to `math.Affine.cs`, and the explicit (c) and deep-well re-measures.
|
||||
- Starfire (Windows and GPU, one job at a time): `tools/compile-glsl.ps1`
|
||||
(glslangValidator), the dxc `lib_6_3 -HV 2021` compile of the HLSL, and the
|
||||
WebGL2 golden-fixture run on the GTX 1070 under ANGLE D3D11. The device run
|
||||
checks `af_snoise`, `af_fbm` and `af_frustum_ball` for enclosure against the
|
||||
device's own noise (`design.md`, GLSL target). The device runner is not in the
|
||||
repository. Follow-up `affine-device-runner-seed` carries it; until it lands
|
||||
the device leg is a Starfire-local procedure, not a repeatable test, and
|
||||
`glsl-browser-parity-run` stays open.
|
||||
|
||||
### Release state
|
||||
|
||||
- `unity/org.gamecult.cultmath/package.json` is 0.3.0 and `CHANGELOG.md` has no
|
||||
unreleased section. The snoise value change on the tie set (the origin and
|
||||
every `(t, t, t)`) is Breaking by the `qn1-snoise-upstream` precedent, so the
|
||||
next release is 0.4.0. Follow-up `snoise-tie-release` carries the version
|
||||
bump, the changelog entry (Breaking: snoise; Added: `iv_*`, `af_*`, the two
|
||||
HLSL files and the GLSL library) and Aetheria's pin bump.
|
||||
- Aetheria pins 0.2.4 (the 0.6 kernel with the cyclic `step`). gamecult-site
|
||||
vendors no CultMath GLSL yet.
|
||||
- `SNOISE_LIPSCHITZ` and the intervals were never released, so re-pinning `L`
|
||||
is not itself a release event.
|
||||
|
||||
### Stale docs and state found (not edited)
|
||||
|
||||
- This file's header status line says "pass 4" and pins `c49c76ee`; Pass 5's
|
||||
pin is `a7966142`. Neither is the as-built head.
|
||||
- The (d) row near line 529 ("ceiling at `L = 10.099261`") and Pass 5's "`L =
|
||||
10.10`" (near line 1037) are measurements at the old `L`, now 7.9640074. Pass 6
|
||||
says they are conservative; the numbers are not re-printed.
|
||||
- Pass 5 "Cut order" reads as future work and Pass 6 "Merge order" lists the
|
||||
merge as pending. Both merged. Pass 5's deletion line cites
|
||||
`NoiseBoundTests.cs` line numbers that have moved.
|
||||
- `docs/cultmath-tape-target.md`: the header "Status: **parked**" (line 3) and
|
||||
"The operator parked (c)" (line 54) say nothing of affine; only the "Open
|
||||
before unparking" item (lines 109-112) records that affine forms were
|
||||
unparked, and nothing records them as built. The interval-or-affine
|
||||
representation question is closed: both exist. Tape steps 2-5 remain parked.
|
||||
- `docs/cultmath-interval-ground-cut-interval-ops*.spec.json` (r1-r3) pin
|
||||
`SNOISE_LIPSCHITZ` "untouched" and cite 10.099261 as provenance. They are spec
|
||||
history, superseded by the constant in `math.Interval.cs`.
|
||||
- `unity/org.gamecult.cultmath/CHANGELOG.md` has no entry for the tie change,
|
||||
intervals or affine forms.
|
||||
- The `0.77` in `packages/cultmath/docs/design.md:376` and `NoiseGradTests.cs:195`
|
||||
is the upstream tie jump and is accurate; it is a different 0.77 from the
|
||||
range-ceiling ratio at line 1347 of this file.
|
||||
|
|
|
|||
Loading…
Reference in a new issue