Add Rust-backed Voronoi batch kernel
This commit is contained in:
parent
5cef6d951e
commit
bfe356fe92
11 changed files with 461 additions and 16 deletions
32
README.md
32
README.md
|
|
@ -1,11 +1,12 @@
|
|||
# CultMath
|
||||
|
||||
Clean-room C# math shaped for people who think in HLSL.
|
||||
Clean-room math shaped for people who think in HLSL.
|
||||
|
||||
CultMath provides lowercase vector types and shader-style intrinsics so
|
||||
math-heavy renderer code can move between C# and HLSL without turning every
|
||||
line into a translation exercise. It is not a Unity.Mathematics clone. It is a
|
||||
small, Aquarium-born library built from public shader semantics and plain .NET.
|
||||
CultMath provides lowercase vector types, shader-style intrinsics, and native
|
||||
hot-path kernels so math-heavy renderer code can move between C#, Rust, and HLSL
|
||||
without turning every line into a translation exercise. It is not a
|
||||
Unity.Mathematics clone. It is a small, Aquarium-born library built from public
|
||||
shader semantics.
|
||||
|
||||
## Current Surface
|
||||
|
||||
|
|
@ -17,6 +18,17 @@ small, Aquarium-born library built from public shader semantics and plain .NET.
|
|||
- `math` intrinsics: `radians`, `degrees`, `abs`, `floor`, `ceil`, `frac`,
|
||||
`min`, `max`, `clamp`, `saturate`, `lerp`, `step`, `smoothstep`, `dot`,
|
||||
`cross`, `length`, `distance`, `normalize`, and `reflect`
|
||||
- `Voronoi.SampleTones`, a C# batch surface that calls the Rust
|
||||
`cultmath-core` native kernel when `cultmath_core` is available and falls back
|
||||
to the managed parity path otherwise.
|
||||
|
||||
## Native Core
|
||||
|
||||
The canonical hot-path body lives in `native/cultmath-core`. It exports a C ABI
|
||||
for batch kernels such as `cultmath_apollonian_voronoi_tones`.
|
||||
|
||||
Runtime wrappers own syntax and integration. Rust owns optimized primitive
|
||||
kernel behavior and parity fixtures.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
@ -33,11 +45,13 @@ float glow = math.smoothstep(0.2f, 1.0f, rim);
|
|||
```powershell
|
||||
dotnet build CultMath.slnx
|
||||
dotnet test CultMath.slnx
|
||||
cargo test --manifest-path native/cultmath-core/Cargo.toml
|
||||
cargo build --release --manifest-path native/cultmath-core/Cargo.toml
|
||||
```
|
||||
|
||||
## Doctrine
|
||||
|
||||
The goal is mechanical sympathy between CPU-side authoring and GPU-side shader
|
||||
math. If an intrinsic exists here, it should behave like the shader concept
|
||||
unless .NET numeric rules make that impossible. Weird deviations get tests and
|
||||
documentation, not folklore.
|
||||
The goal is mechanical sympathy between CPU-side authoring, native kernels, and
|
||||
GPU-side shader math. If an intrinsic exists here, it should behave like the
|
||||
shader concept unless a runtime's numeric rules make that impossible. Weird
|
||||
deviations get tests and documentation, not folklore.
|
||||
|
|
|
|||
Reference in a new issue