From 01973a98dc60d07f2a5a1daed988de4189d9b477 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Sat, 9 Nov 2024 07:21:58 -0500 Subject: [PATCH] fix(core): handle HAL errors from query set creation (#6505) * fix(core): handle HAL errors from query set creation * Update CHANGELOG.md Co-authored-by: Andreas Reich --------- Co-authored-by: Andreas Reich --- CHANGELOG.md | 4 ++++ wgpu-core/src/device/resource.rs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2087875ee..01fb81cdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,10 @@ Bottom level categories: ### Bug Fixes +#### General + +- Handle query set creation failure as an internal error that loses the `Device`, rather than panicking. By @ErichDonGubler in [#6505](https://github.com/gfx-rs/wgpu/pull/6505). + #### Naga - Fix crash when a texture argument is missing. By @aedm in [#6486](https://github.com/gfx-rs/wgpu/pull/6486) diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 46271f7ac..b88759cc9 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -3605,7 +3605,8 @@ impl Device { let hal_desc = desc.map_label(|label| label.to_hal(self.instance_flags)); - let raw = unsafe { self.raw().create_query_set(&hal_desc).unwrap() }; + let raw = unsafe { self.raw().create_query_set(&hal_desc) } + .map_err(|e| self.handle_hal_error(e))?; let query_set = QuerySet { raw: ManuallyDrop::new(raw),