OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::RTShader::CGProgramProcessor Class Reference

CG Language program processor class. More...

#include <OgreShaderCGProgramProcessor.h>

+ Inheritance diagram for Ogre::RTShader::CGProgramProcessor:
+ Collaboration diagram for Ogre::RTShader::CGProgramProcessor:

Public Member Functions

 CGProgramProcessor ()
 Class constructor. More...
 
virtual ~CGProgramProcessor ()
 Class destructor. More...
 
virtual const StringgetTargetLanguage () const
 Return the target language of this processor. More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void * operator new[] (size_t sz)
 
virtual bool postCreateGpuPrograms (ProgramSet *programSet)
 
virtual bool preCreateGpuPrograms (ProgramSet *programSet)
 

Static Public Attributes

static String TargetLanguage
 

Protected Types

typedef map< Parameter
*, ParameterPtr >::type 
LocalParameterMap
 
typedef vector
< MergeCombination >::type 
MergeCombinationList
 
typedef vector< MergeParameter >
::type 
MergeParameterList
 
typedef vector< Operand * >::type OperandPtrVector
 
typedef map< Parameter
*, OperandPtrVector >::type 
ParameterOperandMap
 

Protected Member Functions

void bindAutoParameters (Program *pCpuProgram, GpuProgramPtr pGpuProgram)
 Bind the auto parameters for a given CPU and GPU program set. More...
 
void buildMergeCombinations ()
 Build parameter merging combinations. More...
 
void buildParameterReferenceMap (FunctionAtomInstanceList &funcAtomList, ParameterOperandMap &paramsRefMap)
 Builds a map between parameter and all the references to it. More...
 
void buildTexcoordTable (const ShaderParameterList &paramList, ShaderParameterList outParamsTable[4])
 Internal function that builds parameters table. More...
 
virtual bool compactVsOutputs (Function *vsMain, Function *fsMain)
 Compact the vertex shader output registers. More...
 
void countVsTexcoordOutputs (Function *vsMain, int &outTexCoordSlots, int &outTexCoordFloats)
 Internal method that counts vertex shader texcoord output slots and output floats. More...
 
void generateLocalSplitParameters (Function *func, GpuProgramType progType, MergeParameterList &mergedParams, ShaderParameterList &splitParams, LocalParameterMap &localParamsMap)
 Generates local parameters for the split parameters and perform packing/unpacking operation using them. More...
 
void mergeParameters (ShaderParameterList paramsTable[4], MergeParameterList &mergedParams, ShaderParameterList &splitParams)
 Merge the parameters from the given table. More...
 
bool mergeParametersByCombination (const MergeCombination &combination, ShaderParameterList paramsTable[4], MergeParameter *mergedParameter)
 Internal function that creates merged parameter from given combination. More...
 
void mergeParametersByPredefinedCombinations (ShaderParameterList paramsTable[4], MergeParameterList &mergedParams)
 Internal function that creates merged parameter using pre defined combinations. More...
 
void mergeParametersReminders (ShaderParameterList paramsTable[4], MergeParameterList &mergedParams, ShaderParameterList &splitParams)
 Merge reminders parameters that could not be merged into one slot using the predefined combinations. More...
 
void rebuildFunctionInvocations (FunctionAtomInstanceList &funcAtomList, MergeParameterList &mergedParams, LocalParameterMap &localParamsMap)
 Rebuild function invocations by replacing references to old source parameters with the matching merged parameters components. More...
 
void rebuildParameterList (Function *func, int paramsUsage, MergeParameterList &mergedParams)
 Rebuild the given parameters list using the merged parameters. More...
 
void replaceParametersReferences (MergeParameterList &mergedParams, ParameterOperandMap &paramsRefMap)
 Replace references to old parameters with the new merged parameters. More...
 
void replaceSplitParametersReferences (LocalParameterMap &localParamsMap, ParameterOperandMap &paramsRefMap)
 Replace references to old parameters that have been split with the new local parameters that represents them. More...
 

Static Protected Member Functions

static int getParameterFloatCount (GpuConstantType type)
 Return number of floats needed by the given type. More...
 
static int getParameterMaskByFloatCount (int floatCount)
 Return the parameter mask of by the float count type (I.E: X|Y for 2 etc..) More...
 
static int getParameterMaskByType (GpuConstantType type)
 Return the parameter mask of by the given parameter type (I.E: X|Y for FLOAT2 etc..) More...
 

Protected Attributes

map< Function *, String * >::type mFunctionMap
 
int mMaxTexCoordFloats
 
int mMaxTexCoordSlots
 
MergeCombinationList mParamMergeCombinations
 

Detailed Description

CG Language program processor class.

Definition at line 46 of file OgreShaderCGProgramProcessor.h.

Member Typedef Documentation

Definition at line 168 of file OgreShaderProgramProcessor.h.

Definition at line 166 of file OgreShaderProgramProcessor.h.

Constructor & Destructor Documentation

Ogre::RTShader::CGProgramProcessor::CGProgramProcessor ( )

Class constructor.

virtual Ogre::RTShader::CGProgramProcessor::~CGProgramProcessor ( )
virtual

Class destructor.

Member Function Documentation

void Ogre::RTShader::ProgramProcessor::bindAutoParameters ( Program pCpuProgram,
GpuProgramPtr  pGpuProgram 
)
protectedinherited

Bind the auto parameters for a given CPU and GPU program set.

void Ogre::RTShader::ProgramProcessor::buildMergeCombinations ( )
protectedinherited

Build parameter merging combinations.

void Ogre::RTShader::ProgramProcessor::buildParameterReferenceMap ( FunctionAtomInstanceList funcAtomList,
ParameterOperandMap paramsRefMap 
)
protectedinherited

Builds a map between parameter and all the references to it.

void Ogre::RTShader::ProgramProcessor::buildTexcoordTable ( const ShaderParameterList paramList,
ShaderParameterList  outParamsTable[4] 
)
protectedinherited

Internal function that builds parameters table.

Parameters
paramListThe parameter list.
outParamsTableWill hold the texcoord params sorted by types in each row.
virtual bool Ogre::RTShader::ProgramProcessor::compactVsOutputs ( Function vsMain,
Function fsMain 
)
protectedvirtualinherited

Compact the vertex shader output registers.

Parameters
vsMainThe vertex shader entry function.
fsMainThe fragment shader entry function. Return true on success.
void Ogre::RTShader::ProgramProcessor::countVsTexcoordOutputs ( Function vsMain,
int &  outTexCoordSlots,
int &  outTexCoordFloats 
)
protectedinherited

Internal method that counts vertex shader texcoord output slots and output floats.

Parameters
vsMainThe vertex shader entry function.
outTexCoordSlotsWill hold the number of used output texcoord slots.
outTexCoordFloatsWill hold the total number of floats used by output texcoord slots.
void Ogre::RTShader::ProgramProcessor::generateLocalSplitParameters ( Function func,
GpuProgramType  progType,
MergeParameterList mergedParams,
ShaderParameterList splitParams,
LocalParameterMap localParamsMap 
)
protectedinherited

Generates local parameters for the split parameters and perform packing/unpacking operation using them.

static int Ogre::RTShader::ProgramProcessor::getParameterFloatCount ( GpuConstantType  type)
staticprotectedinherited

Return number of floats needed by the given type.

static int Ogre::RTShader::ProgramProcessor::getParameterMaskByFloatCount ( int  floatCount)
staticprotectedinherited

Return the parameter mask of by the float count type (I.E: X|Y for 2 etc..)

static int Ogre::RTShader::ProgramProcessor::getParameterMaskByType ( GpuConstantType  type)
staticprotectedinherited

Return the parameter mask of by the given parameter type (I.E: X|Y for FLOAT2 etc..)

virtual const String& Ogre::RTShader::CGProgramProcessor::getTargetLanguage ( ) const
inlinevirtual

Return the target language of this processor.

Implements Ogre::RTShader::ProgramProcessor.

Definition at line 60 of file OgreShaderCGProgramProcessor.h.

void Ogre::RTShader::ProgramProcessor::mergeParameters ( ShaderParameterList  paramsTable[4],
MergeParameterList mergedParams,
ShaderParameterList splitParams 
)
protectedinherited

Merge the parameters from the given table.

Parameters
paramsTableSource parameters table.
mergedParamsWill hold the merged parameters list.
bool Ogre::RTShader::ProgramProcessor::mergeParametersByCombination ( const MergeCombination combination,
ShaderParameterList  paramsTable[4],
MergeParameter mergedParameter 
)
protectedinherited

Internal function that creates merged parameter from given combination.

Parameters
combinationThe merge combination to try.
paramsTableThe params table sorted by types in each row.
mergedParameterWill hold the merged parameter.
void Ogre::RTShader::ProgramProcessor::mergeParametersByPredefinedCombinations ( ShaderParameterList  paramsTable[4],
MergeParameterList mergedParams 
)
protectedinherited

Internal function that creates merged parameter using pre defined combinations.

Parameters
paramsTableSource parameters table.
mergedParamsThe merged parameters list.
void Ogre::RTShader::ProgramProcessor::mergeParametersReminders ( ShaderParameterList  paramsTable[4],
MergeParameterList mergedParams,
ShaderParameterList splitParams 
)
protectedinherited

Merge reminders parameters that could not be merged into one slot using the predefined combinations.

Parameters
paramsTableThe params table sorted by types in each row.
mergedParamsThe merged parameters list.
splitParamsThe split parameters list.
template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

virtual bool Ogre::RTShader::CGProgramProcessor::postCreateGpuPrograms ( ProgramSet programSet)
virtual
virtual bool Ogre::RTShader::CGProgramProcessor::preCreateGpuPrograms ( ProgramSet programSet)
virtual
void Ogre::RTShader::ProgramProcessor::rebuildFunctionInvocations ( FunctionAtomInstanceList funcAtomList,
MergeParameterList mergedParams,
LocalParameterMap localParamsMap 
)
protectedinherited

Rebuild function invocations by replacing references to old source parameters with the matching merged parameters components.

void Ogre::RTShader::ProgramProcessor::rebuildParameterList ( Function func,
int  paramsUsage,
MergeParameterList mergedParams 
)
protectedinherited

Rebuild the given parameters list using the merged parameters.

void Ogre::RTShader::ProgramProcessor::replaceParametersReferences ( MergeParameterList mergedParams,
ParameterOperandMap paramsRefMap 
)
protectedinherited

Replace references to old parameters with the new merged parameters.

void Ogre::RTShader::ProgramProcessor::replaceSplitParametersReferences ( LocalParameterMap localParamsMap,
ParameterOperandMap paramsRefMap 
)
protectedinherited

Replace references to old parameters that have been split with the new local parameters that represents them.

Member Data Documentation

map<Function *, String *>::type Ogre::RTShader::ProgramProcessor::mFunctionMap
protectedinherited

Definition at line 263 of file OgreShaderProgramProcessor.h.

int Ogre::RTShader::ProgramProcessor::mMaxTexCoordFloats
protectedinherited

Definition at line 262 of file OgreShaderProgramProcessor.h.

int Ogre::RTShader::ProgramProcessor::mMaxTexCoordSlots
protectedinherited

Definition at line 260 of file OgreShaderProgramProcessor.h.

MergeCombinationList Ogre::RTShader::ProgramProcessor::mParamMergeCombinations
protectedinherited

Definition at line 258 of file OgreShaderProgramProcessor.h.

String Ogre::RTShader::CGProgramProcessor::TargetLanguage
static

Definition at line 72 of file OgreShaderCGProgramProcessor.h.


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