diff --git a/crates/bevy_render/src/view/mod.rs b/crates/bevy_render/src/view/mod.rs index 011d1971e7..b62222efc8 100644 --- a/crates/bevy_render/src/view/mod.rs +++ b/crates/bevy_render/src/view/mod.rs @@ -182,6 +182,20 @@ impl ViewTarget { } } + /// The _other_ "main" unsampled texture. + /// In most cases you should use [`Self::main_texture`] instead and never this. + /// The textures will naturally be swapped when [`Self::post_process_write`] is called. + /// + /// A use case for this is to be able to prepare a bind group for all main textures + /// ahead of time. + pub fn main_texture_other(&self) -> &TextureView { + if self.main_texture.load(Ordering::SeqCst) == 0 { + &self.main_textures.b + } else { + &self.main_textures.a + } + } + /// The "main" sampled texture. pub fn sampled_main_texture(&self) -> Option<&TextureView> { self.main_textures.sampled.as_ref()