Loading...
Searching...
No Matches
HdStExtCompCpuComputation Class Referencefinal

A Buffer Source that represents a CPU implementation of a ExtComputation. More...

#include <extCompCpuComputation.h>

+ Inheritance diagram for HdStExtCompCpuComputation:

Public Member Functions

 HdStExtCompCpuComputation (const SdfPath &id, const HdSt_ExtCompInputSourceSharedPtrVector &inputs, const TfTokenVector &outputs, int numElements, HdSceneDelegate *sceneDelegate)
 Constructs a new Cpu ExtComputation source.
 
HDST_API TfToken const & GetName () const override
 Returns the id for this computation as a token.
 
HDST_API bool Resolve () override
 Ask the scene delegate to run the computation and captures the output signals.
 
HDST_API size_t GetNumElements () const override
 Returns the number of elements (e.g.
 
HDST_API size_t GetOutputIndex (const TfToken &outputName) const
 Converts a output name token into an index.
 
HDST_API const VtValueGetOutputByIndex (size_t index) const
 Returns the value of the specified output (after the computations been Resolved).
 
- 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.
 

Static Public Member Functions

static HDST_API HdStExtCompCpuComputationSharedPtr CreateComputation (HdSceneDelegate *sceneDelegate, const HdExtComputation &computation, HdBufferSourceSharedPtrVector *computationSources)
 Create a CPU computation implementing the given abstract computation.
 

Static Public Attributes

static HDST_API const size_t INVALID_OUTPUT_INDEX
 

Protected Member Functions

HDST_API bool _CheckValid () const override
 Returns if the computation is specified correctly.
 
- 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 that represents a CPU implementation of a ExtComputation.

The computation implements the basic: input->processing->output model where the inputs are other buffer sources and processing happens during resolve.

As a computation may have many outputs, the outputs from the CPU Computation can not be directly associated with a BAR. Instead other buffer source computation bind the output to sources that can be used in a BAR.

Outputs to a computation are in SOA form, so a computation may have many outputs, but each output has the same number of elements in it.

Definition at line 67 of file extCompCpuComputation.h.

Constructor & Destructor Documentation

◆ HdStExtCompCpuComputation()

HdStExtCompCpuComputation ( const SdfPath id,
const HdSt_ExtCompInputSourceSharedPtrVector &  inputs,
const TfTokenVector outputs,
int  numElements,
HdSceneDelegate sceneDelegate 
)

Constructs a new Cpu ExtComputation source.

inputs provides a list of buffer sources that this computation requires. outputs is a list of outputs by names that the computation produces.

Num elements specifies the number of elements in the output.

sceneDelegate and id are used to callback to the scene delegate in order to invoke computation processing.

Member Function Documentation

◆ _CheckValid()

HDST_API bool _CheckValid ( ) const
overrideprotectedvirtual

Returns if the computation is specified correctly.

Implements HdBufferSource.

◆ CreateComputation()

static HDST_API HdStExtCompCpuComputationSharedPtr CreateComputation ( HdSceneDelegate sceneDelegate,
const HdExtComputation computation,
HdBufferSourceSharedPtrVector *  computationSources 
)
static

Create a CPU computation implementing the given abstract computation.

The scene delegate identifies which delegate to pull scene inputs from.

◆ GetName()

HDST_API TfToken const & GetName ( ) const
overridevirtual

Returns the id for this computation as a token.

Reimplemented from HdNullBufferSource.

◆ GetNumElements()

HDST_API size_t GetNumElements ( ) const
overridevirtual

Returns the number of elements (e.g.

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

Reimplemented from HdNullBufferSource.

◆ GetOutputByIndex()

HDST_API const VtValue & GetOutputByIndex ( size_t  index) const

Returns the value of the specified output (after the computations been Resolved).

◆ GetOutputIndex()

HDST_API size_t GetOutputIndex ( const TfToken outputName) const

Converts a output name token into an index.

◆ Resolve()

HDST_API bool Resolve ( )
overridevirtual

Ask the scene delegate to run the computation and captures the output signals.

Implements HdBufferSource.

Member Data Documentation

◆ INVALID_OUTPUT_INDEX

HDST_API const size_t INVALID_OUTPUT_INDEX
static

Definition at line 71 of file extCompCpuComputation.h.


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