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

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

Issue 2239493002: Fix crash in viewer on certain android devices (Closed) Base URL: https://skia.googlesource.com/skia.git@4444
Patch Set: fix branch Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "WindowContextFactory_android.h" 9 #include "WindowContextFactory_android.h"
10 #include "../VulkanWindowContext.h" 10 #include "../VulkanWindowContext.h"
11 11
12 namespace sk_app { 12 namespace sk_app {
13 13
14 namespace window_context_factory { 14 namespace window_context_factory {
15 15
16 WindowContext* NewVulkanForAndroid(ANativeWindow* window, const DisplayParams& p arams) { 16 WindowContext* NewVulkanForAndroid(ANativeWindow* window, const DisplayParams& p arams) {
17 auto createVkSurface = [window] (VkInstance instance) -> VkSurfaceKHR { 17 auto createVkSurface = [window] (VkInstance instance) -> VkSurfaceKHR {
18 static PFN_vkCreateAndroidSurfaceKHR createAndroidSurfaceKHR = nullptr; 18 PFN_vkCreateAndroidSurfaceKHR createAndroidSurfaceKHR =
19 if (!createAndroidSurfaceKHR) { 19 (PFN_vkCreateAndroidSurfaceKHR)vkGetInstanceProcAddr(instance,
20 createAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)vkGetInstan ceProcAddr( 20 "vkCreateAn droidSurfaceKHR");
21 instance, "vkCreateAndroidSurfaceKHR");
22 }
23 21
24 if (!window) { 22 if (!window) {
25 return VK_NULL_HANDLE; 23 return VK_NULL_HANDLE;
26 } 24 }
27 VkSurfaceKHR surface; 25 VkSurfaceKHR surface;
28 26
29 VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo; 27 VkAndroidSurfaceCreateInfoKHR surfaceCreateInfo;
30 memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR)); 28 memset(&surfaceCreateInfo, 0, sizeof(VkAndroidSurfaceCreateInfoKHR));
31 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_ KHR; 29 surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_ KHR;
32 surfaceCreateInfo.pNext = nullptr; 30 surfaceCreateInfo.pNext = nullptr;
(...skipping 10 matching lines...) Expand all
43 WindowContext* ctx = new VulkanWindowContext(params, createVkSurface, canPre sent); 41 WindowContext* ctx = new VulkanWindowContext(params, createVkSurface, canPre sent);
44 if (!ctx->isValid()) { 42 if (!ctx->isValid()) {
45 delete ctx; 43 delete ctx;
46 return nullptr; 44 return nullptr;
47 } 45 }
48 return ctx; 46 return ctx;
49 } 47 }
50 48
51 } // namespace window_context_factory 49 } // namespace window_context_factory
52 } // namespace sk_app 50 } // namespace sk_app
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698