I have a BVH tree with nodes pointing to their children using a pointer. I perform ray tracing on this tree on CPU. I wish to now perform ray tracing on GPU and my question is how to go about moving this tree to GPU memory.
The approach I came across is that first I copy the tree into a contiguous memory, and for child nodes, instead of pointers (which won't work in GPU), have them stored as indices in the array. Then move this continuous chunk of memory to the GPU memory.
Is there a better way to do this ?