if(!primary_buffer)
begin_buffer(0);
- 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();
+ discard_fb_contents = (clear && !viewport);
- sync.barrier(primary_buffer);
+ framebuffer->refresh();
+ VkRenderPass render_pass = device.get_pipeline_cache().get_render_pass(framebuffer->get_format(), clear, (!clear_values && !viewport), fb_is_swapchain);
begin_buffer(render_pass);
StructureBuilder sb(pass_begin_info, 2);
vk.EndCommandBuffer(pass_buffer);
+ device.get_transfer_queue().dispatch_transfers(primary_buffer);
+
+ Synchronizer &sync = device.get_synchronizer();
+ sync.reset();
+ if(!fb_is_swapchain)
+ framebuffer->prepare_image_layouts(discard_fb_contents);
+ sync.barrier(primary_buffer);
+
const VkRenderPassBeginInfo &begin_info = *reinterpret_cast<const VkRenderPassBeginInfo *>(pass_begin_info.data());
vk.CmdBeginRenderPass(primary_buffer, begin_info, VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS);
vk.CmdExecuteCommands(primary_buffer, 1, &pass_buffer);