Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename request_adapter_trace -> request_adapter #589

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/backends.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ It also works out of the box, because the wgpu-native DLL is shipped with wgpu-p

The wgpu_native backend provides a few extra functionalities:

.. py:function:: wgpu.backends.wgpu_native.request_device_tracing(adapter, trace_path, *, label="", required_features, required_limits, default_queue)
.. py:function:: wgpu.backends.wgpu_native.request_device(adapter, trace_path, *, label="", required_features, required_limits, default_queue)

An alternative to :func:`wgpu.GPUAdapter.request_adapter`, that streams a trace
of all low level calls to disk, so the visualization can be replayed (also on other systems),
investigated, and debugged.

The trace_path argument is ignored on drivers that do not support tracing.

:param adapter: The adapter to create a device for.
:param trace_path: The path to an (empty) directory. Is created if it does not exist.
:param label: A human readable label. Optional.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ You can run your application via RenderDoc, which is able to capture a
frame, including all API calls, objects and the complete pipeline state,
and display all of that information within a nice UI.

You can use ``adapter.request_device_tracing()`` to provide a directory path
You can use ``adapter.request_device()`` to provide a directory path
where a trace of all API calls will be written. This trace can then be used
to re-play your use-case elsewhere (it's cross-platform).

Expand Down
4 changes: 2 additions & 2 deletions tests/test_wgpu_native_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,15 @@ def test_wgpu_native_tracer():
assert not os.path.isdir(tempdir)

# Works!
wgpu.backends.wgpu_native.request_device_tracing(adapter, tempdir)
wgpu.backends.wgpu_native.request_device(adapter, tempdir)
assert os.path.isdir(tempdir)

# Make dir not empty
with open(os.path.join(tempdir, "stub.txt"), "wb"):
pass

# Still works, but produces warning
wgpu.backends.wgpu_native.request_device_tracing(adapter, tempdir)
wgpu.backends.wgpu_native.request_device(adapter, tempdir)


@mark.skipif(not can_use_wgpu_lib, reason="Needs wgpu lib")
Expand Down
2 changes: 1 addition & 1 deletion wgpu/backends/wgpu_native/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
gpu = GPU() # noqa: F405
_register_backend(gpu) # noqa: F405

from .extras import enumerate_adapters, request_device_tracing # noqa: F401, E402
from .extras import enumerate_adapters, request_device # noqa: F401, E402
2 changes: 1 addition & 1 deletion wgpu/backends/wgpu_native/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def enumerate_adapters():
raise RuntimeError("Deprecated: use wgpu.gpu.enumerate_adapters() instead.")


def request_device_tracing(
def request_device(
adapter,
trace_path,
*,
Expand Down
Loading