7 #ifndef PXR_IMAGING_HD_TASK_H 8 #define PXR_IMAGING_HD_TASK_H 11 #include "pxr/imaging/hd/api.h" 12 #include "pxr/imaging/hd/driver.h" 13 #include "pxr/imaging/hd/version.h" 15 #include "pxr/imaging/hd/sceneDelegate.h" 17 #include "pxr/usd/sdf/path.h" 18 #include "pxr/base/tf/hashmap.h" 19 #include "pxr/base/vt/value.h" 24 #include <unordered_map> 26 PXR_NAMESPACE_OPEN_SCOPE
29 using HdTaskSharedPtr = std::shared_ptr<class HdTask>;
30 using HdTaskSharedPtrVector = std::vector<HdTaskSharedPtr>;
35 std::unordered_map<TfToken, VtValue, TfToken::HashFunctor>;
100 HdDirtyBits* dirtyBits) = 0;
121 virtual void Prepare(HdTaskContext* ctx,
133 virtual void Execute(HdTaskContext* ctx) = 0;
156 SdfPath const& GetId()
const {
return _id; }
201 HdTaskContext
const* ctx,
225 HdTaskContext::const_iterator valueIt = ctx->find(
id);
226 if (valueIt == ctx->cend()) {
231 const VtValue &valueVt = (valueIt->second);
250 SdfPath const& taskId = GetId();
252 VtValue valueVt = delegate->
Get(taskId, HdTokens->params);
267 HdTaskContext
const* ctx,
270 auto it = ctx->find(HdTokens->drivers);
271 if (it != ctx->end()) {
272 VtValue const& value = it->second;
274 HdDriverVector
const& drivers= value.
UncheckedGet<HdDriverVector>();
275 for (
HdDriver* hdDriver : drivers) {
276 if (hdDriver->name == driverName) {
277 if (hdDriver->driver.IsHolding<T>()) {
278 return hdDriver->driver.UncheckedGet<T>();
288 PXR_NAMESPACE_CLOSE_SCOPE
290 #endif // PXR_IMAGING_HD_TASK_H #define TF_DEV_AXIOM(cond)
The same as TF_AXIOM, but compiled only in dev builds.
The render index is part of the Hydra 1.0 API and is only used for emulation purposes so that HdScene...
T const & UncheckedGet() const &
Returns a const reference to the held object if the held object is of type T.
virtual void Sync(HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits)=0
Sync Phase: Obtain task state from Scene delegate based on change processing.
virtual HD_API VtValue Get(SdfPath const &id, TfToken const &key)
Returns a named value.
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
SDF_API const char * GetText() const
Returns the string representation of this path as a c string.
static bool _GetTaskContextData(HdTaskContext const *ctx, TfToken const &id, T *outValue)
Extracts a typed value out of the task context at the given id.
virtual HD_API const TfTokenVector & GetRenderTags() const
Render Tag Gather.
virtual void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex)=0
Prepare Phase: Resolve bindings and manage resources.
virtual HD_API HdDirtyBits GetInitialDirtyBitsMask() const
Returns the minimal set of dirty bits to place in the change tracker for use in the first sync of thi...
Token for efficient comparison, assignment, and hashing of known strings.
HdDriver represents a device object, commonly a render device, that is owned by the application and p...
virtual void Execute(HdTaskContext *ctx)=0
Execute Phase: Runs the task.
Adapter class providing data exchange with the client scene graph.
std::vector< TfToken > TfTokenVector
Convenience types.
HdTask represents a unit of work to perform during a Hydra render.
A path value used to locate objects in layers or scenegraphs.
virtual HD_API bool IsConverged() const
This function returns true when a (progressive) task considers its execution results converged.
static T _GetDriver(HdTaskContext const *ctx, TfToken const &driverName)
Extract an object from a HdDriver inside the task context.
bool _GetTaskParams(HdSceneDelegate *delegate, T *outValue)
Extracts a typed value out of the task context at the given id.
static HD_API bool _HasTaskContextData(HdTaskContext const *ctx, TfToken const &id)
Check if the shared context contains a value for the given id.
bool IsHolding() const
Return true if this value is holding an object of type T, false otherwise.
Provides a container which may hold any type, and provides introspection and iteration over array typ...