RenderManAPI  24.0
RixDisplacementFactory Class Referenceabstract

#include <RixDisplacement.h>

Inherits RixShadingPlugin.

Public Types

enum  SynchronizeHints { k_None = 0x00000000, k_All = 0xFFFFFFFF }
 The renderer offers the ability to shading plugins to track custom data with every instance of the plugin reference. More...
 

Public Member Functions

int GetInterface () const override
 
virtual RixDisplacementBeginDisplacement (RixShadingContext const *, RixSCShadingMode, void *instanceData)=0
 
virtual void EndDisplacement (class RixDisplacement *disp)=0
 
virtual int GetVersion () const
 
virtual int Init (RixContext &ctx, RtUString const pluginPath)=0
 In order to initialize the plugin, the renderer will call Init() once. More...
 
virtual void Finalize (RixContext &ctx)=0
 Finalize() is the companion to Init(), called at the end of rendering with the expectation that any data allocated within the Init() implementation will be released. More...
 
virtual RixSCParamInfo const * GetParamTable ()=0
 All shading plugins are expected to return a description of their input and output parameters via the GetParamTable() method. More...
 
virtual void Synchronize (RixContext &ctx, RixSCSyncMsg syncMsg, RixParameterList const *syncParams)=0
 This method is used to deliver occasional status information from the renderer. More...
 
virtual void CreateInstanceData (RixContext &rixCtx, RtUString const handle, RixParameterList const *parameterList, InstanceData *instanceData)
 CreateInstanceData() is called once per plugin-instance. More...
 
virtual void SynchronizeInstanceData (RixContext &rixCtx, RtUString const handle, RixParameterList const *instanceParams, uint32_t const editHints, InstanceData *instanceData)
 SynchronizeInstanceData() will only be called if InstanceData::synchronizeHints was set to a non-zero value during the initial call to CreateInstanceData(). More...
 

Protected Member Functions

 RixDisplacementFactory ()
 
 ~RixDisplacementFactory () override
 

Protected Attributes

int m_version
 

Member Enumeration Documentation

◆ SynchronizeHints

The renderer offers the ability to shading plugins to track custom data with every instance of the plugin reference.

This is useful primarily to plugin types like Bxdf and Pattern that expect to see multiple instances. Instance data is usually a function of the instance parameters, and plugins that operate in performance sensitive conditions may "bake" an understanding of their behavior/requirements into custom representation for tracking with the instance. The instance data can be recovered from the operating context associated with the plugin type, or via inspection of the parameter list (using RixParameterList::EvalParam). Note that in the latter case, the ability to inspect the parameter list is restricted: "network" connections (i.e. upstream pattern graph inputs) cannot be evaluated at the time CreateInstanceData is invoked.

Note that CreateInstanceData() is only called once, when the plugin instance is created. As a consequence, edits happening during an interactive session can't be captured by this method. The InstanceData::synchronizeHints member allows a plugin to subscribe to a synchronization call, following some edits. In order for SynchronizeInstanceData() to be called, this member needs to be set to a non-zero value by CreateInstanceData().

Note that some quantities are not accessible anymore through the RixContext object in CreateInstanceData(), for reasons related to interactive rendering. In particular:

  • LPE-related quantities
  • Display-related quantities (e.g. resolution)
  • editable options should only be queried in SynchronizeInstanceData().

Additionally, a plugin can create its parameter table dynamically based on the parameters provided to each instance of the plugin. This dynamically created table should be saved in the paramtable member of InstanceData, and should be freed by the InstanceData freefunc. Generally, concrete interfaces should be preferred over dynamic interfaces due to their extra memory expense. If the paramtable member remains null, all instances will share the parameter table returned by GetParamTable. In order to prevent the renderer from filtering out dynamic parameters as bad inputs, a plugin that is using a dynamically created table should have a k_RixSCAnyType entry in its plugin parameter table.

A trivial implementation of the following methods doesn't modify the InstanceData objects provided. Plugins should consider the number of potential instances that may be produced in a worst-case render to assess the memory impact of the instance data. The renderer will free data via freefunc when it understands that the plugin instance will no longer be needed. The handle parameter the value associated with the Ri instance but may not be guaranteed to be globally unique. The instanceid parameter is optionally delivered via the parameterlist (see RI_INSTANCEID docs) and is expected (though not guaranteed) to be unique. This call might be called in multiple threads and should be re-entrant and thread-safe.

Enumerator
k_None 
k_All 

Constructor & Destructor Documentation

◆ RixDisplacementFactory()

RixDisplacementFactory::RixDisplacementFactory ( )
inlineprotected

◆ ~RixDisplacementFactory()

RixDisplacementFactory::~RixDisplacementFactory ( )
inlineoverrideprotected

Member Function Documentation

◆ BeginDisplacement()

virtual RixDisplacement* RixDisplacementFactory::BeginDisplacement ( RixShadingContext const *  ,
RixSCShadingMode  ,
void *  instanceData 
)
pure virtual

◆ CreateInstanceData()

virtual void RixShadingPlugin::CreateInstanceData ( RixContext rixCtx,
RtUString const  handle,
RixParameterList const *  parameterList,
InstanceData instanceData 
)
inlinevirtualinherited

CreateInstanceData() is called once per plugin-instance.

It may be called before other renderer options and/or plugins have been set-up. As a consequence, some quantities may not be accessible in CreateInstanceData(). For example:

  • LPE-related quantities
  • Display-related quantities (e.g. resolution)
  • editable options SynchronizeInstanceData() should be used to retrieve the up-to-date related quantities.

Reimplemented in RixIntegratorFactory, and RixProjectionFactory.

References PIXAR_ARGUSED.

◆ EndDisplacement()

virtual void RixDisplacementFactory::EndDisplacement ( class RixDisplacement disp)
pure virtual

◆ Finalize()

virtual void RixShadingPlugin::Finalize ( RixContext ctx)
pure virtualinherited

Finalize() is the companion to Init(), called at the end of rendering with the expectation that any data allocated within the Init() implementation will be released.

◆ GetInterface()

int RixDisplacementFactory::GetInterface ( ) const
inlineoverridevirtual

Reimplemented from RixShadingPlugin.

References k_RixDisplacementFactory.

◆ GetParamTable()

virtual RixSCParamInfo const* RixShadingPlugin::GetParamTable ( )
pure virtualinherited

All shading plugins are expected to return a description of their input and output parameters via the GetParamTable() method.

This returns a pointer to an array of RixSCParamInfo, containing one entry for each input and output parameter, as well as an extra empty entry to mark the end of the table. This parameter table is used by the renderer to ensure proper type checking and validate the connections of upstream and downstream nodes. As such, each entry in the table should set a name, a type (RixSCType enumeration), detail (varying vs uniform, RixSCDetail enumeration), and access (input vs output, RixSCAccess enumeration). These declarations also need to be kept in sync with the associated .args file.

◆ GetVersion()

virtual int RixShadingPlugin::GetVersion ( ) const
inlinevirtualinherited

◆ Init()

virtual int RixShadingPlugin::Init ( RixContext ctx,
RtUString const  pluginPath 
)
pure virtualinherited

In order to initialize the plugin, the renderer will call Init() once.

Even if the plugin is evoked multiple times during the render with different arguments, Init() will still be called only once during the lifetime of the render. The RixContext parameter can be used by the plugin to request any RixInterfaces services provided by the renderer. Any expensive memory allocations or operations that can be reused during the lifetime of the plugin can be performed in this routine. Upon successful initialization, this routine should return a zero status.

◆ Synchronize()

virtual void RixShadingPlugin::Synchronize ( RixContext ctx,
RixSCSyncMsg  syncMsg,
RixParameterList const *  syncParams 
)
pure virtualinherited

This method is used to deliver occasional status information from the renderer.

Parameterlist contents depend upon the SyncMsg. A trivial implementation simply does nothing, ignoring all events.

◆ SynchronizeInstanceData()

virtual void RixShadingPlugin::SynchronizeInstanceData ( RixContext rixCtx,
RtUString const  handle,
RixParameterList const *  instanceParams,
uint32_t const  editHints,
InstanceData instanceData 
)
inlinevirtualinherited

SynchronizeInstanceData() will only be called if InstanceData::synchronizeHints was set to a non-zero value during the initial call to CreateInstanceData().

This method is allowed to modify:

  • data (including freeing the previous pointer and allocating new memory)
  • datalen
  • freefunc
  • synchronizeHints

However, it is not currently possible to modify:

  • paramtable

Note that special care should be taken when modifying synchronizeHints, so that the plugin instance doesn't lock itself out of synchronization notifications.

Reimplemented in RixIntegratorFactory, and RixProjectionFactory.

References PIXAR_ARGUSED.

Member Data Documentation

◆ m_version

int RixShadingPlugin::m_version
protectedinherited

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