Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 04be32e

Browse files
authored
small wgpu changes (#691)
* fix deprecated wgpu calls * show a warning instead of raising an exception if no WGPU adapter exists * black
1 parent 962c9ba commit 04be32e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

fastplotlib/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
__version__ = f.read().split("\n")[0]
2525

2626
if len(enumerate_adapters()) < 1:
27-
raise IndexError(
27+
from warnings import warn
28+
29+
warn(
2830
f"WGPU could not enumerate any adapters, fastplotlib will not work.\n"
2931
f"This is caused by one of the following:\n"
3032
f"1. You do not have a hardware GPU installed and you do not have "
@@ -35,5 +37,6 @@
3537
f"common in cloud computing environments.\n"
3638
f"These two links can help you troubleshoot:\n"
3739
f"https://wgpu-py.readthedocs.io/en/stable/start.html#platform-requirements\n"
38-
f"https://fastplotlib.readthedocs.io/en/latest/user_guide/gpu.html\n"
40+
f"https://fastplotlib.readthedocs.io/en/latest/user_guide/gpu.html\n",
41+
RuntimeWarning,
3942
)

fastplotlib/utils/gui.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ def _notebook_print_banner():
5959
image = Image(value=logo_data, format="png", width=300, height=55)
6060

6161
# get adapters and info
62-
adapters = [a for a in wgpu.gpu.enumerate_adapters()]
62+
adapters = [a for a in wgpu.gpu.enumerate_adapters_sync()]
6363
adapters_info = [a.info for a in adapters]
6464

65-
default_adapter_info = wgpu.gpu.request_adapter().info
65+
default_adapter_info = wgpu.gpu.request_adapter_sync().info
6666
default_ix = adapters_info.index(default_adapter_info)
6767

6868
if len(adapters) < 1:

0 commit comments

Comments
 (0)