aboutsummaryrefslogtreecommitdiff
path: root/layers/swapchain.cpp
diff options
context:
space:
mode:
authorIan Elliott <ianelliott@google.com>2016-04-06 14:29:56 -0600
committerIan Elliott <ianelliott@google.com>2016-04-07 09:08:37 -0600
commit0e3003dd1723975fd733088281f533ee2f7f5ff6 (patch)
treea35457a988c0015a2257dd93834d564cffef8e8d /layers/swapchain.cpp
parent3dc40893d158eb3bb6c32e2224a13900aa82d414 (diff)
downloadusermoji-0e3003dd1723975fd733088281f533ee2f7f5ff6.tar.xz
MR 289: layers: Change the test about "too many images".
Given new spec language coming out in early April (clarifying various aspects of acquiring presentable images), a change was needed to the WSI-swapchain validation layer. The new validate-layer test will work for "BlitModel" drivers that advertise a minImageCount of 1. Failing the test now results in an error instead of a performance warning.
Diffstat (limited to 'layers/swapchain.cpp')
-rw-r--r--layers/swapchain.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp
index c456352a..34f8ccbd 100644
--- a/layers/swapchain.cpp
+++ b/layers/swapchain.cpp
@@ -1745,31 +1745,36 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice de
if ((semaphore == VK_NULL_HANDLE) && (fence == VK_NULL_HANDLE)) {
skipCall |= LOG_ERROR(VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, device, "VkDevice", SWAPCHAIN_NO_SYNC_FOR_ACQUIRE,
"%s() called with both the semaphore and fence parameters set to "
- "VK_NULL_HANDLE (at least one should be used).", __FUNCTION__);
+ "VK_NULL_HANDLE (at least one should be used)\n.", __FUNCTION__);
}
SwpSwapchain *pSwapchain = &my_data->swapchainMap[swapchain];
- if (pSwapchain) {
- // Look to see if the application is trying to own too many images at
- // the same time (i.e. not leave any to display):
- uint32_t imagesOwnedByApp = 0;
+ SwpPhysicalDevice *pPhysicalDevice = pDevice->pPhysicalDevice;
+ if (pSwapchain && pPhysicalDevice && pPhysicalDevice->gotSurfaceCapabilities) {
+ // Look to see if the application has already acquired the maximum
+ // number of images, and this will push it past the spec-defined
+ // limits:
+ uint32_t minImageCount = pPhysicalDevice->surfaceCapabilities.minImageCount;
+ uint32_t imagesAcquiredByApp = 0;
for (uint32_t i = 0; i < pSwapchain->imageCount; i++) {
if (pSwapchain->images[i].ownedByApp) {
- imagesOwnedByApp++;
+ imagesAcquiredByApp++;
}
}
- if (imagesOwnedByApp >= (pSwapchain->imageCount - 1)) {
- skipCall |= LOG_PERF_WARNING(VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT, swapchain, "VkSwapchainKHR",
- SWAPCHAIN_APP_OWNS_TOO_MANY_IMAGES, "%s() called when the application "
- "already owns all presentable images "
- "in this swapchain except for the "
- "image currently being displayed. "
- "This call to %s() cannot succeed "
- "unless another thread calls the "
- "vkQueuePresentKHR() function in "
- "order to release ownership of one of "
- "the presentable images of this "
- "swapchain.",
- __FUNCTION__, __FUNCTION__);
+ if (imagesAcquiredByApp > (pSwapchain->imageCount - minImageCount)) {
+ skipCall |= LOG_ERROR(
+ VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT,
+ swapchain, "VkSwapchainKHR",
+ SWAPCHAIN_APP_ACQUIRES_TOO_MANY_IMAGES,
+ "%s() called when it cannot succeed. The application has "
+ "acquired %d image(s) that have not yet been presented. The "
+ "maximum number of images that the application can "
+ "simultaneously acquire from this swapchain (including this "
+ "call to %s()) is %d. That value is derived by subtracting "
+ "VkSurfaceCapabilitiesKHR::minImageCount (%d) from the number "
+ "of images in the swapchain (%d) and adding 1.\n",
+ __FUNCTION__, imagesAcquiredByApp, __FUNCTION__,
+ (pSwapchain->imageCount - minImageCount + 1),
+ minImageCount, pSwapchain->imageCount);
}
}
if (!pImageIndex) {