HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdImaging_TestTask Class Referencefinal

A simple test task that just causes sync processing. More...

#include <unitTestHelper.h>

+ Inheritance diagram for UsdImaging_TestTask:

Public Member Functions

 UsdImaging_TestTask (HdRenderPassSharedPtr const &renderPass, TfTokenVector const &renderTags)
 
virtual void Sync (HdSceneDelegate *delegate, HdTaskContext *ctx, HdDirtyBits *dirtyBits) override
 
virtual void Prepare (HdTaskContext *ctx, HdRenderIndex *renderIndex) override
 
virtual void Execute (HdTaskContext *ctx) override
 
virtual const TfTokenVectorGetRenderTags () const override
 
- Public Member Functions inherited from HdTask
HD_API HdTask (SdfPath const &id)
 
virtual HD_API ~HdTask ()
 
SdfPath constGetId () const
 
virtual HD_API HdDirtyBits GetInitialDirtyBitsMask () const
 

Additional Inherited Members

- Protected Member Functions inherited from HdTask
template<class T >
bool _GetTaskParams (HdSceneDelegate *delegate, T *outValue)
 
HD_API TfTokenVector _GetTaskRenderTags (HdSceneDelegate *delegate)
 
- Static Protected Member Functions inherited from HdTask
static HD_API bool _HasTaskContextData (HdTaskContext const *ctx, TfToken const &id)
 Check if the shared context contains a value for the given id. More...
 
template<class T >
static bool _GetTaskContextData (HdTaskContext const *ctx, TfToken const &id, T *outValue)
 
template<class T >
static T _GetDriver (HdTaskContext const *ctx, TfToken const &driverName)
 

Detailed Description

A simple test task that just causes sync processing.

Definition at line 50 of file unitTestHelper.h.

Constructor & Destructor Documentation

UsdImaging_TestTask::UsdImaging_TestTask ( HdRenderPassSharedPtr const renderPass,
TfTokenVector const renderTags 
)
inline

Definition at line 53 of file unitTestHelper.h.

Member Function Documentation

virtual void UsdImaging_TestTask::Execute ( HdTaskContext ctx)
inlineoverridevirtual

Execute Phase: Runs the task.

The execution phase should trigger render delegate processing, such as issuing draw commands.

Task execution is non-parallel and ordered.

The task context is the same as used by the prepare step and is used for inter-task communication.

Implements HdTask.

Definition at line 73 of file unitTestHelper.h.

virtual const TfTokenVector& UsdImaging_TestTask::GetRenderTags ( ) const
inlineoverridevirtual

Render Tag Gather.

Is called during the Sync phase after the task has been sync'ed.

The task should return the render tags it wants to be appended to the active set.

Hydra prims are marked up with a render tag and only prims marked with the render tags in the current active set are Sync'ed.

Hydra's core will combine the sets from each task and deduplicate the result. So tasks don't need to co-ordinate with each other to optimize the set.

For those tasks that use HdRenderPass, this set is passed to HdRenderPass's Execute method.

The default implementation returns an empty set

Reimplemented from HdTask.

Definition at line 76 of file unitTestHelper.h.

virtual void UsdImaging_TestTask::Prepare ( HdTaskContext ctx,
HdRenderIndex renderIndex 
)
inlineoverridevirtual

Prepare Phase: Resolve bindings and manage resources.

The Prepare phase happens before the Data Commit phase. All tasks in the task list get called for every execute. At this time all Tasks and other prims have completed the phase synced.

This is an opportunity for the task to pull data from other prims (such as a camera prim) by querying the render index.

The task can also use the phase to create, register and update temporary resources with the resource registry or other render delegate specific mechanism.

Tasks are always "Prepared" in execution order.

Inter-task communication is achievable via the task context. The same task context is used for the prepare and execution phases. Data in the task context isn't guaranteed to persist across calls to HdEngine::Execute().

Implements HdTask.

Definition at line 69 of file unitTestHelper.h.

virtual void UsdImaging_TestTask::Sync ( HdSceneDelegate delegate,
HdTaskContext ctx,
HdDirtyBits dirtyBits 
)
inlineoverridevirtual

Sync Phase: Obtain task state from Scene delegate based on change processing.

This function might only be called if dirtyBits is not 0, so isn't guaranteed to be called every time HdEngine::Execute() is run with this task.

However, this is the only time when the task should communicate with with the scene delegate responsible for the task and should be used to pull all changed data. As outside the Sync phase, the scene delegate may not have the data available.

Tasks maybe synced in parallel and out of order.

The ctx parameter is present for legacy reason and shouldn't be used once the task has moved to using the 3-phase mechanism.

After a task has been synced, it is expected that it produces a collection identifying the prims that are important to the task. This collection is used to filter the prims in the scene so only the Relevant prims get synced.

Note about inter-prim dependencies: Quite often tasks need to access other prims, such as a camera prim for example. These other prims have not been synced yet when sync is called. Therefore, it is not recommended to access these prims during the sync phase. Instead a task should store the path to the prim to be resolved to an actual prim during the "prepare" phase.

Implements HdTask.

Definition at line 61 of file unitTestHelper.h.


The documentation for this class was generated from the following file: