Loading...
Searching...
No Matches
HdEmbreeRenderDelegate Class Referencefinal

Render delegates provide renderer-specific functionality to the render index, the main hydra state management structure. More...

#include <renderDelegate.h>

Inherits HdRenderDelegate.

Public Member Functions

 HdEmbreeRenderDelegate ()
 Render delegate constructor.
 
 HdEmbreeRenderDelegate (HdRenderSettingsMap const &settingsMap)
 Render delegate constructor.
 
 ~HdEmbreeRenderDelegate () override
 Render delegate destructor.
 
HdRenderParamGetRenderParam () const override
 Return this delegate's render param.
 
const TfTokenVectorGetSupportedRprimTypes () const override
 Return a list of which Rprim types can be created by this class's CreateRprim.
 
const TfTokenVectorGetSupportedSprimTypes () const override
 Return a list of which Sprim types can be created by this class's CreateSprim.
 
const TfTokenVectorGetSupportedBprimTypes () const override
 Return a list of which Bprim types can be created by this class's CreateBprim.
 
HdResourceRegistrySharedPtr GetResourceRegistry () const override
 Returns the HdResourceRegistry instance used by this render delegate.
 
HdRenderSettingDescriptorList GetRenderSettingDescriptors () const override
 Returns a list of user-configurable render settings.
 
bool IsPauseSupported () const override
 Return true to indicate that pausing and resuming are supported.
 
bool Pause () override
 Pause background rendering threads.
 
bool Resume () override
 Resume background rendering threads.
 
HdRenderPassSharedPtr CreateRenderPass (HdRenderIndex *index, HdRprimCollection const &collection) override
 Create a renderpass.
 
HdInstancerCreateInstancer (HdSceneDelegate *delegate, SdfPath const &id) override
 Create an instancer.
 
void DestroyInstancer (HdInstancer *instancer) override
 Destroy an instancer created with CreateInstancer.
 
HdRprimCreateRprim (TfToken const &typeId, SdfPath const &rprimId) override
 Create a hydra Rprim, representing scene geometry.
 
void DestroyRprim (HdRprim *rPrim) override
 Destroy an Rprim created with CreateRprim.
 
HdSprimCreateSprim (TfToken const &typeId, SdfPath const &sprimId) override
 Create a hydra Sprim, representing scene or viewport state like cameras or lights.
 
HdSprimCreateFallbackSprim (TfToken const &typeId) override
 Create a hydra Sprim using default values, and with no scene graph binding.
 
void DestroySprim (HdSprim *sPrim) override
 Destroy an Sprim created with CreateSprim or CreateFallbackSprim.
 
HdBprimCreateBprim (TfToken const &typeId, SdfPath const &bprimId) override
 Create a hydra Bprim, representing data buffers such as textures.
 
HdBprimCreateFallbackBprim (TfToken const &typeId) override
 Create a hydra Bprim using default values, and with no scene graph binding.
 
void DestroyBprim (HdBprim *bPrim) override
 Destroy a Bprim created with CreateBprim or CreateFallbackBprim.
 
void CommitResources (HdChangeTracker *tracker) override
 This function is called after new scene data is pulled during prim Sync(), but before any tasks (such as draw tasks) are run, and gives the render delegate a chance to transfer any invalidated resources to the rendering kernel.
 
TfToken GetMaterialBindingPurpose () const override
 This function tells the scene which material variant to reference.
 
HdAovDescriptor GetDefaultAovDescriptor (TfToken const &name) const override
 This function returns the default AOV descriptor for a given named AOV.
 
VtDictionary GetRenderStats () const override
 This function allows the renderer to report back some useful statistics that the application can display to the user.
 

Detailed Description

Render delegates provide renderer-specific functionality to the render index, the main hydra state management structure.

The render index uses the render delegate to create and delete scene primitives, which include geometry and also non-drawable objects. The render delegate is also responsible for creating renderpasses, which know how to draw this renderer's scene primitives.

Primitives in Hydra are split into Rprims (drawables), Sprims (state objects like cameras and materials), and Bprims (buffer objects like textures). The minimum set of primitives a renderer needs to support is one Rprim (so the scene's not empty) and the "camera" Sprim, which is required by HdxRenderTask, the task implementing basic hydra drawing.

A render delegate can report which prim types it supports via GetSupportedRprimTypes() (and Sprim, Bprim), and well-behaved applications won't call CreateRprim() (Sprim, Bprim) for prim types that aren't supported. The core hydra prim types are "mesh", "basisCurves", and "points", but a custom render delegate and a custom scene delegate could add support for other prims such as implicit surfaces or volumes.

HdEmbree Rprims create embree geometry objects in the render delegate's top-level embree scene; and HdEmbree's render pass draws by casting rays into the top-level scene. The renderpass writes to renderbuffers, which are then composited into the GL framebuffer.

The render delegate also has a hook for the main hydra execution algorithm (HdEngine::Execute()): between HdRenderIndex::SyncAll(), which pulls new scene data, and execution of tasks, the engine calls back to CommitResources(). This can be used to commit GPU buffers, or as a place to schedule a final BVH build (though Embree doesn't currenlty use it). Importantly, no scene updates are processed after CommitResources().

Definition at line 84 of file renderDelegate.h.

Constructor & Destructor Documentation

◆ HdEmbreeRenderDelegate() [1/2]

Render delegate constructor.

This method creates the RTC device and scene, and links embree error handling to hydra error handling.

◆ HdEmbreeRenderDelegate() [2/2]

HdEmbreeRenderDelegate ( HdRenderSettingsMap const &  settingsMap)

Render delegate constructor.

This method creates the RTC device and scene, and links embree error ahndling to hydra error handling. It also populates initial render settings.

◆ ~HdEmbreeRenderDelegate()

~HdEmbreeRenderDelegate ( )
override

Render delegate destructor.

This method destroys the RTC device and scene.

Member Function Documentation

◆ CommitResources()

void CommitResources ( HdChangeTracker tracker)
override

This function is called after new scene data is pulled during prim Sync(), but before any tasks (such as draw tasks) are run, and gives the render delegate a chance to transfer any invalidated resources to the rendering kernel.

Parameters
trackerThe change tracker passed to prim Sync().

◆ CreateBprim()

HdBprim * CreateBprim ( TfToken const &  typeId,
SdfPath const &  bprimId 
)
override

Create a hydra Bprim, representing data buffers such as textures.

Parameters
typeIdThe bprim type to create. This must be one of the types from GetSupportedBprimTypes().
bprimIdThe scene graph ID of this bprim, used when pulling data from a scene delegate.
Returns
An embree bprim object.

◆ CreateFallbackBprim()

HdBprim * CreateFallbackBprim ( TfToken const &  typeId)
override

Create a hydra Bprim using default values, and with no scene graph binding.

Parameters
typeIdThe bprim type to create. This must be one of the types from GetSupportedBprimTypes().
Returns
An embree fallback bprim object.

◆ CreateFallbackSprim()

HdSprim * CreateFallbackSprim ( TfToken const &  typeId)
override

Create a hydra Sprim using default values, and with no scene graph binding.

Parameters
typeIdThe sprim type to create. This must be one of the types from GetSupportedSprimTypes().
Returns
An embree fallback sprim object.

◆ CreateInstancer()

HdInstancer * CreateInstancer ( HdSceneDelegate delegate,
SdfPath const &  id 
)
override

Create an instancer.

Hydra instancers store data needed for an instanced object to draw itself multiple times.

Parameters
delegateThe scene delegate providing data for this instancer.
idThe scene graph ID of this instancer, used when pulling data from a scene delegate.
Returns
An embree instancer object.

◆ CreateRenderPass()

HdRenderPassSharedPtr CreateRenderPass ( HdRenderIndex index,
HdRprimCollection const &  collection 
)
override

Create a renderpass.

Hydra renderpasses are responsible for drawing a subset of the scene (specified by the "collection" parameter) to the current framebuffer. This class creates objects of type HdEmbreeRenderPass, which draw using embree's raycasting API.

Parameters
indexThe render index this renderpass will be bound to.
collectionA specifier for which parts of the scene should be drawn.
Returns
An embree renderpass object.

◆ CreateRprim()

HdRprim * CreateRprim ( TfToken const &  typeId,
SdfPath const &  rprimId 
)
override

Create a hydra Rprim, representing scene geometry.

This class creates embree-specialized geometry containers like HdEmbreeMesh which map scene data to embree scene graph objects.

Parameters
typeIdThe rprim type to create. This must be one of the types from GetSupportedRprimTypes().
rprimIdThe scene graph ID of this rprim, used when pulling data from a scene delegate.
Returns
An embree rprim object.

◆ CreateSprim()

HdSprim * CreateSprim ( TfToken const &  typeId,
SdfPath const &  sprimId 
)
override

Create a hydra Sprim, representing scene or viewport state like cameras or lights.

Parameters
typeIdThe sprim type to create. This must be one of the types from GetSupportedSprimTypes().
sprimIdThe scene graph ID of this sprim, used when pulling data from a scene delegate.
Returns
An embree sprim object.

◆ DestroyBprim()

void DestroyBprim ( HdBprim bPrim)
override

Destroy a Bprim created with CreateBprim or CreateFallbackBprim.

Parameters
bPrimThe bprim to be destroyed.

◆ DestroyInstancer()

void DestroyInstancer ( HdInstancer instancer)
override

Destroy an instancer created with CreateInstancer.

Parameters
instancerThe instancer to be destroyed.

◆ DestroyRprim()

void DestroyRprim ( HdRprim rPrim)
override

Destroy an Rprim created with CreateRprim.

Parameters
rPrimThe rprim to be destroyed.

◆ DestroySprim()

void DestroySprim ( HdSprim sPrim)
override

Destroy an Sprim created with CreateSprim or CreateFallbackSprim.

Parameters
sPrimThe sprim to be destroyed.

◆ GetDefaultAovDescriptor()

HdAovDescriptor GetDefaultAovDescriptor ( TfToken const &  name) const
override

This function returns the default AOV descriptor for a given named AOV.

This mechanism lets the renderer decide things like what format a given AOV will be written as.

Parameters
nameThe name of the AOV whose descriptor we want.
Returns
A descriptor specifying things like what format the AOV output buffer should be.

◆ GetMaterialBindingPurpose()

TfToken GetMaterialBindingPurpose ( ) const
inlineoverride

This function tells the scene which material variant to reference.

Embree doesn't currently use materials but raytraced backends generally specify "full".

Returns
A token specifying which material variant this renderer prefers.

Definition at line 224 of file renderDelegate.h.

◆ GetRenderParam()

HdRenderParam * GetRenderParam ( ) const
override

Return this delegate's render param.

Returns
A shared instance of HdEmbreeRenderParam.

◆ GetRenderSettingDescriptors()

HdRenderSettingDescriptorList GetRenderSettingDescriptors ( ) const
override

Returns a list of user-configurable render settings.

This is a reflection API for the render settings dictionary; it need not be exhaustive, but can be used for populating application settings UI.

◆ GetRenderStats()

VtDictionary GetRenderStats ( ) const
override

This function allows the renderer to report back some useful statistics that the application can display to the user.

◆ GetResourceRegistry()

HdResourceRegistrySharedPtr GetResourceRegistry ( ) const
override

Returns the HdResourceRegistry instance used by this render delegate.

◆ GetSupportedBprimTypes()

const TfTokenVector & GetSupportedBprimTypes ( ) const
override

Return a list of which Bprim types can be created by this class's CreateBprim.

◆ GetSupportedRprimTypes()

const TfTokenVector & GetSupportedRprimTypes ( ) const
override

Return a list of which Rprim types can be created by this class's CreateRprim.

◆ GetSupportedSprimTypes()

const TfTokenVector & GetSupportedSprimTypes ( ) const
override

Return a list of which Sprim types can be created by this class's CreateSprim.

◆ IsPauseSupported()

bool IsPauseSupported ( ) const
override

Return true to indicate that pausing and resuming are supported.

◆ Pause()

bool Pause ( )
override

Pause background rendering threads.

◆ Resume()

bool Resume ( )
override

Resume background rendering threads.


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