Skip to content

IRenderDevice interface

A backend device that creates offscreen surfaces, draws into them, and exposes them as images.

public interface IRenderDevice
name description
Effects { get; } Gets the shader effect device, or null when the backend runs no custom shaders.
RenderIdentity { get; } Gets the identity that partitions cached resources by device and device generation; the default is empty.
ResourceCache { get; } Gets the cache that holds this device’s resident resources and scratch surfaces, or null when the device has none.
CreateContext(…) Creates a context that draws into surface; throws NotSupportedException when the surface is not Renderable.
CreateImageView(…) Creates an image that aliases the pixels of surface; the surface is released only after its last view has been disposed. (3 methods)
CreateSurface(…) Creates a surface described by descriptor; the caller owns and disposes it.
FlushAsyncWork() Returns an operation that completes once the backend’s queued asynchronous work has finished.
RequestReadback(…) Starts the readback that makes the pixels of a DeferredReadback surface CPU-readable; the returned operation is already completed for other surfaces.
TryReadPixels(…) Copies the pixels of source as BGRA32 rows spaced destinationStrideBytes apart into destination; returns false when the surface is not CPU-readable or the destination is too small.

Surfaces and images belong to the device that created them. Backends with thread-affine state require AcquireBackgroundRenderScope around calls made off the UI thread.