From f3e9f2010c37b31df1874d3217457bc030e94e94 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Fri, 20 Oct 2017 12:30:00 -0600 Subject: layers: Track WSI fences and semaphores Treat temporarily imported semaphores and fences from vkAcquireNextImageKHR as internal sync objects since the spec allows them to be waited on. Change-Id: I195bb7f4b65d141e9fb4a541817b4dc37b6aa600 --- layers/core_validation.cpp | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index 946cbbde..0cd14d73 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -9928,31 +9928,19 @@ static bool PreCallValidateAcquireNextImageKHR(layer_data *dev_data, VkDevice de static void PostCallRecordAcquireNextImageKHR(layer_data *dev_data, VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { auto pFence = GetFenceNode(dev_data, fence); - if (pFence) { - if (GetDeviceExtensions(dev_data)->vk_khr_external_fence) { - // A successful call with external fences enabled acts as a temporary import - if (pFence->scope == kSyncScopeInternal) { - pFence->scope = kSyncScopeExternalTemporary; - } - } else if (pFence->scope == kSyncScopeInternal) { - // A successful call without external fences acts as a signal operation - pFence->state = FENCE_INFLIGHT; - pFence->signaler.first = VK_NULL_HANDLE; // ANI isn't on a queue, so this can't participate in a completion proof. - } + if (pFence && pFence->scope == kSyncScopeInternal) { + // Treat as inflight since it is valid to wait on this fence, even in cases where it is technically a temporary + // import + pFence->state = FENCE_INFLIGHT; + pFence->signaler.first = VK_NULL_HANDLE; // ANI isn't on a queue, so this can't participate in a completion proof. } auto pSemaphore = GetSemaphoreNode(dev_data, semaphore); - if (pSemaphore) { - if (GetDeviceExtensions(dev_data)->vk_khr_external_semaphore) { - // A successful call with external semaphores enabled acts as a temporary import - if (pSemaphore->scope == kSyncScopeInternal) { - pSemaphore->scope = kSyncScopeExternalTemporary; - } - } else if (pSemaphore->scope == kSyncScopeInternal) { - // A successful call without external semaphores acts as a signal operation - pSemaphore->signaled = true; - pSemaphore->signaler.first = VK_NULL_HANDLE; - } + if (pSemaphore && pSemaphore->scope == kSyncScopeInternal) { + // Treat as signaled since it is valid to wait on this semaphore, even in cases where it is technically a + // temporary import + pSemaphore->signaled = true; + pSemaphore->signaler.first = VK_NULL_HANDLE; } // Mark the image as acquired. -- cgit v1.2.3