pygfx.renderers.wgpu

General functions and classes to operate more closely with the wgpu backend.

print_wgpu_report()

Print a report on the internal status of WGPU.

select_power_preference(power_preference)

Select whether a powerful or battery-friendly GPU is selected.

select_adapter(adapter)

Select a specific adapter / GPU.

enable_wgpu_features(*features)

Enable specific features (as strings) on the wgpu device.

WgpuRenderer(target, *args[, pixel_ratio, ...])

Turns Scenes into rasterized images using wgpu.

register_wgpu_render_function(wobject_cls, ...)

Decorator for WGPU rendering functions.

get_shared()

Get the globally shared instance.

Shared(*[, canvas])

An object to store global data to share between multiple wgpu renderers.

Classes and functions required to implement custom shaders:

WorldObjectShader(wobject, **kwargs)

A base shader for world objects.

Binding(name, type, resource[, visibility, ...])

Simple object to hold together some information about a binding, for internal use.

GfxSampler([filter, address_mode])

Simple wrapper for a GPUSampler.

GfxTextureView(texture, *[, view_dim, ...])

Simple wrapper for a GPUTextureView.

load_wgsl(shader_name)

Load wgsl code from the file system.

shaderlib

Lower level functions that may or may not be needed in custom shaders:

nchannels_from_format(format)

Return the number of channels from a buffer format.

to_vertex_format(format)

Convert pygfx' own format to the wgpu format.

to_texture_format(format)

Convert pygfx' own format to the wgpu format.