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#include "pxr/exec/exec/types.h"
15
16#include "pxr/base/tf/bits.h"
17#include "pxr/base/tf/pxrTslRobinMap/robin_map.h"
20#include "pxr/exec/vdf/types.h"
21
22#include <memory>
23#include <vector>
24
25PXR_NAMESPACE_OPEN_SCOPE
26
27class EfTime;
28struct Exec_AttributeValueInvalidationResult;
29class Exec_CacheView;
30struct Exec_DisconnectedInputsInvalidationResult;
31struct Exec_MetadataInvalidationResult;
32class Exec_TimeChangeInvalidationResult;
33class Exec_ValueExtractor;
34class ExecSystem;
35class ExecValueKey;
36template <typename> class TfSpan;
37class VdfRequest;
38class VdfSchedule;
39
47{
48public:
53 const Exec_AttributeValueInvalidationResult &invalidationResult);
54
59 const Exec_MetadataInvalidationResult &invalidationResult);
60
65 const Exec_DisconnectedInputsInvalidationResult &invalidationResult);
66
69 const Exec_TimeChangeInvalidationResult &invalidationResult);
70
76 void Expire();
77
78protected:
79 EXEC_API
81 ExecSystem *system,
82 ExecRequestComputedValueInvalidationCallback &&valueCallback,
83 ExecRequestTimeChangeInvalidationCallback &&timeCallback);
84
85 Exec_RequestImpl(const Exec_RequestImpl&) = delete;
86 Exec_RequestImpl& operator=(const Exec_RequestImpl&) = delete;
87
88 EXEC_API
90
92 EXEC_API
94
96 EXEC_API
97 void _Schedule();
98
100 EXEC_API
102
108 EXEC_API
110
117 EXEC_API
119
125 EXEC_API
126 void _Discard();
127
128private:
129 // Ensures the _leafNodeToIndex map is up-to-date.
130 void _BuildLeafNodeToIndexMap();
131
132 // Turns invalid leaf nodes into a set of requested - and not previously
133 // invalidated - indices.
134 //
135 void _InvalidateLeafOutputs(
136 bool isNewlyInvalidInterval,
138 ExecRequestIndexSet *invalidIndices);
139
140private:
141 // The system that issued this request.
142 ExecSystem *_system;
143
144 // The compiled leaf output.
145 std::vector<VdfMaskedOutput> _leafOutputs;
146
147 // Value extractors corresponding to each requested value.
148 std::vector<Exec_ValueExtractor> _extractors;
149
150 // Maps leaf nodes to their index in the array of valueKeys the request
151 // was built with.
152 pxr_tsl::robin_map<VdfId, size_t> _leafNodeToIndex;
153
154 // The compute request to cache values with.
155 std::unique_ptr<VdfRequest> _computeRequest;
156
157 // The schedule to cache values with.
158 std::unique_ptr<VdfSchedule> _schedule;
159
160 // The combined time interval for which invalidation has been sent out.
161 EfTimeInterval _lastInvalidatedInterval;
162
163 // The combined set of indices for which invalidation has been sent out.
164 TfBits _lastInvalidatedIndices;
165
166 // The invalidation callback to invoke when computed values change.
167 ExecRequestComputedValueInvalidationCallback _valueCallback;
168
169 // The invalidation callback to invoke when time changes.
170 ExecRequestTimeChangeInvalidationCallback _timeCallback;
171};
172
173PXR_NAMESPACE_CLOSE_SCOPE
174
175#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:47
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 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
This file contains definitions for trivial types, including type aliases, so that source files that r...