#include <RslPlugin.h>
|
template<typename T > |
class | RslIter |
|
template<typename T > |
class | RslArrayIter |
|
The RslContext provides access to various capabilities required by shader plugins. The context provides thread-safe global storage (via GetGlobalStorage()), per-thread storage (via GetThreadStorage()), and local "per-grid" storage (via GetLocalStorage()). It also provides a general-purpose way to obtain RenderMan interface extensions (RixInterface), which provide additional utilities, including error/warning messages with duplicate suppression (RixMessages), statistics (RixStats), and threading utilitis (RixThreadUtils).
RixStorage* RslContext_v1::GetGlobalStorage |
( |
) | |
const |
|
inline |
Get thread-safe global variable storage (RixStorage), which is used as follows:
storage->Lock();
void* myglobal = storage->Get("myglobal");
if (myglobal == NULL) {
myglobal = MakeData();
storage->Set("myglobal", myglobal, CleanupData);
}
storage->Unlock();
This code operates as follows:
- Get the globals from the RslContext.
- Lock the globals for thread safety.
- Look up the key to see if the data already exists.
- If not, allocate the data and store it in the globals. (The optional cleanup function is called at end of frame.)
- Unlock the globals.
RixStorage* RslContext_v1::GetLocalStorage |
( |
) | |
const |
|
inline |
Get local data storage (RixStorage), which is cleared when the current shader set finishes running on the current set of points.
virtual RixInterface* RslContext_v1::GetRixInterface |
( |
RixInterfaceId |
id) | |
const |
|
pure virtual |
Shader plugins have access to RixInterfaces that provide various kinds of storage management (per-frame, per-thread, and per-grid), statistics reporting, error messages, etc.
virtual const RslRunFlag* RslContext_v1::GetRunFlags |
( |
unsigned int * |
length) | |
const |
|
pure virtual |
Returns an array of runflags. A value of 1 indicates the grid point is active, a value of 0 means the grid point is not active.
RixStorage* RslContext_v1::GetThreadStorage |
( |
) | |
const |
|
inline |
Get per-thread storage (RixStorage), which is used as follows:
void* mydata = storage->Get("mydata");
if (mydata == NULL) {
mydata = MakeData();
storage->Set("mydata", mydata, CleanupData);
}
This code operates as follows:
- Get the per-thread storage from the RslContext.
- Look up the key to see if the data already exists.
- If not, allocate the data and store it in the globals. (The optional cleanup function is called at end of frame.)
void RslContext_v1::SetLocalData |
( |
void * |
data, |
|
|
RixCleanupFunc |
cleanup = 0L |
|
) |
| |
|
inline |
Set local user data and optional cleanup function. The cleanup function is called on the user data when the current shader set finishes running on the current set of points. For greater flexibility, use GetLocalStorage().
void RslContext_v1::SetThreadData |
( |
void * |
data, |
|
|
RixCleanupFunc |
cleanup = 0L |
|
) |
| |
|
inline |
Set per-thread user data and optional cleanup function. The cleanup function is called on the user data when the thread is terminated. For greater flexibility, use GetThreadStorage().
The documentation for this class was generated from the following file: