From 3a9a2cfa67d95b5b4c93a14ef39c08d0d9c17599 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Tue, 9 May 2017 08:21:15 -0600 Subject: layers: LX673, CreateWin32Surface Null HWND check Added NULL check to parameter validation, and assigned VU2505. All we can do is check for Null. Apparently, hInstance CAN be NULL. Change-Id: Ica5ead0514b7435ea9428dbd0018f53ff25462fd --- layers/parameter_validation.cpp | 6 ++++++ layers/vk_validation_error_database.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/layers/parameter_validation.cpp b/layers/parameter_validation.cpp index 19912167..1cdfad11 100644 --- a/layers/parameter_validation.cpp +++ b/layers/parameter_validation.cpp @@ -5306,6 +5306,12 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateWin32SurfaceKHR(VkInstance instance, const skip |= require_instance_extension(instance, &InstanceExtensions::khr_win32_surface, "vkCreateWin32SurfaceKHR", VK_KHR_WIN32_SURFACE_EXTENSION_NAME); + if (pCreateInfo->hwnd == nullptr) { + skip |= log_msg(my_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__, + VALIDATION_ERROR_02505, LayerName, + "vkCreateWin32SurfaceKHR(): hwnd must be a valid Win32 HWND but hwnd is NULL. %s", + validation_error_map[VALIDATION_ERROR_02505]); + } skip |= parameter_validation_vkCreateWin32SurfaceKHR(my_data->report_data, pCreateInfo, pAllocator, pSurface); diff --git a/layers/vk_validation_error_database.txt b/layers/vk_validation_error_database.txt index 1fac4ff5..b1530647 100644 --- a/layers/vk_validation_error_database.txt +++ b/layers/vk_validation_error_database.txt @@ -2331,7 +2331,7 @@ VALIDATION_ERROR_02501~^~N~^~Unknown~^~vkCmdProcessCommandsNVX~^~For more inform VALIDATION_ERROR_02502~^~N~^~Unknown~^~vkCmdProcessCommandsNVX~^~For more information refer to Vulkan Spec Section '28.4. Indirect Commands Generation' which states 'If sequencesIndexBuffer is not VK_NULL_HANDLE, sequencesIndexBuffer must be a valid VkBuffer handle' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkCmdProcessCommandsInfoNVX)~^~implicit VALIDATION_ERROR_02503~^~N~^~Unknown~^~vkCmdProcessCommandsNVX~^~For more information refer to Vulkan Spec Section '28.4. Indirect Commands Generation' which states 'Each of indirectCommandsLayout, objectTable, sequencesCountBuffer, sequencesIndexBuffer, and targetCommandBuffer that are valid handles must have been created, allocated, or retrieved from the same VkDevice' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkCmdProcessCommandsInfoNVX)~^~implicit VALIDATION_ERROR_02504~^~N~^~Unknown~^~vkCreateWin32SurfaceKHR~^~For more information refer to Vulkan Spec Section '30.2.4. Win32 Platform' which states 'hinstance must be a valid Win32 HINSTANCE.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkWin32SurfaceCreateInfoKHR)~^~ -VALIDATION_ERROR_02505~^~N~^~Unknown~^~vkCreateWin32SurfaceKHR~^~For more information refer to Vulkan Spec Section '30.2.4. Win32 Platform' which states 'hwnd must be a valid Win32 HWND.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkWin32SurfaceCreateInfoKHR)~^~ +VALIDATION_ERROR_02505~^~Y~^~None~^~vkCreateWin32SurfaceKHR~^~For more information refer to Vulkan Spec Section '30.2.4. Win32 Platform' which states 'hwnd must be a valid Win32 HWND.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkWin32SurfaceCreateInfoKHR)~^~ VALIDATION_ERROR_02506~^~N~^~Unknown~^~vkCreateXcbSurfaceKHR~^~For more information refer to Vulkan Spec Section '30.2.5. XCB Platform' which states 'window must be a valid X11 xcb_window_t.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkXcbSurfaceCreateInfoKHR)~^~ VALIDATION_ERROR_02507~^~N~^~Unknown~^~vkCreateXlibSurfaceKHR~^~For more information refer to Vulkan Spec Section '30.2.6. Xlib Platform' which states 'window must be a valid Xlib Window.' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkXlibSurfaceCreateInfoKHR)~^~ VALIDATION_ERROR_02508~^~N~^~Unknown~^~vkEnumerateDeviceExtensionProperties~^~For more information refer to Vulkan Spec Section '31.2. Extensions' which states 'If the value referenced by pPropertyCount is not 0, and pProperties is not NULL, pProperties must be a pointer to an array of pPropertyCount VkExtensionProperties structures' (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#vkEnumerateDeviceExtensionProperties)~^~implicit -- cgit v1.2.3