Class TCustomLockableTexture
Unit
PXL.Textures
Declaration
type TCustomLockableTexture = class abstract(TCustomBaseTexture)
Description
Base definition of "lockable" texture; that is, a texture that can have regions "locked" so they become accessible to CPU. These textures are typical to most GPUs and also provide efficient means of storing dynamically changing data that is provided by CPU.
Hierarchy
Overview
Fields
Methods
Properties
Description
Fields
 |
FBytesPerPixel: Integer; |
|
Current number of bytes each pixel occupies.
|
 |
FDynamicTexture: Boolean; |
|
Determines whether the current texture is dynamic (that is, can have content changed intensively) or not.
|
Methods
 |
function Clear: Boolean; override; |
|
Clears the texture and fills its pixels with zeros.
|
 |
function CopyFromSurface(const Source: TPixelSurface): Boolean; |
|
Copies an entire source surface to this texture. This method does clipping when applicable and calls Lock / Unlock method pair appropriately during the process.
|
 |
function CopyFromSurfaceRect(DestPos: TPoint2i; const Source: TPixelSurface; SourceRect: TIntRect): Boolean; |
|
Copies a portion from source surface to this texture. This method does clipping when applicable and calls Lock / Unlock method pair appropriately during the process.
|
 |
function CopyToSurface(const Dest: TPixelSurface): Boolean; |
|
Copies the entire contents of this texture to the specified destination surface. This method does clipping when applicable and calls Lock / Unlock method pair appropriately during the process.
|
 |
function CopyToSurfaceRect(DestPos: TPoint2i; const Dest: TPixelSurface; SourceRect: TIntRect): Boolean; |
|
Copies a region of this texture to the specified destination surface. This method does clipping when applicable and calls Lock / Unlock method pair appropriately during the process.
|
 |
function Lock(const Rect: TIntRect; out Surface: TPixelSurface): Boolean; overload; |
|
Locks a portion of texture so that it can be accessed by CPU and provides TPixelSurface wrapper around this area for easy access. The texture can be unlocked either by calling Unlock or by freeing the surface returned by this function. Calling Unlock also releases the surface returned by this call.
|
 |
function Lock(out Surface: TPixelSurface): Boolean; overload; inline; |
|
Locks the entire texture so that it can be accessed by CPU and provides TPixelSurface wrapper around this area for easy access. The texture can be unlocked either by calling Unlock or by freeing the surface returned by this function. Calling Unlock also releases the surface returned by this call.
|
 |
function Lock(const Rect: TIntRect; out LockedPixels: TLockedPixels): Boolean; overload; |
|
Locks a portion of texture so that it can be accessed by CPU and provides information in TLockedPixels structure regarding this area.
|
 |
function Lock(out LockedPixels: TLockedPixels): Boolean; overload; inline; |
|
Locks the entire texture so that it can be accessed by CPU and provides information in TLockedPixels structure regarding this area.
|
 |
function Unlock: Boolean; |
|
Unlocks the texture and updates its contents.
|
 |
function DoCopyRect(const Source: TCustomBaseTexture; const SourceRect: TIntRect; const DestPos: TPoint2i): Boolean; override; |
|
This class implements internally limited functionality of "DoCopyRect" by locking both textures and copying data on CPU. For typical applications this could be okay, but it is generally inefficient and should be re-implemented by derived classes to provide copy mechanism directly on the GPU.
|
 |
function DoLock(const Rect: TIntRect; out LockedPixels: TLockedPixels): Boolean; virtual; abstract; |
|
Locks the specified rectangle and provides access information regarding this region. This should be implemented by derived classes. Returns True when the operation is successful and False otherwise.
|
 |
function DoUnlock: Boolean; virtual; abstract; |
|
Unlocks the specified rectangle and makes sure the texture remains updated after these changes. This should be implemented by derived classes. Returns True when the operation is successful and False otherwise.
|
 |
function IsLockRectFull(const Rect: TIntRect): Boolean; |
|
Returns True when the specified rectangle covers the entire texture and False otherwise. On some occasions, this can be useful to determine whether to pass rectangle pointer to locking mechanism or just pass Nil to cover the entire area.
|
 |
function LockSurface(const Surface: TPixelSurface; const Rect: TIntRect; out LockedPixels: TLockedPixels): Boolean; |
|
Helper function that provides locking mechanism to a simple TPixelSurface. That is, a quick shortcut to "lock" non-GPU surface. Returns True when the operation is successful and False otherwise.
|
Properties
 |
property BytesPerPixel: Integer read FBytesPerPixel; |
|
Number of bytes each pixel in the texture occupies.
|
 |
property DynamicTexture: Boolean read FDynamicTexture write SetDynamicTexture; |
|
Determines whether the texture is "dynamic"; that is, can have content changing continuously without major impact on rendering performance. This can provide significant performance benefit but may or may not be supported on specific provider and platform.
|
Copyright © 2000 - 2017 Yuriy Kotsarenko. Help files generated by PasDoc.
|