Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1026)

Side by Side Diff: tools/viewer/sk_app/android/VulkanWindowContext_android.cpp

Issue 1944413005: More refactoring for Viewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix up Android Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "VulkanTestContext_android.h" 9 #include "VulkanWindowContext_android.h"
10 10
11 #include "vk/GrVkInterface.h" 11 #include "vk/GrVkInterface.h"
12 #include "vk/GrVkUtil.h" 12 #include "vk/GrVkUtil.h"
13 13
14 VkSurfaceKHR VulkanTestContext::createVkSurface(VkInstance instance, void* platf ormData) { 14 namespace sk_app {
15
16 VkSurfaceKHR VulkanWindowContext::createVkSurface(VkInstance instance, void* pla tformData) {
15 static PFN_vkCreateAndroidSurfaceKHR createAndroidSurfaceKHR = nullptr; 17 static PFN_vkCreateAndroidSurfaceKHR createAndroidSurfaceKHR = nullptr;
16 if (!createAndroidSurfaceKHR) { 18 if (!createAndroidSurfaceKHR) {
17 createAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)vkGetInstancePr ocAddr(instance, 19 createAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)vkGetInstancePr ocAddr(instance,
18 "vkCreate AndroidSurfaceKHR"); 20 "vkCreate AndroidSurfaceKHR");
19 } 21 }
20 22
21 if (!platformData) { 23 if (!platformData) {
22 return VK_NULL_HANDLE; 24 return VK_NULL_HANDLE;
23 } 25 }
24 ContextPlatformData_android* androidPlatformData = 26 ContextPlatformData_android* androidPlatformData =
25 reinterpret_cast<ContextPlatformData_ android*>(platformData); 27 reinterpret_cast<ContextPlatformData_ android*>(platformData);
26 VkSurfaceKHR surface; 28 VkSurfaceKHR surface;
27 29
28 VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo; 30 VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo;
29 memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR)); 31 memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR));
30 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; 32 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR;
31 surfaceCreateInfo.pNext = nullptr; 33 surfaceCreateInfo.pNext = nullptr;
32 surfaceCreateInfo.flags = 0; 34 surfaceCreateInfo.flags = 0;
33 surfaceCreateInfo.window = androidPlatformData->fNativeWindow; 35 surfaceCreateInfo.window = androidPlatformData->fNativeWindow;
34 36
35 VkResult res = createAndroidSurfaceKHR(instance, &surfaceCreateInfo, 37 VkResult res = createAndroidSurfaceKHR(instance, &surfaceCreateInfo,
36 nullptr, &surface); 38 nullptr, &surface);
37 return (VK_SUCCESS == res) ? surface : VK_NULL_HANDLE; 39 return (VK_SUCCESS == res) ? surface : VK_NULL_HANDLE;
38 } 40 }
39 41
40 bool VulkanTestContext::canPresent(VkInstance instance, VkPhysicalDevice physDev , 42 bool VulkanWindowContext::canPresent(VkInstance instance, VkPhysicalDevice physD ev,
41 uint32_t queueFamilyIndex) { 43 uint32_t queueFamilyIndex) {
42 return true; 44 return true;
43 } 45 }
46
47 } // namespace sk_app
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/android/VulkanWindowContext_android.h ('k') | tools/viewer/sk_app/android/Window_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698