Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::GPUProgram Class Referenceabstract

Abstract shader program (for fragment/vertex shading) More...

#include <mitsuba/hw/gpuprogram.h>

+ Inheritance diagram for mitsuba::GPUProgram:

Public Types

enum  EType { EVertexProgram = 0, EFragmentProgram, EGeometryProgram }
 Denotes the different components of this program. More...
 
enum  EGeometryType {
  EPoints, ELines, ELineStrips, ETriangles,
  ETriangleStrips, EQuadrilaterals
}
 Common geometry shader input/output types. More...
 

Public Member Functions

 GPUProgram (const std::string &name="default")
 Create an empty program. More...
 
void setName (const std::string &name)
 Set the name of this program. More...
 
const std::string & getName () const
 Return the name of this program. More...
 
void setSource (EType type, const std::string &source)
 Set the source code of this program. More...
 
void setSourceFile (EType type, const fs::path &path)
 Set the source code of this program by filename. More...
 
const std::string & getSource (EType type) const
 Get the source code of this program. More...
 
virtual void init ()=0
 Upload to the GPU. More...
 
virtual void bind ()=0
 Bind the shader. More...
 
virtual void unbind ()=0
 Set the default shader program. More...
 
virtual void cleanup ()=0
 Remove all allocated handles. More...
 
virtual int getParameterID (const std::string &name, bool failIfMissing=true) const =0
 Determine the ID number of a named parameter. More...
 
void setParameter (const std::string &name, bool value, bool failIfMissing=true)
 Set a boolean parameter by name. More...
 
void setParameter (const std::string &name, int value, bool failIfMissing=true)
 Set a integer parameter by name. More...
 
void setParameter (const std::string &name, uint32_t value, bool failIfMissing=true)
 Set an unsigned integer parameter by name. More...
 
void setParameter (const std::string &name, Float value, bool failIfMissing=true)
 Set a float parameter by name. More...
 
void setParameter (const std::string &name, const Vector &value, bool failIfMissing=true)
 Set a Vector parameter by name. More...
 
void setParameter (const std::string &name, const Vector3i &value, bool failIfMissing=true)
 Set a Vector3i parameter by name. More...
 
void setParameter (const std::string &name, const Vector2 &value, bool failIfMissing=true)
 Set a Vector2 parameter by name. More...
 
void setParameter (const std::string &name, const Vector2i &value, bool failIfMissing=true)
 Set a Vector2i parameter by name. More...
 
void setParameter (const std::string &name, const Vector4 &value, bool failIfMissing=true)
 Set a Vector4 parameter by name. More...
 
void setParameter (const std::string &name, const Point &value, bool failIfMissing=true)
 Set a Point parameter by name. More...
 
void setParameter (const std::string &name, const Point3i &value, bool failIfMissing=true)
 Set a Point3i parameter by name. More...
 
void setParameter (const std::string &name, const Point2 &value, bool failIfMissing=true)
 Set a Point2 parameter by name. More...
 
void setParameter (const std::string &name, const Point2i &value, bool failIfMissing=true)
 Set a Point2i parameter by name. More...
 
void setParameter (const std::string &name, const Point4 &value, bool failIfMissing=true)
 Set a Point4 parameter by name. More...
 
void setParameter (const std::string &name, const Matrix2x2 &value, bool failIfMissing=true)
 Set a Matrix2x2 parameter by name. More...
 
void setParameter (const std::string &name, const Matrix3x3 &value, bool failIfMissing=true)
 Set a Matrix3x3 parameter by name. More...
 
void setParameter (const std::string &name, const Matrix4x4 &value, bool failIfMissing=true)
 Set a Matrix4x4 parameter by name. More...
 
void setParameter (const std::string &name, const Transform &value, bool failIfMissing=true)
 Set a Transform parameter by name. More...
 
void setParameter (const std::string &name, const Color3 &value, bool failIfMissing=true)
 Set a Color3 parameter by name. More...
 
void setParameter (const std::string &name, const Spectrum &value, bool failIfMissing=true)
 Set a Spectrum parameter (will be converted to linear RGB) by name. More...
 
void setParameter (const std::string &name, const GPUTexture *value, bool failIfMissing=true)
 
virtual void setParameter (int id, bool value)=0
 Set a boolean parameter. More...
 
virtual void setParameter (int id, Float value)=0
 Set a float parameter. More...
 
virtual void setParameter (int id, int value)=0
 Set a int parameter. More...
 
virtual void setParameter (int id, uint32_t value)=0
 Set a uint32_t parameter. More...
 
virtual void setParameter (int id, const Vector &value)=0
 Set a Vector parameter. More...
 
virtual void setParameter (int id, const Vector3i &value)=0
 Set a Vector3i parameter. More...
 
virtual void setParameter (int id, const Vector2 &value)=0
 Set a Vector2 parameter. More...
 
virtual void setParameter (int id, const Vector2i &value)=0
 Set a Vector2i parameter. More...
 
virtual void setParameter (int id, const Vector4 &value)=0
 Set a Vector4 parameter. More...
 
virtual void setParameter (int id, const Point &value)=0
 Set a Point parameter. More...
 
virtual void setParameter (int id, const Point3i &value)=0
 Set a Point3i parameter. More...
 
virtual void setParameter (int id, const Point2 &value)=0
 Set a Point2 parameter. More...
 
virtual void setParameter (int id, const Point2i &value)=0
 Set a Point2i parameter. More...
 
virtual void setParameter (int id, const Point4 &value)=0
 Set a Point4 parameter. More...
 
virtual void setParameter (int id, const Matrix2x2 &value)=0
 Set a Matrix2x2 parameter. More...
 
virtual void setParameter (int id, const Matrix3x3 &value)=0
 Set a Matrix3x3 parameter. More...
 
virtual void setParameter (int id, const Matrix4x4 &value)=0
 Set a Matrix4x4 parameter. More...
 
void setParameter (int id, const Transform &value)
 Set a Transform parameter. More...
 
virtual void setParameter (int id, const Color3 &value)=0
 Set a Color3 parameter. More...
 
virtual void setParameter (int id, const Spectrum &value)=0
 Set a Spectrum parameter (will be converted to linear RGB) More...
 
virtual void setParameter (int id, const GPUTexture *value)=0
 
std::string toString () const
 Return a string representation of this class. More...
 
int getMaxVertices () const
 Returns the max. number of vertices generated by the geometry shader. More...
 
void setMaxVertices (int maxVertices)
 Set the max. number of vertices generated by the geometry shader. More...
 
void setInputGeometryType (EGeometryType type)
 Set the input type of the geometry shader. More...
 
EGeometryType getInputGeometryType () const
 Return the input type of the geometry shader. More...
 
void setOutputGeometryType (EGeometryType type)
 Set the output type of the geometry shader. More...
 
EGeometryType getOutputGeometryType () const
 Return the output type of the geometry shader. More...
 
bool isBound () const
 
void define (const std::string &key, const std::string &value="")
 Create a preprocessor definition (must be used before 'init') More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

virtual ~GPUProgram ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Protected Attributes

std::string m_name
 
std::string m_source [3]
 
EGeometryType m_inputGeometryType
 
EGeometryType m_outputGeometryType
 
int m_maxVertices
 
bool m_bound
 
std::map< std::string,
std::string > 
m_definitions
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Detailed Description

Abstract shader program (for fragment/vertex shading)

Member Enumeration Documentation

Common geometry shader input/output types.

Enumerator
EPoints 
ELines 
ELineStrips 
ETriangles 
ETriangleStrips 
EQuadrilaterals 

Denotes the different components of this program.

Enumerator
EVertexProgram 
EFragmentProgram 
EGeometryProgram 

Constructor & Destructor Documentation

mitsuba::GPUProgram::GPUProgram ( const std::string &  name = "default")

Create an empty program.

virtual mitsuba::GPUProgram::~GPUProgram ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

virtual void mitsuba::GPUProgram::bind ( )
pure virtual

Bind the shader.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::cleanup ( )
pure virtual

Remove all allocated handles.

Implemented in mitsuba::GLProgram.

void mitsuba::GPUProgram::define ( const std::string &  key,
const std::string &  value = "" 
)
inline

Create a preprocessor definition (must be used before 'init')

virtual const Class* mitsuba::GPUProgram::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from Object.

Reimplemented in mitsuba::GLProgram.

EGeometryType mitsuba::GPUProgram::getInputGeometryType ( ) const
inline

Return the input type of the geometry shader.

int mitsuba::GPUProgram::getMaxVertices ( ) const
inline

Returns the max. number of vertices generated by the geometry shader.

const std::string& mitsuba::GPUProgram::getName ( ) const
inline

Return the name of this program.

EGeometryType mitsuba::GPUProgram::getOutputGeometryType ( ) const
inline

Return the output type of the geometry shader.

virtual int mitsuba::GPUProgram::getParameterID ( const std::string &  name,
bool  failIfMissing = true 
) const
pure virtual

Determine the ID number of a named parameter.

Implemented in mitsuba::GLProgram.

const std::string& mitsuba::GPUProgram::getSource ( EType  type) const
inline

Get the source code of this program.

virtual void mitsuba::GPUProgram::init ( )
pure virtual

Upload to the GPU.

Implemented in mitsuba::GLProgram.

bool mitsuba::GPUProgram::isBound ( ) const
inline

Return whether or not this program is currently bound

void mitsuba::GPUProgram::setInputGeometryType ( EGeometryType  type)
inline

Set the input type of the geometry shader.

void mitsuba::GPUProgram::setMaxVertices ( int  maxVertices)
inline

Set the max. number of vertices generated by the geometry shader.

void mitsuba::GPUProgram::setName ( const std::string &  name)
inline

Set the name of this program.

void mitsuba::GPUProgram::setOutputGeometryType ( EGeometryType  type)
inline

Set the output type of the geometry shader.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
bool  value,
bool  failIfMissing = true 
)
inline

Set a boolean parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
int  value,
bool  failIfMissing = true 
)
inline

Set a integer parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
uint32_t  value,
bool  failIfMissing = true 
)
inline

Set an unsigned integer parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
Float  value,
bool  failIfMissing = true 
)
inline

Set a float parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Vector value,
bool  failIfMissing = true 
)
inline

Set a Vector parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Vector3i value,
bool  failIfMissing = true 
)
inline

Set a Vector3i parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Vector2 value,
bool  failIfMissing = true 
)
inline

Set a Vector2 parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Vector2i value,
bool  failIfMissing = true 
)
inline

Set a Vector2i parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Vector4 value,
bool  failIfMissing = true 
)
inline

Set a Vector4 parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Point value,
bool  failIfMissing = true 
)
inline

Set a Point parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Point3i value,
bool  failIfMissing = true 
)
inline

Set a Point3i parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Point2 value,
bool  failIfMissing = true 
)
inline

Set a Point2 parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Point2i value,
bool  failIfMissing = true 
)
inline

Set a Point2i parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Point4 value,
bool  failIfMissing = true 
)
inline

Set a Point4 parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Matrix2x2 value,
bool  failIfMissing = true 
)
inline

Set a Matrix2x2 parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Matrix3x3 value,
bool  failIfMissing = true 
)
inline

Set a Matrix3x3 parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Matrix4x4 value,
bool  failIfMissing = true 
)
inline

Set a Matrix4x4 parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Transform value,
bool  failIfMissing = true 
)
inline

Set a Transform parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Color3 value,
bool  failIfMissing = true 
)
inline

Set a Color3 parameter by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const Spectrum value,
bool  failIfMissing = true 
)
inline

Set a Spectrum parameter (will be converted to linear RGB) by name.

void mitsuba::GPUProgram::setParameter ( const std::string &  name,
const GPUTexture value,
bool  failIfMissing = true 
)
inline

Set a GPUTexture parameter by name. Must be executed after binding the texture to a texture unit

virtual void mitsuba::GPUProgram::setParameter ( int  id,
bool  value 
)
pure virtual

Set a boolean parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
Float  value 
)
pure virtual

Set a float parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
int  value 
)
pure virtual

Set a int parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
uint32_t  value 
)
pure virtual

Set a uint32_t parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Vector value 
)
pure virtual

Set a Vector parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Vector3i value 
)
pure virtual

Set a Vector3i parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Vector2 value 
)
pure virtual

Set a Vector2 parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Vector2i value 
)
pure virtual

Set a Vector2i parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Vector4 value 
)
pure virtual

Set a Vector4 parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Point value 
)
pure virtual

Set a Point parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Point3i value 
)
pure virtual

Set a Point3i parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Point2 value 
)
pure virtual

Set a Point2 parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Point2i value 
)
pure virtual

Set a Point2i parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Point4 value 
)
pure virtual

Set a Point4 parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Matrix2x2 value 
)
pure virtual

Set a Matrix2x2 parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Matrix3x3 value 
)
pure virtual

Set a Matrix3x3 parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Matrix4x4 value 
)
pure virtual

Set a Matrix4x4 parameter.

Implemented in mitsuba::GLProgram.

void mitsuba::GPUProgram::setParameter ( int  id,
const Transform value 
)
inline

Set a Transform parameter.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Color3 value 
)
pure virtual

Set a Color3 parameter.

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const Spectrum value 
)
pure virtual

Set a Spectrum parameter (will be converted to linear RGB)

Implemented in mitsuba::GLProgram.

virtual void mitsuba::GPUProgram::setParameter ( int  id,
const GPUTexture value 
)
pure virtual

Set a GPUTexture parameter. Must be executed after binding the texture to a texture unit

Implemented in mitsuba::GLProgram.

void mitsuba::GPUProgram::setSource ( EType  type,
const std::string &  source 
)
inline

Set the source code of this program.

void mitsuba::GPUProgram::setSourceFile ( EType  type,
const fs::path &  path 
)

Set the source code of this program by filename.

std::string mitsuba::GPUProgram::toString ( ) const
virtual

Return a string representation of this class.

Reimplemented from Object.

virtual void mitsuba::GPUProgram::unbind ( )
pure virtual

Set the default shader program.

Implemented in mitsuba::GLProgram.

Member Data Documentation

bool mitsuba::GPUProgram::m_bound
protected
std::map<std::string, std::string> mitsuba::GPUProgram::m_definitions
protected
EGeometryType mitsuba::GPUProgram::m_inputGeometryType
protected
int mitsuba::GPUProgram::m_maxVertices
protected
std::string mitsuba::GPUProgram::m_name
protected
EGeometryType mitsuba::GPUProgram::m_outputGeometryType
protected
std::string mitsuba::GPUProgram::m_source[3]
protected
Class* mitsuba::GPUProgram::m_theClass
static

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