OGRE: Ogre::RTShader::GLSLProgramProcessor Class Reference - OGRE Documentation

Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes

# Ogre::RTShader::GLSLProgramProcessor Class Reference
[RTShader]

GLSL Language program processor class. More...

`#include <OgreShaderGLSLProgramProcessor.h>`

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

List of all members.

## Public Member Functions
| GLSLProgramProcessor ()
| Class constructor.
virtual | ~GLSLProgramProcessor ()
| Class destructor.
virtual const String & | getTargetLanguage () const
| Return the target language of this processor.
virtual bool | preCreateGpuPrograms (ProgramSet *programSet)
virtual bool | postCreateGpuPrograms (ProgramSet *programSet)
void * | operator new (size_t sz, const char *file, int line, const char *func)
| operator new, with debug line info
void * | operator new (size_t sz)
void * | operator new (size_t sz, void *ptr)
| placement operator new
void * | operator new[] (size_t sz, const char *file, int line, const char *func)
| array operator new, with debug line info
void * | operator new[] (size_t sz)
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 *)
## Protected Types
typedef vector< MergeParameter > ::type | MergeParameterList
typedef vector < MergeCombination >::type | MergeCombinationList
typedef vector< Operand * >::type | OperandPtrVector
typedef map< Parameter *, OperandPtrVector >::type | ParameterOperandMap
typedef map< Parameter *, ParameterPtr >::type | LocalParameterMap
## Protected Member Functions
void | buildMergeCombinations ()
| Build parameter merging combinations.
virtual bool | compactVsOutputs (Function *vsMain, Function *fsMain)
| Compact the vertex shader output registers.
void | countVsTexcoordOutputs (Function *vsMain, int &outTexCoordSlots, int &outTexCoordFloats)
| Internal method that counts vertex shader texcoord output slots and output floats.
void | buildTexcoordTable (const ShaderParameterList &paramList, ShaderParameterList outParamsTable[4])
| Internal function that builds parameters table.
void | mergeParameters (ShaderParameterList paramsTable[4], MergeParameterList &mergedParams, ShaderParameterList &splitParams)
| Merge the parameters from the given table.
void | mergeParametersByPredefinedCombinations (ShaderParameterList paramsTable[4], MergeParameterList &mergedParams)
| Internal function that creates merged parameter using pre defined combinations.
bool | mergeParametersByCombination (const MergeCombination &combination, ShaderParameterList paramsTable[4], MergeParameter *mergedParameter)
| Internal function that creates merged parameter from given combination.
void | mergeParametersReminders (ShaderParameterList paramsTable[4], MergeParameterList &mergedParams, ShaderParameterList &splitParams)
| Merge reminders parameters that could not be merged into one slot using the predefined combinations.
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.
void | rebuildParameterList (Function *func, int paramsUsage, MergeParameterList &mergedParams)
| Rebuild the given parameters list using the merged parameters.
void | rebuildFunctionInvocations (FunctionAtomInstanceList &funcAtomList, MergeParameterList &mergedParams, LocalParameterMap &localParamsMap)
| Rebuild function invocations by replacing references to old source parameters with the matching merged parameters components.
void | buildParameterReferenceMap (FunctionAtomInstanceList &funcAtomList, ParameterOperandMap &paramsRefMap)
| Builds a map between parameter and all the references to it.
void | replaceParametersReferences (MergeParameterList &mergedParams, ParameterOperandMap &paramsRefMap)
| Replace references to old parameters with the new merged parameters.
void | replaceSplitParametersReferences (LocalParameterMap &localParamsMap, ParameterOperandMap &paramsRefMap)
| Replace references to old parameters that have been split with the new local parameters that represents them.
void | bindAutoParameters (Program *pCpuProgram, GpuProgramPtr pGpuProgram)
| Bind the auto parameters for a given CPU and GPU program set.
## Static Protected Member Functions
static int | getParameterFloatCount (GpuConstantType type)
| Return number of floats needed by the given type.
static int | getParameterMaskByType (GpuConstantType type)
| Return the parameter mask of by the given parameter type (I.E: X|Y for FLOAT2 etc..).
static int | getParameterMaskByFloatCount (int floatCount)
| Return the parameter mask of by the float count type (I.E: X|Y for 2 etc..).
## Protected Attributes
MergeCombinationList | mParamMergeCombinations
int | mMaxTexCoordSlots
int | mMaxTexCoordFloats
## Private Member Functions
void | bindTextureSamplers (Program *pCpuProgram, GpuProgramPtr pGpuProgram)
| Bind texture samplers.
void | bindSubShaders (Program *program, GpuProgramPtr pGpuProgram)
| Compiles sub shaders (only if the not exists) and attach them to the main gpu program.
## Private Attributes
StringVector | mLibraryPrograms
## Static Private Attributes
static String | TargetLanguage

## Detailed Description

GLSL Language program processor class.

Definition at line 47 of file OgreShaderGLSLProgramProcessor.h.

## Member Typedef Documentation

typedef map<Parameter*, ParameterPtr>::type Ogre::RTShader::ProgramProcessor::LocalParameterMap`[protected, inherited]`

Definition at line 162 of file OgreShaderProgramProcessor.h.

typedef vector<MergeCombination>::type Ogre::RTShader::ProgramProcessor::MergeCombinationList`[protected, inherited]`

Definition at line 157 of file OgreShaderProgramProcessor.h.

typedef vector<MergeParameter>::type Ogre::RTShader::ProgramProcessor::MergeParameterList`[protected, inherited]`

Definition at line 130 of file OgreShaderProgramProcessor.h.

typedef vector<Operand*>::type Ogre::RTShader::ProgramProcessor::OperandPtrVector`[protected, inherited]`

Definition at line 160 of file OgreShaderProgramProcessor.h.

typedef map<Parameter*, OperandPtrVector>::type Ogre::RTShader::ProgramProcessor::ParameterOperandMap`[protected, inherited]`

Definition at line 161 of file OgreShaderProgramProcessor.h.

## Constructor & Destructor Documentation

Ogre::RTShader::GLSLProgramProcessor::GLSLProgramProcessor | ( |  | ) |

Class constructor.

Parameters:

  | type | The type of this program.

virtual Ogre::RTShader::GLSLProgramProcessor::~GLSLProgramProcessor | ( |  | ) | `[virtual]`

Class destructor.

## Member Function Documentation

void Ogre::RTShader::ProgramProcessor::bindAutoParameters | ( | Program * | pCpuProgram,
|  | GpuProgramPtr | pGpuProgram |
| ) |  |  | `[protected, inherited]`

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

void Ogre::RTShader::GLSLProgramProcessor::bindSubShaders | ( | Program * | program,
|  | GpuProgramPtr | pGpuProgram |
| ) |  |  | `[private]`

Compiles sub shaders (only if the not exists) and attach them to the main gpu program.

void Ogre::RTShader::GLSLProgramProcessor::bindTextureSamplers | ( | Program * | pCpuProgram,
|  | GpuProgramPtr | pGpuProgram |
| ) |  |  | `[private]`

Bind texture samplers.

void Ogre::RTShader::ProgramProcessor::buildMergeCombinations | ( |  | ) | `[protected, inherited]`

Build parameter merging combinations.

void Ogre::RTShader::ProgramProcessor::buildParameterReferenceMap | ( | FunctionAtomInstanceList & | funcAtomList,
|  | ParameterOperandMap & | paramsRefMap |
| ) |  |  | `[protected, inherited]`

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

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

Internal function that builds parameters table.

Parameters:

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

virtual bool Ogre::RTShader::ProgramProcessor::compactVsOutputs | ( | Function * | vsMain,
|  | Function * | fsMain |
| ) |  |  | `[protected, virtual, inherited]`

Compact the vertex shader output registers.

Parameters:

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

void Ogre::RTShader::ProgramProcessor::countVsTexcoordOutputs | ( | Function * | vsMain,
|  | int & | outTexCoordSlots,
|  | int & | outTexCoordFloats |
| ) |  |  | `[protected, inherited]`

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.

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

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

static int Ogre::RTShader::ProgramProcessor::getParameterFloatCount | ( | GpuConstantType | type | ) | `[static, protected, inherited]`

Return number of floats needed by the given type.

static int Ogre::RTShader::ProgramProcessor::getParameterMaskByFloatCount | ( | int | floatCount | ) | `[static, protected, inherited]`

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 | ) | `[static, protected, inherited]`

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

virtual const String& Ogre::RTShader::GLSLProgramProcessor::getTargetLanguage | ( |  | ) | const`[virtual]`

Return the target language of this processor.

Implements Ogre::RTShader::ProgramProcessor.

Definition at line 62 of file OgreShaderGLSLProgramProcessor.h.

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

Merge the parameters from the given table.

Parameters:

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

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

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.

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

Internal function that creates merged parameter using pre defined combinations.

Parameters:

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

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

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.

template<class Alloc >

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

Definition at line 95 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

Definition at line 107 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

Definition at line 101 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

Definition at line 112 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

Definition at line 118 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

Definition at line 72 of file OgreMemoryAllocatedObject.h.

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 67 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

placement operator new

Definition at line 78 of file OgreMemoryAllocatedObject.h.

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 85 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

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

Definition at line 90 of file OgreMemoryAllocatedObject.h.

virtual bool Ogre::RTShader::GLSLProgramProcessor::postCreateGpuPrograms | ( | ProgramSet * | programSet | ) | `[virtual]`

See also:
  ProgramProcessor::postCreateGpuPrograms

Implements Ogre::RTShader::ProgramProcessor.

virtual bool Ogre::RTShader::GLSLProgramProcessor::preCreateGpuPrograms | ( | ProgramSet * | programSet | ) | `[virtual]`

See also:
  ProgramProcessor::preCreateGpuPrograms

Implements Ogre::RTShader::ProgramProcessor.

void Ogre::RTShader::ProgramProcessor::rebuildFunctionInvocations | ( | FunctionAtomInstanceList & | funcAtomList,
|  | MergeParameterList & | mergedParams,
|  | LocalParameterMap & | localParamsMap |
| ) |  |  | `[protected, inherited]`

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 |
| ) |  |  | `[protected, inherited]`

Rebuild the given parameters list using the merged parameters.

void Ogre::RTShader::ProgramProcessor::replaceParametersReferences | ( | MergeParameterList & | mergedParams,
|  | ParameterOperandMap & | paramsRefMap |
| ) |  |  | `[protected, inherited]`

Replace references to old parameters with the new merged parameters.

void Ogre::RTShader::ProgramProcessor::replaceSplitParametersReferences | ( | LocalParameterMap & | localParamsMap,
|  | ParameterOperandMap & | paramsRefMap |
| ) |  |  | `[protected, inherited]`

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

## Member Data Documentation

StringVector Ogre::RTShader::GLSLProgramProcessor::mLibraryPrograms`[private]`

Definition at line 85 of file OgreShaderGLSLProgramProcessor.h.

int Ogre::RTShader::ProgramProcessor::mMaxTexCoordFloats`[protected, inherited]`

Definition at line 253 of file OgreShaderProgramProcessor.h.

int Ogre::RTShader::ProgramProcessor::mMaxTexCoordSlots`[protected, inherited]`

Definition at line 252 of file OgreShaderProgramProcessor.h.

MergeCombinationList Ogre::RTShader::ProgramProcessor::mParamMergeCombinations`[protected, inherited]`

Definition at line 251 of file OgreShaderProgramProcessor.h.

String Ogre::RTShader::GLSLProgramProcessor::TargetLanguage`[static, private]`

Definition at line 83 of file OgreShaderGLSLProgramProcessor.h.

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

- OgreShaderGLSLProgramProcessor.h

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Nov 3 2010 19:25:05