aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-09-22 17:11:06 +1200
committerChris Forbes <chrisforbes@google.com>2016-09-27 09:08:45 +1300
commit68e48586641a526d87ff407bdcce555862422be5 (patch)
treee316be0fb1320277cea94660e923c27e9c490431 /layers/core_validation.cpp
parent5772b8fcbb80dd28f1930cb25398588094eac46c (diff)
downloadusermoji-68e48586641a526d87ff407bdcce555862422be5.tar.xz
layers: Add tracking of acquired state to Core Validation
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 129ab922..62b4ccd1 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -11290,6 +11290,22 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
}
}
+ for (uint32_t i = 0; i < pPresentInfo->swapchainCount; ++i) {
+ // Note: this is imperfect, in that we can get confused about what
+ // did or didn't succeed-- but if the app does that, it's confused
+ // itself just as much.
+ auto local_result = pPresentInfo->pResults ? pPresentInfo->pResults[i] : result;
+
+ if (local_result != VK_SUCCESS && local_result != VK_SUBOPTIMAL_KHR)
+ continue; // this present didn't actually happen.
+
+ // Mark the image as having been released to the WSI
+ auto swapchain_data = getSwapchainNode(dev_data, pPresentInfo->pSwapchains[i]);
+ auto image = swapchain_data->images[pPresentInfo->pImageIndices[i]];
+ auto image_node = getImageNode(dev_data, image);
+ image_node->acquired = false;
+ }
+
// Note: even though presentation is directed to a queue, there is no
// direct ordering between QP and subsequent work, so QP (and its
// semaphore waits) /never/ participate in any completion proof.
@@ -11353,6 +11369,12 @@ VKAPI_ATTR VkResult VKAPI_CALL AcquireNextImageKHR(VkDevice device, VkSwapchainK
pSemaphore->signaled = true;
pSemaphore->signaler.first = VK_NULL_HANDLE;
}
+
+ // Mark the image as acquired.
+ auto swapchain_data = getSwapchainNode(dev_data, swapchain);
+ auto image = swapchain_data->images[*pImageIndex];
+ auto image_node = getImageNode(dev_data, image);
+ image_node->acquired = true;
}
lock.unlock();