Gorilla.Context.Shader
Unit Gorilla.Context.Shader.pasClasses
- TShaderProgram = class ( TObject )
Records
- record TUniformBufferStruct
Enumerations
- enum TContextShaderVariableKindEx = ( Float, Float2, Float3, Vector, Matrix, Texture, Int4Byte, Int4ByteArr, StructArr ) ;
Constants
Mics. types
- type PUniformBufferStruct = pointer to TUniformBufferStruct;
Functions / Procedures
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
- private FContextClass :
TClass
- private FVS :
NativeUInt
- private FPS :
NativeUInt
- private FProg :
NativeUInt
- private FVariables :
TContextShaderVariables
- private FUniformBuffers :
TList<Gorilla.Context.Shader.TUniformBufferStruct>
- private FUniformBuffersModified :
Boolean
Methods
- public constructor Create ( const AContextClass : TClass; const VS : TContextShader; const PS : TContextShader ) ;
- public destructor Destroy ( ) ;
- private procedure DoInitialize
(
const
VS :
TContextShader; const
PS :
TContextShader
)
;
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.
- public function Available
(
)
: Boolean
;
Checks if all handles are available and shader code got compiled
- public procedure Use
(
)
;
virtual;
Activates a shader program for usage.
- public procedure ActivateDefault ( ) ; class virtual;
- public function RegisterUniformBuffer
(
AName :
string; AData :
Pointer; ASize :
Int64
)
: PUniformBufferStruct
;
Registers an individual "packed record" structure as uniform block in the shader program.
- public procedure UnregisterUniformBufferByName ( AName : string ) ;
- public procedure UnregisterUniformBufferByIdx
(
AIdx :
Integer
)
;
Unregisters an individually registered "packed record" structure by its name from the shader program.
- public procedure ClearUniformBuffers
(
)
;
Clears all registered invidual structures from the shader program.
- public function IndexOfUniformBuffer
(
AName :
string
)
: Integer
;
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
;
Searches for a specific uniform buffer by its name and returns a pointer to the registered structure.
- public procedure PushUniformBuffers
(
)
;
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.