while(true)
{
BuildInputsUpdate();
// Do I need to query memory size to check resizing before AS update?
// Or can I just allocate once out of the loop and use the same temporary buffer without worrying about resizing?
ASUpdate(buffer);
}
The OptixAccelBufferSizes structure contains three values for the optixAccelBuild parameters.
The tempUpdateSizeInBytes shouldn’t change across AS updates.
If you search the OptiX SDK examples for that field name, you’ll find that the optixDynamicGeometry example checks if the state.temp_buffer_size is big enough for an AS update operation only once at the end of the buildMeshAccel function and not inside updateMeshAccel.
You might want to rebuild your AS in regular intervals to regain performance if your geometry updates result in such overlapping AABBs. When the motion of the geometric primitives is more continuous than the example image at the bottom of that thread, like when doing morphing, you might need fewer or no rebuilds.