Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SH::ShProgramNode Class Reference

A particular Sh program. More...

#include <ShProgramNode.hpp>

Inheritance diagram for SH::ShProgramNode:

Inheritance graph
[legend]
Collaboration diagram for SH::ShProgramNode:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::list< ShVariableNodePtrVarList
typedef std::list< ShTextureNodePtrTexList
typedef std::list< ShChannelNodePtrChannelList

Public Member Functions

 ShProgramNode (const std::string &target)
void compile (const ShPointer< ShBackend > &backend)
 Forcefully compile this program for a particular backend, even if it has been compiled previously.

void compile (const std::string &target, const ShPointer< ShBackend > &backend)
 Forcefully compile this program for a particular backend, even if it has been compiled previously.

std::string describe_interface () const
 Describe the inputs and outputs of this program.

ShPointer< ShBackendCode > code ()
 Obtain the code for currently active backend.

ShPointer< ShBackendCode > code (const ShPointer< ShBackend > &backend)
 Obtain the code for a particular backend.

ShPointer< ShBackendCode > code (const std::string &target, const ShPointer< ShBackend > &backend)
 Obtain the code for a particular backend. Generates it if necessary.

void updateUniform (const ShVariableNodePtr &uniform)
 Notify this program that a uniform variable has changed.

void collectVariables ()
 Call after contructing the control graph [after optimization!] to make lists of all the variables used in the program.

VarList::const_iterator inputs_begin () const
VarList::const_iterator inputs_end () const
VarList::const_iterator outputs_begin () const
VarList::const_iterator outputs_end () const
VarList::const_iterator temps_begin () const
VarList::const_iterator temps_end () const
VarList::const_iterator constants_begin () const
VarList::const_iterator constants_end () const
VarList::const_iterator uniforms_begin () const
VarList::const_iterator uniforms_end () const
TexList::const_iterator textures_begin () const
TexList::const_iterator textures_end () const
ChannelList::const_iterator channels_begin () const
ChannelList::const_iterator channels_end () const
std::string target () const
 Can be empty, if there is no target associated with this program.

std::string & target ()
 It may be useful to change a program's target sometimes.

ShPointer< ShProgramNodeclone () const
 Make a copy of this program.

bool finished () const
 True if this program has been completed with SH_END.

void finish ()
 Set finished to true. Only shEndShader() needs to call this.

void assign (const ShVariableNodePtr &var) const

Static Public Member Functions

std::ostream & print (std::ostream &out, const VarList &list)
 Print a description of a list of variables.


Public Attributes

ShTokenizer tokenizer
 The tokenizer for this program's body.

ShPointer< ShCtrlGraphctrlGraph
 The control graph (the parsed form of the token list).

VarList inputs
 Input variables used in this program.

VarList outputs
 Output variables used in this program.

VarList temps
 Temporary variables used in this program.

VarList constants
 Constants used in this program.

VarList uniforms
 Uniform variables used in this program.

TexList textures
 Textures used in this program.

ChannelList channels
 Channels used in FETCH instructions in this program.


Detailed Description

A particular Sh program.

Definition at line 50 of file ShProgramNode.hpp.


Member Function Documentation

ShPointer< ShBackendCode > SH::ShProgramNode::code const ShPointer< ShBackend > &  backend  ) 
 

Obtain the code for a particular backend.

Generates it if necessary. This operation will fail if this program does not have a particular target.

Definition at line 79 of file ShProgramNode.cpp.

References code(), and SH::shError().

ShPointer< ShBackendCode > SH::ShProgramNode::code  ) 
 

Obtain the code for currently active backend.

This operation will fail if this program does not have a particular target.

Definition at line 75 of file ShProgramNode.cpp.

Referenced by code(), and compile().

void SH::ShProgramNode::compile const std::string &  target,
const ShPointer< ShBackend > &  backend
 

Forcefully compile this program for a particular backend, even if it has been compiled previously.

Use code() to obtain the actual code.

Definition at line 59 of file ShProgramNode.cpp.

References code(), and collectVariables().

void SH::ShProgramNode::compile const ShPointer< ShBackend > &  backend  ) 
 

Forcefully compile this program for a particular backend, even if it has been compiled previously.

Use code() to obtain the actual code. This operation will fail if this program does not have a particular target.

Definition at line 53 of file ShProgramNode.cpp.

References compile(), and SH::shError().

Referenced by code(), and compile().


Member Data Documentation

ShPointer<ShCtrlGraph> SH::ShProgramNode::ctrlGraph
 

The control graph (the parsed form of the token list).

Constructed during the parsing step, when shEndProgram() is called.

Definition at line 94 of file ShProgramNode.hpp.

Referenced by clone(), and collectVariables().

ShTokenizer SH::ShProgramNode::tokenizer
 

The tokenizer for this program's body.

Used only during construction of the program (before parsing)

Definition at line 89 of file ShProgramNode.hpp.


The documentation for this class was generated from the following files:
Generated on Mon Oct 18 14:17:57 2004 for Sh by doxygen 1.3.7