Table of Contents

Class WebGPUSurfaceSession

Namespace
SixLabors.ImageSharp.Drawing.Processing.Backends
Assembly
SixLabors.ImageSharp.Drawing.WebGPU.dll

Provides shared WebGPU resources for a group of external presentation surfaces.

public sealed class WebGPUSurfaceSession : IDisposable
Inheritance
WebGPUSurfaceSession
Implements
Inherited Members

Remarks

Create one session for related windows and popups so they use the same GPU device and drawing context. Dispose every surface and render target created by the session before disposing the session.

Constructors

WebGPUSurfaceSession()

Initializes a new instance of the WebGPUSurfaceSession class.

public WebGPUSurfaceSession()

WebGPUSurfaceSession(Configuration)

Initializes a new instance of the WebGPUSurfaceSession class.

public WebGPUSurfaceSession(Configuration configuration)

Parameters

configuration Configuration

The configuration used by surfaces and render targets created by this session.

Properties

DeviceContext

Gets the device context shared by every surface and render target in this session.

public WebGPUDeviceContext DeviceContext { get; }

Property Value

WebGPUDeviceContext

Remarks

The session owns the returned context; callers must not dispose it separately.

Exceptions

InvalidOperationException

Thrown when no presentation surface has initialized the session.

IsLost

Gets a value indicating whether the shared WebGPU device has been lost.

public bool IsLost { get; }

Property Value

bool

Methods

CreateRenderTarget(WebGPUTextureFormat, PixelAlphaRepresentation, int, int)

Creates an offscreen render target on the shared WebGPU device.

public WebGPURenderTarget CreateRenderTarget(WebGPUTextureFormat format, PixelAlphaRepresentation alphaRepresentation, int width, int height)

Parameters

format WebGPUTextureFormat

The texture format.

alphaRepresentation PixelAlphaRepresentation

The alpha representation stored by the target.

width int

The target width in pixels.

height int

The target height in pixels.

Returns

WebGPURenderTarget

The created render target.

Exceptions

InvalidOperationException

Thrown when no presentation surface has initialized the session.

CreateSurface(WebGPUSurfaceHost, Size)

Creates a presentation surface attached to an externally owned native host.

public WebGPUExternalSurface CreateSurface(WebGPUSurfaceHost host, Size framebufferSize)

Parameters

host WebGPUSurfaceHost

The native surface host.

framebufferSize Size

The initial framebuffer size in pixels.

Returns

WebGPUExternalSurface

The created presentation surface.

CreateSurface(WebGPUSurfaceHost, Size, WebGPUExternalSurfaceOptions)

Creates a presentation surface attached to an externally owned native host.

public WebGPUExternalSurface CreateSurface(WebGPUSurfaceHost host, Size framebufferSize, WebGPUExternalSurfaceOptions options)

Parameters

host WebGPUSurfaceHost

The native surface host.

framebufferSize Size

The initial framebuffer size in pixels.

options WebGPUExternalSurfaceOptions

The presentation options.

Returns

WebGPUExternalSurface

The created presentation surface.

Dispose()

Releases the shared WebGPU resources.

public void Dispose()