Class TGPUProgrammingServices

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TGPUProgrammingServices = class(TWrapper)

Description

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

Hierarchy

Overview

Methods

Public function AddHighLevelShaderMaterial(const VertexShaderProgram: AnsiString; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; const PixelShaderProgram: AnsiString = ''; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; const GeometryShaderProgram: AnsiString = ''; const GeometryShaderEntryPoint: AnsiString = 'main'; GeometryShaderVersion: TGeometryShaderVersion = gsVersion40; InType: TPrimitiveType = ptTriangles; OutType: TPrimitiveType = ptTriangleStrip; VerticesOut: LongWord = 0; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;
Public function AddHighLevelShaderMaterial(const VertexShaderProgram: AnsiString; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; const PixelShaderProgram: AnsiString = ''; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;
Public function AddHighLevelShaderMaterialFromFiles(const VertexShaderFile: StringType; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; const PixelShaderFile: StringType = ''; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;
Public function AddHighLevelShaderMaterialFromFiles(const VertexShaderFile: StringType; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; const PixelShaderFile: StringType = ''; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; const GeometryShaderFile: StringType = ''; const GeometryShaderEntryPoint: AnsiString = 'main'; GeometryShaderVersion: TGeometryShaderVersion = gsVersion40; InType: TPrimitiveType = ptTriangles; OutType: TPrimitiveType = ptTriangleStrip; VerticesOut: LongWord = 0; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;
Public function AddHighLevelShaderMaterialFromFiles(VertexShaderProgram: TReadFile; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; PixelShaderProgram: TReadFile = nil; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;
Public function AddHighLevelShaderMaterialFromFiles(VertexShaderProgram: TReadFile; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; PixelShaderProgram: TReadFile = nil; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; GeometryShaderProgram: TReadFile = nil; const GeometryShaderEntryPoint: AnsiString = 'main'; GeometryShaderVersion: TGeometryShaderVersion = gsVersion40; InType: TPrimitiveType = ptTriangles; OutType: TPrimitiveType = ptTriangleStrip; VerticesOut: LongWord = 0; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;
Public function AddLowLevelShaderMaterial(const VertexShaderProgram: AnsiString = ''; const PixelShaderProgram: AnsiString = ''; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; inline;
Public function AddLowLevelShaderMaterialFromFiles(const VertexShaderFile: StringType = ''; const PixelShaderFile: StringType = ''; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;
Public function AddLowLevelShaderMaterialFromFiles(VertexShaderProgram: TReadFile = nil; PixelShaderProgram: TReadFile = nil; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;

Properties

Public property VideoDriver: TReferenceCounted read FDriver;

Description

Methods

Public function AddHighLevelShaderMaterial(const VertexShaderProgram: AnsiString; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; const PixelShaderProgram: AnsiString = ''; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; const GeometryShaderProgram: AnsiString = ''; const GeometryShaderEntryPoint: AnsiString = 'main'; GeometryShaderVersion: TGeometryShaderVersion = gsVersion40; InType: TPrimitiveType = ptTriangles; OutType: TPrimitiveType = ptTriangleStrip; VerticesOut: LongWord = 0; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;

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.
VertexShaderEntryPoint
Name of vertex shader program's main function
VertexShaderVersion
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.
PixelShaderEntryPoint
Name of pixel shader program's main function
PixelShaderVersion
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.
GeometryShaderEntryPoint
Name of geometry shader program's main function.
GeometryShaderVersion
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 TShaderConstantSetCallBack 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.

Public function AddHighLevelShaderMaterial(const VertexShaderProgram: AnsiString; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; const PixelShaderProgram: AnsiString = ''; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;

Convenience function for use without geometry shaders.

Public function AddHighLevelShaderMaterialFromFiles(const VertexShaderFile: StringType; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; const PixelShaderFile: StringType = ''; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;

Convenience function for use without geometry shaders.

Public function AddHighLevelShaderMaterialFromFiles(const VertexShaderFile: StringType; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; const PixelShaderFile: StringType = ''; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; const GeometryShaderFile: StringType = ''; const GeometryShaderEntryPoint: AnsiString = 'main'; GeometryShaderVersion: TGeometryShaderVersion = gsVersion40; InType: TPrimitiveType = ptTriangles; OutType: TPrimitiveType = ptTriangleStrip; VerticesOut: LongWord = 0; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;

Like AddHighLevelShaderMaterial, but loads sources from files by path.
Currently only HLSL/D3D9 and GLSL/OpenGL are supported.

Parameters
VertexShaderProgram
Source file path of the vertex shader program. This can be 0 if no vertex program shall be used.
VertexShaderEntryPoint
Name of vertex shader program's main function
VertexShaderVersion
Vertex shader version the high level shader shall be compiled to.
PixelShaderProgram
Source file path of the pixel shader program. This can be 0 if no pixel shader shall be used.
PixelShaderEntryPoint
Name of pixel shader program's main function
PixelShaderVersion
Pixel shader version the high level shader shall be compiled to.
GeometryShaderProgram
Source file path of the geometry shader program. This can be nil if no geometry shader shall be used.
GeometryShaderEntryPoint
Name of geometry shader program's main function.
GeometryShaderVersion
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 TShaderConstantSetCallBack 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.

Public function AddHighLevelShaderMaterialFromFiles(VertexShaderProgram: TReadFile; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; PixelShaderProgram: TReadFile = nil; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;

Convenience function for use without geometry shaders.

Public function AddHighLevelShaderMaterialFromFiles(VertexShaderProgram: TReadFile; const VertexShaderEntryPoint: AnsiString = 'main'; VertexShaderVersion: TVertexShaderVersion = vsVersion11; PixelShaderProgram: TReadFile = nil; const PixelShaderEntryPoint: AnsiString = 'main'; PixelShaderVersion: TPixelShaderVersion = psVersion11; GeometryShaderProgram: TReadFile = nil; const GeometryShaderEntryPoint: AnsiString = 'main'; GeometryShaderVersion: TGeometryShaderVersion = gsVersion40; InType: TPrimitiveType = ptTriangles; OutType: TPrimitiveType = ptTriangleStrip; VerticesOut: LongWord = 0; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;

Like AddHighLevelShaderMaterial, but loads sources from TReadFile s.
Currently only HLSL/D3D9 and GLSL/OpenGL are supported.

Parameters
VertexShaderProgram
Source file of the vertex shader program. This can be 0 if no vertex program shall be used.
VertexShaderEntryPoint
Name of vertex shader program's main function
VertexShaderVersion
Vertex shader version the high level shader shall be compiled to.
PixelShaderProgram
Source file of the pixel shader program. This can be 0 if no pixel shader shall be used.
PixelShaderEntryPoint
Name of pixel shader program's main function
PixelShaderVersion
Pixel shader version the high level shader shall be compiled to.
GeometryShaderProgram
Source file of the geometry shader program. This can be 0 if no geometry shader shall be used.
GeometryShaderEntryPoint
Name of geometry shader program's main function.
GeometryShaderVersion
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 TShaderConstantSetCallBack 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.

Public function AddLowLevelShaderMaterial(const VertexShaderProgram: AnsiString = ''; const PixelShaderProgram: AnsiString = ''; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; inline;

Adds a new ASM shader material renderer to the VideoDriver.
Note that it is a good idea to call TVideoDriver.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 TVideoDriver.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 nil 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.
PixelShaderProgram
String containing the source of the pixel shader program. This can be nil if you don't want to use a pixel shader.
Callback
Pointer to an implementation of TShaderConstantSetCallback in which you can set the needed vertex and pixel shader program constants. Set this to nil if you don't need this.
BaseMaterial
Base material which renderstates will be used to shade the material.
UserData
A user data Integer. It can be set to any value and will be set as parameter in the callback method when calling HandleSetConstants(). In this way it is easily possible to use the same callback method for multiple materials and distinguish between them during the call.
Returns

The number of the material type which can be set in TMaterial.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.

Public function AddLowLevelShaderMaterialFromFiles(const VertexShaderFile: StringType = ''; const PixelShaderFile: StringType = ''; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;

Like AddLowLevelShaderMaterial, but loads from files by path.

Parameters
VertexShaderProgram
Source file path of the vertex shader program. This can be nil 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.
PixelShaderProgram
Source file path of the pixel shader program. This can be nil if you don't want to use a pixel shader.
Callback
Pointer to an implementation of TShaderConstantSetCallback in which you can set the needed vertex and pixel shader program constants. Set this to nil if you don't need this.
BaseMaterial
Base material which renderstates will be used to shade the material.
UserData
A user data Integer. It can be set to any value and will be set as parameter in the callback method when calling HandleSetConstants(). In this way it is easily possible to use the same callback method for multiple materials and distinguish between them during the call.
Returns

The number of the material type which can be set in TMaterial.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.

Public function AddLowLevelShaderMaterialFromFiles(VertexShaderProgram: TReadFile = nil; PixelShaderProgram: TReadFile = nil; Callback: TShaderConstantSetCallback = nil; BaseMaterial: TMaterialType = mtSolid; UserData: LongInt = 0): LongInt; overload; inline;

Like AddLowLevelShaderMaterial, but loads from TReadFile s.

Parameters
VertexShaderProgram
Source file of the vertex shader program. This can be nil 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.
PixelShaderProgram
Source file of the pixel shader program. This can be nil if you don't want to use a pixel shader.
Callback
Pointer to an implementation of TShaderConstantSetCallback in which you can set the needed vertex and pixel shader program constants. Set this to nil if you don't need this.
BaseMaterial
Base material which renderstates will be used to shade the material.
UserData
A user data Integer. It can be set to any value and will be set as parameter in the callback method when calling HandleSetConstants(). In this way it is easily possible to use the same callback method for multiple materials and distinguish between them during the call.
Returns

The number of the material type which can be set in TMaterial.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.

Properties

Public property VideoDriver: TReferenceCounted read FDriver;

The TVideoDriver this Services belong to.


Generated by PasDoc 0.12.1 on 2012-09-14 17:32:22