Hello,
the command “vkCmdBuildAccelerationStructureNV” does not seem to write to the result memory of a top-level acceleration structure if it has no instances. This is not noticable when you allocate new memory for the TLAS (as you usually do), since no intersections are reported as expected. However, if you first create and build a TLAS with some instances, then destroy it and reuse the result memory to create and build an empty TLAS, the old scene will be traced.
I’ve modified the example from https://developer.nvidia.com/rtx/raytracing/vkray to showcase this. The code can be found at https://www.dropbox.com/s/8dh9ec0dvcd7jgk/vkexamples_final.zip?dl=0.
In line 803 of the hello_vulkan.cpp file you can toggle the “freshMemory” flag to compare the results when allocating new memory vs when using the old memory for the empty TLAS.
Tested with an RTX 2080 Ti with drivers 436.48 and 441.12