X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Fcommands_backend.cpp;h=54282c36b675235e9b642c099bf8b588adb40d0c;hb=a16145549dc87c3b12671f797bd77b14bcc7786b;hp=a5f2ceb5ad9dcd38789c14801cf0ca759a83b2ce;hpb=f4f81f1d86d50b29b9a44b237f67c6f5ad8f0523;p=libs%2Fgl.git diff --git a/source/backends/vulkan/commands_backend.cpp b/source/backends/vulkan/commands_backend.cpp index a5f2ceb5..54282c36 100644 --- a/source/backends/vulkan/commands_backend.cpp +++ b/source/backends/vulkan/commands_backend.cpp @@ -71,17 +71,20 @@ void VulkanCommands::begin_render_pass(bool clear, const ClearValue *clear_value Synchronizer &sync = device.get_synchronizer(); sync.reset(); - sync.barrier(current_buffer); bool to_present = false; unsigned n_attachments = framebuffer->get_format().size(); for(unsigned i=0; i(framebuffer->get_attachment(i))) to_present = true; + if(!to_present) + framebuffer->synchronize(clear); VkRenderPass render_pass = device.get_pipeline_cache().get_render_pass(framebuffer->get_format(), clear, !clear_values, to_present); framebuffer->refresh(); + sync.barrier(current_buffer); + VkRenderPassBeginInfo begin_info = { }; begin_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; begin_info.renderPass = handle_cast<::VkRenderPass>(render_pass); @@ -195,8 +198,6 @@ void VulkanCommands::use_pipeline(const PipelineState *ps) end_render_pass(); pipeline_state = ps; - if(pipeline_state) - pipeline_state->refresh(); } void VulkanCommands::clear(const ClearValue *values) @@ -222,6 +223,7 @@ void VulkanCommands::draw_instanced(const Batch &batch, unsigned count) if(!framebuffer) begin_render_pass(false, 0); + pipeline_state->refresh(); pipeline_state->apply(current_buffer); unsigned first_index = batch.get_offset()/batch.get_index_size(); vk.CmdDrawIndexed(current_buffer, batch.size(), count, first_index, 0, 0);