Class ImageReadback<T>
Allow readback a Texture from GPU to CPU with a frame delay count to avoid blocking read.
public class ImageReadback<T> : ImageEffect, IComponent, IReferencable, ICollectorHolder, IImageEffect, IGraphicsRenderer, IGraphicsRendererBase, IGraphicsRendererCore, IDisposable where T : unmanaged
Type Parameters
T
Pixel struct that should match the input texture format
- Inheritance
-
ImageReadback<T>
- Implements
- Inherited Members
- Extension Methods
Remarks
The input texture should be small enough to avoid CPU/GPU readback stalling
Constructors
ImageReadback()
Initializes a new instance of the ImageReadback<T> class.
public ImageReadback()
Properties
ElapsedTime
Gets the elapsed time to query the result.
public TimeSpan ElapsedTime { get; }
Property Value
- TimeSpan
The elapsed time.
ForceGetLatestBlocking
Gets or sets a value indicating whether [force get latest blocking].
public bool ForceGetLatestBlocking { get; set; }
Property Value
- bool
true
if [force get latest blocking]; otherwise,false
.
FrameDelayCount
Gets or sets the number of frame to store before reading back. Default is 16
.
public int FrameDelayCount { get; set; }
Property Value
- int
The frame delay count.
IsResultAvailable
Gets a boolean indicating whether a result is available from Result.
public bool IsResultAvailable { get; }
Property Value
- bool
A result available.
IsSlow
Gets a boolean indicating whether the readback is slow and may be stalling, indicating a FrameDelayCount to low or an input texture too large for an efficient non-blocking readback.
public bool IsSlow { get; }
Property Value
- bool
The readback is slow and stalling.
Result
Gets the result pixels, only valid if IsResultAvailable
public T[] Result { get; }
Property Value
- T[]
The result.
Methods
Destroy()
Disposes of object resources.
protected override void Destroy()
DrawCore(RenderDrawContext)
Main drawing method for this renderer that must be implemented.
protected override void DrawCore(RenderDrawContext context)
Parameters
context
RenderDrawContextThe context.
Reset()
Resets the state of this effect.
public override void Reset()