Skip to content

Commit 92cda27

Browse files
authored
Implement on_submitted_work_done (#7864)
1 parent 86e6b18 commit 92cda27

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Bottom level categories:
106106
#### WebGPU
107107

108108
- Fix setting unclipped_depth. By @atlv24 in [#7841](https://github.com/gfx-rs/wgpu/pull/7841)
109+
- Implement `on_submitted_work_done` for WebGPU backend. By @drewcrawford in [#7864](https://github.com/gfx-rs/wgpu/pull/7864)
109110

110111
### Changes
111112

wgpu/src/backend/webgpu.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,8 +2594,17 @@ impl dispatch::QueueInterface for WebQueue {
25942594
1.0
25952595
}
25962596

2597-
fn on_submitted_work_done(&self, _callback: dispatch::BoxSubmittedWorkDoneCallback) {
2598-
unimplemented!("on_submitted_work_done is not yet implemented");
2597+
fn on_submitted_work_done(&self, callback: dispatch::BoxSubmittedWorkDoneCallback) {
2598+
let promise = self.inner.on_submitted_work_done();
2599+
wasm_bindgen_futures::spawn_local(async move {
2600+
match wasm_bindgen_futures::JsFuture::from(promise).await {
2601+
Ok(_) => callback(),
2602+
Err(error) => {
2603+
log::error!("on_submitted_work_done promise failed: {:?}", error);
2604+
callback();
2605+
}
2606+
}
2607+
});
25992608
}
26002609

26012610
fn compact_blas(

0 commit comments

Comments
 (0)