Hi, we have multiple GAS, some of them occasionally require a complete rebuild due to e.g. topological changes of the stored geometry, or strong deformations.
The documentation says the following about SBT-geometry-AS index that is assigned to the newly created GAS:
The way I understood that, is that each new accelerations structure (built with optixAccelBuild) is assigned a running SBT-geometry-AS index. Is that correct?
Meanwhile, the SBT that I have respects the order in which I built GAS. Which brings me to my next two questions:
Do I need to do something about the previous acceleration structure (that I am about to rebuild) referenced by the traversable handle in optixAccelBuild() optix_host.h File Reference, e.g. do I need to destroy it first?
Does the SBT geometry-AS index of the newly rebuilt GAS remain the same? If not, I assume I would have to update my SBT.
Note the SBT geometry-AS index is a value you get per build input, not per GAS. It starts at zero for the first build input to a GAS and depends only on the build inputs and number of SBT records per build input to a GAS.
When you rebuild a GAS, and you have an old one sitting around, it would be typical to destroy it. In practice that means reclaiming the memory for the GAS buffer. There is no API to inform OptiX that you’re finished with the old GAS, you just stop using the traversable handle. But you can use that memory to build a new GAS, or you can free the memory using your own memory pool or allocator if you have one, or via cudaFree(). (Recommended practice is to re-use the memory if you can, since freeing and allocating new memory using CUDA API calls can be performance limiting.)
Hopefully I’ve already clarified question 2. The new GAS will end up with the same set of SBT geometry-AS indices in it as long as you use the same build inputs in the same order, where for this purpose build inputs are considered “same” if they have the same number of SBT records. To control the SBT offsets for different GASes in an Instance AS (IAS), that’s where the SBT instance offset comes in.