7 #ifndef PXR_EXEC_VDF_EXECUTOR_BUFFER_DATA_H
8 #define PXR_EXEC_VDF_EXECUTOR_BUFFER_DATA_H
132 static constexpr
uintptr_t _IsOwnedFlag = 1 << 0;
135 static constexpr
uintptr_t _IsOccupiedFlag = 1 << 1;
138 static constexpr
uintptr_t _FlagsMask = _IsOwnedFlag | _IsOccupiedFlag;
142 return reinterpret_cast<VdfVector *
>(
reinterpret_cast<void *
>(
v));
147 return reinterpret_cast<uintptr_t>(
reinterpret_cast<void *
>(
v));
152 return _CastToPointer(_CastToInteger(cacheAndFlags) & ~_FlagsMask);
157 return _CastToInteger(cacheAndFlags) & _FlagsMask;
163 return _CastToPointer(_CastToInteger(cacheAndFlags) | flags);
169 return _CastToPointer(_CastToInteger(cacheAndFlags) & ~flags);
184 std::atomic<VdfVector *> _cacheAndFlags;
196 VdfVector *cacheAndFlags = _cacheAndFlags.load(std::memory_order_acquire);
200 if (_GetCache(cacheAndFlags) && _GetFlags(cacheAndFlags) & _IsOwnedFlag) {
201 _cacheAndFlags.store(
202 _SetFlags(cacheAndFlags, _IsOccupiedFlag),
203 std::memory_order_release);
204 return _GetCache(cacheAndFlags);
211 _cacheAndFlags.store(
212 _SetFlags(newCache, _IsOwnedFlag | _IsOccupiedFlag),
213 std::memory_order_release);
232 VdfVector *cacheAndFlags = _cacheAndFlags.load(std::memory_order_acquire);
234 rhs->_cacheAndFlags.load(std::memory_order_acquire);
236 _cacheAndFlags.store(rhsCacheAndFlags, std::memory_order_release);
237 rhs->_cacheAndFlags.store(cacheAndFlags, std::memory_order_release);
239 return _GetCache(rhsCacheAndFlags);
245 VdfVector *cacheAndFlags = _cacheAndFlags.load(std::memory_order_acquire);
246 return (_GetFlags(cacheAndFlags) & _IsOccupiedFlag)
247 ? _GetCache(cacheAndFlags)
262 VdfVector *cacheAndFlags = _cacheAndFlags.load(std::memory_order_acquire);
263 if (_GetFlags(cacheAndFlags) & _IsOccupiedFlag) {
264 _cacheAndFlags.store(
265 _UnsetFlags(cacheAndFlags, _IsOccupiedFlag),
266 std::memory_order_release);
290 VdfVector *cacheAndFlags = _cacheAndFlags.load(std::memory_order_relaxed);
291 return (_GetFlags(cacheAndFlags) & _IsOwnedFlag) != 0;
297 VdfVector *cacheAndFlags = _cacheAndFlags.load(std::memory_order_acquire);
298 _cacheAndFlags.store(
299 _UnsetFlags(cacheAndFlags, _IsOwnedFlag), std::memory_order_release);
310 _cacheAndFlags.store(
311 _SetFlags(v, _IsOccupiedFlag), std::memory_order_release);
322 _cacheAndFlags.store(
323 _SetFlags(v, _IsOccupiedFlag | _IsOwnedFlag),
324 std::memory_order_release);
void TakeOwnership(VdfVector *v)
VDF_API VdfVector * AllocateCache() const
Allocate a new VdfVector with this spec's type.
#define PXR_NAMESPACE_OPEN_SCOPE
bool HasOwnership() const
A VdfMask is placed on connections to specify the data flowing through them.
VDF_API VdfMask ReleaseExecutorCache(VdfSMBLData *smblData)
Fast, compressed bit array which is capable of performing logical operations without first decompress...
#define TF_DEV_AXIOM(cond)
VdfVector * CreateExecutorCache(const VdfOutputSpec &spec)
VdfSMBLData holds per-output data that is meant to be consumed by the executor. This data is an optio...
void SetExecutorCacheMask(const VdfMask &mask)
This object is responsible for storing the executor buffer data, comprised of the executor cache vect...
VdfExecutorBufferData & operator=(const VdfExecutorBufferData &)=delete
const VdfMask & GetExecutorCacheMask() const
#define PXR_NAMESPACE_CLOSE_SCOPE
void ResetExecutorCache()
VdfVector * SwapExecutorCache(VdfExecutorBufferData *rhs)
VdfVector * GetExecutorCache() const
VDF_API void Clone(VdfExecutorBufferData *dest) const
VDF_API void ResizeCache(VdfVector *vector, const VdfMask::Bits &bits) const
Resize an existing VdfVector to accomodate all the data set in the bits.
VDF_API ~VdfExecutorBufferData()
VDF_API void RetainExecutorCache(const VdfOutputSpec &spec, VdfSMBLData *smblData)