diff --git a/tools/hello.cpp b/tools/hello.cpp index 93cbb83..992bc92 100644 --- a/tools/hello.cpp +++ b/tools/hello.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -129,18 +130,15 @@ main (void) auto pdevices = cruft::vk::physical_device::find (instance); auto &pdevice = pdevices[0]; - VkSurfaceKHR surface; - cruft::vk::error::try_code ( - glfwCreateWindowSurface (instance.id (), window, nullptr, &surface) - ); + cruft::vk::surface surface { + cruft::vk::error::try_query ( + glfwCreateWindowSurface, instance.id (), window, nullptr + ) + }; auto surface_capabilities = pdevice.surface_capabilities (surface); - std::vector surface_formats = cruft::vk::error::try_array ( - vkGetPhysicalDeviceSurfaceFormatsKHR, pdevice.id (), surface - ); - std::vector present_modes = cruft::vk::error::try_array ( - vkGetPhysicalDeviceSurfacePresentModesKHR, pdevice.id (), surface - ); + auto surface_formats = pdevice.surface_formats (surface); + auto present_modes = pdevice.present_modes (surface); auto queues = pdevice.queue_families (); int graphics_queue_id = -1, present_queue_id = -1; @@ -150,7 +148,7 @@ main (void) VkBool32 present_support = false; cruft::vk::error::try_func ( - &vkGetPhysicalDeviceSurfaceSupportKHR, pdevice.id (), i, surface, &present_support + &vkGetPhysicalDeviceSurfaceSupportKHR, pdevice.id (), i, surface.id (), &present_support ); if (present_support) present_queue_id = i; @@ -222,7 +220,7 @@ main (void) .sType = cruft::vk::structure_type_v, .pNext = nullptr, .flags = {}, - .surface = surface, + .surface = surface.id (), .minImageCount = image_count, .imageFormat = surface_format.format, .imageColorSpace = surface_format.colorSpace,