Loading...
Searching...
No Matches
parallelExecutorDataManagerInterface.h
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_PARALLEL_EXECUTOR_DATA_MANAGER_INTERFACE_H
8#define PXR_EXEC_VDF_PARALLEL_EXECUTOR_DATA_MANAGER_INTERFACE_H
9
10#include "pxr/pxr.h"
11
12#include "pxr/exec/vdf/types.h"
13
14PXR_NAMESPACE_OPEN_SCOPE
15
17class VdfExecutorInvalidationData;
18class VdfNetwork;
19class VdfOutput;
20class VdfVector;
21
29template <typename DerivedClass, typename DataHandle>
31{
32protected:
33
37
41
45 void _Resize(const VdfNetwork &network) {
46 _Self()->Resize(network);
47 }
48
55 bool _IsValidDataHandle(const DataHandle handle) const {
56 return _Self()->IsValidDataHandle(handle);
57 }
58
64 DataHandle _GetOrCreateDataHandle(const VdfId outputId) const {
65 return _Self()->GetOrCreateDataHandle(outputId);
66 }
67
72 DataHandle _GetDataHandle(const VdfId outputId) const {
73 return _Self()->GetDataHandle(outputId);
74 }
75
83 const DataHandle handle) const {
84 return _Self()->GetPrivateBufferData(handle);
85 }
86
94 const DataHandle handle) const {
95 return _Self()->GetScratchBufferData(handle);
96 }
97
105 const DataHandle handle) const {
106 return _Self()->GetPublicBufferData(handle);
107 }
108
117 void _PublishPrivateBufferData(const DataHandle handle) const {
118 _Self()->PublishPrivateBufferData(handle);
119 }
120
129 void _PublishScratchBufferData(const DataHandle handle) const {
130 _Self()->PublishScratchBufferData(handle);
131 }
132
141 const DataHandle handle) const {
142 return _Self()->GetTransferredBufferData(handle);
143 }
144
158 const DataHandle handle,
159 VdfVector *value,
160 const VdfMask &mask) {
161 return _Self()->TransferBufferData(handle, value, mask);
162 }
163
171 void _ResetTransferredBufferData(const DataHandle handle) {
172 _Self()->ResetTransferredBufferData(handle);
173 }
174
181 VdfExecutorInvalidationData *_GetInvalidationData(
182 const DataHandle handle) const {
183 return _Self()->GetInvalidationData(handle);
184 }
185
193 const DataHandle handle) const {
194 return _Self()->GetInvalidationTimestamp(handle);
195 }
196
203 const DataHandle handle,
205 _Self()->SetInvalidationTimestamp(handle, ts);
206 }
207
211 bool _IsTouched(const VdfId outputId) const {
212 return _Self()->IsTouched(outputId);
213 }
214
218 void _Touch(const VdfId outputId) const {
219 _Self()->Touch(outputId);
220 }
221
225 bool _Untouch(const VdfId outputId) {
226 return _Self()->Untouch(outputId);
227 }
228
231 void _ClearDataForOutput(const VdfOutput &output) {
232 return _Self()->ClearDataForOutput(output);
233 }
234
235private:
236
237 // Returns the constant this pointer to the derived class.
238 const DerivedClass * _Self() const {
239 return static_cast<const DerivedClass *>(this);
240 }
241
242
243 // Returns the mutable this pointer to the derived class.
244 DerivedClass * _Self() {
245 return static_cast<DerivedClass *>(this);
246 }
247
248};
249
250PXR_NAMESPACE_CLOSE_SCOPE
251
252#endif
The interface contract for the static polymorphism used by parallel executor data manager implementat...
void _ResetTransferredBufferData(const DataHandle handle)
Resets the transferred buffer associated with the given handle.
DataHandle _GetOrCreateDataHandle(const VdfId outputId) const
Returns an existing data handle, or creates a new one for the given outputId.
VdfExecutorBufferData * _GetScratchBufferData(const DataHandle handle) const
Returns the scratch VdfExecutorBufferData associated with the given handle.
Vdf_ParallelExecutorDataManagerInterface()
Allow construction via derived classes, only.
void _Resize(const VdfNetwork &network)
Resize the data manager to accommodate all the outputs in the given network.
VdfExecutorInvalidationData * _GetInvalidationData(const DataHandle handle) const
Returns the VdfExecutorInvalidationData associated with the given handle.
void _SetInvalidationTimestamp(const DataHandle handle, VdfInvalidationTimestamp ts)
Sets the invalidation timestamp for the give data handle.
void _Touch(const VdfId outputId) const
Marks the data at the given output as having been touched by evaluation.
VdfExecutorBufferData * _GetPrivateBufferData(const DataHandle handle) const
Returns the private VdfExecutorBufferData associated with the given handle.
bool _IsTouched(const VdfId outputId) const
Returns true if the data at the given output has been touched by evaluation.
void _PublishPrivateBufferData(const DataHandle handle) const
Publishes the private VdfExecutorBufferData, and retains the previously public VdfExecutorBufferData ...
VdfExecutorBufferData * _GetPublicBufferData(const DataHandle handle) const
Returns the public VdfExecutorBufferData associated with the given handle.
VdfInvalidationTimestamp _GetInvalidationTimestamp(const DataHandle handle) const
Returns the VdfInvalidationTimestamp associated with the given handle.
virtual ~Vdf_ParallelExecutorDataManagerInterface()
Prevent destruction via base class pointers (static polymorphism only).
DataHandle _GetDataHandle(const VdfId outputId) const
Returns an existing data handle for the given outputId.
void _PublishScratchBufferData(const DataHandle handle) const
Publishes the scratch VdfExecutorBufferData, and retains the previously public VdfExecutorBufferData ...
void _ClearDataForOutput(const VdfOutput &output)
Clears the executor data for a specific output.
bool _IsValidDataHandle(const DataHandle handle) const
Returns true if the given data handle is valid, i.e.
VdfExecutorBufferData * _GetTransferredBufferData(const DataHandle handle) const
Returns the transferred VdfExecutorBufferData associated with the given handle.
bool _TransferBufferData(const DataHandle handle, VdfVector *value, const VdfMask &mask)
Transfers ownership of the value to the output associated with handle.
bool _Untouch(const VdfId outputId)
Marks the data at the given output as not having been touched by evaluation.
This object is responsible for storing the executor buffer data, comprised of the executor cache vect...
A VdfMask is placed on connections to specify the data flowing through them.
Definition: mask.h:37
A VdfNetwork is a collection of VdfNodes and their connections.
Definition: network.h:60
A VdfOutput represents an output on a node.
Definition: output.h:32
This class is used to abstract away knowledge of the cache data used for each node.
Definition: vector.h:56
uint64_t VdfId
The unique identifier type for Vdf objects.
Definition: types.h:107
unsigned int VdfInvalidationTimestamp
Type of the timestamp that identifies the most recent round of invalidation.
Definition: types.h:74