diff --git a/drape/vulkan/vulkan_base_context.cpp b/drape/vulkan/vulkan_base_context.cpp index c82e7d3a24..2d6d0afc5c 100644 --- a/drape/vulkan/vulkan_base_context.cpp +++ b/drape/vulkan/vulkan_base_context.cpp @@ -294,6 +294,9 @@ void VulkanBaseContext::SetFramebuffer(ref_ptr framebuffer) { if (m_isActiveRenderPass) { + vkCmdEndRenderPass(m_renderingCommandBuffers[m_inflightFrameIndex]); + m_isActiveRenderPass = false; + if (m_currentFramebuffer != nullptr) { ref_ptr fb = m_currentFramebuffer; @@ -304,9 +307,6 @@ void VulkanBaseContext::SetFramebuffer(ref_ptr framebuffer) VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &imageBarrier); } - - vkCmdEndRenderPass(m_renderingCommandBuffers[m_inflightFrameIndex]); - m_isActiveRenderPass = false; } m_currentFramebuffer = framebuffer; @@ -332,7 +332,10 @@ void VulkanBaseContext::ApplyFramebuffer(std::string const & framebufferLabel) // are changed. auto const ops = m_framebuffersData[m_currentFramebuffer].m_packedAttachmentOperations; if (ops != packedAttachmentOperations) + { + vkDeviceWaitIdle(m_device); DestroyRenderPassAndFramebuffer(m_currentFramebuffer); + } // Initialize render pass. auto & fbData = m_framebuffersData[m_currentFramebuffer]; diff --git a/drape/vulkan/vulkan_texture.cpp b/drape/vulkan/vulkan_texture.cpp index 836396341c..d42a20afc3 100644 --- a/drape/vulkan/vulkan_texture.cpp +++ b/drape/vulkan/vulkan_texture.cpp @@ -201,7 +201,7 @@ void VulkanTexture::UploadData(ref_ptr context, uint32_t x, auto imageMemoryBarrier = PreTransferBarrier(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, m_textureObject.m_image); - vkCmdPipelineBarrier(commandBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + vkCmdPipelineBarrier(commandBuffer, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &imageMemoryBarrier); @@ -227,7 +227,7 @@ void VulkanTexture::Bind(ref_ptr context) const if (m_creationStagingBuffer != nullptr) { auto imageMemoryBarrier = PreTransferBarrier(VK_IMAGE_LAYOUT_UNDEFINED, m_textureObject.m_image); - vkCmdPipelineBarrier(commandBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + vkCmdPipelineBarrier(commandBuffer, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &imageMemoryBarrier);