mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 15:00:57 +01:00
WebGPU: Handle GpuInternalError (#9919)
This commit is contained in:
1 parent
4e3117a2e5
commit
83b9fa1661
5 files changed
+63
No files matched your search
@@ -101,6 +101,10 @@ Bottom level categories:
|
||||
|
||||
- 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).
|
||||
|
||||
#### WebGPU
|
||||
|
||||
- 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).
|
||||
|
||||
### Documentation
|
||||
|
||||
#### General
|
||||
|
||||
@@ -79,6 +79,11 @@ impl crate::Error {
|
||||
source,
|
||||
description: js_error.message(),
|
||||
}
|
||||
} else if let Some(js_error) = js_error.dyn_ref::<webgpu_sys::GpuInternalError>() {
|
||||
crate::Error::Internal {
|
||||
source,
|
||||
description: js_error.message(),
|
||||
}
|
||||
} else if js_error.has_type::<webgpu_sys::GpuOutOfMemoryError>() {
|
||||
crate::Error::OutOfMemory { source }
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
// DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// This module part of a subset of web-sys that is used by wgpu's webgpu backend.
|
||||
//
|
||||
// These bindings are vendored into wgpu for the sole purpose of letting
|
||||
// us pin the WebGPU backend to a specific version of the bindings, not
|
||||
// to enable local changes. There are no provisions to preserve changes
|
||||
// you make here the next time we re-vendor the bindings.
|
||||
//
|
||||
// The `web-sys` crate does not treat breaking changes to the WebGPU API
|
||||
// as semver breaking changes, as WebGPU is "unstable". This means Cargo
|
||||
// will not let us mix versions of `web-sys`, pinning WebGPU bindings to
|
||||
// a specific version, while letting other bindings like WebGL get
|
||||
// updated. Vendoring WebGPU was the workaround we chose.
|
||||
//
|
||||
// Vendoring also allows us to avoid building `web-sys` with
|
||||
// `--cfg=web_sys_unstable_apis`, needed to get the WebGPU bindings.
|
||||
//
|
||||
// If you want to improve the generated code, please submit a PR to the https://github.com/wasm-bindgen/wasm-bindgen repository.
|
||||
//
|
||||
// This file was generated by the `cargo xtask vendor-web-sys --version 0.2.115` command.
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::all)]
|
||||
use super::*;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
# [wasm_bindgen (extends = GpuError , extends = :: js_sys :: Object , js_name = GPUInternalError , typescript_type = "GPUInternalError")]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[doc = "The `GpuInternalError` class."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUInternalError)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `GpuInternalError`*"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
|
||||
#[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
|
||||
pub type GpuInternalError;
|
||||
|
||||
#[wasm_bindgen(catch, constructor, js_class = "GPUInternalError")]
|
||||
#[doc = "The `new GpuInternalError(..)` constructor, creating a new instance of `GpuInternalError`."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUInternalError/GPUInternalError)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `GpuInternalError`*"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
|
||||
#[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
|
||||
pub fn new(message: &str) -> Result<GpuInternalError, JsValue>;
|
||||
}
|
||||
+2
@@ -162,6 +162,8 @@ mod gen_GpuMipmapFilterMode;
|
||||
pub use gen_GpuMipmapFilterMode::*;
|
||||
mod gen_GpuMultisampleState;
|
||||
pub use gen_GpuMultisampleState::*;
|
||||
mod gen_GpuInternalError;
|
||||
pub use gen_GpuInternalError::*;
|
||||
mod gen_GpuObjectDescriptorBase;
|
||||
pub use gen_GpuObjectDescriptorBase::*;
|
||||
mod gen_GpuOrigin2dDict;
|
||||
|
||||
@@ -89,6 +89,7 @@ const WEB_SYS_FEATURES_NEEDED: &[&str] = &[
|
||||
"gpu_map_mode",
|
||||
"GpuMipmapFilterMode",
|
||||
"GpuMultisampleState",
|
||||
"GpuInternalError",
|
||||
"GpuObjectDescriptorBase",
|
||||
"GpuOrigin2dDict",
|
||||
"GpuOrigin3dDict",
|
||||
|
||||
Reference in new issue
Block a user