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

Side by Side Diff: src/gpu/vk/GrVkBackendContext.cpp

Issue 2169543002: Use Windowing system-specific WindowContext factories. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: more xlib 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 | « include/gpu/vk/GrVkBackendContext.h ('k') | tools/viewer/sk_app/GLWindowContext.h » ('j') | 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 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "vk/GrVkBackendContext.h" 8 #include "vk/GrVkBackendContext.h"
9 #include "vk/GrVkExtensions.h" 9 #include "vk/GrVkExtensions.h"
10 #include "vk/GrVkInterface.h" 10 #include "vk/GrVkInterface.h"
(...skipping 22 matching lines...) Expand all
33 33
34 // the minimum version of Vulkan supported 34 // the minimum version of Vulkan supported
35 #ifdef SK_BUILD_FOR_ANDROID 35 #ifdef SK_BUILD_FOR_ANDROID
36 const uint32_t kGrVkMinimumVersion = VK_MAKE_VERSION(1, 0, 3); 36 const uint32_t kGrVkMinimumVersion = VK_MAKE_VERSION(1, 0, 3);
37 #else 37 #else
38 const uint32_t kGrVkMinimumVersion = VK_MAKE_VERSION(1, 0, 8); 38 const uint32_t kGrVkMinimumVersion = VK_MAKE_VERSION(1, 0, 8);
39 #endif 39 #endif
40 40
41 // Create the base Vulkan objects needed by the GrVkGpu object 41 // Create the base Vulkan objects needed by the GrVkGpu object
42 const GrVkBackendContext* GrVkBackendContext::Create(uint32_t* presentQueueIndex Ptr, 42 const GrVkBackendContext* GrVkBackendContext::Create(uint32_t* presentQueueIndex Ptr,
43 bool(*canPresent)(VkInstance, VkPhysicalDevice, uin t32_t queueIndex, 43 CanPresentFn canPresent) {
44 void* platformData),
45 void* platformData) {
46 VkPhysicalDevice physDev; 44 VkPhysicalDevice physDev;
47 VkDevice device; 45 VkDevice device;
48 VkInstance inst; 46 VkInstance inst;
49 VkResult err; 47 VkResult err;
50 48
51 const VkApplicationInfo app_info = { 49 const VkApplicationInfo app_info = {
52 VK_STRUCTURE_TYPE_APPLICATION_INFO, // sType 50 VK_STRUCTURE_TYPE_APPLICATION_INFO, // sType
53 nullptr, // pNext 51 nullptr, // pNext
54 "vktest", // pApplicationName 52 "vktest", // pApplicationName
55 0, // applicationVersion 53 0, // applicationVersion
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 graphicsQueueIndex = i; 152 graphicsQueueIndex = i;
155 break; 153 break;
156 } 154 }
157 } 155 }
158 SkASSERT(graphicsQueueIndex < queueCount); 156 SkASSERT(graphicsQueueIndex < queueCount);
159 157
160 // iterate to find the present queue, if needed 158 // iterate to find the present queue, if needed
161 uint32_t presentQueueIndex = graphicsQueueIndex; 159 uint32_t presentQueueIndex = graphicsQueueIndex;
162 if (presentQueueIndexPtr && canPresent) { 160 if (presentQueueIndexPtr && canPresent) {
163 for (uint32_t i = 0; i < queueCount; i++) { 161 for (uint32_t i = 0; i < queueCount; i++) {
164 if (canPresent(inst, physDev, i, platformData)) { 162 if (canPresent(inst, physDev, i)) {
165 presentQueueIndex = i; 163 presentQueueIndex = i;
166 break; 164 break;
167 } 165 }
168 } 166 }
169 SkASSERT(presentQueueIndex < queueCount); 167 SkASSERT(presentQueueIndex < queueCount);
170 *presentQueueIndexPtr = presentQueueIndex; 168 *presentQueueIndexPtr = presentQueueIndex;
171 } 169 }
172 170
173 extensions.initDevice(kGrVkMinimumVersion, inst, physDev); 171 extensions.initDevice(kGrVkMinimumVersion, inst, physDev);
174 172
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return ctx; 266 return ctx;
269 } 267 }
270 268
271 GrVkBackendContext::~GrVkBackendContext() { 269 GrVkBackendContext::~GrVkBackendContext() {
272 vkDeviceWaitIdle(fDevice); 270 vkDeviceWaitIdle(fDevice);
273 vkDestroyDevice(fDevice, nullptr); 271 vkDestroyDevice(fDevice, nullptr);
274 fDevice = VK_NULL_HANDLE; 272 fDevice = VK_NULL_HANDLE;
275 vkDestroyInstance(fInstance, nullptr); 273 vkDestroyInstance(fInstance, nullptr);
276 fInstance = VK_NULL_HANDLE; 274 fInstance = VK_NULL_HANDLE;
277 } 275 }
OLDNEW
« no previous file with comments | « include/gpu/vk/GrVkBackendContext.h ('k') | tools/viewer/sk_app/GLWindowContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698