Irrlicht Engine: irr::video::IGPUProgrammingServices Class Reference

Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials

# irr::video::IGPUProgrammingServices Class Reference

Interface making it possible to create and use programs running on the GPU. More...

`#include <IGPUProgrammingServices.h>`

List of all members.

## Public Member Functions
s32 | addHighLevelShaderMaterial (const c8 *vertexShaderProgram, const c8 *vertexShaderEntryPointName="main", E_VERTEX_SHADER_TYPE vsCompileTarget=EVST_VS_1_1, const c8 *pixelShaderProgram=0, const c8 *pixelShaderEntryPointName="main", E_PIXEL_SHADER_TYPE psCompileTarget=EPST_PS_1_1, IShaderConstantSetCallBack *callback=0, E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID, s32 userData=0)
| convenience function for use without geometry shaders
virtual s32 | addHighLevelShaderMaterial (const c8 *vertexShaderProgram, const c8 *vertexShaderEntryPointName, E_VERTEX_SHADER_TYPE vsCompileTarget, const c8 *pixelShaderProgram, const c8 *pixelShaderEntryPointName, E_PIXEL_SHADER_TYPE psCompileTarget, const c8 *geometryShaderProgram, const c8 *geometryShaderEntryPointName="main", E_GEOMETRY_SHADER_TYPE gsCompileTarget=EGST_GS_4_0, scene::E_PRIMITIVE_TYPE inType=scene::EPT_TRIANGLES, scene::E_PRIMITIVE_TYPE outType=scene::EPT_TRIANGLE_STRIP, u32 verticesOut=0, IShaderConstantSetCallBack *callback=0, E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID, s32 userData=0)=0
| Adds a new high-level shading material renderer to the VideoDriver.
s32 | addHighLevelShaderMaterialFromFiles (io::IReadFile *vertexShaderProgram, const c8 *vertexShaderEntryPointName="main", E_VERTEX_SHADER_TYPE vsCompileTarget=EVST_VS_1_1, io::IReadFile *pixelShaderProgram=0, const c8 *pixelShaderEntryPointName="main", E_PIXEL_SHADER_TYPE psCompileTarget=EPST_PS_1_1, IShaderConstantSetCallBack *callback=0, E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID, s32 userData=0)
| convenience function for use without geometry shaders
virtual s32 | addHighLevelShaderMaterialFromFiles (io::IReadFile *vertexShaderProgram, const c8 *vertexShaderEntryPointName, E_VERTEX_SHADER_TYPE vsCompileTarget, io::IReadFile *pixelShaderProgram, const c8 *pixelShaderEntryPointName, E_PIXEL_SHADER_TYPE psCompileTarget, io::IReadFile *geometryShaderProgram, const c8 *geometryShaderEntryPointName="main", E_GEOMETRY_SHADER_TYPE gsCompileTarget=EGST_GS_4_0, scene::E_PRIMITIVE_TYPE inType=scene::EPT_TRIANGLES, scene::E_PRIMITIVE_TYPE outType=scene::EPT_TRIANGLE_STRIP, u32 verticesOut=0, IShaderConstantSetCallBack *callback=0, E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID, s32 userData=0)=0
| Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
s32 | addHighLevelShaderMaterialFromFiles (const io::path &vertexShaderProgramFileName, const c8 *vertexShaderEntryPointName="main", E_VERTEX_SHADER_TYPE vsCompileTarget=EVST_VS_1_1, const io::path &pixelShaderProgramFileName="", const c8 *pixelShaderEntryPointName="main", E_PIXEL_SHADER_TYPE psCompileTarget=EPST_PS_1_1, IShaderConstantSetCallBack *callback=0, E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID, s32 userData=0)
| convenience function for use without geometry shaders
virtual s32 | addHighLevelShaderMaterialFromFiles (const io::path &vertexShaderProgramFileName, const c8 *vertexShaderEntryPointName, E_VERTEX_SHADER_TYPE vsCompileTarget, const io::path &pixelShaderProgramFileName, const c8 *pixelShaderEntryPointName, E_PIXEL_SHADER_TYPE psCompileTarget, const io::path &geometryShaderProgramFileName, const c8 *geometryShaderEntryPointName="main", E_GEOMETRY_SHADER_TYPE gsCompileTarget=EGST_GS_4_0, scene::E_PRIMITIVE_TYPE inType=scene::EPT_TRIANGLES, scene::E_PRIMITIVE_TYPE outType=scene::EPT_TRIANGLE_STRIP, u32 verticesOut=0, IShaderConstantSetCallBack *callback=0, E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID, s32 userData=0)=0
| Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
virtual s32 | addShaderMaterial (const c8 *vertexShaderProgram=0, const c8 *pixelShaderProgram=0, IShaderConstantSetCallBack *callback=0, E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID, s32 userData=0)=0
| Adds a new ASM shader material renderer to the VideoDriver.
virtual s32 | addShaderMaterialFromFiles (const io::path &vertexShaderProgramFileName, const io::path &pixelShaderProgramFileName, IShaderConstantSetCallBack *callback=0, E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID, s32 userData=0)=0
| Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
virtual s32 | addShaderMaterialFromFiles (io::IReadFile *vertexShaderProgram, io::IReadFile *pixelShaderProgram, IShaderConstantSetCallBack *callback=0, E_MATERIAL_TYPE baseMaterial=video::EMT_SOLID, s32 userData=0)=0
| Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.
virtual | ~IGPUProgrammingServices ()
| Destructor.

## Detailed Description

Interface making it possible to create and use programs running on the GPU.

Definition at line 23 of file IGPUProgrammingServices.h.

## Constructor & Destructor Documentation

virtual irr::video::IGPUProgrammingServices::~IGPUProgrammingServices | ( |  | ) | `[inline, virtual]`

Destructor.

Definition at line 28 of file IGPUProgrammingServices.h.

References addHighLevelShaderMaterial(), irr::video::EGST_GS_4_0, irr::scene::EPT_TRIANGLE_STRIP, and irr::scene::EPT_TRIANGLES.

## Member Function Documentation

s32 irr::video::IGPUProgrammingServices::addHighLevelShaderMaterial | ( | const c8 * | vertexShaderProgram,
|  | const c8 * | vertexShaderEntryPointName = `"main"`,
|  | E_VERTEX_SHADER_TYPE | vsCompileTarget = `EVST_VS_1_1`,
|  | const c8 * | pixelShaderProgram = `0`,
|  | const c8 * | pixelShaderEntryPointName = `"main"`,
|  | E_PIXEL_SHADER_TYPE | psCompileTarget = `EPST_PS_1_1`,
|  | IShaderConstantSetCallBack * | callback = `0`,
|  | E_MATERIAL_TYPE | baseMaterial = `video::EMT_SOLID`,
|  | s32 | userData = `0` |
| ) |  |  | `[inline]`

convenience function for use without geometry shaders

Definition at line 89 of file IGPUProgrammingServices.h.

References addHighLevelShaderMaterial(), irr::video::EGST_GS_4_0, irr::scene::EPT_TRIANGLE_STRIP, and irr::scene::EPT_TRIANGLES.

virtual s32 irr::video::IGPUProgrammingServices::addHighLevelShaderMaterial | ( | const c8 * | vertexShaderProgram,
|  | const c8 * | vertexShaderEntryPointName,
|  | E_VERTEX_SHADER_TYPE | vsCompileTarget,
|  | const c8 * | pixelShaderProgram,
|  | const c8 * | pixelShaderEntryPointName,
|  | E_PIXEL_SHADER_TYPE | psCompileTarget,
|  | const c8 * | geometryShaderProgram,
|  | const c8 * | geometryShaderEntryPointName = `"main"`,
|  | E_GEOMETRY_SHADER_TYPE | gsCompileTarget = `EGST_GS_4_0`,
|  | scene::E_PRIMITIVE_TYPE | inType = `scene::EPT_TRIANGLES`,
|  | scene::E_PRIMITIVE_TYPE | outType = `scene::EPT_TRIANGLE_STRIP`,
|  | u32 | verticesOut = `0`,
|  | IShaderConstantSetCallBack * | callback = `0`,
|  | E_MATERIAL_TYPE | baseMaterial = `video::EMT_SOLID`,
|  | s32 | userData = `0` |
| ) |  |  | `[pure virtual]`

Adds a new high-level shading material renderer to the VideoDriver.

Currently only HLSL/D3D9 and GLSL/OpenGL are supported.

Parameters:

  | vertexShaderProgram,: | String containing the source of the vertex shader program. This can be 0 if no vertex program shall be used.
  | vertexShaderEntryPointName,: | Name of the entry function of the vertexShaderProgram (p.e. "main")
  | vsCompileTarget,: | Vertex shader version the high level shader shall be compiled to.
  | pixelShaderProgram,: | String containing the source of the pixel shader program. This can be 0 if no pixel shader shall be used.
  | pixelShaderEntryPointName,: | Entry name of the function of the pixelShaderProgram (p.e. "main")
  | psCompileTarget,: | Pixel shader version the high level shader shall be compiled to.
  | geometryShaderProgram,: | String containing the source of the geometry shader program. This can be 0 if no geometry shader shall be used.
  | geometryShaderEntryPointName,: | Entry name of the function of the geometryShaderProgram (p.e. "main")
  | gsCompileTarget,: | Geometry shader version the high level shader shall be compiled to.
  | inType | Type of vertices passed to geometry shader
  | outType | Type of vertices created by geometry shader
  | verticesOut | Maximal number of vertices created by geometry shader. If 0, maximal number supported is assumed.
  | callback,: | Pointer to an implementation of IShaderConstantSetCallBack in which you can set the needed vertex, pixel, and geometry shader program constants. Set this to 0 if you don't need this.
  | baseMaterial,: | Base material which renderstates will be used to shade the material.
  | userData,: | a user data int. This int can be set to any value and will be set as parameter in the callback method when calling OnSetConstants(). In this way it is easily possible to use the same callback method for multiple materials and distinguish between them during the call.

Returns:
  Number of the material type which can be set in SMaterial::MaterialType to use the renderer. -1 is returned if an error occured, e.g. if a shader program could not be compiled or a compile target is not reachable. The error strings are then printed to the error log and can be catched with a custom event receiver.

Referenced by addHighLevelShaderMaterial(), and ~IGPUProgrammingServices().

s32 irr::video::IGPUProgrammingServices::addHighLevelShaderMaterialFromFiles | ( | io::IReadFile * | vertexShaderProgram,
|  | const c8 * | vertexShaderEntryPointName = `"main"`,
|  | E_VERTEX_SHADER_TYPE | vsCompileTarget = `EVST_VS_1_1`,
|  | io::IReadFile * | pixelShaderProgram = `0`,
|  | const c8 * | pixelShaderEntryPointName = `"main"`,
|  | E_PIXEL_SHADER_TYPE | psCompileTarget = `EPST_PS_1_1`,
|  | IShaderConstantSetCallBack * | callback = `0`,
|  | E_MATERIAL_TYPE | baseMaterial = `video::EMT_SOLID`,
|  | s32 | userData = `0` |
| ) |  |  | `[inline]`

convenience function for use without geometry shaders

Definition at line 247 of file IGPUProgrammingServices.h.

References addHighLevelShaderMaterialFromFiles(), irr::video::EGST_GS_4_0, irr::scene::EPT_TRIANGLE_STRIP, and irr::scene::EPT_TRIANGLES.

virtual s32 irr::video::IGPUProgrammingServices::addHighLevelShaderMaterialFromFiles | ( | io::IReadFile * | vertexShaderProgram,
|  | const c8 * | vertexShaderEntryPointName,
|  | E_VERTEX_SHADER_TYPE | vsCompileTarget,
|  | io::IReadFile * | pixelShaderProgram,
|  | const c8 * | pixelShaderEntryPointName,
|  | E_PIXEL_SHADER_TYPE | psCompileTarget,
|  | io::IReadFile * | geometryShaderProgram,
|  | const c8 * | geometryShaderEntryPointName = `"main"`,
|  | E_GEOMETRY_SHADER_TYPE | gsCompileTarget = `EGST_GS_4_0`,
|  | scene::E_PRIMITIVE_TYPE | inType = `scene::EPT_TRIANGLES`,
|  | scene::E_PRIMITIVE_TYPE | outType = `scene::EPT_TRIANGLE_STRIP`,
|  | u32 | verticesOut = `0`,
|  | IShaderConstantSetCallBack * | callback = `0`,
|  | E_MATERIAL_TYPE | baseMaterial = `video::EMT_SOLID`,
|  | s32 | userData = `0` |
| ) |  |  | `[pure virtual]`

Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.

Parameters:

  | vertexShaderProgram,: | Text file handle containing the source of the vertex shader program. Set to 0 if no vertex shader shall be created.
  | vertexShaderEntryPointName,: | Name of the entry function of the vertexShaderProgram
  | vsCompileTarget,: | Vertex shader version the high level shader shall be compiled to.
  | pixelShaderProgram,: | Text file handle containing the source of the pixel shader program. Set to 0 if no pixel shader shall be created.
  | pixelShaderEntryPointName,: | Entry name of the function of the pixelShaderProgram (p.e. "main")
  | psCompileTarget,: | Pixel shader version the high level shader shall be compiled to.
  | geometryShaderProgram,: | Text file handle containing the source of the geometry shader program. Set to 0 if no geometry shader shall be created.
  | geometryShaderEntryPointName,: | Entry name of the function of the geometryShaderProgram (p.e. "main")
  | gsCompileTarget,: | Geometry shader version the high level shader shall be compiled to.
  | inType | Type of vertices passed to geometry shader
  | outType | Type of vertices created by geometry shader
  | verticesOut | Maximal number of vertices created by geometry shader. If 0, maximal number supported is assumed.
  | callback,: | Pointer to an implementation of IShaderConstantSetCallBack in which you can set the needed vertex and pixel shader program constants. Set this to 0 if you don't need this.
  | baseMaterial,: | Base material which renderstates will be used to shade the material.
  | userData,: | a user data int. This int can be set to any value and will be set as parameter in the callback method when calling OnSetConstants(). In this way it is easily possible to use the same callback method for multiple materials and distinguish between them during the call.

Returns:
  Number of the material type which can be set in SMaterial::MaterialType to use the renderer. -1 is returned if an error occured, e.g. if a shader program could not be compiled or a compile target is not reachable. The error strings are then printed to the error log and can be catched with a custom event receiver.

s32 irr::video::IGPUProgrammingServices::addHighLevelShaderMaterialFromFiles | ( | const io::path & | vertexShaderProgramFileName,
|  | const c8 * | vertexShaderEntryPointName = `"main"`,
|  | E_VERTEX_SHADER_TYPE | vsCompileTarget = `EVST_VS_1_1`,
|  | const io::path & | pixelShaderProgramFileName = `""`,
|  | const c8 * | pixelShaderEntryPointName = `"main"`,
|  | E_PIXEL_SHADER_TYPE | psCompileTarget = `EPST_PS_1_1`,
|  | IShaderConstantSetCallBack * | callback = `0`,
|  | E_MATERIAL_TYPE | baseMaterial = `video::EMT_SOLID`,
|  | s32 | userData = `0` |
| ) |  |  | `[inline]`

convenience function for use without geometry shaders

Definition at line 169 of file IGPUProgrammingServices.h.

References addHighLevelShaderMaterialFromFiles(), irr::video::EGST_GS_4_0, irr::scene::EPT_TRIANGLE_STRIP, and irr::scene::EPT_TRIANGLES.

virtual s32 irr::video::IGPUProgrammingServices::addHighLevelShaderMaterialFromFiles | ( | const io::path & | vertexShaderProgramFileName,
|  | const c8 * | vertexShaderEntryPointName,
|  | E_VERTEX_SHADER_TYPE | vsCompileTarget,
|  | const io::path & | pixelShaderProgramFileName,
|  | const c8 * | pixelShaderEntryPointName,
|  | E_PIXEL_SHADER_TYPE | psCompileTarget,
|  | const io::path & | geometryShaderProgramFileName,
|  | const c8 * | geometryShaderEntryPointName = `"main"`,
|  | E_GEOMETRY_SHADER_TYPE | gsCompileTarget = `EGST_GS_4_0`,
|  | scene::E_PRIMITIVE_TYPE | inType = `scene::EPT_TRIANGLES`,
|  | scene::E_PRIMITIVE_TYPE | outType = `scene::EPT_TRIANGLE_STRIP`,
|  | u32 | verticesOut = `0`,
|  | IShaderConstantSetCallBack * | callback = `0`,
|  | E_MATERIAL_TYPE | baseMaterial = `video::EMT_SOLID`,
|  | s32 | userData = `0` |
| ) |  |  | `[pure virtual]`

Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.

Parameters:

  | vertexShaderProgramFileName,: | Text file containing the source of the vertex shader program. Set to empty string if no vertex shader shall be created.
  | vertexShaderEntryPointName,: | Name of the entry function of the vertexShaderProgram (p.e. "main")
  | vsCompileTarget,: | Vertex shader version the high level shader shall be compiled to.
  | pixelShaderProgramFileName,: | Text file containing the source of the pixel shader program. Set to empty string if no pixel shader shall be created.
  | pixelShaderEntryPointName,: | Entry name of the function of the pixelShaderProgram (p.e. "main")
  | psCompileTarget,: | Pixel shader version the high level shader shall be compiled to.
  | geometryShaderProgramFileName,: | Name of the source of the geometry shader program. Set to empty string if no geometry shader shall be created.
  | geometryShaderEntryPointName,: | Entry name of the function of the geometryShaderProgram (p.e. "main")
  | gsCompileTarget,: | Geometry shader version the high level shader shall be compiled to.
  | inType | Type of vertices passed to geometry shader
  | outType | Type of vertices created by geometry shader
  | verticesOut | Maximal number of vertices created by geometry shader. If 0, maximal number supported is assumed.
  | callback,: | Pointer to an implementation of IShaderConstantSetCallBack in which you can set the needed vertex, pixel, and geometry shader program constants. Set this to 0 if you don't need this.
  | baseMaterial,: | Base material which renderstates will be used to shade the material.
  | userData,: | a user data int. This int can be set to any value and will be set as parameter in the callback method when calling OnSetConstants(). In this way it is easily possible to use the same callback method for multiple materials and distinguish between them during the call.

Returns:
  Number of the material type which can be set in SMaterial::MaterialType to use the renderer. -1 is returned if an error occured, e.g. if a shader program could not be compiled or a compile target is not reachable. The error strings are then printed to the error log and can be catched with a custom event receiver.

Referenced by addHighLevelShaderMaterialFromFiles().

virtual s32 irr::video::IGPUProgrammingServices::addShaderMaterial | ( | const c8 * | vertexShaderProgram = `0`,
|  | const c8 * | pixelShaderProgram = `0`,
|  | IShaderConstantSetCallBack * | callback = `0`,
|  | E_MATERIAL_TYPE | baseMaterial = `video::EMT_SOLID`,
|  | s32 | userData = `0` |
| ) |  |  | `[pure virtual]`

Adds a new ASM shader material renderer to the VideoDriver.

Note that it is a good idea to call IVideoDriver::queryFeature() in advance to check if the IVideoDriver supports the vertex and/or pixel shader version your are using.

The material is added to the VideoDriver like with IVideoDriver::addMaterialRenderer() and can be used like it had been added with that method.

Parameters:

  | vertexShaderProgram,: | String containing the source of the vertex shader program. This can be 0 if no vertex program shall be used.

For DX8 programs, the will always input registers look like this: v0: position, v1: normal, v2: color, v3: texture cooridnates, v4: texture coordinates 2 if available.

For DX9 programs, you can manually set the registers using the dcl_ statements.

Parameters:

  | pixelShaderProgram,: | String containing the source of the pixel shader program. This can be 0 if you don't want to use a pixel shader.
  | callback,: | Pointer to an implementation of IShaderConstantSetCallBack in which you can set the needed vertex and pixel shader program constants. Set this to 0 if you don't need this.
  | baseMaterial,: | Base material which renderstates will be used to shade the material.
  | userData,: | a user data int. This int can be set to any value and will be set as parameter in the callback method when calling OnSetConstants(). In this way it is easily possible to use the same callback method for multiple materials and distinguish between them during the call.

Returns:
  Returns the number of the material type which can be set in SMaterial::MaterialType to use the renderer. -1 is returned if an error occured. -1 is returned for example if a vertex or pixel shader program could not be compiled, the error strings are then printed out into the error log, and can be catched with a custom event receiver.

virtual s32 irr::video::IGPUProgrammingServices::addShaderMaterialFromFiles | ( | const io::path & | vertexShaderProgramFileName,
|  | const io::path & | pixelShaderProgramFileName,
|  | IShaderConstantSetCallBack * | callback = `0`,
|  | E_MATERIAL_TYPE | baseMaterial = `video::EMT_SOLID`,
|  | s32 | userData = `0` |
| ) |  |  | `[pure virtual]`

Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.

Parameters:

  | vertexShaderProgramFileName,: | Text file name containing the source of the vertex shader program. Set to 0 if no shader shall be created.
  | pixelShaderProgramFileName,: | Text file name containing the source of the pixel shader program. Set to 0 if no shader shall be created.
  | callback,: | Pointer to an IShaderConstantSetCallback object on which the OnSetConstants function is called.
  | baseMaterial,: | baseMaterial
  | userData,: | a user data int. This int can be set to any value and will be set as parameter in the callback method when calling OnSetConstants(). In this way it is easily possible to use the same callback method for multiple materials and distinguish between them during the call.

Returns:
  Returns the number of the material type which can be set in SMaterial::MaterialType to use the renderer. -1 is returned if an error occured. -1 is returned for example if a vertex or pixel shader program could not be compiled, the error strings are then printed out into the error log, and can be catched with a custom event receiver.

virtual s32 irr::video::IGPUProgrammingServices::addShaderMaterialFromFiles | ( | io::IReadFile * | vertexShaderProgram,
|  | io::IReadFile * | pixelShaderProgram,
|  | IShaderConstantSetCallBack * | callback = `0`,
|  | E_MATERIAL_TYPE | baseMaterial = `video::EMT_SOLID`,
|  | s32 | userData = `0` |
| ) |  |  | `[pure virtual]`

Like IGPUProgrammingServices::addShaderMaterial(), but loads from files.

Parameters:

  | vertexShaderProgram,: | Text file containing the source of the vertex shader program. Set to 0 if no shader shall be created.
  | pixelShaderProgram,: | Text file containing the source of the pixel shader program. Set to 0 if no shader shall be created.
  | callback,: | Pointer to an IShaderConstantSetCallback object to which the OnSetConstants function is called.
  | baseMaterial,: | baseMaterial
  | userData,: | a user data int. This int can be set to any value and will be set as parameter in the callback method when calling OnSetConstants(). In this way it is easily possible to use the same callback method for multiple materials and distinguish between them during the call.

Returns:
  Returns the number of the material type which can be set in SMaterial::MaterialType to use the renderer. -1 is returned if an error occured. -1 is returned for example if a vertex or pixel shader program could not be compiled, the error strings are then printed out into the error log, and can be catched with a custom event receiver.

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

- IGPUProgrammingServices.h

| The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Sun Oct 24 12:42:09 2010 by Doxygen (1.6.2)