NvBlastBuildAssetDescChunkReorderMap

Defined in lowlevel/NvBlast.h

bool NvBlastBuildAssetDescChunkReorderMap(uint32_t *chunkReorderMap, const NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, void *scratch, NvBlastLog logFn)

Build chunk reorder map.

NvBlastCreateAsset function requires NvBlastChunkDesc array to be in correct oder:

  1. Root chunks (chunks with invalid parent index) must be first in the asset’s chunk list.

  2. Chunks in the asset must be arranged such that sibling chunks (chunks with the same parent) are contiguous.

  3. Chunks must be arranged such that upper-support chunks (support chunks and their parent chunks) go first in chunk list.

This function builds chunk reorder map which can be used to order chunk descs. Reordering chunk’s descriptors according to generated map places them in correct order for NvBlastCreateAsset to succeed.

Iff chunks are already ordered correctly, function returns ‘true’ and identity chunk reorder map. Otherwise ‘false’ is returned.

Parameters
  • chunkReorderMap[out] User-supplied map of size chunkCount to fill. For every chunk index this array will contain new chunk position (index).

  • chunkDescs[in] Array of chunk descriptors of size chunkCount.

  • chunkCount[in] The number of chunk descriptors.

  • scratch[in] User-supplied scratch storage, must point to 3 * chunkCount * sizeof(uint32_t) valid bytes of memory.

  • logFn[in] User-supplied message function (see NvBlastLog definition). May be NULL.

Returns

true iff the chunks did not require reordering (chunkReorderMap is the identity map).