Ogre::RTShader::ProgramProcessor Class Referenceabstract
Core » RTShader

A class that provides extra processing services on CPU based programs. More...

`#include <OgreShaderProgramProcessor.h>`

Inheritance diagram for Ogre::RTShader::ProgramProcessor:
[legend]

## Classes

struct | MergeCombination
class | MergeParameter

## Public Member Functions

| ProgramProcessor ()
| Class constructor. More...
virtual | ~ProgramProcessor ()
| Class destructor. More...
virtual const String & | getTargetLanguage () const =0
| 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)=0
| Called after creation of the GPU programs. More...
virtual bool | preCreateGpuPrograms (ProgramSet *programSet)=0
| Called before creation of the GPU programs. More...

## 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

A class that provides extra processing services on CPU based programs.

The base class perform only the generic processing. In order to provide target language specific services and optimization one should derive from this class and register its factory via the ProgramManager instance.

Definition at line 49 of file OgreShaderProgramProcessor.h.

## Member Typedef Documentation

## LocalParameterMap

typedef map<Parameter*, ParameterPtr>::type Ogre::RTShader::ProgramProcessor::LocalParameterMap

protected

Definition at line 169 of file OgreShaderProgramProcessor.h.

## MergeCombinationList

typedef vector<MergeCombination>::type Ogre::RTShader::ProgramProcessor::MergeCombinationList

protected

Definition at line 164 of file OgreShaderProgramProcessor.h.

## MergeParameterList

typedef vector<MergeParameter>::type Ogre::RTShader::ProgramProcessor::MergeParameterList

protected

Definition at line 135 of file OgreShaderProgramProcessor.h.

## OperandPtrVector

typedef vector<Operand*>::type Ogre::RTShader::ProgramProcessor::OperandPtrVector

protected

Definition at line 167 of file OgreShaderProgramProcessor.h.

## ParameterOperandMap

typedef map<Parameter*, OperandPtrVector>::type Ogre::RTShader::ProgramProcessor::ParameterOperandMap

protected

Definition at line 168 of file OgreShaderProgramProcessor.h.

## Constructor & Destructor Documentation

## ProgramProcessor()

Ogre::RTShader::ProgramProcessor::ProgramProcessor | ( |  | ) |

Class constructor.

## ~ProgramProcessor()

virtual Ogre::RTShader::ProgramProcessor::~ProgramProcessor | ( |  | ) |

virtual

Class destructor.

## Member Function Documentation

## bindAutoParameters()

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

protected

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

## buildMergeCombinations()

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

protected

Build parameter merging combinations.

## buildParameterReferenceMap()

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

protected

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

## buildTexcoordTable()

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

protected

Internal function that builds parameters table.

Parameters

  paramList | The parameter list.
  outParamsTable | Will hold the texcoord params sorted by types in each row.

## compactVsOutputs()

virtual bool Ogre::RTShader::ProgramProcessor::compactVsOutputs | ( | Function * | vsMain,
|  | Function * | fsMain
| ) |  |

protected virtual

Compact the vertex shader output registers.

Parameters

  vsMain | The vertex shader entry function.
  fsMain | The fragment shader entry function. Return true on success.

## countVsTexcoordOutputs()

void Ogre::RTShader::ProgramProcessor::countVsTexcoordOutputs | ( | Function * | vsMain,
|  | int & | outTexCoordSlots,
|  | int & | outTexCoordFloats
| ) |  |

protected

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

Parameters

  vsMain | The vertex shader entry function.
  outTexCoordSlots | Will hold the number of used output texcoord slots.
  outTexCoordFloats | Will hold the total number of floats used by output texcoord slots.

## generateLocalSplitParameters()

void Ogre::RTShader::ProgramProcessor::generateLocalSplitParameters | ( | Function * | func,
|  | GpuProgramType | progType,
|  | MergeParameterList & | mergedParams,
|  | ShaderParameterList & | splitParams,
|  | LocalParameterMap & | localParamsMap
| ) |  |

protected

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

## getParameterFloatCount()

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

static protected

Return number of floats needed by the given type.

## getParameterMaskByFloatCount()

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

static protected

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

## getParameterMaskByType()

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

static protected

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

## getTargetLanguage()

virtual const String& Ogre::RTShader::ProgramProcessor::getTargetLanguage | ( |  | ) | const

pure virtual

Return the target language of this processor.

Implemented in Ogre::RTShader::GLSLProgramProcessor, Ogre::RTShader::CGProgramProcessor, Ogre::RTShader::GLSLESProgramProcessor, and Ogre::RTShader::HLSLProgramProcessor.

## mergeParameters()

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

protected

Merge the parameters from the given table.

Parameters

  paramsTable | Source parameters table.
  mergedParams | Will hold the merged parameters list.

## mergeParametersByCombination()

bool Ogre::RTShader::ProgramProcessor::mergeParametersByCombination | ( | const MergeCombination & | combination,
|  | ShaderParameterList | paramsTable[4],
|  | MergeParameter * | mergedParameter
| ) |  |

protected

Internal function that creates merged parameter from given combination.

Parameters

  combination | The merge combination to try.
  paramsTable | The params table sorted by types in each row.
  mergedParameter | Will hold the merged parameter.

## mergeParametersByPredefinedCombinations()

void Ogre::RTShader::ProgramProcessor::mergeParametersByPredefinedCombinations | ( | ShaderParameterList | paramsTable[4],
|  | MergeParameterList & | mergedParams
| ) |  |

protected

Internal function that creates merged parameter using pre defined combinations.

Parameters

  paramsTable | Source parameters table.
  mergedParams | The merged parameters list.

## mergeParametersReminders()

void Ogre::RTShader::ProgramProcessor::mergeParametersReminders | ( | ShaderParameterList | paramsTable[4],
|  | MergeParameterList & | mergedParams,
|  | ShaderParameterList & | splitParams
| ) |  |

protected

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

Parameters

  paramsTable | The params table sorted by types in each row.
  mergedParams | The merged parameters list.
  splitParams | The split parameters list.

## operator delete() [1/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) |

inherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

## operator delete() [2/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |
| ) |  |

inherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

## operator delete() [3/3]

template<class Alloc >

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

inherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [1/2]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) |

inherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

## operator delete[]() [2/2]

template<class Alloc >

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

inherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

## operator new() [1/3]

template<class Alloc >

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

inherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

## operator new() [2/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) |

inherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

## operator new() [3/3]

template<class Alloc >

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

inherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

## operator new[]() [1/2]

template<class Alloc >

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

inherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

## operator new[]() [2/2]

template<class Alloc >

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

inherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

## postCreateGpuPrograms()

virtual bool Ogre::RTShader::ProgramProcessor::postCreateGpuPrograms | ( | ProgramSet * | programSet | ) |

pure virtual

Called after creation of the GPU programs.

Parameters

  programSet | The program set container. Return true on success.

Implemented in Ogre::RTShader::GLSLProgramProcessor, Ogre::RTShader::CGProgramProcessor, Ogre::RTShader::GLSLESProgramProcessor, and Ogre::RTShader::HLSLProgramProcessor.

## preCreateGpuPrograms()

virtual bool Ogre::RTShader::ProgramProcessor::preCreateGpuPrograms | ( | ProgramSet * | programSet | ) |

pure virtual

Called before creation of the GPU programs.

Do several preparation operation such as validation, register compaction and specific target language optimizations.

Parameters

  programSet | The program set container. Return true on success.

Implemented in Ogre::RTShader::GLSLProgramProcessor, Ogre::RTShader::CGProgramProcessor, Ogre::RTShader::GLSLESProgramProcessor, and Ogre::RTShader::HLSLProgramProcessor.

## rebuildFunctionInvocations()

void Ogre::RTShader::ProgramProcessor::rebuildFunctionInvocations | ( | FunctionAtomInstanceList & | funcAtomList,
|  | MergeParameterList & | mergedParams,
|  | LocalParameterMap & | localParamsMap
| ) |  |

protected

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

## rebuildParameterList()

void Ogre::RTShader::ProgramProcessor::rebuildParameterList | ( | Function * | func,
|  | int | paramsUsage,
|  | MergeParameterList & | mergedParams
| ) |  |

protected

Rebuild the given parameters list using the merged parameters.

## replaceParametersReferences()

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

protected

Replace references to old parameters with the new merged parameters.

## replaceSplitParametersReferences()

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

protected

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

## Member Data Documentation

## mFunctionMap

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

protected

Definition at line 264 of file OgreShaderProgramProcessor.h.

## mMaxTexCoordFloats

int Ogre::RTShader::ProgramProcessor::mMaxTexCoordFloats

protected

Definition at line 263 of file OgreShaderProgramProcessor.h.

## mMaxTexCoordSlots

int Ogre::RTShader::ProgramProcessor::mMaxTexCoordSlots

protected

Definition at line 261 of file OgreShaderProgramProcessor.h.

## mParamMergeCombinations

MergeCombinationList Ogre::RTShader::ProgramProcessor::mParamMergeCombinations

protected

Definition at line 259 of file OgreShaderProgramProcessor.h.

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

- OgreShaderProgramProcessor.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.