NvBlastActorSerializationBlock.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27 
28 
29 #ifndef NVBLASTACTORSERIALIZATIONBLOCK_H
30 #define NVBLASTACTORSERIALIZATIONBLOCK_H
31 
32 
33 #include "NvBlastFixedBoolArray.h"
34 
35 
36 namespace Nv
37 {
38 namespace Blast
39 {
40 
45 {
46  enum Version
47  {
50 
51  // New formats must come before Count. They should be given descriptive names with more information in comments.
52 
55 
57  Current = Count - 1
58  };
59 };
60 
61 
70 {
74  uint32_t m_formatVersion;
75 
81  uint32_t m_size;
82 
86  uint32_t m_index;
87 
92 
96  uint32_t m_graphNodeCount;
97 
102 
106  NvBlastBlockArrayData(uint32_t, m_visibleChunkIndicesOffset, getVisibleChunkIndices, m_visibleChunkCount);
107 
111  NvBlastBlockArrayData(uint32_t, m_graphNodeIndicesOffset, getGraphNodeIndices, m_graphNodeCount);
112 
116  NvBlastBlockData(float, m_lowerSupportChunkHealthsOffset, getLowerSupportChunkHealths);
117 
121  NvBlastBlockData(float, m_bondHealthsOffset, getBondHealths);
122 
126  NvBlastBlockArrayData(uint32_t, m_fastRouteOffset, getFastRoute, m_graphNodeCount);
127 
131  NvBlastBlockArrayData(uint32_t, m_hopCountsOffset, getHopCounts, m_graphNodeCount);
132 
136  NvBlastBlockData(FixedBoolArray, m_edgeRemovedArrayOffset, getEdgeRemovedArray);
137 };
138 
139 
141 
152 NV_INLINE size_t getActorSerializationSize(uint32_t visibleChunkCount, uint32_t lowerSupportChunkCount, uint32_t graphNodeCount, uint32_t bondCount)
153 {
154  // Family offsets
155  const size_t visibleChunkIndicesOffset = align16(sizeof(ActorSerializationHeader)); // size = visibleChunkCount*sizeof(uint32_t)
156  const size_t graphNodeIndicesOffset = align16(visibleChunkIndicesOffset + visibleChunkCount*sizeof(uint32_t)); // size = graphNodeCount*sizeof(uint32_t)
157  const size_t lowerSupportHealthsOffset = align16(graphNodeIndicesOffset + graphNodeCount*sizeof(uint32_t)); // size = lowerSupportChunkCount*sizeof(float)
158  const size_t bondHealthsOffset = align16(lowerSupportHealthsOffset + lowerSupportChunkCount*sizeof(float)); // size = bondCount*sizeof(float)
159  const size_t fastRouteOffset = align16(bondHealthsOffset + bondCount*sizeof(float)); // size = graphNodeCount*sizeof(uint32_t)
160  const size_t hopCountsOffset = align16(fastRouteOffset + graphNodeCount*sizeof(uint32_t)); // size = graphNodeCount*sizeof(uint32_t)
161  const size_t edgeRemovedArrayOffset = align16(hopCountsOffset + graphNodeCount*sizeof(uint32_t)); // size = 0 or FixedBoolArray::requiredMemorySize(bondCount)
162  return align16(edgeRemovedArrayOffset + (bondCount == 0 ? 0 : FixedBoolArray::requiredMemorySize(bondCount)));
163 }
164 
165 } // namespace Blast
166 } // namespace Nv
167 
168 
169 #endif // ifndef NVBLASTACTORSERIALIZATIONBLOCK_H
Version
Definition: NvBlastActorSerializationBlock.h:46
Definition: NvBlastActorSerializationBlock.h:44
uint32_t m_size
Definition: NvBlastActorSerializationBlock.h:81
Definition: NvBlastFixedBoolArray.h:63
NV_INLINE size_t getActorSerializationSize(uint32_t visibleChunkCount, uint32_t lowerSupportChunkCount, uint32_t graphNodeCount, uint32_t bondCount)
Definition: NvBlastActorSerializationBlock.h:152
#define NvBlastBlockArrayData(_dataType, _name, _accessor, _sizeExpr)
Definition: NvBlastMemory.h:90
Definition: NvBlastActorSerializationBlock.h:69
uint32_t m_index
Definition: NvBlastActorSerializationBlock.h:86
static size_t requiredMemorySize(uint32_t size)
Definition: NvBlastFixedBoolArray.h:71
#define NvBlastBlockData(_dataType, _name, _accessor)
Definition: NvBlastMemory.h:81
uint32_t m_visibleChunkCount
Definition: NvBlastActorSerializationBlock.h:91
uint32_t m_leafChunkCount
Definition: NvBlastActorSerializationBlock.h:101
Definition: NvBlastActorSerializationBlock.h:54
uint32_t m_graphNodeCount
Definition: NvBlastActorSerializationBlock.h:96
uint32_t m_formatVersion
Definition: NvBlastActorSerializationBlock.h:74
#define NV_INLINE
Definition: NvPreprocessor.h:350
Definition: NvBlastActorSerializationBlock.h:57
NV_INLINE T align16(T value)
Definition: NvBlastMemory.h:46
Definition: NvBlastActorSerializationBlock.h:49
Definition: NvBlastArray.h:37