#include <RslPlugin.h>
Public Attributes | |
const char * | m_prototype |
RSL function prototype. | |
RslEntryFunc | m_entry |
Pointer to entry function. | |
RslVoidFunc | m_initFunc |
Per-frame initialization function (possibly NULL). | |
RslVoidFunc | m_cleanupFunc |
Per-frame cleanup function (possibly NULL). | |
RslVoidFunc | m_renderBeginFunc |
Per-render function (possibly NULL). | |
RslVoidFunc | m_renderEndFunc |
Per-render function (possibly NULL). |
First, a array of RslFunction structs is defined:
static RslFunction myfunctions[] = { { "float sqr(float)", sqr_f, NULL, NULL, NULL, NULL }, { "color sqr(color)", sqr_c, NULL, NULL, NULL, NULL }, { "point mynoise(point)", mynoise, noiseinit, noisedelete, NULL, NULL }, NULL };
RSLEXPORT RslFunctionTable RslPublicFunctions(myfunctions);
Each RslFunction specifies the prototype(s) of a shadeop, along a pointer to its entry function. Overloaded shadeops have multiple entries with different prototypes (which might share the same entry point since colors, points, and vectors have the same representation). The last entry of the array should be NULL.
Each RslFunction can also have an optional associated init and cleanup function. The init function is called once per frame in a thread safe way for EACH function it is associated with. Likewise each cleanup function is called once at the end of frame for EACH associated function. The cleanup function will ONLY be called for a function with an associated init function.
In addition to the init and cleanup functions. each RslFunction can also have an optional renderBegin and renderEnd function. The renderBegin function is called once in a thread safe way when rendering starts (including a re-endering iteration). They are called for EACH associated function. Each renderEnd function is called once at the end of a render iteration. The renderBegin and renderEnd functions will ONLY be called for a function with an associated init function and if that init function has already been called. They provide an opportunity to check the validity of external resources during re-rendering.
|
Per-frame cleanup function (possibly NULL).
|
|
Pointer to entry function.
|
|
Per-frame initialization function (possibly NULL).
|
|
RSL function prototype.
|
|
Per-render function (possibly NULL).
|
|
Per-render function (possibly NULL).
|