24 if (!sk_gpu_test::LoadVkLibraryAndGetProcAddrFuncs(&instProc)) {
28 auto createVkSurface = [hwnd, instProc] (VkInstance
instance) -> VkSurfaceKHR {
30 if (!createWin32SurfaceKHR) {
32 instProc(
instance,
"vkCreateWin32SurfaceKHR");
34 HINSTANCE hinstance = GetModuleHandle(0);
40 surfaceCreateInfo.
pNext =
nullptr;
41 surfaceCreateInfo.
flags = 0;
43 surfaceCreateInfo.
hwnd = hwnd;
53 auto canPresent = [instProc] (VkInstance
instance, VkPhysicalDevice physDev,
54 uint32_t queueFamilyIndex) {
56 getPhysicalDeviceWin32PresentationSupportKHR =
nullptr;
57 if (!getPhysicalDeviceWin32PresentationSupportKHR) {
58 getPhysicalDeviceWin32PresentationSupportKHR =
60 instProc(
instance,
"vkGetPhysicalDeviceWin32PresentationSupportKHR");
63 VkBool32 check = getPhysicalDeviceWin32PresentationSupportKHR(physDev, queueFamilyIndex);
67 std::unique_ptr<WindowContext> ctx(
68 new internal::VulkanWindowContext(
params, createVkSurface, canPresent, instProc));
69 if (!ctx->isValid()) {
#define check(reporter, ref, unref, make, kill)
const EmbeddedViewParams * params
std::unique_ptr< WindowContext > MakeVulkanForWin(HWND hwnd, const DisplayParams ¶ms)
VkWin32SurfaceCreateFlagsKHR flags
PFN_vkVoidFunction(VKAPI_PTR * PFN_vkGetInstanceProcAddr)(VkInstance instance, const char *pName)
@ VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR
VkResult(VKAPI_PTR * PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
VkBool32(VKAPI_PTR * PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex)