copyAndCompact(sourceAccelerationStructure:destinationAccelerationStructure:)
Encodes a command to copy and compact an acceleration structure.
Declaration
func copyAndCompact(sourceAccelerationStructure: any MTLAccelerationStructure, destinationAccelerationStructure: any MTLAccelerationStructure)Parameters
- sourceAccelerationStructure:
Acceleration structure to copy and compact.
- destinationAccelerationStructure:
Acceleration structure to copy to.
Discussion
You are responsible for ensuring that the source and destination acceleration structures don’t overlap in memory. If this is an instance acceleration structure, Metal preserves references to primitive acceleration structures it references.
This operation requires that the destination acceleration structure is at least as large as the compacted size of the source acceleration structure. You can compute this size by calling the writeCompactedSize(sourceAccelerationStructure:destinationBuffer:) method.