Loading...
Searching...
No Matches
extCompGpuComputation.h
1//
2// Copyright 2017 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HD_ST_EXT_COMP_GPU_COMPUTATION_H
8#define PXR_IMAGING_HD_ST_EXT_COMP_GPU_COMPUTATION_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12#include "pxr/imaging/hdSt/computation.h"
13#include "pxr/imaging/hdSt/extCompGpuComputationResource.h"
14
15#include "pxr/imaging/hd/bufferSource.h"
16
17#include "pxr/usd/sdf/path.h"
18#include "pxr/base/tf/token.h"
19#include "pxr/base/vt/value.h"
20
21#include <memory>
22#include <vector>
23
24PXR_NAMESPACE_OPEN_SCOPE
25
26
27class HdSceneDelegate;
29using HdStGLSLProgramSharedPtr= std::shared_ptr<class HdStGLSLProgram>;
30using HdExtComputationPrimvarDescriptorVector =
31 std::vector<struct HdExtComputationPrimvarDescriptor>;
32
33using HdStExtCompGpuComputationSharedPtr =
34 std::shared_ptr<class HdStExtCompGpuComputation>;
35
36
69{
70public:
79 SdfPath const &id,
80 HdStExtCompGpuComputationResourceSharedPtr const &resource,
81 HdExtComputationPrimvarDescriptorVector const &compPrimvars,
82 int dispatchCount,
83 int elementCount);
84
99 HDST_API
100 static HdStExtCompGpuComputationSharedPtr
102 HdSceneDelegate *sceneDelegate,
103 HdExtComputation const *sourceComp,
104 HdExtComputationPrimvarDescriptorVector const &compPrimvars);
105
106 HDST_API
108
113 HDST_API
114 void GetBufferSpecs(HdBufferSpecVector *specs) const override;
115
124 HDST_API
125 void Execute(HdBufferArrayRangeSharedPtr const &range,
126 HdResourceRegistry *resourceRegistry) override;
127
132 HDST_API
133 int GetDispatchCount() const;
134
139 HDST_API
140 int GetNumOutputElements() const override;
141
143 HDST_API
144 HdStExtCompGpuComputationResourceSharedPtr const &GetResource() const;
145
146private:
147 SdfPath _id;
148 HdStExtCompGpuComputationResourceSharedPtr _resource;
149 HdExtComputationPrimvarDescriptorVector _compPrimvars;
150 int _dispatchCount;
151 int _elementCount;
152
153 HdStExtCompGpuComputation() = delete;
155 const HdStExtCompGpuComputation &) = delete;
156 HdStExtCompGpuComputation &operator = (
157 const HdStExtCompGpuComputation &) = delete;
158};
159
160
185HDST_API
186void HdSt_GetExtComputationPrimvarsComputations(
187 const SdfPath &id,
188 HdSceneDelegate *sceneDelegate,
189 HdExtComputationPrimvarDescriptorVector const& allCompPrimvars,
190 HdDirtyBits dirtyBits,
191 HdBufferSourceSharedPtrVector *sources,
192 HdBufferSourceSharedPtrVector *reserveOnlySources,
193 HdBufferSourceSharedPtrVector *separateComputationSources,
194 HdStComputationComputeQueuePairVector *computations);
195
196
197PXR_NAMESPACE_CLOSE_SCOPE
198
199#endif // PXR_IMAGING_HD_ST_EXT_COMP_GPU_COMPUTATION_H
Hydra Representation of a Client defined computation.
A central registry for resources.
Adapter class providing data exchange with the client scene graph.
An interface class for GPU computation.
Definition: computation.h:36
A Computation that represents a GPU implementation of a ExtComputation.
HDST_API void Execute(HdBufferArrayRangeSharedPtr const &range, HdResourceRegistry *resourceRegistry) override
Executes the computation on the GPU.
HDST_API HdStExtCompGpuComputationResourceSharedPtr const & GetResource() const
Gets the shared GPU resource holder for the computation.
HDST_API void GetBufferSpecs(HdBufferSpecVector *specs) const override
Adds the output buffer specs generated by this computation to the passed in vector of buffer specs.
HDST_API int GetNumOutputElements() const override
Gets the number of elements in the output primvar.
HDST_API int GetDispatchCount() const
Gets the number of GPU kernel invocations to execute.
static HDST_API HdStExtCompGpuComputationSharedPtr CreateGpuComputation(HdSceneDelegate *sceneDelegate, HdExtComputation const *sourceComp, HdExtComputationPrimvarDescriptorVector const &compPrimvars)
Creates a GPU computation implementing the given abstract computation.
HdStExtCompGpuComputation(SdfPath const &id, HdStExtCompGpuComputationResourceSharedPtr const &resource, HdExtComputationPrimvarDescriptorVector const &compPrimvars, int dispatchCount, int elementCount)
Constructs a new GPU ExtComputation computation.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...