copyAndCompact(sourceAccelerationStructure:destinationAccelerationStructure:)
Encodes a command to compact an acceleration structure’s data and copy it into a different acceleration structure.
Declaration
func copyAndCompact(sourceAccelerationStructure: any MTLAccelerationStructure, destinationAccelerationStructure: any MTLAccelerationStructure)Parameters
- sourceAccelerationStructure:
The source acceleration structure.
- destinationAccelerationStructure:
The destination acceleration structure.
Discussion
The source and destination acceleration structures can’t overlap in memory. The destination acceleration structure needs to be at least as large as the compact size of the source acceleration structure, which you obtain by using the writeCompactedSize(accelerationStructure:buffer:offset:) method.
If the source acceleration structure contains references to other acceleration structures, the copy of the acceleration structure refers to the same child structures.