OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2015 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 "VulkanTestContext_android.h" | 9 #include "VulkanTestContext_android.h" |
10 | 10 |
11 #include "vk/GrVkInterface.h" | 11 #include "vk/GrVkInterface.h" |
12 #include "../../src/gpu/vk/GrVkUtil.h" | 12 #include "vk/GrVkUtil.h" |
13 | 13 |
14 VkSurfaceKHR VulkanTestContext::createVkSurface(void* platformData) { | 14 VkSurfaceKHR VulkanTestContext::createVkSurface(VkInstance instance, void* platf
ormData) { |
15 // need better error handling here | 15 static PFN_vkCreateAndroidSurfaceKHR createAndroidSurfaceKHR = nullptr; |
16 SkASSERT(platformData); | 16 if (!createAndroidSurfaceKHR) { |
| 17 createAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)vkGetInstancePr
ocAddr(instance, |
| 18 "vkCreate
AndroidSurfaceKHR"); |
| 19 } |
| 20 |
| 21 if (!platformData) { |
| 22 return VK_NULL_HANDLE; |
| 23 } |
17 ContextPlatformData_android* androidPlatformData = | 24 ContextPlatformData_android* androidPlatformData = |
18 reinterpret_cast<ContextPlatformData_
android*>(platformData); | 25 reinterpret_cast<ContextPlatformData_
android*>(platformData); |
19 VkSurfaceKHR surface; | 26 VkSurfaceKHR surface; |
20 | 27 |
21 VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo; | 28 VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo; |
22 memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR)); | 29 memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR)); |
23 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; | 30 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; |
24 surfaceCreateInfo.pNext = nullptr; | 31 surfaceCreateInfo.pNext = nullptr; |
25 surfaceCreateInfo.flags = 0; | 32 surfaceCreateInfo.flags = 0; |
26 surfaceCreateInfo.window = androidPlatformData->fNativeWindow; | 33 surfaceCreateInfo.window = androidPlatformData->fNativeWindow; |
27 | 34 |
28 VkResult res = GR_VK_CALL(fBackendContext->fInterface, | 35 VkResult res = createAndroidSurfaceKHR(fBackendContext->fInstance, &surfaceC
reateInfo, |
29 CreateAndroidSurfaceKHR(fBackendContext->fInstance
, | 36 nullptr, &surface); |
30 &surfaceCreateInfo, | |
31 nullptr, &surface)); | |
32 return (VK_SUCCESS == res) ? surface : VK_NULL_HANDLE; | 37 return (VK_SUCCESS == res) ? surface : VK_NULL_HANDLE; |
33 } | 38 } |
34 | 39 |
35 bool VulkanTestContext::canPresent(uint32_t queueFamilyIndex) { | 40 bool VulkanTestContext::canPresent(VkInstance instance, VkPhysicalDevice physDev
, |
| 41 uint32_t queueFamilyIndex) { |
36 return true; | 42 return true; |
37 } | 43 } |
OLD | NEW |