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

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

Issue 1785813002: Enable extension support and debug layer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixes for line endings and versioning Created 4 years, 9 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 | « src/gpu/vk/GrVkGpu.cpp ('k') | src/gpu/vk/GrVkUtil.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/GrVkInterface.h" 8 #include "vk/GrVkInterface.h"
9 #include "vk/GrVkUtil.h"
9 10
10 GrVkInterface::GrVkInterface() { 11 GrVkInterface::GrVkInterface() {
11 } 12 }
12 13
13 #define GET_PROC(F) functions->f ## F = (PFN_vk ## F) vkGetInstanceProcAddr(inst ance, "vk" #F) 14 #define GET_PROC(F) functions->f ## F = (PFN_vk ## F) vkGetInstanceProcAddr(inst ance, "vk" #F)
15 #define GET_PROC_LOCAL(inst, F) PFN_vk ## F F = (PFN_vk ## F) vkGetInstanceProcA ddr(inst, "vk" #F)
14 16
15 const GrVkInterface* GrVkCreateInterface(VkInstance instance) { 17 const GrVkInterface* GrVkCreateInterface(VkInstance instance) {
16 18
19 GET_PROC_LOCAL(nullptr, EnumerateInstanceExtensionProperties);
20 GET_PROC_LOCAL(instance, EnumerateDeviceExtensionProperties);
21 GET_PROC_LOCAL(nullptr, EnumerateInstanceLayerProperties);
22 GET_PROC_LOCAL(instance, EnumerateDeviceLayerProperties);
23
24 GrVkExtensions extensions;
25 if (!extensions.init(kGrVkMinimumVersion,
26 EnumerateInstanceExtensionProperties,
27 EnumerateDeviceExtensionProperties,
28 EnumerateInstanceLayerProperties,
29 EnumerateDeviceLayerProperties)) {
30 return nullptr;
31 }
32
17 GrVkInterface* interface = new GrVkInterface(); 33 GrVkInterface* interface = new GrVkInterface();
18 GrVkInterface::Functions* functions = &interface->fFunctions; 34 GrVkInterface::Functions* functions = &interface->fFunctions;
19 35
20 GET_PROC(CreateInstance); 36 GET_PROC(CreateInstance);
21 GET_PROC(DestroyInstance); 37 GET_PROC(DestroyInstance);
22 GET_PROC(EnumeratePhysicalDevices); 38 GET_PROC(EnumeratePhysicalDevices);
23 GET_PROC(GetPhysicalDeviceFeatures); 39 GET_PROC(GetPhysicalDeviceFeatures);
24 GET_PROC(GetPhysicalDeviceFormatProperties); 40 GET_PROC(GetPhysicalDeviceFormatProperties);
25 GET_PROC(GetPhysicalDeviceImageFormatProperties); 41 GET_PROC(GetPhysicalDeviceImageFormatProperties);
26 GET_PROC(GetPhysicalDeviceProperties); 42 GET_PROC(GetPhysicalDeviceProperties);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 GET_PROC(CmdBeginQuery); 161 GET_PROC(CmdBeginQuery);
146 GET_PROC(CmdEndQuery); 162 GET_PROC(CmdEndQuery);
147 GET_PROC(CmdResetQueryPool); 163 GET_PROC(CmdResetQueryPool);
148 GET_PROC(CmdWriteTimestamp); 164 GET_PROC(CmdWriteTimestamp);
149 GET_PROC(CmdCopyQueryPoolResults); 165 GET_PROC(CmdCopyQueryPoolResults);
150 GET_PROC(CmdPushConstants); 166 GET_PROC(CmdPushConstants);
151 GET_PROC(CmdBeginRenderPass); 167 GET_PROC(CmdBeginRenderPass);
152 GET_PROC(CmdNextSubpass); 168 GET_PROC(CmdNextSubpass);
153 GET_PROC(CmdEndRenderPass); 169 GET_PROC(CmdEndRenderPass);
154 GET_PROC(CmdExecuteCommands); 170 GET_PROC(CmdExecuteCommands);
171 // TODO: break these out with extension checks
155 GET_PROC(DestroySurfaceKHR); 172 GET_PROC(DestroySurfaceKHR);
156 GET_PROC(GetPhysicalDeviceSurfaceSupportKHR); 173 GET_PROC(GetPhysicalDeviceSurfaceSupportKHR);
157 GET_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR); 174 GET_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR);
158 GET_PROC(GetPhysicalDeviceSurfaceFormatsKHR); 175 GET_PROC(GetPhysicalDeviceSurfaceFormatsKHR);
159 GET_PROC(GetPhysicalDeviceSurfacePresentModesKHR); 176 GET_PROC(GetPhysicalDeviceSurfacePresentModesKHR);
160 GET_PROC(CreateSwapchainKHR); 177 GET_PROC(CreateSwapchainKHR);
161 GET_PROC(DestroySwapchainKHR); 178 GET_PROC(DestroySwapchainKHR);
162 GET_PROC(GetSwapchainImagesKHR); 179 GET_PROC(GetSwapchainImagesKHR);
163 GET_PROC(AcquireNextImageKHR); 180 GET_PROC(AcquireNextImageKHR);
164 GET_PROC(QueuePresentKHR); 181 GET_PROC(QueuePresentKHR);
165 GET_PROC(GetPhysicalDeviceDisplayPropertiesKHR); 182 GET_PROC(GetPhysicalDeviceDisplayPropertiesKHR);
166 GET_PROC(GetPhysicalDeviceDisplayPlanePropertiesKHR); 183 GET_PROC(GetPhysicalDeviceDisplayPlanePropertiesKHR);
167 GET_PROC(GetDisplayPlaneSupportedDisplaysKHR); 184 GET_PROC(GetDisplayPlaneSupportedDisplaysKHR);
168 GET_PROC(GetDisplayModePropertiesKHR); 185 GET_PROC(GetDisplayModePropertiesKHR);
169 GET_PROC(CreateDisplayModeKHR); 186 GET_PROC(CreateDisplayModeKHR);
170 GET_PROC(GetDisplayPlaneCapabilitiesKHR); 187 GET_PROC(GetDisplayPlaneCapabilitiesKHR);
171 GET_PROC(CreateDisplayPlaneSurfaceKHR); 188 GET_PROC(CreateDisplayPlaneSurfaceKHR);
172 GET_PROC(CreateSharedSwapchainsKHR); 189 GET_PROC(CreateSharedSwapchainsKHR);
173 190
191 if (extensions.hasInstanceExtension(VK_EXT_DEBUG_REPORT_EXTENSION_NAME)) {
192 GET_PROC(CreateDebugReportCallbackEXT);
193 GET_PROC(DebugReportMessageEXT);
194 GET_PROC(DestroyDebugReportCallbackEXT);
195 }
196
197 interface->fExtensions.swap(&extensions);
198
174 return interface; 199 return interface;
175 } 200 }
176 201
177 #define RETURN_FALSE_INTERFACE \ 202 #define RETURN_FALSE_INTERFACE \
178 if (kIsDebug) { SkDebugf("%s:%d GrVkInterface::validate() failed.\n", __FILE __, __LINE__); } \ 203 if (kIsDebug) { SkDebugf("%s:%d GrVkInterface::validate() failed.\n", __FILE __, __LINE__); } \
179 return false; 204 return false;
180 205
181 bool GrVkInterface::validate() const { 206 bool GrVkInterface::validate() const {
182 // functions that are always required 207 // functions that are always required
183 if (NULL == fFunctions.fCreateInstance || 208 if (NULL == fFunctions.fCreateInstance ||
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 NULL == fFunctions.fGetSwapchainImagesKHR || 350 NULL == fFunctions.fGetSwapchainImagesKHR ||
326 NULL == fFunctions.fAcquireNextImageKHR || 351 NULL == fFunctions.fAcquireNextImageKHR ||
327 NULL == fFunctions.fQueuePresentKHR || 352 NULL == fFunctions.fQueuePresentKHR ||
328 NULL == fFunctions.fGetPhysicalDeviceDisplayPropertiesKHR || 353 NULL == fFunctions.fGetPhysicalDeviceDisplayPropertiesKHR ||
329 NULL == fFunctions.fGetPhysicalDeviceDisplayPlanePropertiesKHR || 354 NULL == fFunctions.fGetPhysicalDeviceDisplayPlanePropertiesKHR ||
330 NULL == fFunctions.fGetDisplayPlaneSupportedDisplaysKHR || 355 NULL == fFunctions.fGetDisplayPlaneSupportedDisplaysKHR ||
331 NULL == fFunctions.fGetDisplayModePropertiesKHR || 356 NULL == fFunctions.fGetDisplayModePropertiesKHR ||
332 NULL == fFunctions.fCreateDisplayModeKHR || 357 NULL == fFunctions.fCreateDisplayModeKHR ||
333 NULL == fFunctions.fGetDisplayPlaneCapabilitiesKHR || 358 NULL == fFunctions.fGetDisplayPlaneCapabilitiesKHR ||
334 NULL == fFunctions.fCreateDisplayPlaneSurfaceKHR || 359 NULL == fFunctions.fCreateDisplayPlaneSurfaceKHR ||
335 NULL == fFunctions.fCreateSharedSwapchainsKHR) { 360 NULL == fFunctions.fCreateSharedSwapchainsKHR ||
361 NULL == fFunctions.fCreateDebugReportCallbackEXT ||
362 NULL == fFunctions.fDebugReportMessageEXT ||
363 NULL == fFunctions.fDestroyDebugReportCallbackEXT) {
336 return false; 364 return false;
337 } 365 }
338 return true; 366 return true;
339 } 367 }
340 368
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpu.cpp ('k') | src/gpu/vk/GrVkUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698