Skip to content

GpuBackend

1 min read

Import: import system.gpu;

This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation. Shader-only declarations can be used only inside @compute, @vertex, @fragment, inferred helpers and ray tracing shader functions; using them elsewhere is a compile error.

GpuBackend

The graphics API a GpuDevice runs on. Only backends whose shader code is in this build can be selected; GpuShaders.backends() lists them. Asking for any other backend returns GpuError.BackendNotCompiled and never falls back to a different one.

public enum GpuBackend

Auto

Lets the host choose: the platform's native API when this build has shader code for it, otherwise WebGPU.

Auto = 0

Dx12

Direct3D 12, on Windows.

Dx12 = 1

Dx11

Direct3D 11, on Windows.

Dx11 = 2

Vulkan

Vulkan, on Windows and Linux.

Vulkan = 3

Metal

Metal, on macOS.

Metal = 4

Cuda

CUDA, on NVIDIA GPUs under Windows and Linux. Runs compute shaders only.

Cuda = 5

WebGpu

WebGPU: the browser's GPU API, or Dawn in native programs.

WebGpu = 6