MCPcopy Create free account
hub / github.com/crownengine/crown / createSurface

Method createSurface

3rdparty/bgfx/src/renderer_vk.cpp:7387–7564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7385 }
7386
7387 VkResult SwapChainVK::createSurface()
7388 {
7389 BGFX_PROFILER_SCOPE("SwapChainVK::createSurface", kColorFrame);
7390
7391 VkResult result = VK_ERROR_EXTENSION_NOT_PRESENT;
7392
7393 const VkInstance instance = s_renderVK->m_instance;
7394 const VkAllocationCallbacks* allocatorCb = s_renderVK->m_allocatorCb;
7395
7396#if BX_PLATFORM_WINDOWS
7397 {
7398 if (NULL != vkCreateWin32SurfaceKHR)
7399 {
7400 VkWin32SurfaceCreateInfoKHR sci;
7401 sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
7402 sci.pNext = NULL;
7403 sci.flags = 0;
7404 sci.hinstance = (HINSTANCE)GetModuleHandle(NULL);
7405 sci.hwnd = (HWND)m_nwh;
7406 result = vkCreateWin32SurfaceKHR(instance, &sci, allocatorCb, &m_surface);
7407 BX_WARN(VK_SUCCESS == result, "vkCreateWin32SurfaceKHR failed %d: %s.", result, getName(result) );
7408 }
7409 }
7410#elif BX_PLATFORM_ANDROID
7411 {
7412 if (NULL != vkCreateAndroidSurfaceKHR)
7413 {
7414 VkAndroidSurfaceCreateInfoKHR sci;
7415 sci.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
7416 sci.pNext = NULL;
7417 sci.flags = 0;
7418 sci.window = (ANativeWindow*)m_nwh;
7419 result = vkCreateAndroidSurfaceKHR(instance, &sci, allocatorCb, &m_surface);
7420 BX_WARN(VK_SUCCESS == result, "vkCreateAndroidSurfaceKHR failed %d: %s.", result, getName(result) );
7421 }
7422 }
7423#elif BX_PLATFORM_LINUX
7424 {
7425 if (g_platformData.type == bgfx::NativeWindowHandleType::Wayland)
7426 {
7427 if (s_extension[Extension::KHR_wayland_surface].m_supported
7428 && NULL != vkCreateWaylandSurfaceKHR
7429 )
7430 {
7431 BX_TRACE("Attempting Wayland surface creation.");
7432 VkWaylandSurfaceCreateInfoKHR sci;
7433 sci.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
7434 sci.pNext = NULL;
7435 sci.flags = 0;
7436 sci.display = (wl_display*)g_platformData.ndt;
7437 sci.surface = (wl_surface*)m_nwh;
7438 result = vkCreateWaylandSurfaceKHR(instance, &sci, allocatorCb, &m_surface);
7439 BX_WARN(VK_SUCCESS == result, "vkCreateWaylandSurfaceKHR failed %d: %s.", result, getName(result) );
7440 }
7441 }
7442 else
7443 {
7444 if (s_extension[Extension::KHR_xlib_surface].m_supported

Callers

nothing calls this directly

Calls 4

dlopenFunction · 0.85
dlsymFunction · 0.85
dlcloseFunction · 0.85
getNameFunction · 0.70

Tested by

no test coverage detected