- // TODO Use proper value for to_present
- VkRenderPass render_pass = device.get_pipeline_cache().get_render_pass(target->get_format(), clear, !clear_values, true);
+ Synchronizer &sync = device.get_synchronizer();
+ sync.reset();
+
+ fb_is_swapchain = false;
+ unsigned n_attachments = framebuffer->get_format().size();
+ for(unsigned i=0; (!fb_is_swapchain && i<n_attachments); ++i)
+ if(dynamic_cast<const SwapChainTexture *>(framebuffer->get_attachment(i)))
+ fb_is_swapchain = true;
+ if(!fb_is_swapchain)
+ framebuffer->prepare_image_layouts(clear && !viewport);
+ VkRenderPass render_pass = device.get_pipeline_cache().get_render_pass(framebuffer->get_format(), clear, (!clear_values && !viewport), fb_is_swapchain);
+
+ framebuffer->refresh();