Skip to content

Commit

Permalink
WebGPU: always send exit message to script before exiting (#30989)
Browse files Browse the repository at this point in the history
* webgpu: always send exit message to script before exiting

* Update expectations

---------

Co-authored-by: sagudev <16504129+sagudev@users.noreply.github.com>
  • Loading branch information
gterzian and sagudev committed Jan 3, 2024
1 parent 65cbc95 commit f44ff83
Show file tree
Hide file tree
Showing 2 changed files with 334 additions and 10 deletions.
12 changes: 6 additions & 6 deletions components/webgpu/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,13 +831,10 @@ impl<'a> WGPU<'a> {
gfx_select!(texture => global.texture_drop(texture, true));
},
WebGPURequest::Exit(sender) => {
if let Err(e) = self.script_sender.send(WebGPUMsg::Exit) {
warn!("Failed to send WebGPUMsg::Exit to script ({})", e);
}
if let Err(e) = sender.send(()) {
warn!("Failed to send response to WebGPURequest::Exit ({})", e)
}
return;
break;
},
WebGPURequest::FreeCommandBuffer(command_buffer_id) => {
self.error_command_encoders
Expand Down Expand Up @@ -888,7 +885,7 @@ impl<'a> WGPU<'a> {
e
)
}
return;
break;
},
};
let adapter = WebGPUAdapter(adapter_id);
Expand Down Expand Up @@ -943,7 +940,7 @@ impl<'a> WGPU<'a> {
w
)
}
return;
break;
},
};
let device = WebGPUDevice(id);
Expand Down Expand Up @@ -1249,6 +1246,9 @@ impl<'a> WGPU<'a> {
}
}
}
if let Err(e) = self.script_sender.send(WebGPUMsg::Exit) {
warn!("Failed to send WebGPUMsg::Exit to script ({})", e);
}
}

fn send_result<U, T: std::fmt::Debug>(
Expand Down
Loading

0 comments on commit f44ff83

Please sign in to comment.