| 446 | } |
| 447 | |
| 448 | GPUSwapChainVulkan::Status GPUSwapChainVulkan::Present(QueueVulkan* presentQueue, SemaphoreVulkan* backBufferRenderingDoneSemaphore) |
| 449 | { |
| 450 | if (_currentImageIndex == -1) |
| 451 | return Status::Ok; |
| 452 | PROFILE_CPU_NAMED("vkQueuePresentKHR"); |
| 453 | |
| 454 | VkPresentInfoKHR presentInfo; |
| 455 | RenderToolsVulkan::ZeroStruct(presentInfo, VK_STRUCTURE_TYPE_PRESENT_INFO_KHR); |
| 456 | VkSemaphore semaphore; |
| 457 | if (backBufferRenderingDoneSemaphore) |
| 458 | { |
| 459 | presentInfo.waitSemaphoreCount = 1; |
| 460 | semaphore = backBufferRenderingDoneSemaphore->GetHandle(); |
| 461 | presentInfo.pWaitSemaphores = &semaphore; |
| 462 | } |
| 463 | presentInfo.swapchainCount = 1; |
| 464 | presentInfo.pSwapchains = &_swapChain; |
| 465 | presentInfo.pImageIndices = (uint32*)&_currentImageIndex; |
| 466 | |
| 467 | const VkResult presentResult = vkQueuePresentKHR(presentQueue->GetHandle(), &presentInfo); |
| 468 | if (presentResult == VK_ERROR_OUT_OF_DATE_KHR) |
| 469 | { |
| 470 | return Status::Outdated; |
| 471 | } |
| 472 | if (presentResult == VK_ERROR_SURFACE_LOST_KHR) |
| 473 | { |
| 474 | return Status::LostSurface; |
| 475 | } |
| 476 | #if GPU_ENABLE_ASSERTION |
| 477 | if (presentResult != VK_SUCCESS && presentResult != VK_SUBOPTIMAL_KHR) |
| 478 | { |
| 479 | VALIDATE_VULKAN_RESULT(presentResult); |
| 480 | } |
| 481 | #endif |
| 482 | |
| 483 | return Status::Ok; |
| 484 | } |
| 485 | |
| 486 | int32 GPUSwapChainVulkan::DoAcquireImageIndex(GPUSwapChainVulkan* viewport, void* customData) |
| 487 | { |
no test coverage detected