Ogre::RTShader::ProgramManager Class Reference
Core » RTShader

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

`#include <OgreShaderProgramManager.h>`

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

## Public Member Functions

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

## Static Public Member Functions

static ProgramManager & | getSingleton ()
| Override standard Singleton retrieval. More...
static ProgramManager * | getSingletonPtr ()
| Override standard Singleton retrieval. More...

## Protected Types

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

## Protected Member Functions

void | addProgramProcessor (ProgramProcessor *processor)
| Add program processor instance to this manager. More...
void | bindUniformParameters (Program *pCpuProgram, const GpuProgramParametersSharedPtr &passParams)
| Bind the uniform parameters of a given CPU and GPU program set. More...
Program * | createCpuProgram (GpuProgramType type)
| Create CPU program . More...
void | createDefaultProgramProcessors ()
| Create default program processors. More...
void | createDefaultProgramWriterFactories ()
| Create default program processors. More...
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. More...
bool | createGpuPrograms (ProgramSet *programSet)
| Create GPU programs for the given program set based on the CPU programs it contains. More...
void | destroyCpuProgram (Program *shaderProgram)
| Destroy a CPU program by name. More...
void | destroyDefaultProgramProcessors ()
| Destroy default program processors. More...
void | destroyDefaultProgramWriterFactories ()
| Destroy default program processors. More...
void | destroyGpuProgram (GpuProgramPtr &gpuProgram)
| Destroy a GPU program by name. More...
void | destroyProgramWriters ()
| Destroy all program writers. More...
void | flushGpuProgramsCache (GpuProgramsMap &gpuProgramsMap)
| Flush the local GPU programs cache. More...
String | generateGUID (const String &programString)
| Generates a unique guid value from a string. More...
size_t | getFragmentShaderCount () const
| Return the number of created fragment shaders. More...
size_t | getVertexShaderCount () const
| Return the number of created vertex shaders. More...
void | removeProgramProcessor (ProgramProcessor *processor)
| Remove program processor instance from this manager. More...
void | synchronizePixelnToBeVertexOut (ProgramSet *programSet)
| Fix the input of the pixel shader to be the same as the output of the vertex shader. More...

## Protected Attributes

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

## Static Protected Attributes

static ProgramManager * | msSingleton

## Friends

class | ProgramSet
class | ShaderGenerator
class | TargetRenderState

## Detailed Description

A singleton manager class that manages shader based programs.

Definition at line 46 of file OgreShaderProgramManager.h.

## Member Typedef Documentation

## GpuProgramsMap

typedef map<String, GpuProgramPtr>::type Ogre::RTShader::ProgramManager::GpuProgramsMap

protected

Definition at line 111 of file OgreShaderProgramManager.h.

## GpuProgramsMapConstIterator

typedef GpuProgramsMap::const_iterator Ogre::RTShader::ProgramManager::GpuProgramsMapConstIterator

protected

Definition at line 113 of file OgreShaderProgramManager.h.

## GpuProgramsMapIterator

typedef GpuProgramsMap::iterator Ogre::RTShader::ProgramManager::GpuProgramsMapIterator

protected

Definition at line 112 of file OgreShaderProgramManager.h.

## ProgramList

typedef set<Program*>::type Ogre::RTShader::ProgramManager::ProgramList

protected

Definition at line 116 of file OgreShaderProgramManager.h.

## ProgramListIterator

typedef ProgramList::iterator Ogre::RTShader::ProgramManager::ProgramListIterator

protected

Definition at line 117 of file OgreShaderProgramManager.h.

## ProgramProcessorConstIterator

typedef ProgramProcessorMap::const_iterator Ogre::RTShader::ProgramManager::ProgramProcessorConstIterator

protected

Definition at line 125 of file OgreShaderProgramManager.h.

## ProgramProcessorIterator

typedef ProgramProcessorMap::iterator Ogre::RTShader::ProgramManager::ProgramProcessorIterator

protected

Definition at line 124 of file OgreShaderProgramManager.h.

## ProgramProcessorList

typedef vector<ProgramProcessor*>::type Ogre::RTShader::ProgramManager::ProgramProcessorList

protected

Definition at line 126 of file OgreShaderProgramManager.h.

## ProgramProcessorMap

typedef map<String, ProgramProcessor*>::type Ogre::RTShader::ProgramManager::ProgramProcessorMap

protected

Definition at line 123 of file OgreShaderProgramManager.h.

## ProgramWriterFactoryList

typedef vector<ProgramWriterFactory*>::type Ogre::RTShader::ProgramManager::ProgramWriterFactoryList

protected

Definition at line 120 of file OgreShaderProgramManager.h.

## ProgramWriterIterator

typedef ProgramWriterMap::iterator Ogre::RTShader::ProgramManager::ProgramWriterIterator

protected

Definition at line 119 of file OgreShaderProgramManager.h.

## ProgramWriterMap

typedef map<String, ProgramWriter*>::type Ogre::RTShader::ProgramManager::ProgramWriterMap

protected

Definition at line 118 of file OgreShaderProgramManager.h.

## Constructor & Destructor Documentation

## ProgramManager()

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

Class default constructor.

## ~ProgramManager()

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

Class destructor.

## Member Function Documentation

## acquirePrograms()

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.

## addProgramProcessor()

void Ogre::RTShader::ProgramManager::addProgramProcessor | ( | ProgramProcessor * | processor | ) |

protected

Add program processor instance to this manager.

Parameters

  processor | The instance to add.

## bindUniformParameters()

void Ogre::RTShader::ProgramManager::bindUniformParameters | ( | Program * | pCpuProgram,
|  | const GpuProgramParametersSharedPtr & | passParams
| ) |  |

protected

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

## createCpuProgram()

Program* Ogre::RTShader::ProgramManager::createCpuProgram | ( | GpuProgramType | type | ) |

protected

Create CPU program .

Parameters

  type | The type of the program to create.

## createDefaultProgramProcessors()

void Ogre::RTShader::ProgramManager::createDefaultProgramProcessors | ( |  | ) |

protected

Create default program processors.

## createDefaultProgramWriterFactories()

void Ogre::RTShader::ProgramManager::createDefaultProgramWriterFactories | ( |  | ) |

protected

Create default program processors.

## createGpuProgram()

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.
  profilesList | The profiles string for program compilation as string list.
  cachePath | The output path to write the program into.

## createGpuPrograms()

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.

## destroyCpuProgram()

void Ogre::RTShader::ProgramManager::destroyCpuProgram | ( | Program * | shaderProgram | ) |

protected

Destroy a CPU program by name.

Parameters

  shaderProgram | The CPU program instance to destroy.

## destroyDefaultProgramProcessors()

void Ogre::RTShader::ProgramManager::destroyDefaultProgramProcessors | ( |  | ) |

protected

Destroy default program processors.

## destroyDefaultProgramWriterFactories()

void Ogre::RTShader::ProgramManager::destroyDefaultProgramWriterFactories | ( |  | ) |

protected

Destroy default program processors.

## destroyGpuProgram()

void Ogre::RTShader::ProgramManager::destroyGpuProgram | ( | GpuProgramPtr & | gpuProgram | ) |

protected

Destroy a GPU program by name.

Parameters

  gpuProgram | The program to destroy.

## destroyProgramWriters()

void Ogre::RTShader::ProgramManager::destroyProgramWriters | ( |  | ) |

protected

Destroy all program writers.

## flushGpuProgramsCache() [1/2]

void Ogre::RTShader::ProgramManager::flushGpuProgramsCache | ( |  | ) |

Flush the local GPU programs cache.

## flushGpuProgramsCache() [2/2]

void Ogre::RTShader::ProgramManager::flushGpuProgramsCache | ( | GpuProgramsMap & | gpuProgramsMap | ) |

protected

Flush the local GPU programs cache.

Parameters

  gpuProgramsMap | The GPU programs cache.

## generateGUID()

String Ogre::RTShader::ProgramManager::generateGUID | ( | const String & | programString | ) |

protected

Generates a unique guid value from a string.

Parameters

  programString | string to generate a hash value for

Returns
  A string representing a 128 bit hash value of the original string

## getFragmentShaderCount()

size_t Ogre::RTShader::ProgramManager::getFragmentShaderCount | ( |  | ) | const

protected

Return the number of created fragment shaders.

Definition at line 208 of file OgreShaderProgramManager.h.

## getSingleton()

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.

## getSingletonPtr()

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.

## getVertexShaderCount()

size_t Ogre::RTShader::ProgramManager::getVertexShaderCount | ( |  | ) | const

protected

Return the number of created vertex shaders.

Definition at line 205 of file OgreShaderProgramManager.h.

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

## releasePrograms()

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.

## removeProgramProcessor()

void Ogre::RTShader::ProgramManager::removeProgramProcessor | ( | ProgramProcessor * | processor | ) |

protected

Remove program processor instance from this manager.

Parameters

  processor | The instance to remove.

## synchronizePixelnToBeVertexOut()

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

## ProgramSet

friend class ProgramSet

friend

Definition at line 237 of file OgreShaderProgramManager.h.

## ShaderGenerator

friend class ShaderGenerator

friend

Definition at line 239 of file OgreShaderProgramManager.h.

## TargetRenderState

friend class TargetRenderState

friend

Definition at line 238 of file OgreShaderProgramManager.h.

## Member Data Documentation

## mCpuProgramsList

ProgramList Ogre::RTShader::ProgramManager::mCpuProgramsList

protected

Definition at line 222 of file OgreShaderProgramManager.h.

## mDefaultProgramProcessors

ProgramProcessorList Ogre::RTShader::ProgramManager::mDefaultProgramProcessors

protected

Definition at line 234 of file OgreShaderProgramManager.h.

## mFragmentShaderMap

GpuProgramsMap Ogre::RTShader::ProgramManager::mFragmentShaderMap

protected

Definition at line 232 of file OgreShaderProgramManager.h.

## mProgramProcessorsMap

ProgramProcessorMap Ogre::RTShader::ProgramManager::mProgramProcessorsMap

protected

Definition at line 226 of file OgreShaderProgramManager.h.

## mProgramWriterFactories

ProgramWriterFactoryList Ogre::RTShader::ProgramManager::mProgramWriterFactories

protected

Definition at line 228 of file OgreShaderProgramManager.h.

## mProgramWritersMap

ProgramWriterMap Ogre::RTShader::ProgramManager::mProgramWritersMap

protected

Definition at line 224 of file OgreShaderProgramManager.h.

## msSingleton

ProgramManager * Ogre::Singleton< ProgramManager >::msSingleton

static protected inherited

Definition at line 75 of file OgreSingleton.h.

## mVertexShaderMap

GpuProgramsMap Ogre::RTShader::ProgramManager::mVertexShaderMap

protected

Definition at line 230 of file OgreShaderProgramManager.h.

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

- OgreShaderProgramManager.h

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