15 VkSurfaceKHR vkSurface{VK_NULL_HANDLE};
17 #if defined(LUG_SYSTEM_WINDOWS) // Win32 surface 18 const VkWin32SurfaceCreateInfoKHR createInfo{
19 VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR,
26 VkResult result = vkCreateWin32SurfaceKHR(static_cast<VkInstance>(
_instance), &createInfo,
nullptr, &vkSurface);
27 #elif defined(LUG_SYSTEM_LINUX) // Linux surface 28 const VkXlibSurfaceCreateInfoKHR createInfo{
29 VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
36 VkResult result = vkCreateXlibSurfaceKHR(static_cast<VkInstance>(
_instance), &createInfo,
nullptr, &vkSurface);
37 #elif defined(LUG_SYSTEM_ANDROID) // Android Surface 38 const VkAndroidSurfaceCreateInfoKHR createInfo{
39 VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR,
45 VkResult result = vkCreateAndroidSurfaceKHR(static_cast<VkInstance>(
_instance), &createInfo,
nullptr, &vkSurface);
49 *returnResult = result;
52 if (result != VK_SUCCESS) {
62 std::unique_ptr<API::Surface> surface = std::make_unique<API::Surface>();
63 return build(*surface, returnResult) ? std::move(surface) :
nullptr;
Surface(const API::Instance &instance)
const API::Instance & _instance
bool build(API::Surface &instance, VkResult *returnResult=nullptr)