Ogre::RTShader::ProgramManager Class Reference
[RTShader]

A singleton manager class that manages shader based programs. More...

#include <OgreShaderProgramManager.h>

Inheritance diagram for Ogre::RTShader::ProgramManager:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ProgramManager ()
 Class default constructor.
 ~ProgramManager ()
 Class destructor.
void acquirePrograms (Pass *pass, TargetRenderState *renderState)
 Acquire CPU/GPU programs set associated with the given render state and bind them to the pass.
void releasePrograms (Pass *pass, TargetRenderState *renderState)
 Release CPU/GPU programs set associated with the given render state and pass.
void flushGpuProgramsCache ()
 Flush the local GPU programs cache.
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 *)

Static Public Member Functions

static ProgramManagergetSingleton ()
 Override standard Singleton retrieval.
static ProgramManagergetSingletonPtr ()
 Override standard Singleton retrieval.

Protected Types

typedef map< String,
GpuProgramPtr >::type 
GpuProgramsMap
typedef GpuProgramsMap::iterator GpuProgramsMapIterator
typedef
GpuProgramsMap::const_iterator 
GpuProgramsMapConstIterator
typedef set< Program * >::type ProgramList
typedef ProgramList::iterator ProgramListIterator
typedef map< String,
ProgramWriter * >::type 
ProgramWriterMap
typedef ProgramWriterMap::iterator ProgramWriterIterator
typedef vector
< ProgramWriterFactory * >
::type 
ProgramWriterFactoryList
typedef map< String,
ProgramProcessor * >::type 
ProgramProcessorMap
typedef
ProgramProcessorMap::iterator 
ProgramProcessorIterator
typedef
ProgramProcessorMap::const_iterator 
ProgramProcessorConstIterator
typedef vector
< ProgramProcessor * >::type 
ProgramProcessorList

Protected Member Functions

void createDefaultProgramProcessors ()
 Create default program processors.
void destroyDefaultProgramProcessors ()
 Destroy default program processors.
void createDefaultProgramWriterFactories ()
 Create default program processors.
void destroyDefaultProgramWriterFactories ()
 Destroy default program processors.
void destroyProgramWriters ()
 Destroy all program writers.
ProgramcreateCpuProgram (GpuProgramType type)
 Create CPU program .
void destroyCpuProgram (Program *shaderProgram)
 Destroy a CPU program by name.
bool createGpuPrograms (ProgramSet *programSet)
 Create GPU programs for the given program set based on the CPU programs it contains.
GpuProgramPtr createGpuProgram (Program *shaderProgram, ProgramWriter *programWriter, const String &language, const String &profiles, const StringVector &profilesList, const String &cachePath)
 Create GPU program based on the give CPU program.
void addProgramProcessor (ProgramProcessor *processor)
 Add program processor instance to this manager.
void removeProgramProcessor (ProgramProcessor *processor)
 Remove program processor instance from this manager.
void destroyGpuProgram (GpuProgramPtr &gpuProgram)
 Destroy a GPU program by name.
void flushGpuProgramsCache (GpuProgramsMap &gpuProgramsMap)
 Flush the local GPU programs cache.
size_t getVertexShaderCount () const
 Return the number of created vertex shaders.
size_t getFragmentShaderCount () const
 Return the number of created fragment shaders.
void synchronizePixelnToBeVertexOut (ProgramSet *programSet)
 Fix the input of the pixel shader to be the same as the output of the vertex shader.
void bindUniformParameters (Program *pCpuProgram, const GpuProgramParametersSharedPtr &passParams)
 Bind the uniform parameters of a given CPU and GPU program set.

Protected Attributes

ProgramList mCpuProgramsList
ProgramWriterMap mProgramWritersMap
ProgramProcessorMap mProgramProcessorsMap
ProgramWriterFactoryList mProgramWriterFactories
GpuProgramsMap mVertexShaderMap
GpuProgramsMap mFragmentShaderMap
ProgramProcessorList mDefaultProgramProcessors

Static Protected Attributes

static ProgramManagermsSingleton

Friends

class ProgramSet
class TargetRenderState
class ShaderGenerator

Detailed Description

A singleton manager class that manages shader based programs.

Definition at line 46 of file OgreShaderProgramManager.h.


Member Typedef Documentation

Definition at line 111 of file OgreShaderProgramManager.h.

typedef GpuProgramsMap::const_iterator Ogre::RTShader::ProgramManager::GpuProgramsMapConstIterator [protected]

Definition at line 113 of file OgreShaderProgramManager.h.

typedef GpuProgramsMap::iterator Ogre::RTShader::ProgramManager::GpuProgramsMapIterator [protected]

Definition at line 112 of file OgreShaderProgramManager.h.

Definition at line 116 of file OgreShaderProgramManager.h.

typedef ProgramList::iterator Ogre::RTShader::ProgramManager::ProgramListIterator [protected]

Definition at line 117 of file OgreShaderProgramManager.h.

typedef ProgramProcessorMap::const_iterator Ogre::RTShader::ProgramManager::ProgramProcessorConstIterator [protected]

Definition at line 125 of file OgreShaderProgramManager.h.

typedef ProgramProcessorMap::iterator Ogre::RTShader::ProgramManager::ProgramProcessorIterator [protected]

Definition at line 124 of file OgreShaderProgramManager.h.

Definition at line 126 of file OgreShaderProgramManager.h.

Definition at line 123 of file OgreShaderProgramManager.h.

Definition at line 120 of file OgreShaderProgramManager.h.

typedef ProgramWriterMap::iterator Ogre::RTShader::ProgramManager::ProgramWriterIterator [protected]

Definition at line 119 of file OgreShaderProgramManager.h.

Definition at line 118 of file OgreShaderProgramManager.h.


Constructor & Destructor Documentation

Ogre::RTShader::ProgramManager::ProgramManager (  ) 

Class default constructor.

Ogre::RTShader::ProgramManager::~ProgramManager (  ) 

Class destructor.


Member Function Documentation

void Ogre::RTShader::ProgramManager::acquirePrograms ( Pass pass,
TargetRenderState renderState 
)

Acquire CPU/GPU programs set associated with the given render state and bind them to the pass.

Parameters:
pass The pass to bind the programs to.
renderState The render state that describes the program that need to be generated.
void Ogre::RTShader::ProgramManager::addProgramProcessor ( ProgramProcessor processor  )  [protected]

Add program processor instance to this manager.

Parameters:
processor The instance to add.
void Ogre::RTShader::ProgramManager::bindUniformParameters ( Program pCpuProgram,
const GpuProgramParametersSharedPtr passParams 
) [protected]

Bind the uniform parameters of a given CPU and GPU program set.

Program* Ogre::RTShader::ProgramManager::createCpuProgram ( GpuProgramType  type  )  [protected]

Create CPU program .

Parameters:
type The type of the program to create.
void Ogre::RTShader::ProgramManager::createDefaultProgramProcessors (  )  [protected]

Create default program processors.

void Ogre::RTShader::ProgramManager::createDefaultProgramWriterFactories (  )  [protected]

Create default program processors.

GpuProgramPtr Ogre::RTShader::ProgramManager::createGpuProgram ( Program shaderProgram,
ProgramWriter programWriter,
const String language,
const String profiles,
const StringVector profilesList,
const String cachePath 
) [protected]

Create GPU program based on the give CPU program.

Parameters:
shaderProgram The CPU program instance.
programWriter The program writer instance.
language The target shader language.
profiles The profiles string for program compilation.
profiles The profiles string for program compilation as string list.
cachePath The output path to write the program into.
bool Ogre::RTShader::ProgramManager::createGpuPrograms ( ProgramSet programSet  )  [protected]

Create GPU programs for the given program set based on the CPU programs it contains.

Parameters:
programSet The program set container.
void Ogre::RTShader::ProgramManager::destroyCpuProgram ( Program shaderProgram  )  [protected]

Destroy a CPU program by name.

Parameters:
shaderProgram The CPU program instance to destroy.
void Ogre::RTShader::ProgramManager::destroyDefaultProgramProcessors (  )  [protected]

Destroy default program processors.

void Ogre::RTShader::ProgramManager::destroyDefaultProgramWriterFactories (  )  [protected]

Destroy default program processors.

void Ogre::RTShader::ProgramManager::destroyGpuProgram ( GpuProgramPtr gpuProgram  )  [protected]

Destroy a GPU program by name.

Parameters:
name The name of the program to destroy.
type The type of the program to destroy.
void Ogre::RTShader::ProgramManager::destroyProgramWriters (  )  [protected]

Destroy all program writers.

void Ogre::RTShader::ProgramManager::flushGpuProgramsCache ( GpuProgramsMap gpuProgramsMap  )  [protected]

Flush the local GPU programs cache.

Parameters:
gpuProgramsMap The GPU programs cache.
void Ogre::RTShader::ProgramManager::flushGpuProgramsCache (  ) 

Flush the local GPU programs cache.

size_t Ogre::RTShader::ProgramManager::getFragmentShaderCount (  )  const [protected]

Return the number of created fragment shaders.

Definition at line 202 of file OgreShaderProgramManager.h.

static ProgramManager& Ogre::RTShader::ProgramManager::getSingleton (  )  [static]

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< ProgramManager >.

static ProgramManager* Ogre::RTShader::ProgramManager::getSingletonPtr (  )  [static]

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< ProgramManager >.

size_t Ogre::RTShader::ProgramManager::getVertexShaderCount (  )  const [protected]

Return the number of created vertex shaders.

Definition at line 199 of file OgreShaderProgramManager.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 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 118 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 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  )  [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  )  [inherited]

Definition at line 90 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.

void Ogre::RTShader::ProgramManager::releasePrograms ( Pass pass,
TargetRenderState renderState 
)

Release CPU/GPU programs set associated with the given render state and pass.

Parameters:
pass The pass to release the programs from.
renderState The render state holds the programs.
void Ogre::RTShader::ProgramManager::removeProgramProcessor ( ProgramProcessor processor  )  [protected]

Remove program processor instance from this manager.

Parameters:
processor The instance to remove.
void Ogre::RTShader::ProgramManager::synchronizePixelnToBeVertexOut ( ProgramSet programSet  )  [protected]

Fix the input of the pixel shader to be the same as the output of the vertex shader.


Friends And Related Function Documentation

friend class ProgramSet [friend]

Definition at line 224 of file OgreShaderProgramManager.h.

friend class ShaderGenerator [friend]

Definition at line 226 of file OgreShaderProgramManager.h.

friend class TargetRenderState [friend]

Definition at line 225 of file OgreShaderProgramManager.h.


Member Data Documentation

Definition at line 215 of file OgreShaderProgramManager.h.

Definition at line 221 of file OgreShaderProgramManager.h.

Definition at line 220 of file OgreShaderProgramManager.h.

Definition at line 217 of file OgreShaderProgramManager.h.

Definition at line 218 of file OgreShaderProgramManager.h.

Definition at line 216 of file OgreShaderProgramManager.h.

ProgramManager * Ogre::Singleton< ProgramManager >::msSingleton [static, protected, inherited]

Definition at line 75 of file OgreSingleton.h.

Definition at line 219 of file OgreShaderProgramManager.h.


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

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:43:06 2012