Skip to content

Commit b5e9f66

Browse files
authored
Update to latest idl (#524)
* Update to latest idl * fix for new feature not existing for wgpu-native yet
1 parent 7aadc72 commit b5e9f66

File tree

9 files changed

+31
-20
lines changed

9 files changed

+31
-20
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ Possible sections in each release:
1717
* Security: in case of vulnerabilities.
1818

1919

20+
### [v0.16.0] - tbd
21+
22+
Changed:
23+
24+
* The `Adapter.request_adapter_info()` method is replaced by the `.info` property.
25+
26+
2027
### [v0.15.3] - 12-06-2024
2128

2229
Added:

docs/start.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,17 @@ WGPU can work in GPU cloud compute environments on Linux machines with no physic
9090
9191
sudo apt install xserver-xorg-core mesa-vulkan-drivers libvulkan1
9292
93-
.. note:: If your distro is not Debian/Ubuntu install the corresponding packages for your distribution.
93+
.. note:: If your distro is not Debian/Ubuntu install the corresponding packages for your distribution.
9494

9595
You can verify whether the `"DiscreteGPU"` adapters are found:
9696

9797
.. code-block:: python
9898
9999
import wgpu
100100
import pprint
101-
101+
102102
for a in wgpu.gpu.enumerate_adapters():
103-
pprint.pprint(a.request_adapter_info())
103+
pprint.pprint(a.info)
104104
105105
If you are using a remote frame buffer via `jupyter-rfb <https://github.com/vispy/jupyter_rfb>`_ we also recommend installing the following for optimal performance:
106106

@@ -109,7 +109,7 @@ If you are using a remote frame buffer via `jupyter-rfb <https://github.com/visp
109109
sudo apt install libjpeg-turbo8-dev libturbojpeg0-dev
110110
pip install simplejpeg
111111
112-
Your mileage may vary across different cloud service providers, for more info see: https://github.com/pygfx/wgpu-py/issues/493
112+
Your mileage may vary across different cloud service providers, for more info see: https://github.com/pygfx/wgpu-py/issues/493
113113

114114
Installing LavaPipe on Linux
115115
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

docs/wgpu.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ features, limits and properties. To actually start using that harware for comput
6363
to control your hardware (or software).
6464
The device is the central object; most other GPU objects are created from it.
6565
Also see the convenience function :func:`wgpu.utils.get_default_device`.
66-
Information on the adapter can be obtained using :func:`wgpu.GPUAdapter.request_adapter_info` in the form of a :class:`GPUAdapterInfo`.
66+
Information on the adapter can be obtained using :attr:`wgpu.GPUAdapter.info` (a dict simular to :class:`GPUAdapterInfo`) or :attr:`wgpu.GPUAdapter.summary`.
6767

6868
A device is controlled with a specific backend API. By default one is selected automatically.
6969
This can be overridden by setting the

tests/testutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def get_wgpu_backend():
9797
"""
9898
Query the configured wgpu backend driver.
9999
"""
100-
code = "import wgpu.utils; info = wgpu.utils.get_default_device().adapter.request_adapter_info(); print(info['adapter_type'], info['backend_type'])"
100+
code = "import wgpu.utils; info = wgpu.utils.get_default_device().adapter.info; print(info['adapter_type'], info['backend_type'])"
101101
result = subprocess.run(
102102
[
103103
sys.executable,

wgpu/_classes.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -377,24 +377,20 @@ def is_fallback_adapter(self):
377377
"""Whether this adapter runs on software (rather than dedicated hardware)."""
378378
return self._adapter_info.get("adapter_type", "").lower() in ("software", "cpu")
379379

380+
# IDL: [SameObject] readonly attribute GPUAdapterInfo info;
381+
@property
382+
def info(self):
383+
"""A dict with information about this adapter, such as the vendor and devicen name."""
384+
# Note: returns a dict rather than an GPUAdapterInfo instance.
385+
return self._adapter_info
386+
380387
@apidiff.add("Useful in multi-gpu environments")
381388
@property
382389
def summary(self):
383390
"""A one-line summary of the info of this adapter (name, adapter_type, backend_type)."""
384391
d = self._adapter_info
385392
return f"{d['device']} ({d['adapter_type']}) via {d['backend_type']}"
386393

387-
# IDL: Promise<GPUAdapterInfo> requestAdapterInfo();
388-
def request_adapter_info(self):
389-
"""Get a dict with information about this adapter, such as the vendor and devicen name."""
390-
# Note: returns a dict rather than an GPUAdapterInfo instance.
391-
return self._adapter_info
392-
393-
# IDL: Promise<GPUAdapterInfo> requestAdapterInfo();
394-
async def request_adapter_info_async(self):
395-
"""Async get information about this adapter."""
396-
return self._adapter_info
397-
398394

399395
class GPUObjectBase:
400396
"""The base class for all GPU objects.

wgpu/backends/wgpu_native/_api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ def to_py_str(key):
344344
# WebGPU features
345345
features = set()
346346
for f in sorted(enums.FeatureName):
347+
if f in ["clip-distances"]:
348+
continue # not supported by wgpu-native yet
347349
key = f"FeatureName.{f}"
348350
i = enummap[key]
349351
# H: WGPUBool f(WGPUAdapter adapter, WGPUFeatureName feature)
@@ -852,6 +854,8 @@ def callback(status, result, message, userdata):
852854
# WebGPU features
853855
features = set()
854856
for f in sorted(enums.FeatureName):
857+
if f in ["clip-distances"]:
858+
continue # not supported by wgpu-native yet
855859
key = f"FeatureName.{f}"
856860
i = enummap[key]
857861
# H: WGPUBool f(WGPUDevice device, WGPUFeatureName feature)

wgpu/enums.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def __repr__(self):
8888
#: * "rg11b10ufloat_renderable"
8989
#: * "bgra8unorm_storage"
9090
#: * "float32_filterable"
91+
#: * "clip_distances"
9192
FeatureName = Enum(
9293
"FeatureName",
9394
depth_clip_control="depth-clip-control",
@@ -101,6 +102,7 @@ def __repr__(self):
101102
rg11b10ufloat_renderable="rg11b10ufloat-renderable",
102103
bgra8unorm_storage="bgra8unorm-storage",
103104
float32_filterable="float32-filterable",
105+
clip_distances="clip-distances",
104106
)
105107

106108
#: * "unmapped"

wgpu/resources/codegen_report.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generatation report
22
## Preparing
3-
* The webgpu.idl defines 37 classes with 76 functions
3+
* The webgpu.idl defines 37 classes with 75 functions
44
* The webgpu.idl defines 5 flags, 33 enums, 59 structs
55
* The wgpu.h defines 198 functions
66
* The wgpu.h defines 7 flags, 50 enums, 93 structs
@@ -18,10 +18,11 @@
1818
* Diffs for GPUTextureView: add size, add texture
1919
* Diffs for GPUBindingCommandsMixin: change set_bind_group
2020
* Diffs for GPUQueue: add read_buffer, add read_texture, hide copy_external_image_to_texture
21-
* Validated 37 classes, 114 methods, 44 properties
21+
* Validated 37 classes, 112 methods, 45 properties
2222
### Patching API for backends/wgpu_native/_api.py
2323
* Validated 37 classes, 111 methods, 0 properties
2424
## Validating backends/wgpu_native/_api.py
25+
* Enum field FeatureName.clip-distances missing in wgpu.h
2526
* Enum PipelineErrorReason missing in wgpu.h
2627
* Enum AutoLayoutMode missing in wgpu.h
2728
* Enum field VertexFormat.unorm10-10-10-2 missing in wgpu.h

wgpu/resources/webgpu.idl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ enum GPUPowerPreference {
100100
interface GPUAdapter {
101101
[SameObject] readonly attribute GPUSupportedFeatures features;
102102
[SameObject] readonly attribute GPUSupportedLimits limits;
103+
[SameObject] readonly attribute GPUAdapterInfo info;
103104
readonly attribute boolean isFallbackAdapter;
104105

105106
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
106-
Promise<GPUAdapterInfo> requestAdapterInfo();
107107
};
108108

109109
dictionary GPUDeviceDescriptor
@@ -125,6 +125,7 @@ enum GPUFeatureName {
125125
"rg11b10ufloat-renderable",
126126
"bgra8unorm-storage",
127127
"float32-filterable",
128+
"clip-distances",
128129
};
129130

130131
[Exposed=(Window, Worker), SecureContext]

0 commit comments

Comments
 (0)