demos: Simplify vulkaninfo to not enable any extensions.
authorJon Ashburn <jon@lunarg.com>
Fri, 25 Mar 2016 18:47:06 +0000 (12:47 -0600)
committerJon Ashburn <jon@lunarg.com>
Fri, 25 Mar 2016 19:36:54 +0000 (13:36 -0600)
For the Linux WSI surface extensions  where BOTH ICD and loader support is
needed for an extension to be supported there was an issue.  If ICD supported
extensions was not equal to loader supported extensions vulkaninfo would error
exit.

Change-Id: Ib6e07d92491b04b1fb90cbf1c6793ae766944d50

demos/vulkaninfo.c

index 7fb13f5..f7ad630 100644 (file)
@@ -455,10 +455,6 @@ static void app_dev_init(struct app_dev *dev, struct app_gpu *gpu) {
         .ppEnabledExtensionNames = NULL,
     };
     VkResult U_ASSERT_ONLY err;
-    // Extensions to enable
-    static const char *known_extensions[] = {
-        VK_KHR_SWAPCHAIN_EXTENSION_NAME,
-    };
 
     uint32_t count = 0;
 
@@ -508,33 +504,14 @@ static void app_dev_init(struct app_dev *dev, struct app_gpu *gpu) {
 
     fflush(stdout);
 
-    uint32_t enabled_extension_count = 0;
-    uint32_t known_extension_count = ARRAY_SIZE(known_extensions);
-
-    for (uint32_t i = 0; i < known_extension_count; i++) {
-        VkBool32 extension_found = 0;
-        for (uint32_t j = 0; j < gpu->device_extension_count; j++) {
-            VkExtensionProperties *ext_prop = &gpu->device_extensions[j];
-            if (!strcmp(known_extensions[i], ext_prop->extensionName)) {
-
-                extension_found = 1;
-                enabled_extension_count++;
-            }
-        }
-        if (!extension_found) {
-            printf("Cannot find extension: %s\n", known_extensions[i]);
-            ERR_EXIT(VK_ERROR_EXTENSION_NOT_PRESENT);
-        }
-    }
-
     /* request all queues */
     info.queueCreateInfoCount = gpu->queue_count;
     info.pQueueCreateInfos = gpu->queue_reqs;
 
     info.enabledLayerCount = 0;
     info.ppEnabledLayerNames = NULL;
-    info.enabledExtensionCount = enabled_extension_count;
-    info.ppEnabledExtensionNames = (const char *const *)known_extensions;
+    info.enabledExtensionCount = 0;
+    info.ppEnabledExtensionNames = NULL;
     dev->gpu = gpu;
     err = vkCreateDevice(gpu->obj, &info, NULL, &dev->obj);
     if (err)
@@ -591,30 +568,7 @@ static void app_create_instance(struct app_instance *inst) {
         .ppEnabledExtensionNames = NULL,
     };
     VkResult U_ASSERT_ONLY err;
-    // Global Extensions to enable
-    static char *known_extensions[] = {
-        VK_KHR_SURFACE_EXTENSION_NAME,
-#ifdef VK_USE_PLATFORM_ANDROID_KHR
-        VK_KHR_ANDROID_SURFACE_EXTENSION_NAME,
-#endif
-#ifdef VK_USE_PLATFORM_MIR_KHR
-        VK_KHR_MIR_SURFACE_EXTENSION_NAME,
-#endif
-#ifdef VK_USE_PLATFORM_WAYLAND_KHR
-        VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,
-#endif
-#ifdef VK_USE_PLATFORM_WIN32_KHR
-        VK_KHR_WIN32_SURFACE_EXTENSION_NAME,
-#endif
-#ifdef VK_USE_PLATFORM_XCB_KHR
-        VK_KHR_XCB_SURFACE_EXTENSION_NAME,
-#endif
-#ifdef VK_USE_PLATFORM_XLIB_KHR
-        VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
-#endif
-    };
 
-    uint32_t global_extension_count = 0;
     uint32_t count = 0;
 
     /* Scan layers */
@@ -663,24 +617,6 @@ static void app_create_instance(struct app_instance *inst) {
     app_get_global_layer_extensions(NULL, &inst->global_extension_count,
                                     &inst->global_extensions);
 
-    for (uint32_t i = 0; i < ARRAY_SIZE(known_extensions); i++) {
-        VkBool32 extension_found = 0;
-        for (uint32_t j = 0; j < inst->global_extension_count; j++) {
-            VkExtensionProperties *extension_prop = &inst->global_extensions[j];
-            if (!strcmp(known_extensions[i], extension_prop->extensionName)) {
-
-                extension_found = 1;
-                global_extension_count++;
-            }
-        }
-        if (!extension_found) {
-            printf("Cannot find extension: %s\n", known_extensions[i]);
-            ERR_EXIT(VK_ERROR_EXTENSION_NOT_PRESENT);
-        }
-    }
-
-    inst_info.enabledExtensionCount = global_extension_count;
-    inst_info.ppEnabledExtensionNames = (const char *const *)known_extensions;
 
     VkDebugReportCallbackCreateInfoEXT dbg_info;
     memset(&dbg_info, 0, sizeof(dbg_info));