Main Page Class List Class Members

NvBlast.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 NVBLAST_H
30 #define NVBLAST_H
31
32
33 #include "NvBlastTypes.h"
34
35
37 // NvBlastAsset functions
40
50 NVBLAST_API size_t NvBlastGetAssetMemorySize(const NvBlastAssetDesc* desc, NvBlastLog logFn);
51
52
62 NVBLAST_API size_t NvBlastGetRequiredScratchForCreateAsset(const NvBlastAssetDesc* desc, NvBlastLog logFn);
63
64
89 NVBLAST_API NvBlastAsset* NvBlastCreateAsset(void* mem, const NvBlastAssetDesc* desc, void* scratch, NvBlastLog logFn);
90
91
101 NVBLAST_API size_t NvBlastAssetGetFamilyMemorySize(const NvBlastAsset* asset, NvBlastLog logFn);
102
103
116 NVBLAST_API NvBlastFamily* NvBlastAssetCreateFamily(void* mem, const NvBlastAsset* asset, NvBlastLog logFn);
117
118
127 NVBLAST_API NvBlastID NvBlastAssetGetID(const NvBlastAsset* asset, NvBlastLog logFn);
128
129
139 NVBLAST_API bool NvBlastAssetSetID(NvBlastAsset* asset, const NvBlastID* id, NvBlastLog logFn);
140
141
150 NVBLAST_API uint32_t NvBlastAssetGetFormatVersion(const NvBlastAsset* asset, NvBlastLog logFn);
151
152
161 NVBLAST_API uint32_t NvBlastAssetGetSize(const NvBlastAsset* asset, NvBlastLog logFn);
162
163
172 NVBLAST_API uint32_t NvBlastAssetGetChunkCount(const NvBlastAsset* asset, NvBlastLog logFn);
173
174
187 NVBLAST_API uint32_t NvBlastAssetGetSupportChunkCount(const NvBlastAsset* asset, NvBlastLog logFn);
188
189
198 NVBLAST_API uint32_t NvBlastAssetGetLeafChunkCount(const NvBlastAsset* asset, NvBlastLog logFn);
199
200
211 NVBLAST_API uint32_t NvBlastAssetGetFirstSubsupportChunkIndex(const NvBlastAsset* asset, NvBlastLog logFn);
212
213
222 NVBLAST_API uint32_t NvBlastAssetGetBondCount(const NvBlastAsset* asset, NvBlastLog logFn);
223
224
233 NVBLAST_API const NvBlastSupportGraph NvBlastAssetGetSupportGraph(const NvBlastAsset* asset, NvBlastLog logFn);
234
235
246 NVBLAST_API const uint32_t* NvBlastAssetGetChunkToGraphNodeMap(const NvBlastAsset* asset, NvBlastLog logFn);
247
248
257 NVBLAST_API const NvBlastChunk* NvBlastAssetGetChunks(const NvBlastAsset* asset, NvBlastLog logFn);
258
259
268 NVBLAST_API const NvBlastBond* NvBlastAssetGetBonds(const NvBlastAsset* asset, NvBlastLog logFn);
269
270
281 NVBLAST_API uint32_t NvBlastAssetGetActorSerializationSizeUpperBound(const NvBlastAsset* asset, NvBlastLog logFn);
282
284
285
287 // NvBlastAsset helper functions
290
307 NVBLAST_API bool NvBlastEnsureAssetExactSupportCoverage(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, void* scratch, NvBlastLog logFn);
308
309
333 NVBLAST_API bool NvBlastBuildAssetDescChunkReorderMap(uint32_t* chunkReorderMap, const NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, void* scratch, NvBlastLog logFn);
334
335
353 NVBLAST_API void NvBlastApplyAssetDescChunkReorderMap
354 (
355 NvBlastChunkDesc* reorderedChunkDescs,
356 const NvBlastChunkDesc* chunkDescs,
357 uint32_t chunkCount,
358 NvBlastBondDesc* bondDescs,
359 uint32_t bondCount,
360 const uint32_t* chunkReorderMap,
361 bool keepBondNormalChunkOrder,
362 NvBlastLog logFn
363 );
364
365
385 NVBLAST_API void NvBlastApplyAssetDescChunkReorderMapInPlace
386 (
387 NvBlastChunkDesc* chunkDescs,
388 uint32_t chunkCount,
389 NvBlastBondDesc* bondDescs,
390 uint32_t bondCount,
391 const uint32_t* chunkReorderMap,
392 bool keepBondNormalChunkOrder,
393 void* scratch,
394 NvBlastLog logFn
395 );
396
397
414 NVBLAST_API bool NvBlastReorderAssetDescChunks
415 (
416 NvBlastChunkDesc* chunkDescs,
417 uint32_t chunkCount,
418 NvBlastBondDesc* bondDescs,
419 uint32_t bondCount,
420 uint32_t* chunkReorderMap,
421 bool keepBondNormalChunkOrder,
422 void* scratch,
423 NvBlastLog logFn
424 );
425
427
428
430 // NvBlastFamily functions
433
442 NVBLAST_API uint32_t NvBlastFamilyGetFormatVersion(const NvBlastFamily* family, NvBlastLog logFn);
443
444
453 NVBLAST_API const NvBlastAsset* NvBlastFamilyGetAsset(const NvBlastFamily* family, NvBlastLog logFn);
454
455
463 NVBLAST_API void NvBlastFamilySetAsset(NvBlastFamily* family, const NvBlastAsset* asset, NvBlastLog logFn);
464
465
474 NVBLAST_API uint32_t NvBlastFamilyGetSize(const NvBlastFamily* family, NvBlastLog logFn);
475
476
485 NVBLAST_API NvBlastID NvBlastFamilyGetAssetID(const NvBlastFamily* family, NvBlastLog logFn);
486
487
496 NVBLAST_API size_t NvBlastFamilyGetRequiredScratchForCreateFirstActor(const NvBlastFamily* family, NvBlastLog logFn);
497
498
509 NVBLAST_API NvBlastActor* NvBlastFamilyCreateFirstActor(NvBlastFamily* family, const NvBlastActorDesc* desc, void* scratch, NvBlastLog logFn);
510
511
520 NVBLAST_API uint32_t NvBlastFamilyGetActorCount(const NvBlastFamily* family, NvBlastLog logFn);
521
522
534 NVBLAST_API NvBlastActor* NvBlastFamilyDeserializeActor(NvBlastFamily* family, const void* buffer, NvBlastLog logFn);
535
536
547 NVBLAST_API uint32_t NvBlastFamilyGetActors(NvBlastActor** actors, uint32_t actorsSize, const NvBlastFamily* family, NvBlastLog logFn);
548
549
559 NVBLAST_API NvBlastActor* NvBlastFamilyGetChunkActor(const NvBlastFamily* family, uint32_t chunkIndex, NvBlastLog logFn);
560
561
570 NVBLAST_API uint32_t NvBlastFamilyGetMaxActorCount(const NvBlastFamily* family, NvBlastLog logFn);
571
573
574
576 // NvBlastActor accessor, serialization, and deactivation functions
579
588 NVBLAST_API uint32_t NvBlastActorGetVisibleChunkCount(const NvBlastActor* actor, NvBlastLog logFn);
589
590
601 NVBLAST_API uint32_t NvBlastActorGetVisibleChunkIndices(uint32_t* visibleChunkIndices, uint32_t visibleChunkIndicesSize, const NvBlastActor* actor, NvBlastLog logFn);
602
603
612 NVBLAST_API uint32_t NvBlastActorGetGraphNodeCount(const NvBlastActor* actor, NvBlastLog logFn);
613
614
625 NVBLAST_API uint32_t NvBlastActorGetGraphNodeIndices(uint32_t* graphNodeIndices, uint32_t graphNodeIndicesSize, const NvBlastActor* actor, NvBlastLog logFn);
626
627
648 NVBLAST_API const float* NvBlastActorGetBondHealths(const NvBlastActor* actor, NvBlastLog logFn);
649
650
660 NVBLAST_API uint32_t NvBlastActorGetSerializationSize(const NvBlastActor* actor, NvBlastLog logFn);
661
662
673 NVBLAST_API uint32_t NvBlastActorSerialize(void* buffer, uint32_t bufferSize, const NvBlastActor* actor, NvBlastLog logFn);
674
675
684 NVBLAST_API NvBlastFamily* NvBlastActorGetFamily(const NvBlastActor* actor, NvBlastLog logFn);
685
686
695 NVBLAST_API uint32_t NvBlastActorGetIndex(const NvBlastActor* actor, NvBlastLog logFn);
696
697
706 NVBLAST_API bool NvBlastActorDeactivate(NvBlastActor* actor, NvBlastLog logFn);
707
709
710
712 // NvBlastActor damage and fracturing functions
715
738 NVBLAST_API void NvBlastActorGenerateFracture
739 (
740 NvBlastFractureBuffers* commandBuffers,
741 const NvBlastActor* actor,
742 const NvBlastDamageProgram program,
743 const void* programParams,
744 NvBlastLog logFn,
745 NvBlastTimers* timers
746 );
747
748
779 NVBLAST_API void NvBlastActorApplyFracture
780 (
781 NvBlastFractureBuffers* eventBuffers,
782 NvBlastActor* actor,
783 const NvBlastFractureBuffers* commands,
784 NvBlastLog logFn,
785 NvBlastTimers* timers
786 );
787
788
802 NVBLAST_API uint32_t NvBlastActorSplit
803 (
804 NvBlastActorSplitEvent* result,
805 NvBlastActor* actor,
806 uint32_t newActorsMaxCount,
807 void* scratch,
808 NvBlastLog logFn,
809 NvBlastTimers* timers
810 );
811
812
822 NVBLAST_API size_t NvBlastActorGetRequiredScratchForSplit(const NvBlastActor* actor, NvBlastLog logFn);
823
824
834 NVBLAST_API uint32_t NvBlastActorGetMaxActorCountForSplit(const NvBlastActor* actor, NvBlastLog logFn);
835
836
845 NVBLAST_API bool NvBlastActorCanFracture(const NvBlastActor* actor, NvBlastLog logFn);
846
847
857 NVBLAST_API bool NvBlastActorIsSplitRequired(const NvBlastActor* actor, NvBlastLog logFn);
858
859
863 NVBLAST_API bool NvBlastActorIsBoundToWorld(const NvBlastActor* actor, NvBlastLog logFn);
864
866
867
869 // NvBlastTimers functions and helpers
872
878 NVBLAST_API void NvBlastTimersReset(NvBlastTimers* timers);
879
880
888 NVBLAST_API double NvBlastTicksToSeconds(int64_t ticks);
889
891
892
893 #endif // ifndef NVBLAST_H
NvBlastAssetGetFormatVersion
uint32_t NvBlastAssetGetFormatVersion(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastAssetCreateFamily
NvBlastFamily * NvBlastAssetCreateFamily(void *mem, const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastActorDeactivate
bool NvBlastActorDeactivate(NvBlastActor *actor, NvBlastLog logFn)
NvBlastSupportGraph
Definition: NvBlastTypes.h:244
NvBlastActorDesc
Definition: NvBlastTypes.h:395
NvBlastGetAssetMemorySize
size_t NvBlastGetAssetMemorySize(const NvBlastAssetDesc *desc, NvBlastLog logFn)
NvBlastFamilyCreateFirstActor
NvBlastActor * NvBlastFamilyCreateFirstActor(NvBlastFamily *family, const NvBlastActorDesc *desc, void *scratch, NvBlastLog logFn)
NvBlastFamilyGetActorCount
uint32_t NvBlastFamilyGetActorCount(const NvBlastFamily *family, NvBlastLog logFn)
NvBlastBond
Definition: NvBlastTypes.h:189
NvBlastFamilySetAsset
void NvBlastFamilySetAsset(NvBlastFamily *family, const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastTimersReset
void NvBlastTimersReset(NvBlastTimers *timers)
NvBlastAssetGetBonds
const NvBlastBond * NvBlastAssetGetBonds(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastAssetGetChunkCount
uint32_t NvBlastAssetGetChunkCount(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastTypes.h
NvBlastFamilyGetMaxActorCount
uint32_t NvBlastFamilyGetMaxActorCount(const NvBlastFamily *family, NvBlastLog logFn)
NvBlastAssetDesc
Definition: NvBlastTypes.h:345
NvBlastBondDesc
Definition: NvBlastTypes.h:322
NvBlastAssetGetActorSerializationSizeUpperBound
uint32_t NvBlastAssetGetActorSerializationSizeUpperBound(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastActorGetRequiredScratchForSplit
size_t NvBlastActorGetRequiredScratchForSplit(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastActorGetVisibleChunkIndices
uint32_t NvBlastActorGetVisibleChunkIndices(uint32_t *visibleChunkIndices, uint32_t visibleChunkIndicesSize, const NvBlastActor *actor, NvBlastLog logFn)
NvBlastActorGetMaxActorCountForSplit
uint32_t NvBlastActorGetMaxActorCountForSplit(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastAssetGetChunkToGraphNodeMap
const uint32_t * NvBlastAssetGetChunkToGraphNodeMap(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastTicksToSeconds
double NvBlastTicksToSeconds(int64_t ticks)
NvBlastAssetSetID
bool NvBlastAssetSetID(NvBlastAsset *asset, const NvBlastID *id, NvBlastLog logFn)
NvBlastActorGenerateFracture
void NvBlastActorGenerateFracture(NvBlastFractureBuffers *commandBuffers, const NvBlastActor *actor, const NvBlastDamageProgram program, const void *programParams, NvBlastLog logFn, NvBlastTimers *timers)
NvBlastFamilyGetChunkActor
NvBlastActor * NvBlastFamilyGetChunkActor(const NvBlastFamily *family, uint32_t chunkIndex, NvBlastLog logFn)
NvBlastActorGetGraphNodeCount
uint32_t NvBlastActorGetGraphNodeCount(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastLog
void(* NvBlastLog)(int type, const char *msg, const char *file, int line)
Definition: NvBlastTypes.h:63
NvBlastFamilyDeserializeActor
NvBlastActor * NvBlastFamilyDeserializeActor(NvBlastFamily *family, const void *buffer, NvBlastLog logFn)
NvBlastFamilyGetAssetID
NvBlastID NvBlastFamilyGetAssetID(const NvBlastFamily *family, NvBlastLog logFn)
NvBlastBuildAssetDescChunkReorderMap
bool NvBlastBuildAssetDescChunkReorderMap(uint32_t *chunkReorderMap, const NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, void *scratch, NvBlastLog logFn)
NvBlastGetRequiredScratchForCreateAsset
size_t NvBlastGetRequiredScratchForCreateAsset(const NvBlastAssetDesc *desc, NvBlastLog logFn)
NvBlastTimers
Definition: NvBlastTypes.h:85
NvBlastReorderAssetDescChunks
bool NvBlastReorderAssetDescChunks(NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, NvBlastBondDesc *bondDescs, uint32_t bondCount, uint32_t *chunkReorderMap, bool keepBondNormalChunkOrder, void *scratch, NvBlastLog logFn)
NvBlastApplyAssetDescChunkReorderMap
void NvBlastApplyAssetDescChunkReorderMap(NvBlastChunkDesc *reorderedChunkDescs, const NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, NvBlastBondDesc *bondDescs, uint32_t bondCount, const uint32_t *chunkReorderMap, bool keepBondNormalChunkOrder, NvBlastLog logFn)
NvBlastFamilyGetRequiredScratchForCreateFirstActor
size_t NvBlastFamilyGetRequiredScratchForCreateFirstActor(const NvBlastFamily *family, NvBlastLog logFn)
NvBlastActorGetIndex
uint32_t NvBlastActorGetIndex(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastDamageProgram
Definition: NvBlastTypes.h:584
NvBlastCreateAsset
NvBlastAsset * NvBlastCreateAsset(void *mem, const NvBlastAssetDesc *desc, void *scratch, NvBlastLog logFn)
NvBlastAssetGetSupportChunkCount
uint32_t NvBlastAssetGetSupportChunkCount(const NvBlastAsset *asset, NvBlastLog logFn)
NVBLAST_API
#define NVBLAST_API
Definition: NvBlastPreprocessor.h:37
NvBlastActorSplitEvent
Definition: NvBlastTypes.h:481
NvBlastActorIsSplitRequired
bool NvBlastActorIsSplitRequired(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastAssetGetSupportGraph
const NvBlastSupportGraph NvBlastAssetGetSupportGraph(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastAssetGetFirstSubsupportChunkIndex
uint32_t NvBlastAssetGetFirstSubsupportChunkIndex(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastFamilyGetActors
uint32_t NvBlastFamilyGetActors(NvBlastActor **actors, uint32_t actorsSize, const NvBlastFamily *family, NvBlastLog logFn)
NvBlastActorCanFracture
bool NvBlastActorCanFracture(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastActorSplit
uint32_t NvBlastActorSplit(NvBlastActorSplitEvent *result, NvBlastActor *actor, uint32_t newActorsMaxCount, void *scratch, NvBlastLog logFn, NvBlastTimers *timers)
NvBlastActorIsBoundToWorld
bool NvBlastActorIsBoundToWorld(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastActorGetBondHealths
const float * NvBlastActorGetBondHealths(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastActorGetSerializationSize
uint32_t NvBlastActorGetSerializationSize(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastAssetGetBondCount
uint32_t NvBlastAssetGetBondCount(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastID
Definition: NvBlastTypes.h:69
NvBlastChunkDesc
Definition: NvBlastTypes.h:292
NvBlastChunk
Definition: NvBlastTypes.h:152
NvBlastAssetGetSize
uint32_t NvBlastAssetGetSize(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastActorGetGraphNodeIndices
uint32_t NvBlastActorGetGraphNodeIndices(uint32_t *graphNodeIndices, uint32_t graphNodeIndicesSize, const NvBlastActor *actor, NvBlastLog logFn)
NvBlastFamilyGetSize
uint32_t NvBlastFamilyGetSize(const NvBlastFamily *family, NvBlastLog logFn)
NvBlastAsset
Definition: NvBlastTypes.h:286
NvBlastAssetGetID
NvBlastID NvBlastAssetGetID(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastFractureBuffers
Definition: NvBlastTypes.h:468
NvBlastAssetGetChunks
const NvBlastChunk * NvBlastAssetGetChunks(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastFamilyGetFormatVersion
uint32_t NvBlastFamilyGetFormatVersion(const NvBlastFamily *family, NvBlastLog logFn)
NvBlastActorApplyFracture
void NvBlastActorApplyFracture(NvBlastFractureBuffers *eventBuffers, NvBlastActor *actor, const NvBlastFractureBuffers *commands, NvBlastLog logFn, NvBlastTimers *timers)
NvBlastEnsureAssetExactSupportCoverage
bool NvBlastEnsureAssetExactSupportCoverage(NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, void *scratch, NvBlastLog logFn)
NvBlastActorGetVisibleChunkCount
uint32_t NvBlastActorGetVisibleChunkCount(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastFamilyGetAsset
const NvBlastAsset * NvBlastFamilyGetAsset(const NvBlastFamily *family, NvBlastLog logFn)
NvBlastAssetGetLeafChunkCount
uint32_t NvBlastAssetGetLeafChunkCount(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastActorSerialize
uint32_t NvBlastActorSerialize(void *buffer, uint32_t bufferSize, const NvBlastActor *actor, NvBlastLog logFn)
NvBlastActor
Definition: NvBlastTypes.h:387
NvBlastActorGetFamily
NvBlastFamily * NvBlastActorGetFamily(const NvBlastActor *actor, NvBlastLog logFn)
NvBlastAssetGetFamilyMemorySize
size_t NvBlastAssetGetFamilyMemorySize(const NvBlastAsset *asset, NvBlastLog logFn)
NvBlastFamily
Definition: NvBlastTypes.h:376
NvBlastApplyAssetDescChunkReorderMapInPlace
void NvBlastApplyAssetDescChunkReorderMapInPlace(NvBlastChunkDesc *chunkDescs, uint32_t chunkCount, NvBlastBondDesc *bondDescs, uint32_t bondCount, const uint32_t *chunkReorderMap, bool keepBondNormalChunkOrder, void *scratch, NvBlastLog logFn)