7#ifndef PXR_EXEC_VDF_SMBL_DATA_H
8#define PXR_EXEC_VDF_SMBL_DATA_H
14#include "pxr/exec/vdf/api.h"
20PXR_NAMESPACE_OPEN_SCOPE
59 const VdfMask &invalidationMask);
68 *lockedCacheMask = _cachedExtend(*lockedCacheMask, cacheMask);
90 return !_cachedAffective(lockedCacheMask, affectsMask);
144 return _cache && !_cacheMask.
IsEmpty();
158 template <
typename R,
typename OP >
159 class _MaskOpMemoizer
164 _result(OP()(_opA, _opB))
170 if (_opA != opA || _opB != opB) {
173 _result = OP()(opA, opB);
193 struct _MaskSubtract {
200 struct _MaskSetOrAppend {
203 res.SetOrAppend(rhs);
209 struct _MaskContains {
216 _MaskOpMemoizer<VdfMask, _MaskSubtract> _cachedInvalidate;
219 _MaskOpMemoizer<VdfMask, _MaskSetOrAppend> _cachedExtend;
222 _MaskOpMemoizer<bool, _MaskContains> _cachedAffective;
226 _MaskOpMemoizer<VdfMask, _MaskSubtract> _cachedRequiredMask;
230 _MaskOpMemoizer<VdfMask, _MaskSubtract> _cachedRequiredLockedCache;
242 const VdfMask &invalidationMask)
246 : _cachedInvalidate(cacheMask, invalidationMask);
261 : _cachedRequiredMask(keepMask, cacheMask);
264 *lockedCacheMask = _cachedRequiredLockedCache(*lockedCacheMask, uncached);
284 _cacheMask = cacheMask;
290PXR_NAMESPACE_CLOSE_SCOPE
A VdfMask is placed on connections to specify the data flowing through them.
bool IsEmpty() const
Returns true if this mask is empty, i.e.
bool Contains(const VdfMask &mask) const
Returns true if mask is a subset-of or equal to this mask, false otherwise.
A VdfOuptutSpec describes an output connector.
VDF_API VdfVector * AllocateCache() const
Allocate a new VdfVector with this spec's type.
VdfSMBLData holds per-output data that is meant to be consumed by the executor.
void RemoveUncachedMask(VdfMask *lockedCacheMask, const VdfMask &cacheMask, const VdfMask &keepMask)
Make sure that all the bits in the keepMask are provided by the cacheMask.
VdfVector * Retain(const VdfOutputSpec &spec, VdfVector *cache, const VdfMask &cacheMask)
Locally retains the passed in cache with the given cacheMask.
VdfVector * GetCache() const
Returns a pointer to the locally retained cache, if any.
VdfMask InvalidateCacheMask(const VdfMask &cacheMask, const VdfMask &invalidationMask)
Invalidates the executor cacheMask given an invalidationMask.
VdfSMBLData(const VdfSMBLData &)=delete
Noncopyable.
const VdfMask & GetCacheMask() const
Returns a mask indicating data available in the locally retained cache.
void Release()
Releases the cache, which has been retained by this object, if any.
bool HasCache() const
Returns true, if a cache has been retained locally, and false if there is no such cache.
bool ComputeAffectiveness(const VdfMask &lockedCacheMask, const VdfMask &affectsMask)
Computes the affectiveness of the corresponding output given the accumulated lockedCacheMask and the ...
void ExtendLockedCacheMask(VdfMask *lockedCacheMask, const VdfMask &cacheMask)
Extends the lockedCacheMask by appending the bits stored in the executor cacheMask.
VDF_API void Clear()
Clear any of the data this object is holding on to.
VdfSMBLData()
Constructs an SMBL data object.
This class is used to abstract away knowledge of the cache data used for each node.
typename std::conditional_t< std::is_pointer_v< T >||Vdf_AndTypeIsSmall< T, std::is_arithmetic_v< T > >||Vdf_AndTypeIsSmall< T, std::is_enum_v< T > >, T, const T & > VdfByValueOrConstRef
Template that evaluates to either T or const T & depending on whether T best be passed as value or co...