From be11b7ca84093dc6b2f44ecbae4cb4c9f3b4ecff Mon Sep 17 00:00:00 2001 From: Jeremy Kniager Date: Fri, 19 Jan 2018 10:55:01 -0700 Subject: layers: Add VU check for VkSwapchainCreateInfoKHR Added validation check for zero values in imageExtent of VkSwapchainCreateInfoKHR. No test included for this VU check as there is currently no clean method for creating a VkSurfaceKHR object in layer_validation_tests.cpp. Change-Id: I5b04543a837d1f1f7d8c20cec4f446df503a81ce --- layers/core_validation.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'layers/core_validation.cpp') diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index e34f0cc9..d88ef476 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -10118,6 +10118,15 @@ static bool PreCallValidateCreateSwapchainKHR(layer_data *dev_data, const char * "%s: pCreateInfo->oldSwapchain's surface is not pCreateInfo->surface", func_name)) return true; } + + if ((pCreateInfo->imageExtent.width == 0) || (pCreateInfo->imageExtent.height == 0)) { + if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, + HandleToUint64(dev_data->device), __LINE__, VALIDATION_ERROR_14600d32, "DS", + "%s: pCreateInfo->imageExtent = (%d, %d) which is illegal. %s", func_name, pCreateInfo->imageExtent.width, + pCreateInfo->imageExtent.height, validation_error_map[VALIDATION_ERROR_14600d32])) + return true; + } + auto physical_device_state = GetPhysicalDeviceState(dev_data->instance_data, dev_data->physical_device); if (physical_device_state->vkGetPhysicalDeviceSurfaceCapabilitiesKHRState == UNCALLED) { if (log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT, -- cgit v1.2.3