aboutsummaryrefslogtreecommitdiffstats
path: root/components/webgpu/script_messages.rs
diff options
context:
space:
mode:
authorSamson <16504129+sagudev@users.noreply.github.com>2024-06-17 14:47:25 +0200
committerGitHub <noreply@github.com>2024-06-17 12:47:25 +0000
commitcbc9304c2002fb0d5c8cdade39eddfe117b12053 (patch)
treeffb9afd683f8ec9d6eda26e3ba395d3214718b72 /components/webgpu/script_messages.rs
parent3381f2a70442aa6a6c31a0bc4a4c3601299631f5 (diff)
downloadservo-cbc9304c2002fb0d5c8cdade39eddfe117b12053.tar.gz
servo-cbc9304c2002fb0d5c8cdade39eddfe117b12053.zip
webgpu: Implement device lost (#32354)
* device lost promise should be init at creation of device object * device lost impl * lock for device poll workaround for wgpu deadlocks * expect * Less lost reason reasoning in script
Diffstat (limited to 'components/webgpu/script_messages.rs')
-rw-r--r--components/webgpu/script_messages.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/components/webgpu/script_messages.rs b/components/webgpu/script_messages.rs
index 7142641a466..083f813901e 100644
--- a/components/webgpu/script_messages.rs
+++ b/components/webgpu/script_messages.rs
@@ -15,6 +15,13 @@ use crate::wgc::id::{
ShaderModuleId, StagingBufferId, SurfaceId, TextureId, TextureViewId,
};
+/// <https://gpuweb.github.io/gpuweb/#enumdef-gpudevicelostreason>
+#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
+pub enum DeviceLostReason {
+ Unknown,
+ Destroyed,
+}
+
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum WebGPUMsg {
FreeAdapter(AdapterId),
@@ -34,14 +41,16 @@ pub enum WebGPUMsg {
FreeRenderBundle(RenderBundleId),
FreeStagingBuffer(StagingBufferId),
FreeQuerySet(QuerySetId),
- CleanDevice {
+ UncapturedError {
device: WebGPUDevice,
pipeline_id: PipelineId,
+ error: Error,
},
- UncapturedError {
+ DeviceLost {
device: WebGPUDevice,
pipeline_id: PipelineId,
- error: Error,
+ reason: DeviceLostReason,
+ msg: String,
},
Exit,
}