diff --git a/wgpu/src/backend/direct.rs b/wgpu/src/backend/direct.rs index 5dede69f3f..51f075154e 100644 --- a/wgpu/src/backend/direct.rs +++ b/wgpu/src/backend/direct.rs @@ -3040,13 +3040,11 @@ impl crate::Context for Context { wgpu_render_pass_end_pipeline_statistics_query(pass_data) } - fn render_pass_execute_bundles<'a>( + fn render_pass_execute_bundles( &self, _pass: &mut Self::RenderPassId, pass_data: &mut Self::RenderPassData, - render_bundles: Box< - dyn Iterator + 'a, - >, + render_bundles: &mut dyn Iterator, ) { let temp_render_bundles = render_bundles.map(|(i, _)| i).collect::>(); unsafe { diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index 04069f224b..ded30957ac 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -3451,13 +3451,11 @@ impl crate::context::Context for Context { // Not available in gecko yet } - fn render_pass_execute_bundles<'a>( + fn render_pass_execute_bundles( &self, _pass: &mut Self::RenderPassId, pass_data: &mut Self::RenderPassData, - render_bundles: Box< - dyn Iterator + 'a, - >, + render_bundles: &mut dyn Iterator, ) { let mapped = render_bundles .map(|(_, bundle_data)| &bundle_data.0) diff --git a/wgpu/src/context.rs b/wgpu/src/context.rs index 45f27dce19..19fea9e983 100644 --- a/wgpu/src/context.rs +++ b/wgpu/src/context.rs @@ -1018,13 +1018,11 @@ pub trait Context: Debug + WasmNotSendSync + Sized { pass: &mut Self::RenderPassId, pass_data: &mut Self::RenderPassData, ); - fn render_pass_execute_bundles<'a>( + fn render_pass_execute_bundles( &self, pass: &mut Self::RenderPassId, pass_data: &mut Self::RenderPassData, - render_bundles: Box< - dyn Iterator + 'a, - >, + render_bundles: &mut dyn Iterator, ); } @@ -1660,11 +1658,11 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync { dest: crate::ImageCopyTextureTagged<'_>, size: wgt::Extent3d, ); - fn queue_submit<'a>( + fn queue_submit( &self, queue: &ObjectId, queue_data: &crate::Data, - command_buffers: Box)> + 'a>, + command_buffers: &mut dyn Iterator)>, ) -> (ObjectId, Arc); fn queue_get_timestamp_period(&self, queue: &ObjectId, queue_data: &crate::Data) -> f32; fn queue_on_submitted_work_done( @@ -2068,11 +2066,11 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync { pass: &mut ObjectId, pass_data: &mut crate::Data, ); - fn render_pass_execute_bundles<'a>( + fn render_pass_execute_bundles( &self, pass: &mut ObjectId, pass_data: &mut crate::Data, - render_bundles: Box + 'a>, + render_bundles: &mut dyn Iterator, ); } @@ -3112,15 +3110,15 @@ where Context::queue_copy_external_image_to_texture(self, &queue, queue_data, source, dest, size) } - fn queue_submit<'a>( + fn queue_submit( &self, queue: &ObjectId, queue_data: &crate::Data, - command_buffers: Box)> + 'a>, + command_buffers: &mut dyn Iterator)>, ) -> (ObjectId, Arc) { let queue = ::from(*queue); let queue_data = downcast_ref(queue_data); - let command_buffers = command_buffers.into_iter().map(|(id, data)| { + let command_buffers = command_buffers.map(|(id, data)| { let command_buffer_data: ::CommandBufferData = *data.downcast().unwrap(); (::from(id), command_buffer_data) }); @@ -4073,19 +4071,19 @@ where Context::render_pass_end_pipeline_statistics_query(self, &mut pass, pass_data) } - fn render_pass_execute_bundles<'a>( + fn render_pass_execute_bundles( &self, pass: &mut ObjectId, pass_data: &mut crate::Data, - render_bundles: Box + 'a>, + render_bundles: &mut dyn Iterator, ) { let mut pass = ::from(*pass); let pass_data = downcast_mut::(pass_data); - let render_bundles = Box::new(render_bundles.into_iter().map(|(id, data)| { + let mut render_bundles = render_bundles.map(|(id, data)| { let render_bundle_data: &::RenderBundleData = downcast_ref(data); (::from(*id), render_bundle_data) - })); - Context::render_pass_execute_bundles(self, &mut pass, pass_data, render_bundles) + }); + Context::render_pass_execute_bundles(self, &mut pass, pass_data, &mut render_bundles) } } diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index c7266d9bfb..f99425a12a 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -4112,19 +4112,16 @@ impl<'a> RenderPass<'a> { /// /// Commands in the bundle do not inherit this render pass's current render state, and after the /// bundle has executed, the state is **cleared** (reset to defaults, not the previous state). - pub fn execute_bundles + 'a>( - &mut self, - render_bundles: I, - ) { + pub fn execute_bundles>(&mut self, render_bundles: I) { + let mut render_bundles = render_bundles + .into_iter() + .map(|rb| (&rb.id, rb.data.as_ref())); + DynContext::render_pass_execute_bundles( &*self.parent.context, &mut self.id, self.data.as_mut(), - Box::new( - render_bundles - .into_iter() - .map(|rb| (&rb.id, rb.data.as_ref())), - ), + &mut render_bundles, ) } } @@ -4998,15 +4995,15 @@ impl Queue { &self, command_buffers: I, ) -> SubmissionIndex { + let mut command_buffers = command_buffers + .into_iter() + .map(|mut comb| (comb.id.take().unwrap(), comb.data.take().unwrap())); + let (raw, data) = DynContext::queue_submit( &*self.context, &self.id, self.data.as_ref(), - Box::new( - command_buffers - .into_iter() - .map(|mut comb| (comb.id.take().unwrap(), comb.data.take().unwrap())), - ), + &mut command_buffers, ); SubmissionIndex(raw, data)