webgpu: Add the dedicated WebGPU task source (#39020)

According to the WebGPU specification there are the dedicated task
source
which is used to queue a global task for a GPUDevice on content
timeline.
https://gpuweb.github.io/gpuweb/#-webgpu-task-source

Tasks on content timeline:
- to fire "uncaptureevent" event
- to resolve GPUDevice.lost promise

Also fixed the "isTrusted" attribute status (false -> true) of the
"uncaptureevent" event by using non JS version of event dispatching.

Testing: No changes in WebGPU CTS expectations
- webgpu:api,operation,uncapturederror:*
- webgpu:api,operation,device,lost:*
- webgpu:api,validation,state,device_lost,destroy:*

Signed-off-by: Andrei Volykhin <volykhin.andrei@huawei.com>
Co-authored-by: Andrei Volykhin <volykhin.andrei@huawei.com>
This commit is contained in:
Andrei Volykhin 2025-08-29 23:09:03 +03:00 committed by GitHub
parent aab9beb3de
commit d253fe70f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 51 additions and 30 deletions

View file

@ -1523,7 +1523,7 @@ impl ScriptThread {
},
#[cfg(feature = "webgpu")]
MixedMessage::FromWebGPUServer(inner_msg) => {
self.handle_msg_from_webgpu_server(inner_msg, can_gc)
self.handle_msg_from_webgpu_server(inner_msg)
},
MixedMessage::TimerFired => {},
}
@ -1959,7 +1959,7 @@ impl ScriptThread {
}
#[cfg(feature = "webgpu")]
fn handle_msg_from_webgpu_server(&self, msg: WebGPUMsg, can_gc: CanGc) {
fn handle_msg_from_webgpu_server(&self, msg: WebGPUMsg) {
match msg {
WebGPUMsg::FreeAdapter(id) => self.gpu_id_hub.free_adapter_id(id),
WebGPUMsg::FreeDevice {
@ -1997,7 +1997,7 @@ impl ScriptThread {
msg,
} => {
let global = self.documents.borrow().find_global(pipeline_id).unwrap();
global.gpu_device_lost(device, reason, msg, can_gc);
global.gpu_device_lost(device, reason, msg);
},
WebGPUMsg::UncapturedError {
device,
@ -2006,7 +2006,7 @@ impl ScriptThread {
} => {
let global = self.documents.borrow().find_global(pipeline_id).unwrap();
let _ac = enter_realm(&*global);
global.handle_uncaptured_gpu_error(device, error, can_gc);
global.handle_uncaptured_gpu_error(device, error);
},
_ => {},
}