This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
HdStExtCompGpuPrimvarBufferSource Class Referencefinal

A buffer source mapped to an output of an ExtComp CPU computation. More...

#include <extCompGpuPrimvarBufferSource.h>

+ Inheritance diagram for HdStExtCompGpuPrimvarBufferSource:

Public Member Functions

 HdStExtCompGpuPrimvarBufferSource (TfToken const &name, HdTupleType const &valueType, int numElements, SdfPath const &compId)
 
virtual HDST_API size_t ComputeHash () const override
 Computes and returns a hash value for the underlying data.
 
virtual HDST_API bool Resolve () override
 Prepare the access of GetData().
 
virtual HDST_API TfToken const & GetName () const override
 Return the name of this buffer source.
 
virtual HDST_API size_t GetNumElements () const override
 Returns the number of elements (e.g.
 
virtual HDST_API HdTupleType GetTupleType () const override
 Returns the data type and count (array size) for this buffer source.
 
virtual HDST_API void GetBufferSpecs (HdBufferSpecVector *specs) const override
 Add the buffer spec for this buffer source into given bufferspec vector.
 
- Public Member Functions inherited from HdNullBufferSource
virtual HD_API TfToken const & GetName () const override
 Return the name of this buffer source.
 
virtual HD_API void const * GetData () const override
 Following interfaces will be called after Resolve.
 
virtual HD_API size_t ComputeHash () const override
 Computes and returns a hash value for the underlying data.
 
virtual HD_API size_t GetNumElements () const override
 Returns the number of elements (e.g.
 
virtual HD_API HdTupleType GetTupleType () const override
 Returns the data type and count (array size) for this buffer source.
 
virtual HD_API void GetBufferSpecs (HdBufferSpecVector *specs) const override
 Add the buffer spec for this buffer source into given bufferspec vector.
 
- Public Member Functions inherited from HdBufferSource
virtual TfToken const & GetName () const =0
 Return the name of this buffer source.
 
virtual void GetBufferSpecs (HdBufferSpecVector *specs) const =0
 Add the buffer spec for this buffer source into given bufferspec vector.
 
virtual HD_API size_t ComputeHash () const
 Computes and returns a hash value for the underlying data.
 
virtual bool Resolve ()=0
 Prepare the access of GetData().
 
virtual void const * GetData () const =0
 Following interfaces will be called after Resolve.
 
virtual HdTupleType GetTupleType () const =0
 Returns the data type and count (array size) for this buffer source.
 
virtual size_t GetNumElements () const =0
 Returns the number of elements (e.g.
 
bool IsResolved () const
 Returns true it this computation has already been resolved.
 
bool HasResolveError () const
 Returns true if an error occurred during resolve.
 
HD_API bool IsValid () const
 Checks the validity of the source buffer.
 
virtual HD_API bool HasPreChainedBuffer () const
 Returns true if this buffer has a pre-chained buffer.
 
virtual HD_API HdBufferSourceSharedPtr GetPreChainedBuffer () const
 Returns the pre-chained buffer.
 
virtual HD_API bool HasChainedBuffer () const
 Returns true if this buffer has any chained buffer(s)
 
virtual HD_API HdBufferSourceSharedPtrVector GetChainedBuffers () const
 Returns the vector of chained buffers.
 

Protected Member Functions

virtual bool _CheckValid () const override
 Checks the validity of the source buffer.
 
- Protected Member Functions inherited from HdBufferSource
void _SetResolved ()
 Marks this buffer source as resolved.
 
void _SetResolveError ()
 Called during Resolve() to indicate an unrecoverable failure occurred and the results of the computation can not be used.
 
bool _TryLock ()
 Non-blocking lock acquisition.
 
virtual bool _CheckValid () const =0
 Checks the validity of the source buffer.
 

Detailed Description

A buffer source mapped to an output of an ExtComp CPU computation.

Definition at line 24 of file extCompGpuPrimvarBufferSource.h.

Member Function Documentation

◆ _CheckValid()

virtual bool _CheckValid ( ) const
overrideprotectedvirtual

Checks the validity of the source buffer.

This function is called by IsValid() to do the real checking.

Should only be implemented in classes at leafs of the class hierarchy (Please place common validation code in a new non-virtual method)

This code should return false:

  • If the buffer would produce an invalid BufferSpec
  • If a required dependent buffer is invalid For example, return false when: The data type is invalid, causing an invalid BufferSpec.

The resolve step requires a 'source' buffer and that buffer is invalid.

If returning false, the buffer will not be registered with the resource registry. AddBufferSpec and Resolve will not be called

Implements HdBufferSource.

◆ ComputeHash()

virtual HDST_API size_t ComputeHash ( ) const
overridevirtual

Computes and returns a hash value for the underlying data.

Reimplemented from HdNullBufferSource.

◆ GetBufferSpecs()

virtual HDST_API void GetBufferSpecs ( HdBufferSpecVector *  specs) const
overridevirtual

Add the buffer spec for this buffer source into given bufferspec vector.

note: buffer specs has to be determined before the source resolution.

Reimplemented from HdNullBufferSource.

◆ GetName()

virtual HDST_API TfToken const & GetName ( ) const
overridevirtual

Return the name of this buffer source.

Reimplemented from HdNullBufferSource.

◆ GetNumElements()

virtual HDST_API size_t GetNumElements ( ) const
overridevirtual

Returns the number of elements (e.g.

VtVec3dArray().GetLength()) from the source array.

Reimplemented from HdNullBufferSource.

◆ GetTupleType()

virtual HDST_API HdTupleType GetTupleType ( ) const
overridevirtual

Returns the data type and count (array size) for this buffer source.

Reimplemented from HdNullBufferSource.

◆ Resolve()

virtual HDST_API bool Resolve ( )
overridevirtual

Prepare the access of GetData().

This process may include some computations (e.g. cpu smooth normals). Note: Resolve may be called in parallel from multiple threads across buffer sources, so be careful if it uses static/shared states among objects. Returns true if it resolved. If the buffer source has to wait some results of other buffer sources, or the buffer source is being resolved by other threads, it returns false.

Implements HdBufferSource.


The documentation for this class was generated from the following file: