From 6ca2bd4707003f9290afe878eb3a5770cc30d5cd Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 29 Sep 2016 11:07:19 +0200 Subject: [PATCH] Tweak List::transition in framebuffer --- vulkano/src/framebuffer/framebuffer.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/vulkano/src/framebuffer/framebuffer.rs b/vulkano/src/framebuffer/framebuffer.rs index 81aba037..ed994290 100644 --- a/vulkano/src/framebuffer/framebuffer.rs +++ b/vulkano/src/framebuffer/framebuffer.rs @@ -333,16 +333,19 @@ unsafe impl AttachmentsList for List unsafe fn transition(&self, states: &mut States, num_command: usize) -> (usize, PipelineBarrierBuilder) { - let (rest_cmd, mut rest_barrier) = self.rest.transition(states, num_command); + let (mut rest_cmd, mut rest_barrier) = self.rest.transition(states, num_command); debug_assert!(rest_cmd <= num_command); - let (layout, stages, access) = { + let barrier = { // FIXME: depth-stencil and general layouts let layout = Layout::ColorAttachmentOptimal; + let stages = PipelineStages { color_attachment_output: true, + late_fragment_tests: true, ..PipelineStages::none() }; + let access = AccessFlagBits { color_attachment_read: true, color_attachment_write: true, @@ -350,14 +353,16 @@ unsafe impl AttachmentsList for List depth_stencil_attachment_write: true, .. AccessFlagBits::none() }; - (layout, stages, access) + + self.first.image().transition(states, num_command, 0, 1, + 0, 1 /* FIXME: */, true, layout, stages, access) }; - let barrier = self.first.image().transition(states, num_command, 0, 1, - 0, 1 /* FIXME: */, true, layout, stages, access); - if let Some(barrier) = barrier { - rest_barrier.add_image_barrier_request(self.first.image().inner(), barrier); + debug_assert!(barrier.after_command_num <= num_command); + rest_cmd = cmp::max(rest_cmd, barrier.after_command_num); + + rest_barrier.add_image_barrier_request(self.first.image().inner(), barrier); } (rest_cmd, rest_barrier)