wgpu.GPU

class wgpu.GPU

Bases: object

The entrypoint to the wgpu API.

The starting point of your wgpu-adventure is always to obtain an adapter. The methods of this class are loaded into the wgpu namespace.

get_preferred_canvas_format()

Not implemented in wgpu-py; use GPUCanvasContext.get_preferred_format() instead. The WebGPU spec defines this function, but in wgpu there are different kinds of canvases which may each prefer/support a different format.

print_report()

Print a report about the interals of the backend.

request_adapter(**parameters)

Create a GPUAdapter, the object that represents an abstract wgpu implementation, from which one can request a GPUDevice.

Parameters:
  • canvas (WgpuCanvasInterface) – The canvas that the adapter should be able to render to (to create a swap chain for, to be precise). Can be None if you’re not rendering to screen (or if you’re confident that the returned adapter will work just fine).

  • powerPreference (PowerPreference) – “high-performance” or “low-power”

async request_adapter_async(**parameters)

Async version of request_adapter().

property wgsl_language_features

A set of strings representing the WGSL language extensions supported by all adapters. Returns an empty set for now.