![]() |
RenderMan
26.0
|
#include <RixProjection.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 |
void | CreateInstanceData (RixContext &rixCtx, RtUString const handle, RixParameterList const *instanceParams, InstanceData *instanceData) final |
CreateInstanceData() is called once per plugin-instance. More... | |
void | SynchronizeInstanceData (RixContext &rixCtx, RtUString const handle, RixParameterList const *instanceParams, uint32_t const editHints, InstanceData *instanceData) final |
SynchronizeInstanceData() will only be called if InstanceData::synchronizeHints was set to a non-zero value during the initial call to CreateInstanceData(). More... | |
virtual RixProjection * | CreateProjection (RixContext &ctx, RtUString const handle, RixParameterList const *pList)=0 |
virtual void | DestroyProjection (RixProjection const *projection)=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... | |
Protected Member Functions | |
RixProjectionFactory () | |
~RixProjectionFactory () override | |
Protected Attributes | |
int | m_version |
|
inherited |
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:
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 |
|
inlineprotected |
|
inlineoverrideprotected |
|
inlinefinalvirtual |
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:
Reimplemented from RixShadingPlugin.
|
pure virtual |
|
pure virtual |
|
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.
|
inlineoverridevirtual |
Reimplemented from RixShadingPlugin.
References k_RixProjectionFactory.
|
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.
|
inlinevirtualinherited |
References RixShadingPlugin::m_version.
|
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.
|
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.
|
inlinefinalvirtual |
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:
However, it is not currently possible to modify:
Note that special care should be taken when modifying synchronizeHints
, so that the plugin instance doesn't lock itself out of synchronization notifications.
Reimplemented from RixShadingPlugin.
|
protectedinherited |
Referenced by RixShadingPlugin::GetVersion().