Nv::Blast::Asset Class Reference

#include <NvBlastAsset.h>

Inheritance diagram for Nv::Blast::Asset:

NvBlastAsset

List of all members.

Classes

struct  ChunkAnnotation
class  DepthFirstIt

Public Member Functions

uint32_t getBondCount () const
uint32_t getContiguousLowerSupportIndex (uint32_t chunkIndex) const
uint32_t getHierarchyCount () const
uint32_t getLowerSupportChunkCount () const
uint32_t getUpperSupportChunkCount () const
 NvBlastBlockArrayData (uint32_t, m_chunkToGraphNodeMapOffset, getChunkToGraphNodeMap, m_chunkCount)
 NvBlastBlockArrayData (uint32_t, m_subtreeLeafChunkCountsOffset, getSubtreeLeafChunkCounts, m_chunkCount)
 NvBlastBlockArrayData (NvBlastBond, m_bondsOffset, getBonds, m_bondCount)
 NvBlastBlockArrayData (NvBlastChunk, m_chunksOffset, getChunks, m_chunkCount)

Static Public Member Functions

static Assetcreate (void *mem, const NvBlastAssetDesc *desc, void *scratch, NvBlastLog logFn)
static size_t createRequiredScratch (const NvBlastAssetDesc *desc)
static bool ensureExactSupportCoverage (uint32_t &supportChunkCount, uint32_t &leafChunkCount, char *chunkAnnotation, uint32_t chunkCount, NvBlastChunkDesc *chunkDescs, bool testOnly, NvBlastLog logFn)
static size_t getMemorySize (const NvBlastAssetDesc *desc)
static bool testForValidChunkOrder (uint32_t chunkCount, const NvBlastChunkDesc *chunkDescs, const char *chunkAnnotation, void *scratch)

Public Attributes

uint32_t m_bondCount
uint32_t m_chunkCount
uint32_t m_firstSubsupportChunkIndex
SupportGraph m_graph
NvBlastDataBlock m_header
NvBlastID m_ID
uint32_t m_leafChunkCount


Member Function Documentation

static Asset* Nv::Blast::Asset::create ( void *  mem,
const NvBlastAssetDesc desc,
void *  scratch,
NvBlastLog  logFn 
) [static]

Create an asset from a descriptor.

Parameters:
[in] mem Pointer to block of memory of at least the size given by getMemorySize(desc). Must be 16-byte aligned.
[in] desc Asset descriptor (see NvBlastAssetDesc).
[in] scratch User-supplied scratch memory of size createRequiredScratch(desc) bytes.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
the pointer to the new asset, or nullptr if unsuccessful.

static size_t Nv::Blast::Asset::createRequiredScratch ( const NvBlastAssetDesc desc  )  [static]

Returns the size of the scratch space (in bytes) required to be passed into the create function, based upon the input descriptor that will be passed to the create function.

Parameters:
[in] desc The descriptor that will be passed to the create function.
Returns:
the number of bytes required.

static bool Nv::Blast::Asset::ensureExactSupportCoverage ( uint32_t &  supportChunkCount,
uint32_t &  leafChunkCount,
char *  chunkAnnotation,
uint32_t  chunkCount,
NvBlastChunkDesc chunkDescs,
bool  testOnly,
NvBlastLog  logFn 
) [static]

Function to ensure support coverage of chunks.

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 actual support chunks will be adjusted accordingly.

Chunk order depends on support coverage, so this function should be called before chunk reordering.

Parameters:
[out] supportChunkCount The number of support chunks. NOTE - this value is not meaninful if testOnly = true and the return value is false.
[out] leafChunkCount The number of leaf chunks. NOTE - this value is not meaninful if testOnly = true and the return value is false.
[out] chunkAnnotation User-supplied char array of size chunkCount. NOTE - these values are not meaninful if testOnly = true and the return value is false.
[in] chunkCount The number of chunk descriptors.
[in] chunkDescs Array of chunk descriptors of size chunkCount. It will be updated accordingly.
[in] testOnly If true, this function early-outs if support coverage is not exact. If false, exact coverage is ensured by possibly modifying chunkDescs' flags.
[in] logFn User-supplied message function (see NvBlastLog definition). May be NULL.
Returns:
true iff coverage was already exact.

NV_INLINE uint32_t Nv::Blast::Asset::getBondCount (  )  const

Returns the number of bonds in this asset's support graph.

Returns:
the number of bonds in this asset's support graph.

NV_INLINE uint32_t Nv::Blast::Asset::getContiguousLowerSupportIndex ( uint32_t  chunkIndex  )  const

Maps all lower-support chunk indices to a contiguous range [0, getLowerSupportChunkCount()).

Parameters:
[in] chunkIndex Asset chunk index.
Returns:
an index in the range [0, getLowerSupportChunkCount()) if it is a lower-support chunk, invalidIndex<uint32_t>() otherwise.

NV_INLINE uint32_t Nv::Blast::Asset::getHierarchyCount (  )  const

Returns the number of separate chunk hierarchies in the asset. This will be the initial number of visible chunks in an actor instanced from this asset.

Returns:
the number of separate chunk hierarchies in the asset.

NV_INLINE uint32_t Nv::Blast::Asset::getLowerSupportChunkCount (  )  const

Returns the number of lower-support chunks in this asset. This is the required actor buffer size for a Actor family.

Returns:
the number of lower-support chunks.

static size_t Nv::Blast::Asset::getMemorySize ( const NvBlastAssetDesc desc  )  [static]

Returns the number of bytes of memory that an asset created using the given descriptor will require. A pointer to a block of memory of at least this size must be passed in as the mem argument of create.

Parameters:
[in] desc The asset descriptor that will be passed into NvBlastCreateAsset.

NV_INLINE uint32_t Nv::Blast::Asset::getUpperSupportChunkCount (  )  const

Returns the number of upper-support chunks in this asset..

Returns:
the number of upper-support chunks.

Nv::Blast::Asset::NvBlastBlockArrayData ( uint32_t  ,
m_chunkToGraphNodeMapOffset  ,
getChunkToGraphNodeMap  ,
m_chunkCount   
)

Mapping from chunk index to graph node index (inverse of m_graph.getChunkIndices().

getChunkToGraphNodeMap returns a uint32_t array of size m_chunkCount.

Nv::Blast::Asset::NvBlastBlockArrayData ( uint32_t  ,
m_subtreeLeafChunkCountsOffset  ,
getSubtreeLeafChunkCounts  ,
m_chunkCount   
)

Caching the number of leaf chunks descended from each chunk (including the chunk itself). This data parallels the Chunks array, and is an array of the same size.

getSubtreeLeafChunkCount returns a uint32_t array of size m_chunkCount.

Nv::Blast::Asset::NvBlastBlockArrayData ( NvBlastBond  ,
m_bondsOffset  ,
getBonds  ,
m_bondCount   
)

Array of bond data for the interfaces between two chunks. Since the bond is shared by two chunks, the same bond data is used for chunk[i] -> chunk[j] as for chunk[j] -> chunk[i]. The size of the array is m_graph.adjacencyPartition[m_graph.m_nodeCount]/2. See NvBlastBond.

getBonds returns an array of size m_bondCount.

Nv::Blast::Asset::NvBlastBlockArrayData ( NvBlastChunk  ,
m_chunksOffset  ,
getChunks  ,
m_chunkCount   
)

Chunks, of type NvBlastChunk.

getChunks returns an array of size m_chunkCount.

static bool Nv::Blast::Asset::testForValidChunkOrder ( uint32_t  chunkCount,
const NvBlastChunkDesc chunkDescs,
const char *  chunkAnnotation,
void *  scratch 
) [static]

Tests a set of chunk descriptors to see if chunks are in valid chunk order.

Chunk order conditions checked: 1. 'all chunks with same parent index should go in a row'. 2. 'chunks should come after their parents'. 3. 'root chunks should go first'. 4. 'upper-support chunks should come before subsupport chunks'.

Parameters:
[in] chunkCount The number of chunk descriptors.
[in] chunkDescs An array of chunk descriptors of length chunkCount.
[in] chunkAnnotation Annotation generated from ensureExactSupportCoverage (see ensureExactSupportCoverage).
[in] scratch User-supplied scratch memory of chunkCount bytes.
Returns:
true if the descriptors meet the ordering conditions, false otherwise.


Member Data Documentation

The number of bonds in the asset.

The total number of chunks in the asset, support and non-support.

Chunks are sorted such that subsupport chunks come last. This is the first subsupport chunk index. Equals m_chunkCount if there are no subsupport chunks.

The support graph.

Asset data block header.

ID for this asset.

The number of leaf chunks in the asset.


The documentation for this class was generated from the following file: