Go to the documentation of this file.
27 #ifndef _ShaderProgramProcessor_
28 #define _ShaderProgramProcessor_
127 int mSrcParameterMask[4];
129 int mDstParameterMask[4];
143 size_t srcParameterTypeCount[4];
145 int srcParameterMask[4];
148 int float1Count,
int float1Mask,
149 int float2Count,
int float2Mask,
150 int float3Count,
int float3Mask,
151 int float4Count,
int float4Mask)
153 srcParameterTypeCount[0] = float1Count;
154 srcParameterTypeCount[1] = float2Count;
155 srcParameterTypeCount[2] = float3Count;
156 srcParameterTypeCount[3] = float4Count;
157 srcParameterMask[0] = float1Mask;
158 srcParameterMask[1] = float2Mask;
159 srcParameterMask[2] = float3Mask;
160 srcParameterMask[3] = float4Mask;
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 the...
size_t mSrcParameterCount
void mergeParametersByPredefinedCombinations(ShaderParameterList paramsTable[4], MergeParameterList &mergedParams)
Internal function that creates merged parameter using pre defined combinations.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Container class for shader based programs.
map< Parameter *, ParameterPtr >::type LocalParameterMap
int getDestinationParameterMask(unsigned int index) const
Return destination parameter mask by index.
void buildTexcoordTable(const ShaderParameterList ¶mList, ShaderParameterList outParamsTable[4])
Internal function that builds parameters table.
static int getParameterMaskByFloatCount(int floatCount)
Return the parameter mask of by the float count type (I.E: X|Y for 2 etc..)
void countVsTexcoordOutputs(Function *vsMain, int &outTexCoordSlots, int &outTexCoordFloats)
Internal method that counts vertex shader texcoord output slots and output floats.
vector< Operand * >::type OperandPtrVector
void mergeParametersReminders(ShaderParameterList paramsTable[4], MergeParameterList &mergedParams, ShaderParameterList &splitParams)
Merge reminders parameters that could not be merged into one slot using the predefined combinations.
ProgramProcessor()
Class constructor.
map< Parameter *, OperandPtrVector >::type ParameterOperandMap
GpuProgramType
Enumerates the types of programs which can run on the GPU.
vector< ParameterPtr >::type ShaderParameterList
void replaceSplitParametersReferences(LocalParameterMap &localParamsMap, ParameterOperandMap ¶msRefMap)
Replace references to old parameters that have been split with the new local parameters that represen...
MergeCombination(int float1Count, int float1Mask, int float2Count, int float2Mask, int float3Count, int float3Mask, int float4Count, int float4Mask)
A class that represents a shader based program.
MergeParameter()
Class constructor.
virtual bool compactVsOutputs(Function *vsMain, Function *fsMain)
Compact the vertex shader output registers.
vector< MergeCombination >::type MergeCombinationList
void buildMergeCombinations()
Build parameter merging combinations.
int getUsedFloatCount()
Return the number of used floats.
void rebuildFunctionInvocations(FunctionAtomInstanceList &funcAtomList, MergeParameterList &mergedParams, LocalParameterMap &localParamsMap)
Rebuild function invocations by replacing references to old source parameters with the matching merge...
vector< MergeParameter >::type MergeParameterList
int getSourceParameterMask(unsigned int index) const
Return source parameter mask by index.
A class that provides extra processing services on CPU based programs.
GpuConstantType
Enumeration of the types of constant we may encounter in programs.
void bindAutoParameters(Program *pCpuProgram, GpuProgramPtr pGpuProgram)
Bind the auto parameters for a given CPU and GPU program set.
void rebuildParameterList(Function *func, int paramsUsage, MergeParameterList &mergedParams)
Rebuild the given parameters list using the merged parameters.
ParameterPtr getDestinationParameter(int usage, int index)
Return the destination parameter.
ParameterPtr mDstParameter
std::map< K, V, P, A > type
virtual bool preCreateGpuPrograms(ProgramSet *programSet)=0
Called before creation of the GPU programs.
size_t getSourceParameterCount() const
Return the source parameter count.
virtual bool postCreateGpuPrograms(ProgramSet *programSet)=0
Called after creation of the GPU programs.
virtual const String & getTargetLanguage() const =0
Return the target language of this processor.
void buildParameterReferenceMap(FunctionAtomInstanceList &funcAtomList, ParameterOperandMap ¶msRefMap)
Builds a map between parameter and all the references to it.
bool mergeParametersByCombination(const MergeCombination &combination, ShaderParameterList paramsTable[4], MergeParameter *mergedParameter)
Internal function that creates merged parameter from given combination.
void addSourceParameter(ParameterPtr srcParam, int mask)
Add source parameter to this merged.
vector< FunctionAtom * >::type FunctionAtomInstanceList
virtual ~ProgramProcessor()
Class destructor.
void createDestinationParameter(int usage, int index)
Creates the destination parameter by a given class and index.
A class that represents a shader based program function.
void replaceParametersReferences(MergeParameterList &mergedParams, ParameterOperandMap ¶msRefMap)
Replace references to old parameters with the new merged parameters.
void clear()
Clear the state of this merge parameter.
map< Function *, String * >::type mFunctionMap
ParameterPtr getSourceParameter(unsigned int index)
Return source parameter by index.
static int getParameterMaskByType(GpuConstantType type)
Return the parameter mask of by the given parameter type (I.E: X|Y for FLOAT2 etc....
void mergeParameters(ShaderParameterList paramsTable[4], MergeParameterList &mergedParams, ShaderParameterList &splitParams)
Merge the parameters from the given table.
static int getParameterFloatCount(GpuConstantType type)
Return number of floats needed by the given type.
MergeCombinationList mParamMergeCombinations
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.