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:

ShaderInterface()

Define what a shader object must look like from the pov from the pipeline.

BaseShader(wobject, **kwargs)

Base shader object to compose and template shaders using jinja2.

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.

register_wgsl_loader(context, func)

Register a source for shader snippets.

load_wgsl(shader_name)

Load wgsl code from pygfx builtin shader snippets.

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.