Table of Contents

Class WebGPUEnvironment

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

Provides explicit support probes for the library-managed WebGPU environment. Use this type when you want to check availability or compute pipeline support before constructing WebGPU objects.

public static class WebGPUEnvironment
Inheritance
WebGPUEnvironment
Inherited Members

Properties

Options

Gets or sets the options used when the library-managed WebGPU environment is initialized.

public static WebGPUEnvironmentOptions Options { get; set; }

Property Value

WebGPUEnvironmentOptions

Remarks

Assign this before constructing WebGPU objects or calling support probes. The shared WebGPU runtime reads the current options during first initialization; changing them later does not reconfigure an existing device.

UncapturedError

Gets or sets the callback invoked when the native WebGPU runtime reports an uncaptured device error.

public static Action<WebGPUErrorType, string>? UncapturedError { get; set; }

Property Value

Action<WebGPUErrorType, string>

Remarks

The callback can be raised from a native WebGPU callback thread. Keep handlers short and non-blocking. Exceptions thrown by the handler are not propagated back through the native callback.

Methods

EnableNativeLogging(Action<string>?)

Routes the native wgpu-native log stream (including the validation errors that precede a lost device) to a managed sink. Unlike UncapturedError, this surfaces errors that abort the process through the binding's submit panic before the uncaptured callback runs.

public static void EnableNativeLogging(Action<string>? sink)

Parameters

sink Action<string>

The managed sink invoked for each native log line, or null to disable.

Remarks

The sink can be invoked from native wgpu threads; keep it short and non-blocking. Passing null only mutes the managed sink; a previously registered native callback stays installed and simply drops its messages. The first call that installs a sink also fixes the native log level at the warning level; that level is not lowered again by later calls.

ProbeAvailability()

Probes whether the required wgpu-native entry points and the library-managed WebGPU device and queue are available.

public static WebGPUEnvironmentError ProbeAvailability()

Returns

WebGPUEnvironmentError

Success when the required wgpu-native entry points and the library-managed WebGPU device and queue are available; otherwise, the stable failure code describing why the probe failed.

Remarks

Returns DxcUnavailable on Windows when the packaged DirectX Shader Compiler runtime is unavailable. Returns WgpuExtensionUnavailable when the core WebGPU API loads but a wgpu-native extension entry point required by the backend is unavailable.

ProbeComputePipelineSupport()

Probes whether the library-managed WebGPU device can create a trivial compute pipeline.

public static WebGPUEnvironmentError ProbeComputePipelineSupport()

Returns

WebGPUEnvironmentError

Success when compute pipeline creation succeeds; otherwise, the stable failure code describing why the probe failed.