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

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

Issue 1832613003: Revise layer, extension and feature setup for Vulkan (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove extra def of ENABLE_VK_LAYERS 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/GrVkBackendContext.h"
9 #include "vk/GrVkUtil.h" 10 #include "vk/GrVkUtil.h"
10 11
11 GrVkInterface::GrVkInterface() { 12 GrVkInterface::GrVkInterface() {
12 } 13 }
13 14
14 #define GET_PROC(F) functions->f ## F = (PFN_vk ## F) vkGetInstanceProcAddr(inst ance, "vk" #F) 15 #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) 16 #define GET_PROC_LOCAL(inst, F) PFN_vk ## F F = (PFN_vk ## F) vkGetInstanceProcA ddr(inst, "vk" #F)
16 #define GET_DEV_PROC(F) functions->f ## F = (PFN_vk ## F) vkGetDeviceProcAddr(de vice, "vk" #F) 17 #define GET_DEV_PROC(F) functions->f ## F = (PFN_vk ## F) vkGetDeviceProcAddr(de vice, "vk" #F)
17 18
18 const GrVkInterface* GrVkCreateInterface(VkInstance instance, VkPhysicalDevice p hysDev, 19 const GrVkInterface* GrVkCreateInterface(VkInstance instance, VkDevice device,
19 VkDevice device) { 20 uint32_t extensionFlags) {
20
21 GET_PROC_LOCAL(nullptr, EnumerateInstanceExtensionProperties);
22 GET_PROC_LOCAL(instance, EnumerateDeviceExtensionProperties);
23 GET_PROC_LOCAL(nullptr, EnumerateInstanceLayerProperties);
24 GET_PROC_LOCAL(instance, EnumerateDeviceLayerProperties);
25
26 GrVkExtensions extensions;
27 if (!extensions.init(kGrVkMinimumVersion,
28 physDev,
29 EnumerateInstanceExtensionProperties,
30 EnumerateDeviceExtensionProperties,
31 EnumerateInstanceLayerProperties,
32 EnumerateDeviceLayerProperties)) {
33 return nullptr;
34 }
35 21
36 GrVkInterface* interface = new GrVkInterface(); 22 GrVkInterface* interface = new GrVkInterface();
37 GrVkInterface::Functions* functions = &interface->fFunctions; 23 GrVkInterface::Functions* functions = &interface->fFunctions;
38 24
39 GET_PROC(CreateInstance); 25 GET_PROC(CreateInstance);
40 GET_PROC(DestroyInstance); 26 GET_PROC(DestroyInstance);
41 GET_PROC(EnumeratePhysicalDevices); 27 GET_PROC(EnumeratePhysicalDevices);
42 GET_PROC(GetPhysicalDeviceFeatures); 28 GET_PROC(GetPhysicalDeviceFeatures);
43 GET_PROC(GetPhysicalDeviceFormatProperties); 29 GET_PROC(GetPhysicalDeviceFormatProperties);
44 GET_PROC(GetPhysicalDeviceImageFormatProperties); 30 GET_PROC(GetPhysicalDeviceImageFormatProperties);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 GET_DEV_PROC(QueuePresentKHR); 170 GET_DEV_PROC(QueuePresentKHR);
185 GET_PROC(GetPhysicalDeviceDisplayPropertiesKHR); 171 GET_PROC(GetPhysicalDeviceDisplayPropertiesKHR);
186 GET_PROC(GetPhysicalDeviceDisplayPlanePropertiesKHR); 172 GET_PROC(GetPhysicalDeviceDisplayPlanePropertiesKHR);
187 GET_PROC(GetDisplayPlaneSupportedDisplaysKHR); 173 GET_PROC(GetDisplayPlaneSupportedDisplaysKHR);
188 GET_PROC(GetDisplayModePropertiesKHR); 174 GET_PROC(GetDisplayModePropertiesKHR);
189 GET_PROC(CreateDisplayModeKHR); 175 GET_PROC(CreateDisplayModeKHR);
190 GET_PROC(GetDisplayPlaneCapabilitiesKHR); 176 GET_PROC(GetDisplayPlaneCapabilitiesKHR);
191 GET_PROC(CreateDisplayPlaneSurfaceKHR); 177 GET_PROC(CreateDisplayPlaneSurfaceKHR);
192 GET_DEV_PROC(CreateSharedSwapchainsKHR); 178 GET_DEV_PROC(CreateSharedSwapchainsKHR);
193 179
194 if (extensions.hasInstanceExtension(VK_EXT_DEBUG_REPORT_EXTENSION_NAME)) { 180 if (extensionFlags & kEXT_debug_report_GrVkExtensionFlag) {
195 GET_PROC(CreateDebugReportCallbackEXT); 181 GET_PROC(CreateDebugReportCallbackEXT);
196 GET_PROC(DebugReportMessageEXT); 182 GET_PROC(DebugReportMessageEXT);
197 GET_PROC(DestroyDebugReportCallbackEXT); 183 GET_PROC(DestroyDebugReportCallbackEXT);
198 } 184 }
199 185
200 interface->fExtensions.swap(&extensions);
201
202 return interface; 186 return interface;
203 } 187 }
204 188
205 #define RETURN_FALSE_INTERFACE \ 189 #define RETURN_FALSE_INTERFACE \
206 if (kIsDebug) { SkDebugf("%s:%d GrVkInterface::validate() failed.\n", __FILE __, __LINE__); } \ 190 if (kIsDebug) { SkDebugf("%s:%d GrVkInterface::validate() failed.\n", __FILE __, __LINE__); } \
207 return false; 191 return false;
208 192
209 bool GrVkInterface::validate() const { 193 bool GrVkInterface::validate() const {
210 // functions that are always required 194 // functions that are always required
211 if (NULL == fFunctions.fCreateInstance || 195 if (NULL == fFunctions.fCreateInstance ||
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 NULL == fFunctions.fCmdPipelineBarrier || 319 NULL == fFunctions.fCmdPipelineBarrier ||
336 NULL == fFunctions.fCmdBeginQuery || 320 NULL == fFunctions.fCmdBeginQuery ||
337 NULL == fFunctions.fCmdEndQuery || 321 NULL == fFunctions.fCmdEndQuery ||
338 NULL == fFunctions.fCmdResetQueryPool || 322 NULL == fFunctions.fCmdResetQueryPool ||
339 NULL == fFunctions.fCmdWriteTimestamp || 323 NULL == fFunctions.fCmdWriteTimestamp ||
340 NULL == fFunctions.fCmdCopyQueryPoolResults || 324 NULL == fFunctions.fCmdCopyQueryPoolResults ||
341 NULL == fFunctions.fCmdPushConstants || 325 NULL == fFunctions.fCmdPushConstants ||
342 NULL == fFunctions.fCmdBeginRenderPass || 326 NULL == fFunctions.fCmdBeginRenderPass ||
343 NULL == fFunctions.fCmdNextSubpass || 327 NULL == fFunctions.fCmdNextSubpass ||
344 NULL == fFunctions.fCmdEndRenderPass || 328 NULL == fFunctions.fCmdEndRenderPass ||
345 NULL == fFunctions.fCmdExecuteCommands || 329 NULL == fFunctions.fCmdExecuteCommands
346 NULL == fFunctions.fDestroySurfaceKHR || 330 #ifdef VK_CHECK_ALL_FUNCTIONS
347 NULL == fFunctions.fGetPhysicalDeviceSurfaceSupportKHR || 331 // || NULL == fFunctions.fDestroySurfaceKHR ||
348 NULL == fFunctions.fGetPhysicalDeviceSurfaceCapabilitiesKHR || 332 //NULL == fFunctions.fGetPhysicalDeviceSurfaceSupportKHR ||
349 NULL == fFunctions.fGetPhysicalDeviceSurfaceFormatsKHR || 333 //NULL == fFunctions.fGetPhysicalDeviceSurfaceCapabilitiesKHR ||
350 NULL == fFunctions.fGetPhysicalDeviceSurfacePresentModesKHR || 334 //NULL == fFunctions.fGetPhysicalDeviceSurfaceFormatsKHR ||
351 NULL == fFunctions.fCreateSwapchainKHR || 335 //NULL == fFunctions.fGetPhysicalDeviceSurfacePresentModesKHR ||
352 NULL == fFunctions.fDestroySwapchainKHR || 336 //NULL == fFunctions.fCreateSwapchainKHR ||
353 NULL == fFunctions.fGetSwapchainImagesKHR || 337 //NULL == fFunctions.fDestroySwapchainKHR ||
354 NULL == fFunctions.fAcquireNextImageKHR || 338 //NULL == fFunctions.fGetSwapchainImagesKHR ||
355 NULL == fFunctions.fQueuePresentKHR || 339 //NULL == fFunctions.fAcquireNextImageKHR ||
356 NULL == fFunctions.fGetPhysicalDeviceDisplayPropertiesKHR || 340 //NULL == fFunctions.fQueuePresentKHR ||
357 NULL == fFunctions.fGetPhysicalDeviceDisplayPlanePropertiesKHR || 341 //NULL == fFunctions.fGetPhysicalDeviceDisplayPropertiesKHR ||
358 NULL == fFunctions.fGetDisplayPlaneSupportedDisplaysKHR || 342 //NULL == fFunctions.fGetPhysicalDeviceDisplayPlanePropertiesKHR ||
359 NULL == fFunctions.fGetDisplayModePropertiesKHR || 343 //NULL == fFunctions.fGetDisplayPlaneSupportedDisplaysKHR ||
360 NULL == fFunctions.fCreateDisplayModeKHR || 344 //NULL == fFunctions.fGetDisplayModePropertiesKHR ||
361 NULL == fFunctions.fGetDisplayPlaneCapabilitiesKHR || 345 //NULL == fFunctions.fCreateDisplayModeKHR ||
362 NULL == fFunctions.fCreateDisplayPlaneSurfaceKHR || 346 //NULL == fFunctions.fGetDisplayPlaneCapabilitiesKHR ||
363 NULL == fFunctions.fCreateSharedSwapchainsKHR || 347 //NULL == fFunctions.fCreateDisplayPlaneSurfaceKHR ||
364 NULL == fFunctions.fCreateDebugReportCallbackEXT || 348 //NULL == fFunctions.fCreateSharedSwapchainsKHR ||
365 NULL == fFunctions.fDebugReportMessageEXT || 349 //NULL == fFunctions.fCreateDebugReportCallbackEXT ||
366 NULL == fFunctions.fDestroyDebugReportCallbackEXT) { 350 //NULL == fFunctions.fDebugReportMessageEXT ||
351 //NULL == fFunctions.fDestroyDebugReportCallbackEXT) {
352 #else
353 ) {
354 #endif
367 return false; 355 return false;
368 } 356 }
369 return true; 357 return true;
370 } 358 }
371 359
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