NvBlastCreateAsset
Defined in lowlevel/NvBlast.h
-
NvBlastAsset *NvBlastCreateAsset(void *mem, const NvBlastAssetDesc *desc, void *scratch, NvBlastLog logFn)
Asset-building function.
Constructs an NvBlastAsset in-place at the address given by the user. The address must point to a block of memory of at least the size given by NvBlastGetAssetMemorySize(desc, logFn), and must be 16-byte aligned.
Support chunks (marked in the NvBlastChunkDesc struct) must provide full coverage over the asset. This means that from any leaf chunk to the root node, exactly one chunk must be support. If this condition is not met the function fails to create an asset.
Any bonds described by NvBlastBondDesc
descriptors that reference non-support chunks will be removed.
Duplicate bonds will be removed as well (bonds that are between the same chunk pairs).
Chunks in the asset should be arranged such that sibling chunks (chunks with the same parent) are contiguous. Chunks are also should be arranged such that leaf chunks (chunks with no children) are at the end of the chunk list. If chunks aren’t arranged properly the function fails to create an asset.
- Parameters
mem – [in] Pointer to block of memory of at least the size given by NvBlastGetAssetMemorySize(desc, logFn). Must be 16-byte aligned.
desc – [in] Asset descriptor (see NvBlastAssetDesc).
scratch – [in] User-supplied scratch memory of size NvBlastGetRequiredScratchForCreateAsset(desc) bytes.
logFn – [in] User-supplied message function (see NvBlastLog definition). May be NULL.
- Returns
pointer to new NvBlastAsset (will be the same address as mem), or NULL if unsuccessful.