OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::GLSLMonolithicProgramManager 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 <OgreGLSLMonolithicProgramManager.h>

+ Inheritance diagram for Ogre::GLSLMonolithicProgramManager:
+ Collaboration diagram for Ogre::GLSLMonolithicProgramManager:

Public Member Functions

 GLSLMonolithicProgramManager (void)
 
 ~GLSLMonolithicProgramManager (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...
 
GLSLMonolithicProgramgetActiveMonolithicProgram (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 setActiveComputeShader (GLSLShader *computeGpuProgram)
 Set the active compute shader for the next rendering state. More...
 
void setActiveDomainShader (GLSLShader *domainGpuProgram)
 Set the active domain(evaluation) shader for the next rendering state. More...
 
void setActiveFragmentShader (GLSLShader *fragmentGpuProgram)
 Set the active fragment shader for the next rendering state. More...
 
void setActiveGeometryShader (GLSLShader *geometryGpuProgram)
 Set the active geometry shader for the next rendering state. More...
 
void setActiveHullShader (GLSLShader *hullGpuProgram)
 Set the active hull(control) shader for the next rendering state. More...
 
void setActiveVertexShader (GLSLShader *vertexGpuProgram)
 Set the active vertex shader for the next rendering state. More...
 

Static Public Member Functions

static
GLSLMonolithicProgramManager
getSingleton (void)
 
static
GLSLMonolithicProgramManager
getSingletonPtr (void)
 

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

Static Protected Attributes

static
GLSLMonolithicProgramManager
msSingleton
 

Private Types

typedef
MonolithicProgramMap::iterator 
MonolithicProgramIterator
 
typedef map< uint32,
GLSLMonolithicProgram * >
::type 
MonolithicProgramMap
 
typedef map< String, GLenum >::type StringToEnumMap
 

Private Attributes

GLSLMonolithicProgrammActiveMonolithicProgram
 active objects defining the active rendering gpu state More...
 
MonolithicProgramMap mMonolithicPrograms
 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 55 of file OgreGLSLMonolithicProgramManager.h.

Member Typedef Documentation

typedef MonolithicProgramMap::iterator Ogre::GLSLMonolithicProgramManager::MonolithicProgramIterator
private

Definition at line 61 of file OgreGLSLMonolithicProgramManager.h.

Definition at line 69 of file OgreGLSLMonolithicProgramManager.h.

Constructor & Destructor Documentation

Ogre::GLSLMonolithicProgramManager::GLSLMonolithicProgramManager ( void  )
Ogre::GLSLMonolithicProgramManager::~GLSLMonolithicProgramManager ( 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.

GLSLMonolithicProgram* Ogre::GLSLMonolithicProgramManager::getActiveMonolithicProgram ( 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 GLSLMonolithicProgramManager& Ogre::GLSLMonolithicProgramManager::getSingleton ( void  )
static
static GLSLMonolithicProgramManager* Ogre::GLSLMonolithicProgramManager::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::GLSLMonolithicProgramManager::setActiveComputeShader ( GLSLShader computeGpuProgram)

Set the active compute shader for the next rendering state.

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

void Ogre::GLSLMonolithicProgramManager::setActiveDomainShader ( GLSLShader domainGpuProgram)

Set the active domain(evaluation) shader for the next rendering state.

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

void Ogre::GLSLMonolithicProgramManager::setActiveFragmentShader ( GLSLShader fragmentGpuProgram)

Set the active fragment shader for the next rendering state.

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

void Ogre::GLSLMonolithicProgramManager::setActiveGeometryShader ( GLSLShader geometryGpuProgram)

Set the active geometry shader for the next rendering state.

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

void Ogre::GLSLMonolithicProgramManager::setActiveHullShader ( GLSLShader hullGpuProgram)

Set the active hull(control) shader for the next rendering state.

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

void Ogre::GLSLMonolithicProgramManager::setActiveVertexShader ( GLSLShader vertexGpuProgram)

Set the active vertex shader for the next rendering state.

The active program 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.

GLSLMonolithicProgram* Ogre::GLSLMonolithicProgramManager::mActiveMonolithicProgram
private

active objects defining the active rendering gpu state

Definition at line 67 of file OgreGLSLMonolithicProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveVertexShader
protectedinherited

Active shader objects defining the active program object.

Definition at line 56 of file OgreGLSLProgramManager.h.

MonolithicProgramMap Ogre::GLSLMonolithicProgramManager::mMonolithicPrograms
private

container holding previously created program objects

Definition at line 64 of file OgreGLSLMonolithicProgramManager.h.

Definition at line 75 of file OgreSingleton.h.

StringToEnumMap Ogre::GLSLMonolithicProgramManager::mTypeEnumMap
private

Definition at line 70 of file OgreGLSLMonolithicProgramManager.h.


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