The wgpu library provides a few utilities. Note that most functions below need to be explicitly imported.
Errors, warnings, and info messages (including messages generated by
wgpu-native) are logged using Python's default logging mechanics. The
wgpu logger instance is in wgpu.logger
, but can also be obtained
via:
import logging
logger = logging.getLogger("wgpu")
To print a full diagnostic report:
wgpu.diagnostics.print_report()
To inspect (for example) the total buffer usage:
>>> counts = wgpu.diagnostics.object_counts.get_dict()
>>> print(counts["Buffer"])
{'count': 3, 'resource_mem': 784}
.. autoclass:: wgpu._diagnostics.DiagnosticsRoot :members:
.. autoclass:: wgpu.DiagnosticsBase :members:
.. autoclass:: wgpu.utils.BaseEnum
.. autofunction:: wgpu.utils.get_default_device
from wgpu.utils.compute import compute_with_buffers
.. autofunction:: wgpu.utils.compute.compute_with_buffers