Skip to content

Commit

Permalink
Change all occurrences of request_adapter_trace (except in the change…
Browse files Browse the repository at this point in the history
…log) to request_adapter. (#589)
  • Loading branch information
fyellin authored Sep 18, 2024
1 parent 6088dd8 commit 6516d37
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
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

0 comments on commit 6516d37

Please sign in to comment.