Multiplier packing (nodeId, elementId) into one numeric vote key.
Two conditions must hold simultaneously, and 2^27 is the value that
satisfies both with room to spare:
Alias-free — the stride must exceed every reachable elementId,
or (node n, element stride) collides with (node n+1, element 0)
and two different elements merge their brightness votes. The largest
reachable index is a node at max capacity, which is
getMaxElementCapacityPerNode = width x maxTextureSize / texelsPerElement: 44,728,319 for points on a 32768-texel device.
2^27 = 134,217,728 clears that ~3x over, so even a future
maxTextureSize of 65536 (~89M) still fits.
Exactly representable — nodeId * stride + elementId must stay
under 2^53 or adjacent keys round onto each other. nodeId is bounded
by MAX_PICK_NODE_ID (2^24 - 1, enforced at allocation), so the
worst case is (2^24 - 1) * 2^27 + 44,728,319 ~ 2.25e15, comfortably
inside 9.007e15.
A stride of 2^32 would satisfy (1) but violate (2) past nodeId 2^21 —
an unenforced bound is not a bound, hence 2^27. The headroom test in
pick-render.test.ts pins both conditions against the live layout
maxima, so a capacity increase that outgrows this stride fails there
rather than silently merging votes.
Multiplier packing
(nodeId, elementId)into one numeric vote key.Two conditions must hold simultaneously, and 2^27 is the value that satisfies both with room to spare:
elementId, or(node n, element stride)collides with(node n+1, element 0)and two different elements merge their brightness votes. The largest reachable index is a node at max capacity, which isgetMaxElementCapacityPerNode=width x maxTextureSize / texelsPerElement: 44,728,319 for points on a 32768-texel device. 2^27 = 134,217,728 clears that ~3x over, so even a futuremaxTextureSizeof 65536 (~89M) still fits.nodeId * stride + elementIdmust stay under 2^53 or adjacent keys round onto each other.nodeIdis bounded by MAX_PICK_NODE_ID (2^24 - 1, enforced at allocation), so the worst case is(2^24 - 1) * 2^27 + 44,728,319~ 2.25e15, comfortably inside 9.007e15.A stride of 2^32 would satisfy (1) but violate (2) past
nodeId2^21 — an unenforced bound is not a bound, hence 2^27. The headroom test inpick-render.test.tspins both conditions against the live layout maxima, so a capacity increase that outgrows this stride fails there rather than silently merging votes.