Skip to content

Commit 83b9fa1

Browse files
authored
WebGPU: Handle GpuInternalError (#9919)
1 parent 4e3117a commit 83b9fa1

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
@@ -101,6 +101,10 @@ Bottom level categories:
101101

102102
- 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).
103103

104+
#### WebGPU
105+
106+
- Recognize `GPUInternalError` when converting a 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).
107+
104108
### Documentation
105109

106110
#### 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)