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

SH::ShVariableNode Class Reference

A generic n-tuple variable. More...

#include <ShVariableNode.hpp>

Inheritance diagram for SH::ShVariableNode:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ShVariableNode (ShBindingType kind, int size, ShValueType valueType, ShSemanticType type=SH_ATTRIB)
 Constructs a VariableNode that holds a tuple of data of type.
bool uniform () const
 Is this a uniform (non-shader specific) variable?
bool hasValues () const
 Does this variable have values in the host, e.g.
int size () const
 Get the number of elements in this variable.
void size (int size)
void lock ()
 Do not update bound shaders in subsequent setValue calls.
void unlock ()
 Update bound shader values, and turn off locking.
ShValueType valueType () const
 Returns index of the data type held in this node.
std::string name () const
 Get this variable's name.
void name (const std::string &n)
 Set this variable's name.
bool hasRange ()
 Whether this variable has ranges set.
void rangeVariant (const ShVariant *low, const ShVariant *high)
 Set a range of possible values for this variable's elements.
void rangeVariant (const ShVariant *low, const ShVariant *high, bool neg, const ShSwizzle &writemask)
ShVariantPtr lowBoundVariant () const
 Generates a new ShVariant holding the lower bound.
ShVariantPtr highBoundVariant () const
 Generates a new ShVariant holding the upper bound.
ShBindingType kind () const
ShSemanticType specialType () const
void specialType (ShSemanticType)
const ShVariantgetVariant () const
 Retrieve the variant.
ShVariantgetVariant ()
 Retrieve the variant. This should probably only be used internally.
void addVariant ()
 Ensure this node has space to store host-side values.
void * operator new (std::size_t size)
void operator delete (void *d)
virtual ~ShVariableNode ()
ShVariableNodePtr clone (ShBindingType newKind=SH_BINDINGTYPE_END, int newSize=0, ShValueType newValueType=SH_VALUETYPE_END, ShSemanticType newType=SH_SEMANTICTYPE_END, bool updateVarList=true, bool keepUniform=true) const
 Clones this ShVariableNode, copying all fields and meta data.
std::string nameOfType () const
 Get a string of this var's specialType, kind, & size.
void setVariant (const ShVariant *other)
 Set the elements of this' variant to those of other.
void setVariant (ShVariantCPtr other)
void setVariant (const ShVariant *other, int index)
 Update indexed element of this' variant.
void setVariant (ShVariantCPtr other, int index)
void setVariant (const ShVariant *other, bool neg, const ShSwizzle &writemask)
 Update elements of this' variant applying the given writemask and negation.
void setVariant (ShVariantCPtr other, bool neg, const ShSwizzle &writemask)
void attach (const ShPointer< ShProgramNode > &evaluator)
 Attaching a null program causes this uniform to no longer become dependent.
void update ()
 Reevaluate a dependent uniform.
void update_all ()
const ShPointer< ShProgramNode > & evaluator () const
 Obtain the program defining this uniform, if any.

Protected Member Functions

 ShVariableNode (const ShVariableNode &old, ShBindingType newKind, int newSize, ShValueType newValueType, ShSemanticType newType, bool updateVarList, bool keepUniform)
 Creates a new variable node that holds the same data type as old.
ShVariantmakeLow () const
ShVariantmakeHigh () const
void programVarListInit ()
void programDeclInit ()
 Adds this to the declared temps set.
void add_dependent (ShVariableNode *dep)
void remove_dependent (ShVariableNode *dep)
void update_dependents ()
void detach_dependencies ()

Protected Attributes

bool m_uniform
ShBindingType m_kind
ShSemanticType m_specialType
ShValueType m_valueType
int m_size
int m_id
int m_locked
ShVariantPtr m_variant
 Ref-counted pointer to the variant.
ShVariableNodeEvalm_eval
std::list< ShVariableNode * > m_dependents

Static Protected Attributes

static int m_maxID
static ShPoolm_pool

Detailed Description

A generic n-tuple variable.

Definition at line 50 of file ShVariableNode.hpp.


Member Function Documentation

void SH::ShVariableNode::addVariant  ) 
 

Ensure this node has space to store host-side values.

Normally this is not necessary, but when uniforms are given dependent programs and evaluated all the temporaries will need to store values during an evaluation.

Definition at line 423 of file ShVariableNode.cpp.

References SH::ShVariantFactory::generate(), m_size, m_valueType, m_variant, and SH::shVariantFactory().

Referenced by ShVariableNode().

bool SH::ShVariableNode::hasValues  )  const
 

Does this variable have values in the host, e.g.

for constants and uniforms.

Definition at line 127 of file ShVariableNode.cpp.

References m_variant.

void SH::ShVariableNode::programDeclInit  )  [protected]
 

Adds this to the declared temps set.

If current parsing program has cfg node (i.e. this is a transformation, not a new program specification), then adds to programs entry node. Else adds an SH_OP_DECL as a dummy statement into current parsing block.

Definition at line 404 of file ShVariableNode.cpp.

References SH::ShContext::current(), m_kind, m_uniform, SH::ShContext::parsing(), and SH::SH_OP_DECL.

Referenced by ShVariableNode().


Member Data Documentation

ShVariantPtr SH::ShVariableNode::m_variant [protected]
 

Ref-counted pointer to the variant.

ShVariableNode is always the sole owner of this pointer once the node exists.

Definition at line 227 of file ShVariableNode.hpp.

Referenced by addVariant(), getVariant(), hasValues(), name(), setVariant(), and size().


The documentation for this class was generated from the following files:
Generated on Wed Jun 15 18:16:44 2005 for Sh by  doxygen 1.4.3-20050530