diff options
| author | Michael Lentine <mlentine@google.com> | 2016-01-27 13:36:46 -0600 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2016-01-27 17:14:43 -0700 |
| commit | 9ea8f8458d466b4576f924da559045a5e6196ca3 (patch) | |
| tree | 8461bcc0f039956cedcb7958b81a9e72c72bcd80 | |
| parent | 5173753358432eb530769fbaaf266449afa134e9 (diff) | |
| download | usermoji-9ea8f8458d466b4576f924da559045a5e6196ca3.tar.xz | |
layers: MR169, Validate queueCount in param_checker
| -rw-r--r-- | layers/param_checker.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp index d515c810..732ac27c 100644 --- a/layers/param_checker.cpp +++ b/layers/param_checker.cpp @@ -2050,7 +2050,7 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties( PostGetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); } -void validateDeviceCreateInfo(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo) { +void validateDeviceCreateInfo(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const std::vector<VkQueueFamilyProperties> properties) { std::unordered_set<uint32_t> set; for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; ++i) { if (set.count(pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex)) { @@ -2069,6 +2069,13 @@ void validateDeviceCreateInfo(VkPhysicalDevice physicalDevice, const VkDeviceCre "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->pQueuePriorities[%d], must be between 0 and 1. Actual value is %f", i, j, pCreateInfo->pQueueCreateInfos[i].pQueuePriorities[j]); } } + if (pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex >= properties.size()) { + log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueFamilyIndex cannot be more than the number of queue families.", i); + } else if (pCreateInfo->pQueueCreateInfos[i].queueCount > properties[pCreateInfo->pQueueCreateInfos[i].queueFamilyIndex].queueCount) { + log_msg(mdd(physicalDevice), VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, 1, "PARAMCHECK", + "VkDeviceCreateInfo parameter, uint32_t pQueueCreateInfos[%d]->queueCount cannot be more than the number of queues for the given family index.", i); + } } } @@ -2105,7 +2112,12 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice( my_device_data->report_data = layer_debug_report_create_device(my_instance_data->report_data, *pDevice); initDeviceTable(*pDevice, fpGetDeviceProcAddr, pc_device_table_map); - validateDeviceCreateInfo(physicalDevice, pCreateInfo); + uint32_t count; + get_dispatch_table(pc_instance_table_map, physicalDevice)->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, nullptr); + std::vector<VkQueueFamilyProperties> properties(count); + get_dispatch_table(pc_instance_table_map, physicalDevice)->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, &count, &properties[0]); + + validateDeviceCreateInfo(physicalDevice, pCreateInfo, properties); return result; } |
