Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Protected Member Functions | List of all members
om::graphics::materials::DeviceShaderProgram Class Referenceabstract

A class that represents the interface for a hardware-executed shading program. More...

#include <omGraphicsDeviceShaderProgram.h>

Inheritance diagram for om::graphics::materials::DeviceShaderProgram:
om::graphics::devices::DeviceResource om::graphics::devices::opengl::OpenGLShaderProgram

Public Member Functions

virtual Size getShaderCount () const =0
 Return the total number of shaders that are attached to this shader program. More...
 
virtual Shared< DeviceShadergetShader (Index shaderIndex) const =0
 Return a pointer to the shader object attached at the specified index to the shader program. More...
 
virtual Bool addShader (const Shared< DeviceShader > &newShader)=0
 Attach the specified shader to this shader program. More...
 
virtual Bool removeShader (Index shaderIndex)=0
 Detach the shader at the specified index from this shader program. More...
 
virtual Bool removeShader (const DeviceShader *shader)=0
 Detach the shader with the specified address from this shader program. More...
 
virtual void clearShaders ()=0
 Remove all shaders that are attached to this shader program. More...
 
virtual Bool link (StringOutputStream *linkLog=((void *) 0))=0
 Link the program's shaders into a useable shader program. More...
 
virtual Bool isLinked () const =0
 Return whether or not a link operation has been attempted on this shader program. More...
 
virtual Size getConstantVariableCount () const =0
 Return the total number of constant variables that are part of this shader program. More...
 
virtual const ConstantVariablegetConstantVariable (Index variableIndex) const =0
 Return a pointer to the constant variable for this shader program at the given index. More...
 
virtual Bool getConstantVariable (const ShaderSourceString &variableName, const ConstantVariable *&variable) const =0
 Get the constant variable that is part of this shader program with the specified name. More...
 
virtual Bool getConstantVariableIndex (const ShaderSourceString &variableName, Index &variableIndex) const =0
 Get the constant variable index for this shader program with the specified name. More...
 
virtual Size getTextureVariableCount () const =0
 Return the total number of texture variables that are part of this shader program. More...
 
virtual const TextureVariablegetTextureVariable (Index variableIndex) const =0
 Return a pointer to the texture variable for this shader program at the given index. More...
 
virtual Bool getTextureVariable (const ShaderSourceString &variableName, const TextureVariable *&variable) const =0
 Get the texture variable that is part of this shader program with the specified name. More...
 
virtual Bool getTextureVariableIndex (const ShaderSourceString &variableName, Index &variableIndex) const =0
 Get the texture variable index for this shader program with the specified name. More...
 
virtual Size getVertexVariableCount () const =0
 Return the total number of vertex variables that are part of this shader program. More...
 
virtual const VertexVariablegetVertexVariable (Index variableIndex) const =0
 Return a pointer to the vertex variable for this shader program at the given index. More...
 
virtual Bool getVertexVariable (const ShaderSourceString &variableName, const VertexVariable *&variable) const =0
 Get the vertex variable that is part of this shader program with the specified name. More...
 
virtual Bool getVertexVariableIndex (const ShaderSourceString &variableName, Index &variableIndex) const =0
 Get the vertex variable index for this shader program with the specified name. More...
 
- Public Member Functions inherited from om::graphics::devices::DeviceResource
virtual ~DeviceResource ()
 Destroy a device object, releasing all internal state. More...
 
GraphicsContextgetContext () const
 Return a pointer to the graphics context associated with this DeviceResource. More...
 
virtual Bool isValid () const =0
 Return whether or not the state of this device resource is valid and able to be used for rendering. More...
 

Protected Member Functions

 DeviceShaderProgram (devices::GraphicsContext *newContext)
 Create a device shader program for the specified context. More...
 
- Protected Member Functions inherited from om::graphics::devices::DeviceResource
 DeviceResource (GraphicsContext *newContext)
 Create a new device object that is associated with the specified graphics context. More...
 

Detailed Description

A class that represents the interface for a hardware-executed shading program.

A shader program is made up of one or more Shader objects that describe the different stages of a shading pipeline. A ShaderProgram presents an interface of shader variables that can be used to control the output of the shader. Shader variables can correspond to constants, per-vertex attributes, or textures. A shader program must be successfully linked before it can be used.

Constructor & Destructor Documentation

om::graphics::materials::DeviceShaderProgram::DeviceShaderProgram ( devices::GraphicsContext newContext)
inlineprotected

Create a device shader program for the specified context.

Member Function Documentation

virtual Size om::graphics::materials::DeviceShaderProgram::getShaderCount ( ) const
pure virtual

Return the total number of shaders that are attached to this shader program.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Shared<DeviceShader> om::graphics::materials::DeviceShaderProgram::getShader ( Index  shaderIndex) const
pure virtual

Return a pointer to the shader object attached at the specified index to the shader program.

Shader indices range from 0 for the first attached shader to N for the Nth attached shader.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::addShader ( const Shared< DeviceShader > &  newShader)
pure virtual

Attach the specified shader to this shader program.

The method returns whether or not the new shader was able to be attached. The method can fail if the shader pointer is NULL, the shader was not able to be compiled, or if there was an internal error.

If the method succeeds, the shader program will need to be re-linked before it can be used.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::removeShader ( Index  shaderIndex)
pure virtual

Detach the shader at the specified index from this shader program.

The method returns whether or not the shader was able to be removed.

If the method succeeds, the shader program will need to be re-linked before it can be used.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::removeShader ( const DeviceShader shader)
pure virtual

Detach the shader with the specified address from this shader program.

The method returns whether or not the shader was able to be removed.

If the method succeeds, the shader program will need to be re-linked before it can be used.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual void om::graphics::materials::DeviceShaderProgram::clearShaders ( )
pure virtual

Remove all shaders that are attached to this shader program.

Shaders will need to be attatched to an empty program before it can be used again.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::link ( StringOutputStream linkLog = ((void *) 0))
pure virtual

Link the program's shaders into a useable shader program.

The return value indicates wether or not the link operation was successful. If an error was encountered during the link process, the linker's output is written to the link log parameter.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::isLinked ( ) const
pure virtual

Return whether or not a link operation has been attempted on this shader program.

The method does not return whether or not the link operation was successful, use the isValid() method instead to determine that.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Size om::graphics::materials::DeviceShaderProgram::getConstantVariableCount ( ) const
pure virtual

Return the total number of constant variables that are part of this shader program.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual const ConstantVariable* om::graphics::materials::DeviceShaderProgram::getConstantVariable ( Index  variableIndex) const
pure virtual

Return a pointer to the constant variable for this shader program at the given index.

Variable indices range from 0 up to the number of constant variables minus one. If an invalid variable index is specified, NULL is returned.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::getConstantVariable ( const ShaderSourceString variableName,
const ConstantVariable *&  variable 
) const
pure virtual

Get the constant variable that is part of this shader program with the specified name.

The constant variable, if found, is placed in the output reference parameter. The method returns whether or not this shader program has a variable with the given variable name.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::getConstantVariableIndex ( const ShaderSourceString variableName,
Index variableIndex 
) const
pure virtual

Get the constant variable index for this shader program with the specified name.

The constant variable's index, if found, is placed in the output reference parameter. The method returns whether or not this shader program has a variable with the given variable name.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Size om::graphics::materials::DeviceShaderProgram::getTextureVariableCount ( ) const
pure virtual

Return the total number of texture variables that are part of this shader program.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual const TextureVariable* om::graphics::materials::DeviceShaderProgram::getTextureVariable ( Index  variableIndex) const
pure virtual

Return a pointer to the texture variable for this shader program at the given index.

Variable indices range from 0 up to the number of texture variables minus one. If an invalid variable index is specified, NULL is returned.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::getTextureVariable ( const ShaderSourceString variableName,
const TextureVariable *&  variable 
) const
pure virtual

Get the texture variable that is part of this shader program with the specified name.

The texture variable, if found, is placed in the output reference parameter. The method returns whether or not this shader program has a variable with the given variable name.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::getTextureVariableIndex ( const ShaderSourceString variableName,
Index variableIndex 
) const
pure virtual

Get the texture variable index for this shader program with the specified name.

The texture variable's index, if found, is placed in the output reference parameter. The method returns whether or not this shader program has a variable with the given variable name.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Size om::graphics::materials::DeviceShaderProgram::getVertexVariableCount ( ) const
pure virtual

Return the total number of vertex variables that are part of this shader program.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual const VertexVariable* om::graphics::materials::DeviceShaderProgram::getVertexVariable ( Index  variableIndex) const
pure virtual

Return a pointer to the vertex variable for this shader program at the given index.

Variable indices range from 0 up to the number of vertex variables minus one. If an invalid variable index is specified, NULL is returned.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::getVertexVariable ( const ShaderSourceString variableName,
const VertexVariable *&  variable 
) const
pure virtual

Get the vertex variable that is part of this shader program with the specified name.

The vertex variable, if found, is placed in the output reference parameter. The method returns whether or not this shader program has a variable with the given variable name.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.

virtual Bool om::graphics::materials::DeviceShaderProgram::getVertexVariableIndex ( const ShaderSourceString variableName,
Index variableIndex 
) const
pure virtual

Get the vertex variable index for this shader program with the specified name.

The vertex variable's index, if found, is placed in the output reference parameter. The method returns whether or not this shader program has a variable with the given variable name.

Implemented in om::graphics::devices::opengl::OpenGLShaderProgram.


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