A class that provides extra processing services on CPU based programs. More...
#include <OgreShaderProgramProcessor.h>
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 ¶msRefMap) |
Builds a map between parameter and all the references to it. More... | |
void | buildTexcoordTable (const ShaderParameterList ¶mList, 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 ¶msRefMap) |
Replace references to old parameters with the new merged parameters. More... | |
void | replaceSplitParametersReferences (LocalParameterMap &localParamsMap, ParameterOperandMap ¶msRefMap) |
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 | |
std::map< Function *, String * > | mFunctionMap |
int | mMaxTexCoordFloats |
int | mMaxTexCoordSlots |
MergeCombinationList | mParamMergeCombinations |
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.
|
protected |
Definition at line 170 of file OgreShaderProgramProcessor.h.
|
protected |
Definition at line 165 of file OgreShaderProgramProcessor.h.
|
protected |
Definition at line 136 of file OgreShaderProgramProcessor.h.
|
protected |
Definition at line 168 of file OgreShaderProgramProcessor.h.
|
protected |
Definition at line 169 of file OgreShaderProgramProcessor.h.
Ogre::RTShader::ProgramProcessor::ProgramProcessor | ( | ) |
Class constructor.
type | The type of this program. |
|
virtual |
Class destructor.
|
protected |
Bind the auto parameters for a given CPU and GPU program set.
|
protected |
Build parameter merging combinations.
|
protected |
Builds a map between parameter and all the references to it.
|
protected |
Internal function that builds parameters table.
paramList | The parameter list. |
outParamsTable | Will hold the texcoord params sorted by types in each row. |
|
protectedvirtual |
Compact the vertex shader output registers.
vsMain | The vertex shader entry function. |
fsMain | The fragment shader entry function. Return true on success. |
|
protected |
Internal method that counts vertex shader texcoord output slots and output floats.
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. |
|
protected |
Generates local parameters for the split parameters and perform packing/unpacking operation using them.
|
staticprotected |
Return number of floats needed by the given type.
|
staticprotected |
Return the parameter mask of by the float count type (I.E: X|Y for 2 etc..)
|
staticprotected |
Return the parameter mask of by the given parameter type (I.E: X|Y for FLOAT2 etc..)
|
pure virtual |
Return the target language of this processor.
Implemented in Ogre::RTShader::GLSLProgramProcessor, Ogre::RTShader::CGProgramProcessor, Ogre::RTShader::GLSLESProgramProcessor, and Ogre::RTShader::HLSLProgramProcessor.
|
protected |
Merge the parameters from the given table.
paramsTable | Source parameters table. |
mergedParams | Will hold the merged parameters list. |
|
protected |
Internal function that creates merged parameter from given combination.
combination | The merge combination to try. |
paramsTable | The params table sorted by types in each row. |
mergedParameter | Will hold the merged parameter. |
|
protected |
Internal function that creates merged parameter using pre defined combinations.
paramsTable | Source parameters table. |
mergedParams | The merged parameters list. |
|
protected |
Merge reminders parameters that could not be merged into one slot using the predefined combinations.
paramsTable | The params table sorted by types in each row. |
mergedParams | The merged parameters list. |
splitParams | The split parameters list. |
|
inlineinherited |
Definition at line 95 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 101 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 107 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 112 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 118 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
operator new, with debug line info
Definition at line 67 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 72 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
placement operator new
Definition at line 78 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
array operator new, with debug line info
Definition at line 85 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 90 of file OgreMemoryAllocatedObject.h.
|
pure virtual |
Called after creation of the GPU programs.
programSet | The program set container. Return true on success. |
Implemented in Ogre::RTShader::GLSLProgramProcessor, Ogre::RTShader::CGProgramProcessor, Ogre::RTShader::GLSLESProgramProcessor, and Ogre::RTShader::HLSLProgramProcessor.
|
pure virtual |
Called before creation of the GPU programs.
Do several preparation operation such as validation, register compaction and specific target language optimizations.
programSet | The program set container. Return true on success. |
Implemented in Ogre::RTShader::GLSLProgramProcessor, Ogre::RTShader::CGProgramProcessor, Ogre::RTShader::GLSLESProgramProcessor, and Ogre::RTShader::HLSLProgramProcessor.
|
protected |
Rebuild function invocations by replacing references to old source parameters with the matching merged parameters components.
|
protected |
Rebuild the given parameters list using the merged parameters.
|
protected |
Replace references to old parameters with the new merged parameters.
|
protected |
Replace references to old parameters that have been split with the new local parameters that represents them.
Definition at line 265 of file OgreShaderProgramProcessor.h.
|
protected |
Definition at line 264 of file OgreShaderProgramProcessor.h.
|
protected |
Definition at line 262 of file OgreShaderProgramProcessor.h.
|
protected |
Definition at line 260 of file OgreShaderProgramProcessor.h.