diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:21 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:21 +0100 |
commit | 48ebe87925c4aca8fb9ab8f120b327b677f6812c (patch) | |
tree | 7d92d0693eee18fed953375eeeb087bf576b481e | |
parent | 92e7aea7472693236e43c84cab603d78fdcebed0 (diff) |
refactor(render): remove draw_clear function
-rw-r--r-- | stockton-render/src/draw/context.rs | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/stockton-render/src/draw/context.rs b/stockton-render/src/draw/context.rs index a02203d..86c2270 100644 --- a/stockton-render/src/draw/context.rs +++ b/stockton-render/src/draw/context.rs @@ -646,82 +646,6 @@ impl<'a> RenderingContext<'a> { Ok((layout, pipeline)) } - /// Draw a frame that's just cleared to the color specified. - pub fn draw_clear(&mut self, color: [f32; 4]) -> Result<(), error::FrameError> { - let get_image = &self.get_image[self.current_frame]; - let render_complete = &self.render_complete[self.current_frame]; - - // Advance the frame _before_ we start using the `?` operator - self.current_frame = (self.current_frame + 1) % self.frames_in_flight; - - // Get the image - let (image_index, _) = unsafe { - self - .swapchain - .acquire_image(core::u64::MAX, Some(get_image), None) - .map_err(|e| error::FrameError::AcquireError (e))? - }; - let image_index = image_index as usize; - - // Make sure whatever was last using this has finished - let present_complete = &self.present_complete[image_index]; - unsafe { - self.device - .wait_for_fence(present_complete, core::u64::MAX) - .map_err(|_| error::FrameError::SyncObjectError)?; - self.device - .reset_fence(present_complete) - .map_err(|_| error::FrameError::SyncObjectError)?; - }; - - // Record commands - unsafe { - use hal::command::{ClearValue, ClearColor, SubpassContents, CommandBufferFlags}; - - let buffer = &mut self.cmd_buffers[image_index]; - let clear_values = [ClearValue { - color: ClearColor { - float32: color - } - }]; - - buffer.begin_primary(CommandBufferFlags::EMPTY); - buffer.begin_render_pass( - &self.renderpass, - &self.framebuffers[image_index], - self.viewport.rect, - clear_values.iter(), - SubpassContents::Inline - ); - buffer.end_render_pass(); - buffer.finish(); - }; - - // Make submission object - let command_buffers = &self.cmd_buffers[image_index..=image_index]; - let wait_semaphores: ArrayVec<[_; 1]> = [(get_image, hal::pso::PipelineStage::COLOR_ATTACHMENT_OUTPUT)].into(); - let signal_semaphores: ArrayVec<[_; 1]> = [render_complete].into(); - - let present_wait_semaphores: ArrayVec<[_; 1]> = [render_complete].into(); - - let submission = Submission { - command_buffers, - wait_semaphores, - signal_semaphores, - }; - - // Submit it - let command_queue = &mut self.queue_group.queues[0]; - unsafe { - command_queue.submit(submission, Some(present_complete)); - self.swapchain - .present(command_queue, image_index as u32, present_wait_semaphores) - .map_err(|_| error::FrameError::PresentError)? - }; - - Ok(()) - } - /// Draw all vertices in the buffer pub fn draw_vertices(&mut self) -> Result<(), &'static str> { let get_image = &self.get_image[self.current_frame]; |