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