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

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

Inherits HdRenderDelegate.

Public Member Functions

 HdEmbreeRenderDelegate ()
 Render delegate constructor. More...
 
 HdEmbreeRenderDelegate (HdRenderSettingsMap const &settingsMap)
 Render delegate constructor. More...
 
virtual ~HdEmbreeRenderDelegate ()
 Render delegate destructor. More...
 
virtual HdRenderParamGetRenderParam () const override
 Return this delegate's render param. More...
 
virtual const TfTokenVectorGetSupportedRprimTypes () const override
 Return a list of which Rprim types can be created by this class's CreateRprim. More...
 
virtual const TfTokenVectorGetSupportedSprimTypes () const override
 Return a list of which Sprim types can be created by this class's CreateSprim. More...
 
virtual const TfTokenVectorGetSupportedBprimTypes () const override
 Return a list of which Bprim types can be created by this class's CreateBprim. More...
 
virtual HdResourceRegistrySharedPtr GetResourceRegistry () const override
 Returns the HdResourceRegistry instance used by this render delegate. More...
 
virtual
HdRenderSettingDescriptorList 
GetRenderSettingDescriptors () const override
 Returns a list of user-configurable render settings. More...
 
virtual bool IsPauseSupported () const override
 Return true to indicate that pausing and resuming are supported. More...
 
virtual bool Pause () override
 Pause background rendering threads. More...
 
virtual bool Resume () override
 Resume background rendering threads. More...
 
virtual HdRenderPassSharedPtr CreateRenderPass (HdRenderIndex *index, HdRprimCollection const &collection) override
 Create a renderpass. More...
 
virtual HdInstancerCreateInstancer (HdSceneDelegate *delegate, SdfPath const &id, SdfPath const &instancerId)
 Create an instancer. More...
 
virtual void DestroyInstancer (HdInstancer *instancer)
 Destroy an instancer created with CreateInstancer. More...
 
virtual HdRprimCreateRprim (TfToken const &typeId, SdfPath const &rprimId, SdfPath const &instancerId) override
 Create a hydra Rprim, representing scene geometry. More...
 
virtual void DestroyRprim (HdRprim *rPrim) override
 Destroy an Rprim created with CreateRprim. More...
 
virtual HdSprimCreateSprim (TfToken const &typeId, SdfPath const &sprimId) override
 Create a hydra Sprim, representing scene or viewport state like cameras or lights. More...
 
virtual HdSprimCreateFallbackSprim (TfToken const &typeId) override
 Create a hydra Sprim using default values, and with no scene graph binding. More...
 
virtual void DestroySprim (HdSprim *sPrim) override
 Destroy an Sprim created with CreateSprim or CreateFallbackSprim. More...
 
virtual HdBprimCreateBprim (TfToken const &typeId, SdfPath const &bprimId) override
 Create a hydra Bprim, representing data buffers such as textures. More...
 
virtual HdBprimCreateFallbackBprim (TfToken const &typeId) override
 Create a hydra Bprim using default values, and with no scene graph binding. More...
 
virtual void DestroyBprim (HdBprim *bPrim) override
 Destroy a Bprim created with CreateBprim or CreateFallbackBprim. More...
 
virtual 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. More...
 
virtual TfToken GetMaterialBindingPurpose () const override
 This function tells the scene which material variant to reference. More...
 
virtual HdAovDescriptor GetDefaultAovDescriptor (TfToken const &name) const override
 This function returns the default AOV descriptor for a given named AOV. More...
 
virtual VtDictionary GetRenderStats () const override
 This function allows the renderer to report back some useful statistics that the application can display to the user. More...
 
- Public Member Functions inherited from HdRenderDelegate
virtual HD_API void SetDrivers (HdDriverVector const &drivers)
 Set list of driver objects, such as a rendering context / devices. More...
 
virtual const TfTokenVectorGetSupportedRprimTypes () const =0
 Returns a list of typeId's of all supported Rprims by this render delegate. More...
 
virtual const TfTokenVectorGetSupportedSprimTypes () const =0
 Returns a list of typeId's of all supported Sprims by this render delegate. More...
 
virtual const TfTokenVectorGetSupportedBprimTypes () const =0
 Returns a list of typeId's of all supported Bprims by this render delegate. More...
 
virtual HD_API HdRenderParamGetRenderParam () const
 Returns an opaque handle to a render param, that in turn is passed to each prim created by the render delegate during sync processing. More...
 
virtual HdResourceRegistrySharedPtr GetResourceRegistry () const =0
 Returns a shared ptr to the resource registry of the current render delegate. More...
 
virtual HD_API void SetRenderSetting (TfToken const &key, VtValue const &value)
 Set a custom render setting on this render delegate. More...
 
virtual HD_API VtValue GetRenderSetting (TfToken const &key) const
 Get the current value for a render setting. More...
 
template<typename T >
GetRenderSetting (TfToken const &key, T const &defValue) const
 Get the current value for a render setting, taking a desired type and a fallback value in case of type mismatch. More...
 
virtual HD_API
HdRenderSettingDescriptorList 
GetRenderSettingDescriptors () const
 Get the backend-exported render setting descriptors. More...
 
virtual HD_API unsigned int GetRenderSettingsVersion () const
 Get the current version of the render settings dictionary. More...
 
virtual HD_API VtDictionary GetRenderStats () const
 Returns an open-format dictionary of render statistics. More...
 
virtual HD_API bool IsPauseSupported () const
 Control of background rendering threads. More...
 
virtual HD_API bool Pause ()
 Pause all of this delegate's background rendering threads. More...
 
virtual HD_API bool Resume ()
 Resume all of this delegate's background rendering threads previously paused by a call to Pause. More...
 
virtual HD_API bool IsStopSupported () const
 Advertise whether this delegate supports stopping and restarting of background render threads. More...
 
virtual HD_API bool Stop ()
 Stop all of this delegate's background rendering threads. More...
 
virtual HD_API bool Restart ()
 Restart all of this delegate's background rendering threads previously stopped by a call to Stop. More...
 
virtual HdRenderPassSharedPtr CreateRenderPass (HdRenderIndex *index, HdRprimCollection const &collection)=0
 Renderpass Factory. More...
 
virtual HD_API
HdRenderPassStateSharedPtr 
CreateRenderPassState () const
 Request to create a new renderpass state. More...
 
virtual HdInstancerCreateInstancer (HdSceneDelegate *delegate, SdfPath const &id, SdfPath const &instancerId)=0
 Instancer Factory. More...
 
virtual void DestroyInstancer (HdInstancer *instancer)=0
 
virtual HdRprimCreateRprim (TfToken const &typeId, SdfPath const &rprimId, SdfPath const &instancerId)=0
 Prim Factories. More...
 
virtual void DestroyRprim (HdRprim *rPrim)=0
 Request to Destruct and deallocate the prim. More...
 
virtual HdSprimCreateSprim (TfToken const &typeId, SdfPath const &sprimId)=0
 Request to Allocate and Construct a new Sprim. More...
 
virtual HdSprimCreateFallbackSprim (TfToken const &typeId)=0
 Request to Allocate and Construct an Sprim to use as a standin, if there if an error with another another Sprim of the same type. More...
 
virtual void DestroySprim (HdSprim *sprim)=0
 Request to Destruct and deallocate the prim. More...
 
virtual HdBprimCreateBprim (TfToken const &typeId, SdfPath const &bprimId)=0
 Request to Allocate and Construct a new Bprim. More...
 
virtual HdBprimCreateFallbackBprim (TfToken const &typeId)=0
 Request to Allocate and Construct a Bprim to use as a standin, if there if an error with another another Bprim of the same type. More...
 
virtual void DestroyBprim (HdBprim *bprim)=0
 Request to Destruct and deallocate the prim. More...
 
virtual void CommitResources (HdChangeTracker *tracker)=0
 Sync, Execute & Dispatch Hooks. More...
 
virtual HD_API TfToken GetMaterialBindingPurpose () const
 Materials. More...
 
virtual HD_API TfToken GetMaterialNetworkSelector () const
 Returns a token that can be used to select among multiple material network implementations. More...
 
virtual HD_API bool IsPrimvarFilteringNeeded () const
 Return true to indicate that the render delegate wants rprim primvars to be filtered by the scene delegate to reduce the amount of primvars that are send to the render delegate. More...
 
virtual HD_API TfTokenVector GetShaderSourceTypes () const
 Returns the ordered list of shader source types that the render delegate supports. More...
 
virtual HD_API HdAovDescriptor GetDefaultAovDescriptor (TfToken const &name) const
 AOVs. More...
 

Additional Inherited Members

- Protected Member Functions inherited from HdRenderDelegate
HD_API HdRenderDelegate ()
 This class must be derived from. More...
 
HD_API HdRenderDelegate (HdRenderSettingsMap const &settingsMap)
 Allow derived classes to pass construction-time render settings. More...
 
 HdRenderDelegate (const HdRenderDelegate &)=delete
 This class is not intended to be copied. More...
 
HdRenderDelegate & operator= (const HdRenderDelegate &)=delete
 
HD_API void _PopulateDefaultSettings (HdRenderSettingDescriptorList const &defaultSettings)
 
- Protected Attributes inherited from HdRenderDelegate
HdRenderSettingsMap _settingsMap
 Render settings state. More...
 
unsigned int _settingsVersion
 

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

Render delegate constructor.

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

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.

virtual ~HdEmbreeRenderDelegate ( )
virtual

Render delegate destructor.

This method destroys the RTC device and scene.

Member Function Documentation

virtual void CommitResources ( HdChangeTracker tracker)
overridevirtual

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().
virtual HdBprim* CreateBprim ( TfToken const &  typeId,
SdfPath const &  bprimId 
)
overridevirtual

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.
virtual HdBprim* CreateFallbackBprim ( TfToken const &  typeId)
overridevirtual

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.
virtual HdSprim* CreateFallbackSprim ( TfToken const &  typeId)
overridevirtual

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.
virtual HdInstancer* CreateInstancer ( HdSceneDelegate delegate,
SdfPath const &  id,
SdfPath const &  instancerId 
)
virtual

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.
instancerIdIf specified, the instancer at this id uses this instancer as a prototype.
Returns
An embree instancer object.
virtual HdRenderPassSharedPtr CreateRenderPass ( HdRenderIndex index,
HdRprimCollection const &  collection 
)
overridevirtual

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.
virtual HdRprim* CreateRprim ( TfToken const &  typeId,
SdfPath const &  rprimId,
SdfPath const &  instancerId 
)
overridevirtual

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.
instancerIdIf specified, the instancer at this id uses the new rprim as a prototype.
Returns
An embree rprim object.
virtual HdSprim* CreateSprim ( TfToken const &  typeId,
SdfPath const &  sprimId 
)
overridevirtual

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.
virtual void DestroyBprim ( HdBprim bPrim)
overridevirtual

Destroy a Bprim created with CreateBprim or CreateFallbackBprim.

Parameters
bPrimThe bprim to be destroyed.
virtual void DestroyInstancer ( HdInstancer instancer)
virtual

Destroy an instancer created with CreateInstancer.

Parameters
instancerThe instancer to be destroyed.
virtual void DestroyRprim ( HdRprim rPrim)
overridevirtual

Destroy an Rprim created with CreateRprim.

Parameters
rPrimThe rprim to be destroyed.
virtual void DestroySprim ( HdSprim sPrim)
overridevirtual

Destroy an Sprim created with CreateSprim or CreateFallbackSprim.

Parameters
sPrimThe sprim to be destroyed.
virtual HdAovDescriptor GetDefaultAovDescriptor ( TfToken const &  name) const
overridevirtual

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.
virtual TfToken GetMaterialBindingPurpose ( ) const
inlineoverridevirtual

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 229 of file renderDelegate.h.

virtual HdRenderParam* GetRenderParam ( ) const
overridevirtual

Return this delegate's render param.

Returns
A shared instance of HdEmbreeRenderParam.
virtual HdRenderSettingDescriptorList GetRenderSettingDescriptors ( ) const
overridevirtual

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.

virtual VtDictionary GetRenderStats ( ) const
overridevirtual

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

virtual HdResourceRegistrySharedPtr GetResourceRegistry ( ) const
overridevirtual

Returns the HdResourceRegistry instance used by this render delegate.

virtual const TfTokenVector& GetSupportedBprimTypes ( ) const
overridevirtual

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

virtual const TfTokenVector& GetSupportedRprimTypes ( ) const
overridevirtual

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

virtual const TfTokenVector& GetSupportedSprimTypes ( ) const
overridevirtual

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

virtual bool IsPauseSupported ( ) const
overridevirtual

Return true to indicate that pausing and resuming are supported.

virtual bool Pause ( )
overridevirtual

Pause background rendering threads.

virtual bool Resume ( )
overridevirtual

Resume background rendering threads.


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