| 244 | } |
| 245 | |
| 246 | void VulkanBaseContext::EndRendering() |
| 247 | { |
| 248 | // Flushing of the default staging buffer must be before submitting the queue. |
| 249 | // It guarantees the graphics data coherence. |
| 250 | m_defaultStagingBuffers[m_inflightFrameIndex]->Flush(); |
| 251 | |
| 252 | for (auto const & h : m_handlers[static_cast<uint32_t>(HandlerType::PrePresent)]) |
| 253 | h.second(m_inflightFrameIndex); |
| 254 | |
| 255 | CHECK(m_isActiveRenderPass, ()); |
| 256 | m_isActiveRenderPass = false; |
| 257 | vkCmdEndRenderPass(m_renderingCommandBuffers[m_inflightFrameIndex]); |
| 258 | |
| 259 | CHECK_VK_CALL(vkEndCommandBuffer(m_memoryCommandBuffers[m_inflightFrameIndex])); |
| 260 | CHECK_VK_CALL(vkEndCommandBuffer(m_renderingCommandBuffers[m_inflightFrameIndex])); |
| 261 | |
| 262 | VkSubmitInfo submitInfo = {}; |
| 263 | VkPipelineStageFlags const waitStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; |
| 264 | VkCommandBuffer commandBuffers[] = {m_memoryCommandBuffers[m_inflightFrameIndex], |
| 265 | m_renderingCommandBuffers[m_inflightFrameIndex]}; |
| 266 | submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; |
| 267 | submitInfo.pWaitDstStageMask = &waitStageMask; |
| 268 | submitInfo.pWaitSemaphores = &m_acquireSemaphores[m_inflightFrameIndex]; |
| 269 | submitInfo.waitSemaphoreCount = 1; |
| 270 | submitInfo.pSignalSemaphores = &m_renderSemaphores[m_inflightFrameIndex]; |
| 271 | submitInfo.signalSemaphoreCount = 1; |
| 272 | submitInfo.commandBufferCount = 2; |
| 273 | submitInfo.pCommandBuffers = commandBuffers; |
| 274 | |
| 275 | auto const res = vkQueueSubmit(m_queue, 1, &submitInfo, m_fences[m_inflightFrameIndex]); |
| 276 | if (res != VK_ERROR_DEVICE_LOST) |
| 277 | { |
| 278 | m_needPresent = true; |
| 279 | CHECK_RESULT_VK_CALL(vkQueueSubmit, res); |
| 280 | } |
| 281 | else |
| 282 | { |
| 283 | m_needPresent = false; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | void VulkanBaseContext::SetFramebuffer(ref_ptr<dp::BaseFramebuffer> framebuffer) |
| 288 | { |
no test coverage detected