aboutsummaryrefslogtreecommitdiff
path: root/layers/core_validation.cpp
diff options
context:
space:
mode:
authorChris Forbes <chrisforbes@google.com>2016-09-22 18:34:20 +1200
committerChris Forbes <chrisforbes@google.com>2016-09-27 09:08:45 +1300
commitb29a76ae34a91a94f6f5c1a3650a34e87431fe51 (patch)
tree6d9678d9b1ba3b981ada348d97571155746627a7 /layers/core_validation.cpp
parent68e48586641a526d87ff407bdcce555862422be5 (diff)
downloadusermoji-b29a76ae34a91a94f6f5c1a3650a34e87431fe51.tar.xz
layers: Move image-not-acquired etc from swapchain to core validation
Now that Core Validation tracks the acquisition state of every swapchain image, we can do this. Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers/core_validation.cpp')
-rw-r--r--layers/core_validation.cpp43
1 files changed, 30 insertions, 13 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 62b4ccd1..1d9eabc3 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -11254,19 +11254,36 @@ VKAPI_ATTR VkResult VKAPI_CALL QueuePresentKHR(VkQueue queue, const VkPresentInf
for (uint32_t i = 0; i < pPresentInfo->swapchainCount; ++i) {
auto swapchain_data = getSwapchainNode(dev_data, pPresentInfo->pSwapchains[i]);
- if (swapchain_data && pPresentInfo->pImageIndices[i] < swapchain_data->images.size()) {
- VkImage image = swapchain_data->images[pPresentInfo->pImageIndices[i]];
- skip_call |= ValidateImageMemoryIsValid(dev_data, getImageNode(dev_data, image), "vkQueuePresentKHR()");
- vector<VkImageLayout> layouts;
- if (FindLayouts(dev_data, image, layouts)) {
- for (auto layout : layouts) {
- if (layout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) {
- skip_call |=
- log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT,
- reinterpret_cast<uint64_t &>(queue), __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
- "Images passed to present must be in layout "
- "VK_IMAGE_LAYOUT_PRESENT_SRC_KHR but is in %s",
- string_VkImageLayout(layout));
+ if (swapchain_data) {
+ if (pPresentInfo->pImageIndices[i] >= swapchain_data->images.size()) {
+ skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
+ reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_INVALID_SWAPCHAIN_IMAGE,
+ "DS", "vkQueuePresentKHR: Swapchain image index too large (%u). There are only %u images in this swapchain.",
+ pPresentInfo->pImageIndices[i], (uint32_t)swapchain_data->images.size());
+ }
+ else {
+ auto image = swapchain_data->images[pPresentInfo->pImageIndices[i]];
+ auto image_node = getImageNode(dev_data, image);
+ skip_call |= ValidateImageMemoryIsValid(dev_data, image_node, "vkQueuePresentKHR()");
+
+ if (!image_node->acquired) {
+ skip_call |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
+ reinterpret_cast<uint64_t const &>(pPresentInfo->pSwapchains[i]), __LINE__, DRAWSTATE_SWAPCHAIN_IMAGE_NOT_ACQUIRED,
+ "DS", "vkQueuePresentKHR: Swapchain image index %u has not been acquired.",
+ pPresentInfo->pImageIndices[i]);
+ }
+
+ vector<VkImageLayout> layouts;
+ if (FindLayouts(dev_data, image, layouts)) {
+ for (auto layout : layouts) {
+ if (layout != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) {
+ skip_call |=
+ log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT,
+ reinterpret_cast<uint64_t &>(queue), __LINE__, DRAWSTATE_INVALID_IMAGE_LAYOUT, "DS",
+ "Images passed to present must be in layout "
+ "VK_IMAGE_LAYOUT_PRESENT_SRC_KHR but is in %s",
+ string_VkImageLayout(layout));
+ }
}
}
}