X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=gph-gfx;a=blobdiff_plain;f=src%2Fggfx_vk.c;h=ba42b86651d5fd05b23b6a7a0d5a16dbf038f0f7;hp=dd8b832948fe5938516766cc4c26067a5f8a0957;hb=5ea3ab5302b95500424d61eab0dda97e98cc53d8;hpb=066a1766c12fd42bf2191842f1857c2a320942dd diff --git a/src/ggfx_vk.c b/src/ggfx_vk.c index dd8b832..ba42b86 100644 --- a/src/ggfx_vk.c +++ b/src/ggfx_vk.c @@ -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