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

Update API to latest IDL #369

Merged
merged 9 commits into from
Oct 3, 2023
Merged
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion tests/test_rs_basics.py
Original file line number Diff line number Diff line change
@@ -156,7 +156,7 @@ def test_shader_module_creation_spirv():
code4 = type("CodeObject", (object,), {})

m1 = device.create_shader_module(code=code1)
assert m1.compilation_info() == []
assert m1.get_compilation_info() == []

with raises(TypeError):
device.create_shader_module(code=code4)
20 changes: 18 additions & 2 deletions wgpu/backends/rs.py
Original file line number Diff line number Diff line change
@@ -70,6 +70,14 @@
WGPU_LIMIT_U32_UNDEFINED = 0xFFFFFFFF
WGPU_LIMIT_U64_UNDEFINED = 0xFFFFFFFFFFFFFFFF


# Features in WebGPU that don't map to wgpu-native yet
KNOWN_MISSING_FEATURES = [
"bgra8unorm-storage",
"float32-filterable",
]

# Features that wgpu-native supports that are not part of WebGPU
NATIVE_FEATURES = (
"multi_draw_indirect",
"push_constants",
@@ -339,7 +347,11 @@ def to_py_str(key):
# WebGPU features
features = set()
for f in sorted(enums.FeatureName):
i = enummap[f"FeatureName.{f}"]
key = f"FeatureName.{f}"
if key not in enummap:
assert f in KNOWN_MISSING_FEATURES
almarklein marked this conversation as resolved.
Show resolved Hide resolved
continue
i = enummap[key]
# H: bool f(WGPUAdapter adapter, WGPUFeatureName feature)
if lib.wgpuAdapterHasFeature(adapter_id, i):
features.add(f)
@@ -755,7 +767,11 @@ def callback(status, result, message, userdata):
# WebGPU features
features = set()
for f in sorted(enums.FeatureName):
i = enummap[f"FeatureName.{f}"]
key = f"FeatureName.{f}"
if key not in enummap:
assert f in KNOWN_MISSING_FEATURES
continue
i = enummap[key]
# H: bool f(WGPUDevice device, WGPUFeatureName feature)
if lib.wgpuDeviceHasFeature(device_id, i):
features.add(f)