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

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

#include <OgreGLSLProgramManager.h>

+ Inheritance diagram for Ogre::GLSLProgramManager:
+ Collaboration diagram for Ogre::GLSLProgramManager:

Public Member Functions

 GLSLProgramManager (void)
 
 ~GLSLProgramManager (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...
 

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
 

Detailed Description

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

GLSL 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 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 programs. 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 OgreGLSLProgramManager.h.

Member Typedef Documentation

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

Definition at line 63 of file OgreGLSLProgramManager.h.

Constructor & Destructor Documentation

Ogre::GLSLProgramManager::GLSLProgramManager ( void  )
Ogre::GLSLProgramManager::~GLSLProgramManager ( void  )

Member Function Documentation

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

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 
)

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 
)

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 
)
protected

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 
)
protected

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

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

void Ogre::GLSLProgramManager::parseGLSLUniform ( const String src,
GpuNamedConstants defs,
String::size_type  currPos,
const String filename,
GpuSharedParametersPtr  sharedParams 
)
protected

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

Member Data Documentation

GLSLShader* Ogre::GLSLProgramManager::mActiveComputeShader
protected

Definition at line 61 of file OgreGLSLProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveDomainShader
protected

Definition at line 58 of file OgreGLSLProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveFragmentShader
protected

Definition at line 60 of file OgreGLSLProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveGeometryShader
protected

Definition at line 59 of file OgreGLSLProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveHullShader
protected

Definition at line 57 of file OgreGLSLProgramManager.h.

GLSLShader* Ogre::GLSLProgramManager::mActiveVertexShader
protected

Active shader objects defining the active program object.

Definition at line 56 of file OgreGLSLProgramManager.h.

StringToEnumMap Ogre::GLSLProgramManager::mTypeEnumMap
protected

Definition at line 65 of file OgreGLSLProgramManager.h.


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