OGRE  1.8
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::GLSLLinkProgramManager Class Reference

Ogre assumes that there are separate vertex and fragment programs to deal with but GLSL has one program object that represents the active vertex and fragment shader objects during a rendering state. More...

#include <OgreGLSLLinkProgramManager.h>

+ Inheritance diagram for Ogre::GLSLLinkProgramManager:
+ Collaboration diagram for Ogre::GLSLLinkProgramManager:

Public Member Functions

 GLSLLinkProgramManager (void)
 
 ~GLSLLinkProgramManager (void)
 
void extractConstantDefs (const String &src, GpuNamedConstants &constantDefs, const String &filename)
 Populate a list of uniforms based on GLSL source. More...
 
void extractUniforms (GLhandleARB programObject, const GpuConstantDefinitionMap *vertexConstantDefs, const GpuConstantDefinitionMap *geometryConstantDefs, const GpuConstantDefinitionMap *fragmentConstantDefs, GLUniformReferenceList &list)
 Populate a list of uniforms based on a program object. More...
 
GLSLLinkProgramgetActiveLinkProgram (void)
 Get the program object that links the two active shader objects together if a program object was not already created and linked a new one is created and linked. More...
 
void setActiveFragmentShader (GLSLGpuProgram *fragmentGpuProgram)
 Set the active fragment shader for the next rendering state. More...
 
void setActiveGeometryShader (GLSLGpuProgram *geometryGpuProgram)
 Set the active geometry shader for the next rendering state. More...
 
void setActiveVertexShader (GLSLGpuProgram *vertexGpuProgram)
 Set the active vertex shader for the next rendering state. More...
 

Static Public Member Functions

static GLSLLinkProgramManagergetSingleton (void)
 
static GLSLLinkProgramManagergetSingletonPtr (void)
 

Static Protected Attributes

static GLSLLinkProgramManagermsSingleton
 

Private Types

typedef LinkProgramMap::iterator LinkProgramIterator
 
typedef map< uint64,
GLSLLinkProgram * >::type 
LinkProgramMap
 
typedef map< String, GLenum >::type StringToEnumMap
 

Private Member Functions

void completeDefInfo (GLenum gltype, GpuConstantDefinition &defToUpdate)
 Use type to complete other information. More...
 
bool completeParamSource (const String &paramName, const GpuConstantDefinitionMap *vertexConstantDefs, const GpuConstantDefinitionMap *geometryConstantDefs, const GpuConstantDefinitionMap *fragmentConstantDefs, GLUniformReference &refToUpdate)
 Find where the data for a specific uniform should come from, populate. More...
 

Private Attributes

GLSLGpuProgrammActiveFragmentGpuProgram
 
GLSLGpuProgrammActiveGeometryGpuProgram
 
GLSLLinkProgrammActiveLinkProgram
 
GLSLGpuProgrammActiveVertexGpuProgram
 active objects defining the active rendering gpu state More...
 
LinkProgramMap mLinkPrograms
 container holding previously created program objects More...
 
StringToEnumMap mTypeEnumMap
 

Detailed Description

Ogre assumes that there are separate vertex and fragment programs to deal with but GLSL has one program object that represents the active vertex and fragment shader objects during a rendering state.

GLSL Vertex and fragment shader objects are compiled separately and then attached to a program object and then the program object is linked. Since Ogre can only handle one vertex program and one fragment program being active in a pass, the GLSL Link Program Manager does the same. The GLSL Link program manager acts as a state machine and activates a program object based on the active vertex and fragment program. Previously created program objects are stored along with a unique key in a hash_map for quick retrieval the next time the program object is required.

Definition at line 52 of file OgreGLSLLinkProgramManager.h.

Member Typedef Documentation

typedef LinkProgramMap::iterator Ogre::GLSLLinkProgramManager::LinkProgramIterator
private

Definition at line 58 of file OgreGLSLLinkProgramManager.h.

Definition at line 69 of file OgreGLSLLinkProgramManager.h.

Constructor & Destructor Documentation

Ogre::GLSLLinkProgramManager::GLSLLinkProgramManager ( void  )
Ogre::GLSLLinkProgramManager::~GLSLLinkProgramManager ( void  )

Member Function Documentation

void Ogre::GLSLLinkProgramManager::completeDefInfo ( GLenum  gltype,
GpuConstantDefinition defToUpdate 
)
private

Use type to complete other information.

bool Ogre::GLSLLinkProgramManager::completeParamSource ( const String paramName,
const GpuConstantDefinitionMap vertexConstantDefs,
const GpuConstantDefinitionMap geometryConstantDefs,
const GpuConstantDefinitionMap fragmentConstantDefs,
GLUniformReference refToUpdate 
)
private

Find where the data for a specific uniform should come from, populate.

void Ogre::GLSLLinkProgramManager::extractConstantDefs ( const String src,
GpuNamedConstants constantDefs,
const String filename 
)

Populate a list of uniforms based on GLSL source.

Parameters
srcReference to the source code
listThe defs to populate (will not be cleared before adding, clear it yourself before calling this if that's what you want).
filenameThe file name this came from, for logging errors.
void Ogre::GLSLLinkProgramManager::extractUniforms ( GLhandleARB  programObject,
const GpuConstantDefinitionMap vertexConstantDefs,
const GpuConstantDefinitionMap geometryConstantDefs,
const GpuConstantDefinitionMap fragmentConstantDefs,
GLUniformReferenceList list 
)

Populate a list of uniforms based on a program object.

Parameters
programObjectHandle to the program object to query
vertexConstantDefsDefinition of the constants extracted from the vertex program, used to match up physical buffer indexes with program uniforms. May be null if there is no vertex program.
geometryConstantDefsDefinition of the constants extracted from the geometry program, used to match up physical buffer indexes with program uniforms. May be null if there is no geometry program.
fragmentConstantDefsDefinition of the constants extracted from the fragment program, used to match up physical buffer indexes with program uniforms. May be null if there is no fragment program.
listThe list to populate (will not be cleared before adding, clear it yourself before calling this if that's what you want).
GLSLLinkProgram* Ogre::GLSLLinkProgramManager::getActiveLinkProgram ( void  )

Get the program object that links the two active shader objects together if a program object was not already created and linked a new one is created and linked.

static GLSLLinkProgramManager& Ogre::GLSLLinkProgramManager::getSingleton ( void  )
static
static GLSLLinkProgramManager* Ogre::GLSLLinkProgramManager::getSingletonPtr ( void  )
static
void Ogre::GLSLLinkProgramManager::setActiveFragmentShader ( GLSLGpuProgram fragmentGpuProgram)

Set the active fragment shader for the next rendering state.

The active program object will be cleared. Normally called from the GLSLGpuProgram::bindProgram and unbindProgram methods

void Ogre::GLSLLinkProgramManager::setActiveGeometryShader ( GLSLGpuProgram geometryGpuProgram)

Set the active geometry shader for the next rendering state.

The active program object will be cleared. Normally called from the GLSLGpuProgram::bindProgram and unbindProgram methods

void Ogre::GLSLLinkProgramManager::setActiveVertexShader ( GLSLGpuProgram vertexGpuProgram)

Set the active vertex shader for the next rendering state.

The active program object will be cleared. Normally called from the GLSLGpuProgram::bindProgram and unbindProgram methods

Member Data Documentation

GLSLGpuProgram* Ogre::GLSLLinkProgramManager::mActiveFragmentGpuProgram
private

Definition at line 66 of file OgreGLSLLinkProgramManager.h.

GLSLGpuProgram* Ogre::GLSLLinkProgramManager::mActiveGeometryGpuProgram
private

Definition at line 65 of file OgreGLSLLinkProgramManager.h.

GLSLLinkProgram* Ogre::GLSLLinkProgramManager::mActiveLinkProgram
private

Definition at line 67 of file OgreGLSLLinkProgramManager.h.

GLSLGpuProgram* Ogre::GLSLLinkProgramManager::mActiveVertexGpuProgram
private

active objects defining the active rendering gpu state

Definition at line 64 of file OgreGLSLLinkProgramManager.h.

LinkProgramMap Ogre::GLSLLinkProgramManager::mLinkPrograms
private

container holding previously created program objects

Definition at line 61 of file OgreGLSLLinkProgramManager.h.

GLSLLinkProgramManager * Ogre::Singleton< GLSLLinkProgramManager >::msSingleton
staticprotectedinherited

Definition at line 75 of file OgreSingleton.h.

StringToEnumMap Ogre::GLSLLinkProgramManager::mTypeEnumMap
private

Definition at line 70 of file OgreGLSLLinkProgramManager.h.


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