anv/device: fail to initialize device if we have queues with unsupported flags
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 6 Feb 2018 09:37:16 +0000 (10:37 +0100)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 7 Mar 2018 20:13:47 +0000 (12:13 -0800)
This is not strictly necessary since users should not be requesting any
flags that are not valid for the list of enabled features requested and
we already fail if they attempt to use an unsupported feature, however
it is an easy to implement sanity check that would help developes realize
that they are doing things wrong, so we might as well do it.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_device.c

index bccb669e4f2f05a570616375842a09dfd7e98eb0..a4237d6b2e5c2231dd04ffadd11a8adb8eb318e5 100644 (file)
@@ -1467,6 +1467,15 @@ VkResult anv_CreateDevice(
       }
    }
 
+   /* Check requested queues and fail if we are requested to create any
+    * queues with flags we don't support.
+    */
+   assert(pCreateInfo->queueCreateInfoCount > 0);
+   for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; i++) {
+      if (pCreateInfo->pQueueCreateInfos[i].flags != 0)
+         return vk_error(VK_ERROR_INITIALIZATION_FAILED);
+   }
+
    /* Check if client specified queue priority. */
    const VkDeviceQueueGlobalPriorityCreateInfoEXT *queue_priority =
       vk_find_struct_const(pCreateInfo->pQueueCreateInfos[0].pNext,