HDK
|
#include <extCompGpuComputation.h>
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 |
HDST_API HdStExtCompGpuComputationResourceSharedPtr const & | 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 HdStExtCompGpuComputationSharedPtr | CreateGpuComputation (HdSceneDelegate *sceneDelegate, HdExtComputation const *sourceComp, HdExtComputationPrimvarDescriptorVector const &compPrimvars) |
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:
Definition at line 85 of file extCompGpuComputation.h.
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.
|
override |
|
static |
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] | sceneDelegate | the delegate to pull scene inputs from. |
[in] | sourceComp | the abstract computation in the HdRenderIndex this instance actually implements. |
[in] | compPrimvars | identifies the primvar data being computed. |
|
overridevirtual |
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] | range | the buffer array range to save the computation result to. |
[in] | resourceRegistry | the registry that is current committing resources to the GPU. |
Implements HdStComputation.
|
overridevirtual |
Adds the output buffer specs generated by this computation to the passed in vector of buffer specs.
[out] | specs | the vector of HdBufferSpec to add this computation output buffer layout requirements to. |
Implements HdStComputation.
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.
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.