From b6f61ea8c40c8b525832e80d29ac1349d5bdaa11 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 17 Oct 2026 16:50:15 +0200 Subject: [PATCH] CultMath.hlsl: the capacity note names no resource type Co-Authored-By: Claude Sonnet 5.5 --- packages/cultmath/docs/design.md | 4 ++-- packages/cultmath/shaders/CultMath.hlsl | 2 +- .../unity/org.gamecult.cultmath/Shaders/CultMath.hlsl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cultmath/docs/design.md b/packages/cultmath/docs/design.md index 4e55dae4..62c6ed00 100644 --- a/packages/cultmath/docs/design.md +++ b/packages/cultmath/docs/design.md @@ -572,8 +572,8 @@ A shader function cannot take a span, so `cultmath_power_border(p, sites, count) and `cultmath_weighted_lattice_cells(p, time, bodies, count, ...)` take `float4 sites[CULTMATH_MAX_SITES]` by value and the count in use, with `count` in `[0, CULTMATH_MAX_SITES]`. `CULTMATH_MAX_SITES` is 128 unless the consumer defines it before including the library (`#ifndef`): 128 covers every Aetheria zone within GLSL ES 3.00's 224 guaranteed fragment uniform -vectors, and loops run to `count`, so the capacity costs uniform space, not iterations. A `StructuredBuffer` caller copies -into a local array first; the library takes no resource, accessor macro or uniform of its own. The preconditions the C# +vectors, and loops run to `count`, so the capacity costs uniform space, not iterations. A caller whose sites live in a +buffer copies them into a local array first; the library takes no resource, accessor macro or uniform of its own. The preconditions the C# functions throw for are the caller's in a shader (finite arguments, `cellSize > 0`, the stated ranges, `p` within 2^23 cells). The ring pass is bounded `k <= 37` and exits as C# does; the box pass recomputes each distance instead of caching 75 x 75 of them, which gives the same values. The C# mirror compiles the array as `T[]`, and diff --git a/packages/cultmath/shaders/CultMath.hlsl b/packages/cultmath/shaders/CultMath.hlsl index 9c1b3307..d3eea396 100644 --- a/packages/cultmath/shaders/CultMath.hlsl +++ b/packages/cultmath/shaders/CultMath.hlsl @@ -721,7 +721,7 @@ float cultmath_lattice_smooth_step(float m, float d, float f1, float smoothing) // Sites by value: a shader function cannot take a span, so these take float4 sites[CULTMATH_MAX_SITES] and the count in use, with // count in [0, CULTMATH_MAX_SITES]. A consumer defines CULTMATH_MAX_SITES before including this file to change the capacity; loops -// run to count, so the capacity costs uniform space, not iterations. A StructuredBuffer caller copies into a local array first. +// run to count, so the capacity costs uniform space, not iterations. A caller whose sites live in a buffer copies them into a local array first. // The preconditions the C# functions throw for are the caller's in a shader: finite arguments, cellSize > 0, boost in [0, 4], // falloff > 0, smoothing in (0, 1], stretch in [1, 2], p within 2^23 cells. A zero stretchNormal means (1, 0) and needs stretch == 1. // cultmath_weighted_lattice_cells is math.weighted_lattice_cells: the ring pass is bounded by k <= 37 and exits as C# does, and the diff --git a/packages/cultmath/unity/org.gamecult.cultmath/Shaders/CultMath.hlsl b/packages/cultmath/unity/org.gamecult.cultmath/Shaders/CultMath.hlsl index 9c1b3307..d3eea396 100644 --- a/packages/cultmath/unity/org.gamecult.cultmath/Shaders/CultMath.hlsl +++ b/packages/cultmath/unity/org.gamecult.cultmath/Shaders/CultMath.hlsl @@ -721,7 +721,7 @@ float cultmath_lattice_smooth_step(float m, float d, float f1, float smoothing) // Sites by value: a shader function cannot take a span, so these take float4 sites[CULTMATH_MAX_SITES] and the count in use, with // count in [0, CULTMATH_MAX_SITES]. A consumer defines CULTMATH_MAX_SITES before including this file to change the capacity; loops -// run to count, so the capacity costs uniform space, not iterations. A StructuredBuffer caller copies into a local array first. +// run to count, so the capacity costs uniform space, not iterations. A caller whose sites live in a buffer copies them into a local array first. // The preconditions the C# functions throw for are the caller's in a shader: finite arguments, cellSize > 0, boost in [0, 4], // falloff > 0, smoothing in (0, 1], stretch in [1, 2], p within 2^23 cells. A zero stretchNormal means (1, 0) and needs stretch == 1. // cultmath_weighted_lattice_cells is math.weighted_lattice_cells: the ring pass is bounded by k <= 37 and exits as C# does, and the