| 2349 | } |
| 2350 | |
| 2351 | uint32_t SyncValidator::SetupPresentInfo(const VkPresentInfoKHR& present_info, BatchContextPtr& batch, |
| 2352 | PresentedImages& presented_images) { |
| 2353 | const VkSwapchainKHR* swapchains = present_info.pSwapchains; |
| 2354 | const uint32_t* image_indices = present_info.pImageIndices; |
| 2355 | const uint32_t swapchain_count = present_info.swapchainCount; |
| 2356 | |
| 2357 | presented_images.reserve(swapchain_count); |
| 2358 | for (uint32_t present_index = 0; present_index < swapchain_count; present_index++) { |
| 2359 | // Note: Given the "EraseIf" implementation for acquire fence waits, each presentation needs a unique tag. |
| 2360 | const ResourceUsageTag tag = presented_images.size(); |
| 2361 | presented_images.emplace_back(*this, batch, swapchains[present_index], image_indices[present_index], present_index, tag); |
| 2362 | if (presented_images.back().Invalid()) { |
| 2363 | presented_images.pop_back(); |
| 2364 | } |
| 2365 | } |
| 2366 | // Present is tagged for each swapchain. |
| 2367 | return static_cast<uint32_t>(presented_images.size()); |
| 2368 | } |
| 2369 | |
| 2370 | void SyncValidator::PostCallRecordAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, |
| 2371 | VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex, |