Loading...
Searching...
No Matches
requestImpl.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_EXEC_REQUEST_IMPL_H
8#define PXR_EXEC_EXEC_REQUEST_IMPL_H
9
10#include "pxr/pxr.h"
11
12#include "pxr/exec/exec/api.h"
13#include "pxr/exec/exec/request.h"
14
15#include "pxr/base/tf/bits.h"
16#include "pxr/base/tf/pxrTslRobinMap/robin_map.h"
19#include "pxr/exec/vdf/types.h"
20
21#include <memory>
22#include <vector>
23
24PXR_NAMESPACE_OPEN_SCOPE
25
26class EfTime;
27struct Exec_AttributeValueInvalidationResult;
28class Exec_CacheView;
29struct Exec_DisconnectedInputsInvalidationResult;
30struct Exec_MetadataInvalidationResult;
31class Exec_TimeChangeInvalidationResult;
32class Exec_ValueExtractor;
33class ExecSystem;
34class ExecValueKey;
35template <typename> class TfSpan;
36class VdfRequest;
37class VdfSchedule;
38
46{
47public:
52 const Exec_AttributeValueInvalidationResult &invalidationResult);
53
58 const Exec_MetadataInvalidationResult &invalidationResult);
59
64 const Exec_DisconnectedInputsInvalidationResult &invalidationResult);
65
70
73 const Exec_TimeChangeInvalidationResult &invalidationResult);
74
80 void Expire();
81
82protected:
83 EXEC_API
85 ExecSystem *system,
86 ExecRequestComputedValueInvalidationCallback &&valueCallback,
87 ExecRequestTimeChangeInvalidationCallback &&timeCallback);
88
89 Exec_RequestImpl(const Exec_RequestImpl&) = delete;
90 Exec_RequestImpl& operator=(const Exec_RequestImpl&) = delete;
91
92 EXEC_API
94
96 EXEC_API
98
100 EXEC_API
101 void _Schedule();
102
104 EXEC_API
106
112 EXEC_API
114
121 EXEC_API
123
129 EXEC_API
130 void _Discard();
131
132private:
133 // Ensures the _leafNodeToIndex map is up-to-date.
134 void _BuildLeafNodeToIndexMap();
135
136 // Turns invalid leaf nodes into a set of requested - and not previously
137 // invalidated - indices.
138 //
139 void _InvalidateLeafOutputs(
140 bool isNewlyInvalidInterval,
142 ExecRequestIndexSet *invalidIndices);
143
144private:
145 // The system that issued this request.
146 ExecSystem *_system;
147
148 // The compiled leaf output.
149 std::vector<VdfMaskedOutput> _leafOutputs;
150
151 // Value extractors corresponding to each requested value.
152 std::vector<Exec_ValueExtractor> _extractors;
153
154 // Maps leaf nodes to their index in the array of valueKeys the request
155 // was built with.
156 pxr_tsl::robin_map<VdfId, size_t> _leafNodeToIndex;
157
158 // The compute request to cache values with.
159 std::unique_ptr<VdfRequest> _computeRequest;
160
161 // The schedule to cache values with.
162 std::unique_ptr<VdfSchedule> _schedule;
163
164 // The combined time interval for which invalidation has been sent out.
165 EfTimeInterval _lastInvalidatedInterval;
166
167 // The combined set of indices for which invalidation has been sent out.
168 TfBits _lastInvalidatedIndices;
169
170 // The invalidation callback to invoke when computed values change.
171 ExecRequestComputedValueInvalidationCallback _valueCallback;
172
173 // The invalidation callback to invoke when time changes.
174 ExecRequestTimeChangeInvalidationCallback _timeCallback;
175};
176
177PXR_NAMESPACE_CLOSE_SCOPE
178
179#endif
A class that represents a point in time for execution.
Definition: time.h:37
A class that represents an interval in EfTime.
Definition: timeInterval.h:36
A view into values cached by ExecSystem.
Definition: cacheView.h:32
Contains data structures necessary to implement exec requests that are independent of scene descripti...
Definition: requestImpl.h:46
EXEC_API void _Schedule()
Builds the schedule for the request.
void DidInvalidateComputedValues(const Exec_AttributeValueInvalidationResult &invalidationResult)
Notify the request of invalid computed values as a consequence of attribute authored value invalidati...
void Expire()
Expires all request indices and discards the request.
EXEC_API Exec_CacheView _Compute()
Computes the value keys in the request.
EXEC_API void _ExpireIndices(const ExecRequestIndexSet &expired)
Expires the indices in expired.
EXEC_API void _Discard()
Removes the request from the system.
void DidChangeTime(const Exec_TimeChangeInvalidationResult &invalidationResult)
Notify the request of time having changed.
void DidInvalidateUnknownValues()
Notify the request to invalidate value keys that don't have a compiled leaf node.
void DidInvalidateComputedValues(const Exec_DisconnectedInputsInvalidationResult &invalidationResult)
Notify the request of invalid computed values as a consequence of uncompilation.
EXEC_API bool _RequiresCompilation() const
Returns true if the request needs to be compiled.
void DidInvalidateComputedValues(const Exec_MetadataInvalidationResult &invalidationResult)
Notify the request of invalid computed values as a consequence of metadata authored value invalidatio...
EXEC_API void _Compile(TfSpan< const ExecValueKey > valueKeys)
Compiles outputs for the value keys in the request.
Base implementation of a system to procedurally compute values based on scene description and computa...
Definition: system.h:44
Specifies a computed value.
Definition: valueKey.h:29
Fast bit array that keeps track of the number of bits set and can find the next set in a timely manne...
Definition: bits.h:49
Represents a range of contiguous elements.
Definition: span.h:71
Contains a specification of how to execute a particular VdfNetwork.
Definition: schedule.h:41
Implementation of a hash map using open-addressing and the robin hood hashing algorithm with backward...
Definition: robin_map.h:96
Implementation of a hash set using open-addressing and the robin hood hashing algorithm with backward...
Definition: robin_set.h:95