From 7b2a561402204e7809b28db61b2e7bbb9a333830 Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:43:32 +0100 Subject: [PATCH] make `open_pass` panic if the encoder is open --- wgpu-core/src/command/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wgpu-core/src/command/mod.rs b/wgpu-core/src/command/mod.rs index d733d4236..afb839007 100644 --- a/wgpu-core/src/command/mod.rs +++ b/wgpu-core/src/command/mod.rs @@ -395,11 +395,16 @@ impl CommandEncoder { /// its own label. /// /// The underlying hal encoder is put in the "recording" state. + /// + /// # Panics + /// + /// - If the encoder is already open. pub(crate) fn open_pass( &mut self, label: Option<&str>, device: &Device, ) -> Result<&mut dyn hal::DynCommandEncoder, DeviceError> { + assert!(!self.is_open); self.is_open = true; let hal_label = hal_label(label, device.instance_flags);