24#ifndef PXR_IMAGING_HD_TASK_H
25#define PXR_IMAGING_HD_TASK_H
28#include "pxr/imaging/hd/api.h"
29#include "pxr/imaging/hd/driver.h"
30#include "pxr/imaging/hd/version.h"
32#include "pxr/imaging/hd/sceneDelegate.h"
34#include "pxr/usd/sdf/path.h"
35#include "pxr/base/tf/hashmap.h"
36#include "pxr/base/vt/value.h"
41#include <unordered_map>
43PXR_NAMESPACE_OPEN_SCOPE
46using HdTaskSharedPtr = std::shared_ptr<class HdTask>;
47using HdTaskSharedPtrVector = std::vector<HdTaskSharedPtr>;
52 std::unordered_map<TfToken, VtValue, TfToken::HashFunctor>;
98 HdDirtyBits* dirtyBits) = 0;
119 virtual void Prepare(HdTaskContext* ctx,
131 virtual void Execute(HdTaskContext* ctx) = 0;
154 SdfPath const& GetId()
const {
return _id; }
160 virtual HdDirtyBits GetInitialDirtyBitsMask()
const;
166 static bool _HasTaskContextData(HdTaskContext
const* ctx,
177 static bool _GetTaskContextData(HdTaskContext
const* ctx,
199 HdTaskContext
const* ctx,
206 HdTask(
const HdTask &) =
delete;
207 HdTask &operator =(
const HdTask &) =
delete;
213HdTask::_GetTaskContextData(HdTaskContext
const* ctx,
223 HdTaskContext::const_iterator valueIt = ctx->find(
id);
224 if (valueIt == ctx->cend()) {
229 const VtValue &valueVt = (valueIt->second);
248 SdfPath const& taskId = GetId();
250 VtValue valueVt = delegate->
Get(taskId, HdTokens->params);
265 HdTaskContext
const* ctx,
268 auto it = ctx->find(HdTokens->drivers);
269 if (it != ctx->end()) {
270 VtValue const& value = it->second;
272 HdDriverVector
const& drivers= value.
UncheckedGet<HdDriverVector>();
273 for (
HdDriver* hdDriver : drivers) {
274 if (hdDriver->name == driverName) {
275 if (hdDriver->driver.IsHolding<T>()) {
276 return hdDriver->driver.UncheckedGet<T>();
286PXR_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.