OLD | NEW |
(Empty) | |
| 1 |
| 2 /* |
| 3 * Copyright 2015 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 "../../src/gpu/vk/GrVkUtil.h" |
| 13 |
| 14 // Platform dependant call |
| 15 VkSurfaceKHR VulkanTestContext::createVkSurface(void* platformData) { |
| 16 // need better error handling here |
| 17 SkASSERT(platformData); |
| 18 ContextPlatformData_win* winPlatformData = |
| 19 reinterpret_cast<ContextPlatformData_
win*>(platformData); |
| 20 VkSurfaceKHR surface; |
| 21 |
| 22 VkWin32SurfaceCreateInfoKHR surfaceCreateInfo; |
| 23 memset(&surfaceCreateInfo, 0, sizeof(VkWin32SurfaceCreateInfoKHR)); |
| 24 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; |
| 25 surfaceCreateInfo.pNext = nullptr; |
| 26 surfaceCreateInfo.flags = 0; |
| 27 surfaceCreateInfo.hinstance = winPlatformData->fHInstance; |
| 28 surfaceCreateInfo.hwnd = winPlatformData->fHWnd; |
| 29 |
| 30 VkResult res = GR_VK_CALL(fBackendContext->fInterface, |
| 31 CreateWin32SurfaceKHR(fBackendContext->fInstance,
&surfaceCreateInfo, |
| 32 nullptr, &surface)); |
| 33 if (VK_SUCCESS != res) { |
| 34 return VK_NULL_HANDLE; |
| 35 } |
| 36 |
| 37 return surface; |
| 38 } |
| 39 |
| 40 // Platform dependant call |
| 41 bool VulkanTestContext::canPresent(uint32_t queueFamilyIndex) { |
| 42 VkBool32 check = GR_VK_CALL(fBackendContext->fInterface, |
| 43 GetPhysicalDeviceWin32PresentationSupportKHR( |
| 44 fBackendConte
xt->fPhysicalDevice, |
| 45 queueFamilyIn
dex)); |
| 46 return (VK_FALSE != check); |
| 47 } |
OLD | NEW |