From 47a0c0317cc774c19b78582bec9b5b09d56f569a Mon Sep 17 00:00:00 2001 From: tcmal Date: Sun, 25 Aug 2024 17:44:23 +0100 Subject: feat(render): draw passes --- stockton-render/src/draw/draw_passes/mod.rs | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'stockton-render/src/draw/draw_passes/mod.rs') diff --git a/stockton-render/src/draw/draw_passes/mod.rs b/stockton-render/src/draw/draw_passes/mod.rs index 566a64b..70f1786 100644 --- a/stockton-render/src/draw/draw_passes/mod.rs +++ b/stockton-render/src/draw/draw_passes/mod.rs @@ -10,22 +10,21 @@ use anyhow::Result; mod cons; mod level; -pub use level::LevelDrawPass; pub use cons::{ConsDrawPass, NilDrawPass}; +pub use level::LevelDrawPass; /// One of several 'passes' that draw on each frame. pub trait DrawPass { /// Queue any necessary draw commands to cmd_buffer /// This should assume the command buffer isn't in the middle of a renderpass, and should leave it as such. - fn queue_draw(&self, session: &Session, cmd_buffer: &mut CommandBufferT) -> Result<()>; + fn queue_draw( + &mut self, + session: &Session, + img_view: &ImageViewT, + cmd_buffer: &mut CommandBufferT, + ) -> Result<()>; - /// This function should ask the queue negotatior to find families for any auxilary operations this draw pass needs to perform - /// For example, .find(&TexLoadQueue) - /// It should return then call .family_spec for each queue type negotiated and return the results. - fn find_aux_queues<'a>( - adapter: &'a Adapter, - queue_negotiator: &mut QueueNegotiator, - ) -> Result)>>; + fn deactivate(self, device: &mut Arc>) -> Result<()>; } /// A type that can be made into a specific draw pass type. @@ -33,8 +32,18 @@ pub trait DrawPass { pub trait IntoDrawPass { fn init( self, + session: &Session, + adapter: &Adapter, device: Arc>, queue_negotiator: &mut QueueNegotiator, swapchain_properties: &SwapchainProperties, ) -> Result; + + /// This function should ask the queue negotatior to find families for any auxilary operations this draw pass needs to perform + /// For example, .find(&TexLoadQueue) + /// It should return then call .family_spec for each queue type negotiated and return the results. + fn find_aux_queues<'a>( + adapter: &'a Adapter, + queue_negotiator: &mut QueueNegotiator, + ) -> Result)>>; } -- cgit v1.2.3