aboutsummaryrefslogtreecommitdiff
path: root/stockton-render/src/draw/draw_passes/cons.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:23 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:23 +0100
commit6eb9083b1f2fec63e17dc8ef462ea89bae0854b5 (patch)
tree814f670c38040c37408db06b66c9cb24550393e9 /stockton-render/src/draw/draw_passes/cons.rs
parent6ef351de4ba506e7f0f285569aa0e22255bb68c6 (diff)
feat(render): ui draw pass
Diffstat (limited to 'stockton-render/src/draw/draw_passes/cons.rs')
-rw-r--r--stockton-render/src/draw/draw_passes/cons.rs45
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)
+ }
+}