foo
[gph-gfx] / src / ggfx_vk.c
index dd8b832..ba42b86 100644 (file)
@@ -19,8 +19,10 @@ int ggfx_init(const char *appname, unsigned int flags)
        VkApplicationInfo appinf = {0};
        VkLayerProperties *lprop = 0;
        VkExtensionProperties *iext;
-       uint32_t i, j, num_inst_layers, num_inst_ext, lprop_count, iext_count;
+       uint32_t i, j, num_inst_layers, num_inst_ext, lprop_count, iext_count, pdev_count;
        char **inst_layers = 0, **inst_ext = 0;
+       VkPhysicalDevice *pdev;
+       VkPhysicalDeviceProperties pdevp;
 
        static const char *debug_layers[] = {
                "VK_LAYER_LUNARG_device_limits",
@@ -36,6 +38,7 @@ int ggfx_init(const char *appname, unsigned int flags)
        static const char *extensions[] = {
                "VK_KHR_surface",
                "VK_KHR_xlib_surface",
+               "VK_KHR_win32_surface",
                0
        };
 
@@ -119,6 +122,22 @@ int ggfx_init(const char *appname, unsigned int flags)
                return -1;
        }
 
+       if(vkEnumeratePhysicalDevices(vk, &pdev_count, 0) != 0 || !pdev_count) {
+               fprintf(stderr, "ggfx_init: failed to enumerate physical devices\n");
+               return -1;
+       }
+       if(!(pdev = malloc(pdev_count * sizeof *pdev))) {
+               perror("ggfx_init: failed to allocate memory for physical devices");
+               return -1;
+       }
+       vkEnumeratePhysicalDevices(vk, &pdev_count, pdev);
+
+       printf("Found %d physical devices\n", pdev_count);
+       for(i=0; i<pdev_count; i++) {
+               vkGetPhysicalDeviceProperties(pdev[i], &pdevp);
+               printf(" - %s\n", pdevp.deviceName);
+       }
+
        return 0;
 }