Utils ===== The wgpu library provides a few utilities. Note that most functions below need to be explictly imported. Logger ------ 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: .. code-block:: py import logging logger = logging.getLogger("wgpu") Diagnostics ----------- To print a full diagnostic report: .. code-block:: py wgpu.diagnostics.print_report() To inspect (for example) the total buffer usage: .. code-block:: py >>> counts = wgpu.diagnostics.object_counts.get_dict() >>> print(counts["Buffer"]) {'count': 3, 'resource_mem': 784} .. autoclass:: wgpu._diagnostics.DiagnosticsRoot :members: .. autoclass:: wgpu.DiagnosticsBase :members: Get default device ------------------ .. autofunction:: wgpu.utils.get_default_device Compute with buffers -------------------- .. code-block:: py from wgpu.utils.compute import compute_with_buffers .. autofunction:: wgpu.utils.compute_with_buffers