demos: Query device features in cube prior to creating device
authorTobin Ehlis <tobin@lunarg.com>
Thu, 24 Sep 2015 21:18:22 +0000 (15:18 -0600)
committerTobin Ehlis <tobin@lunarg.com>
Tue, 29 Sep 2015 16:58:42 +0000 (10:58 -0600)
demos/cube.c

index 6c1f4d7eef86dbf4b248e09e8b724ca7d4cecc4a..b33986837aa296ff641491da0479134a53eb658a 100644 (file)
@@ -2273,6 +2273,12 @@ static void demo_init_vk(struct demo *demo)
             break;
     }
     assert(gfx_queue_idx < demo->queue_count);
+    // Query fine-grained feature support for this device.
+    //  If app has specific feature requirements it should check supported features based on this query
+    VkPhysicalDeviceFeatures physDevFeatures = {};
+    err = vkGetPhysicalDeviceFeatures(demo->gpu, &physDevFeatures);
+    assert(!err);
+
     const VkDeviceQueueCreateInfo queue = {
         .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
         .pNext = NULL,
@@ -2289,6 +2295,7 @@ static void demo_init_vk(struct demo *demo)
         .ppEnabledLayerNames = (const char *const*) ((demo->validate) ? device_validation_layers : NULL),
         .extensionCount = enabled_extension_count,
         .ppEnabledExtensionNames = (const char *const*) extension_names,
+        .pEnabledFeatures = NULL, // If specific features are required, pass them in here
     };
 
     err = vkCreateDevice(demo->gpu, &device, &demo->device);