Fixed child offset computation in nanovdb::tools::cuda::indexToGrid #2013
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ran into a problem when using
nanovdb::tools::cuda::indexToGrid<nanovdb::Vec3f>
to build a grid ofVec3fs
from an index grid. After debugging for a while I managed to find a fix that works for me. I believe the computation fordstTile.child
inprocessRootTilesKernel
is not correct for all types. It seems to work for float and double grids, but not for Vec3f and probably many (or all?) other types that do not align with the size of the index type. My fix is inspired by the code inprocessNodesKernel
that also computes similar byte offsets.I extended the unit test
CudaIndexGridToGrid_ValueOnIndex
to show the problem. It only passes with my fix and not the original code. Feedback is highly appreciated!