diff options
Diffstat (limited to 'stockton-render/src/draw/draw_passes/cons.rs')
-rw-r--r-- | stockton-render/src/draw/draw_passes/cons.rs | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/stockton-render/src/draw/draw_passes/cons.rs b/stockton-render/src/draw/draw_passes/cons.rs index 542c26a..3209806 100644 --- a/stockton-render/src/draw/draw_passes/cons.rs +++ b/stockton-render/src/draw/draw_passes/cons.rs @@ -3,7 +3,7 @@ use std::sync::{Arc, RwLock}; -use super::DrawPass; +use super::{DrawPass, IntoDrawPass}; use crate::types::*; use stockton_types::Session; @@ -11,8 +11,8 @@ use anyhow::Result; /// One draw pass, then another. pub struct ConsDrawPass<A: DrawPass, B: DrawPass> { - a: A, - b: B, + pub a: A, + pub b: B, } impl<A: DrawPass, B: DrawPass> DrawPass for ConsDrawPass<A, B> { @@ -33,3 +33,42 @@ impl<A: DrawPass, B: DrawPass> DrawPass for ConsDrawPass<A, B> { self.b.deactivate(device) } } + +impl<A: DrawPass, B: DrawPass, IA: IntoDrawPass<A>, IB: IntoDrawPass<B>> + IntoDrawPass<ConsDrawPass<A, B>> for (IA, IB) +{ + fn init( + self, + session: &Session, + adapter: &Adapter, + device: Arc<RwLock<DeviceT>>, + queue_negotiator: &mut crate::draw::queue_negotiator::QueueNegotiator, + swapchain_properties: &crate::draw::target::SwapchainProperties, + ) -> Result<ConsDrawPass<A, B>> { + Ok(ConsDrawPass { + a: self.0.init( + session, + adapter, + device.clone(), + queue_negotiator, + swapchain_properties, + )?, + b: self.1.init( + session, + adapter, + device, + queue_negotiator, + swapchain_properties, + )?, + }) + } + + fn find_aux_queues<'a>( + adapter: &'a Adapter, + queue_negotiator: &mut crate::draw::queue_negotiator::QueueNegotiator, + ) -> Result<Vec<(&'a QueueFamilyT, Vec<f32>)>> { + let mut v = IA::find_aux_queues(adapter, queue_negotiator)?; + v.extend(IB::find_aux_queues(adapter, queue_negotiator)?); + Ok(v) + } +} |