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>;
81 HdDirtyBits* dirtyBits) = 0;
102 virtual void Prepare(HdTaskContext* ctx,
114 virtual void Execute(HdTaskContext* ctx) = 0;
137 SdfPath const& GetId()
const {
return _id; }
143 virtual HdDirtyBits GetInitialDirtyBitsMask()
const;
149 static bool _HasTaskContextData(HdTaskContext
const* ctx,
160 static bool _GetTaskContextData(HdTaskContext
const* ctx,
182 HdTaskContext
const* ctx,
189 HdTask(
const HdTask &) =
delete;
190 HdTask &operator =(
const HdTask &) =
delete;
196HdTask::_GetTaskContextData(HdTaskContext
const* ctx,
206 HdTaskContext::const_iterator valueIt = ctx->find(
id);
207 if (valueIt == ctx->cend()) {
212 const VtValue &valueVt = (valueIt->second);
231 SdfPath const& taskId = GetId();
233 VtValue valueVt = delegate->
Get(taskId, HdTokens->params);
248 HdTaskContext
const* ctx,
251 auto it = ctx->find(HdTokens->drivers);
252 if (it != ctx->end()) {
253 VtValue const& value = it->second;
255 HdDriverVector
const& drivers= value.
UncheckedGet<HdDriverVector>();
256 for (
HdDriver* hdDriver : drivers) {
257 if (hdDriver->name == driverName) {
258 if (hdDriver->driver.IsHolding<T>()) {
259 return hdDriver->driver.UncheckedGet<T>();
269PXR_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.
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.