Gorilla.Context.Shader
Unit Gorilla.Context.Shader.pasClasses
- TShaderProgram = class ( TObject )
Records
- record TUniformBufferStruct
Enumerations
- enum TContextShaderKindEx = ( VertexShader, PixelShader, GeometryShader ) ;
- enum TContextShaderVariableKindEx = ( Float, Float2, Float3, Vector, Matrix, Texture, Int4Byte, Int4ByteArr, StructArr, ImageTexture ) ;
Constants
Mics. types
- type PUniformBufferStruct = pointer to TUniformBufferStruct;
- type TShaderProgramClass = class of TShaderProgram;
TContextShaderKindEx
TShaderProgram
Defines a shader program in the specific context.
Remarks
It needs a vertext shader (VS) and pixel shader (PS) to initialize.Ancestors
Members
Fields
- protected FContextClass :
TClass
- protected FVS :
NativeUInt
- protected FGS :
NativeUInt
- protected FPS :
NativeUInt
- protected FProg :
NativeUInt
- protected FVariables :
TContextShaderVariables
- protected FUniformBuffers :
TList<Gorilla.Context.Shader.TUniformBufferStruct>
- protected FUniformBuffersModified :
Boolean
- public ShaderProgramClass :
TShaderProgramClass
Methods
- public constructor Create ( const AContextClass : TClass; const VS : TContextShader; const PS : TContextShader ) ;
- public constructor Create ( const AContextClass : TClass; const VS : TContextShader; const GS : TContextShader; const PS : TContextShader ) ;
- public destructor Destroy ( ) ;
- protected procedure DoInitialize
(
const
VS :
TContextShader; const
PS :
TContextShader
)
;
overload virtual;
Initializes the shader program by creating a program in GPU and applying the vertex and pixel shader to it. It also registeres all shader variables in GPU shader program.
- protected procedure DoInitialize
(
const
VS :
TContextShader; const
GS :
TContextShader; const
PS :
TContextShader
)
;
abstract overload virtual;
Initializes the shader program by creating a program in GPU and applying the vertex, geometry and pixel shader to it. It also registeres all shader variables in GPU shader program.
- protected function NewUniformBufferStruct ( ) : TUniformBufferStruct ; abstract virtual;
- protected procedure FreeUniformBufferStruct ( AStruct : PUniformBufferStruct ) ; abstract virtual;
- public function Available
(
)
: Boolean
;
abstract virtual;
Checks if all handles are available and shader code got compiled
- public procedure Use
(
)
;
abstract virtual;
Activates a shader program for usage.
- public function BuildShader ( AType : Integer; const ACode : TContextShaderCode; AIsInDesignTime : Boolean = False ) : Integer ; class abstract virtual;
- public procedure ActivateDefault
(
)
;
class abstract virtual;
Resets the currently used shader program to the default program with id "0", f.e. in OpenGL glUseProgram(0);
- public function RegisterUniformBuffer
(
AName :
string; AData :
Pointer; ASize :
Int64
)
: PUniformBufferStruct
;
virtual;
Registers an individual "packed record" structure as uniform block in the shader program.
- public procedure UnregisterUniformBufferByName ( AName : string ) ; virtual;
- public procedure UnregisterUniformBufferByIdx
(
AIdx :
Integer
)
;
virtual;
Unregisters an individually registered "packed record" structure by its name from the shader program.
- public procedure ClearUniformBuffers
(
)
;
virtual;
Clears all registered invidual structures from the shader program.
- public function IndexOfUniformBuffer
(
AName :
string
)
: Integer
;
virtual;
Returns the index of a specific uniform buffer object. If the id can not be found, the routine returns -1.
- public function GetUniformBufferByName
(
AName :
string
)
: PUniformBufferStruct
;
virtual;
Searches for a specific uniform buffer by its name and returns a pointer to the registered structure.
- public procedure PushUniformBuffers
(
)
;
virtual;
Pushes all registered uniform buffers to the shader program. In case the buffer was not linked, it will link the buffer again to the shader program.