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

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

#include <OgreGLSLSeparableProgramManager.h>

+ Inheritance diagram for Ogre::GLSLSeparableProgramManager:
+ Collaboration diagram for Ogre::GLSLSeparableProgramManager:

Public Member Functions

 GLSLSeparableProgramManager (void)
 
 ~GLSLSeparableProgramManager (void)
 
void extractUniformsFromGLSL (const String &src, GpuNamedConstants &constantDefs, const String &filename)
 Populate a list of uniforms based on GLSL source and store them in GpuNamedConstants. More...
 
void extractUniformsFromProgram (GLuint programObject, const GpuConstantDefinitionMap *vertexConstantDefs, const GpuConstantDefinitionMap *hullConstantDefs, const GpuConstantDefinitionMap *domainConstantDefs, const GpuConstantDefinitionMap *geometryConstantDefs, const GpuConstantDefinitionMap *fragmentConstantDefs, const GpuConstantDefinitionMap *computeConstantDefs, GLUniformReferenceList &uniformList, GLAtomicCounterReferenceList &counterList, GLUniformBufferList &uniformBufferList, SharedParamsBufferMap &sharedParamsBufferMap, GLCounterBufferList &counterBufferList)
 Populate a list of uniforms based on an OpenGL program object. More...
 
GLSLSeparableProgramgetCurrentSeparableProgram (void)
 Get the program pipeline that combines the current program objects. More...
 
void setActiveComputeShader (GLSLShader *computShader)
 
void setActiveFragmentShader (GLSLShader *fragmentShader)
 
void setActiveGeometryShader (GLSLShader *geometryShader)
 
void setActiveTessDomainShader (GLSLShader *domainShader)
 
void setActiveTessHullShader (GLSLShader *hullShader)
 
void setActiveVertexShader (GLSLShader *vertexShader)
 Set the active link programs for the next rendering state. More...
 

Static Public Member Functions

static
GLSLSeparableProgramManager
getSingleton (void)
 
static
GLSLSeparableProgramManager
getSingletonPtr (void)
 

Protected Types

typedef map< String, GLenum >::type StringToEnumMap
 

Protected Member Functions

void convertGLUniformtoOgreType (GLenum gltype, GpuConstantDefinition &defToUpdate)
 Convert GL uniform size and type to OGRE constant types and associate uniform definitions together. More...
 
bool findAtomicCounterDataSource (const String &paramName, const GpuConstantDefinitionMap *vertexConstantDefs, const GpuConstantDefinitionMap *hullConstantDefs, const GpuConstantDefinitionMap *domainConstantDefs, const GpuConstantDefinitionMap *geometryConstantDefs, const GpuConstantDefinitionMap *fragmentConstantDefs, const GpuConstantDefinitionMap *computeConstantDefs, GLAtomicCounterReference &refToUpdate)
 Find the data source definition for a given atomic counter uniform name and reference. More...
 
bool findUniformDataSource (const String &paramName, const GpuConstantDefinitionMap *vertexConstantDefs, const GpuConstantDefinitionMap *hullConstantDefs, const GpuConstantDefinitionMap *domainConstantDefs, const GpuConstantDefinitionMap *geometryConstantDefs, const GpuConstantDefinitionMap *fragmentConstantDefs, const GpuConstantDefinitionMap *computeConstantDefs, GLUniformReference &refToUpdate)
 Find the data source definition for a given uniform name and reference. More...
 
void parseGLSLUniform (const String &src, GpuNamedConstants &defs, String::size_type currPos, const String &filename, GpuSharedParametersPtr sharedParams)
 Parse an individual uniform from a GLSL source file and store it in a GpuNamedConstant. More...
 

Protected Attributes

GLSLShadermActiveComputeShader
 
GLSLShadermActiveDomainShader
 
GLSLShadermActiveFragmentShader
 
GLSLShadermActiveGeometryShader
 
GLSLShadermActiveHullShader
 
GLSLShadermActiveVertexShader
 Active shader objects defining the active program object. More...
 
StringToEnumMap mTypeEnumMap
 

Static Protected Attributes

static
GLSLSeparableProgramManager
msSingleton
 

Private Types

typedef
SeparableProgramMap::iterator 
SeparableProgramIterator
 
typedef map< uint32,
GLSLSeparableProgram * >::type 
SeparableProgramMap
 

Private Attributes

GLSLSeparableProgrammActiveSeparableProgram
 Active objects defining the active rendering gpu state. More...
 
SeparableProgramMap mSeparablePrograms
 Container holding previously created program pipeline objects. More...
 

Detailed Description

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

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

Definition at line 53 of file OgreGLSLSeparableProgramManager.h.

Member Typedef Documentation

typedef SeparableProgramMap::iterator Ogre::GLSLSeparableProgramManager::SeparableProgramIterator
private

Definition at line 58 of file OgreGLSLSeparableProgramManager.h.

typedef map<String, GLenum>::type Ogre::GLSLProgramManager::StringToEnumMap
protectedinherited

Definition at line 63 of file OgreGLSLProgramManager.h.

Constructor & Destructor Documentation

Ogre::GLSLSeparableProgramManager::GLSLSeparableProgramManager ( void  )
Ogre::GLSLSeparableProgramManager::~GLSLSeparableProgramManager ( void  )

Member Function Documentation

void Ogre::GLSLProgramManager::convertGLUniformtoOgreType ( GLenum  gltype,
GpuConstantDefinition defToUpdate 
)
protectedinherited

Convert GL uniform size and type to OGRE constant types and associate uniform definitions together.

void Ogre::GLSLProgramManager::extractUniformsFromGLSL ( const String src,
GpuNamedConstants constantDefs,
const String filename 
)
inherited

Populate a list of uniforms based on GLSL source and store them in GpuNamedConstants.

Parameters
srcReference to the source code.
constantDefsThe 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::GLSLProgramManager::extractUniformsFromProgram ( GLuint  programObject,
const GpuConstantDefinitionMap vertexConstantDefs,
const GpuConstantDefinitionMap hullConstantDefs,
const GpuConstantDefinitionMap domainConstantDefs,
const GpuConstantDefinitionMap geometryConstantDefs,
const GpuConstantDefinitionMap fragmentConstantDefs,
const GpuConstantDefinitionMap computeConstantDefs,
GLUniformReferenceList uniformList,
GLAtomicCounterReferenceList counterList,
GLUniformBufferList uniformBufferList,
SharedParamsBufferMap sharedParamsBufferMap,
GLCounterBufferList counterBufferList 
)
inherited

Populate a list of uniforms based on an OpenGL program object.

Parameters
programObjectHandle to the program object to query.
vertexConstantDefsDefinition of the uniforms extracted from the vertex program, used to match up physical buffer indexes with program uniforms. May be null if there is no vertex program.
fragmentConstantDefsDefinition of the uniforms 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).
bool Ogre::GLSLProgramManager::findAtomicCounterDataSource ( const String paramName,
const GpuConstantDefinitionMap vertexConstantDefs,
const GpuConstantDefinitionMap hullConstantDefs,
const GpuConstantDefinitionMap domainConstantDefs,
const GpuConstantDefinitionMap geometryConstantDefs,
const GpuConstantDefinitionMap fragmentConstantDefs,
const GpuConstantDefinitionMap computeConstantDefs,
GLAtomicCounterReference refToUpdate 
)
protectedinherited

Find the data source definition for a given atomic counter uniform name and reference.

Return true if found and pair the reference with its data source.

bool Ogre::GLSLProgramManager::findUniformDataSource ( const String paramName,
const GpuConstantDefinitionMap vertexConstantDefs,
const GpuConstantDefinitionMap hullConstantDefs,
const GpuConstantDefinitionMap domainConstantDefs,
const GpuConstantDefinitionMap geometryConstantDefs,
const GpuConstantDefinitionMap fragmentConstantDefs,
const GpuConstantDefinitionMap computeConstantDefs,
GLUniformReference refToUpdate 
)
protectedinherited

Find the data source definition for a given uniform name and reference.

Return true if found and pair the reference with its data source.

GLSLSeparableProgram* Ogre::GLSLSeparableProgramManager::getCurrentSeparableProgram ( void  )

Get the program pipeline that combines the current program objects.

If the program pipeline object was not already created a new one is created. Note that this method does NOT link the program.

static GLSLSeparableProgramManager& Ogre::GLSLSeparableProgramManager::getSingleton ( void  )
static
static GLSLSeparableProgramManager* Ogre::GLSLSeparableProgramManager::getSingletonPtr ( void  )
static
void Ogre::GLSLProgramManager::parseGLSLUniform ( const String src,
GpuNamedConstants defs,
String::size_type  currPos,
const String filename,
GpuSharedParametersPtr  sharedParams 
)
protectedinherited

Parse an individual uniform from a GLSL source file and store it in a GpuNamedConstant.

void Ogre::GLSLSeparableProgramManager::setActiveComputeShader ( GLSLShader computShader)
void Ogre::GLSLSeparableProgramManager::setActiveFragmentShader ( GLSLShader fragmentShader)
void Ogre::GLSLSeparableProgramManager::setActiveGeometryShader ( GLSLShader geometryShader)
void Ogre::GLSLSeparableProgramManager::setActiveTessDomainShader ( GLSLShader domainShader)
void Ogre::GLSLSeparableProgramManager::setActiveTessHullShader ( GLSLShader hullShader)
void Ogre::GLSLSeparableProgramManager::setActiveVertexShader ( GLSLShader vertexShader)

Set the active link programs for the next rendering state.

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

Member Data Documentation

GLSLShader* Ogre::GLSLProgramManager::mActiveComputeShader
protectedinherited

Definition at line 61 of file OgreGLSLProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveDomainShader
protectedinherited

Definition at line 58 of file OgreGLSLProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveFragmentShader
protectedinherited

Definition at line 60 of file OgreGLSLProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveGeometryShader
protectedinherited

Definition at line 59 of file OgreGLSLProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveHullShader
protectedinherited

Definition at line 57 of file OgreGLSLProgramManager.h.

GLSLSeparableProgram* Ogre::GLSLSeparableProgramManager::mActiveSeparableProgram
private

Active objects defining the active rendering gpu state.

Definition at line 64 of file OgreGLSLSeparableProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveVertexShader
protectedinherited

Active shader objects defining the active program object.

Definition at line 56 of file OgreGLSLProgramManager.h.

SeparableProgramMap Ogre::GLSLSeparableProgramManager::mSeparablePrograms
private

Container holding previously created program pipeline objects.

Definition at line 61 of file OgreGLSLSeparableProgramManager.h.

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

Definition at line 75 of file OgreSingleton.h.

StringToEnumMap Ogre::GLSLProgramManager::mTypeEnumMap
protectedinherited

Definition at line 65 of file OgreGLSLProgramManager.h.


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