C# Class Axiom.RenderSystems.OpenGL.GLSL.GLSLLinkProgramManager

Axiom assumes that there are seperate 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 seperately 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.
Inheritance: IDisposable
显示文件 Open project: mono-soc-2011/axiom Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Called when the engine is shutting down.

ExtractConstantDefs ( String src, GpuProgramParameters defs, String filename ) : void

Populate a list of uniforms based on GLSL source.

ExtractUniforms ( int programObject, GpuProgramParameters vertexConstantDefs, GpuProgramParameters geometryConstantDefs, GpuProgramParameters fragmentConstantDefs, Axiom.RenderSystems.OpenGL.GLSL.GLSLLinkProgram list ) : void

Populate a list of uniforms based on a program object.

SetActiveFragmentShader ( GLSLGpuProgram fragmentProgram ) : void

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

SetActiveGeometryShader ( GLSLGpuProgram geometryProgram ) : void

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

SetActiveVertexShader ( GLSLGpuProgram vertexProgram ) : void

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

Private Methods

Method Description
CompleteDefInfo ( int gltype, GpuProgramParameters defToUpdate ) : void
CompleteParamSource ( String paramName, GpuProgramParameters vertexConstantDefs, GpuProgramParameters geometryConstantDefs, GpuProgramParameters fragmentConstantDefs, Axiom.RenderSystems.OpenGL.GLSL.GLSLLinkProgram refToUpdate ) : bool
GLSLLinkProgramManager ( ) : System

Internal constructor. This class cannot be instantiated externally.

Method Details

Dispose() public method

Called when the engine is shutting down.
public Dispose ( ) : void
return void

ExtractConstantDefs() public method

Populate a list of uniforms based on GLSL source.
public ExtractConstantDefs ( String src, GpuProgramParameters defs, String filename ) : void
src String Reference to the source code
defs Axiom.Graphics.GpuProgramParameters The defs to populate (will not be cleared before adding, clear /// it yourself before calling this if that's what you want).
filename String The file name this came from, for logging errors.
return void

ExtractUniforms() public method

Populate a list of uniforms based on a program object.
public ExtractUniforms ( int programObject, GpuProgramParameters vertexConstantDefs, GpuProgramParameters geometryConstantDefs, GpuProgramParameters fragmentConstantDefs, Axiom.RenderSystems.OpenGL.GLSL.GLSLLinkProgram list ) : void
programObject int Handle to the program object to query
vertexConstantDefs Axiom.Graphics.GpuProgramParameters Definition 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.
geometryConstantDefs Axiom.Graphics.GpuProgramParameters Definition 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.
fragmentConstantDefs Axiom.Graphics.GpuProgramParameters Definition 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.
list Axiom.RenderSystems.OpenGL.GLSL.GLSLLinkProgram The list to populate (will not be cleared before adding, clear /// it yourself before calling this if that's what you want).
return void

SetActiveFragmentShader() public method

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
public SetActiveFragmentShader ( GLSLGpuProgram fragmentProgram ) : void
fragmentProgram GLSLGpuProgram
return void

SetActiveGeometryShader() public method

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
public SetActiveGeometryShader ( GLSLGpuProgram geometryProgram ) : void
geometryProgram GLSLGpuProgram
return void

SetActiveVertexShader() public method

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
public SetActiveVertexShader ( GLSLGpuProgram vertexProgram ) : void
vertexProgram GLSLGpuProgram
return void