OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2016 Google Inc. | 3 * Copyright 2016 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "../VulkanWindowContext.h" | 9 #include "../VulkanWindowContext.h" |
10 #include "Window_unix.h" | 10 #include "Window_unix.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 | 33 |
34 VkSurfaceKHR surface; | 34 VkSurfaceKHR surface; |
35 | 35 |
36 VkXcbSurfaceCreateInfoKHR surfaceCreateInfo; | 36 VkXcbSurfaceCreateInfoKHR surfaceCreateInfo; |
37 memset(&surfaceCreateInfo, 0, sizeof(VkXcbSurfaceCreateInfoKHR)); | 37 memset(&surfaceCreateInfo, 0, sizeof(VkXcbSurfaceCreateInfoKHR)); |
38 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; | 38 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; |
39 surfaceCreateInfo.pNext = nullptr; | 39 surfaceCreateInfo.pNext = nullptr; |
40 surfaceCreateInfo.flags = 0; | 40 surfaceCreateInfo.flags = 0; |
41 surfaceCreateInfo.connection = XGetXCBConnection(unixPlatformData->fDisplay)
; | 41 surfaceCreateInfo.connection = XGetXCBConnection(unixPlatformData->fDisplay)
; |
42 surfaceCreateInfo.window = unixPlatformData->fHWnd; | 42 surfaceCreateInfo.window = unixPlatformData->fWindow; |
43 | 43 |
44 VkResult res = createXcbSurfaceKHR(instance, &surfaceCreateInfo, nullptr, &s
urface); | 44 VkResult res = createXcbSurfaceKHR(instance, &surfaceCreateInfo, nullptr, &s
urface); |
45 if (VK_SUCCESS != res) { | 45 if (VK_SUCCESS != res) { |
46 return VK_NULL_HANDLE; | 46 return VK_NULL_HANDLE; |
47 } | 47 } |
48 | 48 |
49 return surface; | 49 return surface; |
50 } | 50 } |
51 | 51 |
52 // Platform dependant call | 52 // Platform dependant call |
53 bool VulkanWindowContext::canPresent(VkInstance instance, VkPhysicalDevice physD
ev, | 53 bool VulkanWindowContext::canPresent(VkInstance instance, VkPhysicalDevice physD
ev, |
54 uint32_t queueFamilyIndex, void* platformDa
ta) { | 54 uint32_t queueFamilyIndex, void* platformDa
ta) { |
55 static PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR | 55 static PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR |
56 getPhysicalDeviceXcbPresentationSupp
ortKHR = nullptr; | 56 getPhysicalDeviceXcbPresentationSupp
ortKHR = nullptr; |
57 if (!getPhysicalDeviceXcbPresentationSupportKHR) { | 57 if (!getPhysicalDeviceXcbPresentationSupportKHR) { |
58 getPhysicalDeviceXcbPresentationSupportKHR = | 58 getPhysicalDeviceXcbPresentationSupportKHR = |
59 (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR) vkGetInstanceProc
Addr(instance, | 59 (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR) vkGetInstanceProc
Addr(instance, |
60 "vkGetPhysicalDeviceXcbPresenta
tionSupportKHR"); | 60 "vkGetPhysicalDeviceXcbPresenta
tionSupportKHR"); |
61 } | 61 } |
62 | 62 |
63 ContextPlatformData_unix* unixPlatformData = | 63 ContextPlatformData_unix* unixPlatformData = |
64 reinterpret_cast<ContextPlatformData_u
nix*>(platformData); | 64 reinterpret_cast<ContextPlatformData_u
nix*>(platformData); |
65 | 65 |
66 Display* display = unixPlatformData->fDisplay; | 66 Display* display = unixPlatformData->fDisplay; |
| 67 VisualID visualID = unixPlatformData->fVisualInfo->visualid; |
67 VkBool32 check = getPhysicalDeviceXcbPresentationSupportKHR(physDev, | 68 VkBool32 check = getPhysicalDeviceXcbPresentationSupportKHR(physDev, |
68 queueFamilyIndex
, | 69 queueFamilyIndex
, |
69 XGetXCBConnectio
n(display), | 70 XGetXCBConnectio
n(display), |
70 unixPlatformData
->fVisualID); | 71 visualID); |
71 return (VK_FALSE != check); | 72 return (VK_FALSE != check); |
72 } | 73 } |
73 | 74 |
74 } // namespace sk_app | 75 } // namespace sk_app |
OLD | NEW |