From c233d6e0d06478a0c58e479db4800c3537c9c8b0 Mon Sep 17 00:00:00 2001 From: Remi Godin <129818497+Remi-Godin@users.noreply.github.com> Date: Thu, 4 Apr 2024 20:46:15 -0700 Subject: [PATCH] Added method to get waiting pipelines IDs from pipeline cache. (#12874) # Objective - Add a way to easily get currently waiting pipelines IDs. ## Solution - Added a method to get waiting pipelines `CachedPipelineId`. --------- Co-authored-by: James Liu --- crates/bevy_render/src/render_resource/pipeline_cache.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/bevy_render/src/render_resource/pipeline_cache.rs b/crates/bevy_render/src/render_resource/pipeline_cache.rs index f24ab7d8b5..bd20f44e2e 100644 --- a/crates/bevy_render/src/render_resource/pipeline_cache.rs +++ b/crates/bevy_render/src/render_resource/pipeline_cache.rs @@ -494,10 +494,16 @@ pub struct PipelineCache { } impl PipelineCache { + /// Returns an iterator over the pipelines in the pipeline cache. pub fn pipelines(&self) -> impl Iterator { self.pipelines.iter() } + /// Returns a iterator of the IDs of all currently waiting pipelines. + pub fn waiting_pipelines(&self) -> impl Iterator + '_ { + self.waiting_pipelines.iter().copied() + } + /// Create a new pipeline cache associated with the given render device. pub fn new( device: RenderDevice,