From 9a9f7a7aafcd2ab986d68d8aee8cdb4d6d91423a Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Fri, 13 Sep 2024 21:08:33 +0200 Subject: [PATCH] Update native (#580) * Update to wgpu-native v22.1.0.5 * Follow fix in wgpu-native for adapter info * fix docstring and comment --- download-wgpu-native.py | 15 +++++++++------ wgpu/_classes.py | 4 ++-- wgpu/backends/wgpu_native/__init__.py | 4 ++-- wgpu/backends/wgpu_native/_api.py | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/download-wgpu-native.py b/download-wgpu-native.py index 83a584e3..69492e29 100644 --- a/download-wgpu-native.py +++ b/download-wgpu-native.py @@ -52,14 +52,17 @@ def download_file(url, filename): def extract_file(zip_filename, member, path): + # Read file from archive, find it no matter the folder structure z = ZipFile(zip_filename) - os.makedirs(path, exist_ok=True) - z.extract(member, path=path) + flat_map = {os.path.basename(fi.filename): fi.filename for fi in z.filelist} + bb = z.read(flat_map[member]) + # Make newlines consistent with Git rules etc. if member.endswith(".h") and FORCE_SIMPLE_NEWLINES: - filename = os.path.join(path, member) - bb = open(filename, "rb").read() - with open(filename, "wb") as f: - f.write(bb.replace(b"\r\n", b"\n")) + bb = bb.replace(b"\r\n", b"\n") + # Write to disk + os.makedirs(path, exist_ok=True) + with open(os.path.join(path, member), "wb") as f: + f.write(bb) def get_os_string(): diff --git a/wgpu/_classes.py b/wgpu/_classes.py index 49c2a299..24e19815 100644 --- a/wgpu/_classes.py +++ b/wgpu/_classes.py @@ -389,9 +389,9 @@ def info(self): @apidiff.add("Useful in multi-gpu environments") @property def summary(self): - """A one-line summary of the info of this adapter (description, adapter_type, backend_type).""" + """A one-line summary of the info of this adapter (device, adapter_type, backend_type).""" d = self._adapter_info - return f"{d['description']} ({d['adapter_type']}) via {d['backend_type']}" + return f"{d['device']} ({d['adapter_type']}) via {d['backend_type']}" class GPUObjectBase: diff --git a/wgpu/backends/wgpu_native/__init__.py b/wgpu/backends/wgpu_native/__init__.py index 69687101..26366fdb 100644 --- a/wgpu/backends/wgpu_native/__init__.py +++ b/wgpu/backends/wgpu_native/__init__.py @@ -9,8 +9,8 @@ # The wgpu-native version that we target/expect -__version__ = "22.1.0.2" -__commit_sha__ = "3e18e3d3e5fd433053875464447c36d980625f0b" +__version__ = "22.1.0.5" +__commit_sha__ = "fad19f5990d8eb9a6e942eb957344957193fe66d" version_info = tuple(map(int, __version__.split("."))) _check_expected_version(version_info) # produces a warning on mismatch diff --git a/wgpu/backends/wgpu_native/_api.py b/wgpu/backends/wgpu_native/_api.py index d3252c92..eb8dc3d5 100644 --- a/wgpu/backends/wgpu_native/_api.py +++ b/wgpu/backends/wgpu_native/_api.py @@ -345,7 +345,7 @@ def to_py_str(key): # Populate a dict according to the WebGPU spec: https://gpuweb.github.io/gpuweb/#gpuadapterinfo # And add all other info we get from wgpu-native too. - # note: description is human readable. device is a PCI ID. + # note: device is human readable. description is driver-description; usually more cryptic, or empty. adapter_info = { # Spec "vendor": to_py_str("vendor"),