From 95a33a738fba6f281e98db27a238155acacb9490 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Wed, 22 Jun 2022 14:41:17 +0200 Subject: [PATCH] Add create_texture_error. Firefox needs it to implement WebGPU's error model (see create_buffer_error). --- wgpu-core/src/device/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index c2490a3af4..68e0c1615d 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -3323,6 +3323,18 @@ impl Global { fid.assign_error(label.borrow_or_default(), &mut token); } + /// Assign `id_in` an error with the given `label`. + /// + /// See `create_buffer_error` for more context and explaination. + pub fn create_texture_error(&self, id_in: Input, label: Label) { + let hub = A::hub(self); + let mut token = Token::root(); + let fid = hub.textures.prepare(id_in); + + let (_, mut token) = hub.devices.read(&mut token); + fid.assign_error(label.borrow_or_default(), &mut token); + } + #[cfg(feature = "replay")] pub fn device_wait_for_buffer( &self,