diff options
| author | Ian Elliott <ianelliott@google.com> | 2015-12-30 17:07:17 -0700 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2016-01-06 12:23:09 -0700 |
| commit | 5b2258c3dcb90522841fd68c5b69033dbe1eed03 (patch) | |
| tree | a57097118a8280d94126724d7a1bae3c1895c896 /layers/swapchain.cpp | |
| parent | bc8b32ce86083b6526ca3263ad3570a15dd0912b (diff) | |
| download | usermoji-5b2258c3dcb90522841fd68c5b69033dbe1eed03.tar.xz | |
Swapchain: Fixes and improvements validating vkQueuePresentKHR().
Diffstat (limited to 'layers/swapchain.cpp')
| -rw-r--r-- | layers/swapchain.cpp | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp index 25cec1ad..ff768167 100644 --- a/layers/swapchain.cpp +++ b/layers/swapchain.cpp @@ -1788,7 +1788,54 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR( VkBool32 skipCall = VK_FALSE; layer_data *my_data = get_my_data_ptr(get_dispatch_key(queue), layer_data_map); - for (uint32_t i = 0; i < pPresentInfo->swapchainCount ; i++) { + if (!pPresentInfo) { + skipCall |= LOG_ERROR_NULL_POINTER(VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + device, + "pPresentInfo"); + } else { + if (pPresentInfo->sType != VK_STRUCTURE_TYPE_PRESENT_INFO_KHR) { + skipCall |= LOG_ERROR_WRONG_STYPE(VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + device, + "pPresentInfo", + "VK_STRUCTURE_TYPE_PRESENT_INFO_KHR"); + } + if (pPresentInfo->pNext != NULL) { + skipCall |= LOG_ERROR_WRONG_NEXT(VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + device, + "pPresentInfo"); + } + if (!pPresentInfo->waitSemaphoreCount) { + skipCall |= LOG_ERROR_ZERO_VALUE(VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + device, + "pPresentInfo->waitSemaphoreCount"); + } + if (!pPresentInfo->pWaitSemaphores) { + skipCall |= LOG_ERROR_NULL_POINTER(VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + device, + "pPresentInfo->pWaitSemaphores"); + } + if (!pPresentInfo->swapchainCount) { + skipCall |= LOG_ERROR_ZERO_VALUE(VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + device, + "pPresentInfo->swapchainCount"); + } + if (!pPresentInfo->pSwapchains) { + skipCall |= LOG_ERROR_NULL_POINTER(VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + device, + "pPresentInfo->pSwapchains"); + } + if (!pPresentInfo->pImageIndices) { + skipCall |= LOG_ERROR_NULL_POINTER(VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + device, + "pPresentInfo->pImageIndices"); + } + // Note: pPresentInfo->pResults is allowed to be NULL + } + + for (uint32_t i = 0; + pPresentInfo && (i < pPresentInfo->swapchainCount); + i++) { + uint32_t swapchainCount = pPresentInfo->swapchainCount; uint32_t index = pPresentInfo->pImageIndices[i]; SwpSwapchain *pSwapchain = &my_data->swapchainMap[pPresentInfo->pSwapchains[i]]; @@ -1832,9 +1879,10 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR( if (VK_FALSE == skipCall) { // Call down the call chain: result = my_data->device_dispatch_table->QueuePresentKHR(queue, - pPresentInfo); + pPresentInfo); - if ((result == VK_SUCCESS) || (result == VK_SUBOPTIMAL_KHR)) { + if (pPresentInfo && + ((result == VK_SUCCESS) || (result == VK_SUBOPTIMAL_KHR))) { for (uint32_t i = 0; i < pPresentInfo->swapchainCount ; i++) { int index = pPresentInfo->pImageIndices[i]; SwpSwapchain *pSwapchain = |
