HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
types.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_EXEC_VDF_TYPES_H
8 #define PXR_EXEC_VDF_TYPES_H
9 
10 /// \file
11 
12 #include "pxr/pxr.h"
13 
14 #include "pxr/exec/vdf/api.h"
16 #include "pxr/exec/vdf/mask.h"
17 
18 #include "pxr/base/tf/hash.h"
19 #include "pxr/base/tf/hashmap.h"
20 #include "pxr/base/tf/hashset.h"
22 
23 #include <functional>
24 #include <string>
25 #include <unordered_map>
26 #include <vector>
27 
29 
30 class VdfConnection;
31 class VdfInput;
32 class VdfNode;
33 class VdfOutput;
34 
35 /// Returns \c true if single-frame parallel evaluation is enabled.
36 ///
37 VDF_API
39 
40 /// Type for an ordered collection of connections.
42 
43 /// Type for an ordered collection of connections.
45 
46 /// Type for an unordered set of connections.
48 
49 /// Type for an unordered set of connections.
51 
52 /// Type for an unordered set of nodes pointers.
54 
55 /// Type for an unordered set of output pointers.
57 
58 /// Type for an unordered set of input pointers.
60 
61 /// Type for an ordered collection of inputs
62 typedef std::vector<const VdfInput *> VdfInputPtrVector;
63 
64 /// Type for an ordered collection of outputs
65 typedef std::vector<const VdfOutput *> VdfOutputPtrVector;
66 
67 /// Type of callback used when processing nodes.
68 typedef std::function<void (const VdfNode &)> VdfNodeCallback;
69 
70 /// Type of callback for building a node debug name
71 typedef std::function<std::string()> VdfNodeDebugNameCallback;
72 
73 /// Type of the timestamp that identifies the most recent round of invalidation.
74 typedef unsigned int VdfInvalidationTimestamp;
75 
76 /// A pair of connection pointer and mask for sparse input dependency computation.
77 typedef std::pair<VdfConnection *, VdfMask> VdfConnectionAndMask;
78 
79 /// A vector of VdfConnectionAndMasks.
80 typedef std::vector<VdfConnectionAndMask> VdfConnectionAndMaskVector;
81 
82 /// Function type to be used with ForEachScheduledOutput().
83 ///
84 typedef
85  std::function<void (const VdfOutput *, const VdfMask &)>
87 
88 /// A map from node pointer to VdfOutputPtrSet.
89 typedef
92 
93 /// A map from node pointer to VdfInputPtrVector
96 
97 /// A map from node pointer to VdfInputPtrVector
100 
101 /// A map from output pointer to mask
102 typedef
103  std::unordered_map<const VdfOutput *, VdfMask, TfHash>
105 
106 /// The unique identifier type for Vdf objects.
107 typedef uint64_t VdfId;
108 
109 /// The index type for Vdf objects.
110 typedef uint32_t VdfIndex;
111 
112 /// The version type for Vdf objects.
113 typedef uint32_t VdfVersion;
114 
115 /// A vector of ids.
116 typedef std::vector<VdfId> VdfIdVector;
117 
118 /// A std::vector which on resize performs default initialization instead of
119 /// value initialization. We use this on arrays that are first resized and
120 /// then immediatelly filled with elements.
121 template <typename T>
122 using Vdf_DefaultInitVector = std::vector<T, Vdf_DefaultInitAllocator<T>>;
123 
125 
126 #endif
TfHashMap< const VdfNode *, VdfInputPtrVector, TfHash > VdfNodeToInputPtrVectorMap
A map from node pointer to VdfInputPtrVector.
Definition: types.h:95
TfHashSet< const VdfConnection *, TfHash > VdfConnectionConstSet
Type for an unordered set of connections.
Definition: types.h:50
TfHashMap< const VdfNode *, VdfOutputPtrSet, TfHash > VdfNodeToOutputPtrSetMap
A map from node pointer to VdfOutputPtrSet.
Definition: types.h:91
uint32_t VdfVersion
The version type for Vdf objects.
Definition: types.h:113
std::vector< VdfId > VdfIdVector
A vector of ids.
Definition: types.h:116
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
std::vector< T, Vdf_DefaultInitAllocator< T >> Vdf_DefaultInitVector
Definition: types.h:122
Definition: node.h:52
std::vector< const VdfOutput * > VdfOutputPtrVector
Type for an ordered collection of outputs.
Definition: types.h:65
TfHashSet< const VdfNode *, TfHash > VdfNodePtrSet
Type for an unordered set of nodes pointers.
Definition: types.h:53
std::pair< VdfConnection *, VdfMask > VdfConnectionAndMask
A pair of connection pointer and mask for sparse input dependency computation.
Definition: types.h:77
#define VDF_API
Definition: api.h:25
TfSmallVector< VdfConnection *, 1 > VdfConnectionVector
Type for an ordered collection of connections.
Definition: types.h:41
TfHashSet< const VdfOutput *, TfHash > VdfOutputPtrSet
Type for an unordered set of output pointers.
Definition: types.h:56
std::function< void(const VdfOutput *, const VdfMask &)> VdfScheduledOutputCallback
Definition: types.h:86
Definition: input.h:35
std::vector< VdfConnectionAndMask > VdfConnectionAndMaskVector
A vector of VdfConnectionAndMasks.
Definition: types.h:80
std::vector< const VdfInput * > VdfInputPtrVector
Type for an ordered collection of inputs.
Definition: types.h:62
TfHashSet< VdfConnection *, TfHash > VdfConnectionSet
Type for an unordered set of connections.
Definition: types.h:47
VDF_API bool VdfIsParallelEvaluationEnabled()
std::function< void(const VdfNode &)> VdfNodeCallback
Type of callback used when processing nodes.
Definition: types.h:68
std::unordered_map< const VdfOutput *, VdfMask, TfHash > VdfOutputToMaskMap
A map from output pointer to mask.
Definition: types.h:104
TfHashMap< const VdfNode *, VdfOutputPtrVector, TfHash > VdfNodeToOutputPtrVectorMap
A map from node pointer to VdfInputPtrVector.
Definition: types.h:99
TfHashSet< const VdfInput *, TfHash > VdfInputPtrSet
Type for an unordered set of input pointers.
Definition: types.h:59
unsigned int VdfInvalidationTimestamp
Type of the timestamp that identifies the most recent round of invalidation.
Definition: types.h:74
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
TfSmallVector< const VdfConnection *, 1 > VdfConnectionConstVector
Type for an ordered collection of connections.
Definition: types.h:44
std::function< std::string()> VdfNodeDebugNameCallback
Type of callback for building a node debug name.
Definition: types.h:71
uint64_t VdfId
The unique identifier type for Vdf objects.
Definition: types.h:107
uint32_t VdfIndex
The index type for Vdf objects.
Definition: types.h:110