| OLD | NEW |
| (Empty) |
| 1 | |
| 2 /* | |
| 3 * Copyright 2016 Google Inc. | |
| 4 * | |
| 5 * Use of this source code is governed by a BSD-style license that can be | |
| 6 * found in the LICENSE file. | |
| 7 */ | |
| 8 | |
| 9 #include "VulkanTestContext_win.h" | |
| 10 | |
| 11 #include "vk/GrVkInterface.h" | |
| 12 #include "vk/GrVkUtil.h" | |
| 13 | |
| 14 // Platform dependant call | |
| 15 VkSurfaceKHR VulkanTestContext::createVkSurface(VkInstance instance, void* platf
ormData) { | |
| 16 static PFN_vkCreateWin32SurfaceKHR createWin32SurfaceKHR = nullptr; | |
| 17 if (!createWin32SurfaceKHR) { | |
| 18 createWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)vkGetInstanceProcAd
dr(instance, | |
| 19 "vkCrea
teWin32SurfaceKHR"); | |
| 20 } | |
| 21 | |
| 22 if (!platformData) { | |
| 23 return VK_NULL_HANDLE; | |
| 24 } | |
| 25 ContextPlatformData_win* winPlatformData = | |
| 26 reinterpret_cast<ContextPlatformData_
win*>(platformData); | |
| 27 VkSurfaceKHR surface; | |
| 28 | |
| 29 VkWin32SurfaceCreateInfoKHR surfaceCreateInfo; | |
| 30 memset(&surfaceCreateInfo, 0, sizeof(VkWin32SurfaceCreateInfoKHR)); | |
| 31 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; | |
| 32 surfaceCreateInfo.pNext = nullptr; | |
| 33 surfaceCreateInfo.flags = 0; | |
| 34 surfaceCreateInfo.hinstance = winPlatformData->fHInstance; | |
| 35 surfaceCreateInfo.hwnd = winPlatformData->fHWnd; | |
| 36 | |
| 37 VkResult res = createWin32SurfaceKHR(instance, &surfaceCreateInfo, nullptr,
&surface); | |
| 38 if (VK_SUCCESS != res) { | |
| 39 return VK_NULL_HANDLE; | |
| 40 } | |
| 41 | |
| 42 return surface; | |
| 43 } | |
| 44 | |
| 45 // Platform dependant call | |
| 46 bool VulkanTestContext::canPresent(VkInstance instance, VkPhysicalDevice physDev
, | |
| 47 uint32_t queueFamilyIndex) { | |
| 48 static PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR | |
| 49 getPhysicalDeviceWin32PresentationS
upportKHR = nullptr; | |
| 50 if (!getPhysicalDeviceWin32PresentationSupportKHR) { | |
| 51 getPhysicalDeviceWin32PresentationSupportKHR = | |
| 52 (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR) vkGetInstancePr
ocAddr(instance, | |
| 53 "vkGetPhysicalDeviceWin32Prese
ntationSupportKHR"); | |
| 54 } | |
| 55 | |
| 56 VkBool32 check = getPhysicalDeviceWin32PresentationSupportKHR(physDev, queue
FamilyIndex); | |
| 57 return (VK_FALSE != check); | |
| 58 } | |
| OLD | NEW |