From be1f36119d86cbdd2483fcbe0b6368e15cfdc1d2 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Tue, 22 Sep 2015 14:00:58 -0600 Subject: layers: DeviceLimits warns if queue properties not queried prior to vkCreateDevice() --- layers/device_limits.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'layers/device_limits.cpp') diff --git a/layers/device_limits.cpp b/layers/device_limits.cpp index e242f8cc..add4afc9 100644 --- a/layers/device_limits.cpp +++ b/layers/device_limits.cpp @@ -298,16 +298,26 @@ static void createDeviceRegisterExtensions(const VkDeviceCreateInfo* pCreateInfo VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice) { - // Check that the requested queue properties are valid - for (uint32_t i=0; iqueueRecordCount; i++) { - uint32_t requestedIndex = pCreateInfo->pRequestedQueues[i].queueFamilyIndex; - auto qfp_it = queueFamilyPropertiesMap[gpu].find(requestedIndex); - if (qfp_it == queueFamilyPropertiesMap[gpu].end()) { // requested index is out of bounds for this physical device - log_msg(mdd(gpu), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PHYSICAL_DEVICE, 0, 0, DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, "DL", - "Invalid queue create request in vkCreateDevice(). Invalid queueFamilyIndex %u requested.", requestedIndex); - } else if (pCreateInfo->pRequestedQueues[i].queueCount > qfp_it->second->queueCount) { - log_msg(mdd(gpu), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PHYSICAL_DEVICE, 0, 0, DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, "DL", - "Invalid queue create request in vkCreateDevice(). QueueFamilyIndex %u only has %u queues, but requested queueCount is %u.", requestedIndex, qfp_it->second->queueCount, pCreateInfo->pRequestedQueues[i].queueCount); + // First check is app has actually requested queueFamilyProperties + auto it = physicalDeviceMap.find(gpu); + if (it == physicalDeviceMap.end()) { + log_msg(mdd(gpu), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PHYSICAL_DEVICE, 0, 0, DEVLIMITS_MUST_QUERY_COUNT, "DL", + "Invalid call to vkCreateDevice() w/o first calling vkEnumeratePhysicalDevices()."); + } else if (QUERY_DETAILS != it->second->vkGetPhysicalDeviceQueueFamilyPropertiesState) { + log_msg(mdd(gpu), VK_DBG_REPORT_WARN_BIT, VK_OBJECT_TYPE_PHYSICAL_DEVICE, 0, 0, DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, "DL", + "Invalid call to vkCreateDevice() w/o first calling vkGetPhysicalDeviceQueueFamilyProperties()."); + } else { + // Check that the requested queue properties are valid + for (uint32_t i=0; iqueueRecordCount; i++) { + uint32_t requestedIndex = pCreateInfo->pRequestedQueues[i].queueFamilyIndex; + auto qfp_it = queueFamilyPropertiesMap[gpu].find(requestedIndex); + if (qfp_it == queueFamilyPropertiesMap[gpu].end()) { // requested index is out of bounds for this physical device + log_msg(mdd(gpu), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PHYSICAL_DEVICE, 0, 0, DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, "DL", + "Invalid queue create request in vkCreateDevice(). Invalid queueFamilyIndex %u requested.", requestedIndex); + } else if (pCreateInfo->pRequestedQueues[i].queueCount > qfp_it->second->queueCount) { + log_msg(mdd(gpu), VK_DBG_REPORT_ERROR_BIT, VK_OBJECT_TYPE_PHYSICAL_DEVICE, 0, 0, DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, "DL", + "Invalid queue create request in vkCreateDevice(). QueueFamilyIndex %u only has %u queues, but requested queueCount is %u.", requestedIndex, qfp_it->second->queueCount, pCreateInfo->pRequestedQueues[i].queueCount); + } } } VkLayerDispatchTable *pDeviceTable = get_dispatch_table(device_limits_device_table_map, *pDevice); -- cgit v1.2.3