mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
Implement the device_set_device_lost_callback
method for ContextWebGpu
(#5438)
* impl device_set_device_lost_callback for ContextWebGpu * merge changelog --------- Co-authored-by: lixiangyu.ava <lixiangyu.ava@bytedance.com>
This commit is contained in:
parent
a9ccbc7dea
commit
b34219ca21
@ -121,6 +121,7 @@ Bottom level categories:
|
||||
|
||||
#### WebGPU
|
||||
|
||||
- Implement the `device_set_device_lost_callback` method for `ContextWebGpu`. By @suti in [#5438](https://github.com/gfx-rs/wgpu/pull/5438)
|
||||
- Add support for storage texture access modes `ReadOnly` and `ReadWrite`. By @JolifantoBambla in [#5434](https://github.com/gfx-rs/wgpu/pull/5434)
|
||||
|
||||
### Bug Fixes
|
||||
|
@ -1979,10 +1979,23 @@ impl crate::context::Context for ContextWebGpu {
|
||||
fn device_set_device_lost_callback(
|
||||
&self,
|
||||
_device: &Self::DeviceId,
|
||||
_device_data: &Self::DeviceData,
|
||||
_device_lost_callback: crate::context::DeviceLostCallback,
|
||||
device_data: &Self::DeviceData,
|
||||
device_lost_callback: crate::context::DeviceLostCallback,
|
||||
) {
|
||||
unimplemented!();
|
||||
use webgpu_sys::{GpuDeviceLostInfo, GpuDeviceLostReason};
|
||||
|
||||
let closure = Closure::once(move |info: JsValue| {
|
||||
let info = info.dyn_into::<GpuDeviceLostInfo>().unwrap();
|
||||
device_lost_callback(
|
||||
match info.reason() {
|
||||
GpuDeviceLostReason::Destroyed => crate::DeviceLostReason::Destroyed,
|
||||
GpuDeviceLostReason::Unknown => crate::DeviceLostReason::Unknown,
|
||||
_ => crate::DeviceLostReason::Unknown,
|
||||
},
|
||||
info.message(),
|
||||
);
|
||||
});
|
||||
let _ = device_data.0.lost().then(&closure);
|
||||
}
|
||||
|
||||
fn device_poll(
|
||||
|
Loading…
Reference in New Issue
Block a user