21 if (!sk_gpu_test::LoadVkLibraryAndGetProcAddrFuncs(&instProc)) {
25 auto createVkSurface = [hwnd, instProc] (VkInstance
instance) -> VkSurfaceKHR {
27 if (!createWin32SurfaceKHR) {
29 instProc(
instance,
"vkCreateWin32SurfaceKHR");
31 HINSTANCE hinstance = GetModuleHandle(0);
37 surfaceCreateInfo.
pNext =
nullptr;
38 surfaceCreateInfo.
flags = 0;
40 surfaceCreateInfo.
hwnd = hwnd;
50 auto canPresent = [instProc] (VkInstance
instance, VkPhysicalDevice physDev,
51 uint32_t queueFamilyIndex) {
53 getPhysicalDeviceWin32PresentationSupportKHR =
nullptr;
54 if (!getPhysicalDeviceWin32PresentationSupportKHR) {
55 getPhysicalDeviceWin32PresentationSupportKHR =
57 instProc(
instance,
"vkGetPhysicalDeviceWin32PresentationSupportKHR");
60 VkBool32 check = getPhysicalDeviceWin32PresentationSupportKHR(physDev, queueFamilyIndex);
64 std::unique_ptr<WindowContext> ctx(
65 new internal::GraphiteVulkanWindowContext(
params, createVkSurface,
66 canPresent, instProc));
67 if (!ctx->isValid()) {
#define check(reporter, ref, unref, make, kill)
const EmbeddedViewParams * params
std::unique_ptr< WindowContext > MakeGraphiteVulkanForWin(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)