Add create_texture_error. (#2800)

Firefox needs it to implement WebGPU's error model (see create_buffer_error).
This commit is contained in:
Nicolas Silva 2022-06-22 14:58:37 +02:00 committed by GitHub
parent 2881a74de9
commit a9f1b4f8e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3323,6 +3323,18 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
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<A: HalApi>(&self, id_in: Input<G, id::TextureId>, 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<A: HalApi>(
&self,