All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdStExtCompGpuComputation Class Referencefinal

#include <extCompGpuComputation.h>

+ Inheritance diagram for HdStExtCompGpuComputation:

Public Member Functions

 HdStExtCompGpuComputation (SdfPath const &id, HdStExtCompGpuComputationResourceSharedPtr const &resource, HdExtComputationPrimvarDescriptorVector const &compPrimvars, int dispatchCount, int elementCount)
HDST_API ~HdStExtCompGpuComputation () override
HDST_API void GetBufferSpecs (HdBufferSpecVector *specs) const override
HDST_API void Execute (HdBufferArrayRangeSharedPtr const &range, HdResourceRegistry *resourceRegistry) override
HDST_API int GetDispatchCount () const
HDST_API int GetNumOutputElements () const override
GetResource () const
 Gets the shared GPU resource holder for the computation. More...
- Public Member Functions inherited from HdStComputation
virtual HDST_API ~HdStComputation ()
bool IsValid ()

Static Public Member Functions

static HDST_API
CreateGpuComputation (HdSceneDelegate *sceneDelegate, HdExtComputation const *sourceComp, HdExtComputationPrimvarDescriptorVector const &compPrimvars)

Detailed Description

A Computation that represents a GPU implementation of a ExtComputation.

The computation implements the basic: input HdBufferArrayRange -> processing -> output HdBufferArrayRange model of HdStComputations where processing happens in Execute during the Execute phase of HdResourceRegistry::Commit.

The computation is performed in three stages by three companion classes:

  1. Input HdBuffersources are committed into the input HdBufferArrayRange during the Resolve phase of the HdResourceRegistry::Commit processing.
  2. HdStExtCompGpuComputationResource holds the committed GPU resident resources along with the compiled compute shading kernel to execute. The values of the HdBufferArrayRanges for the inputs are stored in this object. The resource can store heterogenous sources with differing number of elements as may be required by computations.
  3. HdStExtCompGpuComputation executes the kernel using the committed GPU resident resources and stores the results to the destination HdBufferArrayRange given in Execute. The destination HdBufferArrayRange is allocated by the owning HdRprim that registers the computation with the HdResourceRegistry by calling HdResourceRegistry::AddComputation.
See Also

Definition at line 85 of file extCompGpuComputation.h.

Constructor & Destructor Documentation

HdStExtCompGpuComputation::HdStExtCompGpuComputation ( SdfPath const id,
HdStExtCompGpuComputationResourceSharedPtr const resource,
HdExtComputationPrimvarDescriptorVector const compPrimvars,
int  dispatchCount,
int  elementCount 

Constructs a new GPU ExtComputation computation. resource provides the set of input data and kernel to execute this computation. compPrimvars identifies the primvar data being computed

dispatchCount specifies the number of kernel invocations to execute. elementCount specifies the number of elements to allocate for output.

HDST_API HdStExtCompGpuComputation::~HdStExtCompGpuComputation ( )

Member Function Documentation

static HDST_API HdStExtCompGpuComputationSharedPtr HdStExtCompGpuComputation::CreateGpuComputation ( HdSceneDelegate sceneDelegate,
HdExtComputation const sourceComp,
HdExtComputationPrimvarDescriptorVector const compPrimvars 

Creates a GPU computation implementing the given abstract computation. When created this allocates HdStExtCompGpuComputationResource. Nothing is assigned GPU resources unless the source is subsequently added to the hdResourceRegistry and the registry is committed.

This delayed allocation allow Rprims to share computed primvar data and avoid duplicate allocations GPU resources for computation inputs and outputs.

[in]sceneDelegatethe delegate to pull scene inputs from.
[in]sourceCompthe abstract computation in the HdRenderIndex this instance actually implements.
[in]compPrimvarsidentifies the primvar data being computed.
See Also
HDST_API void HdStExtCompGpuComputation::Execute ( HdBufferArrayRangeSharedPtr const range,
HdResourceRegistry resourceRegistry 

Executes the computation on the GPU. Called by HdResourceRegistry::Commit with the HdBufferArrayRange given to the HdResourceRegistry when the computation was added to the registry.

[in,out]rangethe buffer array range to save the computation result to.
[in]resourceRegistrythe registry that is current committing resources to the GPU.

Implements HdStComputation.

HDST_API void HdStExtCompGpuComputation::GetBufferSpecs ( HdBufferSpecVector specs) const

Adds the output buffer specs generated by this computation to the passed in vector of buffer specs.

[out]specsthe vector of HdBufferSpec to add this computation output buffer layout requirements to.

Implements HdStComputation.

HDST_API int HdStExtCompGpuComputation::GetDispatchCount ( ) const

Gets the number of GPU kernel invocations to execute. It can be useful for this to be different than the number of output elements, e.g. to run a per-curve kernel computing multiple points per-curve.

HDST_API int HdStExtCompGpuComputation::GetNumOutputElements ( ) const

Gets the number of elements in the output primvar. The number of elements produced by the computation must be known before doing the computation. The allocation of GPU resources needs to know the size to allocate before the kernel can run.

Implements HdStComputation.

HDST_API HdStExtCompGpuComputationResourceSharedPtr const& HdStExtCompGpuComputation::GetResource ( ) const

Gets the shared GPU resource holder for the computation.

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