star-line

Structure for accelerating line importance sampling
git clone git://git.meso-star.fr/star-line.git
Log | Files | Refs | README | LICENSE

commit 132c1678ad05eb3fd56b3c78fba680eeff4441f4
parent 7944989505339864ca222f218ffb2c1e07cffab3
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 15 Apr 2026 12:13:31 +0200

A quick update to the polyline construction procedure

Ensure that child nodes are processed recursively in order, that is, in
the order in which they are stored in memory. This change should have
only a (minimal) impact on memory accesses. The resulting trees should
be identical to the previous ones.

Diffstat:
Msrc/sln_tree_build.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sln_tree_build.c b/src/sln_tree_build.c @@ -574,7 +574,7 @@ build_polylines(struct sln_tree* tree) stack[istack++] = inode; /* Push the current node */ /* Push the children except the 1st one */ - FOR_EACH(i, 1, nchildren) { + FOR_EACH_REVERSE(i, nchildren-1, 0) { const size_t ichild = inode + NODE(inode)->offset + i; ASSERT(NODE(ichild)->nvertices == 0); stack[istack++] = ichild; @@ -731,7 +731,7 @@ partition_lines(struct sln_tree* tree) inode = ichildren; /* Make the first child the current node */ ASSERT(istack < STACK_SIZE - 1/*1st child*/); - FOR_EACH(i, 1, nchildren) { + FOR_EACH_REVERSE(i, nchildren-1, 0) { stack[istack++] = ichildren + i; /* Push the other children */ } }