RixShadingPlugin::InstanceData Struct Reference

RixShadingPlugin::InstanceData Struct Reference

#include <RixShading.h>

Public Attributes

RtPointer data
 
size_t datalen
 
void(* freefunc )(RtPointer)
 

Detailed Description

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.

The default implementation produces no instance data. 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. During rerendering, the Create method may be invoked repeatedly within the same rendering session. The handle parameter is 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.


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