Compare mirror results by bit pattern and say what that proves
SequenceEqual on floats treats -0 as 0. The mirror test now compares SingleToInt32Bits, with any NaN equal to any NaN. Its summary and design.md now say the test proves CultMath.hlsl's text computes the same float32 results as C# math on the CPU, not that a GPU agrees: driver sin precision alone makes cultmath_hash and value noise differ on hardware. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
9407da0461
commit
08e213dd7c
2 changed files with 13 additions and 5 deletions
|
|
@ -85,6 +85,11 @@ The HLSL side is checked too: `tools/get-dxc.ps1` fetches Microsoft's
|
|||
DirectXShaderCompiler, and
|
||||
`dxc -T lib_6_3 -HV 2021 shaders/CultMath.hlsl` must compile cleanly.
|
||||
|
||||
The mirror test compares bit patterns (any NaN equals any NaN; -0 differs from
|
||||
0). It proves the text of `CultMath.hlsl` computes the same float32 results as
|
||||
C# `math` on the CPU, not that a GPU agrees: driver `sin` precision alone makes
|
||||
`cultmath_hash` and value noise differ bit for bit on hardware.
|
||||
|
||||
Where HLSL is silent, CultMath keeps its own decisions and does not defer to
|
||||
Unity.Mathematics: `normalize` is safe (divides by `max(length, 1e-20)`),
|
||||
`hash` returns float, and `Random` is CultMath's own xorshift32. Engine-shaped
|
||||
|
|
|
|||
Loading…
Reference in a new issue