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
configurationConfigurationThe 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
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
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
formatWebGPUTextureFormatThe texture format.
alphaRepresentationPixelAlphaRepresentationThe alpha representation stored by the target.
widthintThe target width in pixels.
heightintThe 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
hostWebGPUSurfaceHostThe native surface host.
framebufferSizeSizeThe 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
hostWebGPUSurfaceHostThe native surface host.
framebufferSizeSizeThe initial framebuffer size in pixels.
optionsWebGPUExternalSurfaceOptionsThe presentation options.
Returns
- WebGPUExternalSurface
The created presentation surface.
Dispose()
Releases the shared WebGPU resources.
public void Dispose()