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>
26PXR_NAMESPACE_OPEN_SCOPE
29using HdTaskSharedPtr = std::shared_ptr<class HdTask>;
30using HdTaskSharedPtrVector = std::vector<HdTaskSharedPtr>;
35 std::unordered_map<TfToken, VtValue, TfToken::HashFunctor>;
87 HdDirtyBits* dirtyBits) = 0;
143 SdfPath const& GetId()
const {
return _id; }
188 HdTaskContext
const* ctx,
212 HdTaskContext::const_iterator valueIt = ctx->find(
id);
213 if (valueIt == ctx->cend()) {
218 const VtValue &valueVt = (valueIt->second);
237 SdfPath const& taskId = GetId();
239 VtValue valueVt = delegate->
Get(taskId, HdTokens->params);
254 HdTaskContext
const* ctx,
257 auto it = ctx->find(HdTokens->drivers);
258 if (it != ctx->end()) {
259 VtValue const& value = it->second;
261 HdDriverVector
const& drivers= value.
UncheckedGet<HdDriverVector>();
262 for (
HdDriver* hdDriver : drivers) {
263 if (hdDriver->name == driverName) {
264 if (hdDriver->driver.IsHolding<T>()) {
265 return hdDriver->driver.UncheckedGet<T>();
275PXR_NAMESPACE_CLOSE_SCOPE
HdDriver represents a device object, commonly a render device, that is owned by the application and p...
The Hydra render index is a flattened representation of the client scene graph, which may be composed...
Adapter class providing data exchange with the client scene graph.
virtual HD_API VtValue Get(SdfPath const &id, TfToken const &key)
Returns a named value.
HdTask represents a unit of work to perform during a Hydra render.
static bool _GetTaskContextData(HdTaskContext const *ctx, TfToken const &id, T *outValue)
Extracts a typed value out of the task context at the given id.
HD_API HdTask(SdfPath const &id)
Construct a new task.
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.
virtual void Execute(HdTaskContext *ctx)=0
Execute Phase: Runs the task.
virtual HD_API const TfTokenVector & GetRenderTags() const
Render Tag Gather.
static T _GetDriver(HdTaskContext const *ctx, TfToken const &driverName)
Extract an object from a HdDriver inside the task context.
virtual void Prepare(HdTaskContext *ctx, HdRenderIndex *renderIndex)=0
Prepare Phase: Resolve bindings and manage resources.
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 HdDirtyBits GetInitialDirtyBitsMask() const
Returns the minimal set of dirty bits to place in the change tracker for use in the first sync of thi...
A path value used to locate objects in layers or scenegraphs.
SDF_API const char * GetText() const
Returns the string representation of this path as a c string.
Token for efficient comparison, assignment, and hashing of known strings.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
bool IsHolding() const
Return true if this value is holding an object of type T, false otherwise.
T const & UncheckedGet() const &
Returns a const reference to the held object if the held object is of type T.
#define TF_DEV_AXIOM(cond)
The same as TF_AXIOM, but compiled only in dev builds.
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
std::vector< TfToken > TfTokenVector
Convenience types.