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

Specialisation of HighLevelGpuProgram to provide support for OpenGL Shader Language (GLSL ES) for OpenGL ES 2.0. More...

#include <OgreGLSLESProgram.h>

+ Inheritance diagram for Ogre::GLSLESProgram:
+ Collaboration diagram for Ogre::GLSLESProgram:

Classes

class  CmdOptimisation
 Command object for running the GLSL optimiser. More...
 
class  CmdPreprocessorDefines
 Command object for setting macro defines. More...
 

Public Member Functions

 GLSLESProgram (ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual, ManualResourceLoader *loader)
 
 ~GLSLESProgram ()
 
void attachToProgramObject (const GLuint programObject)
 
bool compile (const bool checkErrors=false)
 compile source into shader object More...
 
GpuProgramParametersSharedPtr createParameters (void)
 Overridden from GpuProgram. More...
 
void detachFromProgramObject (const GLuint programObject)
 
GLuint getGLProgramHandle () const
 
GLuint getGLShaderHandle () const
 GL Shader Handle. More...
 
bool getIsOptimised (void)
 Gets if the GLSL source has been optimised successfully. More...
 
const StringgetLanguage (void) const
 Overridden from GpuProgram. More...
 
String getOptimisedSource (void)
 Gets he optimised GLSL source. More...
 
bool getOptimiserEnabled (void) const
 Gets if the GLSL optimiser is enabled. More...
 
bool getPassFogStates (void) const
 
bool getPassSurfaceAndLightStates (void) const
 
bool getPassTransformStates (void) const
 Overridden. More...
 
const StringgetPreprocessorDefines (void) const
 Sets the preprocessor defines use to compile the program. More...
 
void setIsOptimised (bool flag)
 Sets if the GLSL source has been optimised successfully. More...
 
void setOptimisedSource (const String &src)
 Sets the optimised GLSL source. More...
 
void setOptimiserEnabled (bool enabled)
 Sets if the GLSL optimiser is enabled. More...
 
void setPreprocessorDefines (const String &defines)
 Sets the preprocessor defines use to compile the program. More...
 

Protected Member Functions

void buildConstantDefinitions () const
 Populate the passed parameters with name->index map, must be overridden. More...
 
void checkAndFixInvalidDefaultPrecisionError (String &message)
 check the compile result for an error with default precision - and recompile if needed. More...
 
void createLowLevelImpl (void)
 Internal method for creating a dummy low-level program for this high-level program. More...
 
void loadFromSource (void)
 Internal load implementation, must be implemented by subclasses. More...
 
virtual void notifyOnContextLost ()
 See AndroidResource. More...
 
void populateParameterNames (GpuProgramParametersSharedPtr params)
 Populate the passed parameters with name->index map. More...
 
void unloadHighLevelImpl (void)
 Internal unload implementation, must be implemented by subclasses. More...
 
void unloadImpl (void)
 Overridden from HighLevelGpuProgram. More...
 

Static Protected Attributes

static CmdOptimisation msCmdOptimisation
 
static CmdPreprocessorDefines msCmdPreprocessorDefines
 

Private Attributes

GLint mCompiled
 Flag indicating if shader object successfully compiled. More...
 
GLuint mGLProgramHandle
 
GLuint mGLShaderHandle
 GL handle for shader object. More...
 
bool mIsOptimised
 Flag indicating if shader has been successfully optimised. More...
 
String mOptimisedSource
 The optmised source of the program (may be blank until the shader is optmisied) More...
 
bool mOptimiserEnabled
 
String mPreprocessorDefines
 Preprocessor options. More...
 

Detailed Description

Specialisation of HighLevelGpuProgram to provide support for OpenGL Shader Language (GLSL ES) for OpenGL ES 2.0.

Remarks
GLSL ES has no target assembler or entry point specification like DirectX 9 HLSL. Vertex and Fragment shaders only have one entry point called "main". When a shader is compiled, microcode is generated but can not be accessed by the application. GLSL ES also does not provide assembler low level output after compiling. The GL ES Render system assumes that the Gpu program is a GL Gpu program so GLSLESProgram will create a GLSLESGpuProgram that is subclassed from GLES2GpuProgram for the low level implementation. The GLES2Program class will create a shader object and compile the source but will not create a program object. It's up to GLES2GpuProgram class to request a program object to link the shader object to.

Definition at line 50 of file OgreGLSLESProgram.h.

Constructor & Destructor Documentation

Ogre::GLSLESProgram::GLSLESProgram ( ResourceManager creator,
const String name,
ResourceHandle  handle,
const String group,
bool  isManual,
ManualResourceLoader loader 
)
Ogre::GLSLESProgram::~GLSLESProgram ( )

Member Function Documentation

void Ogre::GLSLESProgram::attachToProgramObject ( const GLuint  programObject)
void Ogre::GLSLESProgram::buildConstantDefinitions ( ) const
protected

Populate the passed parameters with name->index map, must be overridden.

void Ogre::GLSLESProgram::checkAndFixInvalidDefaultPrecisionError ( String message)
protected

check the compile result for an error with default precision - and recompile if needed.

some glsl compilers return an error default precision is set to types other then int or float, this function test a failed compile result for the error, delete the needed lines from the source if needed then try to re-compile.

bool Ogre::GLSLESProgram::compile ( const bool  checkErrors = false)

compile source into shader object

void Ogre::GLSLESProgram::createLowLevelImpl ( void  )
protected

Internal method for creating a dummy low-level program for this high-level program.

GLSL ES does not give access to the low level implementation of the shader so this method creates an object sub-classed from GLES2GpuProgram just to be compatible with GLES2RenderSystem.

GpuProgramParametersSharedPtr Ogre::GLSLESProgram::createParameters ( void  )

Overridden from GpuProgram.

void Ogre::GLSLESProgram::detachFromProgramObject ( const GLuint  programObject)
GLuint Ogre::GLSLESProgram::getGLProgramHandle ( ) const
inline

Definition at line 79 of file OgreGLSLESProgram.h.

GLuint Ogre::GLSLESProgram::getGLShaderHandle ( ) const
inline

GL Shader Handle.

Definition at line 76 of file OgreGLSLESProgram.h.

bool Ogre::GLSLESProgram::getIsOptimised ( void  )
inline

Gets if the GLSL source has been optimised successfully.

Definition at line 100 of file OgreGLSLESProgram.h.

const String& Ogre::GLSLESProgram::getLanguage ( void  ) const

Overridden from GpuProgram.

String Ogre::GLSLESProgram::getOptimisedSource ( void  )
inline

Gets he optimised GLSL source.

Definition at line 105 of file OgreGLSLESProgram.h.

bool Ogre::GLSLESProgram::getOptimiserEnabled ( void  ) const
inline

Gets if the GLSL optimiser is enabled.

Definition at line 95 of file OgreGLSLESProgram.h.

bool Ogre::GLSLESProgram::getPassFogStates ( void  ) const
bool Ogre::GLSLESProgram::getPassSurfaceAndLightStates ( void  ) const
bool Ogre::GLSLESProgram::getPassTransformStates ( void  ) const

Overridden.

const String& Ogre::GLSLESProgram::getPreprocessorDefines ( void  ) const
inline

Sets the preprocessor defines use to compile the program.

Definition at line 89 of file OgreGLSLESProgram.h.

void Ogre::GLSLESProgram::loadFromSource ( void  )
protected

Internal load implementation, must be implemented by subclasses.

virtual void Ogre::GLSLESProgram::notifyOnContextLost ( )
protectedvirtual
void Ogre::GLSLESProgram::populateParameterNames ( GpuProgramParametersSharedPtr  params)
protected

Populate the passed parameters with name->index map.

void Ogre::GLSLESProgram::setIsOptimised ( bool  flag)
inline

Sets if the GLSL source has been optimised successfully.

Definition at line 98 of file OgreGLSLESProgram.h.

void Ogre::GLSLESProgram::setOptimisedSource ( const String src)
inline

Sets the optimised GLSL source.

Definition at line 103 of file OgreGLSLESProgram.h.

void Ogre::GLSLESProgram::setOptimiserEnabled ( bool  enabled)

Sets if the GLSL optimiser is enabled.

void Ogre::GLSLESProgram::setPreprocessorDefines ( const String defines)
inline

Sets the preprocessor defines use to compile the program.

Definition at line 87 of file OgreGLSLESProgram.h.

void Ogre::GLSLESProgram::unloadHighLevelImpl ( void  )
protected

Internal unload implementation, must be implemented by subclasses.

void Ogre::GLSLESProgram::unloadImpl ( void  )
protected

Overridden from HighLevelGpuProgram.

Member Data Documentation

GLint Ogre::GLSLESProgram::mCompiled
private

Flag indicating if shader object successfully compiled.

Definition at line 157 of file OgreGLSLESProgram.h.

GLuint Ogre::GLSLESProgram::mGLProgramHandle
private

Definition at line 155 of file OgreGLSLESProgram.h.

GLuint Ogre::GLSLESProgram::mGLShaderHandle
private

GL handle for shader object.

Definition at line 154 of file OgreGLSLESProgram.h.

bool Ogre::GLSLESProgram::mIsOptimised
private

Flag indicating if shader has been successfully optimised.

Definition at line 162 of file OgreGLSLESProgram.h.

String Ogre::GLSLESProgram::mOptimisedSource
private

The optmised source of the program (may be blank until the shader is optmisied)

Definition at line 165 of file OgreGLSLESProgram.h.

bool Ogre::GLSLESProgram::mOptimiserEnabled
private

Definition at line 163 of file OgreGLSLESProgram.h.

String Ogre::GLSLESProgram::mPreprocessorDefines
private

Preprocessor options.

Definition at line 159 of file OgreGLSLESProgram.h.

CmdOptimisation Ogre::GLSLESProgram::msCmdOptimisation
staticprotected

Definition at line 119 of file OgreGLSLESProgram.h.

CmdPreprocessorDefines Ogre::GLSLESProgram::msCmdPreprocessorDefines
staticprotected

Definition at line 117 of file OgreGLSLESProgram.h.


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