BRL-CAD
ShaderInstance Class Reference

#include <oslexec_pvt.h>

Public Types

typedef ShaderInstanceRef ref
 

Public Member Functions

 ShaderInstance (ShaderMaster::ref master, const char *layername="")
 
 ~ShaderInstance ()
 
ustring layername () const
 
const std::string & shadername () const
 
ShaderMastermaster () const
 
ShadingSystemImplshadingsys () const
 
void parameters (const ParamValueList &params)
 
int findsymbol (ustring name) const
 
int findparam (ustring name) const
 
Symbol * symbol (int index)
 
const Symbol * symbol (int index) const
 
size_t heapround ()
 
void add_connection (int srclayer, const ConnectedParam &srccon, const ConnectedParam &dstcon)
 
int nconnections () const
 
const Connectionconnection (int i) const
 
ConnectionVecconnections ()
 
const ConnectionVecconnections () const
 
int id () const
 
bool writes_globals () const
 
bool run_lazily () const
 
void run_lazily (bool lazy)
 
bool outgoing_connections () const
 
void outgoing_connections (bool out)
 
int maincodebegin () const
 
int maincodeend () const
 
int firstparam () const
 
int lastparam () const
 
int Psym () const
 
int Nsym () const
 
const std::vector< int > & args () const
 
std::vector< int > & args ()
 
int arg (int argnum)
 
Symbol * argsymbol (int argnum)
 
const OpcodeVec & ops () const
 
OpcodeVec & ops ()
 
std::string print ()
 
SymbolVec & symbols ()
 
const SymbolVec & symbols () const
 
void make_symbol_room (size_t moresyms=1)
 
bool unused () const
 
void copy_code_from_master ()
 

Friends

class ShadingSystemImpl
 
class RuntimeOptimizer
 
std::pair< Symbol *, Symbol * > param_range (ShaderInstance *i)
 
std::pair< const Symbol *, const Symbol * > param_range (const ShaderInstance *i)
 

Detailed Description

ShaderInstance is a particular instance of a shader, with its own set of parameter values, coordinate transform, and connections to other instances within the same shader group.

Definition at line 303 of file oslexec_pvt.h.

Member Typedef Documentation

Definition at line 305 of file oslexec_pvt.h.

Constructor & Destructor Documentation

ShaderInstance ( ShaderMaster::ref  master,
const char *  layername = "" 
)

Member Function Documentation

ustring layername ( ) const
inline

Return the layer name of this instance

Definition at line 311 of file oslexec_pvt.h.

const std::string& shadername ( ) const
inline

Return the name of the shader used by this instance.

Definition at line 315 of file oslexec_pvt.h.

ShaderMaster* master ( ) const
inline

Return a pointer to the master for this instance.

Definition at line 319 of file oslexec_pvt.h.

ShadingSystemImpl& shadingsys ( ) const
inline

Return a reference to the shading system for this instance.

Definition at line 323 of file oslexec_pvt.h.

void parameters ( const ParamValueList &  params)

Apply pending parameters

int findsymbol ( ustring  name) const

Find the named symbol, return its index in the symbol array, or -1 if not found.

int findparam ( ustring  name) const

Find the named parameter, return its index in the symbol array, or -1 if not found.

Symbol* symbol ( int  index)
inline

Return a pointer to the symbol (specified by integer index), or NULL (if index was -1, as returned by 'findsymbol').

Definition at line 339 of file oslexec_pvt.h.

const Symbol* symbol ( int  index) const
inline

Definition at line 340 of file oslexec_pvt.h.

size_t heapround ( )

Estimate how much to round the required heap size up if npoints is odd, to account for getting the desired alignment for each symbol.

void add_connection ( int  srclayer,
const ConnectedParam srccon,
const ConnectedParam dstcon 
)

Add a connection

int nconnections ( ) const
inline

How many connections to earlier layers do we have?

Definition at line 354 of file oslexec_pvt.h.

const Connection& connection ( int  i) const
inline

Return a reference to the i-th connection to an earlier layer.

Definition at line 358 of file oslexec_pvt.h.

ConnectionVec& connections ( )
inline

Reference to the connection list.

Definition at line 362 of file oslexec_pvt.h.

const ConnectionVec& connections ( ) const
inline

Definition at line 363 of file oslexec_pvt.h.

int id ( ) const
inline

Return the unique ID of this instance.

Definition at line 367 of file oslexec_pvt.h.

bool writes_globals ( ) const
inline

Does this instance potentially write to any global vars?

Definition at line 371 of file oslexec_pvt.h.

bool run_lazily ( ) const
inline

Should this instance only be run lazily (i.e., not unconditionally)?

Definition at line 375 of file oslexec_pvt.h.

void run_lazily ( bool  lazy)
inline

Definition at line 376 of file oslexec_pvt.h.

bool outgoing_connections ( ) const
inline

Does this instance have any outgoing connections?

Definition at line 380 of file oslexec_pvt.h.

void outgoing_connections ( bool  out)
inline

Set whether this instance has outgoing connections.

Definition at line 383 of file oslexec_pvt.h.

References out.

int maincodebegin ( ) const
inline

Definition at line 385 of file oslexec_pvt.h.

int maincodeend ( ) const
inline

Definition at line 386 of file oslexec_pvt.h.

int firstparam ( ) const
inline

Definition at line 388 of file oslexec_pvt.h.

int lastparam ( ) const
inline

Definition at line 389 of file oslexec_pvt.h.

int Psym ( ) const
inline

Definition at line 403 of file oslexec_pvt.h.

int Nsym ( ) const
inline

Definition at line 404 of file oslexec_pvt.h.

const std::vector<int>& args ( ) const
inline

Definition at line 407 of file oslexec_pvt.h.

std::vector<int>& args ( )
inline

Definition at line 408 of file oslexec_pvt.h.

int arg ( int  argnum)
inline

Definition at line 409 of file oslexec_pvt.h.

Symbol* argsymbol ( int  argnum)
inline

Definition at line 410 of file oslexec_pvt.h.

const OpcodeVec& ops ( ) const
inline

Definition at line 411 of file oslexec_pvt.h.

OpcodeVec& ops ( )
inline

Definition at line 412 of file oslexec_pvt.h.

std::string print ( )
SymbolVec& symbols ( )
inline

Definition at line 416 of file oslexec_pvt.h.

const SymbolVec& symbols ( ) const
inline

Definition at line 417 of file oslexec_pvt.h.

void make_symbol_room ( size_t  moresyms = 1)

Make sure there's room for more symbols.

bool unused ( ) const
inline

Does it appear that the layer is completely unused?

Definition at line 425 of file oslexec_pvt.h.

void copy_code_from_master ( )

Make our own version of the code and args from the master.

Friends And Related Function Documentation

friend class ShadingSystemImpl
friend

Definition at line 449 of file oslexec_pvt.h.

friend class RuntimeOptimizer
friend

Definition at line 450 of file oslexec_pvt.h.

std::pair<Symbol *,Symbol *> param_range ( ShaderInstance i)
friend

Return a begin/end Symbol* pair for the set of param symbols that is suitable to pass as a range for BOOST_FOREACH.

Definition at line 393 of file oslexec_pvt.h.

std::pair<const Symbol *,const Symbol *> param_range ( const ShaderInstance i)
friend

Definition at line 398 of file oslexec_pvt.h.


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