CultMath's hash is the shader-style frac(sin(x) * 43758.5453) and returns float. Unity.Mathematics' hash returned a well-mixed uint, and seeding from the float hash collapses: a 100x100 position grid gave 1625 distinct values in Aetheria's zone generator. - math.pcg(uint), pcg3d(int3/float2/float3), and pcg4d(int4/float4) follow Jarzynski and Olano, "Hash Functions for GPU Rendering" (JCGT 9(3), 2020). pcg3d and pcg4d are the paper's code from page 32. pcg is O'Neill's RXS-M-XS 32/32 output over one LCG step, with the constants checked against pcg-c's pcg_variants.h. - CultMath has no uint vectors, so pcg3d and pcg4d carry uint bit patterns in int3/int4. The float overloads hash IEEE-754 bits via the HLSL intrinsic asuint(float), which is new. pcg3d(float2) holds z at 0, the paper's route for 2 -> N inputs. - The HLSL mirror gains the same functions, written over scalar uints so the text compiles both in dxc 1.9.0.5402 (lib_6_3, HV 2021, clean) and in C#. HlslSourceCompatibilityTests now compares int and uint arguments and results by value; a wrong shift in the mirror's pcg4d gives 208 mismatches. - Known-answer vectors come from an independent Python transcription. pcg3d separates a 100x100 half-unit grid (the full int3). One component alone has one birthday collision there, as a 32-bit value can. The same grid on the integer lattice has none. - design.md states that the hashes are integer-exact in HLSL and on the CPU: dxc wraps uint multiply and add modulo 2^32, as C# unchecked does. - Bump to 0.2.3 and rebuild the tracked Unity DLL and pdb. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
17 lines
371 B
JSON
17 lines
371 B
JSON
{
|
|
"name": "org.gamecult.cultmath",
|
|
"displayName": "CultMath",
|
|
"version": "0.2.3",
|
|
"unity": "2021.3",
|
|
"description": "Precompiled CultMath numeric primitives and matching HLSL semantics for GameCult Unity runtimes.",
|
|
"license": "MPL-2.0",
|
|
"author": {
|
|
"name": "GameCult"
|
|
},
|
|
"keywords": [
|
|
"GameCult",
|
|
"Math",
|
|
"HLSL",
|
|
"Simulation"
|
|
]
|
|
}
|