HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scheduleNode.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_SCHEDULE_NODE_H
8 #define PXR_EXEC_VDF_SCHEDULE_NODE_H
9 
10 /// \file
11 
12 #include "pxr/pxr.h"
13 
14 #include "pxr/exec/vdf/mask.h"
15 #include "pxr/exec/vdf/node.h"
17 #include "pxr/exec/vdf/types.h"
18 
19 #include <vector>
20 
22 
23 class VdfNode;
24 class VdfOutput;
25 
26 ///////////////////////////////////////////////////////////////////////////////
27 ///
28 /// \class VdfScheduleOuput
29 ///
30 /// This class contains scheduling information for an output.
31 /// A VdfScheduleNode contains a list of these.
32 ///
34 {
35 public:
36  VdfScheduleOutput(const VdfOutput *o, const VdfMask &m)
37  : output(o), requestMask(m),
38  passToOutput(NULL), fromBufferOutput(NULL),
39  uniqueIndex(VdfScheduleTaskInvalid) {}
40 
41  /// The output
42  const VdfOutput *output;
43 
44  /// The request mask for this output
46 
47  /// The request mask ANDed with the affects mask (if any)
49 
50  /// The output to pass a buffer to.
52 
53  /// The output to get our buffer from.
55 
56  /// The mask of the data this output is supposed to keep after it passes
57  /// its buffer to passToOutput.
59 
60  /// The unique index assigned to this output, if it passes its buffer.
62 
63 };
64 
65 ///////////////////////////////////////////////////////////////////////////////
66 ///
67 /// \class VdfScheduleInput
68 ///
69 /// This class contains scheduling information for an input. A VdfSheduleNode
70 /// contains a list of these.
71 ///
73 {
74 public:
75  /// The output from which the scheduled input sources its values.
76  const VdfOutput *source;
77 
78  /// The dependency mask, indicating which elements of the source output
79  /// value this input depends on.
81 
82  /// The input corresponding to this scheduled input.
83  const VdfInput *input;
84 };
85 
86 ///////////////////////////////////////////////////////////////////////////////
87 ///
88 /// \class VdfScheduleNode
89 ///
90 /// This class contains scheduling information necessary to run a single
91 /// VdfNode. A VdfScheduleGroup is a container of these classes.
92 ///
94 {
95 public:
97  node(n), outputToClear(nullptr), affective(false) {}
98 
99  /// Returns the index of \p output in the \p outputs array, or -1 if
100  /// it does not exist.
101  ///
102  int GetOutputIndex(const VdfOutput *output) const {
103  size_t size = outputs.size();
104  for (size_t i = 0; i < size; ++i) {
105  if (ARCH_LIKELY(outputs[i].output == output)) {
106  return i;
107  }
108  }
109  return -1;
110  }
111 
112  /// The node being scheduled.
113  const VdfNode *node;
114 
115  /// An output whose temporary buffer can be deallocated as soon as
116  /// this schedule node has finished executing.
118 
119  /// Whether this node, as scheduled, is affective, meaning it cannot
120  /// be ignored as an optimization while a buffer is passed from an
121  /// input to its associated output.
122  bool affective;
123 
124  /// The list of outputs that are being scheduled for this node.
125  std::vector<VdfScheduleOutput> outputs;
126 
127  /// The list of inputs scheduled for this node.
128  std::vector<VdfScheduleInput> inputs;
129 
130 };
131 
132 ///////////////////////////////////////////////////////////////////////////////
133 
135 
136 #endif
#define ARCH_LIKELY(x)
Definition: hints.h:29
const VdfOutput * output
The output.
Definition: scheduleNode.h:42
const VdfOutput * fromBufferOutput
The output to get our buffer from.
Definition: scheduleNode.h:54
const VdfInput * input
The input corresponding to this scheduled input.
Definition: scheduleNode.h:83
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
Definition: node.h:52
A VdfMask is placed on connections to specify the data flowing through them.
Definition: mask.h:36
const VdfNode * node
The node being scheduled.
Definition: scheduleNode.h:113
Definition: input.h:35
const VdfOutput * passToOutput
The output to pass a buffer to.
Definition: scheduleNode.h:51
GLdouble n
Definition: glcorearb.h:2008
int GetOutputIndex(const VdfOutput *output) const
Definition: scheduleNode.h:102
std::vector< VdfScheduleInput > inputs
The list of inputs scheduled for this node.
Definition: scheduleNode.h:128
VdfScheduleInputDependencyUniqueIndex uniqueIndex
The unique index assigned to this output, if it passes its buffer.
Definition: scheduleNode.h:61
std::vector< VdfScheduleOutput > outputs
The list of outputs that are being scheduled for this node.
Definition: scheduleNode.h:125
GLsizeiptr size
Definition: glcorearb.h:664
VdfScheduleNode(const VdfNode *n)
Definition: scheduleNode.h:96
VdfMask requestMask
The request mask for this output.
Definition: scheduleNode.h:45
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
const VdfOutput * outputToClear
Definition: scheduleNode.h:117
uint32_t VdfScheduleInputDependencyUniqueIndex
VdfScheduleOutput(const VdfOutput *o, const VdfMask &m)
Definition: scheduleNode.h:36
const VdfOutput * source
The output from which the scheduled input sources its values.
Definition: scheduleNode.h:76
VdfMask affectsMask
The request mask ANDed with the affects mask (if any)
Definition: scheduleNode.h:48