Skip to content

Commit a8f28c0

Browse files
committed
WebGPU: Handle GpuInteralError
1 parent c97d22f commit a8f28c0

5 files changed

Lines changed: 63 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ Bottom level categories:
100100

101101
- Fixed signed integer `%` (and `%=`) returning the wrong result for negative operands in the GLSL (OpenGL/GLES) backend, e.g. `-1 % 768` yielding `255` instead of `-1`. GLSL's `%` is undefined when either operand is negative, so signed remainder is now lowered as `a - b * (a / b)`, matching the SPIR-V, HLSL, and Metal backends. By @mstampfli in [#9687](https://github.com/gfx-rs/wgpu/pull/9687).
102102

103+
#### WebGPU
104+
105+
- Recognize `GPUInternalError` when converting a caught/uncaptured WebGPU error, mapping it to `Error::Internal` instead of panicking with "Unexpected error". By @evilpies in [#9919](https://github.com/gfx-rs/wgpu/pull/9919).
106+
103107
### Dependency Updates
104108

105109
#### General

wgpu/src/backend/webgpu.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ impl crate::Error {
7979
source,
8080
description: js_error.message(),
8181
}
82+
} else if let Some(js_error) = js_error.dyn_ref::<webgpu_sys::GpuInternalError>() {
83+
crate::Error::Internal {
84+
source,
85+
description: js_error.message(),
86+
}
8287
} else if js_error.has_type::<webgpu_sys::GpuOutOfMemoryError>() {
8388
crate::Error::OutOfMemory { source }
8489
} else {

wgpu/src/backend/webgpu/webgpu_sys/gen_GpuInternalError.rs

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wgpu/src/backend/webgpu/webgpu_sys/mod.rs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

xtask/src/vendor_web_sys.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const WEB_SYS_FEATURES_NEEDED: &[&str] = &[
8989
"gpu_map_mode",
9090
"GpuMipmapFilterMode",
9191
"GpuMultisampleState",
92+
"GpuInternalError",
9293
"GpuObjectDescriptorBase",
9394
"GpuOrigin2dDict",
9495
"GpuOrigin3dDict",

0 commit comments

Comments
 (0)